-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path#_template.cpp
69 lines (59 loc) · 1.62 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
#include <iostream>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define dwn(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define eb emplace_back
// C++ disables the io synchronization
inline void disable_syn() { std::ios_base::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0); }
//fast
int read() {
int s = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -f;
ch = getchar();
}
while (ch >= '0' && ch <= '9') s = (s << 1) + (s << 3) + (ch ^ '0'), ch = getchar();
return s * f;
}
void write(int x) {
if (x < 0) putchar('-'), x = -x;
if (x > 9) write(x / 10), putchar(x % 10 + '0');
else putchar(x + '0');
}
//fast long
ll readL() {
ll s = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -f;
ch = getchar();
}
while (ch >= '0' && ch <= '9') s = (s << 1) + (s << 3) + (ch ^ '0'), ch = getchar();
return s * f;
}
void writeL(ll x) {
if (x < 0) putchar('-'), x = -x;
if (x > 9) writeL(x / 10), putchar(x % 10 + '0');
else putchar(x + '0');
}
// fast generic & varargs read
template<typename T>
inline void readT(T &x) {
T s = 0, f = 1;
T ch = getchar();
while (!std::isdigit(ch)) {
if (ch == '-') f = -f;
ch = getchar();
}
while (std::isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ '0'),ch = getchar();
x = s * f;
}
template<typename T, typename ...Args>
inline void readTs(T &x, Args &...args) {
readT(x);
readTs(args...);
}