#include #include #include #include using namespace std; using P = pair; bool cmp(P x,P y){ if(x.first>y.first)return true; else if(x.first==y.first && x.second> N; string tag; map tags; for(int i=0,n,M,S;i> n >> M >> S; for(int m=0;m> tag; tags[tag]+=S; } } vector

ranking(tags.size()); for(auto it=tags.begin();it!=tags.end();it++){ ranking[id++]=make_pair((*it).second,(*it).first); } sort(ranking.begin(),ranking.end(),cmp); for(int i=0;i<10 && i