How to Write Competitive Programming Problems for AI
How to write competitive programming problems for AI: a precise statement, one correct output per input, brute force checked tests and a tight difficulty band.
Competitive programming is one of the clearest ways to test how well an AI reasons. A problem has a precise statement, a correct answer and hidden tests, so either the solution works or it does not.
To write a competitive programming problem for AI, start with a statement that is solvable from its own text and has exactly one correct output for each input. Then write a reference solution, check it against a slow brute force, build hidden tests that reject wrong solutions, and calibrate difficulty so a strong model solves it sometimes, but rarely.
Our team has written around 100 of these problems for AI training and evaluation. Each one is a full package: the problem statement, a reference solution in Python or C++, a step by step explanation written like a contest editorial, and hidden tests the solver never sees. The setters behind them come from contests themselves, which is why competitive programmers make strong AI code evaluators.
How hard should a problem for AI be?
Hard enough that a strong model usually fails, but not so hard that it never succeeds. We calibrate every problem the same way. A frontier model, one of the most capable models available, attempts it eight times, and we look at the average success rate across those attempts, often written as avg@8. Our target is easy to say and hard to meet: an average of 40% or less, with at least one correct solve.
Both halves matter, and our setters read the result rather than just the number. If the model never solves it, they go back to the statement and the tests to check whether the problem is broken or unclear, because a problem like that teaches nothing. If the model solves it most of the time, it is too easy to be useful. What we want is a problem that is clearly solvable and still hard. We wrote more about picking that band in what pass rate an AI benchmark should target.
Why must every input have exactly one right output?
Because our tests compare outputs exactly, with no custom checker, a program that would accept any valid answer. If a problem allows more than one valid answer, a correct solution could be marked wrong.
Our setters fix this at the design stage. When a draft asks for any valid example of something, we reframe it to ask for something with one answer, like the shortest length. When two correct solutions could break a tie differently, we pin down the tie break rule in the statement so they cannot print different results.
Never trust the reference alone
Expected outputs must never come from the reference solution alone. If the reference has a bug, every test agrees with the bug and everything looks green. So the setter writes a separate brute force solution, slow but obviously correct, and runs the two side by side on every small input we can list. One mismatch means we stop and find out why. In one validation report we checked 5,077 exhaustive small inputs with zero mismatches.
The statement and the editorial
The problem has to be solvable from its own text. Every term is defined. The output format and tie breaks are pinned. If there can be no answer, the statement says what to print. The constraints cover every test input, and our reviewers check each input against the stated limits before a problem goes out, because a test that breaks the limits punishes a solution that trusted them.
The editorial has to prove every case. If a formula has several branches, each branch needs both a bound and a construction that reaches it. An explanation that derives one branch and just states the others gets sent back. Our reviewers read each editorial with exactly this in mind, because an unproven branch is where a wrong formula usually hides.
Topics range across arrays and prefix sums, dynamic programming, counting and combinatorics, probability and expected value, number theory, strings, graphs and flows, game theory, geometry and trees. Some of the harder ones combine two areas, like string hashing with lattice reduction, or flows with closures. Every problem also gets a set of deliberately wrong solutions that the tests must reject, which we cover in how to write test cases that catch wrong solutions.
- Around 100 contest level problems, each with a statement, reference solution, editorial and hidden tests.
- Eight attempts by a frontier model, an average of 40% or less, and at least one solve.
- Exactly one correct output per input, because the tests compare outputs exactly.
- Our setters check the reference against a brute force they write themselves. One report covered 5,077 inputs with zero mismatches.
FAQ
What is avg@8 in AI evaluation? The average success rate across eight attempts by a model on the same problem.
Why must a problem be solvable by the model at least once? For us, one correct solve is evidence the problem is well posed. A problem nobody can solve may be broken and gives no useful training signal, so our setters recheck it.
How do you verify test outputs are correct? Our setter writes an independent brute force and compares it with the reference solution on every small input, so a shared bug cannot hide.
What is a brute force solution? A simple program that tries every possibility. It is far too slow for large inputs but easy to trust, which makes it the right check for a fast reference on small ones.
Need Hard Reasoning Problems, Delivered Proven?
Our problem setters come from competitive programming. Our Dataset Quality and Annotation team builds problem sets for AI labs and model teams with proofs, brute force checks and tests that reject wrong solutions, calibrated to your model and delivered on your timeline.
Get in TouchKeep reading
All articles- AI & MLJan 20, 2026
Why Competitive Programmers Make Strong AI Code Evaluators
Competitive programmers make strong AI code evaluators. Years of contests train precise spec reading, edge case thinking and complexity analysis. Here is why.
- AI & MLNov 18, 2026
What Do AI Training Data Writers and Reviewers Do?
What does an AI training data reviewer do? Checks tasks for correctness, fairness, difficulty and clean grading. Why our team does both writing and review.
- AI & MLJun 25, 2026
How to Rate Bug Severity in Code Review
Bug severity levels in code review explained: what high, medium and low mean, the one question that settles most labels, and the mistakes we saw most often.