http://codeforces.me/contest/378/submission/21474186
I have submitted the analogous code in c++ and it worked fine. Is there some reason why this does not work even having set the recursion limit to 20k? I have every time the time and memory is well within limit when it crashes. any ideas?



