func_code_string: #include <bits/stdc++.h>   using namespace std;   int a[1000005];   long long dp[1000005];   multiset<int> se;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int i, c, j, k, l, m, n, t, r, cnt;     int flag = 0;     long long ans = 0, an = 0;     t = 1;     while (t--) {       scanf( %d , &n);       scanf( %d , &c);       for (i = 1; i <= n; i++) {         scanf( %d , &a[i]);       }       se.insert(0);       for (i = 1; i < c; i++) {         se.insert(a[i]);         dp[i] = dp[i - 1] + a[i];       }       an = dp[c - 1];       for (i = c; i <= n; i++) {         se.insert(a[i]);         se.erase(se.find(a[i - c]));         an += (a[i] - a[i - c]);         dp[i] = min(dp[i - 1] + a[i], dp[i - c] + an - *se.begin());       }       cout << dp[n] << endl;     }   }   