#C10670. Student with Highest Average Grade

    ID: 39901 Type: Default 1000ms 256MiB

Student with Highest Average Grade

Student with Highest Average Grade

You are given data on ( n ) students. Each student is described by a name and a list of their grades. Your task is to determine the student with the highest average grade. The average grade for a student is computed as ( \frac{\text{sum of grades}}{\text{number of grades}} ). In case of a tie (i.e. two or more students have the same average), choose the student who appears first in the input.

Example: If the input is:

3
Alice
3 90 80 70
Bob
2 88 92
Charlie
3 100 60 70

Then the average grades are:

  • Alice: \( \frac{90+80+70}{3} = 80 \)
  • Bob: \( \frac{88+92}{2} = 90 \)
  • Charlie: \( \frac{100+60+70}{3} = 76.67 \)
Thus, the output should be Bob.

inputFormat

The input is read from standard input (stdin) and has the following format:

  • The first line contains an integer \( n \) representing the number of students.
  • For each student, there are two lines:
    • The first line contains the student's name (a string without spaces or with spaces).
    • The second line starts with an integer \( m \) representing the number of grades, followed by \( m \) integers separated by spaces.

outputFormat

Output a single line to standard output (stdout) containing the name of the student with the highest average grade. In the case of a tie, output the name of the student who appears first in the input.## sample

1
Alice
3 90 100 80
Alice

</p>