Cannot comprehend the reason for compilation error

I have posted my code below .
It is giving correct output on Test Case 1 but compilation error on Test Case 0 . I am unable to find the reason for same. Please Help.

Link to my solution

Set do not contain equal elements. So your code will not work when two distances are same. Try to apply priority queue in this problem.