# CP Lang > A competitive-programming language that compiles to one readable C++17 file. Beta (0.3). The full documentation as one file: /llms-full.txt ## Docs - [Ownership, lends & borrowing](/docs/guides/borrowing): Value semantics, mut parameters, lends projections, and @law disjoint without lifetimes. - [Cheat sheet](/docs/guides/cheatsheet): One page of CP Lang: input, output, control flow, optionals, collections, functions and tools. - [From C++17 & performance](/docs/guides/cpp-guide): C++17-to-CP-Lang translation guide, emitted memory layouts, and zero-overhead escape hatches. - [Getting started & CLI](/docs/guides/getting-started): Install the cpl toolchain, run programs locally, and compile submittable C++17. - [Idioms](/docs/guides/idioms): Gold-standard CP Lang idioms: domains, optionals, reductions, grids, and stdlib structures. - [Index spaces, domains & slices](/docs/guides/indices): Typed positions, .l/.r boundaries, grids, slices, arenas, and coordinate compression. - [I/O, formatting & contest modes](/docs/guides/io-and-formatting): Typed read(), print() formatting, @!multitest, interactive ask, and IOI graders. - [Standard & local libraries](/docs/guides/stdlib): Overview of all std modules plus local library packaging and recipes. - [Stress testing](/docs/guides/stress): Find and shrink counterexamples with @alt, @gen, @check, and @interactor — on the CLI or in the browser. - [Strings & ASCII text](/docs/guides/strings): 0..len byte strings, slicing, parsing, nominal character domains, and string algorithms. - [Memoization, stress testing & Trace](/docs/guides/testing): @memo caching, @alt/@check/@interactor verification, and the visual Trace debugger. - [Language tour](/docs/guides/tour): A guided walkthrough of syntax, program layout, and everyday contest idioms. - [Types, numbers & control flow](/docs/guides/types-and-control): Numeric rules, ranges, Tropical Optionals, structs, enums, traits, and loops. - [Documentation](/docs): Guides and reference for CP Lang 0.3 (beta). - [0. Overview](/docs/ref/core/00-overview): The normative CP Lang 0.3 specification. - [1. Lexical structure and grammar](/docs/ref/core/01-lexical-grammar): The normative CP Lang 0.3 specification. - [2. Values and types](/docs/ref/core/02-values-types): The normative CP Lang 0.3 specification. - [3. Numbers, widths and layout](/docs/ref/core/03-numbers-layout): The normative CP Lang 0.3 specification. - [Round 1: indices and ranges](/docs/ref/core/04-indices): The normative CP Lang 0.3 specification. - [Index identity vs offset](/docs/ref/core/04a-identity-vs-offset): The normative CP Lang 0.3 specification. - [Keys: identity everywhere, keys in, keys out](/docs/ref/core/04b-keys): The normative CP Lang 0.3 specification. - [Ownership, mutation and lending](/docs/ref/core/05-ownership): The normative CP Lang 0.3 specification. - [6. Functions, closures and generators](/docs/ref/core/06-control-functions): The normative CP Lang 0.3 specification. - [Round 2: sequences and views](/docs/ref/core/07-sequences): The normative CP Lang 0.3 specification. - [8. Traits, generics, laws and row types](/docs/ref/core/08-traits-generics): The normative CP Lang 0.3 specification. - [9. Contexts, checks and build modes](/docs/ref/core/09-contexts-checks): The normative CP Lang 0.3 specification. - [10. Input, output and program shape](/docs/ref/core/10-io): The normative CP Lang 0.3 specification. - [11. Files, modules, prelude and versions](/docs/ref/core/11-modules-prelude): The normative CP Lang 0.3 specification. - [Powers: what a user library can define](/docs/ref/core/12-powers): The normative CP Lang 0.3 specification. - [13. Lowering to C++](/docs/ref/core/13-lowering): The normative CP Lang 0.3 specification. - [Containers (std.bitset, std.bag, std.interval, std.dsu, std.heap, std.deque, std.marks, std.hashmap, std.seq.Compressed)](/docs/ref/lib/containers): How the library is organised, family by family. - [std.flow: flows, cuts and matchings](/docs/ref/lib/flows): How the library is organised, family by family. - [Standard library design: std.geometry](/docs/ref/lib/geometry): How the library is organised, family by family. - [Round 4: graphs and trees](/docs/ref/lib/graphs-trees): How the library is organised, family by family. - [Standard library design: number theory, combinatorics, NTT and linear algebra](/docs/ref/lib/math): How the library is organised, family by family. - [Round 5: operation values and range structures](/docs/ref/lib/ops-ranges): How the library is organised, family by family. - [Random inputs, alternatives and checkers](/docs/ref/lib/random-stress): How the library is organised, family by family. - [Round 3: search and DP](/docs/ref/lib/search-dp): How the library is organised, family by family. - [Round 7: sequence patterns](/docs/ref/lib/sequence-patterns): How the library is organised, family by family. - [std.strings: complete design](/docs/ref/lib/strings): How the library is organised, family by family. - [algebra](/docs/ref/std/algebra): An associative operation with an identity: the pair (id, op), written Monoid(id, op) or, naming both, Monoid(id: e, op: (a, b) => ...). - [bag](/docs/ref/std/bag): Read-only handle into a SortedBag node, valid until the next mutation. - [beats](/docs/ref/std/beats): Segment Tree Beats over a domain D of Int values. - [bitset](/docs/ref/std/bitset): One bit per position of D, in ceil(K / 64) words. - [deque](/docs/ref/std/deque): A queue with both ends open: var q = Deque(). - [dp](/docs/ref/std/dp): O(1) per evaluation. - [dsu](/docs/ref/std/dsu): A point in the history of a structure that can step back in time, returned by mark() and taken by undo_to. - [fenwick](/docs/ref/std/fenwick): Point add and range sum over anything with + and - (Int, Mod

). - [flow](/docs/ref/std/flow): A handle to one arc of a FlowGraph. - [geometry](/docs/ref/std/geometry): The geometry module. - [graph](/docs/ref/std/graph): O(deg u) per walk of out(u). - [grid](/docs/ref/std/grid): The grid module. - [hashmap](/docs/ref/std/hashmap): Flat open-addressing hash map from Int keys to V, salted with splitmix64. - [heap](/docs/ref/std/heap): A priority queue on <. - [Library](/docs/ref/std): Every public item in the 36 modules of the 0.3 standard library. - [interval](/docs/ref/std/interval): A total partition of domain D into maximal contiguous half-open runs, each carrying a value of type T. - [io](/docs/ref/std/io): The answer word for ok: io.answers.0 when true, else io.answers.1. - [lazy](/docs/ref/std/lazy): Paired aggregate (now, flipped) for range-toggle / complement updates (SegTree(op, a, act: flip)). - [marks](/docs/ref/std/marks): The marks module. - [math](/docs/ref/std/math): The greatest common divisor of a and b, never negative; gcd(0, 0) == 0. - [matrix](/docs/ref/std/matrix): A dense rows x cols matrix stored flat in row-major order. - [mod](/docs/ref/std/mod): An integer modulo the constant P, always stored in 0..P. - [ntt](/docs/ref/std/ntt): The ntt module. - [pair](/docs/ref/std/pair): An unordered pair {lo, hi} of distinct positions of V, lo before hi. - [persistent](/docs/ref/std/persistent): Opaque version handle for PersistentSegTree. - [poly](/docs/ref/std/poly): The poly module. - [prefix](/docs/ref/std/prefix): O(n) calls of f. - [rand](/docs/ref/std/rand): The rand module. - [segtree](/docs/ref/std/segtree): The segtree module. - [seq](/docs/ref/std/seq): Every value of V once, in some order. - [slope](/docs/ref/std/slope): The slope module. - [sparse](/docs/ref/std/sparse): SparseTable(min, a): built in O(n log n) time and memory, fold is O(1). - [strings](/docs/ref/std/strings): self written n times in a row, as a new Str: "0".repeat(4) is "0000". - [subset](/docs/ref/std/subset): A subset of a domain B of at most 64 members, stored as one word (bit k for B's k-th position). - [timetree](/docs/ref/std/timetree): One step in a TimeTree DFS traversal: - Apply(id): apply event tt.event(id) on entry to a segment-tree node. - [tree](/docs/ref/std/tree): A tree rooted at root, owning its own fresh heavy-first preorder domain t.Pre. - [window](/docs/ref/std/window): A sliding fold queue over op. - [Bundling and submission](/docs/ref/tools/bundle): The normative description of each tool. - [The cpl command](/docs/ref/tools/cli): The normative description of each tool. - [cpl explain](/docs/ref/tools/explain): The normative description of each tool. - [Formatter and linter](/docs/ref/tools/fmt-lint): The normative description of each tool. - [Judge profiles](/docs/ref/tools/judge-profiles): The normative description of each tool. - [Language server and editors](/docs/ref/tools/lsp): The normative description of each tool. - [Stress, shrinking and laws](/docs/ref/tools/stress): The normative description of each tool. - [Traces, the debugger and runtime errors](/docs/ref/tools/trace-debug): The normative description of each tool. - [Release notes](/docs/releases): What changed in each version of CP Lang, generated from CHANGELOG.md.