Search the wikiesc

// cp4cpp · learn by compiling

Every algorithm starts with
one compiling program.

CP4CPP teaches C++ and the algorithms behind competitive programming: guided lessons, a proof-first wiki, and tools that turn theory into reflexes.

03
starter lessons, zero gaps
08
planned wiki branches
1
program standing between you and contest C++
lesson-01/hello.cppAC · 0 ms
#include <iostream> int main() {    std::cout << "Hello, CP4CPP!\n";    return 0;}
run ▸Hello, CP4CPP!

This is Lesson 01: your entire first session takes one screen.

§ 02 · how it teaches

Built like a coach,
graded like a judge.

Guided lessons

Ordered steps with prerequisites, worked examples, exercises, and checks. Small steps, no gaps.

Proof-first wiki

Every algorithm comes with its statement, a proof you can follow, and an implementation you can trust.

Visible computation

Simulations of states, graphs, and geometry. Watch the algorithm move instead of imagining it.

§ 03 · straight from the wiki

Tricks you will
actually use.

The wiki is being written around the bit tricks competitive programmers use. Planned entries will connect each statement to a proof and implementation.

  1. ① A power of two has exactly one bit set: subtracting one clears it, leaving zero.
  2. ② Negative two's-complement masks everything above the lowest set bit.
Explore the planned wiki
wiki/bitmask/tricks.cppconstexpr
// x ^ x == 0   x ^ 0 == x   order does not matterconstexpr bool is_power_of_two(unsigned mask) {    return (mask & (mask - 1)) == 0; // ① power of two test: true only here} constexpr unsigned low_bit(unsigned mask) {    return mask & (-mask); // ② isolate lowest set bit}

§ 05 · the quality contract

MICRO keeps it honest.

MMinimalOnly material with a clear purpose.
IInteractiveFeedback where feedback teaches.
CConsistentOne hierarchy, one vocabulary.
RReadableClear beyond expert readers.
OOptimizableEverything stays improvable.

Your first judge-accepted program
is thirty minutes away.