Problem p00184 - Generation 3

Orig Description

Tsuruga Castle
Tsuruga Castle, which is a symbol of Aizuwakamatsu City, was built by Ujisato Gamou with a fully-fledged castle tower and named it "Tsuruga Castle". From the castle tower, you can enjoy a panoramic view of the Aizu Basin. On a clear day, you can also see Tsuruga Castle from the summit of Iimoriyama, famous for the Byakkotai.
In order to use it as a reference for future public relations activities in Aizuwakamatsu City, we decided to conduct an age survey of visitors to Tsuruga Castle. Create a program that outputs the number of people in each age group below based on the visitor's age input.
  Age GroupAge Range
Under 10  0  ~ 9
 10's  10  ~ 19
 20's  20  ~ 29
 30's  30  ~ 39
 40's  40  ~ 49
 50's  50  ~ 59
Over 60 60  ~
Input
The input consists of a sequence of multiple datasets. The end of input is indicated by a line containing a single zero.
Each dataset is given in the following format.
n
a1
a2
:
an
The first line contains the number of visitors n (1 ≤ n ≤ 1000000), followed by n lines describing the age ai (0 ≤ ai ≤ 120) of the i-th visitor.
Output
For each dataset, output the number of people in each age group in the following format:
1st line: Number of people under 10
2nd line: Number of people in their 10's
3rd line: Number of people in their 20's
4th line: Number of people in their 30's
5th line: Number of people in their 40's
6th line: Number of people in their 50's
7th line: Number of people over 60
Sample Input
8
71
34
65
11
41
39
6
5
4
67
81
78
65
0
Output for the Sample Input
2
1
0
2
1
0
2
0
0
0
0
0
0
4

Extracted Specification

An integer n (1 ≤ n ≤ 1,000,000), representing some quantity or size.
A list of integers a of size n, where each integer is between 0 and 120.
The input ends with a single zero.

### Example Input:

```
8
71
34
65
11
41
39
6
5
0
```

### Function Signature:
Write a function f(inputs) that takes in the input.
def f(inputs: List[Tuple[int, List[int]]]):
    ''' 
    inputs: a list of tuples, where each tuple consists of:
        - an integer
        - a list of integers
    '''

Test Case Generator

Sure, I can help you write a test case generator for the "Tsuruga Castle" problem. We'll generate random test cases based on the given constraints. The generator will create a sequence of datasets, each dataset containing a random number of visitors along with their ages, and will terminate with a zero.

Here's the code for the test case generator:

```python
import random

def tcgen():
    datasets = []
    
    # Number of datasets to generate
    num_datasets = random.randint(1, 10)
    
    for _ in range(num_datasets):
        # Number of visitors n (1 ≤ n ≤ 1000000)
        n = random.randint(1, 1000000)
        
        # List of ages ai (0 ≤ ai ≤ 120)
        ages = [random.randint(0, 120) for _ in range(n)]
        
        datasets.append((n, ages))
    
    return datasets

# Function to format the test case as a string
def format_test_case(datasets):
    result = []
    
    for n, ages in datasets:
        result.append(f"{n}")
        result.extend(map(str, ages))
    
    result.append("0")
    
    return "\n".join(result)

# Example usage
datasets = tcgen()
formatted_test_case = format_test_case(datasets)
print(formatted_test_case)
```

### Explanation:

1. **`tcgen` Function**: This function generates a list of datasets. Each dataset consists of:
   - A random number of visitors `n`.
   - A list of `n` ages, with each age being a random integer between 0 and 120.

2. **`format_test_case` Function**: This function formats the generated datasets into the required input format:
   - It converts each dataset into a string where the first line is the number of visitors followed by each visitor's age on a new line.
   - It appends '0' at the end to indicate the end of input.

3. **Example Usage**: The example usage demonstrates how to generate and format test cases. The formatted test case is printed out, which can be used as input for the problem.

By running the generated code, you will get random test cases in the required format. This will help in testing the solution for the "Tsuruga Castle" problem.

Extract Arguments

def extract_arguments(fh):
    inputs = []
    while True:
        n = int(fh.readline().strip())
        if n == 0:
            break
        ages = [int(fh.readline().strip()) for _ in range(n)]
        inputs.append((n, ages))
    return inputs