func_code_string: #include <bits/stdc++.h>   using namespace std;   inline void in(int &n) {     n = 0;     int ch = getchar();     int sign = 1;     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) sign = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       n = (n << 3) + (n << 1) + ch -  0 , ch = getchar();     }     n = n * sign;   }   pair<int, int> a[100005];   long long int Fsum[100005], Rsum[100005];   long long int solve(long long int val, int low, int up) {     int n = up;     while (low < up) {       int mid = low + (up - low) / 2;       if (a[mid].first >= val) {         low = mid + 1;       } else {         up = mid;       }     }     long long int ans = val * (n - low + 1) - Rsum[low];     return ans;   }   int res[100005];   int main() {     int n;     long long int A;     int Cf, Cm;     in(n);     cin >> A;     in(Cf);     in(Cm);     long long int m;     cin >> m;     for (int i = 1; i <= n; i++) {       in(a[i].first);       a[i].second = i;     }     sort(a + 1, a + 1 + n);     reverse(a + 1, a + 1 + n);     Fsum[0] = 0;     for (int i = 1; i <= n; i++) {       Fsum[i] = Fsum[i - 1] + a[i].first;     }     Rsum[n + 1] = 0;     for (int i = n; i >= 1; i--) {       Rsum[i] = Rsum[i + 1] + a[i].first;     }     long long int ans = 0;     int X, Y;     if (A * n - Fsum[n] <= m) {       ans = n * Cf + A * Cm;       X = n;       Y = A;     }     for (int i = 1; i <= n; i++) {       int low = a[n].first;       int up = A;       while (low < up) {         int mid = low + (up - low + 1) / 2;         long long int total = A * (i - 1) - Fsum[i - 1] + solve(mid, i, n);         if (total <= m) {           low = mid;         } else {           up = mid - 1;         }       }       long long int total = A * (i - 1) - Fsum[i - 1] + solve(low, i, n);       if (total <= m) {         long long int p = low;         p *= Cm;         long long int curr = (i - 1) * Cf + p;         if (curr >= ans) {           ans = curr;           X = i - 1;           Y = low;         }       }     }     for (int i = 1; i <= n; i++) {       if (i <= X) {         res[a[i].second] = A;       } else {         res[a[i].second] = max(a[i].first, Y);       }     }     printf( %I64d n , ans);     for (int i = 1; i <= n; i++) {       printf( %d  , res[i]);     }     printf(  n );   }   