func_code_string: #include <bits/stdc++.h>   using namespace std;   long long a[100005];   deque<long long> q;   long long mi[100005];   void add_q(long long ae) {     while (!q.empty() && q.back() > ae) q.pop_back();     q.push_back(ae);   }   void pop_q(long long re) {     if (!q.empty() && q.front() == re) q.pop_front();   }   void solve() {     long long n, c, sum = 0;     cin >> n >> c;     for (int i = 0; i < n; i++) {       cin >> a[i];       sum += a[i];     }     for (int i = 0; i < c; i++) {       add_q(a[i]);     }     mi[0] = q.front();     for (int i = c; i < n; i++) {       pop_q(a[i - c]);       add_q(a[i]);       mi[i - c + 1] = q.front();     }     long long maxc = 0;     long long res = 0;     for (int i = 0; i < c; i++) res = max(res, mi[i]);     for (int i = c; i < n; i++) {       maxc = max(maxc, mi[i - c]);       mi[i] += maxc;       res = max(res, mi[i]);     }     cout << sum - res;   }   int main() {     solve();     return 0;   }   