Skip to content

Commit b14f429

Browse files
committed
Updates
1 parent bd44983 commit b14f429

File tree

2 files changed

+32
-34
lines changed

2 files changed

+32
-34
lines changed

code_template.cpp

+31-33
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,41 @@ using namespace std;
88
typedef long long LL;
99
typedef long double LD;
1010

11-
const int MAX = 1e5 + 5;
12-
const int LIM = 3e5 + 5;
13-
const int MOD = 1e9 + 7;
14-
const LD EPS = 1e-10;
11+
const int MAX = 1e5 + 5;
12+
const int LIM = 3e5 + 5;
13+
const int MOD = 1e9 + 7;
14+
const LD EPS = 1e-10;
1515
const double PI = acos(-1.0);
1616

17-
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
18-
#define Assert(x) {if(!(x)){cerr<<"Assertion failed at line "<<__LINE__<<": "<<#x<<" = "<<(x)<<"\n";exit(1);}}
19-
#define inchar getchar//_unlocked
20-
#define outchar(x) putchar(x)//_unlocked(x)
21-
#define unique(a) sort((a).begin(), a.end()), (a).erase(unique((a).begin(), (a).end()),(a).end())
17+
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
18+
#define Assert(x) {if(!(x)){cerr<<"Assertion failed at line "<<__LINE__<<": "<<#x<<" = "<<(x)<<"\n";exit(1);}}
19+
#define inchar getchar//_unlocked
20+
#define outchar(x) putchar(x)//_unlocked(x)
2221

23-
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
24-
template <typename Arg1>void __f(const char* name, Arg1&& arg1){cout<<name<<" : "<<arg1<<"\n";}
25-
template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" , ";__f(comma+1, args...);}
26-
27-
double tick(){static clock_t oldt;clock_t newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt = newt;return diff;}
28-
template<typename T> void inPos(T &x){x=0;register T c=inchar();while(((c<48)||(c>57))&&(c!='-'))c=inchar();bool neg=false;if(c=='-')neg=true;for(;c<48||c>57;c=inchar());for(;c>47&&c<58;c=inchar())x=(x<<3)+(x<<1)+(c&15);if(neg)x=-x;}
29-
template<typename T> void outPos(T n){if(n<0){outchar('-');n*=-1;}char snum[65];int i=0;do {snum[i++]=n%10+'0';n/=10;}while(n);i=i-1;while(i>=0)outchar(snum[i--]);outchar('\n');}
30-
inline void inStr(char *str){register char c=0;register int i=0;while(c<33)c=inchar();while (c!='\n'&&c!=' '&&c!=EOF){str[i]=c;c=inchar();++i;}str[i]='\0';}
31-
template<typename T> T gcd(T a, T b){return (b?__gcd(a,b):a);}
32-
template<typename T> T lcm(T a, T b){return (a*(b/gcd(a,b)));}
33-
template<typename T> T mod(T a, T b) {return (a<b ? a : a%b);}
34-
template<typename T> T add(T a, T b, T c){T x=a+b;return (x>=c ? x-c : x);}
35-
template<typename T> T mod_neg(T a, T b) {a=mod(a, b);if(a<0){a+=b;}return a;}
36-
LL mulmod(LL a,LL b, LL m){LL q=(LL)(((LD)a*(LD)b)/(LD)m);LL r=a*b-q*m;if(r>m)r%=m;if(r<0)r+=m;return r;}
37-
template<typename T> T expo(T e, T n){T x=1,p=e;while(n){if(n&1)x=x*p;p=p*p;n>>=1;}return x;}
38-
template<typename T> T power(T e, T n, T m){T x=1%m,p=e;while(n){if(n&1)x=mod(x*p,m);p=mod(p*p,m);n>>=1;}return x;}
39-
template<typename T> T extended_euclid(T a, T b, T &x, T &y){T xx=0,yy=1;y=0;x=1;while(b){T q=a/b,t=b;b=a%b;a=t;t=xx;xx=x-q*xx;x=t;t=yy;yy=y-q*yy;y=t;}return a;}
40-
template<typename T> T mod_inverse(T a, T n){T x,y;T d = extended_euclid(a, n, x, y);return (d>1?-1:mod_neg(x,n));}
22+
double tick(){static clock_t oldt,newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt=newt;return diff;}
23+
template<typename T> void inpos(T &x){x=0;register T c=inchar();while(((c<48)||(c>57))&&(c!='-'))c=inchar();bool neg=0;\
24+
if(c=='-')neg=1;for(;c<48||c>57;c=inchar());for(;c>47&&c<58;c=inchar())x=(x<<3)+(x<<1)+(c&15);if(neg)x=-x;}
25+
template<typename T> void outpos(T n){if(n<0){outchar('-');n*=-1;}char snum[65];int i=0;do{snum[i++]=n%10+'0';n/=10;}\
26+
while(n);i=i-1;while(i>=0)outchar(snum[i--]);outchar('\n');}
27+
inline void instr(char *str){register char c=0;register int i=0;while(c<33)c=inchar();while(c!='\n'&&c!=' '&&c!=EOF){\
28+
str[i]=c;c=inchar();++i;}str[i]='\0';}
29+
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
30+
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
31+
int add(int a, int b, int c){int res=a+b;return(res>=c?res-c:res);}
32+
int mod_neg(int a, int b, int c){int res;if(abs(a-b)<c)res=a-b;else res=(a-b)%c;return(res<0?res+c:res);}
33+
int mul(int a, int b, int c){LL res=(LL)a*b;return(res>=c?res%c:res);}
34+
LL mulmod(LL a,LL b, LL m){LL q = (LL)(((LD)a*(LD)b)/(LD)m);LL r=a*b-q*m;if(r>m)r%=m;if(r<0)r+=m;return r;}
35+
template<typename T>T expo(T e, T n){T x=1,p=e;while(n){if(n&1)x=x*p;p=p*p;n>>=1;}return x;}
36+
template<typename T>T power(T e, T n, T m){T x=1,p=e;while(n){if(n&1)x=mul(x,p,m);p=mul(p,p,m);n>>=1;}return x;}
37+
template<typename T>T extended_euclid(T a, T b, T &x, T &y){T xx=0,yy=1;y=0;x=1;while(b){T q=a/b,t=b;b=a%b;a=t;\
38+
t=xx;xx=x-q*xx;x=t;t=yy;yy=y-q*yy;y=t;}return a;}
39+
template<typename T>T mod_inverse(T a, T n){T x,y,z=0;T d=extended_euclid(a,n,x,y);return(d>1?-1:mod_neg(x,z,n));}
4140

4241
int main() {
43-
#ifndef ONLINE_JUDGE
44-
freopen("inp.txt", "r", stdin);
45-
#endif
42+
#ifndef ONLINE_JUDGE
43+
freopen("inp.txt", "r", stdin);
44+
#endif
4645

47-
48-
// cout<<"Execution time : "<<tick()<<"\n";
49-
return 0;
46+
// cout<<"Execution time : "<<tick()<<"\n";
47+
return 0;
5048
}

python_template.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ def power(a,b,m):
4545
return x
4646

4747
if __name__ == "__main__":
48-
#code goes below79
48+
#code goes below

0 commit comments

Comments
 (0)