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

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

#define watch(x) cerr << (#x) << ": " << (x) << endl
#define int long long

const int N = 200009, inf = 1000000000000000000;
int n, a[N];
int dp[N][6];

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

    for(int i = 0; i <= n; ++i) {
        for(int j = 0; j < 6; ++j) {
            dp[i][j] = -inf;
        }
    }
    dp[0][0] = 0;

    for(int i = 0; i < n; ++i) {
        int cur = a[i];
        dp[i+1][0] = dp[i][1];
        dp[i+1][1] = dp[i][0] + cur;
        dp[i+1][2] = max(dp[i][3], dp[i][0]);
        dp[i+1][3] = dp[i][2] + cur;
        dp[i+1][4] = max(dp[i][5], dp[i][2]);
        dp[i+1][5] = dp[i][4] + cur;
    }

    if(n%2) {
        vector<int> cands = {dp[n][2], dp[n][3], dp[n][4], dp[n][5]};
        cout << *max_element(cands.begin(), cands.end()) << '\n';
    } else {
        vector<int> cands = {dp[n][0], dp[n][1], dp[n][2], dp[n][3]};
        cout << *max_element(cands.begin(), cands.end()) << '\n';
    }
    
    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>
using namespace std;

int main(){
    int n;
    long long int a[200000]={};
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    if(n%2==0){
        long long int s1=0,s2=0;
        int j = 0;
        while(j<n){
            s1 = s1 + a[j];
            j = j + 2;
        }
        j = 1;
        while(j<n){
            s2 = s2 + a[j];
            j = j + 2;
        }
           if(s1>s2){
            cout<<s1<<endl;
        }
        else{
            cout<<s2<<endl;
        }
    }
    else{
        long long int s1=0,s2=0;
        for(int i=0;i<n;i++){
            if(i%2==0){
                s1 = s1 + a[i];
            }
            else{
                s2 = s2 + a[i];
            }
        }
        if(a[0]>a[n-1]){
            s1 = s1 - a[n-1];
        }
        else{
            s1 = s1 - a[0];
        }

        if(s1>s2){
            cout<<s1<<endl;
        }
        else{
            cout<<s2<<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 (ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(v) v.begin(), v.end()
#define ll long long
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;

int main(){
    ll n;
    cin>>n;
    vll a(n);
    rep(i,n) cin>>a[i];
    vll left(n,-1e8);
    vll right(n,-1e8);
    vll mid(n,-1e8);
    if(n%2==0){
        left[0]=a[0];
        right[0]=a[1];
        rep(i,n/2-1){
            left[i+1]=left[i]+a[i*2+2];
            right[i+1]=max(left[i],right[i])+a[i*2+3];
        }
    }
    else{
        left[0]=a[0];
        mid[0]=a[1];
        right[0]=a[2];
        rep(i,n/2-1){
            left[i+1]=left[i]+a[i*2+2];
            mid[i+1]=max(left[i],mid[i])+a[i*2+3];
            right[i+1]=max({left[i],mid[i],right[i]})+a[i*2+4];
        }
    }
    cout<<right[n/2-1]<<endl;
}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;



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

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

#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

typedef vector<vector<ll>> vvll;

int main() {
//	cout << fixed << setprecision(15);
	int n;
	cin >> n;
	vll a(n);
	rep(i, n) cin >> a[i];

	vector<vvll> dp(n+1, vvll(3, vll(2, 0)));
	rep(i, n) {
		rep(j, 3) {
			dp[i+1][j][0] = dp[i][j][1];
			dp[i+1][j][1] = dp[i][j][0] + a[i];
		}
		rep(j, 2) chmax(dp[i+1][j+1][0], dp[i][j][0]);
	}
	if(n % 2) cout << max(dp[n][1][0], dp[n][2][1]) << endl;
	else cout << max(dp[n][0][0], dp[n][1][1]) << endl;
}


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

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

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

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

int solve(){
    map<int,ll> dp[20010][2];
    // memset(dp,0,sizeof(dp));
    dp[0][0][0] = 0;
    dp[0][1][1] = A[0];
    for (int i = 1; i < N; i++)
    {
        for (int j = i/2-1; j <= (i+1)/2 && j<=N/2; j++)
        {
            dp[i][0][j] = max(dp[i-1][0][j],dp[i-1][1][j]);
            dp[i][1][j] = dp[i-1][0][j-1]+A[i];
        }
        
    }
    ll ans;
    ans = max(dp[N-1][0][N/2],dp[N-1][1][N/2]);
    DBG(ans)
    cout << ans << endl;
    
    return 0;
}   

int main()
{
    input();
    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++

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    static final long INF = (long) 1e17;
    static int n, a[], maxskips;
    static Long memo[][];

    public static void main(String[] args) throws IOException, InterruptedException {
        Scanner sc = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        n = sc.nextInt();
        a = sc.nextIntArray(n);
        maxskips = 1 + (n % 2);
        memo = new Long[3][n];
        long ans = dp(0, 0);
        out.println(ans);
        out.flush();
        out.close();
    }

    static long dp(int skip, int i) {
        if (skip > maxskips) return -INF;
        if (i >= n) return (n%2!=0 && skip==0)?-INF:0;
        if (memo[skip][i] != null) return memo[skip][i];
        long max = a[i] + dp(skip, i + 2);
        if (i != n - 1) max = Math.max(max, dp(skip + 1, i + 1));
        return memo[skip][i] = max;
    }


    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        boolean ready() throws IOException {
            return br.ready();
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        Scanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        int nextChar() throws IOException {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) throws IOException {
            int[] ans = new int[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextInt();
            return ans;
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.BufferedReader;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.IOException;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.io.PrintWriter;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.*;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
    7 | public class Main {
      | ^~~~~~
Language: C

#include <bits/stdc++.h>

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

ll dp[200100][3];

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

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

  rep(i, n+1){
    rep(j, 3){
      dp[i][j] = -INF;
    }
  }

  dp[0][0] = 0;

  rep(i, n){
    
    // そのまま
    if(i%2==0){
      chmax(dp[i+1][0], dp[i][0] + a[i]);
      chmax(dp[i+1][1], dp[i][1]);
      chmax(dp[i+1][2], dp[i][2] + a[i]);
    }else{
      chmax(dp[i+1][0], dp[i][0]);
      chmax(dp[i+1][1], dp[i][1] + a[i]);
      chmax(dp[i+1][2], dp[i][2]);
    }

    // 1個増やす
    chmax(dp[i+1][1], dp[i][0]);
    chmax(dp[i+1][2], dp[i][1]);

  }

  if(n%2==0){
    cout << dp[n][1] << endl;
  }else{
    cout << dp[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 rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
typedef long long ll;
using namespace std;
int main(void){
    int n;cin>>n;
    vector<pair<ll,int>> a(n);
    rep(i,n){
        ll x;cin>>x;
        a[i]={x,i+1};
    }
    sort(a.rbegin(),a.rend());
    //貪欲に取っていく作戦
    vector<bool> sct(n+5,false);
    int now=0;
    ll res=0;
    rep(i,n){
        ll x=a[i].first; int y=a[i].second;
        if(sct[y])continue;
        for(int j=-1;j<=1;j++) sct[y+j]=true;
        res+=x;
        now++;
        if(now==n/2)break;
    }
    cout<<res<<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

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int dp[200010][3],n,a[200005];
int maxi=1e17;
int dfs(int p,int f){
	if(p>n)RE 0;
	if(dp[p][f]!=-maxi)RE dp[p][f];
	int re=-maxi;
	FOR(i,2,2+f){
		gmax(re,dfs(p+i,f+2-i));
	}
	re=re+a[p];
	RE dp[p][f]=re;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	FOR(i,1,n)cin>>a[i];
	int ans=-1e17;
	FOR(i,0,n+5)FOR(j,0,2)dp[i][j]=-maxi;
	if(n&1){
		FOR(i,0,2){
			gmax(ans,dfs(i+1,2-i));
		}
	}else{
		FOR(i,0,1){
			gmax(ans,dfs(i+1,1-i));
		}
	}
	cout<<ans<<'\n';
	RE 0;
}




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>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

ll a[220000],b[220000];
ll x[220000],y[220000];
int main(){
    ll n,k,ans=0;
    cin>>n;
    rep(i,0,n){cin>>a[i];b[n-1-i]=a[i];}
    rep(i,0,n)x[i]=(i>1?x[i-2]:0)+a[i];
    rep(i,0,n)y[i]=(i>1?y[i-2]:0)+b[i];
    


    /*
    for(int mask = 0; mask < (1 << n); mask++){
        ans=0;
        ll cnt=0;
        rep(i,0,n)if(mask&(1<<i)){ans+=a[i];cnt++;}
        if(ans==295&&cnt==13){
            ans=mask;
            bool pp=true;
            ll st=-1;
            while(ans>0){
                cout<<ans%2;
                if(st*(ans%2)==1)pp=false;
                st=ans%2;
                ans/=2;
            }
            if(pp) cout<<"ans";
            cout<<endl;
        }
    }*/
    
    
    if(n%2==0){
        for(ll i=0;i<n;i+=2){
            if(i+3<n)ans=max(ans,x[i]+x[n-1]-x[i+1]);
            else ans=max(ans,x[i]);
        }
        for(ll i=0;i<n;i+=2){
            if(i+3<n)ans=max(ans,y[i]+y[n-1]-y[i+1]);
            else ans=max(ans,y[i]);
        }
        cout<<ans;
    }
    else{
        ll mm=1e10;
        for(ll i=0;i<n;i+=2)mm=min(mm,a[i]);
        ans=max(x[n-1]-mm,x[n-2]);
        ll mm2=-1e10;
        for(ll i=0;i<n-1;i+=2)mm2=max(mm2,-a[i]+a[i+1]-a[i+2]);
        ans=max(ans,x[n-1]+mm2);

        mm=1e10;
        for(ll i=0;i<n;i+=2)mm=min(mm,b[i]);
        ans=max(y[n-1]-mm,max(ans,y[n-2]));
        mm2=-1e10;
        for(ll i=0;i<n-1;i+=2)mm2=max(mm2,-b[i]+b[i+1]-b[i+2]);
        ans=max(ans,y[n-1]+mm2);

        ll sum1,sum2;
        for(ll i=0;i<n-6;i+=2){
            sum1=x[i];
            for(ll j=i+3;j<n;j+=2){
                sum2=x[j]-x[i+1]+x[n-1]-x[j+1];
                ans=max(ans,sum1+sum2);
            }
        }
        for(ll i=0;i<n-6;i+=2){
            sum1=y[i];
            for(ll j=i+3;j<n-2;j+=2){
                sum2=y[j]-y[i+1]+y[n-1]-y[j+1];
                ans=max(ans,sum1+sum2);
            }
        }
        cout<<ans;
    }
}


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

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

#define ll          long long
#define ull         unsigned long long
#define pb          push_back
#define pii         pair<int,int>
#define pll         pair<long,long>
#define vi          vector<int>
#define vll         vector<ll>
#define vii         vector<pii>
#define Mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)      (a).rbegin(),(a).rend()
#define ff           first
#define ss           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define mod        1000000007
//#define mod        998244353
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define rem(i,a,b)  for(int i=a;i>b;i--)
#define mp(a,b)     make_pair(a,b)
#define INF         numeric_limits<ll>::max();
#define NINF        numeric_limits<ll>::min();
#define vvi(a,b,name)    vector<vector<int>> name(a,vector<int>(b,-1))
const long double pi=3.14159265359;

inline ll add(ll a,ll b,ll m){
    if((a+b)>=m)return (a+b)%m;
    return a+b;
}

inline ll mul(ll a,ll b,ll m){
    if((a*b)<m)return a*b;
    return (a*b)%m;
}

int n;
ll a[200005];
map<pair<int,int>,ll> dp;

ll go(int i,int j){
    if(j>(i+1)/2)return NINF+mod;

    if(i<1 || j<1 )return 0;

    if(dp.find({i,j})!=dp.end())return dp[{i,j}];

    return dp[{i,j}]=max(go(i-2,j-1)+a[i],go(i-1,j));

}

void solve(){
    int n;cin>>n;
    rep(i,1,n+1)cin>>a[i];
    cout<<go(n,n/2);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long 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++

//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 100000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 200005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,dp[li][4][4];
int cev;
string s;
vector<int> v;

inline int f(int sira,int atla,int hak){
	int cevv=-inf;
	if(sira>n){
		if(hak)return -inf;
		return 0;
	}
	if(~dp[sira][atla][hak])return dp[sira][atla][hak];
	if(hak==1){
		cevv=max(cevv,f(sira+1,atla,0));
		if(atla==0)cevv=max(cevv,f(sira+1,1,1));
		if(atla==0)cevv=max(cevv,f(sira+1,1,0));
		cevv=max(cevv,f(sira+2,atla,1)+a[sira]);
	}
	else if(atla==1){
		cevv=max(cevv,f(sira+2,1,0)+a[sira]);
	}
	else{
		cevv=max(cevv,f(sira+1,1,0));
		cevv=max(cevv,f(sira+2,1,0)+a[sira]);
	}
	return dp[sira][atla][hak]=cevv;
}

main(void){
	memset(dp,-1,sizeof(dp));
	scanf("%lld",&n);
	if(n%2==0){
		for(int i=1;i<=inf;i++)
	}
	FOR scanf("%lld",&a[i]);
	if(n%2==0)cev=f(1,0,0);
	else cev=f(1,0,1);
	printf("%lld\n",cev);
	return 0;
}



Compiler output:
a.cc:62:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   62 | main(void){
      | ^~~~
a.cc: In function 'int main()':
a.cc:67:9: error: expected primary-expression before '}' token
   67 |         }
      |         ^
Language: C

//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 1000000000
#define ldb long double
#define pb push_back
#define get(x) x=read()
#define gt(x) scanf("%d",&x)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define gc(a) scanf("%s",a+1)
#define rep(p,n,i) for(RE ll i=p;i<=n;++i)
#define go(x) for(ll i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define fep(n,p,i) for(RE ll i=n;i>=p;--i)
#define pii pair<ll,ll> 
#define mk make_pair
#define RE register
#define P 1000000007
#define S second
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define ull unsigned long long
#define mod 998244353
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline ll read()
{
    register ll x=0,f=1;register char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
const ll MAXN=100005;
ll n;
ll a[MAXN];
ll f[MAXN][3];//f[i][j]前表示前i个数用掉j个空隙的最大值.
signed main()
{
	//freopen("1.in","r",stdin);
	get(n);
	rep(1,n,i)get(a[i]);
	memset(f,0xcf,sizeof(f));
	f[0][0]=0;f[1][0]=a[1];
	rep(2,n,i)
	{
		f[i][0]=f[i-2][0]+a[i];
		if(i>=3)f[i][1]=max(f[i-3][0]+a[i],f[i-2][1]+a[i]);
		if(i>=4)f[i][2]=max(f[i-4][0]+a[i],max(f[i-3][1]+a[i],f[i-2][2]+a[i]));
	}
	if(n&1)putl(max(max(f[n][1],f[n][2]),max(f[n-2][0],max(f[n-1][0],f[n-1][1]))));
	else putl(max(f[n][1],max(f[n][0],f[n-1][0])));
	return 0;
}


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>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

void solve0(ll n) {
    V<ll> a(n);
    V<ll> sum0(n), sum1(n + 2);
    rep(i, n) {
        cin >> a[i];
        (i & 1 ? sum1 : sum0)[i] = a[i];
    }
    rep(i, n - 1) sum0[i + 1] += sum0[i];
    FORR(i, n - 1) sum1[i] += sum1[i + 1];

    ll ans = sum1[0];
    for(int i = 0; i < n; i += 2) {
        chmax(ans, sum0[i] + sum1[i + 2]);
    }
    cout << ans << endl;
    exit(0);
}

void solve1(ll n) {
    ll sum = 0;
    V<ll> a(n + 1);
    FOR(i, 1, n + 1) cin >> a[i], sum += a[i];
    V<V<ll>> dp(n + 1, V<ll>(2, inf));
    dp[0][0] = 0;
    FOR(i, 1, n + 1) {
        if(i & 1) {
            chmin(dp[i][1], dp[i - 1][0] + a[i]);
            if(i > 1) chmin(dp[i][1], dp[i - 2][1] + a[i]);
        } else {
            chmin(dp[i][0], min(dp[i - 1][0], dp[i - 2][0]) + a[i]);
            chmin(dp[i][1], min(dp[i - 1][1], dp[i - 2][1]) + a[i]);
        }
    }
    cout << sum - min(dp[n - 1][1], dp[n][1]) << endl;

    exit(0);
}

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

    ll n;
    cin >> n;
    if(n % 2 == 0) solve0(n);
    solve1(n);

    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<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
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 fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int 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())

const int MAX = 51000;
const int MOD = 1000000007;

//最後をとっている場合
ll dptake[MAX][MAX];
//最後をとっていない場合
ll dpnot[MAX][MAX];

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


  ll ans = 0;
  //Nが偶数の時は簡単2patternしかない
  if(N%2==0){
    ll tmp = 0;
    for(ll i = 0; i < N; i+=2){
      tmp += a[i];
    }
    ans = tmp;
    tmp = 0;
    for(ll i = 1; i < N; i+= 2){
      tmp += a[i];
    }
    ans = max(ans,tmp);
    cout<<ans<<endl;
  }

  //Nが奇数の時はdpでこなしていく
  else{

    dptake[0][1] = a[0];

    for(ll i = 1; i < N; i++){
      for(ll j = (i+1)/2 -1; j <= (i+2)/2; j++){
        if(j>0){
          dptake[i][j] = dpnot[i-1][j-1] + a[i];
        }
        dpnot[i][j] = max(dptake[i-1][j], dpnot[i-1][j]);
      }
    }
    cout<<max(dptake[N-1][N/2], dpnot[N-1][N/2])<<endl;
  }

}


Compiler output:
/tmp/ccV2F62D.o: in function `main':
a.cc:(.text+0x1f4): relocation truncated to fit: R_X86_64_PC32 against symbol `dpnot' defined in .bss section in /tmp/ccV2F62D.o
a.cc:(.text+0x25c): relocation truncated to fit: R_X86_64_PC32 against symbol `dpnot' defined in .bss section in /tmp/ccV2F62D.o
a.cc:(.text+0x2b6): relocation truncated to fit: R_X86_64_PC32 against symbol `dpnot' defined in .bss section in /tmp/ccV2F62D.o
a.cc:(.text+0x326): relocation truncated to fit: R_X86_64_PC32 against symbol `dpnot' defined in .bss section in /tmp/ccV2F62D.o
collect2: error: ld returned 1 exit status
Language: C

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

ll dp[200010][3];

int main(){
  int n; cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  if(n%2==1){
    dp[0][0]=a[0];
    dp[1][1]=a[1];
    dp[2][2]=a[2];
  }
  else{
    dp[0][0]=a[0];
    dp[1][1]=a[1];
  }
  rep(i,n){
    rep(j,3){
      if(i-2>=0) dp[i][j]=dp[i-2][j]+a[i];
      if(i-3>=0&&j-1>=0) chmax(dp[i][j],dp[i-3][j-1]+a[i]);
      if(i-4>=0&&j-2>=0) chmax(dp[i][j],dp[i-4][j-2]+a[i]);
    }
  }
  ll ans=-1e18;
  if(n%2==1){
    chmax(ans,dp[n-1][2]);
    chmax(ans,dp[n-2][1]);
    chmax(ans,dp[n-3][0]);
  }
  else{
    chmax(ans,dp[n-1][1]);
    chmax(ans,dp[n-2][0]);
  }
  cout << ans << endl;
  
}

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

#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
 
 
ll dp[202020][2];
 
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
 
	int N;
	cin >> N;
	vector<ll>A(N);
	for (int i = 0; i < N; i++)cin >> A[i];
 
	dp[1][0] = -inf;
	dp[1][1] = A[0];
	dp[2][0] = A[1];
	dp[3][0] = A[2];
	dp[3][1] = A[0] + A[2];
	for (int i = 4; i <= N; i++) {
		if (i % 2 == 0) {
			ll pre2 = dp[i-2][0];
			ll pre3 = dp[i-3][1];
			dp[i][0] = max(pre2,pre3) + A[i-1];
		}
		else {
			ll pre2_0 = dp[i-2][0];
			ll pre3_0 = dp[i-3][0];
			ll pre4_0 = dp[i-4][1];
			dp[i][0] = max(pre2_0,max(pre3_0,pre4_0)) + A[i - 1];
			dp[i][1] = dp[i-2][1] + A[i - 1];
		}
	}
 
	if (N % 2 == 0) {
		puts(max(dp[N][0],dp[N-1][1]));
	}
	else {
		puts(max(dp[N][0],max(dp[N-1][0],dp[N-2][1])));
	}
 
	return 0;
}

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

use std::io;
use std::collections::*;
#[allow(dead_code)]
fn read() -> String
{
    let mut res = String::new();
    io::stdin().read_line(&mut res).unwrap();
    res
}
#[allow(unused_macros)]
macro_rules! read 
{
    () => 
    {
        read().trim().parse().unwrap();       
    };
}
#[allow(dead_code)]
fn read_vec() -> Vec<i64>
{
    read().split_whitespace().map(|x| x.parse::<i64>().unwrap()).collect()
}
fn solve(a : &Vec<i64>, rem : usize, pos : usize, m : &mut HashMap<(usize, usize), i64>) -> i64
{
    let cur = (rem, pos);
    if let Some(val) = m.get(&cur)
    {
        return *val;
    }
    if rem == 0
    {
        m.insert(cur, 0);
        return 0;
    }
    if rem > (a.len() - pos + 1) / 2
    {
        m.insert(cur, std::i64::MIN);
        return std::i64::MIN;
    }
    let res = solve(a, rem, pos + 1, m).max(solve(a, rem - 1, pos + 2, m) + a[pos]);
    m.insert(cur, res);
    res
}
fn main()
{
    let (n, a, mut m) : (usize, Vec<i64>, HashMap<(usize, usize), i64>) = (read!(), read_vec(), HashMap::default());
    println!("{}", solve(&a, n / 2, 0, &mut m));
}

Compiler output:
a.cc:3:2: error: invalid preprocessing directive #[
    3 | #[allow(dead_code)]
      |  ^
a.cc:10:2: error: invalid preprocessing directive #[
   10 | #[allow(unused_macros)]
      |  ^
a.cc:18:2: error: invalid preprocessing directive #[
   18 | #[allow(dead_code)]
      |  ^
a.cc:1:1: error: 'use' does not name a type
    1 | use std::io;
      | ^~~
a.cc:2:1: error: 'use' does not name a type
    2 | use std::collections::*;
      | ^~~
a.cc:4:1: error: 'fn' does not name a type
    4 | fn read() -> String
      | ^~
a.cc:11:1: error: 'macro_rules' does not name a type
   11 | macro_rules! read
      | ^~~~~~~~~~~
a.cc:19:1: error: 'fn' does not name a type
   19 | fn read_vec() -> Vec<i64>
      | ^~
a.cc:23:1: error: 'fn' does not name a type
   23 | fn solve(a : &Vec<i64>, rem : usize, pos : usize, m : &mut HashMap<(usize, usize), i64>) -> i64
      | ^~
a.cc:44:1: error: 'fn' does not name a type
   44 | fn main()
      | ^~
Language: C

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i > 1) {
      a[i] += a[i - 2];
    }
  }
  vector<long long> dp(n);
  dp[0] = max(0ll, a[0]);
  for (int i = 1; i < n; i++) {
    if (i & 1) {
      dp[i] = a[i - 1];
    } else {
      dp[i] = dp[i - 1];
    }
    if (i > 1) {
      dp[i] = max(dp[i], dp[i - 2] + a[i] - a[i - 2]);
    } else {
      dp[i] = max(dp[i], a[i]);
    }
  }
  cout << dp[n - 1] << '\n';
  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;
typedef long long ll;
const int N = 2e5 + 5;
ll dp[N][2],arr[N];
void solve()
{
	int n;
	cin >> n;

	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]});
			//i为奇数 i要选x个  x=i/2
			//i-1 位置已经维护好 x个  那么只能从 选了x-1的 地方进行转移，很明显i-2   i-3  是维护好了x-1个
			dp[i][1] = arr[i] + temp;

			dp[i][0]=max({dp[i-1][1],dp[i-1][0],arr[i-2]+dp[i-3][0]});
			//该位置不选，从x继承dp[i-1]
			//从 x-1 的一个位置：i-3不选  选i-2  转移
		}
		else
		{
			dp[i][1]=arr[i]+max({dp[i-2][1],dp[i-2][0],dp[i-1][0]，dp[i-3][1],dp[i-3][0]});
			///偶数位置 i  选当前位置
			///1、要选 i/2个 dp[i-2]的位置已经维护好了（i/2-1）个
			///2、前一个不选
			
			
			///i不选，
			///1、一定选i-1  维护前i个必须选i/2个的特性
			dp[i][0] = arr[i-1]+dp[i-2][0];//dp[i-2]选了x-1个 加a[i-1]必须要选
			//dp[i][0] = dp[i-1][1];不能这样写因为dp[i-1][1]可能只选了一个
			
		}
	}
	cout << max(dp[n][1], dp[n][0]) << endl;
	return;
}

int main()
{
	solve();
	return 0;
}
/*
没有两个相邻的被选上
8
1 2 3 4 -1 -2 -3 -4
*/


Compiler output:
a.cc: In function 'void solve()':
a.cc:32:78: error: expected '}' before '\U0000ff0cdp'
   32 |                         dp[i][1]=arr[i]+max({dp[i-2][1],dp[i-2][0],dp[i-1][0]，dp[i-3][1],dp[i-3][0]});
      |                                             ~                                ^~~~
a.cc:32:78: error: expected ')' before '\U0000ff0cdp'
   32 |                         dp[i][1]=arr[i]+max({dp[i-2][1],dp[i-2][0],dp[i-1][0]，dp[i-3][1],dp[i-3][0]});
      |                                            ~                                 ^~~~
      |                                                                              )
a.cc:32:101: error: expected ')' before '}' token
   32 |                         dp[i][1]=arr[i]+max({dp[i-2][1],dp[i-2][0],dp[i-1][0]，dp[i-3][1],dp[i-3][0]});
      |                                            ~                                                        ^
      |                                                                                                     )
a.cc:32:102: error: expected primary-expression before ')' token
   32 |                         dp[i][1]=arr[i]+max({dp[i-2][1],dp[i-2][0],dp[i-1][0]，dp[i-3][1],dp[i-3][0]});
      |                                                                                                      ^
a.cc: At global scope:
a.cc:45:9: error: 'cout' does not name a type
   45 |         cout << max(dp[n][1], dp[n][0]) << endl;
      |         ^~~~
a.cc:46:9: error: expected unqualified-id before 'return'
   46 |         return;
      |         ^~~~~~
a.cc:47:1: error: expected declaration before '}' token
   47 | }
      | ^
Language: C

/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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 pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
const int N = pow(10, 5);

vector<bool> isp(N + 1, true);

long long modMult(long long a, long long b, long long m)
{
    long long res = 0;
    long long exp = a % m;
    while (b)
    {
        if (b & 1)
        {
            res += exp;
            if (res > m)
                res -= m;
        }
        exp <<= 1;
        if (exp > m)
            exp -= m;
        b >>= 1;
    }
    return res;
}
long long powMod(long long a, long long b, long long m)
{
    long long res = 1;
    long long exp = a % m;
    while (b)
    {
        if (b & 1)
            res = modMult(res, exp, m);
        exp = modMult(exp, exp, m);
        b >>= 1;
    }
    return res;
}
//powMod(a,b,MOD)
//O(log(b))?
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    V vec(n);
    rep(i, n) cin >> vec[i];
    if (n % 2 == 0)
    {
        ll even=0, odd=0;
        rep(i, n)
        {
            if (i % 2 == 0)
            {
                even += vec[i];
            }
            else
            {
                odd += vec[i];
            }
        }
        cout << max(even, odd) << endl;
        return 0;
    }
    ll dp[n + 1][2][2];
    rep(i, n + 1) rep(j, 2) rep(k, 2) dp[i][j][k] = -1e18;
    dp[0][0][0]=0;
    rep(i, n)
    {
        chmax(dp[i+1][0][1],dp[i][0][0]);
        chmax(dp[i+1][1][1],dp[i][0][1]+vec[i]);
        chmax(dp[i+1][1][0],dp[i][0][0]+vec[i]);
        chmax(dp[i+1][0][1],dp[i][1][1]);
        chmax(dp[i+1][0][0],dp[i][1][0]);
        cout<<dp[i+1][0][0]<<" "<<dp[i+1][1][0]<<" "<<dp[i+1][0][1]<<" "<<dp[i+1][1][1]<<endl;
    }
    cout << max(dp[n][1][1],dp[n][0][1]) << endl;
}


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

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

#define INF 1e15

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vll a(n);
    rep(i,n) cin>>a[i];
    vector<vll> dp(n+1,vll(3,-INF));
    dp[0][1] = 0;
    dp[1][1] = 0, dp[1][2] = a[0];
    FOR(i,2,n)rep(j,3){
        int k = i/2+j-1;
        int j1 = k-(i-1)/2+1;
        int j2 = k-(i-2)/2;
        if (i&1 || j<2) dp[i][j] = max(dp[i-1][j1], dp[i-2][j2]+a[i-1]);
    }
    cout<<dp[n][1]<<"\n";
    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

# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

#f = open("/Users/naoki/Documents/Atcoder/input.txt")
N = int(input())
A = list(map(int, input().split()))
A.insert(0, 0)

select_num = N//2


Dp = [[[-9999 for _ in range(2)] for _ in range(N+1)] for _ in range(N+1)]

for i in range(1,N+1):
    Start = (i-1)//2
    End = (i+1)//2
    
    for j in range(Start,End+1):
        Dp[i][j][0] = max(Dp[i-1][j][1], Dp[i-1][j][0])   
        # [0] in 3rd dimension  not chosen at last num
        # must be transfered from [i-1]
    for j in range(Start,End+1):
        if Dp[i-1][j-1][0] == -9999 and j == 1:
            Dp[i][j][1] = 0 + A[i]
        else:
            Dp[i][j][1] = Dp[i-1][j-1][0]+A[i]

print(max(Dp[-1][select_num][0], Dp[-1][select_num][1]))

Compiler output:
main.c:1:3: error: invalid preprocessing directive #-
    1 | # -*- coding: utf-8 -*-
      |   ^
main.c:2:1: error: expected identifier or '(' before string constant
    2 | """
      | ^~
main.c:2:3: warning: missing terminating " character
    2 | """
      |   ^
main.c:2:3: error: missing terminating " character
main.c:6:3: warning: missing terminating " character
    6 | """
      |   ^
main.c:6:3: error: missing terminating " character
main.c:8:2: error: invalid preprocessing directive #f; did you mean #if?
    8 | #f = open("/Users/naoki/Documents/Atcoder/input.txt")
      |  ^
      |  if
main.c:24:11: error: invalid preprocessing directive #[
   24 |         # [0] in 3rd dimension  not chosen at last num
      |           ^
main.c:25:11: error: invalid preprocessing directive #must
   25 |         # must be transfered from [i-1]
      |           ^~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int n;
vector<long long> a(200200, 0);
long long dp[200200][2];
long long odddp[200200][2][2];

long long dpcheck(int limit) {
    dp[1][0] = a.at(0); dp[1][1] = a.at(1);
    for(int i = 1; i < limit; ++ i) {
        for(int j = 0; j < 2; ++j) {
            if(j == 0) chmax(dp[i+1][0], dp[i][j]+a.at(2*i));
            chmax(dp[i+1][1], dp[i][j]+a.at(2*i+1));
        }
    }
    return max(dp[limit][0], dp[limit][1]);
}

int main() {
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> a.at(i);
    for(int i = 0; i <= n; ++i) {
        dp[i][0] = -1e18;
        dp[i][1] = -1e18;
        odddp[i][0][0] = odddp[i][0][1] = odddp[i][1][0] = odddp[i][1][1] = -1e18;
    }

    int nlimit = n/2;
    if(n % 2 == 0) {
        cout << dpcheck(nlimit) << endl;
    }else {
        // 奇数かつ最後の要素を使うパターン
        odddp[1][0][0] = a.at(n-1)+a.at(0); odddp[1][1][0] = a.at(n-1)+a.at(1);
        odddp[1][0][1] = a.at(n-1);
        for(int i = 1; i < nlimit; ++i) {
            for(int j = 0; j < 2; ++j) {
                for(int k = 0; k < 2; ++k) {
                    if(k == 0) chmax(odddp[i+1][0][1], odddp[i][j][k]);
                    if(j == 0) chmax(odddp[i+1][0][k], odddp[i][j][k]+a.at(2*i));
                    if(i != nlimit-1) chmax(odddp[i+1][1][k], odddp[i][j][k]+a.at(2*i+1));
                }
            }
        }
        cout << max({dpcheck(nlimit), odddp[nlimit][0][1], odddp[nlimit][1][1]}) << endl;
    }
}

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

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

//解説参考.
int main(){
	int n;
	cin>>n;
	
	vector<llong> a(n);
	REP(i,n) cin>>a[i];
	
	vector<vector<llong> > dp(n,vector<llong>(n+1,-INF));
	dp[0][0]=0;
	dp[0][1]=a[0];
	dp[1][0]=0;
	dp[1][1]=max(a[0],a[1]);
	for(int i=2;i<n;++i){
		for(int j=(i+1-1)/2;j<=(i+1+1)/2;++j){
			dp[i][j]=max(dp[i-1][j],dp[i-2][j-1]+a[i]);
		}
	}
	
	//REP(i,n) cout<<dp[i][(i+1)/2]<<endl;
	
	cout<<dp[n-1][n/2]<<endl;
}

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}

// https://atcoder.jp/contests/abc162/submissions/11879810
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  vector<map<int, ll> > dp(n + 2);
  dp[0][0] = 0;
  rep(i, n) {
    // [0, i - 1] の個数, max sums
    for (const auto &[c, val] : dp[i]) {
      // 0 との max をとらないよう
      if (!dp[i + 1].count(c)) dp[i + 1][c] = -INF;
      chmax(dp[i + 1][c], dp[i][c]);

      if (!dp[i + 2].count(c + 1)) dp[i + 2][c + 1] = -INF;
      chmax(dp[i + 2][c + 1], dp[i][c] + a[i]);
    }
  }
  ll ans = -INF;
  rep(i, n + 2) if (dp[i].count(n / 2)) chmax(ans, dp[i][n / 2]);
  cout << ans << endl;
}


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