Rat in a maze problem getting run time error

Code is working properly but not getting submitted.It is showing run time error when getting submitted.
Here is the link to the code.

@Aakash-Gupta-2308897339337431 see the question the constraints can be grid size of 1000 increase grid size