WA in RRSTONES may long challenge

I know it is an ongoing contest, so answer my question only after the contest gets over; I’ve tried solving RRSTONES considering all corner cases but still getting WA. Can anyone please tell me where I am going amiss. here is my code
http://www.codechef.com/viewsolution/3855501

can anyone answer this question, now that the contest is over

read the editorial answer is there - http://discuss.codechef.com/questions/42550/rrstone-editorial