Learn CP Lang
For people who already program in C++, Python, Java or Rust and want to write contest solutions in CP Lang.
Everything here runs in your browser on the real compiler. Nothing to install.
There are two tracks. Do them in either order, or side by side.
Read
Short chapters, read in order. Each one is prose with live examples you can edit and run, and ends with one problem.
Practice
Small implementation problems, about the level of a Div 2 A or B. Each one is picked to teach one piece of the language.
Read
- Your first program: typed input, ranges,
letandvar, loops,print, traps. - Arrays and index spaces: domains, 1-based input, positions and cuts, prefix sums, grids.
- Optionals instead of sentinels:
?Int,None,??,max=andmin=, a BFS withoutINF.
Coming soon: functions, structs and match; strings and output; collections, sorting and searching; the standard library; stress testing and the trace debugger. Until then, the guides cover them.
In a hurry
- Your first program in five minutes
- The cheat sheet: the whole language on one page
- Six problems side by side with the language you know: C++, Python, Java, Rust