https://pintia.cn/problem-sets/994805260223102976/problems/994805277163896832
#include <iostream>
using namespace std;
int main(){
int n, score[1002] = {0}, tmp1, tmp2 = 0;
cin >> n;
for(int i = 0; i < n; i++){
int a, b, c;
scanf("%d-%d %d", &a, &b, &c);
score[a] += c;
}
for(int i = 0; i < 1001; i++){
if(score[i] > tmp2){
tmp2 = score[i];
tmp1 = i;
}
}
cout << tmp1 << " " << tmp2;
return 0;
}