#include #include #include using namespace std; vector parse() { vector elves; string line; unsigned elf = 0; while (getline(cin, line)) { if (line.empty()) { elves.push_back(elf); elf = 0; continue; } elf += stoul(line); } sort(elves.begin(), elves.end(), greater()); return elves; } unsigned p1(vector &input) { return input[0]; } unsigned p2(vector &input) { return input[0] + input[1] + input[2]; } int main() { auto input = parse(); cout << p1(input) << endl; cout << p2(input) << endl; }