Chapter 143
HomeA good template saves 5-10 minutes per contest. Keep it lean — only include what you actually use. Know every line.
#includeusing namespace std; using ll = long long; using vi = vector ; using vll = vector ; #define all(x) begin(x), end(x) const int MOD = 1e9 + 7; void solve() { // per-test-case logic here } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) solve(); return 0; }
💡 Keep a library file
Store DSU, segment tree, Dinic, etc. as separate files on your machine. Copy-paste (or #include) as needed. Don't retype from scratch — you'll introduce bugs.