TanayKulkarni's blog

By TanayKulkarni, history, 12 days ago, In English

Input Template

void read(){}
void read(long long& a){scanf("%lld",&a);}
void read(long& a){scanf("%ld",&a);}
void read(int& a){scanf("%d",&a);}
void read(double& a){scanf("%lf",&a);}
void read(float& a){scanf("%f",&a);}
void read(string& a){cin>>a;}
template<typename x,typename y>void read(pair<x,y>& a){ read(a.first),read(a.second);}
template<typename x>void read(x& a){for(auto  &i : a) read(i);}
template<typename x,typename... y>void read(x& a,y&... b){read(a);read(b...);}

Debug Template

void _print(char i){ cerr<<i;}
void _print(string i){ cerr<<i;}
void _print(float i){ cerr<<i;}
void _print(int i){ cerr<<i;}
void _print(double i){ cerr<<i;}
void _print(){cerr<<"\n";};
template<typename x,typename y> void _print(pair<x,y>&t){cerr<<"{ ";_print(t.first);cerr<<" , ";_print(t.second);cerr<<" },";}
template<typename x> void _print(x &t){  cerr<<"{ "; for(int i = 0;i < (int)t.size();i++){ _print(t[i]); if(i < (int) t.size() - 1) cerr<<", "; } cerr<<" }"; }
template<typename x,typename... y> void _print(x a,y... b){_print(a);if(sizeof...(b)) cerr<<" , ";_print(b...);}
#define dbg(x...) cerr<<"DEBUG : "<<#x<<" => ";_print(x);cerr<<"\n";

Sample Code

#include<bits/stdc++.h>
using namespace std;
// READ TEMPLATE
void read(){}
void read(long long& a){scanf("%lld",&a);}
void read(long& a){scanf("%ld",&a);}
void read(int& a){scanf("%d",&a);}
void read(double& a){scanf("%lf",&a);}
void read(float& a){scanf("%f",&a);}
void read(string& a){cin>>a;}
template<typename x,typename y>void read(pair<x,y>& a){ read(a.first),read(a.second);}
template<typename x>void read(x& a){for(auto  &i : a) read(i);}
template<typename x,typename... y>void read(x& a,y&... b){read(a);read(b...);}
// DEBUG TEMPLATE
void _print(char i){ cerr<<i;}
void _print(string i){ cerr<<i;}
void _print(float i){ cerr<<i;}
void _print(int i){ cerr<<i;}
void _print(double i){ cerr<<i;}
void _print(){cerr<<"\n";};
template<typename x,typename y> void _print(pair<x,y>&t){cerr<<"{ ";_print(t.first);cerr<<" , ";_print(t.second);cerr<<" },";}
template<typename x> void _print(x &t){  cerr<<"{ "; for(int i = 0;i < (int)t.size();i++){ _print(t[i]); if(i < (int) t.size() - 1) cerr<<", "; } cerr<<" }"; }
template<typename x,typename... y> void _print(x a,y... b){_print(a);if(sizeof...(b)) cerr<<" , ";_print(b...);}
#define dbg(x...) cerr<<"DEBUG : "<<#x<<" => ";_print(x);cerr<<"\n";
signed main(){
    int n,x,y;
    read(n,x,y); // READING INPUT
    vector<int>a(n);
    read(a); // READING INPUT

    dbg(n,x,y,a); 
}
 
 
 
 
  • Vote: I like it
  • +1
  • Vote: I do not like it