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

#include<iostream>
using namespace std;
const int MAX = 200001;
int main(){
	int N,A[MAX];
	long long int sum[MAX][3],ans=0;
	bool visit[MAX][3]={0};
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N-N%2;i+=2)ans+=A[i];
	
	if(N<=3){
		ans=A[0];
		for(int i=1;i<N;i++)ans=max(ans,A[i]);
		cout<<ans;
		return 0;
	}
	
	if(N%2){
		sum[0][2]=A[0];visit[0][2]=true;
		sum[1][1]=A[1];visit[1][1]=true;
		sum[2][0]=A[2];visit[2][0]=true;
	}else{
		sum[0][1]=A[0];visit[0][1]=true;
		sum[1][0]=A[1];visit[1][0]=true;
	}

	for(int i=0;i+2<N;i++)for(int j=0;j<3;j++){
		if(!visit[i][j])continue;
		for(int k=0;k<=min(j,N-i-3);k++){
			if(visit[i+2+k][j-k])sum[i+2+k][j-k]=max(sum[i+2+k][j-k],sum[i][j]+A[i+2+k]);
			else sum[i+2+k][j-k]=sum[i][j]+A[i+2+k];
			visit[i+2+k][j-k]=true;
			if(i+2+k>=N-(j-k+1))ans=max(ans,sum[i+2+k][j-k]);
		}
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:44: error: no matching function for call to 'max(long long int&, int&)'
   14 |                 for(int i=1;i<N;i++)ans=max(ans,A[i]);
      |                                         ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:14:44: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   14 |                 for(int i=1;i<N;i++)ans=max(ans,A[i]);
      |                                         ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: Java


import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
// import java.io.*;
import java.util.*;
public class temp{
    public static void main(String args[])throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        int n=Integer.parseInt(br.readLine());
        
       int[]arr=new int[n];
       for(int i=0;i<n;i++)
       arr[i]=Integer.parseInt(br.readLine());

       ans(arr,0,0,0);
        System.out.println(count);
       // display(dp);
    }
   public static long count=0;
    public static void ans(int[]arr,int vidx,long sum,int a){
    
        if(sum>count && a>=arr.length/2)
        count=sum;
        // if(sum>count && a>=arr.length/2 && vidx>=arr.length-1)
        // return count;
        if(vidx>=arr.length)
        return ;
    
      ans(arr,vidx+2,sum+arr[vidx],a+1);
     ans(arr,vidx+1,sum,a);

     
}
}

Compiler output:
Main.java:7: error: class temp is public, should be declared in a file named temp.java
public class temp{
       ^
1 error
Language: C++

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

int main() {
  int N;
  cin>>N;
  vector<int64_t> p(N);
for (int i=0;i<N;i++) {
  cin>>p.at(i);
}
  if(N%2==0){
    int64_t Z=0,a=-1;
    for(int i=0;i<N/2;i++){
      Z=Z+p.at(2*i+1)-p.at(2*i);
      if(Z>0){
        Z=0;
        a=i;
      }
    }
    Z=0;
    for(int i=0;i<N/2;i++){
      if(i>a){
        Z+=p.at(2*i+1);
      }
      else{
        Z+=p.at(2*i);
      }
    }
    cout<<Z<<endl;
  }
  
  else{
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:2: error: expected '}' at end of input
   34 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C

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

int main() {
  int n, a[2][200000], temp[2];
  
  cin >> n;
  
  for (int i = 0; i < n; i++) {
    cin >> a[0][i];
    a[1][i] = i;
  }
  
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[0][i] < a[0][j]) {
        temp[0] = a[0][i];
        temp[1] = a[1][i];
        a[0][i] = a[0][j];
        a[1][i] = a[1][j];
        a[0][j] = temp[0];
        a[1][j] = temp[1];
      }
    }
  }
  
  for (int i = 0; i < n - 2; i++) {
    for (int j = i + 1; j < n - 1; j++) {
      if (a[1][i] - a[1][j] == 1 || a[1][i] - a[1][j] == -1) {
        continue;
      }
      
      for (int k = j + 1; k < n; k++) {
        if (a[1][k] - a[1][j] == 1 || a[1][k] - a[1][j] == -1) {
          continue;
        }
        
        if (a[1][k] - a[1][i] == 1 || a[1][k] - a[1][i] == -1) {
          continue;
        }
        
        cout << a[0][i] + a[0][j] + a[0][k] << endl;
        
        return 0;
      }
    }
  }
  
  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;
#define int long long
int n,a[200200],pre[200200][2],sub[200200][2],ans;
int mxl[200200],mxr[200200];
signed main()
{
	scanf("%lld",&n);
	int i=1;
	while(i<=n)
	{
		scanf("%lld",&a[i]);
		++i;
	}
	if(!(n&1))
	{
		pre[0][0]=0;
		pre[0][1]=0;
		sub[n+1][0]=0;
		sub[n+1][1]=0;
		i=1;
		while(i<=n)
		{
			pre[i][0]=pre[i-1][0];
			pre[i][1]=pre[i-1][1];
			pre[i][i&1]+=a[i];
			++i;
		}
		i=n;
		while(i>=1)
		{
			sub[i][0]=sub[i+1][0];
			sub[i][1]=sub[i+1][1];
			sub[i][i&1]+=a[i];
			--i;
		}
		ans=0;
		i=0;
		while(i<=n)
		{
			ans=max(ans,pre[i][1]+sub[i+1][0]);
			i+=2;
		}
		printf("%lld\n",ans);
		return 0;
	}
	if(n==3)
	{
		printf("%lld\n",max(max(a[1],a[2]),a[3]));
		return 0;
	}
	pre[0][0]=0;
	pre[0][1]=0;
	sub[n+1][0]=0;
	sub[n+1][1]=0;
	i=1;
	while(i<=n)
	{
		pre[i][0]=pre[i-1][0];
		pre[i][1]=pre[i-1][1];
		pre[i][i&1]+=a[i];
		++i;
	}
	i=n;
	while(i>=1)
	{
		sub[i][0]=sub[i+1][0];
		sub[i][1]=sub[i+1][1];
		sub[i][i&1]+=a[i];
		--i;
	}
	mxl[0]=sub[1][0];
	i=2;
	while(i<n)
	{
		mxl[i]=max(mxl[i-2],pre[i][1]+sub[i+1][0]);
		i+=2;
	}
	mxr[n+1]=pre[n][0];
	i=n-1;
	while(i>1)
	{
		mxr[i]=max(mxr[i+2],pre[i-1][0]+sub[i][1]);
		i-=2;
	}
	i=1;
	while(i<=n)
	{
		ans=max(ans,mxl[i-1]+mxr[i+1]-sub[i][0]-pre[i][0]);
		i+=2;
	}
//	i=n+1;
//	while(i>1)
//	{
//		ans=max(ans,max(sub[i][0],sub[i][1])+max(pre[i-2][0],pre[i-2][1]));
//

Compiler output:
a.cc: In function 'int main()':
a.cc:91:10: error: expected '}' at end of input
   91 |         }
      |          ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^
Language: C++

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

int main() {
  int n, a[2][200000], temp[2];
  
  cin >> n;
  
  for (int i = 0; i < n; i++) {
    cin >> a[0][i];
    a[1][i] = i;
  }
  
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      if (b[0][i] < b[0][j]) {
        temp[0] = a[0][i];
        temp[1] = a[1][i];
        a[0][i] = a[0][j];
        a[1][i] = a[1][j];
        a[0][j] = temp[0];
        a[1][j] = temp[1];
      }
    }
  }
  
  for (int i = 0; i < n - 2; i++) {
    for (int j = i + 1; j < n - 1; j++) {
      if (a[1][i] - a[1][j] == 1 || a[1][i] - a[1][j] == -1) {
        continue;
      }
      
      for (int k = j + 1; k < n; k++) {
        if (a[1][k] - a[1][j] == 1 || a[1][k] - a[1][j] == -1) {
          continue;
        }
        
        if (a[1][k] - a[1][i] == 1 || a[1][k] - a[1][i] == -1) {
          continue;
        }
        
        cout << a[0][i] + a[0][j] + a[0][k] << endl;
        
        return;
      }
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: 'b' was not declared in this scope
   16 |       if (b[0][i] < b[0][j]) {
      |           ^
a.cc:44:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   44 |         return;
      |         ^~~~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define debug(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define IN freopen("in.txt", "r", stdin);
#define endl '\n'
#define pb push_back
#define eb emplace_back
#define fi first
#define int long long
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> pii;
const int inf = 0x3f3f3f3f;

const int N = 2e5+10;
int a[N],f[N];

int32_t main(){
    IOS;
    int n;cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    if(n%2==0){
        f[1]=a[1],f[2]=a[2];
        for(int i=2;i<=n/2;i++){
            f[i*2-1]=f[(i-1)*2-1]+a[i*2-1];
            f[i*2]=max(f[(i-1)*2],f[(i-1)*2-1])+a[i*2];
        }
        cout<<max(f[n],f[n-1])<<endl;
        return 0;
    }
    f[1]=a[1],f[2]=a[2],f[3]=a[3];
    for(int i=2;i<=n/2;i++){
        f[i*2+1]=max(f[(i-1)*2-1],max(f[(i-1)*2],f[(i-1)*2+1]))+a[i*2+1];
        f[i*2]=max(f[(i-1)*2-1],f[(i-1)*2])+a[i*2];
        f[i*2-1]=f[(i-1)*2-1]+a[i*2-1];
    }
    cout<<max(f[n-2],max(f[n-1],f[n]))<<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 be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++){
    	cin>>a[i];
    }
    if(n&1){
    	ll ans=-1e18;
    	ll sum=0;
    	for(int i=0;i<n;i++){
    		if(i%2==0)sum+=a[i];
    	}
    	ll dp[n]; dp[0]=0;
    	for(int i=1;i<n;i++){
    		if(i%2==0)dp[i]=dp[i-1];
    	    else{
    	    	ll num=a[i]-a[i-1];
    	    	dp[i]=max(dp[i-1]+num,0LL);
    	    }
    	}
    	ll m=-1e18;
    	for(int i=0;i<n;i++){
    		if(i&1){
    			dp[i]-=a[i+1];
    			m=max(dp[i],m);
    		}
    	}
    	ll ans=sum-a[0];
    	ans=max(ans,sum+m);
    	cout << ans <<endl;
    }
    else{
    	ll b[n+1];
    	b[n]=0;
    	for(int i=n-1;i>=0;i--){
    		if(i&1)b[i]=b[i+1]+a[i];
    		else b[i]=b[i+1];
    	}
    	ll sum=0;
    	ll ans=-1e18;
    	for(int i=0;i<n-1;i++){
    		if(i%2==0)ans=max(ans,sum+b[i+1]),sum+=a[i];
    	}
        ans=max(ans,sum);
        cout << ans <<endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:12: error: redeclaration of 'll ans'
   40 |         ll ans=sum-a[0];
      |            ^~~
a.cc:20:12: note: 'll ans' previously declared here
   20 |         ll ans=-1e18;
      |            ^~~
Language: C++

#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll n; cin >> n;
	vl a(n); rep(i,n) cin >> a[i];
	if(n & 1){
		vvl dp(n+1,vl(3,-linf));
		dp[0][0] = a[0];
		dp[1][1] = a[1];
		dp[2][2] = a[2];
		ll ans = -linf;
		REP(i,2,n){
			chmax(dp[i][0],dp[i-2][0] + a[i]);
			chmax(dp[i][1],dp[i-2][1] + a[i]);
			chmax(dp[i][2],dp[i-2][2] + a[i]);
			if(i > 2){
				chmax(dp[i][1],dp[i-3][0] + a[i]);
				chmax(dp[i][2],dp[i-3][1] + a[i]);
			}
			if(i > 3){
				chmax(dp[i][2],dp[i-4][0] + a[i]);
			}
		}
		ll ans = max({dp[n-3][0],dp[n-2][0],dp[n-1][0],dp[n-2][1],dp[n-1][1],dp[n-1][2]});
		cout << ans << endl;
	}else{
		ll odd = 0;
		ll even = 0;
		for(ll i=0; i<n; i+=2) odd += a[i];
		for(ll i=1; i<n; i+=2) even += a[i];
		cout << max(odd,even) << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:78:20: error: redeclaration of 'll ans'
   78 |                 ll ans = max({dp[n-3][0],dp[n-2][0],dp[n-1][0],dp[n-2][1],dp[n-1][1],dp[n-1][2]});
      |                    ^~~
a.cc:65:20: note: 'll ans' previously declared here
   65 |                 ll ans = -linf;
      |                    ^~~
Language: C

#include <bits/stdc++.h>
using namespace std;
const int Max=200000;
long A[Max]={}, f[Max]={}, seen[Max]={}, E[Max]={0};
long F(int n){
long M=0;
if(n==2){ M=max(A[0], A[1]); return M; }
if(n==3){ M=max(F(2), A[2]); return M; }
if(seen[n]){ return f[n]; }
seen[n]=1; 
if(n%2){ return f[n]=max(F(n-1), F(n-2)+A[n-1]); }
else{ return f[n]=max(E[n/2], F(n-2)+A[n-1]); }
}

int main(){
int N, i; cin >> N;
for(i=0; i<N; i++){ cin >> A[i]; }
E[0]=A[0];
for(i=2; i<N; i+=2){ E[i]=E[i-2]+A[i]; }  
cout << F(N) << "\n";
}

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>
#define int int64_t
using namespace std;

const int M = 1e9+7;

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

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

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:8: error: 'N' was not declared in this scope
   28 |     if(N%2 == 0)cout << dp[n][0] << "\n";
      |        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

ll dp[200010][2][3] = {};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<ll> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    ll inf = 1e18;
    for(int i=0;i<=N;i++) for(int j=0;j<2;j++) for(int k=0;k<3;k++) dp[i][j][k] = -inf;
    dp[0][0][0] = 0;
    for(int i=0;i<N;i++){
        //選ぶ
        for(int k=0;k<3;k++){
            dp[i+1][1][k] = max(dp[i+1][1][k],dp[i][0][k]+A[i]);
        }
        //選ばない
        if(i!=0){
            for(int k=0;k<3;k++){
                dp[i+1][0][k] = max(dp[i+1][0][k],dp[i][1][k]);
            }
            for(int k=0;k<2;k++) dp[i+1][0][k+1] = max(dp[i+1][0][k+1],dp[i][0][k]);
        }else{
            dp[i+1][0][1] = 0;
        }
    }
    ll ans = -inf;
    if(N%2==1) ans = max(dp[N][1][2],dp[N][0][1]);
    else ans = max(ans,dp[N][1][0],dp[N][0][1]);
    cout << ans << "\n";
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:39:19:   required from here
   39 |     else ans = max(ans,dp[N][1][0],dp[N][0][1]);
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC omodtimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long long,long long> ii; 	
typedef complex<long double> com;

const ll mod = 1e9+7;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin >> n;
	vector <ll> arr(n+1);
	for (int z=1;z<=n;z++){
		cin >> arr[z];
	}
	ll dp[n+1][3][2];
	for (int z=0;z<=n;z++){
		for (int x=0;x<3;x++){
			for (int y=0;y<2;y++){
				dp[z][x][y] = -(ll(1) << 50);
			}
		}
	}
	dp[0][0][0] = 0;
	dp[0][0][1] = 0;
	for (int z=1;z<=n;z++){
		dp[z][0][1] = max(dp[z][0][1],dp[z-1][0][0]+arr[z]);
		dp[z][0][0] = max(dp[z][0][0],dp[z-1][0][1]);

		dp[z][1][1] = max(dp[z][1][1],dp[z-1][1][0]+arr[z]);
		dp[z][1][0] = max(dp[z][1][0],dp[z-1][1][1]);

		dp[z][2][1] = max(dp[z][2][1],dp[z-1][2][0]+arr[z]);
		dp[z][2][0] = max(dp[z][2][0],dp[z-1][2][1]);

		if (z > 3){
			dp[z][1][1] = max(dp[z][1][1],dp[z-3][0][1]+arr[z]);
			dp[z][2][1] = max(dp[z][2][1],dp[z-3][1][1]+arr[z]);
		}

		if (z > 4){
			dp[z][2][1] = max(dp[z][2][1],dp[z-4][0][1]+arr[z]);
		}
		
	}
	ll ans = 0;
	if (n & 1){
		for (int x=0;x<3;x++){
			for (int y=0;y<2;y++){
				if (x == 2 && y == 0) continue;
				ans = max(ans,dp[n][x][y]);
			}
		}
	} else {
		for (int x=0;x<2;x++){
			for (int y=0;y<2;y++){
				if (x == 1 && y == 0) continue;
				ans = max(ans,dp[n][x][y]);
			}
		}
	}
	
	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 <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC omodtimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long long,long long> ii; 	
typedef complex<long double> com;

const ll mod = 1e9+7;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin >> n;
	vector <ll> arr(n+1);
	for (int z=1;z<=n;z++){
		cin >> arr[z];
	}
	ll dp[n+1][3][2];
	for (int z=0;z<=n;z++){
		for (int x=0;x<3;x++){
			for (int y=0;y<2;y++){
				dp[z][x][y] = -(ll(1) << 50);
			}
		}
	}
	dp[0][0][0] = 0;
	dp[0][0][1] = 0;
	for (int z=1;z<=n;z++){
		dp[z][0][1] = max(dp[z][0][1],dp[z-1][0][0]+arr[z]);
		dp[z][0][0] = max(dp[z][0][0],dp[z-1][0][1]);

		dp[z][1][1] = max(dp[z][1][1],dp[z-1][1][0]+arr[z]);
		dp[z][1][0] = max(dp[z][1][0],dp[z-1][1][1]);

		dp[z][2][1] = max(dp[z][2][1],dp[z-1][2][0]+arr[z]);
		dp[z][2][0] = max(dp[z][2][0],dp[z-1][2][1]);

		if (z >= 3){
			dp[z][1][1] = max(dp[z][1][1],dp[z-3][0][1]+arr[z]);
			dp[z][2][1] = max(dp[z][2][1],dp[z-3][1][1]+arr[z]);
		}

		if (z >= 4){
			dp[z][2][1] = max(dp[z][2][1],dp[z-4][0][1]+arr[z]);
		}
		
	}
	ll ans = 0;
	if (n & 1){
		for (int x=0;x<3;x++){
			for (int y=0;y<2;y++){
				if (x == 2 && y == 0) continue;
				ans = max(ans,dp[n][x][y]);
			}
		}
	} else {
		for (int x=0;x<2;x++){
			for (int y=0;y<2;y++){
				if (x == 1 && y == 0) continue;
				ans = max(ans,dp[n][x][y]);
			}
		}
	}
	
	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 <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;
const int inf = 1e15;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}

const int N =2e5+10;
int dp[N][3];

void solve()
{
   int n;
    cin >> n;
    
    int a[n];
    f(i,n) cin >> a[i];
    
        f(i,n) f(j,3) dp[i][j] = -inf;
        
        dp[0][0] = a[0];
        dp[1][1] = a[1];
        dp[2][2] = a[2];
        dp[2][0] = a[0] + a[2];
    
        for(int i=3;i<n;i++)
        {
           dp[i][0] = a[i] + dp[i-2][0];
           dp[i][1] = a[i] + max(dp[i-2][1],dp[i-3][0]);
           dp[i][2] = a[i] + max(dp[i-2][2],dp[i-3][1]);
            
           if(i>3) dp[i][2] = max(dp[i][2],a[i] + dp[i-4][0]);
        }
        
  if(n%2 == 1)
  {
        int res = dp[n-1][2];
        res = max(res,dp[n-2][1]);
        res = max(res,dp[n-3][0]);
        cout << res;
  }
  else
  {
      int res = dp[n-1][1];
      res = max(res,dp[n-2][0]);
    
      cout << res;
  }
    }
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Compiler output:
a.cc:87:1: error: expected declaration before '}' token
   87 | }
      | ^
Language: C++

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;
const int inf = 1e15;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}

const int N =2e5+10;
int dp[N][3];

void solve()
{
   int n;
    cin >> n;
    
    int a[n];
    f(i,n) cin >> a[i];
    
        f(i,n) f(j,3) dp[i][j] = -inf;
        
        dp[0][0] = a[0];
        dp[1][1] = a[1];
        dp[2][2] = a[2];
        dp[2][0] = a[0] + a[2];
    
        for(int i=3;i<n;i++)
        {
           dp[i][0] = a[i] + dp[i-2][0];
           dp[i][1] = a[i] + max(dp[i-2][1],dp[i-3][0]);
           dp[i][2] = a[i] + max(dp[i-2][2],dp[i-3][1]);
            
           if(i>3) dp[i][2] = max(dp[i][2],a[i] + dp[i-4][0]);
        }
        
  if(i%2 == 1)
  {
        int res = dp[n-1][2];
        res = max(res,dp[n-2][1]);
        res = max(res,dp[n-3][0]);
        cout << res;
  }
  else
  {
      int res = dp[n-1][1];
      res = max(res,dp[n-2][0]);
    
      cout << res;
  }
    }
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:71:6: error: 'i' was not declared in this scope
   71 |   if(i%2 == 1)
      |      ^
a.cc: At global scope:
a.cc:87:1: error: expected declaration before '}' token
   87 | }
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
long long max (long long a, long long b) {if (a > b) return a; return b;}
 
int main()
{
    int N;
    int a[100005] = {0};
    long long dp1[100005] = {0};
    long long dp2[100005] = {0};
    long long dp3[100005] = {0};
    long long dp4[100005][3] = {0};
    long long sum = 0;
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> a[i];
    for (int i = 0; i < N; i += 2) {
        sum += a[i];
        dp1[i] = sum;
    }
    sum = 0;
    for (int i = 1; i < N; i += 2) {
        sum += a[i];
        dp3[i] = sum;
    }
    sum = 0;
    for (int i = N - 1; i >= 0; i -= 2) {
        sum += a[i];
        dp2[i] = sum;
    }

    // for (int i = 0; i < N; ++i) {
    //     cout << dp1[i] << ' ';
    // }
    // cout << endl;
    // for (int i = 0; i < N; ++i) {
    //     cout << dp2[i] << ' ';
    // }
    // cout << endl;
    long long ans = 0;
    if (N % 2 == 0) {
        for (int i = 0; i < N; i += 2)
        {
            if (i + 3 < N) ans = max(ans, dp1[i] + dp2[i+3]);
            else ans = max(ans, dp1[i]);
        }
        for (int i = N-1; i >= 0; i -= 2)
        {
            if (i - 3 >= 0) ans = max(ans, dp2[i] + dp2[i-3]);
            else ans = max(ans, dp2[i]);
        }
        cout << ans << endl;
    } else {
        dp4[0][0] = a[0]; dp4[0][1] = INT_MIN;  dp4[0][2] = INT_MIN;
        dp4[1][1] = a[1]; 
        dp4[1][2] = INT_MIN; 
        dp4[1][0] = INT_MIN; 
        dp4[2][2] = a[2]; 
        for (int i = 2; i < N; i++) {
            dp4[i][0] = dp4[i-2][0] + a[i];
            dp4[i][1] = dp4[i-2][1]+a[i];
            if (i - 3 >= 0) dp4[i][1] = max(dp4[i][1], dp4[i-3][0] + a[i]); 
            dp4[i][2] = dp4[i-2][2]+a[i];
            if (i - 3 >= 0) dp4[i][2] = max(dp4[i][2], dp4[i-3][1] + a[i]); 
            if (i - 4 >= 0) dp4[i][2] = max(dp4[i][2], dp4[i-4][0] + a[i]); 
            if (N - i == 3)ans = max(ans, dp4[i][0]);
            if (N - i == 2)ans = max(ans, dp4[i][1]);
            if (N - i == 1)ans = max(ans, dp4[i][2]);
        }
        cout << ans << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:39: error: 'INT_MIN' was not declared in this scope
   55 |         dp4[0][0] = a[0]; dp4[0][1] = INT_MIN;  dp4[0][2] = INT_MIN;
      |                                       ^~~~~~~
a.cc:4:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <cstdlib>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C

#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;
long long neg_inf=0;

void fill_dp(int x, int y, map<pair<int,int>,long long>& ht, int n, vector<long long>& a){
    if(x>n){
        ht.insert({{x,y},neg_inf});
        return;
    }

    if(y>1){
        if(x<2*y-1){
            ht.insert({{x,y},neg_inf});
            return;
        }
        long long tmp=neg_inf;
        for(int i=x;i>0 && i>=2*y-1;i--){
            if(ht.find({i-2,y-1})!=ht.end()){
                tmp=max(tmp,ht.find({i-2,y-1})->second + a[i-1]);
            }
        }
        ht.insert({{x,y},tmp});
    }
    else{
        long long tmp=0;
        for(int i=0;i<x;i++){
            tmp=max(tmp,a[i]);
        }
    
        ht.insert({{x,y},tmp});
    }
}

void f1(int x,int y,map<pair<int,int>,long long>& ht, int n, vector<long long>& a){
    fill_dp(x,y,ht,n,a);
    cout<<x<<" "<<y<<" "<<ht.find({x,y})->second<<"\n";
}

void solve(){
    int n;
    cin>>n;
    vector<long long> a(n,0ll);
    long long min_sm=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        neg_inf-=abs(a[i]);
        if(i%2==1){
            min_sm+=a[i];
        }
    }
    neg_inf=neg_inf*2-100-MOD;
    int m=n/2;
    map<pair<int,int>,long long> ht;
    for(int i=1;i<=m;i++){
        f1(2*i-1,i,ht,n,a);
        f1(2*i,i,ht,n,a);
        f1(2*i+1,i,ht,n,a);
        f1(2*i+2,i,ht,n,a);
    }
    long long ans=min_sm;
    for(int i=n;i>0 && i>=2*m-1;i--){
        if(ht.find({i,m})!=ht.end()){
            ans=max(ans,ht.find({i,m})->second);
        }
    }

    cout<<ans<<"\n";
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    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 sz(x) (int)x.size()
#define trav(v, x) for (auto v : x)
#define re(x, y, z) for (int x=y; x<z; ++x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
const int maxn = 2e5 + 10;
long long memo[2][maxn];
long long memo2[2][maxn];
int a[maxn];

class F {
public:
    long long get(int a[], int n) {
        memo[0][0] = a[0];
        memo[1][0] = a[1];
        for (int i = 2; i < n; i += 2) {
            memo[0][i] = memo[0][i-2] + a[i];
            memo[1][i] = max(memo[0][i-2], memo[1][i-2]) + a[i+1];
        }
        return  max(memo[0][n-2], memo[1][n-2]);
    }
    int testNumber = 0;
	void solve(istream& in, ostream& out) {
        //out << "Case #" << ++testNumber << ": ";
        int n;
        in >> n;
        re(i, 0, n) in >> a[i];
        long long ans;
        if (n & 1) {
            memo[0][0] = a[0];
            memo[1][0] = a[1];
            for (int i = 2; i < n; i += 2) {
                memo[0][i] = memo[0][i-2] + a[i];
                memo[1][i] = max(memo[0][i-2], memo[1][i-2]) + a[i+1];
            }
            reverse(a, a+n);
            memo2[0][0] = a[0];
            memo2[1][0] = a[1];
            for (int i = 2; i < n; i += 2) {
                memo2[0][i] = memo2[0][i-2] + a[i];
                memo2[1][i] = max(memo2[0][i-2], memo2[1][i-2]) + a[i+1];
            }
            reverse(a, a+n);
            ans = -1e18;
            for (int i = 0; i < n; ++i) {
                if (i&1) {
                    ll temp11 = i<3?0:memo[0][i-3];
                    ll temp12 = i<3?0:memo[1][i-3];
                    ll temp21 = i+4>n?0:memo2[1][n-i-4];
                    ll temp22 = i+4>n?0:memo2[0][n-i-4];

                    //[0 1 2] 3 4 5 6
                    //1 -> 2
                    //n-1-(i+3)


                    ans = max(ans, temp11 + a[i-1] + max(temp21, temp22));
                    ans = max(ans, max(temp11, temp12) + a[i+1] + temp22);
                } else {
                    ll temp = i<2?0:max(memo[0][i-2], memo[1][i-2]);
                    ll temp2 = i+3>n?0:max(memo2[1][n-i-3], memo2[0][n-i-3]);
                    ans = max(ans, temp + temp2);
                }
                //if (ans == 298) {
                //    cout << i << endl;
                 //   break;
                //}
            }
            //a[n] = 0;
            //ans = max(ans, get(a, n+1));
            //reverse(a, a+n);
            //ans = max(ans, get(a, n+1));
        } else ans = get(a, n);
        out << ans << endl;
	}
};

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define ll long long int
#define sec ->second
#define fir ->first
#define mapi map<int,int>
#define veci vector<int,int>
#define pb(a) .push_back(a)
#define pob(a) .pop_back(a)
#define fori(a) for(int i=0;i<a;i++)
#define forill(a) for(long long int i=0;i<a;i++)
#define listi list<int>
int main()
{
    ll minne=100000000000,minno=100000000000;
    ll n;cin>>n;ll sume=0,sumo=0,half=floor(n/2);
    if(n%2==0){
        for(int i=0;i<n;i++){
            ll a;cin>>a;
            if(i%2==0){sume+=a;}
            else sumo+=a;
        }}
    else {
        for(int i=0;i<n;i++){
            ll a;cin>>a;
            if(i%2==0){
                sume+=a;
            }
            else {
                if(a<minno){minno=a;}
                sumo+=a;
            }
        }
        sumo-=minno;
    }

      if(sumo>=sume)cout<<sumo<< " ";
     else cout<<sume;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:39: error: 'floor' was not declared in this scope
   20 |     ll n;cin>>n;ll sume=0,sumo=0,half=floor(n/2);
      |                                       ^~~~~
Language: C

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//end

ll dp[201000][3][2]={};

int main(){
   int n; cin>>n;
   vector<int> a(n); rep(i,0,n)cin>>a[i];
   if(n&1){
      rep(i,0,n+1)rep(j,0,3)rep(k,0,2)dp[i][j][k]=-INF;
      rep(j,0,3)dp[0][j][1]=0;
      rep(i,0,n)rep(j,0,3)rep(k,0,2){
         chmax(dp[i+1][j][k^1],dp[i][j][k]+(k?a[i]:0));
         if(j!=2)chmax(dp[i+1][j+1][k],dp[i][j][k]);
      }
      ll res=0; rep(k,0,2)chmax(res,dp[n][2][k]);
      printf("%lld\n",res);
   }
   else{
      vector<ll> lb(n+1),rb(n+1);
      rep(i,0,n)lb[i+1]=lb[i]+(i%2==0?a[i]:0);
      rrep(i,n,0)rb[i-1]=rb[i]+((n-i)%2==0?a[i-1]:0);
      ll res=0;
      rep(i,0,n)if(i%2==0){
         chmax(res,lb[i]+rb[i]);
      } printf("%lld\n",res);
   }
   return 0;
}

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>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
const int inf = 1 << 30;
const ll linf = 1e18;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}


int N;
ll A[200010];
ll fsum[200010];
ll bsum[200010];
ll dp[3][200010];
bool flag[3][200010];

ll ans = 0;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N;
    for(int i = 1; i <= N; i++){
        cin >> A[i];
        dp[0][i] = -linf;
        dp[1][i] = -linf;
        dp[2][i] = -linf;
    }
    for(int i = 1; i <= N; i++){
        fsum[i] += A[i];
        fsum[i + 2] = fsum[i];
    }
    for(int i = N; i >= 1; i--){
        bsum[i] = bsum[i + 2];
        bsum[i] += A[i];
    }
    ans = max(fsum[N - 1], bsum[2]);
    
    for(int i = 0; i < N; i++){
        ll res = fsum[i] + bsum[i + 2];
        int cnt = (i + 1) / 2;
        cnt += (N - i) / 2;
        if(cnt == N / 2) chmax(ans, res);
    }
    for(int i = 0; i < N; i++){
        ll res = fsum[i] + bsum[i + 3];
        int cnt = (i + 1) / 2;
        cnt += (N - i - 1) / 2;
        if(cnt == N / 2) chmax(ans, res);
    }
    for(int i = 0; i < N; i++){
        ll res = fsum[i] + bsum[i + 4];
        int cnt = (i + 1) / 2;
        cnt += (N - i - 2) / 2;
        if(cnt == N / 2) chmax(ans, res);
    }

    flag[0][1] = true;
    flag[1][2] = true;
    flag[2][3] = true;
    dp[0][1] = 0;
    dp[1][2] = 0;
    dp[2][3] = 0;
    for(int i = 1; i <= N; i++){
        if(flag[0][i]){
            dp[0][i] += A[i];
            chmax(dp[0][i + 2], dp[0][i]);
            chmax(dp[1][i + 3], dp[0][i]);
            chmax(dp[2][i + 4], dp[0][i]);
            flag[0][i + 2] = true;
            flag[1][i + 3] = true;
            flag[2][i + 4] = true;
        }
        if(flag[1][i]){
            dp[1][i] += A[i];
            chmax(dp[1][i + 2], dp[1][i]);
            chmax(dp[2][i + 3], dp[1][i]);
            flag[1][i + 2] = true;
            flag[2][i + 3] = true;

        }
        if(flag[2][i]){
            dp[2][i] += A[i];
            chmax(dp[2][i + 2], dp[2][i]);
            flag[2][i + 2] = true;
        }
    }

    if(N % 2 == 1){
        chmax(ans, dp[2][N]);
        chmax(ans, dp[1][N - 1]);
    }
    cout << ans << 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> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 100000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
using namespace std;

//余裕についてdp?
int main() {
	int N; cin >> N;
	vi A(N);
	rep(i, N) {
		cin >> A[i];
	}
	vector<vector<ll>> dp(N, vll(3)); //dp[i][j] jは余裕を表す

	if (N <= 2) {
		cout << max(A[0], A[1]) << endl;
	}
	else if (N == 3) {
		cout << max(A[1], A[2], A[3]) << endl;;
	}
	else {
		dp[0][0] = A[0];
		dp[0][1] = 0;
		dp[0][2] = 0;

		dp[1][0] = A[1];
		dp[1][1] = A[0];
		dp[1][2] = 0;

		dp[2][0] = A[2];
		dp[2][1] = A[1];
		dp[2][2] = A[0];

		for (int i = 3; i < N; i++) { // 0 Origin
			if (i % 2 == 1) { // 1 Origin and Even nubmer indexed  A
				dp[i][2] = 0;
				dp[i][1] = dp[i - 1][2] + A[i - 1];
				dp[i][0] = max(dp[i - 1][2], dp[i - 1][1]) + A[i];
			}
			else {
				dp[i][2] = dp[i - 1][1];
				dp[i][1] = dp[i - 1][0];
				dp[i][0] = max({ dp[i - 2][0],dp[i - 2][1],dp[i - 2][2] }) + A[i];
			}
		}

		cout << max({ dp[N - 1][0],dp[N - 1][1],dp[N - 1][2] }) << endl;
	}
	
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:47:14:   required from here
   47 |                 cout << max(A[1], A[2], A[3]) << endl;;
      |                         ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: Java

class Main
{ 
    int FindMaxSum(int arr[], int n) 
    { 
        int incl = arr[0]; 
        int excl = 0; 
        int excl_new; 
        int i; 
  
        for (i = 1; i < n; i++) 
        { 
            
            excl_new = (incl > excl) ? incl : excl; 
  
            incl = excl + arr[i]; 
            excl = excl_new; 
        } 
  
        return ((incl > excl) ? incl : excl); 
    } 
  
    public static void main(String[] args) 
    { 
        MaximumSum sum = new MaximumSum(); 
        int arr[] = new int[]{5, 5, 10, 100, 10, 5}; 
        System.out.println(sum.FindMaxSum(arr, arr.length)); 
    } 
} 

Compiler output:
Main.java:24: error: cannot find symbol
        MaximumSum sum = new MaximumSum(); 
        ^
  symbol:   class MaximumSum
  location: class Main
Main.java:24: error: cannot find symbol
        MaximumSum sum = new MaximumSum(); 
                             ^
  symbol:   class MaximumSum
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

ll a[200222],dpl[200222],dpr[200222],mnl[200222],mnr[200222];
	
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	for(int i=1; i<=n; i++){
		cin >> a[i];
	}
	memset(dpl,0,sizeof(dpl)); memset(mnl,INF,sizeof(mnl));
	memset(dpr,0,sizeof(dpr)); memset(mnr,INF,sizeof(mnr));
	mnl[1] = a[1];
	for(int i=1; i<=n; i++){
		if(i%2==1){dpl[i] = a[i]; if(i>2)mnl[i] = min(mnl[i-1],a[i]);}
		else mnl[i] = mn[i-1];
		if(i){dpl[i]+=dpl[i-1];}
	}
	
	for(int i=n; i>=1; i--){
		if(i%2==0){dpr[i] = a[i]; if(i<n)mnr[i] = min(mnr[i+1],a[i]);}
		else mnr[i] = mnr[i+1];
		dpr[i] += dpr[i+1];
	}
	for(int i=1; i<=n; i++){
		cout << dpl[i] << ' ';
	} cout << endl;
	for(int i=1; i<=n; i++){
		cout << dpr[i] << ' ';
	} cout << endl;
	if(n%2==0){
		ll ans = 0;
		for(int i=1; i<=n; i+=2){
			ans = max(ans,dpl[i-1]+dpr[i]);
		}
		cout << ans << endl;
	}else{
		ll ans = 0;
		for(int i=1; i<=n; i+=2){
			ans = max(ans,dpl[i-1]+dpr[i])-min(mnl[i-1],mnr[i]);
		}
		cout << ans << endl;
	}
}	
/*  Benq's (modified)
	stuff you should look for
	* ll, int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:36:31: error: 'mn' was not declared in this scope; did you mean 'n'?
   36 |                 else mnl[i] = mn[i-1];
      |                               ^~
      |                               n
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using PL = pair<long long, long long>;
const int INF = 1001001007;
const int MOD = 1000000007;

ll mx(vector<int> &p, ll n){
    ll ans = 0;
    rep(i,n / 2 + 1){
        ll a = 0;
        repl(j,i){
            a += p[2 * j];
        }
        reppl(j,n / 2 + 1, i+1){
            a += p[2 * j - 1];
        }
        ans = max(ans, a);
    }
    return ans;
}

ll ma(vector<int> &p, ll n){
    if (n == 3){
        ll ans = max{p[0], p[1], p[2]};
        return ans;
    }
    return max(mx(p,n-1), ma(p,n-2));
}

int main(){
    ll n; cin >> n;
    vector<int> ar(n);
    repl(i,n)  cin >> ar[i];
    if (n % 2 == 0) cout << mx(ar, n);
    else {
        cout << max(mx(ar,n-1), ma(ar,n));
    }
}

Compiler output:
a.cc: In function 'll ma(std::vector<int>&, ll)':
a.cc:34:18: error: cannot resolve overloaded function 'max' based on conversion to type 'll' {aka 'long long int'}
   34 |         ll ans = max{p[0], p[1], p[2]};
      |                  ^~~
Language: C

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)
    {
        cin >> a.at(i);
    }

    ll sum = 0;
    int mi = min_element(a.begin(), a.end()) - a.begin();
    if (n % 2 == 0) {
        if (mi % 2 == 0) {
            rep(i, n)
            {
                if (i % 2 == 1) {
                    sum += a.at(i);
                }
            }
        } else {
            rep(i, n)
            {
                if (i % 2 == 0) {
                    sum += a.at(i);
                }
            }
        }
    } else {
        ll sum_a = 0;
        ll sum_b = 0;
        rep(i, n)
        {
            if (i == mi)
                continue;
            else if (i % 2 == 0)
                sum_a += a.at(i);
            else {
                sum_b += a.at(i);
            }
        }
        sum = max(sum_a, sum_b);
    }

    cout << sum << 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 <climits>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  ll odsum = 0, evsum = 0, omin = LLONG_MAX;
  for (int i = 0; i < n / 2; i++) {
    int o, e;
    cin >> o >> e;
    odsum += o;
    evsum += e;
    if (o < omin) omin = o;
  }
  if (n % 2 == 1) {
    int o;
    cin >> o;
    odsum += o;
    if (o < omin) omin = o;
  }
  odsum -= omin;
  cout << (odsum > evsum ? odsum : evsum) << endl;
  
  return 0;
}

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