Welcome to Codeforces!

Exploring one of the largest competitive programming community

What is Competitive Programming?

Codeforces is created by a group of competitive programmers from Saratov State University led by Mike Mirzayanov in 2010. It holds a wide variety of contests across the years.

  • Microsoft Q#
  • Huawei Honorcup
  • VK Cup
  • April Fools Day
  • Good Bye 2021: 2022 is NEAR
  • Hello 2022
  • ...

0

Rated contests are held in an average month in 2010

Common Contest Rules

  • Contests are free and open to all users
  • A typical contest spans 2 to 3 hours with 5 to 6 problems
  • Problems are sorted in rising difficulty and weighted (the harder the more points it worth)
  • Points of problems decay as the time flows. Slower submission yields less points.
  • The participants raise or lower their rating depends on their points earned
  • Participants are splited into 3 divisions, Div.1 (the stronger ones), Div.2, and Div.3 (the weaker ones)
  • Higher division users are not rated when participating in lower division contests
  • The rating changes are similar to Elo Rating System (i.e. zero-sum game)

Rating: Colors and Title

Codeforces has a unique color and title system that defines user's strength. (Suggestion: Read from left to right!)

In short,

  • Codeforces is C O L O R F U L!
  • Strong players earn fame. For example, almost every Codeforces user would know how is tourist
  • One surprising fact: A lot of the strong algorithmists (i.e. red players) earned the title when they are just students!

User

Throughout 12 years, Codeforces community has experienced exponential growth.

0

*Rated Users as of 2010

Rated users are users who have taken part in at least one Codeforces contest

Where are they from?

Let's look at data as of February 2022!

*Only rated users who report nationality are included in next page

Observations

  • India, China, and Russia have the most Codeforces users (with more than 55% of all users)
  • Surprisingly, Greenland has the highest rough user density (1 out of 3000)
  • Asia have the most users while Africa has the least
  • High-rating users are fewer than low-rating users. Even India (having 32.90% of all Codeforces users) has 0 Legendary Grandmaster!

What happens during a contest?

How do the submissions and accuracies change over time?

Let's get your hands dirty! Click the buttons below to sample random previous Codeforces contest and see if you can observe some trends. Try to sample at least 5 plots before looking at the author's opinion!

  • Your observation are likely independent of the divisions.
  • Likely, You will observe that the number of submissions spike during the first few minutes , followed by a steady decline, and finished with an abrupt surge near the end of contest
  • On the other hand, number of correct submissions and accuracy drops continuously, despite of the surge of submission near the end.

  • As problems are sorted in increasing difficulty, the first few problems can be solved quickly, causing initial high submissions and accuracy.
  • As the difficulty increases, the time it takes is higher. Participants become more prone to corner cases in harder problems too.
  • Near the end of contest, participants tend to keep resubmitting their work as wrong penalty is capped at 50 points.
  • This might partially explain the spike of submission with low accuracy at the end of contest. What do you think?
]

Which Language to choose?

  • Generally, C++ is the best for the abundance and efficiency of built-in libraries and STL
  • You might consider Java and PyPy too if you wish to shun away from C++ complexity
  • We also observe that PyPy popularity has slowly exceeded CPython, perhaps for its higher runtime performance.
  • Obsolete languages such as FPC and Delphi are slowly out of sight while new languages such as Kotlin and Rust are rising!

Let's try to look at an actual problem

Eugeny and Array

Eugeny has array a = a1, a2, ..., an, consisting of n integers. Each integer ai equals to -1, or to 1. Also, he has m queries:

  • Query number i is given as a pair of integers li, ri (1 ≤ li ≤ ri ≤ n)
  • The response to the query will be integer 1, if the elements of array a can be rearranged so as the sum ali + ali + 1 + ... + ari = 0, otherwise the response to the query will be integer 0.

Help Eugeny, answer all his queries.

This problem is adapted from Codeforces Round #182 (Div. 2). Can you solve it?

This is a naive sum problem, which could be solved brute force, greedy, or prefix sum. Actually, a fun fact is that this problem is the officially fastest solved problem in Codeforces. It is solved by left_hand in 11 seconds despite text analyzer suggests that this problem prompt takes 22 seconds to read!

Last thought: Why Codeforces?

  • It is more than just grinding Leetcode. Codeforces contests are proposed and prepared by the users themselves! That's why Codeforces problems are often more creative, challenging and fun as most of them are original. There are a lot of them involve creative problem solving instead of being "standard".
  • It is thrilling as well! Competitive programming is totally different from software development or practice problem. You will know that feelings if you give it a try!
Q: "I am convinced! But how should I start?"
A: "Start by registering an account and joining a contest! Wish you high rating and Welcome to Codeforces!"

Acknowledgements

Data Source

Thanks to:

  • CSE 442 instructor Jeffrey Heer and teaching staffs for their excellent guidance
  • d3.js developed by Mike Bostock, Jason Davies, Jeffrey Heer, and Vadim Ogievetsky that provides an excellent interface for creating highly customized visualization!
  • fullPage.js developed by Alvaro Trigo that makes the website navigation seemless.
  • Bootstrap developed by Twitter developers lead by Mark Otto that makes the CSS styling less painful
  • Codeforces developed by Mike Mirzayanov that empowers the competitive programming community
  • Wan Yee, zscoder, and Evirir for giving generous feedbacks throughout the development process.