#K41317. Determine the Best Employee Based on Average Weekly Scores

    ID: 26839 Type: Default 1000ms 256MiB

Determine the Best Employee Based on Average Weekly Scores

Determine the Best Employee Based on Average Weekly Scores

You are given the monthly performance data of n employees over m weeks. Each employee's performance is represented by a list of m scores.

Your task is to determine the employee who performed best on average throughout the period. The average score for the i-th employee is computed as:

\(\frac{\sum_{j=1}^{m} s_{ij}}{m}\)

If there are no employees (i.e. n = 0) or no weeks (m = 0), output -1. In case more than one employee has the same highest average score, choose the one with the smallest index. Note that employee indices are 1-indexed.

inputFormat

The input is given from stdin and consists of:

  1. The first line contains two integers n and m separated by a space, representing the number of employees and the number of weeks, respectively.
  2. If n > 0 and m > 0, the next n lines each contain m integers separated by spaces indicating the scores of an employee in each week.

outputFormat

Output a single integer to stdout – the 1-indexed position of the employee with the highest average score. If the input is invalid (i.e., n = 0 or m = 0), output -1.

## sample
3 4
10 20 15 10
20 10 20 10
10 10 10 10
2