Competitive Programmers often need to generate a lot of test cases for the problems they have curated. Generating input files is a task which is very difficult to automate, because of the fact that the constraints for all the input files are not the same. But the task of generating the output files based on the inputs from the input files can be simplified.
Let us consider that you have a directory containing the soln.cpp(the file from which the outputs need to be generated) file and the input.txt files, say of the form input0.txt, input1.txt and so on.
This Python script will allow you to generate all the output.txt files, say of the form output0.txt, output1.txt and so on and also move all the input files to a folder called input and the output files to a folder called output.
The screenshots folder contains the screenshots of the working of the code on my system.
Description for the images
- The inital view of the working directory containing the soln.cpp file, the main.py file and all the other input.txt files.
- Screenshot 2,3 and 4 showcase the running script
- Screenshot 5 is the final view of the working directory