func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   ll dp[2][5005];   int main() {     cin.tie(0);     cin.sync_with_stdio(0);     int n, k, x;     cin >> n >> k >> x;     if (n / k > x) return cout << -1, 0;     vector<int> a(n);     for (auto &x : a) cin >> x;     x = min(x, n);     for (int i = 0; i < k; ++i) dp[1][i] = a[i];     for (int z = 2; z <= x; ++z) {       deque<ll> d;       int c = (z & 1);       int p = 1 - c;       int m = min(n, z * k);       memset(dp[c], 0, sizeof dp[c]);       for (int i = 0; i < m; ++i) {         while (d.size() && i - d.front() > k) d.pop_front();         if (i >= z - 1) dp[c][i] = a[i] + dp[p][d.front()];         while (d.size() && dp[p][d.back()] <= dp[p][i]) d.pop_back();         d.emplace_back(i);       }     }     ll ans = 0;     for (int i = n - 1; i >= 0; --i) {       if (n - i <= k) {         ans = max(ans, dp[x & 1][i]);       } else {         break;       }     }     cout << ans;   }   