Skip to content

Instantly share code, notes, and snippets.

@shenlebantongying
Last active February 28, 2021 11:53
Show Gist options
  • Save shenlebantongying/e180d473be2fbf4d8ffe8509d3e67333 to your computer and use it in GitHub Desktop.
Save shenlebantongying/e180d473be2fbf4d8ffe8509d3e67333 to your computer and use it in GitHub Desktop.
Codeforces_cheatsheet
// Codeforces require speed rather than safty or architecture 

#define MIN(a,b) (a) < (b) ? (a) : (b)
#define MAX(a,b) (a) > (b) ? (a) : (b)
#define ABS(a) (a) > 0 ? (a) : -(a)

// Include EVERY std librarys of C and C++
// https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/precompiled/stdc%2B%2B.h
// Path under GCC tree libstdc++-v3/include/precompiled/stdc++.h
#include <bits/stdc++.h> 
 
using namespace std;

// Creepy Speed up!
ios_base::sync_with_stdio(false);
cin.tie(NULL);

// Read all lines
cin >> n;
while (n--){}

// <algorithm> sorting first 30 of a char[]
#include <algorithm>
char a[100];
int j(30);
sort(a,a+j);

#define all(x) (x).begin(), (x).end()
sort(vec.begin(), vec.end()) => sort(all(vec))

//Output answer
cout<<x<<endl;

built-in c++1x functionos:

Greatest common divisor (gcd) -> the minimum is always 1

Least common multiple (lcm) -> the biggest is always infinity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment