using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ var score = new Dictionary(); var lastAC = new Dictionary(); var Inf = (int) 1e9; int[] AC = new int[N]; for(int i=0;i P = new List(); foreach(var s in score.Keys){ P.Add(new Pair(s,score[s].Sum(),lastAC[s])); } P.Sort((p,q) => { if( p.Score.CompareTo(q.Score) != 0) return - p.Score.CompareTo(q.Score); return p.LastAC.CompareTo(q.LastAC); }); for(int i=0;iint.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }