-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcp_snippet.cpp
91 lines (80 loc) · 1.7 KB
/
cp_snippet.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
# include <iostream>
# include <utility>
# include <iterator>
# include <string>
# include <stdio.h>
# include <map>
# include <unordered_map>
# include <algorithm>
# include <queue>
# include <vector>
# include <climits>
# include <cstring>
# include <set>
# include <unordered_set>
# include <sstream>
# include <deque>
# include <bitset>
# include <functional>
# include <numeric>
# include <stack>
# include <limits>
# include <time.h>
# include <math.h>
# include <stdlib.h>
# include <assert.h>
using namespace std;
# define SAMRAT ios::sync_with_stdio(0);cin.tie(0);
# define LL long long
# define LD long double
# define FOR(i,x,y) for(LL i=x;i<y;i++)
# define RFOR(i,x,y) for(LL i=x;i>=y;i--)
# define DEBUG_1D(x,a,b) FOR(i,a,b){cout<<x[i]<<" ";}cout<<endl;
# define DEBUG_2D(x,a1,b1,a2,b2) FOR(i,a1,b1){FOR(j,a2,b2){cout<<x[i][j]<<" ";}cout<<endl;}
# define ALL(x) x.begin(), x.end()
# define MOD (LL)(1e9+7)
# define INF8 (LL)(1e17+5)
# define endl '\n'
typedef vector<LL> VI;
typedef vector<bool> VB;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef pair<LL, LL> PI;
typedef pair<LL, PI> PPI;
typedef vector<PI> VP;
typedef vector<PPI> VPP;
inline LL mod(LL x) {
return (x%MOD + MOD)%MOD;
}
LL POWER(LL x, LL y) {
LL res = 1;
x = x%MOD;
if (x == 0) return 0;
while (y > 0) {
if (y&1) res = mod(res * x);
y >>= 1; x = mod(x * x);
}
return res;
}
LL nCr(int n, int r) {
r = min(r, n - r);
if (!r) return 1;
LL num = 1, deno = 1;
while (r) {
num *= n;
deno *= r;
LL div = gcd(num, deno); // only works on C++17
num /= div;
deno /= div;
n--, r--;
}
return num;
}
int main() {
SAMRAT
int t = 1;
// cin >> t;
while (t--) {
}
return 0;
}