#C8562. Top Teams Ranking

    ID: 52558 Type: Default 1000ms 256MiB

Top Teams Ranking

Top Teams Ranking

You are given an integer \(t\) representing the number of teams and an integer \(k\) representing the number of top teams to display. For each team, a line of input is provided containing the team name followed by their scores. The task is to determine the top \(k\) teams based on their average score. The average score of a team is computed as \(\frac{\sum_{i=1}^{n} score_i}{n}\), where \(n\) is the number of scores for that team. The average must be rounded to two decimal places.

The teams should be sorted primarily in descending order of their average scores. In case of ties (teams having the same average score), they should be sorted in lexicographical order of their names (i.e., alphabetical order).

Example:

Input:
5 3
TeamA 85 92 88
TeamB 90 95 90
TeamC 75 85 85
TeamD 90 93 89
TeamE 90 85 85

Output: TeamB 91.67 TeamD 90.67 TeamA 88.33

</p>

inputFormat

The first line contains two integers \(t\) and \(k\) separated by a space, where \(t\) is the number of teams and \(k\) is the number of top teams to output.

The following \(t\) lines each contain a team name followed by one or more integer scores, separated by spaces.

It is guaranteed that each team has at least one score, and the total number of scores per team is the same for all teams.

outputFormat

Output exactly \(k\) lines (or \(t\) lines if \(k > t\)), each containing the team name and its average score rounded to two decimal places, separated by a space. The teams must be printed according to the sorted order as described in the problem.

## sample
5 3
TeamA 85 92 88
TeamB 90 95 90
TeamC 75 85 85
TeamD 90 93 89
TeamE 90 85 85
TeamB 91.67

TeamD 90.67 TeamA 88.33

</p>