A competitive programming tool to automate downloading of test cases and creation of code files.
- This program can generate test cases for problems from atcoder.jp and codeforces.com including gym.
- Parse a whole contest -> will save the sample input/output and generate code for selected languages.
- For parsing whole contests, links can be used. Links are not supported for individual problems
- For gym, only links are supported.
- AtCoder links should end in
/tasks
. Meaning, link of contest's tasks page should be provided.
# format: cf [-g|-gen] <contest/problem id>
> cf -gen 1345
> cf -g abc161
> cf -g https://codeforces.com/contest/564
> cf -gen https://codeforces.com/gym/353232
> cf -g https://atcoder.jp/contests/dp/tasks/
- Parse a single problem.
> cf -gen abc160_d
- Test a code against parsed input-output.
# format: cf [-j|-c[-d]] [-r] <problem>
# test java code
> cf -j a
# test cpp code
> cf -c a
# test cpp code with debug options enabled
> cf -c -d a
> cf -cd a
- Run the code for a specific problem and input custom test case from console.
# java
> cf -jr b
# cpp
> cf -c -r
- Add custom input/output to the problem. It will be used to test against next time.
> cf -a d
Enter input:
<Enter custome input here>
<Press Enter>
Enter output:
<Enter corresponding correct ouput here>
<Press Enter>
- Install dependencies using the below command
pip3 install -r requirements.txt
- Make changes in the
settings.yaml
file according to your needs- set which languages you need (supports only java acd cpp)
- set template path for the languages required
- Download and save cookies for both, atcoder and codeforces, sites
- set the location of cookies in settings
- Run the following command
make
or
make create
make copy
This will first create the cf
excecutable and will then copy it to /usr/local/bin/
. So that it is available in path
and can be used from anywhere.
Use cf -h
to see the help message:
Note: -d
can only be used with -c|-cpp|--cpp
cpp options.
usage: cf [-h] [-g] [-p] [-m] [-a] [-r] [-j] [-c] [-d] problem
CF Helper Tool
positional arguments:
problem Problem link/id
optional arguments:
-h, --help show this help message and exit
-g, -gen Generate source code and parse IO
-p, -parse, --parse Parse IO for the problem
-m, -make, --make Creates a dir with code files
-a, -add, --add Add more IO to probelm
-r, -run, --run Runs the problem code, and allows you to give input
-j, -java, --java Test or run java code
-c, -cpp, --cpp Test or run cpp code
-d, -debug, --debug Test/run cpp code in debug mode