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

#include <iostream>
#include <algorithm>
#define ll long long
const int N=2e5+5;
using namespace std;
ll a[N];
bool cmp(ll a,ll b){
	return a>=b;
}
int main(){
	int n; cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n,cmp);
//	for(int i=0;i<n;i++)
//		cout<<a[i]<<' ';
//	cout<<endl;
	int num=(n%2==0?n/2:n/2+1);
	int cnt=0,int fac=0,int i=0;
	ll ans=0;
	while(cnt<num){
		if(fac){
			ans+=a[i++];
			cnt++; fac=0;
			continue;
		}
		if(i>0&&a[i]==a[i-1]-1){
			fac=1;
			i++;
			continue;
		}
			ans+=a[i++];
			cnt++;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: expected unqualified-id before 'int'
   19 |         int cnt=0,int fac=0,int i=0;
      |                   ^~~
a.cc:22:20: error: 'fac' was not declared in this scope
   22 |                 if(fac){
      |                    ^~~
a.cc:23:32: error: 'i' was not declared in this scope
   23 |                         ans+=a[i++];
      |                                ^
a.cc:27:20: error: 'i' was not declared in this scope
   27 |                 if(i>0&&a[i]==a[i-1]-1){
      |                    ^
a.cc:28:25: error: 'fac' was not declared in this scope
   28 |                         fac=1;
      |                         ^~~
a.cc:32:32: error: 'i' was not declared in this scope
   32 |                         ans+=a[i++];
      |                                ^
Language: C++

#include <iostream>
#include <algorithm>
#define ll long long
const int N=2e5+5;
using namespace std;
ll a[N];
bool cmp(ll a,ll b){
	return a>=b;
}
int main(){
	int n; cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n,cmp);
//	for(int i=0;i<n;i++)
//		cout<<a[i]<<' ';
//	cout<<endl;
	int num=(n%2==0?n/2:n/2+1)
	int cnt=0,int fac=0,int i=0;
	ll ans=0;
	while(cnt<num){
		if(fac){
			ans+=a[i++];
			cnt++; fac=0;
			continue;
		}
		if(i>0&&a[i]==a[i-1]-1){
			fac=1;
			i++;
			continue;
		}
			ans+=a[i++];
			cnt++;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: expected ',' or ';' before 'int'
   19 |         int cnt=0,int fac=0,int i=0;
      |         ^~~
a.cc:21:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
   21 |         while(cnt<num){
      |               ^~~
      |               int
a.cc:22:20: error: 'fac' was not declared in this scope
   22 |                 if(fac){
      |                    ^~~
a.cc:23:32: error: 'i' was not declared in this scope
   23 |                         ans+=a[i++];
      |                                ^
a.cc:27:20: error: 'i' was not declared in this scope
   27 |                 if(i>0&&a[i]==a[i-1]-1){
      |                    ^
a.cc:28:25: error: 'fac' was not declared in this scope
   28 |                         fac=1;
      |                         ^~~
a.cc:32:32: error: 'i' was not declared in this scope
   32 |                         ans+=a[i++];
      |                                ^
Language: C++

#include <iostream>
#include <algorithm>
#define ll long long
const int N=2e5+5;
using namespace std;
ll a[N];
bool cmp(ll a,ll b){
	return a>=b;
}
int main(){
	int n; cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n,cmp);
	for(int i=0;i<n;i++)
		cout<<a[i]<<' ';
	cout<<endl;
	int num=(n%2==0?n/2:n/2+1)
	int cnt=0,fac=0,i=0;
	ll ans=0;
	while(cnt<num){
		if(fac){
			ans+=a[i++];
			cnt++; fac=0;
			continue;
		}
		if(i>0&&a[i]==a[i-1]-1){
			fac=1;
			i++;
			continue;
		}
			ans+=a[i++];
			cnt++;
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: expected ',' or ';' before 'int'
   19 |         int cnt=0,fac=0,i=0;
      |         ^~~
a.cc:21:15: error: 'cnt' was not declared in this scope; did you mean 'int'?
   21 |         while(cnt<num){
      |               ^~~
      |               int
a.cc:22:20: error: 'fac' was not declared in this scope
   22 |                 if(fac){
      |                    ^~~
a.cc:23:32: error: 'i' was not declared in this scope
   23 |                         ans+=a[i++];
      |                                ^
a.cc:27:20: error: 'i' was not declared in this scope
   27 |                 if(i>0&&a[i]==a[i-1]-1){
      |                    ^
a.cc:28:25: error: 'fac' was not declared in this scope
   28 |                         fac=1;
      |                         ^~~
a.cc:32:32: error: 'i' was not declared in this scope
   32 |                         ans+=a[i++];
      |                                ^
Language: C

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  // Including tree_order_statistics_node_update

using namespace __gnu_pbds;
using namespace std;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define minei(x) min_element(x.begin(), x.end()) - (x).begin()
#define maxei(x) max_element(x.begin(), x.end()) - (x).begin()
#define LSOne(S) (S & (-S))

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define acusum(x) accumulate(x.begin(), x.end(), 0)
#define acumul(x) accumulate(x.begin(), x.end(), 1, multiplies<int>());
#define bits(x) __builtin_popcount(x)
#define oo INT_MAX
#define inf 1000000000
#define MAXN 200007
#define MOD 1000000007

const double pi = acos(-1.0);
const double eps = 1e-11;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
ll dp[MAXN][2];
int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<ll> v(n + 1);
    for (int i = 1; i <= n; i++) cin >> v[i];
    dp[2][0] = v[1];
    dp[2][1] = v[2];
    for (int i = 3; i <= n; i++) {
        if (i % 2 == 0) {
            dp[i][0] = v[i - 1] + dp[i - 2][0];
            dp[i][1] = v[i] + max(dp[i - 2][0], dp[i - 2][1]);
        } else {
            dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]);
            dp[i][1] = v[i] + max(dp[i - 2][0], dp[i - 2][1]);
        }
    }
    cout << max(dp[n][0], dp[n][1]) << endl;

    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>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

i64 dp[200001][3][2];

void solve() {
  int n;
  cin >> n;
  vi32 a(n);
  cin >> a;
  repc(i, n) rep(j, 3) rep(k, 2) {
    dp[i][j][k] = -1e18;
  }
  dp[0][1][0] = 0;
  rep(i, n) rep(j, 3) rep(k, 2) rep(l, 2) {
    if (dp[i][j][k] == -1e18) continue;
    if (k == 1 && l == 1) {
      continue;
    }
    if (i & 1) {
      if (l == 0) {
        if (j == 0) continue;
        amax(dp[i + 1][j - 1][0], dp[i][j][k]);
      } else {
        amax(dp[i + 1][j][1], dp[i][j][k] + a[i]);
      }
    } else {
      if (l == 0) {
        amax(dp[i + 1][j][0], dp[i][j][k]);
      } else {
        if (j == 2) continue;
        amax(dp[i + 1][j + 1][1], dp[i][j][k] + a[i]);
      }
    }
  }
  i64 ans = -1e18;
  rep(k, 2) amax(ans, dp[n][1][k]);
  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;
using namespace __detail;

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define fork(i,n) for(ll i=0; i<(n); i++)
#define forn for(ll i=0; i<(n); i++)
#define fori(i,k,n) for(ll i=k; i<(n); i++) 
#define all(x) (x).begin(),(x).end()
#define en '\n'
#define FILL(x,v) memset(x,v,sizeof(x))
#define pb push_back
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

void solve(){
	ll n;
	cin >> n;
	vll a(n), pre(n,0), dp(n+1, 0);
	forn{
		cin >> a[i];
		pre[i] = (i>1 ? pre[i-2] : 0) + a[i];
	}
	for(ll i=2; i<=n; i++){
		if(i&1L){//odd
			dp[i]=max(dp[i-2]+a[i-1], dp[i-1]);
		} else{
			dp[i]=max(pre[i-2], dp[i-2]+a[i-1]);
		}
	}
	print(dp);
	cout << dp[n] << en;
}

int main(){
    ios::sync_with_stdio(0);
	cin.tie(0);
    cout.tie(0);
 
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
    int t = 1;
    while(t--)
        solve();
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:37:9: error: 'print' was not declared in this scope; did you mean 'rint'?
   37 |         print(dp);
      |         ^~~~~
      |         rint
Language: C

/* * * * * * * * * * * **
*                      *
*	   saurabh8522	   *
*	  I will handle	   *
*		   IT.		   *
*                      *
* * * * * * * * * * * **/
#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ld long double
#define zero(a) memset((a),0,sizeof((a)))
#define one(a) memset((a),1,sizeof((a)))
#define minus(a) memset((a),-1,sizeof((a)))
#define all(g) g.begin(),g.end()
#define ppb pop_back
using namespace std;
typedef long long int ll;
#define MOD 1000000007
ll extgcd(ll a,ll b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extgcd(b,a%b,y,x);y-=a/b*x;return g;}}
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
ll numdigit(ll n){return floor(log10(n)) + 1;}
bool isPowerTwo (ll x) { return x && (!(x&(x-1))); }
const ll INF=1e16;
vector<ll>v(100005,-INF);
ll dp[100005][2][2];
bool vis[100005][2][2];
ll n;
ll find(ll pos,ll flag1,ll flag2){
	// cout<<pos<<" "<<flag1<<" "<<flag2<<endl;
	if(pos>=n) return 0ll;
	ll &ans=dp[pos][flag1][flag2];
	if(vis[pos][flag1][flag2]) return ans;
	vis[pos][flag1][flag2]=1;
	if(flag2==0){
		if(pos==n-3){
			if(flag1==0) return ans=max(v[pos],max(v[pos+1],v[pos+2]));
			else         return ans=max(v[pos+1],v[pos+2]);
		}
		if(flag1==0){
			ll ans1=find(pos+2,0ll,1ll);
			ll ans2=v[pos]+find(pos+2,0ll,0ll);
			ll ans3=v[pos+1]+find(pos+2,1ll,0ll);
			ans=max(ans1,max(ans2,ans3));
		}
		else{
			ll ans1=find(pos+2,0ll,1ll);
			ll ans2=v[pos+1]+find(pos+2,1ll,0ll);
			ans=max(ans1,ans2);
		}
	}
	else{
		if(flag1==0){
			ll ans1=v[pos]+find(pos+2,0ll,1ll);
			ll ans2=v[pos+1]+find(pos+2,1ll,1ll);
			ans=max(ans1,ans2);
		}
		else{
			ans=v[pos+1]+find(pos+2,1ll,1ll);
		}	
	}
	// cout<<pos<<" "<<flag1<<" "<<flag2<<" "<<ans<<endl;
	return ans;
} 
int main(){
	FastRead;
	ll t=1;
	while(t--){
		cin>>n;
		for(ll i=0;i<n;i++){
			cin>>v[i];
		}
		for(ll i=0;i<n;i++){
			vis[i][0][0]=vis[i][0][1]=0;
			vis[i][1][0]=vis[i][1][1]=0;
		}
		if(n&1){
			cout<<find(0,0ll,0ll)<<endl;
		}
		else{
			cout<<find(0,0ll,1ll)<<endl;
		}
	}
}

Compiler output:
main.c:8:9: fatal error: bits/stdc++.h: No such file or directory
    8 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
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, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
#define chmax(a, b) a = max(a, b)
using ll = long long;

ll dp[200009][9];

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  int k=1+n%2;
  rep(i,n+1)rep(j,k+1)dp[i][j]=-INF;
  dp[0][0]=0;
  rep(i,n){
    rep(j,k+1){
      chmax(dp[i+1][j+1],dp[i][j]);
      ll now=dp[i][j];
      if((i+j)%2==0)now+=a[i];
      chmax(dp[i+1][j],now);
    }
  }
  cout<<dp[n][k]<<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

//Link : https://codeforces.com/contest/1253

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005
#define mod 998244353
/*
#include <limits.h>
INT_MAX
LLONG_MAX
*/
int a[N];
ll odd[N],even[N];
void solve() {
  int n;
  scanf("%d ", &n);
  for(int i=1;i<=n;++i) {
    scanf("%d  ", &a[i]);
  }
  for(int i=1;i+1<=n;i+=2) {
    if(i==1) {
      even[i] = a[i];
      even[i+1] = a[i+1];
    } else {
      even[i+1] = a[i+1] + max(even[i-1],even[i-2]);
      even[i] = a[i] + even[i-2];
    }
  }
  for(int i=3;i<=n;i+=2) {
    odd[i] = max(even[i-1], a[i] + odd[i-2]);
  }
  printf("%lld\n", max(odd[n],even[n]));
}

int main() {
    //freopen("input.txt","r",stdin);
    solve();
    return 0;
}


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

n = int(input())
A = list(map(int,input().split()))
if n%2 == 0:
    dp_l = [0]*(n//2+1)
    dp_r = [0]*(n//2+1)
    for i in range(n//2):
        dp_l[i+1] = A[2*i]
        dp_r[i+1] = A[2*i+1]
    for i in range(len(dp_l)-1):
        dp_l[i+1] += dp_l[i]
        dp_r[i+1] += dp_r[i]
    ans = 0
    for i in range(n//2+1):
        ans = max(ans,dp_r[n//2]-dp_r[i]+dp_l[i])
    print(ans)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n = int(input())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:5: error: expected expression before 'int'
    1 | n = int(input())
      |     ^~~
Language: C

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

typedef long long ll;

const ll inf=1e18;

int main(){
    int N; cin >> N;
    ll a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    ll res=0;
    for(int i=1;i<N-1;i+=2){
        res+=a[i];
    }
    ll dp1[N+1]={};
    ll dp2[N+1]={};
    dp1[1]=a[0];
    dp2[N-1]=a[N-1];
    for(int i=2;i<=N;i++){
        dp1[i]+=dp1[i-2]+a[i-1];
    }
    for(int i=N-2;i>=0;i--){
        dp2[i]+=dp2[i+2]+a[i];
    }
    /*
    for(int i=0;i<=N;i++){
        cout << dp1[i] << " ";
    }
    cout << endl;
    for(int i=0;i<=N;i++){
        cout << dp2[i] << " ";
    }
    cout << endl;
    */
    if(N%2==0){
        cout << max(dp1[N],dp1[N-1]) << endl;
    }else{
        ll ans=-1*inf;
        for(int i=1;i<N;i++){
            ans=max(dp1[i-1]+dp2[i+1],ans);
        }
        cout << max(ans,res) << 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 <bits/stdc++.h>

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(random_device{}());
template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vector<int> a(n);
    for(auto& it:a) cin>>it;
    int buf=(n&1?3:2);
    vector<vector<ll>> dp(n+1,vector<ll>(buf,-1e18));
    dp[0][0]=0;
    forn(i,n){
        forn(j,buf){
            dp[i+1][j]=max(dp[i+1][j],dp[i][j]+((i+j)%2==0?a[i]:0));
            if(j+1<buf) dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]);
        }
    }
    cout<<dp[n][buf-1];
    return 0;
}

#include <bits/stdc++.h>

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(random_device{}());
template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vector<int> a(n);
    for(auto& it:a) cin>>it;
    int buf=(n&1?3:2);
    vector<vector<ll>> dp(n+1,vector<ll>(buf,-1e18));
    dp[0][0]=0;
    forn(i,n){
        forn(j,buf){
            dp[i+1][j]=max(dp[i+1][j],dp[i][j]+((i+j)%2==0?a[i]:0));
            if(j+1<buf) dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]);
        }
    }
    cout<<dp[n][buf-1];
    return 0;
}



Compiler output:
a.cc:49:11: error: redefinition of 'const int INF'
   49 | const int INF = 0x3f3f3f3f;
      |           ^~~
a.cc:13:11: note: 'const int INF' previously defined here
   13 | const int INF = 0x3f3f3f3f;
      |           ^~~
a.cc:50:9: error: redefinition of 'std::mt19937 gen'
   50 | mt19937 gen(random_device{}());
      |         ^~~
a.cc:14:9: note: 'std::mt19937 gen' previously declared here
   14 | mt19937 gen(random_device{}());
      |         ^~~
a.cc:51:33: error: redefinition of 'template<class ... Args> void write(Args ...)'
   51 | template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}
      |                                 ^~~~~
a.cc:15:33: note: 'template<class ... Args> void write(Args ...)' previously declared here
   15 | template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}
      |                                 ^~~~~
a.cc:53:5: error: redefinition of 'int main()'
   53 | int main() {
      |     ^~~~
a.cc:17:5: note: 'int main()' previously defined here
   17 | int main() {
      |     ^~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653

int main(){
	ll n, x, ans; cin >> n;
	if (n%2==0){
		vector<ll> a(n/2+1);
		vector<ll> bl(n/2+1);
		vector<ll> b(n/2+1);
		REP(i,n){
			cin >> x;
			if (i%2==0) a[i/2+1] = a[i/2]+x;
			else bl[i/2+1] = bl[i/2]+x;
		}
		REP(i,n/2+1) b[i] = bl[n/2]-bl[i];
		ans = a[0]+b[0];
		FOR(i,1,n/2){
			ans = max(ans, a[i]+b[i]);
		}
		cout << ans << endl;
	}
	else{
		vector<ll> a(n);
		REP(i,n) cin >> a[i];
		vector<vector<ll>> dp(n/2,vector<ll>(2));
		dp[0][0] = a[0];
		dp[0][1] = a[1];
		FOR(i,1,n/2-1){
			dp[i][0] = dp[i-1][0]+a[2*i];
			dp[i][1] = max(dp[i-1][0],dp[i-1][1])+a[2*i+1];
		}
		vector<ll> evenl(n/2+1);
		FOR(i,1,n/2) evenl[0] += a[2*i];
		FOR(i,1,n/2) evenl[i] = evenl[i-1]-a[2*i];
		ans = evenl[0];
		FOR(i,2,n/2+1){
			ll maxdp = max(dp[i-2][0], dp[i-2][1]);
			ans = max(ans, maxdp+evenl[i-1]);
		}
		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;

#define ll long long
ll sum[200001], a[200001], dp[200001];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	for(int i=1;i<=n;i++) {
		cin >> a[i];
		sum[i] = (i > 2 ? sum[i-2] : 0) + a[i];
	}

	for(int i=2;i<=n;i++) {
		if(i&1) dp[i] = max(dp[i-1], dp[i-2]+a[i]);
		else    dp[i] = max(sum[i-1], dp[i-2]+a[i]);
	}
	cout << dp[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++

// ABC162A.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>

void solve_A() {
	int N; std::cin >> N;
	int mod_1 = N % 10;
	N /= 10;
	int mod_2 = N % 10;
	N /= 10;
	int mod_3 = N % 10;
	N /= 10;
	if (mod_1 == 7 || mod_2 == 7 || mod_3 == 7) {
		std::cout << "Yes";
	}
	else {
		std::cout << "No";
	}

}

void solve_B() {
	int N;
	std::cin >> N;

	long long int sum = 0;
	for (int i = 1; i <= N; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			sum += i;
		}
	}
	std::cout << sum;
}

int gcd(int y, int x) {
	if (y < x) std::swap(x, y);
	int r;
	while (x > 0) {
		r = y % x;
		y = x;
		x = r;
	}

	return y;

}

void solve_C(){
	int K;
	std::cin >> K;

	int sum = 0;
	for (int i = 1; i <= K; i++) {
		for (int j = 1; j <= K; j++) {
			for (int k = 1; k <= K; k++) {
				sum += gcd(gcd(i, j), k);
			}
		}
	}

	std::cout << sum;

}

#include <string>
void solve_D() {
	int n;
	std::cin >> n;
	std::string s;
	std::cin >> s;
	long long r_count = 0, g_count = 0, b_count = 0;
	for(int i = 0; i < n;i++) {
		if (s[i] == 'R') r_count++;
		else if (s[i] == 'G') g_count++;
		else b_count++;
	}
	long long ans = r_count * g_count * b_count;
	for (int distance = 1; distance < n + 1; distance++) {
		for (int j = 0; j + 2 * distance < n; ++j) { 
			if (s[j] != s[j + distance] && s[j + distance] != s[j + 2 * distance] && s[j] != s[j + 2 * distance])
				ans -= 1;
		}
	}
	std::cout << ans << std::endl;
}

const long long MOD = 1e9 + 7;
long long pwr(long long a, long long n) {
	a %= MOD;
	long long r = 1;
	for (; n > 0; n >>= 1) {
		if (n & 1) r = r * a % MOD;
		a = a * a % MOD;
	}
	return r;
}

void solve_E() {
	int n, k; std::cin >> n >> k;
	long long  answer = 0;
	const int N = 1e5 + 10;
	long long ways[N];
	for (int x = k; x >= 1; x--) {
		int m = k / x;
		ways[x] = pwr(m, n);
		for (int gg = 2 * x; gg <= k; gg += x) {
			ways[x] -= ways[gg];
		}
		ways[x] %= MOD;
		ways[x] += MOD;
		ways[x] %= MOD;

		answer += (ways[x] * x) % MOD;
	}
	answer %= MOD;
	std::cout << answer << std::endl;
}

#include<algorithm>
void solve_F() {
	int n;
	int A[200001], dp[200001], sum[200001];
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> A[i];
		if(i==1){
			sum[i] = A[i];
			continue;
		}
		sum[i] = sum[i - 2] + A[i];
	}

	for (int i = 2; i <= n; i++) {
		if (i%2==0) {
			dp[i] = std::max(dp[i - 2] + A[i], sum[i-1]);
		}
		else if (i%2 == 1) {
			dp[i] = std::max(dp[i - 2] + A[i], dp[i-1]);
		}
	}

	std::cout << dp[n] << std::endl;

}


int main()
{
	std::ios::sync_with_stdio(false);
	//solve_A();
	//solve_B();
	//solve_C();
	//solve_D();
	//solve_E();
	solve_F();
    return 0;
}



Compiler output:
a.cc:4:10: fatal error: stdafx.h: No such file or directory
    4 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <string.h>
#include <string>
#include <complex>
using namespace std;

#define INT_max 2147483647


typedef long long ll;
typedef long double ld;


int main(){
	int n;
	cin>>n;
	if(n < 4){
		int ans;
		for(int i = 0;i < n;i++){
			int t;
			cin>>t;
			if(i == 0) ans = t;
			else ans = max(ans,t);
		}
		cout<<ans;
		return 0;
	}
	vector<ll> ans1(n,0);//记录的是当前包含i/2个数的最大和 
	vector<ll> ans2(n,0);//记录的是当前包含（i+1）/2个数的最大和
	for(int i = 0;i < n;i++){
		ll t;
		cin>>t;
		if(i < 2){
			ans2[i] = t;
		}
		else{
			if(i%2) ans2[i] = max(ans2[i-2],ans2[i-3]) + t;
			else ans2[i] = ans2[i-2]+t; 
		}
		if(i < 3){
			if(i == 2) ans1[i] = max(ans1[0],t);
			else ans1[i] = t;
		}
		else{
			if(i%2) ans1[i] = max(ans2[i-3],ans1[i-2]) + t;
			else ans1[i] = max(ans1[i-3],ans1[i-2]) + t;
		}
	}
	if(n%2) cout<<max(ans1[n-1],ans1[n-2]);
	else cout<< max(ans2[n-1],ans2[n-2]);
	return 0;
}




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

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <string.h>
#include <string>
#include <complex>
using namespace std;

#define INT_max 2147483647


typedef long long ll;
typedef long double ld;


int main(){
	int n;
	cin>>n;
	if(n < 4){
		int ans;
		for(int i = 0;i < n;i++){
			int t;
			cin>>t;
			if(i == 0) ans = t;
			else ans = max(ans,t);
			cout<<ans<<endl;
			return 0;
		}
	}
	vector<ll> ans1(n,0);//记录的是当前包含i/2个数的最大和 
	vector<ll> ans2(n,0);//记录的是当前包含（i+1）/2个数的最大和
	for(int i = 0;i < n;i++){
		ll t;
		cin>>t;
		if(i < 2){
			ans2[i] = t;
		}
		else{
			if(i%2) ans2[i] = max(ans2[i-2],ans2[i-3]) + t;
			else ans2[i] = ans2[i-2]+t; 
		}
		if(i < 3){
			if(i == 2) ans1[i] = max(ans1[0],t);
			else ans1[i] = t;
		}
		else{
			if(i%2) ans1[i] = max(ans2[i-3],ans1[i-2]) + t;
			else ans1[i] = max(ans1[i-3],ans1[i-2]) + t;
		}
	}
	if(n%2) cout<<max(ans1[n-1],ans1[n-2])<<endl;
	else cout<< max(ans2[n-1],ans2[n-2])<<endl;
	return 0;
}




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

#include <iostream>
#include <vector>
#include <queue>
#include <iostream>
#include <bitset>
#include <cmath>


using namespace std;
typedef long long LL;

int main() {

    LL ans = 0;
    int N; cin >> N;
    LL a[200000+1];
    LL dp[3][200000+1];

    for(int i = 1; i <=N; i++){
        cin >> a[i];
    }

    // N % 2 == 0
    for(int i = 0; i < (2+N % 2);i++){
        for(int j =1; j <= N;j+=2){
            if(i==0 && j==1){
                dp[i][i+j] = a[i+j];
                continue;
            }
            if(i==0){
                dp[i][i+j] = dp[i][i+j-2]+a[i+j];
                continue;
            }
            if(j==0){
                dp[i][i+j] = a[i+j];
                continue;
            }
            dp[i][i+j] = max(dp[i][i+j-2]+a[i+j], dp[i-1][i+j-3]+a[i+j]);
        }
        // cout << N % 2 << endl;
    }
 
    

    // a[i];
    for(int i = 0; i <=2; i++){
        for(int j = 0; j <=N; j++){
            // cout << dp[i][j] << " ";
        }
        // cout << endl;
    }
    for(int i=0; i <=2;i++){
        // cout << dp[i][i+N-((N+1)%2)] << endl;
        ans = max(ans,dp[i][i+N-((N+1)%2)]);
    }

    cout << ans << endl;
}

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

var
	N,i,a,j,ni,nj:Longint;
	dp:Array[0..200000,0..3]of int64;
begin
read(N);
for i:=0 to N do for j:=0 to 2 do dp[i,j]:=-1000000000000000000;
dp[0,0]:=0;
for i:=0 to N-1 do begin
read(a);
for j:=0 to 2 do begin
if dp[i+1,j+1]<dp[i,j]then dp[i+1,j+1]:=dp[i,j];
ni:=i+2;if ni>N then ni:=N;
nj:=j;if i+2=N then inc(nj);
if dp[ni,nj]<dp[i,j]+a then dp[ni,nj]:=dp[i,j]+a;
end;
end;
writeln(dp[N,1+N mod 2]);
end.


Compiler output:
a.cc:3:18: error: too many decimal points in number
    3 |         dp:Array[0..200000,0..3]of int64;
      |                  ^~~~~~~~~
a.cc:3:28: error: too many decimal points in number
    3 |         dp:Array[0..200000,0..3]of int64;
      |                            ^~~~
a.cc:1:1: error: 'var' does not name a type
    1 | var
      | ^~~
a.cc:3:11: error: found ':' in nested-name-specifier, expected '::'
    3 |         dp:Array[0..200000,0..3]of int64;
      |           ^
      |           ::
a.cc:3:9: error: 'dp' does not name a type
    3 |         dp:Array[0..200000,0..3]of int64;
      |         ^~
a.cc:4:1: error: 'begin' does not name a type
    4 | begin
      | ^~~~~
a.cc:6:1: error: expected unqualified-id before 'for'
    6 | for i:=0 to N do for j:=0 to 2 do dp[i,j]:=-1000000000000000000;
      | ^~~
a.cc:7:1: error: 'dp' does not name a type
    7 | dp[0,0]:=0;
      | ^~
a.cc:8:1: error: expected unqualified-id before 'for'
    8 | for i:=0 to N-1 do begin
      | ^~~
a.cc:10:1: error: expected unqualified-id before 'for'
   10 | for j:=0 to 2 do begin
      | ^~~
a.cc:12:1: error: 'ni' does not name a type
   12 | ni:=i+2;if ni>N then ni:=N;
      | ^~
a.cc:12:9: error: expected unqualified-id before 'if'
   12 | ni:=i+2;if ni>N then ni:=N;
      |         ^~
a.cc:13:1: error: 'nj' does not name a type
   13 | nj:=j;if i+2=N then inc(nj);
      | ^~
a.cc:13:7: error: expected unqualified-id before 'if'
   13 | nj:=j;if i+2=N then inc(nj);
      |       ^~
a.cc:14:1: error: expected unqualified-id before 'if'
   14 | if dp[ni,nj]<dp[i,j]+a then dp[ni,nj]:=dp[i,j]+a;
      | ^~
a.cc:15:1: error: 'end' does not name a type
   15 | end;
      | ^~~
a.cc:16:1: error: 'end' does not name a type
   16 | end;
      | ^~~
a.cc:17:8: error: expected constructor, destructor, or type conversion before '(' token
   17 | writeln(dp[N,1+N mod 2]);
      |        ^
a.cc:18:1: error: 'end' does not name a type
   18 | end.
      | ^~~
Language: C

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
ll a[N],dp[N],sum[N];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1,x;i<=n;i++){
		scanf("%lld",&a[i]);
		sum[i]=(i>2?sum[i-2]:0)+a[i];
	}
	for(int i=2;i<=n;i++)
	{
		if(i&1) dp[i]=max(dp[i-1],dp[i-2]+a[i]);//i为奇数的情况 选和不选该数. 
		else dp[i]=max(sum[i-1],dp[i-2]+a[i]);//i为偶数的情况 选和不选该数. 
	}
	printf("%lld\n",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<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
ll dp[200010][5];
const ll INF = -1e15;
ll a[200010],n;
ll func(ll here, ll ch) {
	if (here >= n)
	{
		if (ch == 0)
			return 0;
		else
			return INF;
	}
	if (ch < 0)return INF;
	ll& ret = dp[here][ch];
	if (ret != -1)return ret;
	ret = INF;
	ret = max(ret, func(here + 2, ch) + a[here]);
	ret = max(ret, func(here + 1, ch - 1));
	return ret;
}
int main()
{
	memset(dp, -1, sizeof(dp));
	scanf("%lld", &n);
	for (int i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	ll sum = 0;
	sum = n / 2;
	sum += sum;
	sum--;
	printf("%lld", func(0, n-sum));
}

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

#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int) n; i++)
using ll = long long;
template <class T>
using vt = std::vector<T>;
using vvi = std::vector<vt<int>>;

int main(){
  int n;
  std::cin >> n;
  int number = n/2;
  vt<std::pair<int,int>> a(n);
  rep(i,n) {
    std::cin >> a[i].first;
    a[i].second = i;
  }

  sort(a.rbegin(),a.rend());
  vt<bool> f(n+2);
  int cnt = 0;
  ll ans1 = 0;
  rep(i,n) {
    int k = a[i].second;
    if(f[k] == false && f[k+2] == false) {
      f[k+1] = true;
      ans1 += a[i].first;
      ++cnt;
    }
    if(cnt == number)
      break;
  }

  std::cout << ans1 << '\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>
using namespace std;
#define int long long
const int N=200005;
ll sum[N],d[N],a[N],n;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++)
	{
        if(i%2==0) sum[i]=sum[i-1]+a[i];
        else sum[i]=sum[i-1];
    }
    for(int i=2;i<=n;i++)
	{
        if(i%2==1) d[i]=max(d[i-2]+a[i],d[i-1]);
        else d[i]=max(d[i-2]+a[i],sum[i-1]);
    }
    cout<<d[n]<<endl;
    return 0;
}

Compiler output:
a.cc:5:1: error: 'll' does not name a type
    5 | ll sum[N],d[N],a[N],n;
      | ^~
cc1plus: error: '::main' must return 'int'
a.cc: In function 'int main()':
a.cc:7:10: error: 'n' was not declared in this scope
    7 |     cin>>n;
      |          ^
a.cc:8:32: error: 'a' was not declared in this scope
    8 |     for(int i=1;i<=n;i++) cin>>a[i];
      |                                ^
a.cc:11:20: error: 'sum' was not declared in this scope
   11 |         if(i%2==0) sum[i]=sum[i-1]+a[i];
      |                    ^~~
a.cc:11:36: error: 'a' was not declared in this scope
   11 |         if(i%2==0) sum[i]=sum[i-1]+a[i];
      |                                    ^
a.cc:12:14: error: 'sum' was not declared in this scope
   12 |         else sum[i]=sum[i-1];
      |              ^~~
a.cc:16:20: error: 'd' was not declared in this scope
   16 |         if(i%2==1) d[i]=max(d[i-2]+a[i],d[i-1]);
      |                    ^
a.cc:16:36: error: 'a' was not declared in this scope
   16 |         if(i%2==1) d[i]=max(d[i-2]+a[i],d[i-1]);
      |                                    ^
a.cc:17:14: error: 'd' was not declared in this scope
   17 |         else d[i]=max(d[i-2]+a[i],sum[i-1]);
      |              ^
a.cc:17:30: error: 'a' was not declared in this scope
   17 |         else d[i]=max(d[i-2]+a[i],sum[i-1]);
      |                              ^
a.cc:17:35: error: 'sum' was not declared in this scope
   17 |         else d[i]=max(d[i-2]+a[i],sum[i-1]);
      |                                   ^~~
a.cc:19:11: error: 'd' was not declared in this scope
   19 |     cout<<d[n]<<endl;
      |           ^
Language: C++

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

const long INF = 1L << 60;
int a[200010];
long dp[200010][4];

template<class T> inline bool chmax(T &a, const T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

int main(){
	int n, a;
	scanf("%d", &n);
	int k = n % 2 + 1;
	for(int i = 0; i <= n; i++)
		for(int j = 0; j <= k; j++)
			dp[i][j] = -INF;
	dp[0][0] = 0;
	for(int i = 0; i < n; i++) {
		scanf("%d", &a);
		for(int j = 0; j <= k; j++) {
			chmax(dp[i+1][j+1], dp[i][j]);
				chmax(dp[i+1][j], dp[i][j]);
			else
				chmax(dp[i+1][j], dp[i][j] + a);
		}
	}
	printf("%ld\n", dp[n][k]);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:25: error: 'else' without a previous 'if'
   29 |                         else
      |                         ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

class Solution {
public:
	void solve() {
		int n;
		cin >> n;
		vector<long long> a(n, 0);
		for (int i = 0; i < n; i++) cin >> a[i];
		int skip = (n % 2 == 0) ? 1 : 2;
		vector<vector<vector<long long>>> dp(n + 1, vector<vector<long long>>(skip + 1, vector<long long>(2, -(1LL << 60))));
		dp[0][0][0] = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j <= skip; j++) {
				// use
				dp[i + 1][j][1] = max(dp[i + 1][j][1], dp[i][j][0] + a[i]);
				// skip
				if (j != skip) dp[i + 1][j + 1][0] = max(dp[i + 1][j + 1][0], dp[i][j][0]);
				// force skip(not counted)
				dp[i + 1][j][0] = max(dp[i + 1][j][0], dp[i][j][1]);
			}
		}
		cout << max(max(max(dp[n][skip - 1][0], dp[n][skip - 1][1])), max(dp[n][skip][0], dp[n][skip][1])) << endl;

		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Compiler output:
a.cc: In member function 'void Solution::solve()':
a.cc:25:32: error: no matching function for call to 'max(const long long int&)'
   25 |                 cout << max(max(max(dp[n][skip - 1][0], dp[n][skip - 1][1])), max(dp[n][skip][0], dp[n][skip][1])) << endl;
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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: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:   candidate expects 2 arguments, 1 provided
/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, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:25:32: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   25 |                 cout << max(max(max(dp[n][skip - 1][0], dp[n][skip - 1][1])), max(dp[n][skip][0], dp[n][skip][1])) << endl;
      |                             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C

#include <bits/stdc++.h>
#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;
 
ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}
using namespace std;

ll powerm(ll base,ll exp,ll mod) 
{ll ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}

void solve()
{
    ll n;
    cin>>n;
    ll a[n+1];
    for(ll i=1; i < n+1; i++) cin >> a[i];
    ll ps[n+1]={0},dp[n+1]={0};
    dp[0] = 0;
	dp[1] = 0;
    ps[1] = a[1];
    for(ll i=3;i<=n;i+=2) 
	{
		ps[i] = ps[i-2] + a[i];
	//	cout << ps[i] << " ";
	}
    for(ll i = 2; i < n+1; i++)
	{
        if (i&1)
		{
            dp[i] = max(dp[i-1],a[i]+dp[i-2]);
        }
        else
		{
            dp[i] = max(dp[i-2] + a[i],ps[i-1]);
        }
	}
    cout << dp[n] << endl;
}
int main() 
{  
	fast;
	solve();
}

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>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 

#define M 200010

ll n,a[M];
ll dp[M][2];
ll f(ll i,ll ok){
	if(i>=n)return 0;
	if(dp[i][ok]!=-1)return dp[i][ok];
	ll ans=f(i+2,ok)+a[i];
	if(ok)ans=max(ans,f(i+3,!ok)+a[i]);
	return dp[i][ok]=ans;
}
ll dp1[M][3][2];
ll f(ll i,ll f1,ll f2){
	if(i>=n){
		if(f1==2 and !f2)return 0;
		if(f1<2 and f2)return 0;
		return -1*inf;
	}
	if(dp1[i][f1][f2]!=-1)return dp1[i][f1][f2];
	ll ans=f(i+2,f1,f2)+a[i];
	if(f1)ans=max(ans,f(i+3,f1-1,f2)+a[i]);
	if(f2)ans=max(ans,f(i+4,f1,!f2)+a[i]);
	return dp1[i][f1][f2]=ans;
}
int main(){
	IOS;
	tihs;
	
	memset(dp,-1,sizeof(dp));
	memset(dp1,-1,sizeof(dp1));

	cin>>n;
	rep(i,0,n)cin>>a[i];
	ll ans=0,i=1;
	while(i<n)ans+=a[i],i+=2;
	if(n%2==0){
		cout<<max(ans,f(0,1));
		return 0;
	}
	ll sum=0;i=2;
	while(i<n)sum+=a[i],i+=2;
	ans=max(ans,sum);
	ans=max(ans,f(1,1));
	cout<<max(ans,f(0,2,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.
Language: C

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
const ll MAX_N = 2e5;
ll N, A[MAX_N], dp[MAX_N], psm[MAX_N];
int main() {
	
	cin >> N;
	REP(i, N) {
		cin >> A[i];
	}
	psm[0] = A[0];
	for (ll i = 2; i < N; i += 2) {
		psm[i] = psm[i - 2] + A[i];
	}
	dp[0] = 0;
	dp[1] = max(A[0], A[1]);
	FOR(i, 2, N) {
	//	if (i % 2 == 0) {
			dp[i] = max(dp[i - 1], A[i] + dp[i - 2]);
	//	}
	//	else {
	//		dp[i] = max(psm[i - 1], A[i] + dp[i - 2]);
		//}
	}
	cout << dp[N - 1] << endl;
}

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<algorithm>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
const ll MAX_N = 2e5;
ll N, A[MAX_N], dp[MAX_N], psm[MAX_N];
int main() {
	cin.tie(0);
	cin.sync_with_stdio(false);
	cin >> N;
	REP(i, N) {
		cin >> A[i];
	}
	psm[0] = A[0];
	for (ll i = 2; i < N; i += 2) {
		psm[i] = psm[i - 2] + A[i];
	}
	dp[0] = 0;
	dp[1] = max(A[0], A[1]);
	FOR(i, 2, N) {
	//	if (i % 2 == 0) {
			dp[i] = max(dp[i - 1], A[i] + dp[i - 2]);
	//	}
	//	else {
	//		dp[i] = max(psm[i - 1], A[i] + dp[i - 2]);
		//}
	}
	cout << dp[N - 1] << endl;
}

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

#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
const ll MAX_N = 2e5;
ll N, A[MAX_N], dp[MAX_N], psm[MAX_N];
int main() {
	cin.tie(0);
	cin.sync_with_stdio(false);
	cin >> N;
	REP(i, N) {
		cin >> A[i];
	}
	psm[0] = A[0];
	for (ll i = 2; i < N; i += 2) {
		psm[i] = psm[i - 2] + A[i];
	}
	dp[0] = 0;
	dp[1] = max(A[0], A[1]);
	FOR(i, 2, N) {
	//	if (i % 2 == 0) {
			dp[i] = max(dp[i - 1], A[i] + dp[i - 2]);
	//	}
	//	else {
	//		dp[i] = max(psm[i - 1], A[i] + dp[i - 2]);
		//}
	}
	cout << dp[N - 1] << endl;
}

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

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

typedef long long ll;
#define endl "\n"
#define deb(x) cerr << #x << ":" << x << "\n"

vector<ll> dp;
vector<int> v;
int n;

void solve(){
    cin>>n;
    v.resize(n+1);
    dp.resize(n+1);
    for(int i=1;i<=n;i++)cin>>v[i];
    dp[1]=v[1];
    dp[2]=v[2];
    for(int i=3;i<=n;i++){
        if(i&1)dp[i]=dp[i-2]+v[i];
        else dp[i]=max(dp[i-2],dp[i-3])+v[i];
    }
    if(n&1){
        ll bj=v[n],ans=max(dp[n-1],dp[n-2]);
        for(int i=n-2;i>=3;i-=2){
            ans=max(ans,bj+max(dp[i-1],dp[i-2]));
            bj+=v[i];
        }
        cout<<max(ans,bj);
    }else cout<<max(dp[n-1],dp[n]);;

}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    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 REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

static const ll INF = 1e17;

ll dp[200005][4];

int main(){
  int N;
  cin >> N;
  vector<ll> v;
  rep(i,N){
    ll a;
    cin >> a;
    v.push_back(a);
  }

  rep(i,200005){
    rep(j,4){
      dp[i][j] = -INF;
    }
  }

  dp[0][0] = 0;

  int K = N%2 + 1;
  rep(i,N){
    rep(j,K+1){
      // xを1つ挿入
      dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]);
      // oまたはxを挿入
      if((i+j)%2 == 0){
        dp[i+1][j] = max(dp[i+1][j], dp[i][j] + v[i]);
      }else{
        dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
      }
    }
  }
  
  cout << dp[N][K] << 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<iostream>
#include<algorithm>
#include<math.h>
#include<cstring>
#include<vector>

using namespace std;

#define long long long
#define ft(i, a, b) for (int i = (long)a ; i <= (long)b ; i++)
#define fd(i, a, b) for (int i = (long)a ; i >= (long)b ; i--)

const int mxN = 1e5 + 5;
const long oo = 1e15;

long n;
long a[mxN] , dp[mxN][mxN];
bool mark[mxN][mxN];

long cal(int idx , int cnt) {
    if (idx > n) {
        if (cnt == n / 2) return 0;
        return -oo;
    }
    if (mark[idx][cnt]) return dp[idx][cnt];
    mark[idx][cnt] = true;

    dp[idx][cnt] = max(cal(idx + 1 , cnt) , cal(idx + 2 , cnt + 1) + a[idx]);
    return dp[idx][cnt];
}

void Solve() {
    cout << cal(1 , 0);
}   

void FastInput() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen(".inp", "r", stdin);
    //freopen(".out", "w", stdout);
}

void Input() {
    cin >> n;
    ft(i , 1 , n) cin >> a[i];
}

int main() {
    FastInput();
    Input();
    Solve();
}

Compiler output:
/tmp/ccu1SG3R.o: in function `cal(int, int)':
a.cc:(.text+0x70): relocation truncated to fit: R_X86_64_PC32 against symbol `mark' defined in .bss section in /tmp/ccu1SG3R.o
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `mark' defined in .bss section in /tmp/ccu1SG3R.o
collect2: error: ld returned 1 exit status