icpc-algorithm-template

I built this C++ reference with Codex while preparing for ICPC and CCPC. It brings implementations, notes on where they break, tests, and a printable handbook into one place. My team earned bronze at the 2026 CCPC Leshan contest. This English page is a guide to the library; the full file-by-file catalog is in Chinese.

What’s in it#

The catalog contains 196 C++ template files. Here is the chapter breakdown.

ChapterFilesExamples
Basics and techniques14Monotonic stacks and queues, two pointers, bit operations, multidimensional differences
Data structures38Segment trees, link-cut trees, wavelet trees, rollback DSU
Strings15KMP, Aho–Corasick, suffix structures, palindromic trees
Graph theory48Shortest paths, tree algorithms, matching, flows, Steiner trees
Mathematics39Number theory, combinatorics, matrices, polynomials, simplex
Dynamic programming18Knapsack, tree DP, digit DP, bitmask DP, Slope Trick
Search8DFS and BFS, meet-in-the-middle, A*, IDA*, DLX
Computational geometry13Convex hulls, half-plane intersection, circles, Minkowski sums
Implementation and debugging3Performance measurement, random tests, and interactive I/O

Using and testing a template#

Most files have no main. Take the module you need and check its indexing, capacity, initialization, modulus, and dependencies. Several files reuse global names, so combining whole directories into one program can cause conflicts. The source notes are in Chinese, and some modules use GNU C++ extensions.

The test suite has 190 C++ entry points that include the actual templates. It checks boundary cases, compares against independent implementations, and runs randomized tests. The LaTeX handbook shares the same code and text and uses a two-column A4 layout.

Repository and full file index · Complete file-by-file catalog in Chinese