Skip to Content

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

  1. Your first program: typed input, ranges, let and var, loops, print, traps.
  2. Arrays and index spaces: domains, 1-based input, positions and cuts, prefix sums, grids.
  3. Optionals instead of sentinels: ?Int, None, ??, max= and min=, a BFS without INF.

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

On this page