Language: C++

#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;

const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<ll> A;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> N;
    A = fetch_vec<ll>(N);
}

int solve(){
    map<int,ll> dp[20010][2];
    dp[0][0][0] = 0;
    dp[0][1][1] = A[0];
    dp[0][0][1] = -LL_INF;
    dp[0][1][0] = -LL_INF;
    for (int j = 2; j <= N/2; j++)
    {
        dp[0][0][j] = -LL_INF;
        dp[0][1][j] = -LL_INF;
    }
    
    for (int i = 1; i < N; i++)
    {
        for (int j = i/2-1; j <= min((i+1)/2,N/2) ; j++)
        {
            if(j>=0) {
                if(dp[i-1][0][j]==0 && dp[i-1][1][j]==0) dp[i][0][j]=-LL_INF;
                else dp[i][0][j] = max(dp[i-1][0][j],dp[i-1][1][j]);
                }
            if(j>0) {
                if(dp[i-1][0][j-1]==-LL_INF) dp[i][1][j]=-LL_INF;
                else dp[i][1][j] = dp[i-1][0][j-1]+A[i];
        }
        dp[i-1][0].clear();
        dp[i-1][1].clear();
    }
    ll ans;
    ans = max(dp[N-1][0][N/2],dp[N-1][1][N/2]);
    cout << ans << endl;
    
    return 0;
}   

int maketestcase(int n=200000){
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        // freopen(__input.c_str(), "r", stdin);
        freopen(__input.c_str(), "w", stdout);
    #endif

    cout << n << endl;
    ll mod=1e9+7;
    for (ll i = 0; i < n; i++)
    {
        cout << -((i+1)%100)%mod << " ";
    }
    cout << endl;    
    return 0;
}

int main()
{
    input();
    solve();
    // maketestcase(10000);
    return 0;
}


Compiler output:
a.cc: In function 'int solve()':
a.cc:77:31: error: a function-definition is not allowed here before '{' token
   77 | int maketestcase(int n=200000){
      |                               ^
a.cc:98:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   98 | int main()
      |         ^~
a.cc:98:9: note: remove parentheses to default-initialize a variable
   98 | int main()
      |         ^~
      |         --
a.cc:98:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:99:1: error: a function-definition is not allowed here before '{' token
   99 | {
      | ^
a.cc:104:2: error: expected '}' at end of input
  104 | }
      |  ^
a.cc:43:12: note: to match this '{'
   43 | int solve(){
      |            ^
a.cc:104:2: warning: control reaches end of non-void function [-Wreturn-type]
  104 | }
      |  ^