Click any module to expand. This module is 80% doing and 20% learning. Every session includes a timed problem-solving component. The goal: by the end, students can solve 3 medium-difficulty problems in 60 minutes consistently.
The platforms, rating systems, templates, and tooling that every competitive programmer needs
Codeforces (Div 1–4 rounds, educational rounds, rating system). AtCoder (ABC/ARC/AGC — best for learning progression). LeetCode (weekly/biweekly contests, company-tagged problems). CodeChef (Starters, Long Challenge). HackerRank, HackerEarth. Which platform to focus on and why.
Codeforces: Newbie → Pupil → Specialist → Expert → Candidate Master → Master. LeetCode: contest rating and percentile. How rating is calculated (Elo-based). Setting realistic targets: Specialist (1400+) in 3 months, Expert (1600+) in 6. Tracking progress with graphs.
ios_base::sync_with_stdio(false), cin.tie(nullptr). #define shortcuts: ll, all(x), pb, mp. Multi-test-case template with solve(). Debug macros: #define dbg(x) cerr << #x << "=" << x. Pre-built snippets: modpow, gcd, sieve, DSU, segment tree. The template that saves 5 minutes per contest.
g++ -O2 -std=c++20 -Wall -Wextra. Address sanitizer (-fsanitize=address,undefined) for catching bugs locally. Setting up competitive programming in VS Code / Sublime with custom build-and-run shortcuts. Online judge quirks: SPOJ stack size, Codeforces time limits.
The 10 STL constructs every contestant memorises: vector, pair, map, set, unordered_map, priority_queue (min-heap trick), stack, deque, bitset, __builtin_popcount. sort with custom comparator as lambda. lower_bound/upper_bound patterns. When to use set vs unordered_set (hash collision attacks).
Virtual contest mode on Codeforces/AtCoder — practice like it's real. The optimal practice loop: virtual contest → upsolve unsolved → read editorial → implement → tag weak topics. Why solving 5 problems in contest mode beats 20 problems untimed. Spaced repetition for algorithm recall.
The meta-skill: reading a problem and identifying the technique within 2 minutes
Two pointers, sliding window, binary search on answer, prefix sums, hash maps, sorting + greedy, BFS/DFS on grid, union-find, segment tree queries, DP (1D, 2D, bitmask), backtracking, math/number theory, string matching, interactive, constructive. Every problem maps to one (or a combination).
"Minimum/maximum" → binary search on answer or DP. "Count of subarrays" → prefix sum + hash. "Connected components" → DSU or DFS. "Lexicographically smallest" → greedy. "All permutations" → backtracking. "Shortest path" → BFS or Dijkstra. Building an instant-lookup mental index.
n ≤ 20 → brute force / bitmask (2ⁿ). n ≤ 10⁴ → O(n²). n ≤ 10⁵ → O(n log n). n ≤ 10⁶ → O(n). n ≤ 10⁸ → O(n) or O(1). Reading constraints to eliminate impossible approaches BEFORE thinking about the problem. The fastest problem-solving shortcut.
Problems where you BUILD a valid solution, not search for one. "Construct an array where..." "Find any permutation such that..." Pattern: work backwards, use parity/invariant arguments, exploit edge cases. A category Codeforces loves that DSA training rarely covers.
Interactive problems: query the judge, receive answers, deduce the hidden structure. "Guess the number in ≤ 20 queries" (binary search). "Find the hidden graph." I/O flush requirements. Output-only: generate solutions offline. Contest-specific formats students must know.
Problems that don't fit standard patterns — require a unique observation or insight. Parity arguments, invariant identification, game simulation, pigeonhole principle. "If you can't find the pattern in 5 minutes, simulate small cases on paper." The skill of finding the trick.
Writing correct code FAST — the skill that separates contest performers from concept knowers
Consistent variable naming under pressure. Direction arrays for grid problems: int dx[]={0,0,1,-1}. Input reading patterns for various formats (graph, tree, matrix, queries). Output formatting. Writing modular code even in contests — because bugs in spaghetti code cost more time than writing clean code.
Integer overflow (use long long for n > 46340). Off-by-one errors in binary search (lo < hi vs lo <= hi vs lo+1 < hi). Array index out of bounds. Forgetting to reset globals between test cases. Modular arithmetic mistakes. The 10 bugs that cause 80% of wrong answers.
mod addition, subtraction (handle negatives!), multiplication. modpow (binary exponentiation). Modular inverse (Fermat for prime mod). nCr mod p using precomputed factorials and inverse factorials. The modular arithmetic template every contestant carries. MOD = 1e9+7 and MOD = 998244353.
__builtin_popcount, __builtin_clz, __builtin_ctz. Iterating over all subsets of a bitmask. Checking if a bit is set: (mask >> i) & 1. Setting/clearing bits. XOR properties for toggling. Bitset for O(n/64) operations. The bit tricks that save 5 lines and prevent bugs.
Can you write a segment tree in 10 minutes without looking it up? DSU in 3 minutes? Trie in 5? BIT in 3? The contest test: if you can't implement it from memory, you can't use it under pressure. Drilling implementation speed for 8 core structures until they're muscle memory.
The problem categories that appear as problems A, B, C in Codeforces rounds — build speed on these first
Build the answer greedily: sort + sweep, priority queue selection, exchange arguments. "Prove your greedy works" — the informal proof skill. Activity selection, job scheduling, minimum platforms, reorganise string, partition labels. Speed target: solve in 8–12 minutes.
Sort by one dimension, process by another. Meeting rooms, merge intervals, event scheduling, minimum arrows to burst balloons. Custom sort comparators. When sorting transforms O(n²) into O(n log n). Speed target: 5–10 minutes.
Not learning the technique (DSA covers that) — practising SPEED. Given a two-pointer problem, code the solution in under 8 minutes. 20+ timed drills on: pair sum, 3Sum, minimum window substring, longest without repeating. Speed is the goal, not understanding.
Binary search on answer: minimum capacity, maximum minimum distance, split array largest sum. Binary search on sorted rotated array variants. Timed drills: identify binary search applicability in 1 minute, implement in 5. 15+ problems at speed.
GCD/LCM applications, prime factorisation, sieve applications, Euler's totient in problems, combinatorics (nCr mod p), probability in contests. Recognising when a problem is "just math" — no complex data structure needed. Speed: recognise + implement in 10 minutes.
Hashing for substring comparison. Palindrome detection variants. Character frequency-based problems. KMP/Z when exact matching is needed. Timed practice: solve common string contest problems in 8–12 minutes. Build the "string problem" pattern library.
Problems D, E, F in contests — the problems that gain rating points and crack top-tier interviews
Many hard problems don't look like graph problems but ARE graph problems. "Transform word A to word B" = BFS on word graph. "Minimum cost to connect" = MST. "Dependency ordering" = topological sort. The skill: recognising when to MODEL the problem as a graph.
Not learning DP (DSA covers that) — practising DP STATE DESIGN at speed. Given a new problem, define dp[i][j] within 3 minutes. Recognise knapsack variants, interval DP, bitmask DP, digit DP triggers. 20+ timed DP problems. The skill: state definition speed.
Range query problems in contests: identify when segment tree or BIT is needed. Implement from memory, apply to the problem, submit. Range update + range query, count inversions, merge sort tree applications. Speed: identify → implement → submit in 15 minutes.
Shortest path variants (Dijkstra with state), cycle detection in directed graphs (contest version), SCC applications (2-SAT reduction), Euler tour for subtree queries. Recognising which graph algorithm applies from the problem constraints.
Problems that ask "count the number of ways." Inclusion-exclusion, Burnside's lemma, Catalan number recognition, stars and bars, generating functions (conceptual). Modular arithmetic for large answers. The "counting" pattern that appears in 20%+ of hard problems.
Finding bugs in 3 minutes instead of 30 — the skill nobody teaches but everyone needs
The debugging checklist (in order): array bounds → integer overflow → uninitialised variables → off-by-one → edge cases (n=1, n=0, all same) → wrong data type → wrong MOD. Running through this list in 2 minutes catches 90% of bugs. Don't think — check systematically.
Write a brute-force solution (O(n²) or worse). Write a random test generator. Run both, compare outputs. If they differ — you have a counter-example. Automate with a bash script. The ONLY reliable way to find subtle bugs. Should be muscle memory: takes 5 minutes to set up.
The 20 edge cases that catch contestants: empty input, single element, all elements same, all elements max value, sorted input, reverse-sorted, negative numbers, zero, large n with small values, small n with large values, disconnected graph, tree that's a line, tree that's a star. Always test these.
"At most K operations" vs "exactly K operations." "1-indexed" vs "0-indexed." "Distinct elements" vs "not necessarily distinct." "Connected graph" vs "not necessarily connected." The two words you missed that gave you WA. Reading skills are debugging skills.
Time management, problem ordering, penalty optimisation, and handling pressure
Read ALL problems in the first 5 minutes. Estimate difficulty. Start with the easiest, not the first. Time budget per problem: Easy (10–15 min), Medium (15–25 min), Hard (25–40 min). If stuck for 5 minutes with no progress — SKIP and return. Never spend 40 minutes on one problem when 3 easier problems are unsolved.
Codeforces: time penalty matters — submit early for higher score. LeetCode: wrong submissions don't penalise but waste time. ICPC: 20-minute penalty per wrong answer. Test locally before submitting. "One more test case" is worth 2 minutes to avoid a 20-minute penalty.
Step 1: Re-read the problem (you probably missed something). Step 2: Try small examples by hand. Step 3: Consider the constraint (what algorithm fits?). Step 4: Think about the OPPOSITE problem. Step 5: If still stuck after 5 minutes — skip, solve other problems, return with fresh eyes. Never panic-code.
Pre-contest routine: open template, test compilation, breathe. During: focus on YOUR performance, not the leaderboard. After wrong answer: systematic debugging, not random changes. After a bad contest: upsolve, learn, don't dwell. The mental game is real — ignoring it is a competitive disadvantage.
After every contest, solve the problems you COULDN'T solve during the contest. Read the editorial. Implement the solution. Add it to your problem archive. Tag it by technique. Growth formula: 50% contest + 50% upsolving. Students who only contest without upsolving plateau at Specialist.
Structured weekly contest participation with upsolving, analysis, and rating trackings
4–5 problems, 2 hours, rated internally. Problems curated by difficulty: 1 easy, 2 medium, 1 medium-hard, 1 hard. Leaderboard and rating tracked. Post-contest editorial session: trainer walks through optimal solutions for all problems. The backbone of the module.
Participate in past Codeforces rounds as virtual contests (timed, rated experience). Start with Div 3, progress to Div 2, then Div 1/Div 2 combined. Track virtual performance vs actual standings. The most effective practice format because it simulates real pressure.
Join live LeetCode Weekly and Biweekly contests. Company-relevant problem formats. Track contest rating progression. Compare solutions with top performers. LeetCode contest problems directly mirror placement coding round formats.
Maintain a personal problem archive: each solved problem tagged by technique, difficulty, and time taken. Identify weak techniques (e.g., "I solve graph problems slowly" or "I can't recognise DP state design"). Dedicate targeted practice sessions to weak areas. Review archive before contests.
Target milestones: Codeforces Specialist (1400+) → Expert (1600+). LeetCode contest rating 1800+. Solving 3/4 problems consistently in Codeforces Div 2. Solving 3/4 in LeetCode weekly. 300+ problems solved total. These are the measurable outcomes that signal competitive coding fluency.
The gold standard. Rated rounds multiple times per week. Div 1–4 difficulty tiers. Largest competitive programming community globally. Best for: rating-based progression and contest experience.
Japanese platform with exceptionally well-designed problems. ABC (beginner) → ARC → AGC progression. Cleanest problem statements. Best for: learning progression and mathematical/constructive problems
Weekly and biweekly rated contests. Company-tagged problems for targeted placement prep. Most directly relevant to interview coding rounds. Best for: placement-specific practice and company-tagged drilling.
Indian platform with Starters (rated short contests) and Long Challenge format. Strong Indian community. Cook-offs and Lunchtime rounds. Best for: Indian competitive programming community and beginner-friendly progression.
Team-based (ICPC) and individual (Meta Hacker Cup) premier contests. Multi-round elimination format. The pinnacle of competitive programming achievement. ICPC regionals are the target for top college teams.
Used by companies for hiring assessments. Many campus recruitment coding rounds run on these platforms. Best for: practising the exact platform students will encounter during placement drives.
Trainers with Codeforces Expert/Master ratings solve contest problems live — showing the decision-making process, not just the solution. "I see n ≤ 10⁵, so O(n log n) works. This looks like a binary search on answer..."
2-hour timed contests every week with 4–5 problems. Internal rating system. Post-contest editorial session. Leaderboard creates competition. This is the primary learning vehicle — not lectures.
3 problems daily on the platform — solve all 3 in 45 minutes. Topic-rotated: Monday (greedy), Tuesday (DP), Wednesday (graphs), Thursday (strings), Friday (mixed). Speed is tracked and graphed.
Student dashboards: problems solved by topic, average time per difficulty, contest rating progression, weak technique identification. TPOs see: which students are contest-ready, which need more practice.
Across Codeforces, LeetCode, and the internal platform. Tagged by technique and difficulty."
Specialist level — solves problems A, B, C consistently in Div 2 rounds.
Consistently solve 3 medium-difficulty problems within a 60-minute window.
Implement segment tree, BIT, DSU, trie, heap, graph (adj list), sparse table, and stack from memory in under 10 minutes each.
Read a new problem statement and identify the primary technique within 2 minutes, 80%+ of the time.
Weekly internal contests + Codeforces virtual contests + LeetCode weekly. Upsolving done for each.
TCS, Infosys, Wipro, Google, Amazon — every company's coding round gives 2–4 problems in 45–90 minutes. This is literally a competitive programming contest. Students who've done 50+ contests treat placement rounds as routine. Students who haven't, panic.
Google, Flipkart, Tower Research, DE Shaw, and several startups ask for Codeforces/LeetCode profiles during hiring. A Codeforces Specialist (1400+) or LeetCode Top 15% rating is a concrete, verifiable signal of coding ability that resumes can't fake.
A student who knows DP but takes 30 minutes to code a solution loses to a student who codes it in 12 minutes. Competitive coding training builds IMPLEMENTATION SPEED — the ability to translate a correct approach into correct code, fast. Speed is trainable. This module trains it.
The correlation is direct: students who can solve 3/4 problems in a placement coding round get shortlisted for higher-package roles. Students who solve 1/4 get filtered to lower-package tracks. Competitive coding training is an investment in placement package outcomes.