Skip to main content

A fast Codeforces CLI tool for fetching problems and testing competitive programming solutions

Project description

cfmate — Fast Codeforces CLI for Competitive Programming

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

Creating Files and Folders

cf create <target> [lang]

Modes:

cf create 2227        # create contest2227/ folder
cf create A py        # create 2227A.py inside current contest folder
cf create 2227A py    # create folder + file

Behavior:

  • Creates contest<id>/ folder if not present
  • Generates file using language template
  • Automatically infers problem ID
  • Optionally fetches and caches the problem

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

When using cf create, cache is stored inside the contest folder:

contest2227/
  ├── 2227A.py
  └── .cf_cache/
      └── 2227A.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cfmate-0.2.2.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cfmate-0.2.2-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file cfmate-0.2.2.tar.gz.

File metadata

  • Download URL: cfmate-0.2.2.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cfmate-0.2.2.tar.gz
Algorithm Hash digest
SHA256 3900f928c58e71319171ccd85623282335f5397680f5790185847172c710b28c
MD5 6d8bd13dce356f7809baaed53377b58e
BLAKE2b-256 7eb38d0e0484e977d0401968ca4480784650e144b95980af5411c2f5799af128

See more details on using hashes here.

Provenance

The following attestation bundles were made for cfmate-0.2.2.tar.gz:

Publisher: publish.yml on Saksham-cmd-tech/cf_tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cfmate-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: cfmate-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cfmate-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba22ac7212a35eab19b631d1d684c5785d5aaef9be4db594d0948df9fa74030f
MD5 8b62192890145c169208461c48101888
BLAKE2b-256 4b55e4563fd61e64f726e6c967f513c7a3f8e93b923486564ae829b46b9ba4ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for cfmate-0.2.2-py3-none-any.whl:

Publisher: publish.yml on Saksham-cmd-tech/cf_tool

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page