answers locally on my pc..
                  
                  
                  But I have one issue.. the number of test cases isn't specified.. hence I have to read all the inputs...
                  
                  
                  when I try to do that I get a runtime error
                  
                  
                  
                  
                  
                  How can I read inputs if I don't know the number of inputs?
                  
                  
                  
                  
                  
                  Example:
                  
                  
                  
                  
                  
                  12
                  
                  
                  2
                  
                  
                  3
                  
                  
                  
                  
                  
                  I have to stop the loop after reading 3
                  
                  
                
a = list(input().split(' ')) Int a = list(map(int, input().split(' ')))
Yeah, just read it as a one line string, then convert into separate numbers using split() and add it to a list, like above mentioned^. Unlike C++, Python doesn't treat space as a newline character in inputs.
if u dont want split a string ,, you can use a timer ,, and create timeout mode to break loop
Обсуждают сегодня