We need to compute the minimum number of moves (segments) needed to cover all points, where all segments are either all vertical or all horizontal (chosen at the start). In each move, we can paint a segment of any length (line segment, presumably infinite? "any length on the plane", but it's a segment, not necessarily infinite line) of the chosen orientation. The segment can be placed anywhere, and any alarm clock that lies exactly on that segment gets turned off. We can draw multiple segments. We want to cover all points with a set of axis-aligned segments (all vertical or all horizontal) with the goal of minimizing the number of segments used.
So essentially we have a set of points with integer coordinates in a grid 0..100. We need to cover them using lines (segments) that are either all vertical or all horizontal. Since we can choose any length, we can always cover any points that lie on a common vertical line (x = constant) with a single vertical segment that covers the range of y's that contain points on that line. However, note that if we have points on same x but with y values that are not contiguous? Actually, since it's a segment of any length, we can draw a segment that covers from min y to max y among points on that x, and it will cover all points on that x (since they lie on that vertical line). So each vertical line (distinct x coordinate) can be covered by one vertical segment (as long as we cover all y's that have points, but we can cover the entire range from min y to max y, which includes all points on that line because any point on that x lies somewhere in that y range). But careful: if we have points at x=0 with y=0,2 but not y=1, a vertical segment from y=0 to y=2 will include the entire continuous interval, but does it cover points exactly at y=0 and y=2? Since the segment is the set of points (0, y) for y in [0,2]. This segment includes all points on that line with y in the interval, so it covers y=0 and y=2, but also passes through y=1. However, there is no alarm clock at y=1, so it's fine. So indeed one vertical segment per distinct x coordinate covers all points on that x.
Similarly, for horizontal segments, we can cover all points with a given y coordinate by one horizontal segment covering the range of x's from min to max.
Thus, if we choose vertical segments, the number of moves needed is the number of distinct x-coordinates among the points. If we choose horizontal segments, the number of moves is the number of distinct y-coordinates.
But wait: is there any possibility to cover points from multiple vertical lines with a single vertical segment? No, because vertical segment is a fixed x coordinate. So it can only cover points that share that x. So indeed each distinct x must have its own segment.
Similarly for horizontal.
Thus the minimum number of moves would be min( number of distinct x, number of distinct y ).
But is that always optimal? Let's check the examples.
Example 1:
Points: (0,0), (0,1), (0,2), (1,0). Distinct x: 0,1 => 2. Distinct y: 0,1,2 => 3. min=2, output=2. That matches.
Example 2:
(0,0),(0,1),(1,0),(1,1). Distinct x:0,1 =>2. Distinct y:0,1 =>2. min=2, output=2.
Example 3:
(1,1),(1,2),(2,3),(3,3). Distinct x:1,2,3 =>3. Distinct y:1,2,3 =>3. min=3, output=3. Indeed.
So seems trivial: answer = min( distinct x count, distinct y count).
But wait, the problem statement says: "Inna can paint a segment of any length on the plane, she chooses its type at the beginning of the game (either vertical or horizontal), then all alarm clocks that are on this segment switch off." This might imply that the segment is of finite length but can be placed arbitrarily. It also says "then all alarm clocks that are on this segment switch off". If a point lies exactly on the segment, it gets turned off. So if we draw a vertical segment from y=0 to y=100, it covers all points on that x between those y. So indeed covering all points on a vertical line requires only one segment if we extend it to cover the full y-range of the points. So it's straightforward.
But is there any twist? Possibly overlapping segments? No, because we can cover any number of points with a single segment; but could we cover points from two different vertical lines with a single vertical segment? No. So indeed each distinct coordinate needs its own segment. So answer = min(count distinct x, count distinct y). This seems too easy for a problem from Codeforces? Actually, I recall a problem "Inna and Alarm Clocks" maybe from Codeforces. Let me check memory: There is Codeforces problem 374A? Not sure. There is one named "Inna and Alarm Clocks" maybe? Actually I recall a problem "Inna and Alarm Clock" might involve covering points with lines and answer = min(unique x, unique y). Yes, that is a known simple problem. But constraints n up to 1e5, coordinates 0..100, which is small. So the solution is trivial: read points, put x's and y's in sets, output min size.
But wait: The problem says: "Inna can paint a segment of any length on the plane, she chooses its type at the beginning of the game (either vertical or horizontal)". Does the segment have to be drawn within the room? It says "on the plane", but the room is a 100x100 square. Usually, segments can be anywhere, but they can be placed beyond the room? Possibly yes, but no effect. Points are inside the room.
Also, could we use segments that are not axis-aligned? No, she chooses type: vertical or horizontal.
So indeed answer is min distinct x, distinct y.
But is there any scenario where we could do better than number of distinct x with vertical segments, by using a vertical segment that covers multiple x? That doesn't make sense: a vertical segment is a straight line segment that is vertical, meaning all points on it have same x coordinate. So cannot cover different x.
But what about if we choose a vertical segment that is not aligned with integer x? Could we place it at x=0.5? But alarm clocks have integer coordinates; a vertical segment at x=0.5 would not pass through any integer x point (except maybe if the clock coordinates are integer, they will never have x=0.5). So it would not cover any alarm clock. So only vertical lines at integer x would cover points. But could a vertical segment at x=0.5 still cover some points if we consider points at x=0? No, point (0,0) is not on line x=0.5. So we must align the vertical segment to the x-coordinate of the points. So we need to cover each distinct x with a vertical segment placed exactly at that x.
Thus answer is min distinct x, distinct y.
Double-check note: In sample 1, they mention if she paints horizontal segments she will need at least 3 segments. That's consistent: distinct y=3.
All good.
But wait, there is a nuance: The segments can be any length, but we can also place a segment that doesn't cover the entire line from min to max y? Actually, we could cover points on same x using multiple segments, but that would be inefficient. So minimal is using one per x.
But could there be a scenario where points on same x are not collinear? Actually they are collinear vertically. So one vertical segment can cover them all.
Thus answer is straightforward.
But maybe there is a trick: The points can have multiple alarm clocks at same coordinate. That doesn't affect distinct counts.
Thus implementation: read n, create two sets for x and y, for each point add x to setX, y to setY. Answer = min(len(setX), len(setY)). Print answer.
Check constraints: n up to 1e5, coordinates 0..100, set size at most 101. So trivial.
Thus solution is O(n).
Now write answer accordingly.
But before finalizing, let's think about whether there is any possibility to reduce number of segments by using segments that are not necessarily aligned with integer coordinates? As argued, if we use a vertical segment at x coordinate that is not an integer, it won't pass through any points (since points have integer coordinates). But maybe we could use a segment that is placed such that it goes through points that are not aligned on same x? For a vertical segment, points on it must have same x. So cannot go through points with different x. So no.
What if we use a horizontal segment: similar.
Thus answer stands.
So final solution: min distinct x, distinct y.
But wait, problem says: "Inna makes multiple moves. In a single move, Inna can paint a segment of any length on the plane, she chooses its type at the beginning of the game (either vertical or horizontal), then all alarm clocks that are on this segment switch off." Does the segment have to be drawn as a segment, i.e., a finite line, or could it be an infinite line? They say "segment of any length", implying finite but can be as long as needed. So we can cover entire vertical line from y=0 to y=100 if needed.
Thus indeed.
Now, is there any scenario where we could cover points on two different x using a single vertical segment if we place it at an angle? No, type is vertical or horizontal only, not diagonal.
Thus answer.
Given that it's from a contest, it's likely intended to be simple, perhaps to illustrate a concept.
Thus solution done.
Let's produce the final answer with explanation. The answer is simply the minimum between the number of distinct x-coordinates and distinct y-coordinates among all alarm clocks.
- If Inna chooses vertical segments, each segment must have a fixed x-coordinate, so all points with the same x can be covered by one vertical segment (by extending it to span the required y-range). Hence the number of moves equals the number of distinct x-values.
- Similarly, if she chooses horizontal segments, the number of moves equals the number of distinct y-values.
Inna will pick the orientation that yields the smaller count, so the minimum number of segments needed is min(|set_x|, |set_y|).
The solution runs in O(n) time and uses O(1) extra space (since coordinates are in [0, 100], sets have at most 101 elements).