Skip to content

Instantly share code, notes, and snippets.

@arnabdas
Created June 22, 2020 05:54
Show Gist options
  • Select an option

  • Save arnabdas/589035c25d40c308df926d303c8d8587 to your computer and use it in GitHub Desktop.

Select an option

Save arnabdas/589035c25d40c308df926d303c8d8587 to your computer and use it in GitHub Desktop.

Revisions

  1. arnabdas created this gist Jun 22, 2020.
    100 changes: 100 additions & 0 deletions cpp.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,100 @@
    {
    // Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and
    // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
    // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
    // same ids are connected.
    // Example:
    // "Print to console": {
    // "prefix": "log",
    // "body": [
    // "console.log('$1');",
    // "$2"
    // ],
    // "description": "Log output to console"
    // }
    "New CPP": {
    "prefix": "!",
    "body": [
    "/******** All Required Header Files ********/",
    "#include <iostream>",
    "#include <string>",
    "#include <vector>",
    "#include <algorithm>",
    "#include <sstream>",
    "#include <queue>",
    "#include <deque>",
    "#include <bitset>",
    "#include <iterator>",
    "#include <list>",
    "#include <stack>",
    "#include <map>",
    "#include <set>",
    "#include <functional>",
    "#include <numeric>",
    "#include <utility>",
    "#include <limits>",
    "#include <time.h>",
    "#include <math.h>",
    "#include <stdio.h>",
    "#include <string.h>",
    "#include <stdlib.h>",
    "#include <assert.h>",
    "",
    "using namespace std;",
    "",
    "/******* All Required define Pre-Processors and typedef Constants *******/",
    "#define SCD(t) scanf(\"%d\",&t)",
    "#define SCLD(t) scanf(\"%ld\",&t)",
    "#define SCLLD(t) scanf(\"%lld\",&t)",
    "#define SCC(t) scanf(\"%c\",&t)",
    "#define SCS(t) scanf(\"%s\",t)",
    "#define SCF(t) scanf(\"%f\",&t)",
    "#define SCLF(t) scanf(\"%lf\",&t)",
    "#define MEM(a, b) memset(a, (b), sizeof(a))",
    "#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)",
    "#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)",
    "#define REP(i, j) FOR(i, 0, j, 1)",
    "#define RREP(i, j) RFOR(i, j, 0, 1)",
    "#define all(cont) cont.begin(), cont.end()",
    "#define rall(cont) cont.end(), cont.begin()",
    "#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)",
    "#define IN(A, B, C) assert( B <= A && A <= C)",
    "#define MP make_pair",
    "#define PB push_back",
    "#define INF (int)1e9",
    "#define EPS 1e-9",
    "#define PI 3.1415926535897932384626433832795",
    "#define MOD 1000000007",
    "#define read(type) readInt<type>()",
    "const double pi=acos(-1.0);",
    "typedef pair<int, int> PII;",
    "typedef vector<int> VI;",
    "typedef vector<string> VS;",
    "typedef vector<PII> VII;",
    "typedef vector<VI> VVI;",
    "typedef map<int,int> MPII;",
    "typedef set<int> SETI;",
    "typedef multiset<int> MSETI;",
    "typedef long int int32;",
    "typedef unsigned long int uint32;",
    "typedef long long int int64;",
    "typedef unsigned long long int uint64;",
    "",
    "/****** Template of some basic operations *****/",
    "template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }",
    "template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }",
    "/**********************************************/",
    "",
    "using namespace std;",
    "",
    "int main()",
    "{",
    "",
    "\t$0",
    "",
    "\treturn 0;",
    "}"
    ],
    "description": "CPP Initial Template"
    }
    }
    22 changes: 22 additions & 0 deletions launch.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    {
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    {
    "name": "clang++ - Build and debug active file",
    "type": "cppdbg",
    "request": "launch",
    // "program": "${fileDirname}/${fileBasenameNoExtension}",
    "program": "${fileDirname}/a.out",
    "args": [],
    "stopAtEntry": true,
    "cwd": "${workspaceFolder}",
    "environment": [],
    "externalConsole": false,
    "MIMode": "lldb",
    "preLaunchTask": "clang++ build active file"
    }
    ]
    }
    6 changes: 6 additions & 0 deletions settings.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    {
    "files.associations": {
    "iostream": "cpp",
    "ostream": "cpp"
    }
    }
    29 changes: 29 additions & 0 deletions tasks.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    {
    "version": "2.0.0",
    "tasks": [
    {
    "type": "shell",
    "label": "clang++ build active file",
    "command": "/usr/bin/clang++",
    "args": [
    "-std=c++17",
    "-stdlib=libc++",
    "-g",
    "${file}",
    "-o",
    "${fileDirname}/a.out"
    // "${fileDirname}/${fileBasenameNoExtension}"
    ],
    "options": {
    "cwd": "${workspaceFolder}"
    },
    "problemMatcher": [
    "$gcc"
    ],
    "group": {
    "kind": "build",
    "isDefault": true
    }
    }
    ]
    }