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

#include <bits/stdc++.h>

using namespace std;
struct st{
    int val, index;
    bool operator < (const st &a)const{
        return val  > a.val;
    }
};
vector<st>v;
set <int> index;

int main()
{
    int n, i, x;
    cin>>n;
    st aux;

    long long sum = 0;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        aux.val =x;
        aux.index = i;
        v.push_back(aux);
    }
    aux .val =0;
    aux.index = -1;
    sort(v.begin(), v.end());
    aux = v[0];
    sum = sum + aux.val;
    int c =0;
    c++;
    index.insert(aux.index);
    for(i=1;i<v.size();i++)
    {
        if(index.find(v[i].index-1) == index.end() && index.find(v[i].index +1) == index.end() )
        {
            aux = v[i];
            index.insert(aux.index);
            sum = sum + aux.val;
            c++;
            if(c == (n>>1))
                break;
        }
    }
   cout<<sum<<"\n";

    return 0;
}


Compiler output:
a.cc:11:11: error: 'std::set<int> index' redeclared as different kind of entity
   11 | set <int> index;
      |           ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:34:11: error: overloaded function with no contextual type information
   34 |     index.insert(aux.index);
      |           ^~~~~~
a.cc:37:18: error: overloaded function with no contextual type information
   37 |         if(index.find(v[i].index-1) == index.end() && index.find(v[i].index +1) == index.end() )
      |                  ^~~~
a.cc:37:46: error: overloaded function with no contextual type information
   37 |         if(index.find(v[i].index-1) == index.end() && index.find(v[i].index +1) == index.end() )
      |                                              ^~~
a.cc:37:61: error: overloaded function with no contextual type information
   37 |         if(index.find(v[i].index-1) == index.end() && index.find(v[i].index +1) == index.end() )
      |                                                             ^~~~
a.cc:37:90: error: overloaded function with no contextual type information
   37 |         if(index.find(v[i].index-1) == index.end() && index.find(v[i].index +1) == index.end() )
      |                                                                                          ^~~
a.cc:40:19: error: overloaded function with no contextual type information
   40 |             index.insert(aux.index);
      |                   ^~~~~~
Language: C++

// clang-format off
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
#define DEB(variable) cout << #variable << '=' << variable << endl

#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr long long int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

// clang-format on
int main(){

    llint n;
    cin>>n;
    vector v(2, vector(n / 2 + 2, 0ll));
    REP(i,n){
        cin >> v[1 & i][i / 2];
    }
    vector sum(2, vector(2 + n / 2, 0ll));
    REP(i,n){
        sum[i & 1][1 + i / 2] += v[i & 1][i / 2]+sum[i & 1][i / 2];
    }
    llint result = -linf;
    if(n%2==0){
        REP(i,1+n/2){
            result = max(result,max(sum[1][n / 2] - sum[1][i] + sum[0][i] - sum[0][0], result));

        }
        cout << result << endl;
    }else{
        REP(i,)
    }   

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:101: error: expected primary-expression before ')' token
   16 | #define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)
      |                                                                                                     ^
a.cc:45:9: note: in expansion of macro 'REP'
   45 |         REP(i,)
      |         ^~~
a.cc:46:5: error: expected primary-expression before '}' token
   46 |     }
      |     ^
Language: Java

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import sun.util.logging.resources.logging;
public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int n;
        n=nextInt();
        Long[] arr = new Long[n];
        for(int i=0;i<n;i++){
            arr[i]=nextLong();
        }
        long sum1,sum2;
        //Long con =0L;
        //Long k = n/2L;

        List<Long> list_sum1 = new ArrayList<Long>();
        List<Long> list_sum2 = new ArrayList<Long>();
        sum1=0L;
        sum2=0L;
        for(int i=0;i<n;i++){
            if(i%2==0) list_sum1.add(arr[i]);
            else list_sum2.add(arr[i]);
        }
        Collections.sort(list_sum1);
        Collections.sort(list_sum2);
        if(list_sum1.size()>list_sum2.size()) list_sum1.remove(0);
        for(Long a:list_sum1){
            sum1+=a;
        }
        for(Long a:list_sum2){
            sum2+=a;
        }
        print(Math.max(sum1,sum2));
    }



    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }
    public static void print(Object a){
        System.out.println(a);
    }
}

Compiler output:
Main.java:8: error: package sun.util.logging.resources is not visible
import sun.util.logging.resources.logging;
                       ^
  (package sun.util.logging.resources is declared in module java.logging, which does not export it)
1 error
Language: C

#include <iostream>
#include <cstdio>

using namespace std;

const int N = 100005;

typedef long long LL;

int n, a[N], Lm[N], Rm[N];

LL L[N], R[N], f[N][2], g[N][2];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", a + i);
	if (n % 2 == 0) {
		LL v1 = 0, v2 = 0;
		for (int i = 1; i <= n; i += 2) {
			v1 += a[i];
			v2 += a[i + 1];
		}
		printf("%lld\n", max(v1, v2));
	} else {
		LL ans = 0;
		for (int i = 2; i <= n; i += 2) ans += a[i];
		LL v1 = 0;
		int v2 = 2e9;
		for (int i = 1; i <= n; i += 2) v1 += a[i], v2 = min(v2, a[i]);
		ans = max(ans, v1 - v2);
		L[1] = Lm[1] = a[1];
		for (int i = 2; i <= n; i++) {
			L[i] = L[i - 2] + a[i];
			if (i == 2) Lm[i] = a[i];
			else Lm[i] = min(Lm[i - 2], a[i]);
		}
		for (int i = n; i; i--) {
			R[i] = R[i + 2] + a[i];
			Rm[i] = a[i];
			if (i + 2 <= n) Rm[i] = min(Rm[i], Rm[i + 2]);
		}
		for (int i = 1; i + 3 <= n; i++) {
			ans = max(ans, L[i] + R[i + 3]);
		}
		f[2][1] = a[2];
		for (int i = 4; i <= n; i += 2) {
			f[i][1] = f[i - 2][1] + a[i];
			f[i][0] = max(L[i - 3] + a[i], f[i - 2][0] + a[i]);
		}
		g[n - 1][1] = a[n - 1];
		for (int i = n - 3; i; i -= 2) {
			g[i][1] = g[i + 2][1] + a[i];
			g[i][0] = max(R[i + 3] + a[i], g[i + 2][0] + a[i]);
		}
		for (int i = 2; i + 2 <= n; i++) {
			ans = max(ans, f[i][0] + g[i + 2][0]);
		}
		printf("%lld\n", ans);
	}
	return 0;
}

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

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl '\n'

int main()
{
    

    int n;
    cin>>n;
    ll a[n+10];
    ffor(i,0,n) cin>>a[i];
    if(n==2)
    {
        cout<<max(a[0],a[1]);
        return 0;
    }

    ll dp[n+10][3];

    ffor(i,n,n+10) 
    {
        a[i]=-1e17;
        dp[i][0]=dp[i][1]=dp[i][2]=-1e17;
    }
    mem(dp,0);
    dp[n-1][0]=a[n-1];
    dp[n][1]=0;
    dp[n+1][2]=0;

    bfor(i,n,0)
    {
        dp[i][0]=a[i]+dp[i+2][0];
        dp[i][1]=max(dp[i+3][0]+a[i],dp[i+2][1]+a[i]);
        dp[i][2]=max(dp[i+3][1]+a[i],dp[i+4][0]+a[i],dp[i+2][2]+a[i]);
        
    }

   // ffor(i,0,n) cout<<dp[i][0]<<" "<<dp[i][1]<<" "<<dp[i][2]<<endl;
    
    if(n&1)
    {
        cout<<max({dp[0][0],dp[0][1],dp[0][2],dp[1][0],dp[1][1],dp[2][0]});
    }
    else cout<<max({dp[0][0],dp[0][1],dp[1][0]});

    return 0;
}



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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}

int main(){
    ll n;cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    vi dpl(n),dpr(n);
    ll s=0,t=0;
    rep(i,n){
        if(i&1)s+=v[i];
        else t+=v[i];
        dpl[i]=max(s,t);
    }
    if(n%2==0)dame(dpl[n-1]);
    s=0;t=0;
    for(int i=n-1;i>=0;i--){
        if(i&1)s+=v[i];
        else t+=v[i];
        dpr[i]=max(s,t);
    }
    ll ans=max(dpr[1],dpl[n-2]);
    for(int i=2;i<n-2;i+=2){
        chmax(ans,dpl[i-1]+dpr[i+1]);
    }
    out(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<cstdio>
using namespace std;
#define int long long
const int N=302019;
int a[N],f[N][4],sf[N],pr[N];
#undef int
int main()
{
	#define int long long
	int n; cin>>n;
	for(int i=1;i<=n;i++)scanf("%lld",a+i);
	pr[1]=a[1]; pr[2]=a[2];
	for(int i=3;i<=n;i++)pr[i]=pr[i-2]+a[i];
	for(int i=1;i<=n;i++)f[i][0]=f[i][1]=f[i][2]=-1e18;
	f[1][0]=a[1]; f[2][0]=a[2];
	for(int i=3;i<=n;i++){
		f[i][1]=max(f[i-2][1]+a[i],pr[i-3]+a[i]);
		f[i][2]=max(f[i-2][2]+a[i],f[i-3][1]+a[i]);
		if(i>3)f[i][2]=max(f[i][2],pr[i-4]+a[i]);
	}
	if(n&1)cout<<max(pr[n]-a[1],max(max(pr[n-2],pr[n-1]),max(f[n][2],max(f[n-1][1],f[n][1]))))<<endl;
	else cout<<max(pr[n],max(pr[n-1],f[n][1]))<<endl;
	return 0;
}

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:43:41: error: no matching function for call to 'max(const long long int&)'
   43 |                 cout<<max(dp[n-2][0],max(max(dp[n-1][1],dp[n][2])))<<endl;
      |                                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:43:41: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   43 |                 cout<<max(dp[n-2][0],max(max(dp[n-1][1],dp[n][2])))<<endl;
      |                                      ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C

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

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	ll N;
	cin>>N;
    vector<ll> A(N);
    rep(i,N){
        cin>>A[i];     
    }
    
    ll ans = 0;
    rep(i,N/2){
        ans += A[i*2];
    }
    ll s = ans;
    if(N%2==0){
        ll ind = N-1;
        while(ind>=1){
            s+=A[ind];
            s-=A[ind-1];
            ind-=2;
            ans = max(ans,s);
        }
    }else{
        ll ind = N-2;
        while(ind>=1){
            s+=A[ind];
            s-=A[ind-1];
            ind-=2;
            ans = max(ans,s);
        }
        ind = N-1;
        while(ind>1){
            s+=A[ind];
            s-=A[ind-1];
            ind-=2;
            ans = max(ans,s);
        }
    }

    cout<<ans<<"\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;
long long n,s1,s2,vals[200005],sufans[200005],prefans[200005];

int main(){
    cin >> n;
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }
    for(int i = 0 ; i < n ; i += 1){
        cin >> vals[i];
        if(i % 2 == 0){
            s1 += vals[i];
        }else{
            s2 += vals[i];
        }
    }
    for(int i = n-1 ; i >= 0 ; i -= 1){
        if((n-i)%2 == 0){
            sufans[i] = vals[i] + max(sufans[i+2],sufans[i+3]);
        }else{
            sufans[i] = vals[i] + sufans[i+2];
        }
    }
    for(int i = 0 ; i < n ; i += 1){
        if((i+1)%2 == 0){
            long long a = -1000000000000000000;
            if(i-3 >= 0){
                a = prefans[i-3];
            }
            prefans[i] = vals[i]+max(prefans[i-2],a);
        }else{
            long long a = 0;
            if(i-2 >= 0){
                a = prefans[i-2];
            }
            prefans[i] = vals[i]+a;
        }
    }
    if(n % 2 == 0){
        cout << max(s1,s2) << endl;
        return 0;
    }
    long long maxi = sufans[2];
    for(int i = 0 ; i+3 <= n ; i += 1){
        if((i+1)%2 == 0){
            maxi = max(maxi,sufans[i+3]+max(prefans[i],prefans[i-1]));
        }else{
            maxi = max(maxi,prefans[i]+max(sufans[i+3],sufans[i+4]));
        }
    }
    cout << max(maxi,prefans[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<iostream>
#include<bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb(x)	cout << #x << " " << x << endl;

typedef long long int ll;

#define N 200001
ll dp[N];
ll ans = 0;
ll a[N];
int choose, n;

void calc(int cur, int count, ll sum) {
	if (count == choose) {
		ans = max(ans, sum);
		return;
	}

	if (cur >= n)
		return;

	calc(cur + 1, count, sum);

	sum = sum + a[cur];

	calc(cur + 2, count+1,  sum);

}

int main() {

	IOS

	cin >> n;

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

	choose = n/2;

	calc(0, 0, 0);

	cout << ans;

	return 0;
}

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

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()
A = LI()
dp = [0] * n
if n % 2:
    ret2 = 0
    dp2 = [0] * n
    dp2[0] = A[0]
    dp2[1] = A[1]
    for i in range(n):
        if i == 0:
            ret = 0
        elif i == 1:
            ret = A[1]
        elif i >= 2:
            dp2[i] = dp2[i - 2] + A[i]
            ret = max(ret, dp[i - 2] + A[i])
        elif i >= 3:
            ret = max(ret, dp[i - 3] + A[i])
        elif i >= 4:
            ret = max(ret, dp2[i - 4] + A[i])
        dp[i] = ret
    print(max(dp[-1], dp[-2], dp[-3]))
else:
    for i in range(n):
        ret = A[i]
        if i >= 2:
            ret = max(ret, dp[i - 2] + A[i])
        elif i >= 3:
            ret = max(ret, dp[i - 3] + A[i])
        dp[i] = ret
    print(max(dp[-1], dp[-2]))






Compiler output:
main.c:1:1: error: unknown type name 'from'
    1 | from collections import defaultdict, deque, Counter
      | ^~~~
main.c:1:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'import'
    1 | from collections import defaultdict, deque, Counter
      |                  ^~~~~~
main.c:1:18: error: unknown type name 'import'
main.c:18:62: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   18 | def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
      |                                                              ^~~~~~~
main.c:19:61: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   19 | def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
      |                                                             ^~~~~~~
Language: C

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#define int long long 
using namespace std;
const int maxn = 1e6+10;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int k,m,n;
int a[maxn];
int dp[maxn][2],sum[maxn][2],max_[maxn];
signed main(){
	n=read();
	for(register int i=1;i<=n;i++)a[i]=read();
	if(n%2==0){
		int sum1=0,sum2=0;
		for(register int i=1;i<=n;i++){
			if(i%2==0)sum1+=a[i];
			else sum2+=a[i];
		}
		printf("%lld\n",max(sum1,sum2));
		return 0;
	}
	for(register int i=1;i<=n;i++){
		sum[i][0]=sum[i-1][0];
		sum[i][1]=sum[i-1][1];
		if(i%2==0)sum[i][0]+=a[i];
		else sum[i][1]+=a[i];
	}
	/*memset(dp,-0x3f,sizeof(dp));
	for(register int i=1;i<=n;i++){
		int x=0;
		if(i-2>0)x=dp[i-2][0];
		else x=0;
		dp[i][0]=max(dp[i][0],x+a[i]);
		if(i-3>0)x=dp[i-3][0];
		else x=0;
		dp[i][1]=max(dp[i][1],x+a[i]);
		cout<<i<<" "<<dp[i][0]<<" "<<dp[i][1]<<endl;
	}
	printf("%lld\n",max(dp[n][0],max(dp[n][1],dp[n-1][0])));*/
	int ans=-1e16;
	for(register int i=1;i<n;i++){
		int summ=0,x=(i-1)%2;
		summ+=sum[i-1][x];
		summ+=sum[n][x^1]-sum[i+1][x^1];
		ans=max(ans,summ);
	}
	int summ=sum[n][(n-1)%2];
	for(register int i=1;i<n;i+=2){
		max_[i]=summ+sum[i+1][1]-sum[i+1][0];
		//cout<<i<<" "<<max_[i]<<" "<<sum[i+1][1]<<" "<<sum[i+1][0]<<" "<<summ<<endl;
		if(i>2)max_[i]=max(max_[i],max_[i-2]);
	}
	int maxx=0;
	for(register int i=n-1;i>1;i-=2){
		maxx=max(maxx,(sum[n][1]-sum[i-1][1])-(sum[n][0]-sum[i-1][0]));
		//cout<<i<<" "<<maxx<<" "<<max_[i+1]<<" "<<(sum[n][1]-sum[i-1][1])<<" "<<(sum[n][0]+sum[i-1][0])<<endl;
		ans=max(ans,max_[i+1]+maxx);
	}
	printf("%lld\n",ans);
	return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

#define int long long

void solve() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; ++i) cin >> a[i];
    vector <vector <int> > dp(n + 1, vector <int> (2 + n % 2, -1e18));
    dp[0][0] = 0;
    for (int i = 1; i <= n; ++i) {
        //cout << i << endl;
        if (i - 2 < 0) dp[i][0] = max(dp[i][0], a[i - 1]);
        else {
            dp[i][0] = max(dp[i - 2][0] + a[i - 1], dp[i][0]);
            dp[i][1] = max(dp[i - 2][1] + a[i - 1], dp[i][1]);
            if (n % 2) dp[i][2] = max(dp[i - 2][2] + a[i - 1], dp[i][2]);
        }
        if (i - 3 >= 0) {
            dp[i][1] = max(dp[i][1], dp[i - 3][0] + a[i - 1]);
            if (n % 2) dp[i][2] = max(dp[i][2], dp[i - 3][1] + a[i - 1]);
        }
        if (i - 4 > 0 && n % 2) {
            dp[i][2] = max(dp[i][2], dp[i - 4][0] + a[i - 1]);
        }
    }
    //for (int i = 0; i <= n; ++i) for (int j = 0; j < 2 + n % 2; ++j) cout << i << ' ' << j << ' ' << dp[i][j] << '\n';
    int ans = dp[n][1];
    if (n % 2 == 0) ans = max(ans, dp[n][0]);
    if (n % 2) ans = max(ans, dp[n][2]);
    ans = max(ans, dp[n - 1][0]);
    if (n % 2) ans = max(ans, dp[n - 1][1]);
    if (n % 2) {
        ans = max(ans, dp[n - 2][0]);
    }
    cout << ans;
    /*if (n % 2 == 0) {
        int od = 0, ev = 0;
        for (int i = 0; i < n; ++i) {
            if (i % 2) od += a[i];
            else ev += a[i];
        }
        int ans = max(od, ev);
        int odl = 0, odr = 0, evl = 0, evr = 0;
        for (int i = 0; i < n; ++i) {
            if (i % 2) odr += a[i];
            else evr += a[i];
        }
        for (int i = 0; i < n - 1; ++i) {
            if (i % 2) {
                odr -= a[i];
                ans = max(ans, evl + odr);
                odl += a[i];
            }
            else {
                evr -= a[i];
                ans = max(ans, odl + evr);
                evl += a[i];
            }
        }
        cout << ans;
        return;
    }
    int odl = 0, odr = 0, evl = 0, evr = 0;
    for (int i = 0; i < n; ++i) {
        if (i % 2) odr += a[i];
        else evr += a[i];
    }
    int ans = -1e18;
    for (int i = 0; i < n - 1; ++i) {
        if (i % 2) {
            odr -= a[i];
            ans = max(ans, evl + odr);
            odl += a[i];
        }
        else {
            evr -= a[i];
            ans = max(ans, odl + evr);
            evl += a[i];
        }
    }
    cout << ans;*/
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    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>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

ll n;
vl as;
vvl dp;

ll dfs(int m, int d) {
    if (m == n / 2) return 0;
    if (dp[m][d]) return dp[m][d];
    ll res = -LINF;
    chmax(res, as[m * 2 + d] + dfs(m + 1, d));
    if (d <= 1) chmax(res, as[m * 2 + d + 1] + dfs(m + 1, d + 1));
    if (d == 0) chmax(res, as[m * 2 + d + 2] + dfs(m + 1, d + 2));
    return dp[m][d] = res;
}

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

    cin>>n;
    as = vl(n);
    cin>>as;
    dp = vvl(n / 2, vl(3));

    ll ans = dfs(0, 0);
    cout<<ans<<endl;
}

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

#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010], n;
map<int, ll> mem[100010];
ll dp(int x, int nm){
	if(nm==1){
		if(x>=n)
			return -1e17;
		return a[x];
	}
	if(n-x<(nm-1)*2+1){
		return -1e17;
	}
	if(mem[x].count(nm)){
		return mem[x][nm];
	}
	ll res=a[x];
	res=a[x]+dp(x+2, nm-1);
	// if((n-x-2)>2*(nm-1)){
		res=max(res, a[x]+dp(x+3, nm-1));
	// }
	mem[x][nm]=res;
	return res;
}
int main(){
    while(cin>>n){
        ll ans=0;
        for(int i=0; i<n; ++i){
        	mem[i].clear();
            scanf("%d",a+i);
        }
        ans=max(dp(0, n/2), dp(1, n/2));
        ans=max(ans, dp(2, n/2));
        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

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

int n;
/*
ll dp[200005][2];
ll a[200005];
ll solve(int index,int taken,int c)
{
    if(index>=n && c!=n/2) return LLONG_MIN;
    if(index>=n && c==n/2) return  0;
    if(c==n/2) return 0;
    if(n%2==0 && c>=n/2+1) return LLONG_MIN;
    if(n%2!=0 && c>=(n+1)/2) return LLONG_MIN;
    ll &ret = dp[index][taken];
    if(~ret) return ret;
    ret = 0;
    if(taken==1)
    {
        ret = max(ret,solve(index+1,0,c));
    }
    else
    {
        ret = max(ret,solve(index+1,0,c));
        ret = max(ret,solve(index+1,1,c+1)+a[index]);
    }
    return ret;
}
*/
struct lol
{
    ll val;
    int pos;
    bool operator < (lol a)
    {
        return val > a.val;
    }
};
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    vector<lol> a(n);
    for(int i=0;i<n;++i)
    {
        ll x; cin>>x;
        a[i].val = x;
        a[i].pos = i;
    }
    sort(a.begin(),a.end());
    set<int> x;
    //for(auto l : a) cout<<l.val<<" ";
    ll ans = 0; int c = 0;
    for(int i=0;i<n;++i)
    {
        if(x.find(a[i].pos-1)!=x.end() || x.find(a[i].pos+1)!=x.end())
        {
            //cout<<a[i].val<<" ";
        }
        else
        {
            x.insert(a[i].pos);
            ans+=a[i].val;
            c++;
        }
        if(c==n/2) break;
    }
    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>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
const ll INF = 9999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    vl A;
    ll dp[n][4]; //どこまで見たか・i番目まで見たときにi-(使った数)*2+2
    rep(i, n) {
        cin >> a;
        A.push_back(a);
    }

    rep(i, n) {
        if(i == 0) {
            dp[0][0] = A[0];
            dp[0][1] = -INF;
            dp[0][2] = -INF;
        } else {
            if(i == 1)
                dp[i][0] = -INF;
            else
                dp[i][0] = dp[i - 2][0] + A[i];
            if(i == 1)
                dp[i][1] = A[i];
            else
                dp[i][1] = dp[i - 2][1] + A[i];
            if(i > 2)
                dp[i][1] = max(dp[i - 3][0] + A[i], dp[i][1]);
            if(i == 1)
                dp[i][2] = -INF;
            else if(i == 2)
                dp[i][2] = A[i];
            else
                dp[i][2] = dp[i - 2][2] + A[i];
            if(i > 2)
                dp[i][2] = max(dp[i - 3][1] + A[i], dp[i][2]);
            if(i > 3)
                dp[i][2] = max(dp[i - 4][0] + A[i], dp[i][2]);
        }
    }

    if(n % 2 == 0)
        ans = max(dp[n - 2][0], dp[n - 1][1]);
    else
        ans = max({dp[n - 3][0], dp[n - 2][1], dp[n - 1][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 "bits/stdc++.h"
using namespace std;

const int MAXN = 2e5 + 5;
const long long MAX = 2e9, INF = 1e18;

int n;
long long a[MAXN];
long long finalAns, sumL[MAXN][2], sumR[MAXN][2];
long long ans[MAXN][3];
bool found[MAXN][3];

long long dp(int pos, int rem){
	if(pos >= n)
		return (rem == 0) ? 0:-INF;
	if(found[pos][rem])
		return ans[pos][rem];
	found[pos][rem] = true;
	ans[pos][rem] = dp(pos+2, rem)+a[pos];
	if(rem > 0)
		ans[pos][rem] = max(ans[pos][rem], dp(pos+1, rem-1));
	return ans[pos][rem];
}

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; ++i){
		scanf("%lld", &a[i]);
		a[i] += MAX;
	}
	if(n%2 == 0){
		finalAns = max(dp(0, 0), dp(0, 1));
	}else{
		finalAns = max(dp(0, 1), dp(0, 2));
	}
	printf("%lld\n", finalAns-(MAX*(n/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

//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


ll dp[200001][3][2];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


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

	rep(i, N + 1) rep(j, 3) rep(k, 2) dp[i][j][k] = -1e18;
	dp[0][0][0] = 0;
	rep(i, N) {
		int a = A[i];
		chmax(dp[i + 1][1][0], dp[i][0][0]);
		chmax(dp[i + 1][0][1], dp[i][0][0] + a);

		chmax(dp[i + 1][0][0], dp[i][0][1]);

		chmax(dp[i + 1][2][0], dp[i][1][0]);
		chmax(dp[i + 1][1][1], dp[i][1][0] + a);

		chmax(dp[i + 1][1][0], dp[i][1][1]);

		chmax(dp[i + 1][2][1], dp[i][2][0] + a);

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

	if (N % 2) {
		ll kotae = dp[N][1][0];
		chmax(kotae, dp[N][2][1]);
		co(kotae);
	}
	else {
		co(max(dp[N][0][0], dp[N][1][1]));
	}

	Would you please return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int64_t sum;
  cin >> N;
  vector<int> vec(N);
  
    for (int i = 0; i < N; i++) {
      cin >> vec.at(i);
    }
  
  sort(vec.begin(), vec.end());
     for (int i = 0; i < vec.size(); i++) {
    }
    for (int i = 0; i < N / 2; i += 2){
      sum +=vec.at(i+1);
    }
  cout << sum << endl;
}

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

#include <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--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const ll mod = 1e9 + 7;

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

    ll n;
    cin >> n;
    vll a(n);
    REP(i, n) cin >> a[i];

    if (n % 2 == 0) {
        ll ev = 0, od = 0;
        REP(i, n) {
            if (i % 2) od += a[i];
            else ev += a[i];
        }
        ll res = max(od, ev);
        cout << res << endl;
        return 0;
    }

    // dp[i][j] : i 文字目まで見て j 回パスしたときの和の最大値
    vvll dp(n, vll(3, -1e15));
    dp[0][0] = a[0];
    dp[1][1] = a[1];
    dp[2][2] = a[2];
    REP(i, n) {
        if (i < 2) continue;
        REP(j, 3) {
            dp[i][j] = max(dp[i][j], dp[i - 2][j] + a[i]);
        }
        dp[i][1] = max(dp[i][1], dp[i - 1][0] - a[i - 1] + a[i]);
        dp[i][2] = max(dp[i][2], dp[i - 1][1] - a[i - 1] + a[i]);
    }
    ll res = -1e15;
    REP(j, 3) {
        res = max(res, dp[n - 1][j]);
    }
    cout << res << endl;
    return 0;
}

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

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

int main() {
  int64_t N, CO, CE, C;
  cin >> N;
  vector<int64_t> vec(N);
  CO = 0;
  CE = 0;
  
  for (int64_t i = 0; i < N; i++) {
    if (i % 2 == 0) { // 奇数項
      cin >> vec.at(i);
      CO = CO + vec.at(i);
    }
    if (i % 2 == 1) { // 偶数項
      cin >> vec.at(i);
      CE = CE + vec.at(i);
    }
  }
  
  if (CO > CE) {
    cout << CO;
  }
  else if (CO < CE) {
    cout << CE;
  }
}

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++)

using namespace std;
using lint=long long;

const long long INF=1LL<<61;

int main(){
	int n; scanf("%d",&n);
	vector<lint> a(n);
	rep(i,n) scanf("%lld",&a[i]);

	lint ans;
	if(n%2==0){
		lint sum1=0,sum2=0;
		rep(i,n){
			if(i%2==0) sum1+=a[i];
			else       sum2+=a[i];
		}
		ans=max(sum1,sum2);
	}
	else{
		static lint dp[200002][3];
		rep(i,n+2) rep(j,3) dp[i][j]=-INF;
		dp[0][0]=0;
		rep(i,n){
			dp[i+2][0]=dp[i][0]+a[i];
			dp[i+2][1]=dp[i][1]+a[i];
			if(i>=1) dp[i+2][1]=max(dp[i+2][1],dp[i-1][0]+a[i]);
			dp[i+2][2]=dp[i][2]+a[i];
			if(i>=1) dp[i+2][2]=max(dp[i+2][2],dp[i-1][1]+a[i]);
			if(i>=2) dp[i+2][2]=max(dp[i+2][2],dp[i-2][0]+a[i]);
		}
		ans=max({dp[n-1][0],dp[n][1],dp[n+1][2]});
	}
	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

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

int main() {
  double N, CO, CE, C;
  cin >> N;
  vector<double> vec(N);
  CO = 0;
  CE = 0;
  
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) { // 奇数項
      cin >> vec.at(i);
      CO = CO + vec.at(i);
    }
    if (i % 2 == 1) { // 偶数項
      cin >> vec.at(i);
      CE = CE + vec.at(i);
    }
  }
  
  if (CO > CE) {
    cout << CO;
  }
  else if (CO < CE) {
    cout << CE;
  }
}

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 <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


int main(){
    LL n;
    cin >> n;
    vector<LL> a(n);
    for(LL i = 0; i < n; ++i){
        cin >> a[i];
    }
    vector<vector<LL>> dp(n+2, vector<LL>(3, -1e+15));
    dp[0][0] = 0;
    dp[1][1] = 0;
    for(LL i = 0; i < n; ++i){
        for(LL j = 0; j < 3; ++j){
            // use a[i]
            dp[i+2][j] = max(dp[i+2][j], dp[i][j] + a[i]); 
            // not use a[i]
            if(j+1 < 3){
                dp[i+2][j+1] = max(dp[i+2][j+1], dp[i+1][j]);                  
            }
        }
    }
    LL ans = 0;
    if(n % 2 == 0){
        ans = dp[n+1][1];
    }else{
        ans = dp[n+1][2];
    }
    //cerr << dp << endl;
    cout << ans << endl;
    return 0;
}



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

#include <bits/stdc++.h>
#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##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

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

    vv<int> left = vvec(N + 1, 3, 0), right = left;
    rep(i, N) {
        rep(j, 3) left[i + 1][j] = left[i][j];
        if (S[i] == 'R') left[i + 1][0]++;
        else if (S[i] == 'G') left[i + 1][1]++;
        else left[i + 1][2]++;
    }
    for (int i = N - 1; i >= 0; --i) {
        rep(j, 3) right[i][j] = right[i + 1][j];
        if (S[i] == 'R') right[i][0]++;
        else if (S[i] == 'G') right[i][1]++;
        else right[i][2]++;
    }

    ll ans = 0;
    rep(i, 1, N - 1) {
        if (S[i] == 'R') {
            ans += left[i][1] * right[i + 1][2];
            ans += left[i][2] * right[i + 1][1];
            for (int j = i - 1, k = i + 1; j >= 0 && k < N; --j, ++k) {
                if (S[j] == 'G' && S[k] == 'B') ans--;
                else if (S[j] == 'B' && S[k] == 'G') ans--;
            }
        }
        else if (S[i] == 'G') {
            ans += left[i][0] * right[i + 1][2];
            ans += left[i][2] * right[i + 1][0];
            for (int j = i - 1, k = i + 1; j >= 0 && k < N; --j, ++k) {
                if (S[j] == 'R' && S[k] == 'B') ans--;
                else if (S[j] == 'B' && S[k] == 'R') ans--;
            }
        }
        else {
            ans += left[i][0] * right[i + 1][1];
            ans += left[i][1] * right[i + 1][0];
            for (int j = i - 1, k = i + 1; j >= 0 && k < N; --j, ++k) {
                if (S[j] == 'R' && S[k] == 'G') ans--;
                else if (S[j] == 'G' && S[k] == 'R') ans--;
            }
        }
    }
    write(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;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    if(n%2==0){
        ll m=n/2;
        ll dp[m][2];
        rep(i,0,m-1)rep(j,0,1)dp[i][j]=-inf;
        dp[0][0]=a[0];
        dp[0][1]=a[1];
        rep(i,1,m-1){
            dp[i][0]=dp[i-1][0]+a[i*2];
            dp[i][1]=max(dp[i-1][0]+a[i*2+1],dp[i-1][1]+a[i*2+1]);
        }
        cout<<max(dp[m-1][0],dp[m-1][1])<<endl;
    }else{
        ll m=(n-1)/2;
        ll dp[m][2];
        rep(i,0,m-1)rep(j,0,1)dp[i][j]=-inf;
        dp[0][0]=a[0];
        dp[0][1]=a[1];
        rep(i,1,m-1){
            dp[i][0]=dp[i-1][0]+a[i*2];
            dp[i][1]=max(dp[i-1][0]+a[i*2+1],dp[i-1][1]+a[i*2+1]);
        }
        reverse(a,a+n);
        ll dp1[m][2];
        rep(i,0,m-1)rep(j,0,1)dp1[i][j]=-inf;
        dp1[0][0]=a[0];
        dp1[0][1]=a[1];
        rep(i,1,m-1){
            dp1[i][0]=dp1[i-1][0]+a[i*2];
            dp1[i][1]=max(dp1[i-1][0]+a[i*2+1],dp1[i-1][1]+a[i*2+1]);
        }
        reverse(a,a+n);
        ll maxi=-inf;
        rep(i,-1,m-1){
            if(i==-1){
                maxi=max(maxi,max(dp1[m-1][0],dp1[m-1][1]));
            }else if(i==m-1){
                maxi=max(maxi,max(dp[m-1][0],dp[m-1][1]));
            }else{
                maxi=max(maxi,max(dp[i][0],dp[i][1])+max(dp1[m-2-i][0],dp1[m-2-i][1]));
            }
        }
        cout<<maxi<<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.