Local Codeforces practice workbench for importing problems, running tests, and tracking personal progress.
cf-workbench is a local-first programming practice tool for Codeforces. It imports problems, creates C++ solution files from local templates, runs sample and custom tests, and can show Codeforces profile/submission information through the official Codeforces API.
Use it when you want one local workspace for problem statements, sample tests, source files, custom test cases, and recent submission context.
cf-workbench is designed as an assistive program that operates within Codeforces contest-rule boundaries when used as intended. It helps you manage your own code, personal templates, problem statements, sample tests, and local test runs. It does not bypass Codeforces login, CAPTCHA, Cloudflare, CSRF, or rate limits; it does not extract other contestants' code; and it does not perform direct automated submissions.
Always follow the official Codeforces Contest Rules, Codeforces Terms, and any round-specific announcements, because individual contests may add or modify rules.
- Import Codeforces problems from Competitive Companion payloads or the included Chrome extension
- Manage problem folders, source files, templates, sample tests, and custom tests locally
- Compile and run C++ solutions with configurable comparison modes:
tokens,trim,exact - Use a browser-based local UI with Monaco editor integration
- Save a Codeforces handle and optional API credentials from the web UI
- View Codeforces profile information, rating history, recent submissions, and accepted-problem sync
- Optionally prefill Codeforces submit pages through the included Chrome extension
- Run from a downloaded repository on Windows with
cf-workbench.cmd - English UI by default, with Korean available from the local Settings tab
cf-workbench keeps the usual Codeforces practice loop in one place:
- Import a problem.
- Open the generated local solution file.
- Run the sample tests.
- Add edge cases as custom tests.
- Check recent submissions or sync accepted problems when a Codeforces handle is configured.
The project stores its working files locally, avoids overwriting existing solutions, and keeps generated workspace data out of git by default.
flowchart TD
CF["Codeforces problem page"]
CC["Competitive Companion<br/>(optional external extension)"]
EXT["cf-workbench Chrome extension<br/>(included, optional)"]
LAUNCH["cf-workbench local UI"]
SERVER["Local HTTP server<br/>companion_server.py"]
UI["Local browser UI<br/>web_ui.py + Monaco editor"]
STORAGE["Local workspace<br/>statements, tests, source files"]
RUNNER["Runner<br/>compile, execute, compare"]
CONFIG["Local config<br/>handle, API keys, templates"]
API["Official Codeforces API"]
SUBMIT["Codeforces submit page<br/>user-controlled prefill"]
CF --> CC --> SERVER
CF --> EXT --> SERVER
LAUNCH --> SERVER
SERVER --> UI
SERVER --> STORAGE
UI --> STORAGE
UI --> RUNNER --> STORAGE
UI --> CONFIG
CONFIG --> API --> UI
EXT --> SUBMIT
Problem workspace with statement view, Monaco editor, source files, and sample tests:
Stats dashboard with a fictional sample Codeforces profile:
- Windows, macOS, or Linux for the Python package
- Python 3.11+
g++for compiling C++ solutions- Google Chrome or a Chromium-based browser if you want to use the included browser extension
From a downloaded or cloned repository, double-click cf-workbench.cmd.
If you prefer a terminal, run:
.\cf-workbench.cmdThis starts the local server and opens the browser UI. On first run, it creates the default local config, workspace folder, and C++ template if they do not already exist.
The default local address is:
http://127.0.0.1:27121/
If the browser does not open automatically, copy that address into your browser.
Most day-to-day work happens inside the browser UI after this step. CLI commands are only needed for advanced or development workflows.
You can save a Codeforces handle from the web UI:
- Start
cf-workbench. - Open the
Accounttab. - Enter your Codeforces handle.
- Optionally enter Codeforces API credentials.
- Save the account settings.
Open the Stats tab to refresh profile statistics or sync accepted submissions.
The tool uses official Codeforces API endpoints. It does not store Codeforces passwords.
The local browser UI starts in English by default. To switch the UI to Korean:
- Start
cf-workbench. - Open the
Settingstab. - Set
UI languagetoKorean. - Save settings.
The preference is stored in your local .cfw/config.json.
You do not need multiple extensions for the same task.
| Extension | Required? | Purpose | Included in this repo? |
|---|---|---|---|
| Competitive Companion | Optional | Import problems through its standard payload format | No, install from the browser extension store |
| cf-workbench Chrome extension | Optional, but needed for submit prefill | Capture Codeforces statements from the page DOM and fill submit forms from local source files | Yes, browser-extension/ |
For problem import, use either Competitive Companion or the included browser-extension/. For submit prefill, load the included browser-extension/.
Detailed setup:
- Competitive Companion:
docs/competitive-companion-setup.md - Included Chrome extension:
docs/statement-capture-extension.md - Submit prefill:
docs/submit-prefill.md
Start cf-workbench first, then keep the browser UI open.
With Competitive Companion:
- Install Competitive Companion in your browser.
- Open a Codeforces problem page.
- Click the Competitive Companion button.
- Confirm that the problem appears in the local UI.
With the included Chrome extension:
- Open
chrome://extensions. - Enable Developer mode.
- Load the
browser-extension/folder as an unpacked extension. - Open a Codeforces problem page.
- Use the
cfwcapture button. - Confirm that the problem appears in the local UI.
Imported problems are stored under:
workspace/codeforces/
Use the Code tab:
- Select a problem from the left sidebar.
- Edit the source file in the center editor.
- Choose the comparison mode from the toolbar if needed:
tokens,trim, orexact. - Click
Runto compile and run the sample and custom tests. - Add custom tests from the
TESTSpanel on the right.
The result panel shows compile errors, runtime errors, wrong answers, and accepted test results without leaving the UI.
cf-workbench/
|- cfw/ # Backward-compatible CLI module alias
|- src/cf_workbench/ # Main Python package
| |- cli.py # argparse CLI entry point
| |- companion_server.py # Local HTTP server and web UI API
| |- storage.py # Workspace/problem/test persistence
| |- runner.py # Compile and test execution
| |- codeforces_api.py # Official Codeforces API client
| `- web_ui.py # Rendered local browser UI
|- browser-extension/ # Chrome extension for statement capture/prefill
|- scripts/ # Windows launch helpers
|- src/cf_workbench/templates/ # Packaged default C++ starter template
|- tests/ # pytest suite
`- workspace/ # Local generated workspace, ignored by git
- The project does not bypass Codeforces login, CAPTCHA, Cloudflare, CSRF, or rate limits.
- It does not implement direct automated submission POST requests.
- Submit-page integration is explicit and user-controlled.
- Imported workspaces, generated binaries, logs, and local credentials are excluded from git.

