Problem p03592 - Generation 1

Orig Description

Score : 200 points
Problem StatementWe have a grid with N rows and M columns of squares. Initially, all the squares are white.
There is a button attached to each row and each column.
When a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.
When a button attached to a column is pressed, the colors of all the squares in that column are inverted.
Takahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.
Constraints
1 \leq N,M \leq 1000
0 \leq K \leq NM
InputInput is given from Standard Input in the following format:
N M K
OutputIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.
Sample Input 12 2 2
Sample Output 1Yes
Press the buttons in the order of the first row, the first column.
Sample Input 22 2 1
Sample Output 2No
Sample Input 33 5 8
Sample Output 3Yes
Press the buttons in the order of the first column, third column, second row, fifth column.
Sample Input 47 9 20
Sample Output 4No

Extracted Specification

Canonicalized Input Description:

An integer N (1 ≤ N ≤ 1000), representing some quantity or size.
An integer M (1 ≤ M ≤ 1000), representing some quantity or size.
An integer K (0 ≤ K ≤ NM), representing some quantity or size.

### Example Input:

```
2 2 2
```

### Function Signature:
Write a function f(N, M, K) that takes in the input.
```python
def f(N: int, M: int, K: int):
    ''' 
    N: an integer 
    M: an integer 
    K: an integer 
    '''
```

Test Case Generator

Certainly! Here's a test case generator for the given problem statement:

```python
import random

def generate_test_case():
    # Constraints
    N = random.randint(1, 1000)  # Number of rows
    M = random.randint(1, 1000)  # Number of columns
    K = random.randint(0, N * M)  # Number of black squares desired

    return N, M, K

# Printing a sample generated test case
test_case = generate_test_case()
print(test_case)
```

### Explanation:
1. **N**: Randomly chooses the number of rows between 1 and 1000.
2. **M**: Randomly chooses the number of columns between 1 and 1000.
3. **K**: Randomly chooses the number of black squares desired between 0 and \(N \times M\).

Running the `generate_test_case` function will provide a tuple representing a random test case for the problem, adhering to the constraints specified.

### Example Output:
Running the function might give an output like:
```
(753, 482, 123456)
```

This represents:
- 753 rows
- 482 columns
- 123456 black squares desired

Feel free to integrate this into your testing framework or use it to generate multiple test cases for thorough testing.

Extract Arguments

def extract_arguments(fh):
    N, M, K = map(int, fh.readline().strip().split())
    return N, M, K