Spiderman and Jumping SPIDY2 SIGSEGV

I have applied memoization to solve the problem http://www.codechef.com/problems/SPIDY2 . My solution seems correct to me but it is giving me SIGSEGV. I don’t think the SIGSEGV is due to stack overflow as the limits are 2*10^5. Can somebody help me find mistake in my code. Here is my solution. http://www.codechef.com/viewsolution/6065064

EDIT:- It was due to stack overflow. Got accepted after increasing the size of the stack. http://www.codechef.com/viewsolution/6066494