@@ -12,13 +12,11 @@ if [ -f "$name" ]; then
12
12
echo " File already exists!"
13
13
else
14
14
cat << EOL > "$name "
15
- #include<bits/stdc++.h>
16
-
15
+ #include <bits/stdc++.h>
17
16
using namespace std;
18
17
19
18
// Type definitions
20
19
typedef long long ll;
21
- typedef long double ld;
22
20
typedef pair<int, int> pii;
23
21
typedef pair<ll, ll> pll;
24
22
typedef vector<int> vi;
@@ -28,81 +26,105 @@ typedef vector<pll> vpll;
28
26
typedef vector<vi> vvi;
29
27
typedef vector<vl> vvl;
30
28
31
- //Macros
32
- #define nline "\\ n"
29
+ //Macros
30
+ #define nline "\n"
33
31
#define all(x) (x).begin(), (x).end()
34
32
#define rall(x) (x).rbegin(), (x).rend()
35
33
#define sz(x) (int)(x).size()
36
34
#define pb push_back
37
35
#define mp make_pair
38
36
#define F first
39
37
#define S second
40
- #define forn(i, n) for(int i = 0; i < int(n); i++)
41
- #define forr(i, a, b) for(int i = a; i <= b; i++)
42
- #define ford(i, a, b) for(int i = a; i >= b; i--)
43
- #define elasped_time 1.0 * clock() / CLOCKS_PER_SEC
38
+ #define forn(i, n) for (int i = 0; i < int(n); i++)
39
+ #define forr(i, a, b) for (int i = a; i <= b; i++)
40
+ #define ford(i, a, b) for (int i = a; i >= b; i--)
41
+ #define elasped_time 1.0 * clock() / CLOCKS_PER_SEC
42
+
43
+ // clang-format off
44
+ // Debug macros
45
+ #define debarr(a,n) cout<<#a<<" : ";for(int i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
46
+ #define debmat(mat,row,col) cout<<#mat<<" :\n";for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
47
+ #define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
48
+
49
+ // Debug template functions
50
+ template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
51
+ template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
52
+ template <class T>ostream& operator <<(ostream& os, const unordered_set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
53
+ template <class S, class T>ostream& operator <<(ostream& os, const unordered_map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
54
+ template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
55
+ template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
56
+ template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
57
+ template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
58
+ template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
59
+ template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
60
+ // clang-format on
44
61
45
62
// Constants
46
63
const int MOD = 1e9 + 7;
47
64
const ll INF = 1e18;
48
65
const double EPS = 1e-9;
49
66
const double PI = acos(-1);
50
67
68
+ // Utility functions
51
69
ll mod_add(ll a, ll b, ll m = MOD) { return ((a % m) + (b % m)) % m; }
52
70
ll mod_sub(ll a, ll b, ll m = MOD) { return ((a % m) - (b % m) + m) % m; }
53
71
ll mod_mul(ll a, ll b, ll m = MOD) { return ((a % m) * (b % m)) % m; }
54
-
55
- ll mod_pow(ll base, ll exp, ll m = MOD) {
72
+ ll mod_pow(ll base, ll exp, ll m = MOD)
73
+ {
56
74
ll res = 1;
57
75
base %= m;
58
- while (exp > 0) {
59
- if (exp & 1) res = mod_mul(res, base, m);
76
+ while (exp > 0)
77
+ {
78
+ if (exp & 1)
79
+ res = mod_mul(res, base, m);
60
80
base = mod_mul(base, base, m);
61
81
exp >>= 1;
62
82
}
63
83
return res;
64
84
}
65
-
66
- ll mod_inv(ll a, ll m = MOD) {
67
- return mod_pow(a, m - 2, m); // Only works if m is prime
85
+ ll mod_inv(ll a, ll m = MOD)
86
+ {
87
+ return mod_pow(a, m - 2, m); // Only works if m is prime
68
88
}
69
-
70
- ll mod_div(ll a, ll b, ll m = MOD) {
89
+ ll mod_div(ll a, ll b, ll m = MOD)
90
+ {
71
91
return mod_mul(a, mod_inv(b, m), m);
72
92
}
73
93
74
- // Binary exponentiation (for non-modular calculations )
75
- ll binpow(ll base, ll exp) {
94
+ ll binpow(ll base, ll exp, ll mod = MOD )
95
+ {
76
96
ll res = 1;
77
- while (exp > 0) {
78
- if (exp & 1) res *= base;
79
- base *= base;
97
+ base %= mod;
98
+ while (exp > 0)
99
+ {
100
+ if (exp & 1)
101
+ res = (res * base) % mod;
102
+ base = (base * base) % mod;
80
103
exp >>= 1;
81
104
}
82
105
return res;
83
106
}
84
-
85
- void solve(){
86
-
107
+ /************/
108
+ void solve()
109
+ {
110
+ // Your solution code here
87
111
}
88
112
89
- int main(){
90
-
113
+ int main()
114
+ {
91
115
ios_base::sync_with_stdio(0);
92
116
cin.tie(0);
93
117
cout.tie(0);
94
-
95
- #ifndef ONLINE_JUDGE
96
- freopen("./outputs/input.txt", "r", stdin);
97
- freopen("./outputs/output.txt", "w", stdout);
98
- #endif
99
-
100
- // int t; cin>>t;while(t--)
101
- // solve();
102
-
118
+ #ifndef ONLINE_JUDGE
119
+ freopen("./outputs/input.txt", "r", stdin);
120
+ freopen("./outputs/output.txt", "w", stdout);
121
+ #endif
122
+ int t;
123
+ cin >> t;
124
+ while (t--)
125
+ solve();
103
126
return 0;
104
127
}
105
-
106
128
// Explanation
107
129
/*
108
130
0 commit comments