python RE NZEC


i’ll start by saying i’m new here and new to python.
i’ve been struggling to submit a code i wrote for Queries On Tree in school tab (was a part of the ltime19.
my problem is that i get RE ( NZEC ) and i have no idea why.
i know the code works fine for small amount of inputs ,i ran it in, as i read in one of the answers that both sites use the same engine ,and it works fine.
i’m using raw_input() and not just input() to get the inputs.
i also ran it in cmd line (windows) with an input file like this : < inputFile > outputFile and it looks fine.

my code (written in python 2.7) is a bit long so here is the ideone link : ideone

can anyone help me understand what am i missing here ?

thanks in advance

1 Like

Ok, there are only two options - I’m lucker or I did something wrong…

It gives RE for my first input -

But as I said, I do not know Python, so you have to check yourself :wink:

Hi @sstuff, I’m not upvoting questions often, but you mentioned all information needed to help you. You shown respect and put effort solving it yourself and I hope someone skilled in Python will help you soon :wink: Unfortunatelly Python is not my cup of tea, sorry.

thank you my friend. :slight_smile: