Competitive programming setups suck ! This was the motivation behind creating codemon. Who wants to use Sublime Text with two inefficient windows for I/O anyways ? Also, what about the Vim Lovers ?
Codemon is a build tool that works on the terminal, and aims to make the workflow for competitive programming faster than ever. Codemon integrates flawlessly with popular editors such as VSCode, Sublime Text and obviously Vim (β€) !
- Just give the contest number, codemon will create a nice directory structure and will fetch all your testcases (inputs & outputs π₯) from CodeForces.
- Hit
Ctrl+Sand codemon will compile your code, run it on the testcases fetched and show you the output. - In case, your output is wrong, don't worry ! Codemon makes debugging easier by pointing out exactly where your output didn't match.
- Apart from that, codemon allows you to create multiple code templates for various competitions and pulls them just in time.
There are many ways to install Codemon.
pip install codemon
-
To install setuptools, use
pip install setuptools -
Type
git clone https://github.com/ankingcodes/codemon.gitto clone the package -
Type
cd codemon -
Type
sudo python3 setup.py install -
Type
sudo python setup.py bdist_wheel -
Install the package locally using
pip install .This command will place
codemonexecutable at/usr/local/binso that it can be executed anywhere. -
Type
codemonand you are ready to go.
codemon init <contestName>
This command is used to create a new contest directory for a CodeForces contest. The value of <contestName> should include the Contest Number of the CodeForces Contest. Codemon automatically fetches the inputs and outputs for each problem in that round and creates the directory & file structure accordingly. We can also use flags such as -cpp, -py, -java along with the codemon init command to specify which extension will be used to create the files.
For example, for Codeforces Round number 1472,
codemon init CodeForces1472
Contest URL - https://codeforces.com/contest/1472/
Codemon creates a directory structure as follows:
The .in and .op files contain inputs and outputs respectively.
codemon init -n <fileName>.<extension>
Creates a single file using a default template.
codemon listen
Once codemon starts listening, it would capture all modifications on the contest files created, that is, when an users saves their code using ctrl + s, codemon will catch that file, compile it using the respective compiler for that file (currently supports C++), and run it using the inputs already fetched in the .in file.
Codemon then displays the output from the program on the terminal and also matches it with the sample outputs given in .op file. In case, both the outputs don't match, Codemon would point exactly where the error has occurred.
A correct output looks as follows:
An incorrect output looks as follows:
There are many more commands available, which can be viewed using codemon --help.
Don't hesitate to create issues and PRs for improving codemon. All contributions are welcome.
The MIT License
Copyright (c) 2021 Ankush Bhardwaj