Does your code work on IDEONE, and with larger input sets?
NZEC often occurs due to int() conversion on strings which ar not valid integers. You can improve your code by ignoring whitespace in split-function: split() is better than split(' ').
And NZEC could be resulting from index errors...
Anyway, your algorithm will probably not get AC in the end - there's no successfull python submission for this problem. Furthermore, the comments lead towards a segment tree algorithm, which most probably will be quite more efficient than your "naive" approach.