A Codeforces CLI tool — fetch, display, and test against problems.
Project description
cfmate
cfmate is a fast, developer-friendly CLI tool for Codeforces that lets you fetch problems, view them in a clean format, and test your solutions directly from the terminal.
It is designed to eliminate context switching and streamline the competitive programming workflow.
🚀 Why cfmate?
Competitive programming usually involves:
- switching between browser and editor
- manually copying test cases
- repeatedly fetching problem statements
cfmate solves this by bringing everything into your terminal.
With cfmate, you can:
- fetch problems instantly
- run solutions with sample tests
- cache problems locally for speed
- stay fully inside your development environment
✨ Features
🔍 Problem Fetching
Fetch any Codeforces problem directly:
cf get 1829A
- Displays formatted problem statement
- Includes input/output format
- Shows sample test cases
- Uses clean terminal rendering
🧪 Solution Testing
Run your solution against sample tests:
cf run solution.py --problem 1829A
- Executes all sample test cases
- Shows pass/fail results
- Displays clear output differences
- Returns proper exit codes (useful for scripting)
⚡ Smart Caching System
- Problems are stored locally in
.cf_cache/ - Eliminates repeated network requests
- Provides instant access after first fetch
🧠 Smart Problem Detection
You don’t always need to specify the problem:
cf run 1829A.py
- Automatically extracts problem ID from filename
- Reduces command verbosity
🌐 Multi-language Support
Supports multiple programming languages:
| Language | Execution |
|---|---|
| Python | python3 file.py |
| C++ | g++ -O2 then run |
| C | gcc -O2 then run |
| Java | javac + java |
| JavaScript | node file.js |
| TypeScript | ts-node file.ts |
| Go | go run file.go |
| Rust | rustc -O then run |
| Ruby | ruby file.rb |
🎯 Clean Developer Experience
- Minimal and readable terminal output
- No unnecessary clutter
- Fast execution and feedback loop
📦 Installation
Install directly from PyPI:
pip install cfmate
⚡ Quick Start
1. Fetch a problem
cf get 1829A
2. Solve it in your editor
Create a file:
1829A.py
3. Run tests
cf run 1829A.py
📘 Detailed Usage
Fetching Problems
cf get <problem_id>
Examples:
cf get 1829A
cf get 2227D --no-cache
Options:
--no-cache→ force re-fetch from Codeforces
Running Solutions
cf run <file> [options]
Examples:
cf run solution.py --problem 1829A
cf run 1829A.py
cf run 2227D.cpp
Options:
--problem/-p→ specify problem ID manually--time-limit→ override execution time limit
Example:
cf run solution.py -p 1829A --time-limit 2000
Cache Management
cf cache <command>
Commands:
cf cache list
cf cache clear 1829A
cf cache clear
🗂 Cache System (Detailed)
Location
Cache is stored in:
.cf_cache/
Each problem is stored as a JSON file:
.cf_cache/
├── 1829A.json
├── 2227D.json
Cache Behavior
| Scenario | Behavior |
|---|---|
| Not cached | Fetch from Codeforces and store |
| Cached | Load instantly |
| Corrupted cache | Re-fetch automatically |
--no-cache used |
Skip cache and overwrite |
Benefits
- Faster repeated runs
- Reduced network usage
- Offline access after first fetch
🧪 Exit Codes
| Code | Meaning |
|---|---|
0 |
All tests passed |
1 |
One or more tests failed |
Useful for:
- scripting
- CI pipelines
- automation
⚠️ Disclaimer
This tool is not affiliated with Codeforces.
It fetches publicly available problem statements for personal use only. All problem content belongs to Codeforces: https://codeforces.com
Users are responsible for complying with Codeforces Terms: https://codeforces.com/terms
This tool does not store or redistribute problems beyond local caching.
🔗 Links
📄 License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cfmate-0.1.4.tar.gz.
File metadata
- Download URL: cfmate-0.1.4.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f002d84c5ea87ba8c127306fe84a6980b8e3a1461189f8a9263b58fe2205738
|
|
| MD5 |
66bc9d9d8e03506c03b44995b88318b2
|
|
| BLAKE2b-256 |
971f95f8ec76fcc1a3a323d8a313ce1f25688fdce5f0b0958de91039ed625637
|
File details
Details for the file cfmate-0.1.4-py3-none-any.whl.
File metadata
- Download URL: cfmate-0.1.4-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3dd8c31928c2f8732af1c13208da42d8e77d60de1fc9a2376f47f26a9fa02ba
|
|
| MD5 |
4e4212084f605d043821380d9d012dab
|
|
| BLAKE2b-256 |
6005540c8dbb86bc116ae1c756e444519e6148dc0a4698801e5addfb20ff286e
|