Every problem here is pulled from the live Codeforces API with its real rating and solve count — nothing invented. Rating ladders are the spine; topic ladders are ramps through one tag, ordered easiest first.
More problems is not the thing that improves you. These four are, and they are what strong competitors point at when asked.
Work at your current rating and +100. When roughly 8 in 10 land inside 35 minutes, step up one rung. Jumping ahead feels productive and teaches nothing.
Then read the editorial. Staring for three hours is the single biggest waste in competitive programming — the learning is in reading the solution after real struggle.
Do a virtual contest, then solve everything you could not finish during it. This is the habit most often named as the thing that actually moved someone’s rating.
A problem you needed the editorial for is not learned. Re-solve it cold seven days later. This is pattern recall under time pressure, and it decays.
One caveat, stated plainly: this is competitive programming, not Software Engineer interview prep. It will sharpen your implementation speed, binary search and graph instincts. It will also spend a lot of your time on constructive algorithms, number theory and game theory that interviews never ask about. Use it knowingly alongside the DSA track, not instead of it.
Any problem where a candidate answer can be checked faster than it can be found. If can(x) is monotone — true for everything above some threshold and false below — you can binary search the threshold in log time.
The giveaway phrase is minimise the maximum or maximise the minimum. That is binary search on the answer, essentially always.
check(x), and halve the range. Most 1400–1900 problems tagged this are exactly this.check is monotone before you search. If it is not, binary search is silently wrong.An integer used as a set. Feasible while n is at most about 20–24, because you enumerate all 2n subsets. The moment you see n ≤ 20 in the constraints, think bitmask.
n & (n-1) clears the lowest set bit and n & -n isolates it. Those two show up in more solutions than any other bit trick.
dp[mask] over which elements are used — travelling salesman, assignment, covering. O(2n·n) is the standard shape.for (s = m; s; s = (s-1) & m) walks every submask of m. Total over all masks is 3n, not 4n.xor[i..j] = pre[j] ^ pre[i-1] — the XOR analogue of prefix sums.Not a failure mode — a deliberate reading of the constraints. If n is 100 and the limit is 2 seconds, an O(n3) triple loop is the intended solution and anything cleverer is wasted effort.
Always compute the worst case before dismissing brute force. 108 simple operations runs in about a second; people abandon a correct O(n²) at n = 5000 for no reason.
Counting without enumerating. Almost always modulo 109+7, which means precomputed factorials and modular inverses are the first thing you write.
Precompute factorials and inverse factorials to 2×105 once, at the top of the file. Half of these problems become a one-line formula after that.
fact[], inv_fact[], and Fermat's little theorem for the inverse. The standard opening move.You are asked to build a valid answer, not count or optimise one. There is usually a simple pattern, and the work is finding it rather than implementing it.
Solve n = 1, 2, 3, 4 by hand on paper before writing anything. The pattern is nearly always visible by n = 4, and nearly never visible from staring at the statement.
When the naive solution is right but too slow, and the fix is a structure that makes one operation logarithmic. Recognising which structure is most of the work.
If the problem is range query plus point update, it is a Fenwick tree, and a Fenwick tree is fifteen lines. Do not reach for a segment tree until you actually need range updates.
Depth-first traversal on graphs and grids, plus everything you can compute on the way down and back up. The single most reusable technique on this list.
Write it iteratively with an explicit stack, or raise the recursion limit — a recursive DFS on 105 nodes will stack-overflow in some languages and it is a miserable bug to find.
low[] values from DFS. Standard once you have written it once.Split the input, solve both halves, and do the work that crosses the split. That crossing step is where the whole problem lives.
Counting inversions with merge sort is the template for this entire tag. Learn it properly and half of these become recognisable.
Optimal substructure plus overlapping subproblems. The hard part is never the code — it is choosing what the state means, and doing that badly is why a DP feels impossible.
Write the state as an English sentence first: dp[i][j] is the best value using the first i items with j capacity left. If you cannot write that sentence, you do not have the state right yet.
dp[i][j] grid over two inputs.dp[v][state] combined from children during DFS. Extremely common at 1700+.Union-Find. Use it when the question is only ever are these two in the same group and groups merge but never split.
Path compression plus union by size is five lines and effectively O(1). Writing it without both is the difference between passing and timing out.
Turning a string of operators, numbers and brackets into a value or a tree. Rare in contests, but the technique is fixed and worth owning once.
One recursive-descent parser you have written and understood beats memorising the shunting-yard algorithm you half-remember.
expr → term → factor. The clearest approach by far.( recurse, on ) return. Also the pattern for decoding nested strings.Max-flow and min-cut. The real skill is modelling — recognising that a problem about assignment, selection or scheduling is secretly a flow network.
Max-flow equals min-cut is the theorem that makes this tag useful. Most flow problems are actually asking for the cut.
Two players, both playing optimally. The answer is almost never a simulation — it is a win/lose classification of positions.
Compute the win/lose status for the first ten positions by hand. The pattern is usually periodic and usually obvious, and then the whole problem collapses to a parity check.
Points, lines, polygons. The algorithms are standard; the failure is precision. Stay in integers as long as you possibly can.
Use the cross product for orientation, never a computed slope. Slopes divide, division introduces error, and vertical lines break outright.
Pairing up two sides so nobody is used twice. Bipartite matching covers nearly all of it in practice.
By König's theorem, in a bipartite graph the maximum matching equals the minimum vertex cover. That converts a lot of covering problems into matching problems.
The umbrella tag. Most of the work is recognising that the problem is a graph — states as nodes, transitions as edges — when nothing in the statement says graph.
If the problem has states and moves between them, it is a shortest-path problem even when it looks like a puzzle about a keypad or a jug of water.
Take the locally best option and never reconsider. Fast to write, and wrong far more often than people expect — which is why the proof matters more than the code.
Before you code it, try to construct a counterexample for two minutes. If you cannot, you probably have a correct greedy; if you can, you have just saved yourself a wrong-answer verdict.
Turning a string or a set into a number you can compare in O(1). Powerful, and probabilistic — you are accepting a very small chance of collision.
Use two independent moduli, or a random base chosen at runtime. Fixed, well-known bases get anti-hash tests written against them on Codeforces specifically.
No clever idea — just do exactly what the statement says, carefully. These are lost to bugs and off-by-ones, not to missing insight.
Read the statement twice and write the steps as comments before any code. Time lost here is almost always time spent re-reading, not time spent thinking.
You query a hidden input and get answers back. Almost always a search with a strict query budget, and the budget tells you the intended complexity.
Flush after every single query or you will time out with correct logic. A budget of about 20 queries for n = 106 means binary search; about 2n means a linear scan.
cout << endl, fflush, or flush=True. Forgetting this looks exactly like a wrong algorithm.Formula-and-insight problems. Rarely long code — the difficulty is entirely in the observation, and once you have it the implementation is three lines.
If the answer for small n looks like a known sequence, compute the first six terms and look at the differences. Most of this tag is pattern recognition.
Grids to simulate, or matrix exponentiation to jump a linear recurrence forward billions of steps in log time.
n up to 1018 with a linear recurrence means matrix exponentiation. That constraint is essentially a label on the problem.
Split the input in half, enumerate both halves separately, and combine. Turns 240 into two lots of 220 plus a join.
The tell is n ≤ 40 — too big for 2n, too small for polynomial. That constraint means this technique almost every time.
Divisibility, primes, GCD, modular arithmetic. Heavy in formulas, light in code, and a fixed toolkit that covers most problems.
Trial division to √n is enough to factorise a single number up to 1012. Reach for a sieve only when you need many numbers factorised.
gcd(a,b), and the extended version for modular inverses and linear Diophantine equations.i and n/i in one loop. Appears constantly.Expected values and probabilities, almost always modulo a prime, so 1/3 means the modular inverse of 3 rather than a decimal.
Linearity of expectation applies whether or not events are independent. That single fact trivialises a startling number of hard-looking problems.
dp[state] holding an expected value; transitions weighted by probability.Cheapest route through a weighted graph. Which algorithm you need is decided entirely by the edge weights.
Dijkstra breaks on negative edges — not slowly, but silently and wrongly. Check the weights before you pick the algorithm.
Sorting as the setup rather than the goal. Almost always sort by the right key, then the answer is one linear pass.
Choosing the comparator is the problem. Once the order is right, these usually collapse to a greedy scan.
Suffix arrays, suffix automata and Z/prefix functions. Heavy machinery for substring questions that a hash cannot answer.
Try hashing first — it solves most substring comparison problems in a fraction of the code. Reach for suffix structures when you need all distinct substrings or the longest repeat.
Everything from simple character counting to pattern matching. The easy end is frequency arrays; the hard end is prefix functions and hashing.
A 26-length frequency array answers more string problems than any algorithm on this list. Try counting before you try anything clever.
For a function that rises then falls (or the reverse) with a single peak. Binary search finds a threshold; ternary search finds an extremum.
Prove the function is unimodal first. Ternary search on a function with two local maxima returns a confidently wrong answer.
A connected acyclic graph, which makes almost everything easier: exactly one path between any two nodes, and no cycles to guard against.
Root the tree at node 1 and run one DFS computing subtree values on the way back up. That single pattern solves a large share of this tag.
dp[v][state] merged from children — independent set, matching, colouring on trees.Two indices moving in one direction over a sorted or sequential structure, so a quadratic scan becomes linear. Sliding window is the same idea with one pointer chasing the other.
The window is valid, so move right; the window is invalid, so move left. If you can state the shrink condition in one sentence, you have already solved it.
1,467 distinct problems across 2,400 ladder slots · snapshot taken 2026-08-30 from the Codeforces API · pool of 11,087 rated problems
A problem can sit in several ladders at once — ticking it marks it solved in all of them. Ratings and solve counts drift over time; re-run the generator to refresh.
Back to the ledger →Made By Jatin Bhargava · 2026