func_code_string: #include <bits/stdc++.h>   using namespace std;   int dx[] = {0, 0, +1, -1};   int dy[] = {+1, -1, 0, 0};   inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }   int biton(int N, int pos) { return N = N | (1 << pos); }   int bitoff(int N, int pos) { return N = N & ~(1 << pos); }   bool check(int N, int pos) { return (bool)(N & (1 << pos)); }   int n, ar[1234567], k;   pair<int, int> p[323456];   int main() {     scanf( %d%d , &n, &k);     for (int i = 0; i < n; i++) {       scanf( %d , &p[i].first);       p[i].second = i + 1;       ar[i + 1] = p[i].first;     }     sort(p, p + n, greater<pair<int, int>>());     int start = k + 1;     long long int ans = 0;     map<int, int> block, ok;     for (int i = 0; i < n; i++) {       while (block[start] != 0) start++;       if (start < p[i].second) {         ok[p[i].second] = p[i].second;         block[p[i].second] = p[i].second;       } else {         ok[p[i].second] = start;         block[start] = start;         start++;       }     }     long long int sum = 0;     for (int i = 1; i <= n; i++) {       sum += 1LL * (ok[i] - i) * ar[i];     }     printf( %lli n , sum);     for (int i = 1; i <= n; i++) printf( %i  , ok[i]);   }   