func_code_string: #include <bits/stdc++.h>   using namespace std;   const long double eps = 1e-13;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m;     cin >> n >> m;     int k = n / m;     vector<int> v(n);     vector<vector<int>> d(m);     for (int i = 0; i < (int)(n); ++i) {       cin >> v[i];       d[v[i] % m].push_back(i);     }     long long ans = 0;     vector<pair<int, int>> free;     for (int i = 0; i < (int)(2 * m); ++i) {       int cur = i % m;       while (d[cur].size() > k) {         free.push_back(make_pair(d[cur].back(), i));         d[cur].pop_back();       }       while (d[cur].size() < k && !free.empty()) {         d[cur].push_back(free.back().first);         v[free.back().first] += i - free.back().second;         ans += i - free.back().second;         free.pop_back();       }     }     cout << ans <<   n ;     for (auto x : v) cout << x <<    ;     return 0;   }   