Runtime Error in TSECJ05

Problem link-https://www.codechef.com/problems/TSECJ05
My code(python) is correct in this problem but still it is showing runtime error.Till date whoever has submitted in python has got runtime error in this code.Is this problem solvable in python??

My solution: https://www.codechef.com/viewsolution/24416662
@vijju123