-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcpp.json
More file actions
142 lines (142 loc) · 5.79 KB
/
cpp.json
File metadata and controls
142 lines (142 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
{
"Insert Code Header": {
"prefix": "codeheader",
"body": [
"/**",
" * author: ${1:Crevious}",
" * created: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE} ${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}",
" **/",
"",
"$0"
],
"description": "Insert a standard code header"
},
"Insert Code template": {
"prefix": "codeKorbo",
"body": [
" ",
" #include <bits/stdc++.h>",
" using namespace std;",
" ",
" using ll = long long;",
" using db = long double; // or double, if TL is tight",
" using str = string; // yay python!",
" ",
" // pairs",
" using pi = pair<int, int>;",
" using pl = pair<ll, ll>;",
" using pd = pair<db, db>;",
" #define mp make_pair",
" #define f first",
" #define s second",
" ",
" #define tcT template <class T",
" #define tcTU tcT, class U",
" // ^ lol this makes everything look weird but I'll try it",
" tcT > using V = vector<T>;",
" tcT, size_t SZ > using AR = array<T, SZ>;",
" using vi = V<int>;",
" using vb = V<bool>;",
" using vl = V<ll>;",
" using vd = V<db>;",
" using vs = V<str>;",
" using vpi = V<pi>;",
" using vpl = V<pl>;",
" using vpd = V<pd>;",
" ",
" // vectors",
" #define sz(x) int(size(x))",
" #define bg(x) begin(x)",
" #define all(x) bg(x), end(x)",
" #define rall(x) rbegin(x), rend(x)",
" #define sor(x) sort(all(x))",
" #define rsz resize",
" #define ins insert",
" #define pb push_back",
" #define eb emplace_back",
" #define ft front()",
" #define bk back()",
" ",
" #define lb lower_bound",
" #define ub upper_bound",
" tcT > int lwb(const V<T> &a, const T &b) { return int(lb(all(a), b) - bg(a)); }",
" tcT > int upb(const V<T> &a, const T &b) { return int(ub(all(a), b) - bg(a)); }",
" ",
" const int MOD = 998244353; // 1e9+7;",
" const int MX = (int)2e5 + 5;",
" const ll BIG = 1e18; // not too close to LLONG_MAX",
" const db PI = acos((db)-1);",
" const int dx[4]{1, 0, -1, 0}, dy[4]{0, 1, 0, -1}; // for every grid problem!!",
" mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());",
" template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;",
" ",
" // bitwise ops",
" // also see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html",
" constexpr int pct(int x) { return __builtin_popcount(x); } // # of bits set",
" constexpr int bits(int x) { // assert(x >= 0); // make C++11 compatible until",
" // USACO updates ...",
" return x == 0 ? 0 : 31 - __builtin_clz(x);",
" } // floor(log2(x))",
" constexpr int p2(int x) { return 1 << x; }",
" constexpr int msk2(int x) { return p2(x) - 1; }",
" ",
" ll cdiv(ll a, ll b) {",
" return a / b + ((a ^ b) > 0 && a % b);",
" } // divide a by b rounded up",
" ll fdiv(ll a, ll b) {",
" return a / b - ((a ^ b) < 0 && a % b);",
" } // divide a by b rounded down",
" ",
" tcT > bool ckmin(T &a, const T &b) {",
" return b < a ? a = b, 1 : 0;",
" } // set a = min(a,b)",
" tcT > bool ckmax(T &a, const T &b) {",
" return a < b ? a = b, 1 : 0;",
" } // set a = max(a,b)",
" ",
" tcTU > T fstTrue(T lo, T hi, U f) {",
" ++hi;",
" assert(lo <= hi); // assuming f is increasing",
" while (lo < hi) { // find first index such that f is true",
" T mid = lo + (hi - lo) / 2;",
" f(mid) ? hi = mid : lo = mid + 1;",
" }",
" return lo;",
" }",
" tcTU > T lstTrue(T lo, T hi, U f) {",
" --lo;",
" assert(lo <= hi); // assuming f is decreasing",
" while (lo < hi) { // find first index such that f is true",
" T mid = lo + (hi - lo + 1) / 2;",
" f(mid) ? lo = mid : hi = mid - 1;",
" }",
" return lo;",
" }",
" tcT > void remDup(vector<T> &v) { // sort and remove duplicates",
" sort(all(v));",
" v.erase(unique(all(v)), end(v));",
" }",
" tcTU > void safeErase(T &t, const U &u) {",
" auto it = t.find(u);",
" assert(it != end(t));",
" t.erase(it);",
" }",
" ",
" void l355g0_45sif() {",
" // Your code here",
" }",
" ",
" int main() {",
" int tc = 1;",
" // cin >> tc;",
" for (int i = 1; i <= tc; i++) {",
" // cout << \"Case #\" << i << \": \";",
" l355g0_45sif();",
" }",
" return 0;",
" }",
""
],
"description": "Insert a standard code header"
}
}