CPC is a command-line utility aimed towards competitive programmers.
At any point in time, you can run cpc
or cpc -h
to get a list of what the utility has to offer, or cpc <command> -h
for details related to a particular command.
CPC provides functionality to test an optimized program against bruteforce to compare their outputs with
cpc st -b <bruteforce-executable> -o <optimized-executable> -tg <testcase-generator>
It is advised to supply the arguments via the .cpcrc
file. This would shorten the command to:
cpc st
Users can scrape their submissions from various online judges. Even though support is limited, contribution is welcome to add support to other judges.
Judges currently supported:
- Codeforces (Gym is also supported)
- SPOJ
Interactive scraper can be launched using:
cpc scrape
CPC can be configured using a .cpcrc
file. This would sit in the same repository as to where you will be operating from. If it exists in another directory, a path can be specified using:
cpc <sub-command> -cf <path/to/.cpcrc>
This is very useful for the stress testing command. Below is an example configuration:
precommand: |
# To compile code into executables
g++ -std=c++17 testcase_generator.cpp -o generator
g++ -std=c++17 main.cpp -o optimized
g++ -std=c++17 bruteforce.cpp -o bruteforce
count: 1000 # Default -> 100
bruteforce: bruteforce # Default -> bruteforce
optimized: optimized # Default -> optimized
testcase_generator: generator # Default -> generator
The installation process is very straight-forward. CPC is available as a PYPI package and can be installed via:
pip install cpc
To install manually, clone from github. It is advised to use python venv:
git clone https://github.com/Purhan/cpc.git
cd cpc
pip install --editable .