#include <bits/stdc++.h> #include <map> using namespace std; int main(){ map<int, int> cur; int n; cin >> n; while (n--) { int l,r; cin >> l >> r; cur[l] += r; } for (auto it : cur) cout << it.first << ' ' << it.second << endl; return 0; } ...