One Shot Through the Origin
Alice is standing at the origin of an infinite practice range with a laser pointer. When she picks a direction and fires, the beam travels as a full straight line through the origin — it shoots out both forwards and backwards, hitting every target that lies anywhere on that line (on either side of her).
There are n targets scattered around the range, given by their integer
coordinates. A target standing exactly at the origin is hit no matter which
direction Alice fires in, since the line always passes through her feet.
Bob challenges Alice to line up as many targets as possible with a single shot. Help Alice find the largest number of targets that one shot (one line through the origin) can hit.
Input
The first line contains one integer n (1 ≤ n ≤ 2·10^5) — the number of
targets.
Each of the next n lines contains two integers x_i and y_i
(-10^9 ≤ x_i, y_i ≤ 10^9) — the coordinates of a target. Several targets
may share the same coordinates, and several targets may be at the origin.
Output
Print a single integer — the maximum number of targets Alice can hit with one shot.
Notes
In the first example, the targets at (1, 1), (2, 2) and (-1, -1) all
lie on the same line through the origin (the beam hits (1, 1) and (2, 2)
going one way and (-1, -1) going the other way), and the target at
(0, 0) is hit by every shot, for a total of 4. The remaining target,
(3, 1), lies on a different line and cannot be added.
Watch out for direction keys that only normalize the sign, not the
magnitude, or only the magnitude, not the sign: (2, 4), (-1, -2) and
(1, 2) all describe the very same line through the origin and must be
counted together.