Skip to main content

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


🆕 New Features

🔎 Problem Explorer

Browse all Codeforces problems with fuzzy search:

cf explore

Pre-filter by tag or keyword:

cf explore -e dp
  • Search by problem name, tags, or rating
  • Fast fuzzy matching
  • Navigate using keyboard
  • Press Enter to fetch problem instantly

📚 Contest Browser

Open a contest and select problems interactively:

cf get 2227
  • Shows all problems in the contest
  • Navigate with arrow keys
  • Press Enter to fetch selected problem

🌍 Global Problem Cache

A global problem dataset is now stored at:

~/.cfmate/problems_cache.json
  • Enables fast searching in cf explore
  • Loaded instantly after first fetch

🔄 Update Problem List

Refresh the global problem dataset:

cf update -p
  • Fetches latest problems from Codeforces API
  • Recommended occasionally to stay up-to-date

⚡ Enhanced Create Command

Improved project scaffolding:

cf create 2227
cf create 2227A py
cf create A py
  • Supports folder-only, file-only, and combined modes
  • Automatically detects contest context
  • Saves preferred language
  • Optionally pre-fetches problem into cache

🧠 Improved Architecture

  • Introduced a core.py module for shared logic
  • Clean separation between CLI, UI, and core logic
  • Improved maintainability and scalability

✨ 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>

⚠️ If cf get is not working or shows a loading/Cloudflare error, run:

playwright install chromium

This installs the browser required for fetching problems.

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.



📄 License

MIT

Metadata

Release files for cfmate 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cfmate 0.5.0
File Size Uploaded Provenance Actions
cfmate-0.5.0.tar.gz 36.5 kB With provenance Details for cfmate-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cfmate 0.5.0
File Interpreter ABI Platform Actions
cfmate-0.5.0-py3-none-any.whl Python 3 none any Details for cfmate-0.5.0-py3-none-any.whl

Total release size: 76.8 kB

Release files / cfmate-0.5.0.tar.gz

Download URL cfmate-0.5.0.tar.gz
Size 36.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6e7a5b62985e4f7de7dd5ca32862cf1f76b77d808cb0170b155c44711c17513a
BLAKE2b-256 checksum
How to use checksums
1148193cfcc420e51ab0f1417e78f30fbc199d4633fc206055a8073a2a41053a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.

Transparency log

Release files / cfmate-0.5.0-py3-none-any.whl

Download URL cfmate-0.5.0-py3-none-any.whl
Size 40.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
657a71553cf1ac2cc4b730c5f952882e28897a824b50d7c5c2ef893f1968a1cc
BLAKE2b-256 checksum
How to use checksums
c2907d4862ec28d2ec087ba0c05c069a12d1609c5a6ceffcf30be024d875a822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.

Transparency log

Security for cfmate 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cfmate-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page