A Codeforces CLI tool — fetch, display, and test against problems.
Project description
Disclaimer
This tool is not affiliated with Codeforces.
It fetches publicly available problem statements for personal use only. Users must comply with Codeforces Terms of Service: https://codeforces.com/terms
This tool does not store or redistribute problems beyond local caching.
cfmate
A fast, Codeforces CLI — fetch problems, display them cleanly, and test your solutions against sample cases, all from the terminal.
Features
cf get— fetch and display any Codeforces problem with clean Rich formattingcf run— run your solution against all sample tests, with pass/fail output and diffs- Local cache — problems are saved to
.cf_cache/so repeated fetches are instant - Multi-language — Python, C++, C, Java, JavaScript, TypeScript, Ruby, Go, Rust
- Smart ID inference — name your file
1829A.pyand skip the--problemflag - Clean UX — spinner for loading, no fake delays, no excessive color
Installation
git clone https://github.com/Saksham-cmd-tech/cf_tool.git
cd cf_tool
pip install -e .
This registers the cf command globally.
Usage
Fetch a problem
cf get 1829A
cf get 2227D --no-cache # bypass cache
Run your solution
# Specify the problem explicitly
cf run solution.py --problem 1829A
# Or name your file after the problem — ID is inferred automatically
cf run 1829A.py
cf run 2227D.cpp
# Custom time limit (milliseconds)
cf run solution.py -p 1829A --time-limit 2000
Manage the cache
cf cache list # list cached problems
cf cache clear 1829A # remove one problem
cf cache clear # remove everything
Supported Languages
| Extension | Language | How it runs |
|---|---|---|
.py |
Python 3 | python3 file.py |
.cpp |
C++17 | g++ -O2 then run |
.c |
C | gcc -O2 then run |
.java |
Java | javac then java |
.js |
JavaScript | node file.js |
.ts |
TypeScript | ts-node file.ts |
.rb |
Ruby | ruby file.rb |
.go |
Go | go run file.go |
.rs |
Rust | rustc -O then run |
Project Structure
cf_tool/
├── cf_tool/
│ ├── __init__.py # package version
│ ├── cli.py # Typer CLI entry point
│ ├── scraper.py # cloudscraper HTTP layer
│ ├── parser.py # BeautifulSoup HTML → Problem
│ ├── runner.py # subprocess test execution
│ ├── formatter.py # Rich terminal output
│ ├── cache.py # JSON local cache
│ ├── models.py # Problem + TestCase dataclasses
│ └── utils.py # LaTeX cleaning, ID parsing, normalization
├── pyproject.toml
├── requirements.txt
└── README.md
Exit Codes
| Code | Meaning |
|---|---|
0 |
All tests passed |
1 |
One or more tests failed / error |
This makes cf run composable in shell scripts and CI pipelines.
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.3.tar.gz.
File metadata
- Download URL: cfmate-0.1.3.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74a4c253686c1546355d2933982f6fe1b5f32bb1b9bee48ee5a37c8cedecfd05
|
|
| MD5 |
e0d6057896e0de146b27b0bbf193d909
|
|
| BLAKE2b-256 |
dae78ef8a8d1b00d893650a52d4aaeb816e6f89b88cf3941faa38ddf7db87508
|
File details
Details for the file cfmate-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cfmate-0.1.3-py3-none-any.whl
- Upload date:
- Size: 19.4 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 |
69cc9cceb13855a6881fabf2cebedbeae09980af30cde3abc5806e4b44381ce6
|
|
| MD5 |
0bdcdc19a790ac3dcc2dc1300144de81
|
|
| BLAKE2b-256 |
44c828d302ebe98c54d726c215c4bfdaed0d162ead6be2cdbf081a293e39a526
|