Robott path dp doubt

pls tell me what is wrong with this code it is giving run time error
cn u tell me reason for this error
link to code is

@Tanna Your code is not giving run- time error. But i think it is giving the wrong output.

Consider the sample case:
4 3 2
3 3
3 1

Output should be: 2

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.