Python Code Giving NZEC

My code for the Problem : http://www.codechef.com/OCT13/problems/HELPLIRA/ :

is repeatedly giving (NZEC) for the following
solution :
http://www.codechef.com/viewsolution/2800370 :

Please suggest any optimizations.

This is a live contest question. please ask after contest is over.

oohh!! crap extremely sorry for that!!