Runtime error in CF02,Edit distance

,

The link to question is CF02 Problem - CodeChef
The link to my solution is dkKV9D - Online C++ Compiler & Debugging Tool - Ideone.com

It’s giving correct answers for all test cases i could check but after submitting I am getting runtime error.
Please help me out to find my error.Thanks in advance.