Skip to content

Commit 8d75b82

Browse files
authored
Create template.cpp
1 parent db5a210 commit 8d75b82

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

template.cpp

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#include <bits/stdc++.h>
2+
#include <ext/pb_ds/assoc_container.hpp>
3+
#include <ext/pb_ds/tree_policy.hpp>
4+
5+
using namespace __gnu_pbds;
6+
using namespace std;
7+
8+
#define pb push_back
9+
#define f first
10+
#define s second
11+
#define mp make_pair
12+
#define SZ(x) ((int)(x.size()))
13+
#define FOI(i, a, n) for( i = int(a); i <= int(n); i++)
14+
#define FOD(i, a, n) for( i = int(a); i >= int(n); i--)
15+
#define IN(x, y) ((y).find(x) != (y).end())
16+
#define ALL(t) t.begin(),t.end()
17+
#define MSET(tabl,i) memset(tabl, i, sizeof(tabl))
18+
#define PSET(x,y) fixed<<setprecision(y)<<lf(x)
19+
#define DBG(c) cout << #c << " = " << c << endl;
20+
#define RTIME ((double)clock()/(double)CLOCKS_PER_SEC)
21+
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
22+
#define Mod 1000000007
23+
24+
typedef unsigned long long ll;
25+
typedef long double lf;
26+
typedef pair < ll, ll > pii;
27+
typedef pair < ll, ll > pll;
28+
typedef vector < ll > vi;
29+
typedef vector<vi> vvi;
30+
typedef complex<double> base;
31+
32+
#define TRACE
33+
#ifdef TRACE
34+
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
35+
template <typename Arg1>
36+
void __f(const char* name, Arg1&& arg1){
37+
cout << name << " : " << arg1 << std::endl;
38+
//use cerr if u want to display at the bottom
39+
}
40+
template <typename Arg1, typename... Args>
41+
void __f(const char* names, Arg1&& arg1, Args&&... args){
42+
const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
43+
}
44+
#else
45+
#define trace(...)
46+
#endif
47+
48+
const int N = 1e5 + 5;
49+
const int lgN = 1e6+5;
50+
const int te = 3e8+1;
51+
const ll MOD = 998244353;
52+
const lf pi = 3.141592653589793238462643383;
53+
const ll IMAX = 1e9 + 5;
54+
const double PI = 3.141592653589793;
55+
56+
57+
template<class T>
58+
using max_pq = priority_queue<T>;
59+
template<class T>
60+
using min_pq = priority_queue<T,vector<T>,greater<T>>;
61+
template<class T>
62+
using OST = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
63+
64+
ll x,y;
65+
template<class T> T gcd(T a,T b){ if(a==0) {x=0,y=1; return b;}T gc=gcd(b%a,a);T temp;temp=x;x=y-(b/a)*temp;y=temp;return gc;}
66+
67+
//(a^x)%m
68+
ll po(ll a, ll x,ll m){ if(x==0){return 1;}ll ans=1;ll k=1; while(k<=x) {if(x&k){ans=((ans*a)%m);} k<<=1; a*=a; a%=m; }return ans; }
69+
70+
ll modInverse(ll A, ll M)
71+
{
72+
gcd(A,M);
73+
return (x%M+M)%M; //x may be negative
74+
}

0 commit comments

Comments
 (0)