-
Notifications
You must be signed in to change notification settings - Fork 3
/
cpp.json
132 lines (131 loc) · 3.54 KB
/
cpp.json
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
{
// 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"
// }
"ch": {
"prefix": "ch",
"body": [
"#include<bits/stdc++.h>",
"using namespace std;",
"",
"#define mp make_pair",
"#define mt make_tuple",
"#define rep(i,begin,end) for (__typeof(begin) i=(begin),_end=(end),_step=1-2*((begin)>(end));i!=_end;i+=_step)",
"",
"// OUTPUT",
"template<class a, class b>",
"ostream& operator << (ostream& os, const pair<a,b>& p) {",
" os<<\"(\"<<p.first<<\",\"<<p.second<<\")\";",
" return os;",
"}",
"template<class T>",
"ostream& operator << (ostream& os, const vector<T>& v) {",
" os<<\"[\";",
" if (!v.size()) ",
" os<<\"]\"; ",
" else",
" for (int i=0;i<v.size();++i)",
" os<<v[i]<<\",]\"[i==v.size()-1];",
" return os;",
"}",
"template<class T>",
"ostream& operator << (ostream& os, const set<T>& s) {",
" os<<\"{\";",
" if (!s.size()) ",
" os<<\"}\"; ",
" else",
" for (auto x:s)",
" os<<x<<\",}\"[x==*s.rbegin()];",
" return os;",
"}",
"",
"void printr(ostream& os){os<<'\\n';}",
"template<class T, class... Args>",
"void printr(ostream& os, const T& t, const Args&... args){",
" os<<t; if (sizeof...(args)) os<<\" \";",
" printr(os,args...);",
"}",
"#define print(args...) printr(cout,##args)",
"",
"// INPUT",
"template<class T>",
"void read(T& x) {cin>>x;}",
"template<class T, class... Args>",
"void read(T& t, Args&... args){",
" read(t),read(args...);",
"}",
"template<class T>",
"void readarray(T* A,int n) {",
" rep(i,0,n) read(A[i]);",
"}",
"",
"",
"// DEBUG",
"void dbgr(ostream& os) { os<<endl; }",
"template<class T, class... Args>",
"void dbgr(ostream& os, const T& t, const Args&... args) {",
" os<<t; if (sizeof...(args)) os<<\", \";",
" dbgr(os,args...); ",
"}",
"#define dbg(args...) cout<<#args<<\" = \", dbgr(cout,##args) //cout can be changed",
"",
"",
"#define maxn 500050",
"#define modu 998244353",
"typedef long long LL;",
"typedef pair<int,int> pii;",
"typedef pair<LL,LL> pll;",
"",
"// COMMON FUNCTION",
"// min",
"template<class T>",
"T min(const vector<T>& v) { return *min_element(v.begin(),v.end()); }",
"// max",
"template<class T>",
"T max(const vector<T>& v) { return *max_element(v.begin(),v.end()); }",
"",
"LL pw(LL a,LL k=modu-2) {",
" LL ans=1;",
" for (a%=modu;k;k>>=1) {",
" if (k&1)",
" ans=ans*a%modu;",
" a=a*a%modu;",
" }",
" return ans;",
"}",
"",
"int main() {",
" ios::sync_with_stdio(false);",
" cin.tie(0),cout.tie(0);",
" $0",
" return 0;",
"}",
"/*README",
"1. Is modu correct?",
"2. Is maxn correct?",
"*/"
],
"description": "head.h"
},
"multicase": {
"prefix": "multicase",
"body": [
"int _;",
"read(_);",
"while (_--) {",
" $0",
"}"
],
"description": "multicase"
}
}