func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 5005;   int n, k, x, arr[N];   long long tree[2][17000];   void build(int pos, int l, int r, int dim) {     if (l == r) {       if (l <= k)         tree[dim][pos] = arr[l];       else         tree[dim][pos] = -1e18;       return;     }     int mid = (l + r) >> 1;     build(pos << 1, l, mid, dim);     build(pos << 1 | 1, mid + 1, r, dim);     tree[dim][pos] = max(tree[dim][pos << 1], tree[dim][pos << 1 | 1]);   }   void update(int pos, int l, int r, int x, long long v, int dim) {     if (l == r) {       tree[dim][pos] = v;       return;     }     int mid = (l + r) >> 1;     if (mid >= x)       update(pos << 1, l, mid, x, v, dim);     else       update(pos << 1 | 1, mid + 1, r, x, v, dim);     tree[dim][pos] = max(tree[dim][pos << 1], tree[dim][pos << 1 | 1]);   }   long long get(int pos, int l, int r, int qLow, int qHigh, int dim) {     if (l >= qLow && r <= qHigh) return tree[dim][pos];     int mid = (l + r) >> 1;     long long a = -1, b = -1;     if (mid >= qLow) a = get(pos << 1, l, mid, qLow, qHigh, dim);     if (mid + 1 <= qHigh) b = get(pos << 1 | 1, mid + 1, r, qLow, qHigh, dim);     return max(a, b);   }   int main() {     scanf( %d%d%d , &n, &k, &x);     for (int i = 1; i <= n; i++) scanf( %d , &arr[i]);     for (int i = 1; i <= k; i++) tree[0][i] = arr[i];     for (int i = k + 1; i <= n; i++) tree[0][i] = -1e18;     int p = 1;     for (int z = 2; z <= x; z++) {       deque<int> q;       for (int i = max(0, z - k); i < z; i++) {         while (!q.empty() && tree[!p][i] >= tree[!p][q.back()]) q.pop_back();         q.push_back(i);       }       for (int i = z; i <= n; i++) {         while (!q.empty() && q.front() < i - k) q.pop_front();         long long zorbe7 = tree[!p][q.front()];         while (!q.empty() && tree[!p][i] >= tree[!p][q.back()]) q.pop_back();         q.push_back(i);         long long ans = arr[i] + (zorbe7 < 0 ? -1e18 : zorbe7);         tree[p][i] = ans;       }       p = !p;     }     long long zorbe7 = -1e18;     for (int i = n - k + 1; i <= n; i++) zorbe7 = max(zorbe7, tree[!p][i]);     printf( %lld , zorbe7 > 0 ? zorbe7 : -1);     return 0;   }   