#include #include #include #include using namespace std; int main(int argc, char* argv[]) { if (argc != 2) { cerr << "Usage: " << argv[0] << " FILE" << endl; return 1; } ifstream ifs(argv[1]); if ( ! ifs ) { cerr << "Error: '" << argv[0] << "' could not be opened." << endl; return 1; } map m; int id, count; while ( ifs >> id >> count ) { m[id] += count; } cout << "PID AMOUNT" << endl; for ( pair p : m ) { cout << setw(7) << left << p.first << setw(6) << right << p.second << endl; } return 0; }