Sponsored
Use these hints if you're stuck. Try solving on your own first.
Binary search for the answer. How can you check how many pairs have distance <= X?
Solve with full IDE support and test cases