When I have a program that can take up to the n
input line to solve the problem, before starting with the next, I need to throw away all the input lines that are related to the old problem, when the program can solve it before reading all the input data.
Of course, I could just go in cycles until I get to a new problem, but reading and storing all this data can be expensive. Is there no way to simply tell the input stream to ignore the following so-and-many values?
source
share