Add path to Environment Variables
- Right-click on This PC, go to Properties > Advanced system settings > Environment Variables
- Click on the Path column in System variables and click Edit
- Click New, paste
C:\Program Files\CMake\bin
, and click OK - Finally, close and reopen VSCode
In VSCode, go to File > Preferences > Settings
Search for C_Cpp › Default: Compiler Path and set it to C:/MinGW/bin/g++.exe
This repository contains the following files:
.clang-format: C++ code formatter that provides an option that lets the user define their custom code style options
CMakeLists.txt: directives and instructions describing the project's source files and targets.
fetch_cases.py: takes contest number and problem letter as input to access the specific problem with the URL (for example, https://codeforces.com/problemset/problem/1681/A) to parse all the test cases with its inputs and outputs into their respective text files
run.py: executes the code with the input generated by fetch_cases.py for all test cases
remove_exe.py: removes the executable of the program from CMakeLists.txt
make.bat: contains lines with commands executing in sequence. Performs multiple tasks as per the user's request, all of which are discussed in the next section
Clone this repository and open it in VSCode. To clone, run
git clone https://github.com/geekyquentin/cf_test-case-parser_and_runner
CMakeLists.txt might be having some executables added, and it throws errors when it doesn't find its corresponding source files. To remove the added executables from the list, run
./make.bat rex
Open a problem in the codeforces site. From its URL, get the contest number and the problem letter (for example, in https://codeforces.com/problemset/problem/1681/A, contest_number is 1681 and problem_letter is A).
To get the input and output for all test cases, run
./make.bat contest_number problem_letter gtc
Function: fetch_cases.py accesses the page and parses the test cases. make.bat creates problem_letter.cpp
in the directory contest_number
, adds an executable of this program to CMakeLists.txt, and opens it in VSCode.
To run the program on every test case, run
./make.bat contest_number problem_letter debug
Function: make.bat generates the CMake build directory if it doesn't exist and builds all the executables that are added to the CMakeLists.txt. run.py runs the executable in CMake build directory for all test cases and writes the output to code_output.txt.
To compare the outputs, use run
instead of debug
./make.bat contest_number problem_letter run
To add a problem to the TODO list, run
./make.bat contest_number problem_letter todo
To perform a clean-up, run
./make.bat clean
Function: Deletes input and output files generated while parsing test cases and removes the CMake build directory
If the problem doesn't ask for the number of test cases as an input, edit the main()
function accordingly
To disable GitHub Copilot for the .cpp files, add "github.copilot.enable": { "cpp": false, }
to .vscode/settings.json