Spiderman and Jumping SPIDY2 SIGSEGV

I have applied memoization to solve the problem SPIDY2 Problem - CodeChef . 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. CodeChef: Practical coding for everyone

EDIT:- It was due to stack overflow. Got accepted after increasing the size of the stack. CodeChef: Practical coding for everyone