func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 110000;   int len, k, n;   long long a[N];   long long resolve() {     int pK = k;     set<pair<long long, int>> av;     set<pair<long long, int>> changed;     long long sumP = 0;     for (int i = 0; i < len; i++) {       av.insert({a[i], i});       sumP += a[i];     }     while (true) {       if (!av.size()) break;       auto lowest = *av.begin();       if (lowest.first >= 0) break;       if (pK == 0) break;       av.erase(av.begin());       changed.insert({-lowest.first, lowest.second});       sumP -= lowest.first;       sumP += (-lowest.first);       pK--;     }     long long best = sumP;     for (int i = 1; i <= n - len; i++) {       if (av.count({a[i - 1], i - 1})) {         av.erase(av.find({a[i - 1], i - 1}));         sumP -= a[i - 1];       } else {         changed.erase(changed.find({-a[i - 1], i - 1}));         sumP -= (-a[i - 1]);         pK++;       }       int j = i + len - 1;       av.insert({a[j], j});       sumP += a[j];       while (pK > 0) {         if (av.size()) {           auto x = *av.begin();           if (x.first < 0) {             av.erase(av.begin());             changed.insert({-x.first, x.second});             sumP -= x.first;             sumP += (-x.first);             pK--;           } else             break;         } else           break;       }       while (pK == 0) {         if (!av.size() || !changed.size()) break;         auto x = *av.begin();         auto y = *changed.begin();         if (x.first > 0) break;         if (x.first * -1 > y.first) {           changed.erase(changed.begin());           av.erase(av.begin());           changed.insert({x.first * -1, x.second});           av.insert({y.first * -1, y.second});           sumP -= y.first;           sumP += (-y.first);           sumP -= x.first;           sumP += (-x.first);         } else           break;       }       best = max(best, sumP);     }     return best;   }   int main() {     scanf( %d %d , &n, &len);     for (int i = 0; i < n; i++) scanf( %lld , a + i);     scanf( %d , &k);     long long ans = resolve();     for (int i = 0; i < n; i++) a[i] *= -1;     ans = max(ans, resolve());     cout << ans << endl;     return 0;   }   