This is a somewhat loose compilation of the library I originally maintained at github.com/romophic/Compro. I was recommended to treat it like a bonsai tree, so I started.
Prerequisite Template:
#pragma GCC optimize("Ofast")#include <bits/stdc++.h>#define int long long#define double long double#define uint unsigned long long#define int128 __int128#define uint128 unsigned __int128using namespace std;constexpr int INF = 1LL << 60;template <class T>bool chmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }template <class T>bool chmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }Algorithms
Graph
Data Structures
Mathematics
- Prime Factorization
- Divisor Enumeration
- Binary Exponentiation
- ModInt
- Base Conversion
- “Euler’s totient function”
- BigInt (Arbitrary-precision integer)
Strings
Miscellaneous
- Binary Search
- chmax/chmin
- Making STL Data Structures cin/cout Compatible
- Fast I/O
- Mo’s Algorithm
- Prefix Sum (Cumulative Sum) (1D, 2D, 3D)
- Index Conversion (1D, 2D, 3D)
Heuristics
Libraries that Helped Me
I implemented these by referring solely to places that explicitly permit free usage.