What is wrong in my solution?

refer this for code

becuase of too much memory allocation it is giving segfault.
use given row and colum to intialise dp array
or guess the size