-
Notifications
You must be signed in to change notification settings - Fork 3
/
template.cpp
108 lines (90 loc) · 2.73 KB
/
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
// Note: Don't fully copy my template to avoid getting flagged or something on judges.
// Feel free to use the template for ideas, etc.
// code by savir singh
// my current cpp template for ccc
// (and for everything else too lol)
// Include everything needed for CP
#include <bits/stdc++.h>
using namespace std;
// Compiler Optimizations
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
// Shorthand Macros
#define bit32 int32_t
#define int long long // comment out if unnecessary
#define __ ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl '\n'
#define pb push_back
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vvvi vector<vvi>
#define vpii vector<pii>
#define vvpii vector<vpii>
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(a) (int) (a).size()
#define rsz resize
#define eb emplace_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define fe(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>n;i--)
#define fre(i,x,n) for(int i=x;i>=n;i--)
#define mod 1000000007
#define mod2 998244353
#define INF 1e18
#define ld long double
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define ps(x,y) fixed<<setprecision(y)<<x
#define w(x) int x; fastscan(x); while(x--)
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
// Fast Input
template<typename T, typename... Args>
inline void fastscan(T& num, Args&... args) {
int c = getchar();
num = 0;
bool neg = false;
// Handle negative numbers
if (c == '-') {
neg = true;
c = getchar();
}
// Process digits
while (c >= '0' && c <= '9') {
num = num * 10 + (c - '0');
c = getchar();
}
if (neg)
num = -num;
if constexpr (sizeof...(args) > 0)
fastscan(args...); // Recursively read the remaining arguments
}
// Fast Output For Integers
inline void fastprint(int num, const string& endline = "\n") {
if (num < 0) {
putchar('-');
num = -num;
}
char buffer[20];
int idx = 19;
buffer[idx--] = '\0';
do {
buffer[idx--] = static_cast<char>('0' + num % 10);
num /= 10;
}while (num > 0);
fputs(&buffer[idx + 1], stdout);
fputs(endline.c_str(), stdout);
}
// Fast Output for Strings
inline void fastprint(const string& s, const string& endline = "\n") {
fputs(s.c_str(), stdout);
fputs(endline.c_str(), stdout);
}
// == your template ends here, start coding!!! ==
//vars
bit32 main() {
__
// write your code here
return 0;
}