ONEKING Constraints doubt

In the last subtask test cases are 100 and n is 100000. So that makes to reading 100*100000 inputs(10^7). Is there some constraint on sum of n over all test cases? Because reading that many numbers will itself result in tle.

No, but this is upper bound.