The map of the form `map<long long, vector<long long>>` is given. One has to take all keys and values modulo some integer `N`. Some keys can merge and corresponding values must join accordingly. For example, the map `{{1,{2,6,4}}, {5,{8,4,9}}, {10,{5,1,7}}}` should be equal to `{{1,{2,1,4}}, {0,{0,1,2,3,4}}}` after reduction modulo 5.

My way is in using a new map but I think there should be a better way.

code added

```
vector<long long> tmp;
//integer N, for example N = 5
int N = 5;
unordered_map<long long, vector<long long>> map;
//temporary map
unordered_map<long long, vector<long long>> map_tmp;
     for (auto & x : map)
        {
            tmp.clear();
            for (auto & y : x.second) tmp.push_back(y % N);
            ind = x.first % N;
            map_tmp[ind].insert(map_tmp[ind].end(), tmp.begin(), tmp.end());
            sort(map_tmp[ind].begin(), map_tmp[ind].end());
            map_tmp[ind].erase(unique(map_tmp[ind].begin(), map_tmp[ind].end()), map_tmp[ind].end());
        }
        map = map_tmp;

```