#C13361. Student Record Manager

    ID: 42891 Type: Default 1000ms 256MiB

Student Record Manager

Student Record Manager

You are given a student record system where each student has a name, a set of grades in various subjects, and an attendance_rate (an integer percentage). You need to implement three operations:

  • CALCULATE: Compute the student's adjusted score as follows:
    $$score = \text{average_grade} \times \frac{\text{attendance_rate}}{100}$$ where $$\text{average_grade} = \frac{\sum_{i=1}^{n} grade_i}{n}$$ (with \(n\) being the number of subjects).
  • TOP: Given a list of student records, determine the student with the highest adjusted score and output their name.
  • ADD: Given an existing list of students and a new student record, add the new record to the list and output the new total number of students along with the new student's name.

Your program should read input from stdin and print results to stdout based on the operation specified.

inputFormat

The input starts with a command which is one of CALCULATE, TOP, or ADD.

If the command is CALCULATE:

CALCULATE
<student_name>
<attendance_rate>
<number_of_subjects>
<subject1> <grade1>
... (repeat for each subject)

If the command is TOP:

TOP
<number_of_students>
For each student:
  <student_name>
  <attendance_rate>
  <number_of_subjects>
  <subject1> <grade1>
  ... (repeat for each subject)

If the command is ADD:

ADD
<number_of_existing_students>
For each existing student:
  <student_name>
  <attendance_rate>
  <number_of_subjects>
  <subject1> <grade1>
  ... (repeat for each subject)
Then the new student record:
  <student_name>
  <attendance_rate>
  <number_of_subjects>
  <subject1> <grade1>
  ... (repeat for each subject)

outputFormat

For CALCULATE: Print the student's adjusted score as a floating-point number with one decimal place.

For TOP: Print the name of the student with the highest score.

For ADD: Print a single line containing the new total number of students followed by a space and the new student's name.

## sample
CALCULATE
Test
100
3
Math 100
English 90
Science 80
90.0

</p>