My personal collection of competitive programming code, templates, tools...
- Dijkstra's shortest path algorithm
- Bellman ford's shortest path algorithm
- Floyd warshall's shortest path algorithm + negative cycle detection
- Kruskal's minimum spanning tree algorithm
- Dinic's max flow algorithm
- Binary exponentiation and modulo inverse
- Matrix exponontiation
- Sieve of eratosthenes
- Linear Sieve
- Fermat Primality test
- GCD, Extended GCD, LCM
- Euler's totient function
using the above code alone won't compile, make sure the add the template above below the code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fastio ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define debug(x) cerr << #x << " is " << x << "\n"
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()