func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 5005;   template <class I>   inline void ckMax(I& p, I q) {     p = (p > q ? p : q);   }   template <class I>   inline void ckMin(I& p, I q) {     p = (p < q ? p : q);   }   template <class I>   inline I Max(I& p, I q) {     return p > q ? p : q;   }   template <class I>   inline I Min(I& p, I q) {     return p < q ? p : q;   }   template <class I>   inline void sp(I& p, I& q) {     I x = p;     p = q, q = x;   }   int n, m, k, a[N];   long long f[N][N], ans;   deque<int> q[N];   int main() {     scanf( %d%d%d , &n, &k, &m);     register int i, j;     for (i = 1; i <= n; ++i) scanf( %d , &a[i]);     q[0].push_back(0);     for (i = 1; i <= n; ++i)       for (j = m; j; --j) {         while ((!q[j - 1].empty()) && q[j - 1].front() < i - k)           q[j - 1].pop_front();         if (q[j - 1].empty()) continue;         f[i][j] = f[q[j - 1].front()][j - 1] + a[i];         while ((!q[j].empty()) && f[q[j].back()][j] <= f[i][j]) q[j].pop_back();         q[j].push_back(i);       }     for (i = n - k + 1; i <= n; ++i) ckMax(ans, f[i][m]);     printf( %lld , ans > 0 ? ans : -1ll);     return 0;   }   