func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   T abs(T x) {     return x > 0 ? x : -x;   }   template <typename T>   T sqr(T x) {     return x * x;   }   template <typename T>   ostream &operator<<(ostream &s, const vector<T> &x) {     s <<  [ ;     for (auto it : x) {       s <<  it          <<  ,  ;     }     s <<  ] ;     return s;   }   template <typename T>   ostream &operator<<(ostream &s, const set<T> &x) {     s <<  { ;     for (auto it : x) {       s <<  it          <<  ,  ;     }     s <<  } ;     return s;   }   vector<pair<long long, long long> > a[5];   int main() {     int n, k, b, c;     cin >> n >> k >> b >> c;     if (b > c * 5) b = c * 5;     for (int i = 1; i <= n; i++) {       int x;       cin >> x;       for (int i = 0; i < 5; i++)         a[((x + i) % 5 + 5) % 5].push_back(make_pair(x + i, i * c));     }     long long ans = 1e18;     for (int i = 0; i < 5; i++) {       sort(a[i].begin(), a[i].end());       auto v = a[i];       bool flag = false;       long long firstpos = -1;       multiset<long long> setic;       long long allsum = 0;       for (auto f : v) {         long long pos = f.first, w = f.second;         if (!flag) {           flag = true;           firstpos = pos;         }         w -= (pos - firstpos) / 5 * b;         allsum += w;         setic.insert(w);         if ((int)setic.size() > k) {           auto it = setic.end();           it--;           allsum -= *it;           setic.erase(it);         }         if ((int)setic.size() == k) {           ans = min(ans, allsum + (long long)k * (pos - firstpos) / 5 * b);         }       }     }     cout << ans <<   n ;     return 0;   }   