What are the details of your problem?
There are several ways to take external input - stdin, CLI arguments, or files, etc.
In python3, keywords respectively are: input
, sys.argv
, open
.
The most commonly used of these in normal applications is taking input from the stdin
i.e. either via keyboard, or via shell; the input()
function in python.
But unlike both the other 2 methods, i don't know the way to automate or hardcode this within the script be it for C/C++/Python. Some known ways to (semi) automate input seams to be stdin i.e. <<<
in bash, or (as told by chatGPT) in configuration files.
This lack of automation makes it very hard while doing any type of coding, be it
designing for the first time, debugging, or benchmarking/timing.
Replacing the whole input function call with some value may work for less variables, but where lots of variables take input, it becomes laborious to add and remove such substitutes.
In continuation of this, I would like to reproduce the setup used by online coding sites like Hackerrank, Coding Ninja etc to test the script against variety of inputs.
Also to measure or cap it with time and memory limits to overcome the TLEs, but that's outside scope of this question.