func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = (int)1e9;   const long long inf = (long long)3e18;   const int base = 1000 * 1000 * 1000;   const int maxn = 20;   const long double pi = acosl(-1.0);   const long double eps = 1e-5;   void error() { exit(1); }   int n;   bool flag = true;   long long A, cf, cm, m;   vector<long long> d;   long long ans = 0, minans;   long long predmin, curmin, people;   unordered_map<long long, long long> st;   set<long long> val;   set<pair<long long, int> > powerans;   set<pair<long long, int> > power, nopower;   void solve() {     scanf( %d %I64d %I64d %I64d %I64d , &n, &A, &cf, &cm, &m);     d.resize(n);     for (int i = 0; i < n; i++) {       scanf( %I64d , &d[i]);       nopower.insert(make_pair((-1) * d[i], i));       st[d[i]]++;       val.insert(d[i]);     }     val.insert(A);     val.insert(A + 1);     while ((int)nopower.size() && (A + (*nopower.begin()).first) <= m) {       pair<long long, int> v = (*nopower.begin());       nopower.erase(nopower.begin());       st[(-1) * v.first]--;       st[A]++;       m -= (A + v.first);       power.insert(make_pair((-1) * v.first, v.second));       ans += cf;     }     predmin = (*val.begin());     val.erase(val.begin());     curmin = (*val.begin());     val.erase(*val.begin());     people = st[predmin];     ans += predmin * cm;     minans = predmin;     powerans = power;     while ((int)power.size() || flag) {       if (predmin == A || (int)power.size() == n) {         ans = A * cm + n * cf;         break;       }       if ((int)power.size() && (m <= 0 || !flag)) {         pair<long long, int> v = (*power.begin());         power.erase(power.begin());         if (predmin >= v.first)           m += (A - predmin);         else           m += (A - v.first);         if (v.first <= predmin)           people++;         else           st[v.first]++;       }       flag = false;       long long del = m / people;       if (m > 0 && del > 0) {         flag = true;         if (curmin <= predmin + del) {           m -= (curmin - predmin) * people;           people += st[curmin];           predmin = curmin;           curmin = (*val.begin());           val.erase(*val.begin());         } else {           predmin += del;           m -= del * people;         }         long long curans = predmin * cm + (int)power.size() * cf;         if (predmin == A) curans += (people - (int)power.size()) * cf;         if (ans < curans) {           ans = curans;           minans = predmin;           while ((int)powerans.size() != (int)power.size()) {             powerans.erase(*powerans.begin());           }         }       }     }     printf( %I64d n , ans);     while ((int)powerans.size()) {       pair<long long, int> v = (*powerans.begin());       powerans.erase(powerans.begin());       d[v.second] = A;     }     for (int i = 0; i < n; i++)       if (d[i] < minans) d[i] = minans;     for (int i = 0; i < n; i++) printf( %I64d  , d[i]);   }   int main() {     solve();     return 0;   }   