-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.cpp
191 lines (171 loc) · 5.55 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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <string.h>
//-------------------------------------macros-----------------------------------------------
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define color(array, value) memset(array, value, sizeof(array))
#define colorDD(array, value) fill_n(*array, sizeof(array) / sizeof(**array), value);
#define sz(x) ((ll)x.size())
#define cerr(x) std::cout << #x << " = " << x << endl
#define YES std::cout << "YES\n"
#define NO std::cout << "NO\n"
#define Yes std::cout << "Yes\n"
#define No std::cout << "No\n"
#define endl "\n"
#define FOR(index, lower, upper) for (ll index = lower; index < upper; index++)
#define FORD(index, upper, lower) for (ll index = upper; index > lower; index--)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define containsKey(map, key) (map.find(key) != map.end())
#define umap unordered_map
#define uset unordered_set
#define CASE(x) std::cout << "Case " << x << ":" << endl;
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll, ll>
const ll MOD = 1e9 + 7;
const ll A_MOD = 998244353;
const ld EPS = 1e-7;
const ld PI = acos(-1.0);
const ll INF = 2e18;
/*------------------------------------Policy based data structures-------------------------------------------*/
using namespace std;
using namespace __gnu_pbds;
template <class T>
using oset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*-----------custom-hash------------*/
struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
template <class T1, class T2>
using pmap = gp_hash_table<T1, T2, custom_hash>;
template <class T>
using pset = unordered_set<T, custom_hash>;
/*----------------------Graph Moves----------------*/
const ll dx[] = {+0, +0, +1, -1, -1, +1, -1, +1}; // Kings Move L R D U
const ll dy[] = {-1, +1, +0, +0, +1, +1, -1, -1}; // Kings Move
// const ll dx[] = {-2, -2, -1, -1, 1, 1, 2, 2}; // Knights Move
// const ll dy[] = {-1, 1, -2, 2, -2, 2, -1, 1}; // Knights Move
/*------------------------------------------------*/
bool getBit(ll number, ll bit) {
return (number & (1ll << bit)) != 0;
}
ll inverseBit(ll number, ll bit) {
return (number ^ (1ll << bit));
}
ll setBit(ll number, ll bit) {
return (number | (1ll << bit));
}
ll ceil_div(ll a, ll b) {
return a / b + ((a ^ b) > 0 && a % b != 0);
}
template <typename T>
T square(T v) {
return v * v;
}
bool comp_second(pair<ll, ll> &a, pair<ll, ll> &b) {
if (a.second != b.second)
return a.second < b.second;
return a.first < b.first;
}
bool comp_first_reverse(pair<ll, ll> &a, pair<ll, ll> &b) {
if (a.first != b.first)
return a.first < b.first;
return a.second > b.second;
}
bool comp_second_reverse(pair<ll, ll> &a, pair<ll, ll> &b) {
if (a.second != b.second)
return a.second > b.second;
return a.first < b.first;
}
ll __lcm(ll a, ll b) {
return (a / __gcd(a, b)) * b;
}
struct Point {
ld x, y;
Point() : x(0.0), y(0.0) {}
Point(ld _x, ld _y) : x(_x), y(_y){};
};
//-------------------------------------------- fast-io----------------------------------------
void HUTH() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
std::cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input", "r", stdin);
freopen("output", "w", stdout);
#endif
}
//-----------------------------------------Operator overloads----------------------------------
template <typename T1, typename T2> // cin >> pair<T1, T2>
istream &operator>>(istream &istream, pair<T1, T2> &p) { return (istream >> p.first >> p.second); }
template <typename T> // cin >> vector<T>
istream &operator>>(istream &istream, vector<T> &v) {
for (auto &it : v)
cin >> it;
return istream;
}
template <typename T1, typename T2> // std::cout << pair<T1, T2>
ostream &operator<<(ostream &ostream, const pair<T1, T2> &p) { return (ostream << p.first << " " << p.second); }
template <typename T> // std::cout << vector<T>
ostream &operator<<(ostream &ostream, const vector<T> &c) {
ll n = sz(c);
FOR(i, 0, n) {
std::cout << c[i] << ((i == n - 1) ? "" : " ");
}
return ostream;
}
template <typename T> // std::cout << unordered_set<T>
ostream &operator<<(ostream &ostream, const unordered_set<T> &c) {
for (auto &it : c)
std::cout << it << " ";
return ostream;
}
template <typename T> // std::cout << ordered_set<T>
ostream &operator<<(ostream &ostream, const set<T> &c) {
for (auto &it : c)
std::cout << it << " ";
return ostream;
}
istream &operator>>(istream &istream, Point &v) {
cin >> v.x >> v.y;
return istream;
}
//-----------------------------------------Operator overloads----------------------------------
void solve(ll);
int main() {
HUTH();
ll T = 1ll;
cin >> T;
FOR(i, 1, T + 1) {
solve(i);
}
}
void solve(ll TC) {
}
/*
itne me hi thakk gaya vro?
read question
rethink your approach
dont put --> n <-- in every for loop
consider case = 0
* Expert before 2023
* CM before ?
Aur poocho na zara
Mere din ke bare mein bhi
Bas itne mein
Sambhal jaun haan
* Rakh vishwas tu hai shiv ka dass *
*/