Skip to main content

Codeforces Survival Guide

From LeetCode to Codeforces

You’ve grinded LeetCode. You understand algorithms. But Codeforces? It’s a different beast. This guide will help you survive and thrive.

Understanding the Rating System

Rating Colors & Titles

Rating Changes

Pro Tip: Your first 6 contests have inflated K values. Focus on performing well early!

Contest Types

Division 4 (Div 4)

  • Who: Rated < 1400
  • Difficulty: A (800) to G (1400)
  • Duration: 2 hours, 7-8 problems
  • Strategy: Solve A-E quickly, attempt F-G
  • Best for: Complete beginners, first-time CF users, building confidence
  • Frequency: Every 4-6 months (less frequent than Div 2/3)

Division 3 (Div 3)

  • Who: Rated < 1600
  • Difficulty: A (800) to F (1600)
  • Duration: 2 hours, 6-7 problems
  • Strategy: Solve A-D quickly, attempt E-F
  • Best for: Beginners who are comfortable with basics

Division 2 (Div 2)

  • Who: Rated < 2100
  • Difficulty: A (800-1000) to E/F (2000+)
  • Duration: 2 hours, 5-6 problems
  • Strategy: Solve A-C, attempt D
  • Best for: Reaching Specialist/Expert

Division 1+2 (Combined)

  • Who: Everyone is rated (no rating cutoff)
  • Difficulty: A (1000-1200) to F/G (2400+)
  • Duration: 2-2.5 hours, 6-7 problems
  • Strategy: Same problems for all participants
  • Best for: Intermediate difficulty between Div 2 and Div 1
  • Note: A-B problems are harder than typical Div 2 A-B

Division 1 (Div 1)

  • Who: Rated ≥ 1900
  • Difficulty: Starts at ~1700
  • Best for: Expert+ grinders

Educational Rounds

  • Rated: For all < 2100
  • Special: 12-hour hacking phase after
  • Format: Similar to Div 2

Global Rounds

  • Who: Everyone rated
  • Difficulty: Wide range
  • Duration: Usually 2.5-3 hours

The Contest Interface

Before Contest

During Contest

Verdict Meanings

PRETESTS ≠ ACCEPTEDDuring contest, you only pass pretests. After contest ends, your solution runs on the full test set (system test). Many solutions fail system tests!

Reading CF Problems

Anatomy of a CF Problem

How to Read (The Right Way)

1

Skim the Story (10 seconds)

Most CF problems have elaborate stories. Skim for keywords.
2

Read Constraints FIRST (30 seconds)

This tells you what complexity is acceptable.
  • n ≤ 100 → O(n³) OK
  • n ≤ 10⁵ → Need O(n log n) or O(n)
  • n ≤ 10⁶ → Must be O(n)
3

Read Problem Statement (1-2 minutes)

Understand what you need to compute/output.
4

Study Examples (1 minute)

Trace through by hand. Read the Note section!
5

Check Edge Cases

What if n=1? What if all elements are same?

Input/Output Differences from LeetCode

LeetCode Style

Codeforces Style

Multiple Test Cases

Most CF problems have multiple test cases!
Common Mistake: Forgetting to reset variables between test cases!

Common CF Input Patterns

Pattern 1: Single Line of Numbers

Pattern 2: Matrix/Grid

Pattern 3: String Grid

Pattern 4: Graph Edges

Pattern 5: Queries


Output Patterns

YES/NO Questions

Impossible Cases

Floating Point

Multiple Values


Debugging on Codeforces

Using Custom Test

  1. After submitting (or before), go to problem page
  2. Scroll down to “Custom Test”
  3. Enter your test case
  4. Run and see output

Creating Test Cases

When you get WA, try:
  1. Edge cases: n=1, n=2, all same, all different
  2. Boundary values: Maximum n, minimum values
  3. Special patterns: Sorted, reverse sorted, alternating

Stress Testing

Compare your solution with a brute force on random inputs:

Your First Week Checklist

1

Create Account

Register at codeforces.com
2

Set Up Environment

Install VS Code + extensions + template
3

Solve 10 Problems Rated 800

Get comfortable with the format
4

Do a Virtual Contest

Go to Contests → Pick a past contest → Click “Virtual Participation” on the right sidebar
5

Participate in Live Contest

Register for next Div 3 or Div 4
6

Upsolve

Solve problems you couldn’t during contest


Key Takeaways

Read Constraints First

Constraints tell you what algorithm to use.

Handle Test Cases

Most problems have multiple test cases.

Use Fast I/O

Always use sync_with_stdio(false).

Upsolve Everything

Learning happens after the contest.

Next Up

Fast I/O & Templates

Set up your competitive programming template.