Codeforces · modular arithmetic study

1e9+7 vs 998244353: how Codeforces uses moduli

Every Codeforces archive problem was checked for an answer modulus. The data comes from the official API plus an open statement dataset, and a validated detector reads each statement. Use the filters to slice by year, difficulty, contest type, tag or modulus. Every chart can also be shown as a table.

Problems analyzed
–
Use modular arithmetic
–
1e9+7
–
998244353
–
Other / variable
–

Share of problems using each modulus, by year

Each line is the percentage of that year's problems that use the modulus. * 2025 is partial: the statement dataset ends in February 2025.

998244353's share of the big two

998244353 ÷ (1e9+7 + 998244353) among problems using either.

Problem index

% of problems at each position (A, B, C…) that use a modulus.

Difficulty × modulus

Cell = % of problems in that rating band using the modulus. Hover a cell for counts.

Contest type

% of problems per contest type (types with at least 20 problems).

Time limit

% of problems in each time-limit band that use a modulus.

Tags most associated with moduli

Top 20 tags by modular share (tags with at least 30 problems in the current slice).

Memory limit

% of problems in each memory-limit band that use a modulus.

How to read this

  • Confirmed: the statement sets a numeric modulus ("print it modulo 998244353"). Bound mentions like "a_i ≤ 998244353" don't count.
  • Variable: the modulus is an input parameter ("modulo p", where p is given).
  • Uncertain: a well-known modulus appears without a modulo phrase. These are excluded unless you tick "Count uncertain matches".
  • Validation on 110 hand-checked problems: 105 correct, 4 partial, 1 wrong. Details.

Moduli ranking

Every distinct confirmed modulus in the current slice. Click a column header to sort.

Problem explorer

Report & data

The full write-up covers methodology, every breakdown, findings and limitations. The underlying data can be downloaded below.