-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCPP_Template.cpp
129 lines (119 loc) · 2.9 KB
/
CPP_Template.cpp
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
// include
#include <bits/stdc++.h>
// define
#define endl "\n"
#define l_b lower_bound
#define u_b upper_bound
#define ins insert
#define fir first
#define sec second
#define x first
#define y second
#define lc (rt << 1)
#define rc (rt << 1 | 1)
#define pb push_back
#define pf push_front
#define mp make_pair
#define random(a, b) rand() % (b - a + 1) + a
#define log(a, b) log(a) / log(b)
#define ALL(v) v.begin(), v.end()
#define clear(x) memset(x, 0, sizeof(x));
#define setINF(x) memset(x, 63, sizeof(x));
// using
using namespace std;
using ll = long long;
using lb = long double;
using PI = pair<int, int>;
using PLL = pair<ll, ll>;
using PS = pair<string, string>;
using VI = vector<int>;
using VPI = vector<PI>;
using VLL = vector<ll>;
using VPLL = vector<PLL>;
using QI = queue<int>;
using PQI = priority_queue<int>;
using PQII = priority_queue<int, VI, greater<int>>;
using STKI = stack<int>;
using DQI = deque<int>;
using SI = set<int>;
using SLL = set<ll>;
using SS = set<string>;
using USI = unordered_set<int>;
using USLL = unordered_set<ll>;
using USS = unordered_set<string>;
using MI = map<int, int>;
using MLL = map<ll, ll>;
using MS = map<string, string>;
using UMI = unordered_map<int, int>;
using UMLL = unordered_map<ll, ll>;
using UMS = unordered_map<string, string>;
// common variables
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int dir[8][2] = {{0, 1}, {0, -1}, {-1, 0}, {1, 0}, {-1, 1}, {1, -1}, {-1, -1}, {1, 1}};
struct Edge{int u, v, w;};
// common functions
inline int lowbit(int x) { return x & (-x); }
inline bool CMP(int a, int b) { return a > b; }
inline void copy(int a[], int b[], int sz) {
for (int i = 0; i <= sz; i++) {
a[i] = b[i];
}
}
inline int gcd(int a, int b) {
if (a == 0) {
return b;
}
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
inline int lcm(int a, int b) { return a / gcd(a, b) * b; }
inline int getMid(int l, int r) { return (l + r) >> 1; }
inline ll fast_pow(ll a, ll b) {
if (b == 1) {
return a;
}
ll tmp = fast_pow(a, b / 2);
if (b % 2 == 1) {
return tmp * tmp * a;
} else {
return tmp * tmp;
}
}
inline bool is_prime(ll x) {
for (ll i = 2; i * i <= x; i++) {
if (x % i == 0) {
return false;
}
}
return true;
}
//--------------------- start of program ---------------------
inline void solve() {
// Codes Here
}
//--------------------- end of program ---------------------
bool fileIO = false;
bool doCase = false;
int main() {
if (fileIO) {
// File IO Configurations
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
}
srand(time(0));
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
if (doCase) {
int T;
cin >> T;
while (T--) {
cout << "Case #" << T << ": ";
solve();
}
} else solve();
return 0;
}