func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 100010;   int n, i, Ans, b[M], pos[M];   long long A, w1, w2, m, ans, s[M];   struct shit {     long long w;     int id;   } a[M];   bool cmp(shit x, shit y) { return x.w > y.w; }   int main() {     scanf( %d%I64d%I64d%I64d%I64d , &n, &A, &w1, &w2, &m);     for (i = 1; i <= n; i++) {       scanf( %d , &a[i].w);       a[i].id = i;     }     sort(a + 1, a + n + 1, cmp);     for (i = 1; i <= n; i++) s[i] = a[i].w + s[i - 1];     if (m + s[n] - A * n >= 0) {       printf( %I64d n , w1 * n + w2 * A);       for (i = 1; i <= n; i++) printf( %d  , A);       puts(  );       return 0;     }     int now = 1;     for (i = 0; i < n; i++) {       if (m - A * i + s[i] < 0) break;       while (now <= i ||              a[now].w * (n - now + 1) - s[n] + s[now - 1] > m - A * i + s[i])         now++;       pos[i] = now;       long long tmp = (m - A * i + s[i] + s[n] - s[now - 1]) / (n - now + 1);       if (w1 * i + w2 * tmp > ans) ans = w1 * i + w2 * tmp, Ans = i;     }     printf( %I64d n , ans);     long long p =         (m - A * Ans + s[Ans] + s[n] - s[pos[Ans] - 1]) / (n - pos[Ans] + 1);     for (i = 1; i <= Ans; i++) b[a[i].id] = A;     for (i = Ans + 1; i < pos[Ans]; i++) b[a[i].id] = a[i].w;     for (i = pos[Ans]; i <= n; i++) b[a[i].id] = p;     for (i = 1; i <= n; i++) printf( %d  , b[i]);     puts(  );   }   