目录

Codeforces Solutions

This repository collects solutions for Codeforces problems. The directory tree mirrors the contest numbers (0-999, 1000-1999, 2000-2999, …). Inside each contest folder you will typically find:

  • problemX.txt – the problem statement or notes for problem X.
  • Solution files in Go or other languages (1234A.go, solB.cpp, etc.).
  • Optional verifier programs such as verifierA.go that compile a submission and run it against sample tests.

Utilities

Several helper tools live in the repository root:

  • create.go – scaffold a new contest/problem directory.
  • auto.go – convert existing C++ solutions to Go using the Codex CLI.
  • auto_so.go – generate Go solutions from problem statements with Codex.
  • webserver.go – simple HTTP server for browsing problems and submitting solutions locally.
  • Other helper utilities may be added for brute-force testing or instrumentation.
  • eval.go – evaluate AI-generated solutions. Supports flags like -model, -provider, -db and -timeout to control the HTTP request timeout.
  • export_failed.go – export failed AI responses by model into per-model folders with filenames like 1395D.go or 1453A.rs based on language.

All Go utilities build with the standard tooling. Example:

cd 1000-1999/1900-1999/1990-1999/1994
go run verifierA.go ./1994A

This repository aims to provide a complete archive. Feel free to use the code or utilities as a reference for your own workflow.

Some contests include verifier programs with deterministic test cases. For example, contest 90 provides verifiers for problems A and B:

cd 0-999/0-99/90-99/90
go run verifierA.go ./mySolutionA
go run verifierB.go ./mySolutionB

Contest 1989 includes verifiers for all six problems with at least 100 test cases each. Run them by passing the path to your executable. For example:

cd 1000-1999/1900-1999/1980-1989/1989
go run verifierA.go ./1989A

Running the local webserver

The webserver.go program lets you browse contests and test solutions directly from your browser. Launch it from the repository root:

go run webserver.go

If you set the ADMIN_KEY environment variable, the “Add Problem” form requires the same key before a problem is created. This helps prevent unauthorized modifications when running a public server.

Open http://localhost:8081 to see the list of contests. Each problem page allows you to paste code or upload a file in C, C++, Go, Rust, Java or Python. If a verifier is present in the contest directory it will run automatically after compilation.

Exporting failed AI responses

Use export_failed.go to pull all failed evaluations for specific models (exact model names) and save their code into folders named after each model:

go run export_failed.go \
  -db "user:pass@tcp(127.0.0.1:3306)/dbname" \
  -models "grok-4,gemini-2.5-pro,gpt-5-mini,o3,gpt-5"

This creates directories like gpt-5, gemini-2.5-pro, etc., and files such as 1395D.go or 1453A.rs depending on the stored language. Use -dry-run to preview without writing files.

Required compilers

The web server relies on external compilers/interpreters. Install the following tools so every language option works:

  • gcc and g++
  • javac/java
  • go
  • rustc
  • python3

Below are minimal installation commands for common platforms.

Linux (Debian/Ubuntu)

sudo apt update
sudo apt install build-essential openjdk-17-jdk golang rustc python3

macOS (Homebrew)

brew install gcc openjdk go rust python

Windows

pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-libgfortran \
  mingw-w64-x86_64-go mingw-w64-x86_64-rust mingw-w64-x86_64-python

Alternatively use the official installers for MinGW-w64, Adoptium JDK, Go, Rust and Python.

关于
69.5 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号