#include #include #include using namespace std; int main() { int i; ifstream in("pooh.in"); in >> i; map h; while (in >> i) { h[i]+=i; } in.close(); map::iterator t; int a = 0; int r=0; for( t = h.begin(); t != h.end(); t++ ) { if(t->second>a){ r=t->first; a=t->second; } if(t->second==a && t->first) r=t->first; } ofstream out("pooh.out"); out<< r; out.close(); return 0; }