Notebook¶
This folder is the short-reference layer of the repo.
Use it for:
- notebook-ready snippets
- formulas
- checklist pages
- contest-time reminders
It should stay denser and shorter than topics/.
Quick Split¶
Notebook= recall the main invariant, signal, or trap fastTemplate Library= retrieve the smallest reusable snippet fastBuild Kit= route between notebook, templates, and workflow pages
Contract¶
This layer answers one question:
I already mostly know the area. What is the shortest route back to the right invariant, trap, and reusable snippet?
Every mature cheatsheet should bias toward:
Use whenDo not use whenChoose by signal- one or two core invariants
- one or two main traps
- direct jumps to topic pages, templates, and repo notes
It should not try to reteach the full topic. If you need proofs or slower walkthroughs, jump back to topics/.
Use This Layer When¶
- the area is mostly known, but retrieval feels slow
- you want the lightest viable template family quickly
- you need the main invariant or failure mode under contest pressure
- you want one nearby repo note to reopen, not a long tutorial
Do Not Use This Layer When¶
- you are learning the topic for the first time
- you still do not know the brute-force baseline
- you cannot yet explain why the main technique works
- the problem needs a slower decision page more than a compact reminder
Fast Retrieval Loop¶
When you are mid-problem and want the shortest route back to something reusable:
- open the relevant cheatsheet for the family
- pick a template or invariant from there
- jump back into the topic page only if you need proof, pitfalls, or a slower explanation
This is meant to be the layer you skim during implementation, not the layer you study first.
Sheet Contract In Practice¶
The shortest useful scan order is:
Use whenDo not use whenChoose by signalInvariant / trap- one template or repo anchor
Representative Anchors¶
- Data structures -> CVP00001
- Graphs -> QOS, MINCOST
- DP -> TFIELD
- Number theory -> CRYPTKEY
- Geometry -> Big Brother, Closest Pair, KINGDOMS, PRAVO
Current Sheets¶
- Foundations cheatsheet
- Data structures cheatsheet
- Fenwick hot sheet
- DSU hot sheet
- DSU Rollback hot sheet
- DSU On Tree hot sheet
- Segment Tree hot sheet
- Lazy Segment Tree hot sheet
- Segment Tree Beats hot sheet
- Persistent Data Structures hot sheet
- Persistent Treap hot sheet
- Pairing / Leftist Heap hot sheet
- Balanced BST hot sheet
- B-Tree hot sheet
- Skiplist hot sheet
- X-Fast / Y-Fast hot sheet
- Interval Tree hot sheet
- ODT / Chtholly hot sheet
- Treap / Implicit Treap hot sheet
- Wavelet Tree hot sheet
- Sparse Table hot sheet
- Offline Tricks hot sheet
- Mo's hot sheet
- Binary Trie hot sheet
- Order Statistics Tree hot sheet
- Monotonic Stack / Queue hot sheet
- Splay Tree hot sheet
- Graph cheatsheet
- Low-Link hot sheet
- Eulerian hot sheet
- De Bruijn Sequence hot sheet
- Two-SAT hot sheet
- Tree Isomorphism hot sheet
- Subtree Queries hot sheet
- Virtual Tree hot sheet
- HLD hot sheet
- Centroid Decomposition hot sheet
- Link-Cut Tree hot sheet
- Euler Tour Tree hot sheet
- Shortest Paths hot sheet
- Flow hot sheet
- Push-Relabel hot sheet
- Global Min-Cut hot sheet
- Gomory-Hu hot sheet
- Flow With Lower Bounds hot sheet
- Min-Cost Flow hot sheet
- Matching hot sheet
- Stable Marriage hot sheet
- Hungarian hot sheet
- General Matching hot sheet
- Huffman / Data Compression hot sheet
- Meet-In-The-Middle hot sheet
- DP cheatsheet
- SOS DP hot sheet
- FWHT / XOR Convolution / Subset Convolution hot sheet
- Bit-Parallelism / Bitset Optimization hot sheet
- Broken Profile hot sheet
- Divide and Conquer DP hot sheet
- Knuth Optimization hot sheet
- CHT / Li Chao hot sheet
- Slope Trick hot sheet
- Aliens Trick hot sheet
- Simplex hot sheet
- Matroid Intersection hot sheet
- Online Algorithms hot sheet
- Machine Learning hot sheet
- Gradient Descent hot sheet
- Quantum Algorithms hot sheet
- Parallel Algorithms hot sheet
- Digit DP hot sheet
- Combinatorics cheatsheet
- Burnside / Pólya hot sheet
- Linear Recurrence hot sheet
- Berlekamp-Massey / Kitamasa hot sheet
- Gaussian Elimination hot sheet
- XOR Basis hot sheet
- Sprague-Grundy hot sheet
- Probability hot sheet
- Polynomial / FPS hot sheet
- Lucas Theorem hot sheet
- Discrete Log hot sheet
- Modular Square Root hot sheet
- Primitive Root hot sheet
- Pollard-Rho hot sheet
- Mobius hot sheet
- Dirichlet prefix sums hot sheet
- Min_25 / Du Jiao hot sheet
- Number theory cheatsheet
- Modular Arithmetic hot sheet
- Chinese Remainder hot sheet
- String cheatsheet
- Palindromes hot sheet
- Eertree hot sheet
- String Hashing hot sheet
- Aho-Corasick hot sheet
- Regex / Finite Automata hot sheet
- Suffix Tree hot sheet
- Suffix Array / LCP hot sheet
- Geometry cheatsheet
- Half-Plane Intersection hot sheet
- Minkowski Sum hot sheet
- Nearest Pair hot sheet
- Contest checklist
- Anti-Hack Workflow
- Stress testing workflow
- Local judge workflow
- Many-Valid-Answers / Validator-First Workflow
- Special Judge / Output Protocol Workflow
Good Pairings¶
- Fenwick / dynamic prefix counts -> Fenwick hot sheet + Data structures cheatsheet
- merge-only components -> DSU hot sheet + Data structures cheatsheet
- offline add/remove connectivity -> DSU Rollback hot sheet + Offline Tricks hot sheet
- segment tree under pressure -> Segment Tree hot sheet + Data structures cheatsheet
- online range add + range sum -> Lazy Segment Tree hot sheet + Segment Tree hot sheet
- online range
chmin / chmax / add / sum-> Segment Tree Beats hot sheet + Lazy Segment Tree hot sheet - versioned array queries -> Persistent Data Structures hot sheet + Segment Tree hot sheet
- versioned split/merge lists -> Persistent Treap hot sheet + Treap / Implicit Treap hot sheet
- heaps that must meld online -> Pairing / Leftist Heap hot sheet + Data structures cheatsheet
- textbook balanced-BST curiosity / AVL or Red-Black or Scapegoat or SBT compare work -> Balanced BST hot sheet + Order Statistics Tree hot sheet
- textbook high-fanout search-tree breadth / split-full-child refresher -> B-Tree hot sheet + Balanced BST hot sheet
- textbook probabilistic ordered-dictionary breadth -> Skiplist hot sheet + Balanced BST hot sheet
- bounded-universe predecessor / successor breadth -> X-Fast / Y-Fast hot sheet + Binary Trie hot sheet
- dynamic interval overlap queries over one live interval set -> Interval Tree hot sheet + Balanced BST hot sheet
- self-adjusting ordered set or a refresher before link-cut tree -> Splay Tree hot sheet + Link-Cut Tree hot sheet
- first-smaller / first-greater boundary scans or fixed-width window extrema -> Monotonic Stack / Queue hot sheet + Data structures cheatsheet
- interval partitions that stay viable because assign keeps collapsing runs -> ODT / Chtholly hot sheet + Lazy Segment Tree hot sheet
- mutable sequence edits by position -> Treap / Implicit Treap hot sheet + Lazy Segment Tree hot sheet
- static subarray order statistics -> Wavelet Tree hot sheet + Persistent Data Structures hot sheet
- static idempotent range queries -> Sparse Table hot sheet + Data structures cheatsheet
- reorderable query batches -> Offline Tricks hot sheet + Data structures cheatsheet
- static range queries with cheap endpoint add/remove -> Mo's hot sheet + Offline Tricks hot sheet
- live integer set with maximum xor queries -> Binary Trie hot sheet + Data structures cheatsheet
- live ordered set with online rank /
k-th queries -> Order Statistics Tree hot sheet + Data structures cheatsheet - tree path queries -> HLD hot sheet + Graph cheatsheet
- shortest paths -> Shortest Paths hot sheet + Graph cheatsheet
- low-link critical structure -> Low-Link hot sheet + Graph cheatsheet
- use-every-edge-once graph tasks -> Eulerian hot sheet + Graph cheatsheet
- overlap-string construction where every length-
nwindow must appear once -> De Bruijn Sequence hot sheet + Eulerian hot sheet - binary clause feasibility -> Two-SAT hot sheet + Graph cheatsheet
- rooted or center-rooted tree shape comparison -> Tree Isomorphism hot sheet + Trees
- subtree-only tree aggregation -> Subtree Queries hot sheet + Graph cheatsheet
- subset-like exact search around
n ≈ 40-> Meet-In-The-Middle hot sheet + Complexity And Hardness - marked-subset tree compression -> Virtual Tree hot sheet + Graph cheatsheet
- tree problems that want balanced recursive splits -> Centroid Decomposition hot sheet + Graph cheatsheet
- dynamic tree path queries -> Link-Cut Tree hot sheet + Graph cheatsheet
- dynamic tree subtree-side queries -> Euler Tour Tree hot sheet + Treap / Implicit Treap hot sheet
- recover
xfroma^x ≡ b (mod m)-> Discrete Log hot sheet + Number Theory cheatsheet - recover one root from
x^2 ≡ a (mod p)under one prime modulus -> Modular Square Root hot sheet + Number Theory cheatsheet - flow / cuts / transport -> Flow hot sheet + Graph cheatsheet
- hard plain max-flow benchmark or preflow-engine reopen -> Push-Relabel hot sheet + Flow hot sheet
- one undirected weighted graph with no designated
s-t, asking only for the cheapest disconnection cut -> Global Min-Cut hot sheet + Flow hot sheet - many undirected pairwise min-cuts -> Gomory-Hu hot sheet + Flow hot sheet
- mandatory lower / upper edge flow bounds -> Flow With Lower Bounds hot sheet + Flow hot sheet
- costed transport under capacities -> Min-Cost Flow hot sheet + Flow hot sheet
- bipartite pairing -> Matching hot sheet + Flow hot sheet when the reduction is ambiguous
- stable one-to-one pairing under strict preferences -> Stable Marriage hot sheet + Matching hot sheet
- dense square weighted assignment -> Hungarian hot sheet + Matching hot sheet
- non-bipartite maximum matching -> General Matching hot sheet + Matching hot sheet
- optimal binary prefix-code tree / repeated merge-two-smallest -> Huffman / Data Compression hot sheet + Greedy
- digit-counting on large ranges -> Digit DP hot sheet + DP cheatsheet
- full mask-cube subset/superset aggregates -> SOS DP hot sheet + DP cheatsheet
- pair-combine two full mask functions under xor, or one exact subset split inside each mask -> FWHT / XOR Convolution / Subset Convolution hot sheet + SOS DP hot sheet
- one huge boolean sum axis or component-size reachability row -> Bit-Parallelism / Bitset Optimization hot sheet + Knapsack Family
- partition DP with monotone split points -> Divide and Conquer DP hot sheet + DP cheatsheet
- affine DP / online line minimum -> CHT / Li Chao hot sheet + DP cheatsheet
- convex piecewise-linear position/value DP with hinge penalties -> Slope Trick hot sheet + DP cheatsheet
- exact-
Kpicks / segments via penalty search -> Aliens Trick hot sheet + DP cheatsheet - one small continuous LP in contest max form -> Simplex hot sheet + Optimization And Duality
- two independence systems on one explicit ground set -> Matroid Intersection hot sheet + Optimization And Duality
- one first competitive-ratio benchmark with no future knowledge -> Online Algorithms hot sheet + Randomized Algorithms
- one linearly separable binary classifier with mistake-driven online updates -> Machine Learning hot sheet + Online Algorithms
- one smooth-loss breadth benchmark with deterministic full-batch updates -> Gradient Descent hot sheet + Machine Learning Algorithms
- one simulator-first quantum breadth benchmark around Hadamard layers and a promise oracle -> Quantum Algorithms hot sheet + FWHT / XOR Convolution / Subset Convolution
- one work/span breadth benchmark around Blelloch scan and PRAM-style thinking -> Parallel Algorithms hot sheet + Prefix Sums
- linear systems modulo one prime -> Gaussian Elimination hot sheet + Modular Arithmetic hot sheet
- linear recurrence under one modulus -> Linear Recurrence hot sheet + Modular Arithmetic hot sheet
- higher-order recurrence jump or recurrence recovery from a prefix -> Berlekamp-Massey / Kitamasa hot sheet + Linear Recurrence hot sheet
- truncated FPS inverse / log / exp under
998244353-> Polynomial / FPS hot sheet + FFT And NTT - subset xor span / maximum subset xor -> XOR Basis hot sheet + Binary Trie hot sheet when xor semantics are ambiguous
- impartial normal-play heaps/components -> Sprague-Grundy hot sheet + DP cheatsheet
- finite random processes / exact expectation -> Probability hot sheet + DP cheatsheet
- small-width grid frontier occupancy -> Broken Profile hot sheet + DP cheatsheet
- ordered sets / sliding windows -> Data structures cheatsheet
- modular arithmetic /
nCk-> Modular Arithmetic hot sheet + Number theory cheatsheet - symmetry counting up to cyclic rotation -> Burnside / Pólya hot sheet + Modular Arithmetic hot sheet
- congruence systems or one inverse under composite modulus -> Chinese Remainder hot sheet + Modular Arithmetic hot sheet
- large
nCk mod pwithpprime and small enough for one digit table -> Lucas Theorem hot sheet + Modular Arithmetic hot sheet - gcd/divisor counting over all
d <= MAX-> Mobius hot sheet + Number theory cheatsheet - summatory arithmetic functions that collapse into one divisor-side floor-sum -> Dirichlet prefix sums hot sheet + Number theory cheatsheet
- implicit prefix sums of
phi/muon one quotient setQ_n-> Min_25 / Du Jiao hot sheet + Number theory cheatsheet - modular square-root extraction under one prime modulus -> Modular Square Root hot sheet + Modular Arithmetic hot sheet
- primitive-root finding under one prime modulus -> Primitive Root hot sheet + Number theory cheatsheet
- 64-bit integer factorization -> Pollard-Rho hot sheet + Number theory cheatsheet
- one static palindrome scan -> Palindromes hot sheet + String cheatsheet
- one append-only distinct-palindrome structure -> Eertree hot sheet + Palindromes hot sheet
- substring fingerprints -> String Hashing hot sheet + String cheatsheet
- many patterns in one text -> Aho-Corasick hot sheet + String cheatsheet
- one small regex language matched as an epsilon-NFA -> Regex / Finite Automata hot sheet + String cheatsheet
- one static text as a compressed substring index -> Suffix Tree hot sheet + String cheatsheet
- exact static suffix structure -> Suffix Array / LCP hot sheet + String cheatsheet
- polygon and segment geometry -> Geometry cheatsheet
- bounded feasible polygons from directed line constraints -> Half-Plane Intersection hot sheet + Geometry cheatsheet
- convex-region addition or scaled point queries after polygon sums -> Minkowski Sum hot sheet + Geometry cheatsheet
- global nearest distance in one static point set -> Nearest Pair hot sheet + Geometry cheatsheet
- debugging a suspicious implementation -> Stress testing workflow
- hack-sensitive constructive or open-hack fragility -> Anti-Hack Workflow
- interactive or simulator-style tasks -> Local judge workflow
- interactive task where the harness exists but the protocol loop still feels fragile -> Local judge workflow + Interactive Protocol Clinic 01
- many-valid-answers task where the legality contract is still fuzzy -> Many-Valid-Answers / Validator-First Workflow
- predicate-checked batch output or custom-judge legality -> Special Judge / Output Protocol Workflow + Local judge workflow
Learn -> Practice -> Retrieve¶
Use this layer as the Retrieve step, not the first step:
| If you need... | Open first | Then |
|---|---|---|
| proof or slower explanation | Topics | come back here after the idea is trusted |
| a concrete next problem | Problem Finder | then reopen the relevant sheet |
| a pasteable snippet | Build Kit | then the relevant template |
Reopen Rules¶
- if you need proofs, go to
topics/ - if you need a pasteable skeleton, go to Template library
- if you need the exact next problem or next short set, go to Problem Finder