Salman Adnan

codeforces-mashup-generator

Codeforces Mashup Generator

Codeforces is a site full of programming puzzles, and Salman's study group ran practice contests on them. The problem: someone had usually already solved one of them, spoiling the contest. This tool picks instead: it looks up what every member has solved, keeps only puzzles nobody has done, filters by difficulty and topic, and writes the shortlist to an Excel sheet. One verified live run took about 14 seconds.

Solo

Solo work by Salman Adnan.

Rating Ladder: an artwork of what the tool picks out. Programming puzzles rain down sorted by difficulty, and the few nobody in the group has already solved rack up into one fair practice contest. Live and interactive: drag it to orbit, scroll or pinch to zoom. Open full screen
Real output from a live run against the Codeforces API: a generated practice contest.
Live run: 9 problems pulled from the real Codeforces API.
800-2000rating band, step 100
~14 sverified live run
2Codeforces API endpoints

Overview

A single-script tool that builds fair mashup contests for a study group by querying the public Codeforces API, filtering the problemset by rating band, tags, and solver history, then writing candidate problems to an Excel sheet.

When the study group ran mashup contests, someone always got a problem they had already solved, which ruins the point. This script only picks problems that no listed group member has an accepted submission on, and optionally requires that a trusted strong user has solved it as a rough quality signal.

Key features

  • Filter by any set of rating bands (default 800 to 2000 in steps of 100).
  • An include filter (keep only problems solved by a trusted handle) and an exclude filter (drop any problem solved by a group member).
  • Tag filtering with four modes.
  • Uses two endpoints, problemset.problems and user.status (paginated 10,000 submissions at a time), reducing both to (contestId, index) identity sets.
  • Output is a flat Excel sheet via pandas and openpyxl.

Results

A verified small run against the live API took about 14 seconds and produced 9 rows (3 per rating), all tagged greedy, none solved by the two excluded members, all solved by the trusted handle; two stale handles returned HTTP 400 and the sheet still generated.

Tech stack

  • Python 3.10+ (tested on 3.12)
  • requests
  • argparse
  • pandas + openpyxl

A challenge worth noting

The API splits the needed data across two differently shaped endpoints: problemset.problems returns flat objects while user.status wraps the problem under a key, so both had to be reduced to the same (contestId, index) identity for the filters to line up. A related gotcha: raise_for_status() only covers transport-level failures, and Codeforces returns HTTP 200 with a FAILED JSON body for an unknown handle, so a second check on the payload's own status field is needed.

Book a call

Let's talk about what you're building.

Pick a slot below. No forms, no back-and-forth emails.