C++ is a very important language in competitive programming because C++ include flexibility of C and have extended STL template library.You can use C++ easy and and quick way if you have a template file. A template file contains a format and necessary code which is required frequently in competitive programming.You can save a lot of time by using template file because it takes some time if you have to include another header and define some more macros.
Here I am giving a simple template file according to my convenience.You can edit it or generate another file according to yours.
- #include<iostream>
- #include<cstdio>
- #include<bitset>
- #include<vector>
- #include<cmath>
- #include<queue>
- #include<map>
- #include<set>
- #include<list>
- #include<stack>
- #include<string>
- #include<cstdlib>
- #include<cstring>
- #include<algorithm>
- using namespace std;
- #define fori(i,n) for(i=0;i<(n);++i)
- #define forin(i,s,n) for(i=(s);i<=(n);++i)
- #define forn(i,n) for(i=(n-1);i>=0;--i)
- #define forni(i,n,e) for(i=(n);i>=(e);--i)
- #define MAX(a, b) ((a) > (b) ? (a) : (b))
- #define MIN(a, b) ((a) < (b) ? (a) : (b))
- #define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
- #define SQ(X) ( (X) * (X) )
- #define nil NULL
- #define itr iterator
- #define pb push_back
- #define mod 1000000007 //10^9+7
- #define P printf
- #define S scanf
- //#define getchar getchar_unlocked //Uncomment this if you are going to use fast i/o
- typedef long long int lli;
- typedef long double ld;
- typedef vector<int> vi;
- typedef vector<lli> vll;
- typedef pair<int,int> ii;
- /*-------------------------------------------------------------
- ++++++++++++++++++++++++++++++++SourcCode++++++++++++++++++++++
- -------------------------------------------------------------*/
- //Functions and Global variables
- void program();
- inline void pAry(int a[],int n)
- {
- int i;
- fori(i,n)
- printf("%d ",a[i]);
- printf("\n");
- }
- inline void pSAry(int a[],int s,int e)
- {
- int i;
- forin(i,s,e)
- printf("%d ",a[i]);
- printf("\n");
- }
- //int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
- //double pi=2*acos(0.0);
- //Main()
- int main()
- {
- //freopen("IN.txt", "r", stdin);
- //freopen("OUT.txt", "w", stdout);
- program();
- return 0;
- }
- //Root Program
- void program()
- {
- }
@Happy Programming
Comments
Post a Comment