Problem p03609 - Generation 2

Orig Description

Score : 100 points
Problem StatementWe have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand.
How many grams of sand will the upper bulb contains after t seconds?
Constraints
1≤X≤10^9
1≤t≤10^9
X and t are integers.
InputThe input is given from Standard Input in the following format:
X t
OutputPrint the number of sand in the upper bulb after t second.
Sample Input 1100 17
Sample Output 183
17 out of the initial 100 grams of sand will be consumed, resulting in 83 grams.
Sample Input 248 58
Sample Output 20
All 48 grams of sand will be gone, resulting in 0 grams.
Sample Input 31000000000 1000000000
Sample Output 30

Extracted Specification

An integer X (1 ≤ X ≤ 10^9), representing a quantity.
An integer t (1 ≤ t ≤ 10^9), representing a time.

### Example Input:

```
100 17
```

### Function Signature:
Write a function f(X, t) that takes in the input.
def f(X: int, t: int):
    ''' 
    X: an integer 
    t: an integer 
    '''

Test Case Generator

Sure, here is a Python function to generate test cases for the given sandglass problem:

```python
import random

def tcgen():
    X = random.randint(1, 10**9)
    t = random.randint(1, 10**9)
    return X, t

# Generate a test case
X, t = tcgen()
print(f"{X} {t}")

# Example usage: output a test case
if __name__ == "__main__":
    for _ in range(5):  # Generate 5 example test cases
        X, t = tcgen()
        print(f"{X} {t}")
```

This function randomly generates values for \(X\) and \(t\) within the specified constraints (1 ≤ \(X\) ≤ 10^9 and 1 ≤ \(t\) ≤ 10^9). The generated values are returned and printed in the required format. You can run this function to generate multiple test cases as needed.

Here's how you can use the function to generate and print multiple test cases:

```python
if __name__ == "__main__":
    for _ in range(5):  # Generate 5 example test cases
        X, t = tcgen()
        print(f"{X} {t}")
```

This will generate 5 test cases and print them in the required format, suitable for use in testing the sandglass problem solution.

Extract Arguments

def extract_arguments(fh):
    X, t = map(int, fh.readline().strip().split())
    return X, t