OI-templates

  • Some templates/snippets with vscode snippets configuration in JSON form.
  • fast read / fast write

General

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
#include <bits/stdc++.h>
#define mod (int)(1e9 + 7)
#define int long long
#define endl '\n'
#define pb push_back
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define fst first
#define snd second
typedef long long ll;
typedef long double ld;
const int MAX = 0x3f3f3f3f;
const ll LLMAX = 9223372036854775807;
const double PI = acos(-1);
using namespace std;
void solve() {

}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while (t--) solve();
return 0;
}

vscode code snippets

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
"ACM": {
"prefix": "acminit",
"body": [
"#include <bits/stdc++.h>",
"#define mod (int)(1e9 + 7)",
"#define int long long",
"#define endl '\\n'",
"#define pb push_back",
"#define PII pair<int, int>",
"#define PLL pair<ll, ll>",
"#define fst first",
"#define snd second",
"typedef long long ll;",
"typedef long double ld;",
"const int MAX = 0x3f3f3f3f;",
"const ll LLMAX = 9223372036854775807;",
"const double PI = acos(-1);",
"using namespace std;",
"void solve() {",
" $1",
"}",
"signed main() {",
" ios::sync_with_stdio(false);",
" cin.tie(0);",
" cout.tie(0);",
" int t = 1;",
" cin >> t;",
" while (t--) solve();",
" return 0;",
"}"
],
"description": "ACM code template"
}

fast read/fast write

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// inline void rd(ll &x){x=0;short f=1;char c=getchar();while((c<'0'||c>'9')&&c!='-') c=getchar();if(c=='-') f=-1,c=getchar();while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();x*=f;}
inline void rd(ll &x) {
x = 0;
short f = 1;
char c = getchar();
while ((c < '0' || c > '9') && c != '-') c = getchar();
if (c == '-') f = -1, c = getchar();
while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
x *= f;
}
// inline void pt(ll x){if(x<0) putchar('-'),x=-x;if(x>9) pt(x/10);putchar(x%10+'0');}
inline void pt(ll x) {
if (x < 0) putchar('-'), x = -x;
if (x > 9) pt(x / 10);
putchar(x % 10 + '0');
}

vscode code snippets

1
2
3
4
5
6
7
8
"FRDFWT": {
"prefix": "frfw",
"body": [
"inline void rd(ll &x){x=0;short f=1;char c=getchar();while((c<'0'||c>'9')&&c!='-') c=getchar();if(c=='-') f=-1,c=getchar();while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();x*=f;}",
"inline void pt(ll x){if(x<0) putchar('-'),x=-x;if(x>9) pt(x/10);putchar(x%10+'0');}"
],
"description": "fast read fast write template"
}