Problem p03122 - Generation 1

Orig Description

Score : 1000 points
Problem StatementRed bold fonts show the difference from C1.
There is an infinitely large triangular grid, as shown below.
Each point with integer coordinates contains a lamp.
Initially, only the lamp at (X, Y) was on, and all other lamps were off.
Then, Snuke performed the following operation zero or more times:
Choose two integers x and y.
Toggle (on to off, off to on) the following three lamps: (x, y), (x, y+1), (x+1, y).
After the operations, N lamps (x_1, y_1), \cdots, (x_N, y_N) are on, and all other lamps are off.
Find X and Y.
Constraints
1 \leq N \leq 10^4
-10^{17} \leq x_i, y_i \leq 10^{17}
(x_i, y_i) are pairwise distinct.
The input is consistent with the statement, and you can uniquely determine X and Y.
InputInput is given from Standard Input in the following format:
N
x_1 y_1
:
x_N y_N
OutputPrint X and Y, separated by a space.
Sample Input 14
-2 1
-2 2
0 1
1 0
Sample Output 1-1 0
The following picture shows one possible sequence of operations:

Extracted Specification

An integer N (1 ≤ N ≤ 10^4), representing some quantity or size.
A list of tuples, where each tuple consists of two integers (x, y) with both integers in the range [-10^17, 10^17].
The tuples are pairwise distinct.

### Example Input:

```
4
-2 1
-2 2
0 1
1 0
```

### Function Signature:
Write a function f(inputs) that takes in the input.
```python
from typing import List, Tuple

def f(inputs: List[Tuple[int, int]]):
    '''
    inputs: a list of tuples, where each tuple consists of two integers
    '''
```

Test Case Generator

Certainly! Below is the test case generator for the provided problem statement involving a triangular grid with lamps.

```python
import random

def tcgen():
    N = random.randint(1, 10**4)
    
    lamps = set()
    while len(lamps) < N:
        x = random.randint(-10**17, 10**17)
        y = random.randint(-10**17, 10**17)
        lamps.add((x, y))
    
    lamps_list = list(lamps)
    
    return N, lamps_list

def format_input(N, lamps_list):
    formatted_input = f"{N}\n"
    for x, y in lamps_list:
        formatted_input += f"{x} {y}\n"
    return formatted_input

# Example Usage
N, lamps_list = tcgen()
input_data = format_input(N, lamps_list)
print(input_data)
```

This script generates a test case for the problem. It creates a random number of lamps `N` within the constraints and ensures that the coordinates of the lamps are unique. It also formats the input to match the expected standard input format for the problem.

### Explanation:
1. **Generating `N`**: Randomly choose the number of lamps `N` between 1 and 10,000.
2. **Generating Unique Lamp Coordinates**: Use a set to store unique lamp coordinates. Randomly generate `x` and `y` coordinates in the range \([-10^{17}, 10^{17}]\) until we have `N` unique lamps.
3. **Formatting the Input**: Convert the set of lamps to a list and format it into the required input format.

The `format_input` function is used to convert the generated test case into the format specified in the problem statement, making it easy to pass the input to your solution for testing.

Extract Arguments

def extract_arguments(fh):
    N = int(fh.readline().strip())
    lamps = []
    for _ in range(N):
        x, y = map(int, fh.readline().strip().split())
        lamps.append((x, y))
    return N, lamps

# if __name__ == "__main__":
#     input_path = sys.argv[1]
#     with open(input_path, 'r') as fh:
#         N, lamps = extract_arguments(fh)
#         f(N, lamps)