Closest Huddle of Drifting Buoys
n buoys drift along a straight channel, which we treat as a number line. At time 0 buoy i is
at position x_i, and it drifts with a constant speed v_i (a negative speed means it drifts
toward smaller positions). So at time t buoy i is at position x_i + v_i·t. Buoys never
interact: they pass through each other freely.
The spread of the buoys at time t is the distance between the two outermost buoys, that is the
largest position minus the smallest position at that moment.
Find the smallest spread over all real times t ≥ 0.
Input
The first line contains n (1 ≤ n ≤ 10^5), the number of buoys.
Each of the next n lines contains two integers x_i and v_i (−10^5 ≤ x_i ≤ 10^5,
−1000 ≤ v_i ≤ 1000): the starting position and the speed of buoy i. Several buoys may share a
position or a speed.
Output
Print the smallest spread over all times t ≥ 0, a real number. Your answer is accepted if its
absolute or relative error is at most 10^-6.
Notes
In the first example the buoys are at 2t, 10 − t and 4. At time t = 10/3 the first two meet
at position 20/3, and the spread is 20/3 − 4 = 8/3; at no other moment is it smaller.
In the second example the buoys only move apart, so the smallest spread is the one at time 0.
Times before 0 don't count.