Help for Shortest Route

I don’t usually ask for help debugging code. But ever since codechef moved wrong answer debugging, hints and video tutorial to pro I have been compelled to ask for help with debugging my code. I have tried every possible test case I can think of but couldn’t understand what’s wrong.
Question statement: CodeChef
My solution: CodeChef

I am not asking for a complete debug. Any help such as some small mistake is highly appreciated.
Edit: Please ignore the fast_input and fast_output class they do what they sound like.
I use ‘in’ instead of ‘cin’ and ‘out’ instead of ‘cout’ also ‘enl’ instead of ‘endl’.