criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include "iostream"
using namespace std;int N=2e5+5;int64_t a[N],d[N],s[N],n,i;main(){cin>>n;for(;i<n;++i)cin>>a[i],s[i]=(i>1?s[i-2]:0)+a[i];for(i=1;i<n;++i)d[i]=max((i&1?s:d)[i-1],d[i-2]+a[i]);cout<<d[n-1];}


Compiler output:
a.cc:2:43: error: size of array 'a' is not an integral constant-expression
    2 | using namespace std;int N=2e5+5;int64_t a[N],d[N],s[N],n,i;main(){cin>>n;for(;i<n;++i)cin>>a[i],s[i]=(i>1?s[i-2]:0)+a[i];for(i=1;i<n;++i)d[i]=max((i&1?s:d)[i-1],d[i-2]+a[i]);cout<<d[n-1];}
      |                                           ^
a.cc:2:48: error: size of array 'd' is not an integral constant-expression
    2 | using namespace std;int N=2e5+5;int64_t a[N],d[N],s[N],n,i;main(){cin>>n;for(;i<n;++i)cin>>a[i],s[i]=(i>1?s[i-2]:0)+a[i];for(i=1;i<n;++i)d[i]=max((i&1?s:d)[i-1],d[i-2]+a[i]);cout<<d[n-1];}
      |                                                ^
a.cc:2:53: error: size of array 's' is not an integral constant-expression
    2 | using namespace std;int N=2e5+5;int64_t a[N],d[N],s[N],n,i;main(){cin>>n;for(;i<n;++i)cin>>a[i],s[i]=(i>1?s[i-2]:0)+a[i];for(i=1;i<n;++i)d[i]=max((i&1?s:d)[i-1],d[i-2]+a[i]);cout<<d[n-1];}
      |                                                     ^
a.cc:2:60: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | using namespace std;int N=2e5+5;int64_t a[N],d[N],s[N],n,i;main(){cin>>n;for(;i<n;++i)cin>>a[i],s[i]=(i>1?s[i-2]:0)+a[i];for(i=1;i<n;++i)d[i]=max((i&1?s:d)[i-1],d[i-2]+a[i]);cout<<d[n-1];}
      |                                                            ^~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1000000001;

int main(){
  int n;
  ll ans = 0;
  priority_queue<pair<int, int>> a;
  cin >> n;
  rep(i, n){
    int tmp;
    cin >> tmp;
    a.push(make_pair(tmp, i));
  }
  unordered_set<int> choosed;
  rep(i, n/2){
    pair<int, int> k = a.top();
    a.pop();
    
    if(!choosed.count(k.second+1) && !choosed.count(k.second-1)){
      ans += k.first;
      choosed.insert(k.second);
    }else{
      i--;
    }
  }
  cout << ans <<endl;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

ll dp[200200][2]; // dp[i][j]:i番目のグループで(j==0:左、j==1:右)を取った時の最大値
ll dp2[200200][2][2]; // dp2[i][j][k]:i番目のグループで(j==0:左、j==1:右)を取った時の最大値
                      // kは既に1グループ飛ばしたかどうか

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<=n;i++){
        // 初期化
        dp[i][0]=dp[i][1]=-1e18;
        dp2[i][0][0]=dp2[i][0][1]=dp2[i][1][0]=dp2[i][1][1]=-1e18;
    }
    int m=n/2;
    if(n%2==0){
        dp[1][0]=a[0],dp[1][1]=a[1];
        for(int i=1;i<m;i++){
            for(int j=0;j<2;j++){
                if(j==0){
                    dp[i+1][0]=max(dp[i+1][0],dp[i][j]+a[2*i]);
                }
                dp[i+1][1]=max(dp[i+1][1],dp[i][j]+a[2*i+1]);
            }
        }
        cout << max(dp[m][0],dp[m][1]) << endl;
    }
    else{
        // a[n-1]を使わない場合　上の偶数の場合と一緒
        dp[1][0]=a[0],dp[1][1]=a[1];
        for(int i=1;i<m;i++){
            for(int j=0;j<2;j++){
                if(j==0){
                    dp[i+1][0]=max(dp[i+1][0],dp[i][j]+a[2*i]);
                }
                dp[i+1][1]=max(dp[i+1][1],dp[i][j]+a[2*i+1]);
            }
        }
        // a[n-1]を使う場合
        dp2[1][0][0]=a[n-1]+a[0],dp2[1][1][0]=a[n-1]+a[1];
        dp2[1][0][1]=a[n-1];
        for(int i=1;i<m;i++){
            for(int j=0;j<2;j++){
                for(int k=0;k<2;k++){
                    if(k==0){
                        dp2[i+1][0][1]=max(dp2[i+1][0][1],dp2[i][j][k]);
                    }
                    if(j==0){
                        dp2[i+1][0][k]=max(dp2[i+1][0][k],dp2[i][j][k]+a[i*2]);
                    }
                    // a[n-2]は使えない事に注意！
                    if(i!=m-1)dp2[i+1][1][k]=max(dp2[i+1][1][k],dp2[i][j][k]+a[i*2+1]);
                }
            }
        }
        cout << max({dp[m][0],dp[m][1],dp2[m][0][1],dp2[m][1][1]}) << endl;
    }
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int N;
    cin >>N;
    int vec[N+1];
  	vec[0]=0;
    REP(i,N){
        cin>>vec[i+1];
    }
    int a=N/2;
    vector<vector<int>>dp(N+1,vector<int>(a+1,0));
    dp[1][1]=vec[1];
    dp[2][1]=max(vec[1],vec[2]);
    for(int i=3;i<=N;i++){
        if(i%2==1){
            if(i==3) dp[3][1]=max(vec[1],max(vec[2],vec[3]));
          	if(i!=3) dp[i][i/2-1]=max(dp[i-2][i/2-2]+vec[i],dp[i-1][i/2-1]);
            dp[i][i/2]=max(dp[i-2][i/2-1]+vec[i],dp[i-1][i/2]);
            dp[i][i/2+1]=max(dp[i-2][i/2]+vec[i],dp[i-1][i/2+1]);
        }
        if(i%2==0){
            dp[i][i/2-1]=max(dp[i-2][i/2-2]+vec[i],dp[i-1][i/2-1]);
            dp[i][i/2]=max(dp[i-2][i/2-1]+vec[i],dp[i-1][i/2]);
        }
    }
    cout<<dp[N][a]<<endl;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

long long guusuuDP(long long N,long long num[])
{
	long long ma[N][2];
	ma[1][0] = num[0];
	ma[1][1] = num[1];
	int i;
	for(i=1;i<=(N/2-1);i++)
	{
		ma[2*i+1][0] = ma[2*i-1][0] + num[2*i];
		ma[2*i+1][1] = max((ma[2*i-1][0]),(ma[2*i-1][1]))
		+ num[2*i+1];
	}
	return max(ma[N-1][0],ma[N-1][1]);
}
long long kisuuDP(long long N,long long num[])
{
	long long ma[N][2];
	ma[2][0] = max(num[0],num[1]);
	ma[2][1] = num[2];
	long long i;
	long long sum[(N+1)/2];
	sum[0] = num[0];
	for(i=1;i<=(N-1)/2;i++)
	{
		sum[1] = sum[0] + num[2*i];
	}
	for(i=2;i<=(N-1)/2;i++)
	{
		ma[2*i][1] = max(ma[2*i-2][0],ma[2*i-2][1])
		+ num[2*i];
		ma[2*i][0] = max(sum[i-1],ma[2*i-2][0])
		+ num[2*i-1];
	}
	return max(ma[N-1][0],ma[N-1][1]);
}
int main()
{
	long long N;
	cin >> N;
	long long num[N];
	long long i;
	for(i=0;i<N;i++)
	{
		cin >> num[i];
	}
	if(N % 2 == 0) cout << guusuuDP(N,num) << endl;
	else if(N % 2 == 1) cout << kisuuDP(N,num) << endl;
	return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

const ll INF = 1LL << 50;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N);
    for (auto& a : A) {
        cin >> a;
    }
    int rest = N - N / 2 - N / 2 + 1;
    vector<vector<ll>> dp(N, vector<ll>(rest + 1, -INF));
    rep(i, 0, rest + 1) {
        dp[i][rest - i] = A[i];
    }
    rep(i, 0, N) rep(j, 0, rest + 1) {
        rep(k, 0, j + 1) {
            if (i + k + 2 >= N) {
                break;
            }
            chmax(dp[i + k + 2][j - k], dp[i][j] + A[i + k + 2]);
        }
    }
    ll ans = 0;
    rep(i, 0, rest + 1) {
        chmax(ans, dp[N - 1][i]);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>


using namespace std;

typedef long long ll;

const ll INF = -1e17;

ll n;
ll a[200005];
ll dp[200005][3];
int main() {
  cin >> n;

  for(int i = n; i > 0; i--) {
    cin >> a[i];
  }

  for(int i = 0; i <= n; i++) {
    for(int j = 0; j < 3; j++) {
      dp[i][j] = INF;
    }
  }

  dp[0][0] = dp[0][1] = dp[0][2] = 0;
  dp[1][2] = a[1];
  dp[1][0] = 0;
  dp[1][1] = 0;
  dp[2][0] = max(a[2],a[1]);
  dp[2][1] = 0;

  for(int i = 3; i <= n; i++) {
    if(i & 1) {
      dp[i][0] = max(a[i]+dp[i-2][0],dp[i-1][0]);
      dp[i][1] = dp[i-1][1];
      dp[i][2] = a[i] + dp[i-2][2];
    }
    else {
      dp[i][0] = max(a[i]+dp[i-2][0],a[i-1]+dp[i-3][2]);
      dp[i][1] = dp[i-1][0];
    }
  }

  /*  for(int i = 0; i <= n; i++) {
    for(int j = 0; j < 3; j++) {
      cout <<" dp["<<i<<"]["<<j<<"] = "<<dp[i][j] <<  endl;
    }
    }*/
  
  if(n & 1) {
    cout << max(dp[n][0],max(dp[n-1][0],dp[n-2][2])) << endl;
  }
  else {
    cout << max(dp[n][0],dp[n-1][0]) << endl;
  }
  
}


  
  
  


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
typedef long long int ll;
 
using namespace std;
 
const ll INF = 1e17;
ll N;
ll a[300000];
ll l[300000];
ll r[300000];
map<ll, ll> dp[300000];
 
int main() {
  cin >> N;
  for (int i=0; i<N; i++)
    cin >> a[i];
  for (int i=0; i<N/2; i++) {
    l[i] = 2*i;
    r[N/2-1-i] = (N-1) - 2*i;
  }
  // for (int i=0; i<N/2; i++) {
  //   cout << l[i] << "-" << r[i] << endl;
  // }
  for (int j=l[0]; j<=r[0]; j++)
    dp[0][j] = a[j];
  for (int i=1; i<N/2; i++) for(int j=l[i]; j<=r[i]; j++) {
    dp[i][j] = -INF;
    for (int bj=l[i-1]; bj<=min(r[i-1], (ll)j-2); bj++) {
      dp[i][j] = max(dp[i][j], a[j] + dp[i-1][bj]);
    }
    // printf("dp[%d][%d]=%ld\n", i, j, dp[i][j]);
  }
  ll ans = -INF;
  for (int j=l[N/2-1]; j<=r[N/2-1]; j++) {
    ans = max(ans, dp[N/2-1][j]);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ull = unsigned long long;

#define int long long
#define FOR(a, b, c) for(int a = b, _c = c; a <= _c; ++a)
#define ROF(a, b, c) for(int a = b, _c = c; a >= _c; --a)
#define REP(a, b, c) for(int a = b, _c = c; a < _c; ++a)
#define VEC(a, b) for(auto &a : b)
#define ii pair <int, int>
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(), a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define sz(x) (int)(x.size())
#define bit(x, i) (x >> (i - 1) & 1ll)
#define onbit(x, i) (x | (1ll << (i - 1)))
#define offbit(x, i) (x & ~(1ll << (i - 1)))

template <class T> void Max(T &x, T y) { x = (x > y) ? x : y;}
template <class T> void Min(T &x, T y) { x = (x < y) ? x : y;}

#define debug(x) cerr << #x << '=' << x << '\n'
#define debugn(a, n) FOR(i, 1, n) cerr << a[i] << ' '
#define debugv(a) VEC(v, a) cerr << v << ' '

const int N = 2e5 + 5;
const int inf = 1e18;
int n, a[N];
int f[N][3][3];

main() {
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cin >> n;
  FOR(i, 1, n) cin >> a[i];
  FOR(i, 0, n) FOR(j, 0, 2) FOR(k, 0, 1) f[i][j][k] = -inf;
  f[0][0][0] = 0;
  for(int i = 1; i <= n;  i += 2) {
    int j = (i + 1) / 2;
    f[j][0][1] = max({ f[j - 1][0][0], f[j - 1][2][0], f[j - 1][1][0]});
    f[j][1][0] = max(f[j - 1][0][0], f[j - 1][1][0]) + a[i];
    f[j][2][0] = max({ f[j - 1][0][0], f[j - 1][1][0], f[j - 1][2][0]}) + a[i + 1];
    f[j][1][1] = max({ f[j - 1][0][1], f[j - 1][1][1]}) + a[i];
    f[j][2][1] = max({ f[j - 1][0][1], f[j - 1][1][1], f[j - 1][2][1]}) + a[i + 1];
  }
  int ans = max(f[n / 2][1][0], f[n / 2][2][0]);
  if(n % 2 == 1) ans = max(ans, max(f[n / 2][0][1], f[n / 2][1][1]) + a[n]);
  cout << ans;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
using namespace std;

typedef long long ll;

int main(int, char**)
{
    int n;
    cin >> n;

    // acum[i][j] : 先頭からi個のデータのうちj個選んで総和を最大にしたときの最大値
    vector< vector<ll> > acum(n+1, vector<ll>(n+1,0));

    ll tmp;
    for (int i = 1; i <= n; i++) {
        cin >> tmp;
        if (i == 1) acum[i][1] = tmp;
        else if (i == 2) acum[i][1] = max(acum[i-1][1], tmp);
        else if (i % 2 == 0) {
            // 偶数はi/2個かi/2-1個の選び方しかありえない
            acum[i][i/2] = max(acum[i-1][i/2], acum[i-2][i/2-1] + tmp);
            acum[i][i/2-1] = max(acum[i-1][i/2-1], acum[i-2][i/2-2] + tmp);
        } else {
            // 奇数はi/2+1個かi/2個の選び方しかありえない
            acum[i][i/2+1] = acum[i-2][i/2] + tmp;
            acum[i][i/2] = max(acum[i-1][i/2], acum[i-2][i/2-1] + tmp);
        }
    }

    cout << acum[n][n/2] << endl;
    return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional> //operator[]
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;


signed main(){
    int n; cin >> n;
    ll a[n];
    rep(i,n) cin >> a[i];
    if(n%2==0){
        ll l[n/2+1],r[n/2+1];
        l[0]=r[0]=0;
        for(int i=0;2*i<n;i++){
            l[i+1]=l[i]+a[2*i];
            r[i+1]=r[i]+a[n-1-(2*i)];
        }
        ll ans=l[n/2+1];
        rep(i,n/2+1){
            chmax(ans,l[i]+r[n/2-i]);
        }
        cout << ans << endl;
    }else{
        ll dp[n][3];
        dp[0][0]=0; dp[0][1]=0; dp[0][2]=a[0];
        rep(i,n-1){
            if(i%2==0){
                dp[i+1][0]=max(dp[i][0],dp[i][1]);
                dp[i+1][1]=dp[i][1]+a[i+1];
                dp[i+1][2]=dp[i][2];
            }else{
                dp[i+1][0]=dp[i][0]+a[i+1];
                dp[i+1][1]=max(dp[i][1],dp[i][2]);
                dp[i+1][2]=dp[i][2]+a[i+1];
            }
        }
        cout << dp[n-1][0] << endl;
    }
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <vector>

using namespace std;
int main(void)
{
  long long n;
  cin >> n;
  vector<long long> a = vector<long long>(n + 1, 0);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }

  vector<vector<long long>> ms = vector<vector<long long>>(n + 1, vector<long long>(n / 2 + 2));

  for (long long i = 1; i <= n; i++) {
    for (long long j = i / 2 - 1; j <= (i + 1) / 2; j++) {
      if (j > 0) {
	if (i == 1) {
	  ms[1][1] = a[0];
	} else {
	  ms[i][j] = max(ms[i - 2][j - 1] + a[i - 1], ms[i - 1][j]);
	}
      }
    }
  }
  
  cout << ms[n][n / 2] << endl;  
  return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define ll long long
int in() {int x; cin>>x; return x;}
ll lin() {ll x; cin>>x; return x;}
string sin() {string x;cin>>x;return x;}
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;

bool ifprime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=2;i*i<=x;i++){if(x%i==0)return false;}
    return true;
}
ll mod(ll x, ll y){if(x>=0||x%y==0) return x%y;return y+x%y;} //mod including minus
ll dv0(ll x, ll y){if(x>=0||x%y==0)return x/y;return x/y-1;} //rnd down
ll dv1(ll x, ll y){if(x%y==0) return dv0(x,y);return dv0(x,y)+1;} //rnd up

//Start from Here
int main(){
    int N;
    cin>>N;
    ll a[(N+1)/2][3];
    ll c[N];
    rep(i, N){
        cin>>c[i];
    }
    if(N%2==1){
        a[0][0]=0;
        a[0][1]=0;
        a[0][2]=c[0];
        rep2(i, (N-1)/2){
            a[i][1]=max(a[i-1][0],a[i-1][1])+c[2*i];
            a[i][0]=max(c[2*i-1]+a[i-1][0],a[i-1][2]);
            a[i][2]=a[i-1][2]+c[2*i];
        }
        cout<<max(a[(N-1)/2][0],a[(N-1)/2][1])<<endl;
    }else{
        a[0][0]=0;
        a[0][1]=c[0];
        rep2(i, N/2-1){
            a[i][0]=max(a[i-1][0]+c[2*i-1],a[i-1][1]);
            a[i][1]=a[i-1][1]+c[2*i];
        }
        cout<<max(a[N/2-1][0]+c[N-1],a[N/2-1][1])<<endl;
    }

}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;
const int N=2e5+5;
const int N1=-1e18-5;
int dp[N][3];
int a[N];
 
int func(int x,int y,int n,int flag=0){
	if(x>=n||y<0) return 0;
	if(dp[x][y]!=N1) return(dp[x][y]);
	if(flag==0&&x==n-1) return(N1);
	int res=N1;
	for(int i=0;i<=y;i++){
		res=max(res,a[x+i]+func(x+i+2,y-i,n,((flag==1)||(i>0)))); 
	}
	return(dp[x][y]=res);
}
 
int32_t main(){
    IOS;
    int n;
    cin>>n;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++){
    	for(int j=0;j<3;j++) dp[i][j]=N1;
    }
	int ans=func(0,n%2+1,n);
	cout<<ans<<endl;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a+=b;if(a>=M)a%=M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////

int n, a[210000], b[210000];
int dp[210000][3];
signed main(){
  cin>>n;rep(i,n)cin>>a[i];
  if(n % 2 == 0){
    int odd = a[1], even = a[0];
    repd(i,2,n){
      if(i % 2 == 0){
        even += a[i];
        b[i] += b[i-2] + a[i];
      }else{
        odd += a[i];
        b[i] += b[i-2] + a[i];
      }
    }
    int ans = max(odd, even);
    rep(i,n){
      if(i % 2 == 0)continue;
      chmax(ans, b[i-1] + b[n-1] - b[i]);
    }
    cout << ans << endl;
  }else{
    dp[0][0] = a[0];dp[1][1] = a[1];dp[2][0] = a[0]+a[2];dp[2][2] = a[2];
    repd(i,3,n){
      dp[i][0] = dp[i-2][0] + a[i];
      dp[i][1] = max(dp[i-2][1], dp[i-3][0]) + a[i];
      dp[i][2] = max(dp[i-2][2], dp[i-3][1]) + a[i];
    }
    cout << max({dp[n-1][2], dp[n-2][1]}) << endl;
  }
}


Compiler output:
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory
    2 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

#include <set>
#include <iterator>
using namespace std;
// using namespace __gnu_pbds;


#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define INF (ll)1e17
#define matrix vector<vector<ll> >

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
#define maxbits 9
#define maxmask (1ll<<maxbits)
// typedef tree<pll, null_type, less<pll>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
const int  N=1e6 +10, M=(ll)1e9+1 ;
const int mod =998244353 ,sz=5, MAX=(ll)1e6+10;
string fir="Monocarp",sec="Bicarp";

void work(){
	ll n;
	cin >> n;

	vl a(n+1);
	for(ll i=1;i<=n;i++)
		cin >> a[i];

	ll dp[n+1][2];
	memset(dp,0,sizeof(dp));

	dp[1][0]=0;
	dp[1][1]=a[1];
	dp[2][0]=a[1];
	dp[2][1]=max(a[1],a[2]);
	for(ll i=3;i<=n;i++){
		if(i&1){
			dp[i][1]=max(dp[i-2][1],dp[i-3][1])+a[i];
			dp[i][0]=dp[i-1][1];
		}
		else{
			dp[i][1]=dp[i-2][1]+a[i];
			dp[i][0]=dp[i-1][0]+a[i-1];
		}
	}

	cout << max(dp[n][0],dp[n][1]) ;
}

int main(){
 ios_base::sync_with_stdio(0);
 cin.tie(0);

	#ifndef ONLINE_JUDGE
	ll t;
	// cin >> t;
	t=1;
	while(t--){
	        work();
	
	}
return 0;
}
	

Compiler output:
a.cc:80: error: unterminated #ifndef
   80 |         #ifndef ONLINE_JUDGE
Language: C

#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
	
	int n;
	cin>>n;
	int a[n+1];
	for(int i=0;i<n;i++) cin>>a[i];
	int dp[n+1];
	dp[n-1] = a[n-1];
	for(int i=n-3;i>=0;i=i-2){
		dp[i] = dp[i+2] + a[i];
	}
	if(n>=2)dp[n-2] = a[n-2];
	for(int i=n-4;i>=0;i=i-2) dp[i] = dp[i+2] + a[i];
	if(n%2==0) cout<<max(dp[0],dp[1]);
else{
	int ans = dp[2];
	for(int i=1;i<n-2;i++){
		ans = max(ans,dp[i+2] + dp[i-1] - dp[i+1]);
	}
	cout<<ans;
}
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

ll dp[200010][2][3];

int main(){
	int n; cin >> n;
	vector<int> a(n);
	for( auto &k : a ) cin >> k;
	dp[0][1][0] = a[0];
	dp[0][0][0] = 0;
	for( int i = 1; i < n; ++i ){
		dp[i][1][0] = dp[i-1][0][0] + a[i];
		dp[i][1][1] = dp[i-1][0][1] + a[i];
		dp[i][1][2] = dp[i-1][0][2] + a[i];
		dp[i][0][0] = dp[i-1][1][0];
		dp[i][0][1] = max(dp[i-1][0][0], dp[i-1][1][1]);
		dp[i][0][2] = max(dp[i-1][0][1], dp[i-1][1][2]);
	}
	if( n%2 == 0 ) cout << max(dp[n-1][1][1], dp[n-1][0][0]) << endl;
	else cout << max(dp[n-1][0][1], dp[n-1][1][2]) << endl;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int>a(n+1);
  vector<int>dp(n+1);
  int sum = 0;
  int ans = 0;
  for(int i = 1;i<=n;i++) cin >> a[i];
  dp[0] = 0;dp[1] = a[1];
  for(int i = 2;i<=n;i++)
  {
    dp[i] = max(dp[i-2]+a[i],dp[i-1]);
  }
  cout << dp[n];
  return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>

//#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 200005;
int n, a[MX];
ll mem[MX][5];

ll dp (int i, int k) {
	if (k < 0) return -1e18;
	if (i >= n) {
		if (k == 2) return -1e18;
		return 0;
	}

	ll &res = mem[i][k];
	if (res != -1) return res;

	return res = max(
		dp(i + 1, k - 1),
		dp(i + 2, k) + a[i]
	);
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	memset(mem, -1, sizeof(mem));

	cin >> n;
	forn (i, n) cin >> a[i];
	cout << dp(0, 1 + n % 2) << endl;

	return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
using  ll = long long;

int main() {
	int N; cin >> N;
	vector<ll> A(N);
	for(int i=0;i<N;i++) {
		cin >> A[i];
	}

	vector<vector<vector<ll>>> dp(N+1, vector<vector<ll>>(2, vector<ll>(3, -1LL<<60)));

	// dp[i][j][k]: i番目, i要素目を取らないならj = 1, k: これまで連続で選ばなかった箇所の個数
	dp[0][1][0] = 0;
	for(int i=0;i<N;i++) {
		// 取らない
		for(int k=0;k<2;k++)
			dp[i+1][1][k+1] = max(dp[i+1][1][k+1], dp[i][1][k]);
		for(int k=0;k<3;k++)
			dp[i+1][1][k] = max(dp[i+1][1][k], dp[i][0][k]);

		// 取る
		for(int k=0;k<3;k++)
			dp[i+1][0][k] = max(dp[i+1][0][k], dp[i][1][k] + A[i]);
	}
	if(N % 2 == 0) cout << max(dp[N][0][1], dp[N][1][0]) << endl;
	else cout << max(dp[N][0][2], dp[N][1][1]) << endl;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,-1,sizeof(x))
const int INF = 1000000001;

int main(){
  int n;
  ll ans = 0;
  priority_queue<pair<int, int>> a;
  cin >> n;
  rep(i, n){
    int tmp;
    cin >> tmp;
    a.push(make_pair(tmp, i));
  }
  vector<int> choosed;
  rep(i, n/2){
    pair<int, int> k = a.top();
    a.pop();
    auto res = find(all(choosed), k.second+1);
    auto res_2 = find(all(choosed), k.second-1);
    if(res==choosed.end() && res_2==choosed.end()){
      ans += k.first;
      choosed.push_back(k.second);
    }else{
      i--;
    }
  }
  cout << ans <<endl;
}
      
    

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>
#include <functional>

using namespace std;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)       for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF                 (ll)2e9
#define MOD                 (1000 * 1000 * 1000 + 7)
#define Ceil(x, n)          (((((x))+((n)-1))/n))
#define CeilN(x, n)         (((((x))+((n)-1))/n)*n)
#define FloorN(x, n)        ((x)-(x)%(n))
#define IsOdd(x)            (((x)&0x01UL) == 0x01UL)
#define IsEven(x)           (!IsOdd((x)))
#define M_PI                3.14159265358979323846
typedef long long           ll;
typedef pair<ll, ll>	    P;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
/* 最大公約数 */
ll gcd(ll a, ll b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	ll N;
	cin >> N;
	vector<ll> A(N);
	REP(i, N) cin >> A[i];

	ll idx = 0;
	vector<vector<ll>> dp(N + 2, vector<ll>(3, -INF));
	dp[0][0] = 0;
	REP(i, N) {
		REP(j, 3) {
			if (dp[i][j] != -INF) {
				dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
				dp[i + 2][j + 1] = max(dp[i + 2][j + 1], dp[i][j] + A[i]);
			}
		}

		if (2 < i && IsOdd(i)) {
			REPN(j, 1, 3) {
				ll sftIdx = i + j;
				dp[sftIdx][0] = dp[sftIdx][1];
				dp[sftIdx][1] = dp[sftIdx][2];
				dp[sftIdx][2] = -INF;
			}
			idx++;
		}
	}

	ll ofs = N / 2 - idx;
	ll ans = max(dp[N][ofs], dp[N + 1][ofs]);
	cout << ans << endl;
	return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll A;
    ll i;
    ll dp[N+1][3][2];
    dp[0][0][0]=0;
    dp[0][0][1]=0;
    dp[0][1][0]=0;
    dp[0][1][1]=0;
    dp[0][2][0]=0;
    dp[0][2][1]=0;
    for(i=1;i<=N;i++){
        cin >> A;
        dp[i][0][0]=dp[i-1][0][1];
        dp[i][0][1]=dp[i-1][0][0]+A;
        dp[i][1][0]=max(dp[i-1][1][1],dp[i-1][0][0]);
        dp[i][1][1]=dp[i-1][1][0]+A;
        dp[i][2][0]=max(dp[i-1][2][1],dp[i-1][1][0]);
        dp[i][2][1]=dp[i-1][2][0]+A;
    }
    if(N%2==0){
        cout << max(dp[N-1][0][1],dp[N][1][1])<<endl;
    }else{
        cout << max(dp[N-2][0][1],max(dp[N-1][1][1],dp[N][2][1]))<<endl;
    }
    return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;

using namespace std;

ll dp[200020][3];

int main(){
    std::ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    for(int i = 0; i < n+10; i++){
        for(int j = 0; j < 3; j++){
            dp[i][j] = -INF;
        }
    }

    dp[0][1] = a[0];
    dp[0][0] = 0;
    dp[0][2] = 0;
    dp[1][1] = a[0];
    dp[1][0] = a[1];
    dp[1][2] = 0;
    for(int i = 2; i < n; i++){
        if(i%2 == 0){
            dp[i][0] = max(dp[i-1][0],dp[i-1][1]);
            dp[i][1] = dp[i-1][2]+a[i];
            dp[i][2] = dp[i-1][1]+a[i];
        } else {
            dp[i][0] = dp[i-1][0]+a[i];
            dp[i][1] = dp[i-1][2];
            dp[i][2] = max(dp[i-1][1],dp[i-1][0]);
        }
    }
    ll ans = max(dp[n-1][0],dp[n-1][1]);
    cout << ans << endl;

    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;

long long oddsum,evensum,bil,oddmin,evenmin,arr[200001];
int n;

int main(){
	cin>>n;
	oddmin = 99999999999;
	evenmin = 99999999999;
	for(int i = 1;i <= n;i ++){
		cin>>bil;
		arr[i] = bil;
		if(i % 2 == 1){
			oddsum = oddsum + bil;
			if(oddmin > bil){
				oddmin = bil;
			}
		}else{
			evensum = evensum + bil;
			if(evenmin > bil){
				evenmin = bil;
			}
		}
	}
	if(n % 2 == 0){
		cout<<max(oddsum,evensum)<<endl;
	}else{
		cout<<max((oddsum,evensum),(oddsum - oddmin,evensum - evenmin))<<endl;
	}
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>

using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> N;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }

  vector<ll> dp0(N),dp1(N),dp2(N);
  dp0[0]=0; // select (i)/2
  dp1[0]=0; // select (i+1)/2
  dp2[0]=A[0]; // select (i+2)/2

  dp0[1]=0;
  dp1[1]=max(A[0],A[1]);
  dp2[1]=max(A[0],A[1]);

  for(int i=2;i<N;i++){
    dp0[i]=dp0[i-2]+A[i];
    dp1[i]=max(dp1[i-2]+A[i],dp2[i-1]);
    dp2[i]=dp2[i-2]+A[i];
  }

  cout << dp1[N-1] << endl;
  return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;

long long memo[200005][2], a[200005];

int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    memo[2][0] = a[1], memo[2][1]= a[2];
    for (int i = 3; i <= n; i++) {
        if (i%2 == 0) {
            memo[i][0] = a[i - 1] + memo[i - 2][0];
            memo[i][1] = a[i] + max(memo[i - 1][0], max(memo[i - 2][0], memo[i - 2][1]));
        }
        else {
            memo[i][0] = max(memo[i - 1][1], memo[i - 1][0]);
            memo[i][1] = a[i] + max(max(memo[i - 2][0], memo[i - 2][1]), max(memo[i - 3][0], memo[i - 3][1]));
        }
    }
    cout << max(memo[n][0], memo[n][1]) << "\n";
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

ll Solve_g(vec x){
    ll N=x.size();
    ll M=N/2;
    vec a(M+1,0),b(M+1,0);
    rep(i,M) a.at(i+1)=a.at(i)+x.at(i*2);
    rep(i,M) b.at(i+1)=b.at(i)+x.at(N-1-(i*2));
    ll ret=a.at(M);
    rep(i,M) ret=max(ret,a.at(i)+b.at(M-i));
    return ret;
}

ll Solve_k(vec x){
    ll N=x.size();
    ll M=N/2;
    ll MIN=INF;
    vec a(N+2,0), b(N+2,0);
    for(int i=0;i<N;i+=2) {
        a.at(i+2)=a.at(i)+x.at(i);
        MIN=min(x.at(i),MIN);
    }
    for(int i=1;i<N;i+=2) {
        b.at(i+2)=b.at(i)+x.at(i);
    }
    ll SUM=a.at(N+1);
    ll ret=SUM-MIN;
    /*rep(i,N+2) cout<<a.at(i)<<' ';
    cout<<endl;
    rep(i,N+2) cout<<b.at(i)<<' ';
    cout<<endl;
    cout<<ret<<endl;*/
   for(int i=1;i<N;i+=2) for(int j=i;j<N;j+=2){
       ll UP=b.at(j+2)-b.at(i);
       ll DOWN=a.at(j+3)-a.at(i-1);
       ret=max(SUM+UP-DOWN,ret);
   }
   return ret;



}

int main(){
    ll N; cin>>N;
    vec x(N);
    rep(i,N) cin>>x.at(i);
    if(N%2==1) cout<<Solve_k(x)<<endl;
    else cout<<Solve_g(x)<<endl;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=10000000000000007;
const int MOD=1000000007;
int dp[5][2][300000];
signed main(){
  int n;cin>>n;
  vector<int> a(n+5,-inf);
  rep1(i,n)cin>>a[i];
  rep1(i,n){
    a[i]+=MOD;
  }
  int res=0;
  rep(i,5){
    rep(j,300000){
      dp[i][0][j]=0;
      dp[i][1][j]=0;
    }
  }

  rep1(i,n){
    dp[0][0][i]=dp[0][1][i-1];
    dp[0][1][i]=dp[0][0][i-1]+a[i];
    dp[1][0][i]=max(dp[0][0][i-1],dp[1][1][i-1]);
    dp[1][1][i]=max(dp[1][0][i-1]+a[i],(int)-inf);
    dp[2][0][i]=max(dp[2][1][i-1],max(-inf,dp[1][0][i-1]));
    dp[2][1][i]=dp[2][0][i-1]+a[i];
    if(i<=1){
      dp[1][1][i]=0;
      dp[1][0][i]=0;
    }
    if(i<=2){
      dp[2][1][i]=0;
      dp[2][0][i]=0;
    }
  }
  	if(n%2==0){
      cout<<max(dp[0][1][n],max(dp[0][0][n],dp[1][1][n]))-MOD*n/2<<endl;
    }
    else{
      cout<<max(dp[2][0][n],dp[2][1][n])-n/2*MOD<<endl;
      //cout<<dp[2][0][n]<<"\n";
      //cout<<dp[2][1][n]<<"\n";
    }
  return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
int  main()
{
 long n,ind=0;
 cin>>n;
 vector<long> arr(n);
 for(long i=0;i<n;i++)
 {
   cin>>arr[i];
   if(arr[ind]>arr[i])
     	ind=i;
 }
  if(n%2)
    arr.erase(arr.begin()+i);
 cout<<0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:27: error: 'i' was not declared in this scope
   15 |     arr.erase(arr.begin()+i);
      |                           ^
Language: C

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

#define amax(a, b) a = max(a, b)
#define INF 1e15

int main() {
    int n;
    cin >> n;
    int k = n / 2;
    ll a[n]; for (auto &ai:a) cin >> ai;
    ll dp[k + 1][3];
    fill(dp[0], dp[k+1], -INF);
    dp[0][0] = 0;
    for (int i=0; i<k; i++) {
        for (int x=0; x<3; x++) {
            for (int y=x; y<3; y++) {
                if (i*2 + y < n)
                    amax(dp[i+1][y], dp[i][x] + a[i*2 + y]);
            }
        }
    }
    cout << max({dp[k][0], dp[k][1], dp[k][2]}) << '\n';
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var seqA = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

        var suffix = 0L;
        for (int i = 1 + n % 2; i < seqA.Length; i += 2)
        {
            suffix += seqA[i];
        }

        var max = suffix;
        var ps = new long[2];
        for (int i = 2; i < seqA.Length; i += 2)
        {
            var window = seqA.AsSpan(i - 2, 3);
            suffix -= window[2];
            ps[0] = ps.Max() + window[1];
            ps[1] += window[0];
            max = Math.Max(max, ps.Max() + suffix);
        }

        Console.WriteLine(max);
    }
}


Compiler output:
main.c:1:1: error: unknown type name 'using'
    1 | using System;
      | ^~~~~
main.c:2:1: error: unknown type name 'using'
    2 | using System.Linq;
      | ^~~~~
main.c:2:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    2 | using System.Linq;
      |             ^
main.c:3:1: error: unknown type name 'using'
    3 | using System.Collections.Generic;
      | ^~~~~
main.c:3:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    3 | using System.Collections.Generic;
      |             ^
main.c:4:1: error: unknown type name 'using'
    4 | using System.Diagnostics;
      | ^~~~~
main.c:4:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    4 | using System.Diagnostics;
      |             ^
main.c:6:1: error: unknown type name 'using'
    6 | using E = System.Linq.Enumerable;
      | ^~~~~
main.c:6:17: error: request for member 'Linq' in something not a structure or union
    6 | using E = System.Linq.Enumerable;
      |                 ^
main.c:8:1: error: unknown type name 'public'
    8 | public class Program
      | ^~~~~~
main.c:8:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Program'
    8 | public class Program
      |              ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

const int N = 2e5 + 5;
LL a[N], sum[N], f[N];
int main(){
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++ i){
        cin >> a[i];
        sum[i] = (i > 1 ? sum[i - 2] : 0) + a[i];
    }
    for (int i = 2; i <= n; ++ i){
        if (i & 1) f[i] = max(f[i - 2] + a[i], f[i - 1]);
        else f[i] = max(f[i - 2] + a[i], sum[i - 1]);
    }
    cout << f[n] << endl;
    return 0;
}


Compiler output:
a.cc:5:1: error: 'LL' does not name a type
    5 | LL a[N], sum[N], f[N];
      | ^~
a.cc: In function 'int main()':
a.cc:10:16: error: 'a' was not declared in this scope
   10 |         cin >> a[i];
      |                ^
a.cc:11:9: error: 'sum' was not declared in this scope
   11 |         sum[i] = (i > 1 ? sum[i - 2] : 0) + a[i];
      |         ^~~
a.cc:14:20: error: 'f' was not declared in this scope
   14 |         if (i & 1) f[i] = max(f[i - 2] + a[i], f[i - 1]);
      |                    ^
a.cc:14:42: error: 'a' was not declared in this scope
   14 |         if (i & 1) f[i] = max(f[i - 2] + a[i], f[i - 1]);
      |                                          ^
a.cc:15:14: error: 'f' was not declared in this scope
   15 |         else f[i] = max(f[i - 2] + a[i], sum[i - 1]);
      |              ^
a.cc:15:36: error: 'a' was not declared in this scope
   15 |         else f[i] = max(f[i - 2] + a[i], sum[i - 1]);
      |                                    ^
a.cc:15:42: error: 'sum' was not declared in this scope
   15 |         else f[i] = max(f[i - 2] + a[i], sum[i - 1]);
      |                                          ^~~
a.cc:17:13: error: 'f' was not declared in this scope
   17 |     cout << f[n] << endl;
      |             ^
Language: C++

#include<bits/stdc++.h>
using namsespace std;

const int N = 2e5 + 5;

int sum[N], f[N], a[N];
int main(){
    int n;
    for (int i = 1; i <= n; ++ i){
        cin >> a[i];
        sum[i] = (i > 1 ? sum[i - 2] : 0) + a[i];
    }
    for (int i = 2; i <= n; ++ i){
        if (i & 1) f[i] = max(f[i - 2] + a[i], f[i - 1]);
        else f[i] = max(f[i - 2] + a[i], sum[i - 1]);
    }
    cout << f[n] << endl;
    return 0;
}


Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namsespace'
    2 | using namsespace std;
      |       ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:10:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   10 |         cin >> a[i];
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:14:27: error: 'max' was not declared in this scope; did you mean 'std::max'?
   14 |         if (i & 1) f[i] = max(f[i - 2] + a[i], f[i - 1]);
      |                           ^~~
      |                           std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:15:21: error: 'max' was not declared in this scope; did you mean 'std::max'?
   15 |         else f[i] = max(f[i - 2] + a[i], sum[i - 1]);
      |                     ^~~
      |                     std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:17:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |     cout << f[n] << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:17:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   17 |     cout << f[n] << endl;
      |                     ^~~~
      |                     std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C

#include<bits/stdc++.h>
#include <numeric>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

typedef pair<ll, ll> P;


int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<vector<ll>> dp(n, vector<ll>(n+1, -LONG_MAX));
    dp[0][0] = 0;
    dp[0][1] = a[0];
    dp[1][0] = 0;
    dp[1][1] = max(a[0], a[1]);

    for(int i=2; i<n; i++) {
        // iを選んで, i/2の状態
        chmax(dp[i][i/2], dp[i-2][(i/2)-1] + a[i]);
        // iをえらばず, i/2の状態
        chmax(dp[i][i/2], dp[i-1][i/2]);
        // iを選んで, (i+1)/2個選ばれてる状態
        chmax(dp[i][(i+1)/2], dp[i-2][((i+1)/2)-1] + a[i]);
        // iを選ばず, (i+1)/2個選ばれてる状態(ありえないはず)
    }

    cout << dp[n-1][n/2] << endl;

    return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

ll solve(int n,int k,vector<int>a){
    ll dp1[2][k+1];
    ll dp2[2][k+1];
    memset(dp1,0,sizeof(dp1));
    memset(dp2,0,sizeof(dp2));
    int mx=-1e9;
    int now=1,old=0;
    for(int i=0;i<n;i++){
        old=now;
        now=1-now;
        dp1[now][1]=a[i];
        dp2[now][1]=mx;
        mx=max(mx,a[i]);
     for(int j=0;j<=k;j++){
       if(j>(i+1)/2)continue;
       if(j==0)continue;
       if(old>0)dp1[now][j]=dp2[old][j-1]+a[i];
       if(old>0)dp2[now][j]=max(dp1[old][j],dp2[old][j]);
    }
    }
    return max(dp1[now][k],dp2[now][k]);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);

int n;
cin>>n;
int k=n/2;

vector<int>a(n);
rep(i,n)cin>>a[i];

cout<<solve(n,k,a)<<endl;
return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,f[200009],dp[200009],i,j,k[200009];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a;
	for(i=1; i<=a; i++) cin>>f[i];
  for(i=a; i>=1; i--) k[i]=k[i+2]+f[i];
	for(i=a; i>=1; i--){
		if((a-i+1)%2==0){
			dp[i]=max(f[i]+dp[i+2],k[i+1]);
		}else{
			dp[i]=max(f[i+1]+dp[i+3],f[i]+dp[i+2]);
          if(dp[i]<k[i+3]) dp[i]=k[i+3];
		}
	}
  /*for(i=a; i>=a-7; i--){
    cout<<i<<" "<<dp[i]<<endl;
  }*/
	cout<<dp[1];
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.