- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplatecpp.cpp
More file actions
Latest commit
153 lines (140 loc) · 5.04 KB
/
Copy pathtemplatecpp.cpp
File metadata and controls
153 lines (140 loc) · 5.04 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
143
144
145
146
147
148
149
150
151
152
153
#include<bits/stdc++.h>
usingnamespacestd;
// to minimize
// defines
constdoublePI = acos(-1);
#defineINF1E9
#defineINFflow1E8
#defineendl'\n'
#defineTloopint T; cin >> T; for(int count_ = 1; count_ < T+1; count_++)
#defineNloopint N; cin >> N; for(int count__ = 0; count__ < N; count__++)
#defineprintcaseg cout << "Case #" << count_ << ": "
#defineprintcaseu cout << "Case " << count_ << ": "
#defineMOD1000000007
#defineLSOne(S) ((S)&(-S))
#defineSZ(S) S.size()
#defineALL(S) S.begin(), S.end()
#definepb push_back
#definefi first
#definese second
#defineeb emplace_back
#definemp make_pair
// A lot of typedefs
typedeflonglong ll;
typedefunsignedlonglong ull;
typedef stack<int> si;
typedef stack<longlong> sll;
typedef stack<string> ss;
typedef stack<double> sd;
typedef queue<int> qi;
typedef queue<longlong> qll;
typedef queue<string> qs;
typedef queue<double> qd;
typedef deque<int> di;
typedef deque<longlong> dll;
typedef deque<string> ds;
typedef deque<double> dd;
typedef priority_queue<int> pqi;
typedef priority_queue<longlong> pqll;
typedef priority_queue<string> pqs;
typedef priority_queue<double> pqd;
typedef priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pqdijk;
typedef set<int> seti;
typedef set<longlong> setll;
typedef set<string> sets;
typedef set<double> setd;
typedef unordered_set<int> useti;
typedef unordered_set<longlong> usetll;
typedef unordered_set<string> usets;
typedef unordered_set<double> usetd;
typedef map<int, string> mapis;
typedef map<string, int> mapsi;
typedef map<longlong, string> maplls;
typedef map<string, longlong> mapsll;
typedef map<int, int> mapii;
typedef map<string, string> mapss;
typedef map<longlong, longlong> mapllll;
typedef map<longlong, double> maplld;
typedef map<double, longlong> mapdll;
typedef map<string, double> mapsd;
typedef map<double, string> mapds;
typedef map<int, double> mapid;
typedef map<double, int> mapdi;
typedef unordered_map<int, string> umapis;
typedef unordered_map<string, int> umapsi;
typedef unordered_map<longlong, string> umaplls;
typedef unordered_map<string, longlong> umapsll;
typedef unordered_map<int, int> umapii;
typedef unordered_map<string, string> umapss;
typedef unordered_map<longlong, longlong> umapllll;
typedef unordered_map<longlong, double> umaplld;
typedef unordered_map<double, longlong> umapdll;
typedef unordered_map<string, double> umapsd;
typedef unordered_map<double, string> umapds;
typedef unordered_map<int, double> umapid;
typedef unordered_map<double, int> umapdi;
typedef vector<int> vi;
typedef vector<longlong> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vector<pair<int,int>>> vwAL;
typedef vector<vector<int>> vAL;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<string, int> psi;
typedef pair<longlong, longlong> pllll;
typedef pair<longlong, string> plls;
typedef pair<double, string> pds;
typedef pair<double, double> pdd;
typedef pair<double, int> pdi;
typedef pair<double, longlong> pdll;
// struct
structmystruct {
int counter;
};
//custom hashing
structcustom_hash {
inline std::size_toperator()(const std::pair<int,int> & v) const {
return v.first*31+v.second*7;
}
};
// pq/set custom comparator
classmycomp {
public:
booloperator() (mystruct a, mystruct b) {
return a.counter > b.counter;
}
};
// sort custom comparator
boolcustomcompare(mystruct a, mystruct b) {
return a.counter > b.counter;
}
// string split
vector<string> strsplit(string toSplit, char tok) {
vector<string> ans;
string token;
istringstream iss(toSplit);
while(getline(iss, token, tok)) {
ans.pb(token);
}
return ans;
}
vector<vi> gen_2d_vi(int size_1, int size_2) {
vector<vi> result;
for (int i = 0; i < size_1; i++) {
vi lst;
for (int j = 0; j < size_2; j++) {
lst.pb(-1);
}
lst.pb(-1);
result.pb(lst);
}
return result;
}
intmain ()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return0;
}