void into_vector(const unordered_map<T, U>& um, Lambda& func, vector<W>& v) { transform( um.cbegin(), um.cend(), back_inserter(v), func); }
void keys_into_queue(const unordered_map<T, U>& um, queue<T>& q) { transform( um.cbegin(), um.cend(), datie::queuie::make_queue_inserter(q), [](const typename unordered_map<T, U>::value_type &pair ){ return pair.first;}); }
void keys_into_set(const unordered_map<T, U>& um, unordered_set<T>& us) { transform( um.cbegin(), um.cend(), inserter(us, us.end()), [](const typename unordered_map<T, U>::value_type &pair){ return pair.first;}); }
void getDeployments(vector<string>& _return) { ostringstream log; log << "getting deployments" << endl; cout << log.str(); vector<string> deployments; for (auto iter = activeDeployments.cbegin(); iter != activeDeployments.cend(); ++iter) { deployments.push_back(iter->first); } _return = deployments; cout << "returning " << deployments.size() << " deploymentIds" << endl; }
int main() { int n; in >> n; for(int i = 0; i < n; ++i) { int m; in >> m; for(int j = 0; j < m; ++j) { int tp,val; in >> tp >> val; if(list.count(tp)) list[tp]+=val; else list[tp]=val; } } out << list.size() << '\n'; for(auto it = list.cbegin(); it!=list.cend();++it){ out << it->first << ' ' << it->second << ' '; } out << '\n'; return 0; }