# 题目

After each PAT, the PAT Center will announce the ranking of institutions based on their students’ performances. Now you are asked to generate the ranklist.

### Input Specification:

Each input file contains one test case. For each case, the first line gives a positive integer $N (≤10^5)$, which is the number of testees. Then N lines follow, each gives the information of a testee in the following format:

where ID is a string of 6 characters with the first one representing the test level: B stands for the basic level, A the advanced level and T the top level; Score is an integer in [0, 100]; and School is the institution code which is a string of no more than 6 English letters (case insensitive). Note: it is guaranteed that ID is unique for each testee.

### Output Specification:

For each case, first print in a line the total number of institutions. Then output the ranklist of institutions in nondecreasing order of their ranks in the following format:

where Rank is the rank (start from 1) of the institution; School is the institution code (all in lower case); ; TWS is the total weighted score which is defined to be the integer part of ScoreB/1.5 + ScoreA + ScoreT*1.5, where ScoreX is the total score of the testees belong to this institution on level X; and Ns is the total number of testees who belong to this institution.

The institutions are ranked according to their TWS. If there is a tie, the institutions are supposed to have the same rank, and they shall be printed in ascending order of Ns. If there is still a tie, they shall be printed in alphabetical order of their codes.

# 题解

• 就是排序一把梭
• 用哈希表来存储学校
• 然后就没有然后了

## 数据结构

• Python里，schools 是一个哈希表，将键映射到一个列表
• 列表第一项是B的总成绩
• 第二项是A
• 第三项是T
• 第四项是TWS 总加权成绩
• 第五项是这个学校的总人数
• C++里将schools哈希表，映射到了一个结构体上。

• 读入数据
• 计算加权总成绩
• 排序
• 输出

## 代码

• 这道题使用Python最后两个点有时候会超时，概率还比较大。因此也放了C++的题解。