My code is showing wrong answer on one test case..?

if(v[i].first<distance) use <
instead of <=