> ## Documentation Index
> Fetch the complete documentation index at: https://resources.devweekends.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Competitive Programming Mastery

> The ultimate strategic guide to dominate Codeforces and ICPC with pattern recognition and winning strategies

# Competitive Programming Mastery

<img src="https://mintcdn.com/devweeekends/AEOaWh79Ur7CdHHv/images/courses/cp/cp-mastery-path.svg?fit=max&auto=format&n=AEOaWh79Ur7CdHHv&q=85&s=6715f1d69d26be23f3cf957755a283bb" alt="CP Mastery Path" width="1080" height="1080" data-path="images/courses/cp/cp-mastery-path.svg" />

> **This isn't just another algorithms course.** This is a strategic battle plan to take you from solving Div2A problems to crushing Div1 and qualifying for ICPC World Finals. Every chapter is designed with one goal: **make you win.**

<Info>
  **Course Goal**: Take you from **Newbie (800)** to **Expert (1600+)** on Codeforces and prepare you for **ICPC Regionals** within 6-12 months of dedicated practice.
</Info>

***

## The Winning Formula

Most people practice CP wrong. They solve random problems, never upsolve, and wonder why they plateau. Here's the formula that actually works:

```
Rating Growth = Pattern Recognition × Problem Quantity × Upsolving × (1 / Random Solving)
```

<CardGroup cols={2}>
  <Card title="Pattern Recognition" icon="brain">
    80% of CF problems use just 15 core patterns. Master them and you'll "see" solutions instantly.
  </Card>

  <Card title="Strategic Practice" icon="chart-line">
    Solve problems slightly above your level. Use CP-31, Codeforces Problemset filters, and A2OJ ladders.
  </Card>

  <Card title="Upsolving is Everything" icon="rotate">
    Every problem you couldn't solve in contest is a lesson. Upsolve within 24 hours or you wasted the contest.
  </Card>

  <Card title="Speed + Accuracy" icon="bolt">
    In ICPC, more problems solved always wins. But when tied, lower penalty time breaks it—so speed matters.
  </Card>
</CardGroup>

***

## The Strategic Approach

### The "See the Pattern" Framework

When you read a problem, run through this mental checklist:

<Steps>
  <Step title="Constraints Analysis (30 seconds)">
    * n ≤ 20 → Bitmask DP / Brute force
    * n ≤ 10³ → O(n²) solutions
    * n ≤ 10⁵ → O(n log n) or O(n)
    * n ≤ 10⁶ → O(n) only
  </Step>

  <Step title="Problem Type Recognition (1 minute)">
    * "Minimum/Maximum" → DP, Greedy, or Binary Search on Answer
    * "Count ways" → DP or Combinatorics
    * "Yes/No possible" → Greedy, Graph connectivity, or Binary Search
    * "Shortest path" → BFS/Dijkstra
    * "Subarray/Substring" → Two Pointers, Sliding Window, or Prefix Sum
  </Step>

  <Step title="Pattern Matching (2-3 minutes)">
    Match to known patterns. If stuck, think: "What's the simplest version of this problem I can solve?"
  </Step>

  <Step title="Edge Cases (Before Coding)">
    n=1, n=2, all same elements, all different, sorted, reverse sorted, negative numbers.
  </Step>
</Steps>

***

## What Makes This Course Different

<CardGroup cols={3}>
  <Card title="Real CF Problems" icon="code">
    Every topic has 10+ curated Codeforces problems with difficulty ratings.
  </Card>

  <Card title="Pattern Recognition" icon="eye">
    We teach you HOW to identify patterns, not just what the patterns are.
  </Card>

  <Card title="Common Mistakes" icon="triangle-exclamation">
    Every chapter covers the mistakes that cause WA/TLE so you avoid them.
  </Card>

  <Card title="Mental Models" icon="lightbulb">
    Analogies and visualizations to build intuition, not just memorization.
  </Card>

  <Card title="CP-31 Integration" icon="list-check">
    References to the famous CP-31 sheet for structured practice.
  </Card>

  <Card title="Contest Strategy" icon="chess">
    Not just algorithms—how to approach a 2-hour contest optimally.
  </Card>
</CardGroup>

***

## Course Structure: The Rating Ladder

### Phase 1: Foundation (Newbie → Pupil: 800-1200)

| Chapter | Topic | Key Patterns | Target Problems |
| - | - | - | - |
| 1 | Time Complexity | Constraint analysis | - |
| 2 | Fast I/O & Templates | Speed optimization | - |
| 3 | STL Mastery | Choosing right data structure | - |
| 4 | Prefix Sum | Range queries | CF 800-1100 |
| 5 | Two Pointers | Sorted arrays, subarrays | CF 800-1200 |

### Phase 2: Core Techniques (Pupil → Specialist: 1200-1400)

| Chapter | Topic | Key Patterns | Target Problems |
| - | - | - | - |
| 6 | Binary Search | Search on answer, bounds | CF 1100-1400 |
| 7 | Sorting Strategies | Custom comparators | CF 1100-1300 |
| 8 | Recursion & Backtracking | Subsets, permutations | CF 1200-1400 |
| 9 | Greedy Algorithms | Exchange arguments | CF 1200-1500 |
| 10 | Divide & Conquer | Merge sort pattern | CF 1300-1500 |

### Phase 3: Dynamic Programming (Specialist → Expert: 1400-1600)

| Chapter | Topic | Key Patterns | Target Problems |
| - | - | - | - |
| 11 | DP Fundamentals | 1D DP, state design | CF 1300-1600 |
| 12 | DP on Grids & Advanced | 2D DP, bitmask DP | CF 1400-1700 |

### Phase 4: Graphs (Expert Level: 1500-1700)

| Chapter | Topic | Key Patterns | Target Problems |
| - | - | - | - |
| 13 | Graph Fundamentals | DFS, BFS, cycles | CF 1300-1600 |
| 14 | Shortest Paths | Dijkstra, Floyd | CF 1400-1700 |
| 15 | Trees | LCA, tree DP | CF 1500-1800 |

### Phase 5: Advanced (Expert → Candidate Master: 1600-1900)

| Chapter | Topic | Key Patterns | Target Problems |
| - | - | - | - |
| 16 | Disjoint Set Union | Connectivity, MST | CF 1400-1700 |
| 17 | Segment Trees | Range queries with updates | CF 1500-1900 |
| 18 | String Algorithms | Hashing, KMP, Z-function | CF 1500-1800 |
| 19 | Bit Manipulation | XOR tricks, bitmask | CF 1400-1700 |
| 20 | Contest Strategy | ICPC & CF optimization | - |

***

## The CP-31 Integration

**CP-31** is a famous curated problem set that covers all essential topics. Throughout this course, we reference CP-31 problems that align with each chapter:

| CP-31 Topic | Our Chapter | Problems |
| - | - | - |
| Implementation | 1-3 | Foundation |
| Prefix Sums | 4 | Range queries |
| Two Pointers | 5 | Subarray problems |
| Binary Search | 6 | Search on answer |
| Greedy | 9 | Optimization |
| DP | 11-12 | All DP patterns |
| Graphs | 13-15 | Traversals, paths, trees |
| Data Structures | 16-17 | DSU, Segment Tree |
| Strings | 18 | Pattern matching |

***

## Practice Resources

<CardGroup cols={2}>
  <Card title="Codeforces" icon="ranking-star" href="https://codeforces.com">
    Primary platform. Filter problems by rating and tags. Participate in every contest.
  </Card>

  <Card title="CSES Problem Set" icon="book" href="https://cses.fi/problemset">
    300 classic problems. Perfect for pattern practice.
  </Card>

  <Card title="AtCoder" icon="a" href="https://atcoder.jp">
    Clean problems. Great for math and DP.
  </Card>

  <Card title="CP-31 Sheet" icon="list-check" href="https://codeforces.com/blog/entry/55274">
    Curated topic-wise problems for systematic practice.
  </Card>
</CardGroup>

### Essential Tools & Extensions

| Tool | Purpose | Link |
| - | - | - |
| **Competitive Companion** | Parse problems to IDE | [Chrome](https://chrome.google.com/webstore/detail/competitive-companion/cjnmckjndlpiamhfimnnjmnckgghkjbl) |
| **CF-Predictor** | Predict rating changes | [Chrome Extension](https://chrome.google.com/webstore/detail/cf-predictor/ocfloejljfognbljnlbjajgocmpgjppl) |
| **Carrot** | Rating predictor (alternate) | [Chrome](https://chrome.google.com/webstore/detail/carrot/gakohpplicjdhhfllilcjpfildodfnnn) |
| **CPH (VS Code)** | Auto testing in VS Code | [VS Code Extension](https://marketplace.visualstudio.com/items?itemName=DivyanshuAgrawal.competitive-programming-helper) |
| **A2OJ Ladders** | Rating-based problem lists | [A2OJ](https://a2oj.com/ladders) |
| **CF Visualizer** | Analyze your stats | [cfviz](https://cfviz.netlify.app/) |

### Recommended Problem Lists

<CardGroup cols={3}>
  <Card title="CSES 300" icon="fire">
    Complete the entire CSES problemset. Covers all fundamentals.
  </Card>

  <Card title="Striver's CP Sheet" icon="scroll">
    450 curated problems for placement prep.
  </Card>

  <Card title="Junior Training Sheet" icon="graduation-cap">
    500 problems from 800 to 1600 rating.
  </Card>
</CardGroup>

***

## The Mindset of Champions

<Warning>
  **Reading ≠ Learning. Solving ≠ Understanding.**

  The only way to improve is:

  1. **Struggle** with problems (at least 30-60 minutes before hints)
  2. **Upsolve** everything you couldn't solve
  3. **Analyze** why you got stuck
  4. **Repeat** patterns until they're automatic
</Warning>

### Weekly Practice Schedule (Recommended)

| Day | Activity |
| - | - |
| Mon-Wed | Solve 3-5 problems/day from current topic |
| Thu | Virtual contest (past Div2) |
| Fri | Upsolve Thursday's contest |
| Sat | Live Codeforces contest |
| Sun | Upsolve + Review mistakes |

***

## Let's Begin Your Journey

<CardGroup cols={2}>
  <Card title="8-Week Roadmap to Specialist" icon="calendar" href="/courses/competitive-programming/01a-8-week-roadmap">
    Structured weekly plan to go from LeetCode solver to CF Specialist (1400+).
  </Card>

  <Card title="Codeforces Survival Guide" icon="shield" href="/courses/competitive-programming/01b-cf-guide">
    Everything LeetCode users need to know about CF—ratings, contests, I/O.
  </Card>

  <Card title="Setup Your Environment" icon="gear" href="/courses/competitive-programming/02a-environment-setup">
    Configure VS Code, templates, and tools for competitive programming.
  </Card>

  <Card title="Contest Strategy" icon="chess" href="/courses/competitive-programming/20-contest-strategy">
    Master the meta-skills that separate winners from participants.
  </Card>
</CardGroup>

### Quick Links

| Resource | Description |
| - | - |
| [Upsolving Guide](/courses/competitive-programming/01c-upsolving) | How to learn from every problem |
| [Debugging Guide](/courses/competitive-programming/01d-debugging) | Find bugs faster with systematic debugging |
| [CF Problem Types](/courses/competitive-programming/01e-problem-types) | Recognize common CF problem patterns |
| [Code Library](/courses/competitive-programming/21-code-library) | Ready-to-use algorithm implementations |
| [Quick Reference](/courses/competitive-programming/22-quick-reference) | One-page cheat sheet for contests |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.