Categorygithub.com/rendon/cf
modulepackage
0.0.0-20240515000846-2ec062619353
Repository: https://github.com/rendon/cf.git
Documentation: pkg.go.dev

# README

cf

Codeforces command line client.

The goal of this tool is to make your life as a problem solver a little bit easier, you focus on solving the main problems, cf takes care of setting your environment up.

With cf you can easily download test cases, generate boilerplate code for various programming languages, automate tests, etc.

Usage examples

Download test cases for a single problem:

$ cf parse http://codeforces.com/contest/459/problem/C
$ tree -a
.
├── .in1.txt
├── .in2.txt
├── .out1.txt
├── .out2.txt
└── .settings.yml

0 directories, 5 files

Download test cases for all problems in a contest:

$ cf setup 459
Problem A is ready!
Problem B is ready!
Problem C is ready!
Problem D is ready!
Problem E is ready!

$ tree -a
.
└── CodeforcesRound261Div.2
    ├── A
    │   ├── .in1.txt
    │   ├── ...
    │   └── .settings.yml
    ├── B
    │   ├── .in1.txt
    │   ├── ...
    │   └── .settings.yml
    ├── C
    │   ├── .in1.txt
    │   ├── ...
    │   └── .settings.yml
    ├── D
    │   ├── .in1.txt
    │   ├── ...
    │   └── .settings.yml
    └── E
        ├── .in1.txt
        ├── ...
        └── .settings.yml

6 directories, 33 files

Introducing the cf global configuration file

cf uses the ~/.cf.yml file to store global settings, e.g.:

---
template.cpp: /home/user/templates/template.cpp
template.go: /home/user/templates/template.go

Generate sample solution:

$ cf gen main.go
$ cat main.go
package main

import ()

func main() {
}

If you specify a valid template file in your ~/.cf.yml, the sample solution will be a copy of that template.

# Functions

GenerateSampleSolution generates sample solution from file name, programming language will be determined from file extension.
GetContestName returns the name of contest with ID `id`.
ParseProblem Parses problem and extracts tests cases.
ReadKeyValueYamlFile reads YAML file and returns a map of string -> interface.
WriteKeyValueYamlFile writes YAML representation of `doc` to a file.
WriteTest Writes tests cases to files, one for input, and another for output.

# Structs

Contest contains basic fields of a Codeforces contest.
ContestListResponse a list of contests, as Codeforces returns them.
Lang contains values and functions for every supported language.