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

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
//#define S second
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
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;
}

int mod_pow(int x, int n, int mm) {
    int res = 1;
    while(n > 0) {
        if(n & 1) res = res * x % mm;
        x = x * x % mm;
        n >>= 1;
    }
    return res;
}
int extgcd(int a, int b, int &x, int &y) {
    int d = a;
    if(b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}
int mod_inverse(int a, int mm) {
    int x, y;
    extgcd(a, mm, x, y);
    return (mm + x % mm) % mm;
}
signed main() {
    int N;
    cin >> N;
    int A[N];
    rep(i, N) cin >> A[i];
    if(N % 2 == 0) {
        vector<vector<int>> dp(2, vector<int>(N, -INF));
        dp[0][0] = A[0];
        dp[1][1] = A[1];
        for(int i = 1; i < N; i++) {
            if(i > 1) chmax(dp[0][i], dp[0][i - 2] + A[i]);
            if(i > 1) chmax(dp[1][i], dp[1][i - 2] + A[i]);
            if(i > 2) chmax(dp[1][i], dp[0][i - 3] + A[i]);
            chmax(dp[1][i], dp[0][i - 1]);
        }
        cout << max(dp[1][N - 1], dp[0][N - 1]) << endl;

    } else {
        vector<vector<int>> dp(3, vector<int>(N, -INF));
        dp[0][0] = A[0];
        dp[1][1] = A[1];
        dp[2][2] = A[2];
        for(int i = 1; i < N; i++) {
            if(i > 1) chmax(dp[0][i], dp[0][i - 2] + A[i]);
            if(i > 1) chmax(dp[1][i], dp[1][i - 2] + A[i]);
            if(i > 2) chmax(dp[1][i], dp[0][i - 3] + A[i]);
            chmax(dp[1][i], dp[0][i - 1]);
            if(i > 1) chmax(dp[2][i], dp[2][i - 2] + A[i]);
            if(i > 2) chmax(dp[2][i], dp[1][i - 3] + A[i]);
            if(i > 3) chmax(dp[2][i], dp[0][i - 3] + A[i]);
            chmax(dp[2][i], dp[1][i - 1]);
        }
        cout << max(dp[0][N - 1], max(dp[1][N - 1], dp[2][N - 1]));
    }
}


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 ll = long long;
using namespace std;
int main() {
	int n; cin >> n;
	int a[n]; for (int & i : a) cin >> i;

	ll pre_sum[n + 1] = {};
	pre_sum[i] = a[1];
	for (int i = 3; i <= n; i += 2)
		pre_sum[i] = pre_sum[i - 2] + a[i];

	ll dp[n + 1] = {};
	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(pre_sum[i - 1], dp[i - 2] + a[i]);
		}
	}

	cout << dp[n];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'i' was not declared in this scope
    9 |         pre_sum[i] = a[1];
      |                 ^
Language: C

// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
signed main(){
  init_io();
  ll n;
  cin >> n;
  vector<ll> dp(n,0);
  vector<ll> a(n),sum(n,0);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  sum[n-1] = a[n-1];
  for(int i=n-2;i>=0;i--){
    sum[i] = sum[i+1];
    if((i%2==0)^(n%2==0)) sum[i] += a[i];
  }
  dp[n-1] = 0;
  dp[n-2] = max(a[n-1],a[n-2]);
  for(int i=n-3;i>=0;i--){
    if(n%2){
      if(i%2==0){
        dp[i] = max(dp[i+1],dp[i+2]+a[i]);
      }else{
        dp[i] = max(sum[i+1],dp[i+2]+a[i]);
      }
    }else{
      if(i%2==0){
        dp[i] = max(sum[i+1],dp[i+2]+a[i]);
      }else{
        dp[i] = max(dp[i+1],dp[i+2]+a[i]);
      }
    }
  }
  cout << dp[0]<<endl;
}


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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  if (N % 2 == 0){
    vector<vector<long long>> dp(N / 2 + 1, vector<long long>(2, 0));
    //0: left 1: right
    for (int i = 0; i < N / 2; i++){
      dp[i + 1][0] = dp[i][0] + A[i * 2];
      dp[i + 1][1] = max(dp[i][0], dp[i][1]) + A[i * 2 + 1];
    }
    cout << max(dp[N / 2][0], dp[N / 2][1]);
  } else {
    vector<vector<long long>> dp(N / 2 + 1, vector<long long>(3, 0));
    for (int i = 0; i < N / 2; i++){
      dp[i + 1][0] = dp[i][0] + A[i * 2];
      dp[i + 1][1] = max(dp[i][0], dp[i][1]) + A[i * 2 + 1];
      dp[i + 1][2] = max({dp[i][0], dp[i][1], dp[i][2]}) + A[i * 2 + 2];
    }
    cout << max({dp[N / 2][0], dp[N / 2][1], dp[N / 2][2]});
  }
}

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

#include <iostream>
#include <vector>
#include <limits.h>
using namespace std;
using ll=long long;

int main(){
    const ll INF=LLONG_MAX/2;
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ll ret=0;
    if(n%2==0){
        vector<vector<vector<ll>>> dp(n,vector<vector<ll>>(2,vector<ll>(2,-INF)));
        dp[0][0][0]=0;
        dp[0][1][1]=a[0];
        for(int i=1;i<n;i++){
            if(i%2==0){
                dp[i][0][0]=max(dp[i-1][0][1],dp[i-1][1][1]);
                dp[i][0][1]=-INF;
                dp[i][1][0]=-INF;
                dp[i][1][1]=dp[i-1][0][1]+a[i];
            }else{
                dp[i][0][0]=-INF;
                dp[i][0][1]=dp[i-1][1][1];
                dp[i][1][0]=-INF;
                dp[i][1][1]=dp[i-1][0][0]+a[i];
            }
        }
        ret=max(dp[n-1][0][1],dp[n-1][1][1]);
    }else{
        vector<vector<vector<ll>>> dp(n,vector<vector<ll>>(2,vector<ll>(2,-INF)));
        dp[0][0][0]=0;
        dp[0][1][1]=a[0];
        for(int i=1;i<n;i++){
            if(i%2==0){
                dp[i][0][0]=max(dp[i-1][0][1],dp[i-1][1][1]);
                dp[i][0][1]=-INF;
                dp[i][1][0]=dp[i-1][0][0]+a[i];
                dp[i][1][1]=dp[i-1][0][1]+a[i];
            }else{
                dp[i][0][0]=max(dp[i-1][0][0],dp[i-1][1][0]);
                dp[i][0][1]=max(dp[i-1][0][1],dp[i-1][1][1]);
                dp[i][1][0]=-INF;
                dp[i][1][1]=dp[i-1][0][0]+a[i];
            }
        }
        ret=max(dp[n-1][0][0],dp[n-1][1][0]);
    }
    cout<<ret<<endl;
}


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

#include <bits/stdc++.h>

#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i,a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using namespace std;
using ll = long long;
using ld = long double;
template<class T> using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-10;
ll mod = static_cast<ll>(1e9 + 7);
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class A, int N, class T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

int n;
ll a[200005];
ll dp[200005][3][2], dp2[200005][3][2];
void solve() {
    cin >> n;
    rep(i, n) cin >> a[i];

    if (n % 2 == 0) {
        ll res1 = 0, res2 = 0;
        rep(i, n) {
            if (i % 2 == 0) res1 += a[i];
            else res2 += a[i];
        }
        cout << max(res1, res2) << endl;
    }
    else {
        fillArray(dp, -inf);
        dp[0][0][0] = 0;
        rep(i, n) rep(j, 3) {
            if (dp[i][j][0] > -inf) {
                maxs(dp[i + 1][j][1], dp[i][j][0] + a[i]);
                if (i > 0 && j < 2) maxs(dp[i + 1][j + 1][0], dp[i][j][0]);
            }
            if (dp[i][j][1] > -inf) {
                maxs(dp[i + 1][j][0], dp[i][j][1]);
            }
        }
        fillArray(dp2, -inf);
        dp2[0][0][1] = 0;
        rep(i, n) rep(j, 2) {
            if (dp2[i][j][0] > -inf) {
                maxs(dp2[i + 1][j][1], dp2[i][j][0] + a[i]);
                if (i > 0 && j < 2) maxs(dp2[i + 1][j + 1][0], dp2[i][j][0]);
            }
            if (dp2[i][j][1] > -inf) {
                maxs(dp2[i + 1][j][0], dp2[i][j][1]);
            }
        }
        cout << max({ dp[n][2][0], dp[n][2][1],dp2[n][1][0],dp2[n][1][1] }) << endl;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    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, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> P;

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int main(){
    int N;
    cin >> N;

    vector<int> A(N);
    rep(i, N) cin >> A[i];

    vector<vector<map<int, ll>>> dp(N+1, vector<map<int, ll>>(2));
    vector<vector<map<int, bool>>> flg(N+1, vector<map<int, bool>>(2));
    dp[0][0][0] = 0;

    rep(i, N) {
        rep(j, 2) {
            for (auto &p : dp[i][j]) {
                int k = p.first, ni = i+1, nk = k;
                rep(nj, 2) {
                    if (j && nj) continue;
                    if (nj) nk++;
                    
                    if (nk < (ni-1)/2 || (ni+1)/2 < nk) continue;

                    if (nj) {
                        if (dp[ni][nj].count(nk)) chmax(dp[ni][nj][nk], dp[i][j][k] + A[i]);
                        else dp[ni][nj][nk] = dp[i][j][k] + A[i];
                    } else {
                        if (dp[ni][nj].count(nk)) chmax(dp[ni][nj][nk], dp[i][j][k]);
                        else dp[ni][nj][nk] = dp[i][j][k];
                    }
                }
            }
        }
    }

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


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

#include <iostream>
#include <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];
	vvl dp(n+1,vl(3,-linf));
	dp[0][0] = a[0];
	dp[1][1] = a[1];
	dp[2][2] = a[2];
	REP(i,2,n){
		chmax(dp[i][0],dp[i-2][0] + a[i]);
		if(i > 2){
			chmax(dp[i][1],dp[i-2][1] + a[i]);
			chmax(dp[i][1],dp[i-3][0] + a[i]);
		}
		if(i > 3){
			chmax(dp[i][2],dp[i-2][2] + a[i]);
			chmax(dp[i][2],dp[i-3][1] + a[i]);
			chmax(dp[i][2],dp[i-4][0] + a[i]);
		}
	}
	ll ans;
	if(n & 1) ans = max({dp[n-3][0],dp[n-2][1],dp[n-1][2]});
	else ans = max(dp[n-2][0],dp[n-1][1]);
	cout << ans << endl;
}


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

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

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

signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n;cin>>n;
  V<ll> v(n);rep(i,0,n)cin>>v[i];
  rep(i,0,200010)rep(j,0,3)dp[i][j]=-LINF;
  
  dp[0][0]=0;
  dp[1][1]=0;
  if(n%2)dp[2][2]=0;

  rep(i,0,n){
    chmax(dp[i+2][0],dp[i][0]+v[i]);
    chmax(dp[i+2][1],dp[i][1]+v[i]);
    chmax(dp[i+2][2],dp[i][2]+v[i]);


    chmax(dp[i+3][1],dp[i][0]+v[i]);
    chmax(dp[i+3][2],dp[i][1]+v[i]);
    chmax(dp[i+4][2],dp[i][0]+v[i]);
  }

  if(n%2==0)cout<<max(dp[n+1][1],dp[n][0])<<ENDL;
  else cout<<max({dp[n+1][2],dp[n][1],dp[n-1][0]})<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

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

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define for(i,a,b) for(ll i=a;i<b;i++)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n;
  cin >> n;
  vl a(n);
  for(i,0,n){
    cin >> a[i];
  }
  vvl dp(n,vl(3));
  for(i,0,n){
    for(j,0,3){
      dp[i][j]=-INF;
    }
  }
  dp[0][0]=a[0];
  dp[1][1]=a[1];
  if(n>=3){
  dp[2][2]=a[2];
    if(n>=4){
  dp[3][1]=max(dp[0][0],dp[1][1])+a[3];
    }
  dp[2][0]=a[0]+a[2];
    }
  if(n>4){
  	for(i,4,n){
   	 if(i%2==0){
      dp[i][0]=dp[i-2][0]+a[i];
      }
 	   dp[i][1]=max(dp[i-2][1]+a[i],a[i]+dp[i-3][0]);
 	   dp[i][2]=max(dp[i-2][2]+a[i],max(dp[i-3][1],dp[i-4][0])+a[i]);
 	 }
  }
  if(n%2==0)
    cout << max(dp[n-2][0],dp[n-1][1]) << endl;
  else
    cout << max(max(dp[n-1][2],dp[n-2][1]),dp[n-3][0]) << 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

#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    vector dp(n+1, 0LL);
    ll sum = a[0];
    dp[0] = dp[1] = 0;
    for(int i = 2; i <= n; i++) {
        if(i % 2 == 0){
            dp[i] = max(dp[i-2] + a[i-1], sum);
            if(i < n)sum += a[i];
        }
        else {
            dp[i] = max(dp[i-2] + a[i-1], dp[i-1]);
        }
    }

    cout << dp[n] << endl;
}

Compiler output:
main.c:2:9: 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 int long long
#define sc(x) scanf("%lld",&(x));
int n;
int A[200005];
int dp[200005][3];
int INF = 1e18;
signed main()
{
    sc(n)
    for(int i=1;i<=n;i++)sc(A[i])
    dp[1][0]=A[1];
    dp[1][1]=-INF;
    dp[1][2]=-INF;
    dp[2][0]=A[2];
    dp[2][1]=-INF;
    dp[2][2]=-INF;
    int len = n/2;
    int ans = -INF;
    for(int i=3;i<=n;i++){
        dp[i][0]=dp[i-2][0]+A[i];
        dp[i][1]=max(dp[i-2][1]+A[i],dp[i-3][0]+A[i]);
        if(i>3)
            dp[i][2]=max((dp[i-2][2]+A[i],dp[i-3][1]+A[i]),dp[i-4][0]+A[i]);
        else dp[i][2]=-INF;
        if((i+1)/2 == len){
            ans = max(ans,dp[i][0]);
        }else if((i+2)/2 == len +1){
            ans = max(ans,dp[i][1]);
        }else if((i+3)/2 == len + 2){
            ans = max(ans,dp[i][2]);
        }
    }
    cout<<ans<<'\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>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P> > vec;
// vector<vector<int>> data(3, vector<int>(4));

map<ll, ll> m[200002];

vector<long long> A(200002);
long long N;

ll rec(ll n, ll k) {
    if (n <= 0 && k == 0) return 0;
    if ((n + 1) / 2 < k || n <= 0 || k < 0) return -9999999999999;
    if (m[n][k] != 0) return m[n][k];
    return m[n][k] = max(A[N - n] + rec(n - 2, k - 1), rec(n - 1, k));
}

int main() {
    scanf("%lld", &N);

    for (int i = 0; i <= N - 1; i++) {
        scanf("%lld", &A[i]);
    }
    ll res = 0;
    ll now = 0;
    if (N % 2 == 0) {
        now = 0;
        rep(i, N) {
            if (i % 2 == 0) now += A[i];
        }
        res = max(res, now);
        now = 0;
        rep(i, N) {
            if (i % 2 == 1) now += A[i];
        }
        res = max(res, now);
        cout << res << endl;
    } else {
        cout << rec(N, N / 2) << endl;
    }
    return 0;
}


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

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+5;
int a[N];
ll f[N][3];
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++) {
        scanf("%d",&a[i]);
    }
    for(int i=1;i<=n;i++) {
        for(int j=0;j<3;j++) {
            f[i][j]=-1e18;
        }
    }
    for(int i=1;i<=3;i++) {
        f[i][i-1]=a[i];
    }
    f[3][0]=a[1]+a[3];
    for(int i=4;i<=n;i++) {
        f[i][0]=f[i-2][0]+a[i];
        f[i][1]=max(f[i-2][1],f[i-3][0])+a[i];
        f[i][2]=max(f[i-2][2],f[i-3][1])+a[i];
        if(i>4) f[i][2]=max(f[i][2],f[i-4][0]+a[i]);
    }
    ll ans;
    if(n&1) ans=max(f[n][2],max(f[n-1][1],f[n-2][0]));
    else ans=max(f[n][1],f[n-1][0]);
    printf("%lld\n",ans);
    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++

/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

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

	map<P, ll> mp;

	rep(i, n){
		REPN(k, i / 2, i / 2 + 1) mp[{i, k}] = -LINF;
		mp[{1, 0}] = 0;
		mp[{0, 0}] = 0;
		mp[{-1, 0}] = 0;
		mp[{-2, 0}] = 0;
		mp[{-3, 0}] = 0;
		REPN(j, i - 5, i - 2){
			REPN(k, i / 2, i / 2 + 1){
				if(mp.find({j, k - 1}) != mp.end()) chmax(mp[{i, k}], mp[{j, k - 1}] + a[i]);
			}
		}
	}

	ll ans = 0;
	rep(i, n) if(mp.find({i, n / 2}) != mp.end())　chmax(ans, mp[{i, n / 2}]);
	co(ans);

	return 0;
}


Compiler output:
a.cc:86:54: error: extended character 　 is not valid in an identifier
   86 |         rep(i, n) if(mp.find({i, n / 2}) != mp.end())　chmax(ans, mp[{i, n / 2}]);
      |                                                      ^
a.cc: In function 'int main()':
a.cc:86:54: error: '\U00003000chmax' was not declared in this scope; did you mean 'chmax'?
   86 |         rep(i, n) if(mp.find({i, n / 2}) != mp.end())　chmax(ans, mp[{i, n / 2}]);
      |                                                      ^~~~~~~
      |                                                      chmax
Language: C++

#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#define getchar_unlocked getchar
#define putchar_unlocked putchar
#else
#include <bits/stdc++.h>
#endif // VS

#define long long long
using namespace std;

#pragma region CS_COMPATIBLE
#define var auto
#define Max std::max
#define Min std::min
#define Abs std::abs
//#define List std::vector;
//#define Add push_back
#pragma endregion

void read(uint32_t& x)
{
	x = 0;
	int k;
	while (true)
	{
		k = getchar_unlocked();
		if (k < '0' || k > '9')	break;
		x = x * 10 + k - '0';
	}
}

void sread(int32_t& x)
{
	bool flag;
	x = 0;
	int k = getchar_unlocked();
	if (flag = (k == '-')) k = getchar_unlocked();

	while (true)
	{
		if (k < '0' || k > '9')	break;
		x = x * 10 + k - '0';
		k = getchar_unlocked();
	}
	if (flag) x *= -1;
}

void sprint(int64_t x) {
	if (x == 0) {
		putchar_unlocked('0');
		return;
	}
	if (x < 0) {
		putchar_unlocked('-');
		x *= -1;
	}
	int s = 0;
	char f[15];
	while (x) {
		f[s++] = x % 10;
		x /= 10;
	}
	while (s--)
		putchar_unlocked(f[s] + '0');
	putchar_unlocked('\n');
}

int32_t a[200000];
int main() {
	uint32_t n;
	read(n);
	for (size_t i = 0; i < n; i++) sread(a[i]);
	int64_t res;
	if (n & 1) {
		return;
		//Odd
		var sum = 0L;
		for (int i = 0; i < n - 1; i += 2) sum += a[i];
		res = sum;
		int64_t tailDiff = 0, tailDiffMax = 0;
		for (int i = n - 3; i >= 0; i -= 2)
		{
			sum -= a[i]; sum += a[i + 1];
			tailDiff += a[i + 2]; tailDiff -= a[i + 1];
			tailDiffMax = max(tailDiffMax, tailDiff);
			res = max(res, sum + tailDiffMax);
		}
	}
	else {
		//Even
		int64_t sum = 0;
		for (size_t i = 0; i < n; i += 2) sum += a[i];
		res = sum;
		for (int i = n - 1; i >= 0; i -= 2)
		{
			sum += a[i]; sum -= a[i - 1];
			res = max(res, sum);
		}
	}
	sprint(res);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:76:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   76 |                 return;
      |                 ^~~~~~
Language: C

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int n;cin>>n;
	vl a(n);
	rep(i,n)cin>>a[i];
	ll sum1[n+1],sum2[n+1];
    mem(sum1,0);
    mem(sum2,0);
	sum1[0]=a[0];sum2[0]=0;
	for(int i=1;i<n;++i){
		if(i%2==0){
			sum1[i]=sum1[i-1]+a[i];
			sum2[i]=sum2[i-1];
		}
		else{
			sum1[i]=sum1[i-1];
			sum2[i]=sum2[i-1]+a[i];
		}
	}
	ll dp[n][2];
	mem(dp,0);
	dp[0][0]=0;
	dp[0][1]=a[0];
	dp[1][0]=dp[0][1];
    dp[1][1]=dp[0][0]+a[1];
	if(n>=3){
	dp[2][0]=max(dp[1][0],dp[1][1]);
	dp[2][1]=dp[0][0]+a[2];
	for(int i=3;i<n;++i){
		if(i%2==0){
			dp[i][0]=max(dp[i-1][0],dp[i-1][1]);
			dp[i][1]=max(dp[i-2][0],dp[i-2][1])+a[i];
		}
		if(i%2==1){
			dp[i][0]=dp[i-2][0]+a[i-1];
			dp[i][1]=dp[i-1][0]+a[i];
		}
	}
	}
	cout<<max(dp[n-1][0],dp[n-1][1])<<endl;
}

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

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

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

    // dp[i][j]][k]: i番目までj個選び、k=0の場合iを使わない, k=1の場合iを使う
    vector< vector<vector<ll> > > dp(N+1, vector<vector<ll> >(N/2+5, vector<ll>(2, -2e9)));

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

    FOR(i, 2, N) {
        FOR(j, (i-1)/2, (i+1)/2) {
            dp[i][j][0] = max(dp[i-1][j][0], dp[i-1][j][1]);
            if(j>=1)
                dp[i][j][1] = dp[i-1][j-1][0] + A[i];
        }
    }

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

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

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

const ll minus_INF = -1000000000000000;

int main() {
  ll N;
  cin >> N;

  vector<ll> A(N + 1, 0);
  rep(i, N) cin >> A[i + 1];

  vector<vector<vector<ll> > > dp(N + 1, vector<vector<ll> >(floor(N / 2) + 1, vector<ll>(2, minus_INF)));
  for (ll i = 0; i <= N; i++) {
    dp[i][0][0] = 0;
    dp[i][0][1] = 0;
  }
  for (ll i = 0; i <= floor(N / 2) ; i++) {
    dp[0][i][0] = 0;
    dp[0][i][1] = 0;
  }
  dp[1][1][1] = A[1];

  for (ll i = 2; i <= N; i++) {
    for (ll j = floor((i - 1) / 2); j <= min(floor((i + 1) / 2), floor(N / 2)); j++) {
      if (j == 0) j = 1;
      cout << i << ' ' << j << ' '<< "test start" << endl;
      dp[i][j][0] = max(dp[i - 1][j][0], dp[i - 1][j][1]);
      dp[i][j][1] = dp[i - 1][j - 1][0] + A[i];
      cout << i << ' ' << j << ' '<< "test end" << endl;
    }
  }
  
  cout << max(dp[N][floor(N / 2)][0], dp[N][floor(N / 2)][1]) << endl;
  return 0;
}
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const ll minus_INF = -1000000000000000;

int main() {
  ll N;
  cin >> N;

  vector<ll> A(N + 1, 0);
  rep(i, N) cin >> A[i + 1];

  vector<vector<vector<ll> > > dp(N + 1, vector<vector<ll> >(floor(N / 2) + 1, vector<ll>(2, minus_INF)));
  for (ll i = 0; i <= N; i++) {
    dp[i][0][0] = 0;
    dp[i][0][1] = 0;
  }
  for (ll i = 0; i <= floor(N / 2) ; i++) {
    dp[0][i][0] = 0;
    dp[0][i][1] = 0;
  }
  dp[1][1][1] = A[1];

  for (ll i = 2; i <= N; i++) {
    for (ll j = floor((i - 1) / 2); j <= min(floor((i + 1) / 2), floor(N / 2)); j++) {
      if (j == 0) j = 1;
      cout << i << ' ' << j << ' '<< "test start" << endl;
      dp[i][j][0] = max(dp[i - 1][j][0], dp[i - 1][j][1]);
      dp[i][j][1] = dp[i - 1][j - 1][0] + A[i];
      cout << i << ' ' << j << ' '<< "test end" << endl;
    }
  }
  
  cout << max(dp[N][floor(N / 2)][0], dp[N][floor(N / 2)][1]) << endl;
  return 0;
}


Compiler output:
a.cc:46:10: error: redefinition of 'const ll minus_INF'
   46 | const ll minus_INF = -1000000000000000;
      |          ^~~~~~~~~
a.cc:7:10: note: 'const ll minus_INF' previously defined here
    7 | const ll minus_INF = -1000000000000000;
      |          ^~~~~~~~~
a.cc:48:5: error: redefinition of 'int main()'
   48 | int main() {
      |     ^~~~
a.cc:9:5: note: 'int main()' previously defined here
    9 | int main() {
      |     ^~~~
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 sum = 0;
    	for(int i=0;i<n;i++)if(i%2==0) sum+=a[i];
    	vector<ll> dp(n,0);
    	for(int i=2;i<n;i++)if(i%2==0) dp[i]=max(dp[i-2] - a[i-2] + a[i-1], 0LL);
    	ll m=-1e18;
    	for(int i=0;i<n;i++)if(i%2==0) m = max(dp[i]-a[0], m);
    	cout << sum + m <<endl;
    }
    else{
    	vector<ll> b(n+1,0);
    	for(int i=n-1;i>=0;i--){
    		b[i] += b[i+1];
    		if(i&1)b[i] += a[i];
    	}
    	ll sum=0;
    	ll ans=-1e18;
    	for(int i=0;i<n;i++)if(!(i&1)) ans = max(ans,sum+b[i+1]), sum += a[i];
      　ans = max(ans,sum);
        cout << ans <<endl;
    }
    return 0;
}


Compiler output:
a.cc:35:7: error: extended character 　 is not valid in an identifier
   35 |       　ans = max(ans,sum);
      |       ^
a.cc: In function 'int main()':
a.cc:35:7: error: '\U00003000ans' was not declared in this scope
   35 |       　ans = max(ans,sum);
      |       ^~~~~
Language: C

/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int n; cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    static int dp[200200][6];
    rep(i, 200200) {
        rep(j, 6) {
            dp[i][j] = -INF;
        }
    }
    dp[0][0] = 0;
    rep(i, n) {
        rep(j, 3) {
            if(i + 1 < n) chmax(dp[i + 2][j], dp[i][j] + a[i + 1]);
            if(i + 2 < n) chmax(dp[i + 3][j + 1], dp[i][j] + a[i + 2]);
            if(i + 3 < n) chmax(dp[i + 4][j + 2], dp[i][j] + a[i + 3]);
        }
    }
    if(n & 1) {
        cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
    } else {
        cout << max(dp[n][0], dp[n][1]) << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

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

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	
	vector<vector<ll>> dp(n/2, vector<ll>(n, -1e9+7));

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

	cout << dp[n / 2 - 1][n - 1] << 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 <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <unordered_map>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
ll read(){ll a;scanf("%lld",&a);return a;}

const int inf = TEN(18) + 10;
const int mod = TEN(9) + 10;

int N;
int dp_even[200010][2];

signed main()
{
	cin >> N;

	if (N & 1) return 1;

	vi A(N + 5);
	rep1(i, N) cin >> A[i];

	rep(i, N+1) rep(j,2) dp_even[i][j] = -inf;

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

	for (int i = 3; i <= N; ++i) {
		chmax(dp_even[i][0], dp_even[i - 2][0] + A[i]);
		chmax(dp_even[i][1], max(dp_even[i - 2][1] + A[i], dp_even[i - 2][0]));
	}

	cout << max(dp_even[N][0], dp_even[N][1]) << endl;
}




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

//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n; cin>>n;
    ll arr[n+3];
    for(int i=1;i<=n;i++) cin>>arr[i];
    ll dp[n][2];
    dp[n][0]=0;
    dp[n][1]=0;
    dp[n-1][1]=arr[n-1];
    dp[n-1][0]=arr[n];
    for(int i=n-2;i>=1;i--)
    {
        int idx=n-i+1;
        if(idx%2==1){
            dp[i][1]=arr[i]+max(dp[i+2][0],dp[i+2][1]);
            dp[i][0]=max(dp[i+1][0],dp[i+1][1]);
        }
        else{
            dp[i][1]=arr[i]+max(dp[i+1][0],max(dp[i+2][0],dp[i+2][1])};
            dp[i][0]=arr[i+1]+dp[i+2][0];
        }
        // cout<<i<<" --> ";
        // cout<<dp[i][1]<<" "<<dp[i][0]<<endl;
    }
    cout<<max(dp[1][0],dp[1][1])<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:70: error: expected ')' before '}' token
   30 |             dp[i][1]=arr[i]+max(dp[i+1][0],max(dp[i+2][0],dp[i+2][1])};
      |                                ~                                     ^
      |                                                                      )
a.cc: At global scope:
a.cc:36:5: error: 'cout' does not name a type
   36 |     cout<<max(dp[1][0],dp[1][1])<<endl;
      |     ^~~~
a.cc:37:1: error: expected declaration before '}' token
   37 | }
      | ^
Language: C

//Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define file_input
//#define multitest
//#define measure_time
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<v32>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print_container(const ContainerType<ValueType, Args...> &c)
{
	cout << "{ ";
	for (const auto &v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

const int N = 2e5 + 5;
ll dp[N][2];

void solve()
{
	int n;
	cin >> n;
	v64 arr(n + 1, 0);
	for (int i = 1; i < n + 1; i++)
		cin >> arr[i];
	memset(dp, 0, sizeof(dp));
	dp[2][1] = arr[2];
	dp[2][0] = arr[1];
	for (int i = 3; i < n + 1; i++)
	{
		if (i & 1)
		{
			ll temp = max({dp[i - 3][1], dp[i - 3][0], dp[i - 2][1], dp[i - 2][0]});
			dp[i][1] = arr[i] + temp;
			dp[i][0] = max({arr[i - 1] + dp[i - 2][0], arr[i - 1] + dp[i - 3][1], arr[i - 1] + dp[i - 3][0], arr[i - 2] + dp[i - 3][0]});
		}
		else
		{
			dp[i][1] = arr[i] + max({dp[i - 2][1], dp[i - 2][0], dp[i - 1][0]});
			dp[i][0] = arr[i - 1] + dp[i - 2][0];
		}
	}
	cout << max(dp[n][1], dp[n][0]) << ln;
	return;
}

int main()
{
	FASTIO;
#ifdef file_input
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	clock_t start, stop;
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
#ifdef measure_time
	start = clock();
#endif
	for (int tc = 1; tc < t + 1; tc++)
		solve();
#ifdef measure_time
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	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

#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint n;
llint a[200005];
llint dp[200005][3];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	
	for(int i = 0; i <= n; i++){
		for(int j = 0; j < 3; j++){
			dp[i][j] = -inf;
		}
	}
	dp[0][0] = 0;
	
	for(int i = 0; i < n+1; i++){
		for(int j = 0; j < 3; j++){
			chmax(dp[i+2][j], dp[i][j] + a[i+1]);
			if(j+1 < 3) chmax(dp[i+1][j+1], dp[i][j]);
		}
	}
	cout << dp[n+1][n%2+1] << endl;
	
	return 0;
}

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

#include <iostream>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  vector<ll> v(n);
  for(ll i=0;i<n;i++)
  {
    cin>>v[i];
  }
  ll sum1 = 0,sum2 = 0;
  for(ll i = 0;i<v.size();i+=2)
  {
    sum1 = max(sum1,sum1+v[i]);
  }
  for(ll i = 1;i<v.size();i+=2)
  {
    sum2 = max(sum2,sum2+v[i]);
  }
  cout << max(sum1,sum2) <<"\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<ll> v(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
a.cc:8:10: note: in expansion of macro 'll'
    8 |   vector<ll> v(n);
      |          ^~
a.cc:11:10: error: 'v' was not declared in this scope
   11 |     cin>>v[i];
      |          ^
a.cc:14:18: error: 'v' was not declared in this scope
   14 |   for(ll i = 0;i<v.size();i+=2)
      |                  ^
a.cc:18:18: error: 'v' was not declared in this scope
   18 |   for(ll i = 1;i<v.size();i+=2)
      |                  ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  vector<ll> v(n);
  for(ll i=0;i<n;i++)
  {
    cin>>v[i];
  }
  ll sum1 = 0;sum2 = 0;
  for(ll i = 0;i<v.size();i+=2)
  {
    sum1 = max(sum1,sum1+v[i]);
  }
  for(ll i = 1;i<v.size();i+=2)
  {
    sum2 = max(sum2,sum2+v[i]);
  }
  cout << max(sum1,sum2) <<"\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'sum2' was not declared in this scope; did you mean 'sum1'?
   14 |   ll sum1 = 0;sum2 = 0;
      |               ^~~~
      |               sum1
Language: C++

#include <iostream>
using namespace std;
#define ll long long
int main()
{
  ll n;
  cin>>n;
  vector<ll> v(n);
  for(ll i=0;i<n;i++)
  {
    cin>>v[i];
  }
  ll sum1 = 0;sum2 = 0;
  for(ll i = 0;i<v.size();i+=2)
  {
    sum1 = max(sum1,sum1+v[i]);
  }
  for(ll i = 1;i<v.size();i+=2)
  {
    sum2 = max(sum2,sum2+v[i]);
  }
  cout << max(sum1,sum2) <<"\n";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<ll> v(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:3:12: error: expected primary-expression before 'long'
    3 | #define ll long long
      |            ^~~~
a.cc:8:10: note: in expansion of macro 'll'
    8 |   vector<ll> v(n);
      |          ^~
a.cc:11:10: error: 'v' was not declared in this scope
   11 |     cin>>v[i];
      |          ^
a.cc:13:15: error: 'sum2' was not declared in this scope; did you mean 'sum1'?
   13 |   ll sum1 = 0;sum2 = 0;
      |               ^~~~
      |               sum1
a.cc:14:18: error: 'v' was not declared in this scope
   14 |   for(ll i = 0;i<v.size();i+=2)
      |                  ^
a.cc:18:18: error: 'v' was not declared in this scope
   18 |   for(ll i = 1;i<v.size();i+=2)
      |                  ^