Skip to content

Instantly share code, notes, and snippets.

@kevin51jiang
Forked from sananth12/template.cpp
Last active January 1, 2019 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevin51jiang/d93a514c2c2c08a318d69c56b89efe62 to your computer and use it in GitHub Desktop.
Save kevin51jiang/d93a514c2c2c08a318d69c56b89efe62 to your computer and use it in GitHub Desktop.
Competitive programming template (C++)
#include <iostream>
#include <cmath>
#include <algorithm>
#include <limits>
#include <vector>
#include <bitset>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <time.h>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <cctype>
#include <list>
#include <iterator>
using namespace std;
#define MOD 1000000007LL
#define LL long long
#define ULL unsigned long long
#define LD long double
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(x) ((x)<0?-(x):(x))
#define si(n) scanf("%d",&n)
#define sf(n) scanf("%f",&n)
#define sl(n) scanf("%lld",&n)
#define slu(n) scanf("%llu",&n)
#define sd(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
#define pnl printf("\n")
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,n) for(int i=(n);i>=0;i--)
#define DB(x) cout<<"\n"<<#x<<" = "<<(x)<<"\n";
#define CL(a,b) memset(a,b,sizeof(a))
const double PI=3.14159265358979323846264338327950288419716939937510582097494459230;
void swapc (char *x,char *y){char temp;temp=*x;*x=*y;*y=temp;}
void swapi(int *a,int *b){int temp;temp=*a;*a=*b;*b=temp;}
ULL gcd(ULL a,ULL b){if(a==0)return b;if(b==0)return a;if(a==1||b==1)return 1;
if(a==b)return a;if(a>b)return gcd(b,a%b);else return gcd(a,b%a);}
#define SIZE 1000001
void preprocess() {
}//end prepreprocess
void refresh() {
}//end refresh
void compute() {
}//end compute
int main() {
#ifdef debug
freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
freopen("log.txt", "w", stderr);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t,i,j;preprocess();
scanf("%d",&t);
while(t--) {
compute();
}//end while
#ifdef debug
fprintf(stdout,"\nTIME: %.3lf sec\n", (double)clock()/(CLOCKS_PER_SEC));
#endif
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment