Problem p00195 - Generation 3

Orig Description

What are the popular stalls?
In Aizu-Wakamatsu City, there is a first market called "Tokaichi" on January 10th every year. This Tokaichi has a history of about 600 years and is the largest first market in the Aizu region. It is also well known that "Okiai Ko-boshi", a familiar good luck item in the Aizu region, is sold. Okiai Ko-boshi is a doll with a center of gravity at the bottom that is about 3 cm in size, and its name comes from the fact that it stands up immediately even if it falls. In each household, one more than the family must be purchased and offered to the household shrine. This one has the meaning of "increasing the family" or "carrying the burden of misfortune".
The Tokaichi Executive Committee has decided to investigate the store with the highest sales of Okiai Ko-boshi for the next Tokaichi. The number of stores this year is five (A, B, C, D, E: lowercase letters), and the number of items sold has been reported to the Tokaichi Executive Committee separately for the morning and afternoon sessions.
Create a program that takes information for each store as input and outputs the name and number of the store with the highest sales for the day.
Input
The input consists of a sequence of multiple data sets. The end of the input is indicated by two zeros on a line.
Each dataset is given in the following format.
s1A s2A
s1B s2B
s1C s2C
s1D s2D
s1E s2E
For the i-th line, the morning sales s1i and the afternoon sales s2i (1 ≤ s1i, s2i ≤ 10000) for stores A, B, C, D, and E are given. It is assumed that there are no stores that sell the same number of items for the day.
The number of datasets is no more than 100.
Output
For each dataset, output the name and number of the store with the highest sales for the day on one line.
Sample Input
1593 4311
4321 2155
1256 6421
5310 1455
2152 5421
1549 3386
4528 3719
1234 4321
3330 3109
2739 2199
0 0
Output for the Sample Input
C 7677
B 8247

Extracted Specification

An integer sequence of multiple datasets. The end of the input is indicated by two zeros on a line.
Each dataset consists of 5 pairs of integers (a1, a2), (b1, b2), (c1, c2), (d1, d2), (e1, e2), where 1 ≤ ai, bi, ci, di, ei ≤ 10000.
The number of datasets is no more than 100.

### Example Input:

```
1593 4311
4321 2155
1256 6421
5310 1455
2152 5421
1549 3386
4528 3719
1234 4321
3330 3109
2739 2199
0 0
```

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

Test Case Generator

Sure, I can help you write a test case generator for the given problem statement "What are the popular stalls?". Here is the Python code for the test case generator:

```python
import random

def generate_test_case():
    test_cases = []
    
    # Number of datasets
    num_datasets = random.randint(1, 100)
    
    for _ in range(num_datasets):
        dataset = []
        total_sales = []
        stores = ['A', 'B', 'C', 'D', 'E']
        
        for store in stores:
            s1 = random.randint(1, 10000)
            s2 = random.randint(1, 10000)
            total = s1 + s2
            dataset.append((s1, s2))
            total_sales.append((total, store))
        
        # Ensure no two stores have the same total sales
        total_sales = list(set(total_sales))
        
        # Sort to find the highest sale
        total_sales.sort(reverse=True)
        
        test_cases.append((dataset, total_sales[0]))
    
    # Convert test cases to input-output format
    input_str = ""
    output_str = ""
    
    for dataset, highest_sale in test_cases:
        for s1, s2 in dataset:
            input_str += f"{s1} {s2}\n"
        output_str += f"{highest_sale[1]} {highest_sale[0]}\n"
    
    input_str += "0 0\n"  # End of input
    
    return input_str.strip(), output_str.strip()

# Example usage
input_str, output_str = generate_test_case()
print("Generated Input:")
print(input_str)
print("\nExpected Output:")
print(output_str)
```

### Explanation:
1. **Number of datasets**: Randomly determine the number of datasets (between 1 and 100).
2. **Dataset Creation**: For each dataset:
   - Create an array for each store ('A', 'B', 'C', 'D', 'E') containing random sales values for the morning (`s1`) and afternoon (`s2`) sessions.
   - Calculate the total sales for each store.
   - Ensure no two stores have the same total sales by using a set.
3. **Sort and Find Highest Sale**: Sort the total sales in descending order to determine the store with the highest sales.
4. **Format for Output**: Convert the datasets into the required input and output format.
5. **End of Input**: Append `0 0` to mark the end of input.

You can run the `generate_test_case()` function to generate a new test case each time.

Extract Arguments

def extract_arguments(fh):
    datasets = []
    while True:
        data = []
        for _ in range(5):
            line = fh.readline().strip()
            if line == "0 0":
                return datasets
            data.append(tuple(map(int, line.split())))
        datasets.append(data)