Movement on a 2-D grid

Can anybody tell why the above solution is giving TLE??

I am unable to access your code. Please provide my some other link to your code as well as the question.

https://leetcode.com/interview/1/submissions/

It redirects me to the interview page. I guess leetcode does not allow sharing of submissions. Either format your code and paste it here along with the question link or ideone it.

Thanks for informing the same.
Question link
here is link of my code https://ideone.com/krtWmA
Consider code written inside main function only.

variable of loop is same as your variable for horizontal and vertical