Beta

Write the editorial, not the boilerplate.

CP Lang is a language for competitive programming. It compiles to one readable C++17 file you submit anywhere.

Output
Press Run (Ctrl+Enter).

The limits from the statement are the types. Change 90 to 900 in the input and run: the run stops and names the value.

Compare with the C++ (15 lines against 3)
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    assert(1 <= n && n <= 200000);
    vector<int> a(n);
    long long sum = 0;
    for (int& x : a) {
        cin >> x;
        assert(1 <= x && x <= 100);
        sum += x;
    }
    cout << sum << "\n";
}

A standard library built for contests

Segment trees, shortest paths, union-find and modular arithmetic are one line each. Browse the library (63 modules)

Output
Press Run (Ctrl+Enter).

Point updates and range minimum. You give SegTree the operation; fold takes the range as the statement writes it.

Whole olympiad solutions

Complete solutions to real olympiad problems, next to more of the syntax they rely on. Run each in place; one the compiler does not run yet shows its status instead, until it does.

Output
Press Run (Ctrl+Enter).

CCO 2021 Travelling Merchant, the whole solution. Peel dead ends off the reversed graph, keep the rest, and settle answers from a heap.

Compare with the accepted C++
Output
Press Run (Ctrl+Enter).

The statement's format and limits are written once. They drive parsing, validation and the width of every value.

Learn it in 30 minutes
One page, every example runs in the browser.
Coming from C++, Python, Java or Rust
Six problems, side by side with what you know.
Look something up
Guides, the language reference and the library.
How fast is it?
Across 105 timed ports, the generated C++ takes a median 0.78x the time of matched hand-written C++ (lower is faster), and 1.98x at p95. The bar is a median of at most 1.1x, p95 at most 1.2x and max at most 1.5x; it isn't met yet. See the full distribution
100 real problems
Accepted C++ next to its CP Lang rewrite, with notes, linking to each judge's statement. Browse the gallery