Runtime(NZEC) error in submission of MARBLES problem

I was trying the MARBLES problem in the medium difficulty practise problems and even though my code seems to be running well, I am getting Runtime(NZEC)error on submission. Can somebody find the problem?
My solution:- CodeChef: Practical coding for everyone