The TEMPLATE WE NEED

Правка en2, от i_anku, 2021-06-09 21:27:10

hi Everyone Here is a template i managed to get from some famous people

copy the code below: ok lets start with shortcut. vl = vector vll = vector<vector> vc = vector; vs = vector how to use? lets declare a vector long long: vll arr; similarly vs arr1; vc arr2;

some other shortcuts: for loop shortcut +ve for loop fp(i,start,end){ // some code; } i = variable to use; start = starting point; end = ending point + 1;

-ve for loop: fn(i,start,end){ // some code; } i : variable start : start point; end : end point -1;

for debuging ure code: make a document name as "error.txt"

lets have a variable: int a = 10 int b = 19; vl arr = {1,2,3,4,6}; vc arr1 = {'a','b','c'}; //lets debug

debug(a); debug(b); debug(arr); debug(arr1);

//expected output on error.txt // a 10 // b 19 // arr [ 1 2 3 4 5 6 ] // arr1 [ a b c ]

include<bits/stdc++.h>

using namespace std;

typedef long long ll; typedef unsigned long long ull; typedef long double lld;

define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

define MOD 1000000007

define MOD1 998244353

define INF 1e18

define nline "\n"

define pb push_back

define ppb pop_back

define mp make_pair

define ff first

define ss second

define PI 3.141592653589793238462

define set_bits __builtin_popcountll

define sz(x) ((int)(x).size())

define all(x) (x).begin(), (x).end()

define fp(i,start,end) for(ll i = start;i < end; i++)

define fn(i,start,end) for(ll i = start;i > end; i--)

define vl vector

define vc vector

define vs vector

define vll vector<vector>

// typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update > pbds; // find_by_order, order_of_key

ifndef ONLINE_JUDGE

define debug(x) cerr << #x <<" "; _print(x); cerr << endl;

else

define debug(x)

endif

void _print(ll t) {cerr << t;} void _print(int t) {cerr << t;} void _print(string t) {cerr << t;} void _print(char t) {cerr << t;} void _print(lld t) {cerr << t;} void _print(double t) {cerr << t;} void _print(ull t) {cerr << t;}

template <class T, class V> void _print(pair <T, V> p); template void _print(vector v); template void _print(set v); template <class T, class V> void _print(map <T, V> v); template void _print(multiset v); template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";} template void _print(vector v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} template void _print(set v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} template void _print(multiset v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";} template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}

void solve(){

}

int main() { fastio();

ifndef ONLINE_JUDGE

freopen("Error.txt", "w", stderr);
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);

endif

solve()

}

//comment if u have any trouble understanding the code

Теги comptetive programming, code setup, sublime text setup, fast io

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский i_anku 2021-06-09 21:41:54 74
en4 Английский i_anku 2021-06-09 21:40:49 35 Tiny change: 'ESENT** \nhi Every' -> 'ESENT** \n**ALSO REFER THE IMAGE ATTACHED**\nhi Every'
en3 Английский i_anku 2021-06-09 21:30:02 61
en2 Английский i_anku 2021-06-09 21:27:10 51
en1 Английский i_anku 2021-06-09 21:24:10 3337 Initial revision (published)