Problem p02253 - Generation 1

Orig Description

Activity Selection Problem
There are $n$ activities with start times $\{s_i\}$ and finish times $\{t_i\}$. Assuming that a person can only work on a single activity at a time, find the maximum number of activities that can be performed by a single person.
Input
$n$
$s_1$ $t_1$
$s_2$ $t_2$
:
$s_n$ $t_n$
The first line consists of the integer $n$. In the following $n$ lines, the start time $s_i$ and the finish time $t_i$ of the activity $i$ are given.
Output
Print the maximum number of activities in a line.
Constraints
$1 \le n \le 10^5$
$1 \le s_i \lt t_i \le 10^9 (1 \le i \le n)$
Sample Input 1
5
1 2
3 9
3 5
5 9
6 8
Sample Output 1
3
Sample Input 2
3
1 5
3 4
2 5
Sample Output 2
1
Sample Input 3
3
1 2
2 3
3 4
Sample Output 3
2

Extracted Specification

Canonicalized Input Description:

An integer n (1 ≤ n ≤ 10^5), representing some quantity or size.
A list of n tuples, each containing two integers (s_i, t_i), where 1 ≤ s_i < t_i ≤ 10^9.

### Example Input:

```
5
1 2
3 9
3 5
5 9
6 8
```

### Function Signature:
Write a function f(inputs) that takes in the input.
```python
def f(inputs: List[Tuple[int, int]]):
    ''' 
    inputs: a list of tuples, each containing two integers
    '''
```

Test Case Generator

Sure! Below is a test case generator for the Activity Selection Problem.

```python
import random

def tcgen():
    # Number of activities (1 ≤ n ≤ 10^5)
    n = random.randint(1, 10**5)
    
    activities = []
    for _ in range(n):
        # Start time (1 ≤ s_i < t_i ≤ 10^9)
        s_i = random.randint(1, 10**9 - 1)
        # Finish time (s_i < t_i ≤ 10^9)
        t_i = random.randint(s_i + 1, 10**9)
        activities.append((s_i, t_i))
    
    # Sorting activities by start time to make it easier to read
    activities.sort()
    
    return n, activities

# To print the generated test case in the required format
def print_test_case(n, activities):
    print(n)
    for s_i, t_i in activities:
        print(s_i, t_i)

# Example usage
n, activities = tcgen()
print_test_case(n, activities)
```

### Explanation:
1. **Number of Activities (`n`)**: A random integer between 1 and 100,000 is chosen to represent the number of activities.
2. **Activity Start and Finish Times**:
   - For each activity, a start time `s_i` is randomly chosen between 1 and 10^9 - 1.
   - The finish time `t_i` is then chosen to be a random integer between `s_i + 1` and 10^9 to ensure that `s_i < t_i`.

### Usage:
- The `tcgen` function generates the random test case.
- The `print_test_case` function prints the generated test case in the required format.

You can run this script to generate and print a random test case for the Activity Selection Problem.

Extract Arguments

def extract_arguments(fh):
    n = int(fh.readline().strip())
    activities = []
    for _ in range(n):
        s, t = map(int, fh.readline().strip().split())
        activities.append((s, t))
    return n, activities

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