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

#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
A = list(map(int,input().split()))
dp0 = [0] * (n+11)
dp1 = [0] * (n+11)
dp2 = [0] * (n+11)
for i,ai in enumerate(A):
  dp2[i+11] = (max(dp0[i+7] + ai, dp1[i+8] + ai, dp2[i+9] + ai) if i >= 2 else 0)
  dp1[i+11] = (max(dp0[i+8] + ai, dp1[i+9] + ai) if i >= 1 else 0)
  dp0[i+11] = dp0[i+9] + ai 
if n % 2 == 0:
  print(max(dp0[n + 9], dp1[n + 10]))
else:
  print(max(dp0[n + 8], dp1[n + 9], dp2[n + 10]))

# debug
# print(dp0,dp1,dp2,sep="\n")




Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env python3
      |  ^
a.cc:3:61: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    3 | input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
      |                                                             ^~~~~~~
a.cc:4:13: warning: multi-character character constant [-Wmultichar]
    4 | inf = float('inf') ;mod = 10**9+7
      |             ^~~~~
a.cc:21:3: error: invalid preprocessing directive #debug
   21 | # debug
      |   ^~~~~
a.cc:22:3: error: invalid preprocessing directive #print
   22 | # print(dp0,dp1,dp2,sep="\n")
      |   ^~~~~
a.cc:2:1: error: 'import' does not name a type
    2 | import sys, math, itertools, collections, bisect
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:21: error: 'mod' does not name a type
    4 | inf = float('inf') ;mod = 10**9+7
      |                     ^~~
a.cc:5:13: error: 'ans' does not name a type
    5 | mans = inf ;ans = 0 ;count = 0 ;pro = 1
      |             ^~~
a.cc:5:22: error: 'count' does not name a type
    5 | mans = inf ;ans = 0 ;count = 0 ;pro = 1
      |                      ^~~~~
a.cc:5:33: error: 'pro' does not name a type
    5 | mans = inf ;ans = 0 ;count = 0 ;pro = 1
      |                                 ^~~
Language: C

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n;cin>>n;
    vl a(n);
    rep(i,n)cin>>a[i];
    vvl dp(n+10,vl(4,-L_INF));
    int m = n%2 + 1;//奇数なら2こ飛ばせる
    dp[0][0]=0;
    rep(i,n){
        rep(j,m+1){
            chmax(dp[i+1][j+1],dp[i][j]);
            ll now = dp[i][j];
            if((i+j)%2==0) now += a[i];
            chmax(dp[i+1][j],now);
        }
    }
    out(dp[n][m]);
}


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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;


typedef long long ll;
int main(){
    int n;
    cin>>n;
    vector<ll> a(n+1,0);
    for(int i = 1; i<=n; i++){
        cin>>a[i];
    }
    vector<ll> dp(n+1, 0);
    dp[1]=0;
    vector<ll> prefix(n+1);
    prefix[1]=a[1];
    for(int i = 3; i<= n; i+=2){
        prefix[i]=prefix[i-2]+a[i];
    }
    for(int i = 2; i<= n; i++){
        if(i&1){
            dp[i]=max(dp[i-1],dp[i-2]+a[i]);
        }else {
            dp[i]=a[i]+dp[i-2];
            dp[i]=max(dp[i], prefix[i-1]);
        }
    }
    cout<<dp[n]<<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 debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;
#define fastio ios_base::sync_with_stdio(false); \
		cin.tie(0);							     \
		cout.tie(0);
#define sz(arr) (ll)arr.size()

using namespace std;
using ll = long long;
const ll MOD = 998244353;
const ll INF = 1e9 + 9;
const double PI = 4.0 * atan(1.0);

ll powmod(ll a, ll b, const ll MOD) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; } return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }



int main() {
	//#ifndef ONLINE_JUDGE
	//	(void)freopen("input.txt", "r", stdin);
	//	(void)freopen("output.txt", "w", stdout);
	//#endif // !ONLINE_JUDGE
		//  ======= FAST I/O =========
	fastio;
	//  ==========================
	int n;
	cin >> n;
	vector<ll> a(n + 1);
	for (int i = 1; i <= n; ++i)
		cin >> a[i];
	vector<vector<ll>> dp(200005, vector<ll>(3, -INF));
	dp[0][0] = 0;
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j < 3; ++j)
			if(i)
				dp[i + 1][j] = max(dp[i + 1][j], dp[i - 1][j] + a[i]);
		for (int j = 0; j < 2; ++j)
			dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j]);
	
	}
	cout << dp[n+1][1 + n % 2];
	return 0;
}


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

#include <iostream>
#include <algorithm>

#define INF 1000000000000000

using namespace std;

int main(){
    int N;
    cin >> N;
    long A[N];
    for(int i=0; i<N; i++) cin >> A[i];
    long dp[N][3][2];

    // initialize
    for(int j=0; j<3; j++){
        for(int s=0; s<2; s++) dp[0][j][s] = -INF;
    }
    dp[0][0][0] = 0;
    dp[0][1][1] = A[0];

    long base[N];
    base[0] = 0;

    for(int i=1; i<N; i++){

        base[i] = N / 2 - (N - i) / 2;
        for(int j=base[i]; j<=(i+2)/2; j++){
            if(j  <= (i+1)/2) dp[i][j - base[i]][0] = max(dp[i-1][j - base[i-1]][0], dp[i-1][j - base[i-1]][1]);
            else dp[i][j - base[i]][0] = -INF;
            if(j-1 <= (i+1)/2) dp[i][j - base[i]][1] = dp[i-1][j-1-base[i-1]][0] + A[i];
            else dp[i][j - base[i]][1] = -INF;
        }
    }
    cout << max(dp[N-1][N/2 - base[N-1]][0], dp[N-1][N/2 - base[N-1]][1]) << endl;
    return 0;
}

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

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

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

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

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

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

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

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

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

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

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

#include<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;
typedef map<pair<int, int>, ll> mpi;

long shUtils(int cnt, int curr, int a[], int n, mpi dp) {
    if (cnt >= n / 2) {
        return 0;
    }

    if (curr >= n) {
        return LONG_MIN;
    }

    pair<int, int> p = {cnt, curr};


    if (dp.find(p) != dp.end() && dp[p] != LONG_MIN)
        return dp[p];


    ll tmp = shUtils(cnt + 1, curr + 2, a, n, dp);
    ll choice1;

    if (tmp == LONG_MIN)
        choice1 = tmp;
    else
        choice1 = a[curr] + tmp;

    ll choice2 = shUtils(cnt, curr + 1, a, n, dp);

    ll ans = max(choice1, choice2);
    dp[p] = ans;

    return ans;
}

ll selectHalf(int a[], int n) {

    mpi dp;

    ll ans = shUtils(0, 0, a, n, dp); // cnt and index passed
    return ans;
}

int main() {

	IOS

	int n;
	cin >> n;

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

	cout << selectHalf(a, n) << 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 <iostream>
#include <algorithm>

using namespace std;

long even_solver(long * A, int N){
    long dpl[N/2], dpr[N/2];
    for(int i=0; i<N; i+=2){
        if(i == 0) dpl[i/2] = A[i];
        else dpl[i/2] = A[i] + dpl[i/2-1];
    }
    for(int i=N-1; i>0; i-=2){
        if(i == N-1) dpr[i/2] = A[i];
        else dpr[i/2] = A[i] + dpr[i/2+1];
    }
    long ans = 0;
    for(int i=0; i<N/2; i++){
        if(i == 0) ans = max(ans, dpr[0]);
        else if(i == N/2-1) ans = max(ans, dpl[N/2-1]);
        else ans = max(ans, dpl[i-1] + dpr[i]);
    }
    return ans;
}

int main(){
    int N;
    cin >> N;
    long A[N];
    for(int i=0; i<N; i++) cin >> A[i];
    long ans = even_solver(A, N);
    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 rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
 
const ll INF = 1e18;
 
ll dp[200005][4];


int main(){
    int n;
    cin >> n;
    
    vector<int> a(n);
    
    rep(i, n) cin >> a[i];
    
    int k = 1 + n % 2;
    
    rep(i,n+1)rep(j,k+1) dp[i][j] = -INF;
    
    dp[0][0] = 0;
    
    rep(i,n){
        rep(j,k+1){
            
            chmax(dp[i+1][j+1], dp[i][j]);
            
            ll now = dp[i][j];
            
            if ((i+j)%2 == 0) now += a[i];
            chmax(dp[i+1][j], now);
        }
    }
    
    ll ans = do[n][k];
    cout << ans << endl;
    return 0;
    
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:14: error: expected primary-expression before 'do'
   39 |     ll ans = do[n][k];
      |              ^~
Language: C

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <queue>
#include <numeric>

using ll = long long;

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    int N; cin>>N;
    ll ans{};

    vector<ll> v(N);
    for (auto& e: v) cin>>e;
    using type = vector<pair<ll,ll>>;
    vector<type> dp(N);
    for (int i = 0; i < N; ++ i) {
        //  i/2   cnts...

        if (i <= 2) {
            pair<ll, ll> a{1, v[i]};
            dp[i] = vector<pair<ll,ll>> {a};
        }
        else {
            int few = (i+1)/2;
            pair<ll,ll> p{few, 0};
            // not choosing
            for (int j = i-2; j >= i-4 && j >= 0; -- j){
                for (auto& e : dp[j]){
                    if (e.first == few) {
                        p.second = max(p.second, e.second);
                    }
                }
            }
            // choosing
            for (int j = i-2; j >= i-4 && j >= 0; -- j){
                for (auto& e : dp[j]){
                    if (e.first == few-1) {
                        p.second = max(p.second, e.second + v[i]);
                    }
                }
            }
            dp[i] = type{p};
            if (p.first == N/2) ans = max(ans, p.second);
        }
    }
    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 <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

ll A[200010], dp[200010][2];

int main(void){
    int N;
    cin >> N;
    for(int i=0; i<N; ++i) cin >> A[i];
    dp[0][0]=A[0];
    dp[1][0]=A[1];
    if(N%2==0){
        for(int i=1; i*2<N; ++i){
            dp[i*2][0]=dp[i*2-2][0]+A[i*2];
            dp[i*2+1][0]=max(dp[i*2-2][0], dp[i*2-1][0])+A[i*2+1];
        }
        cout << max(dp[N-2][0], dp[N-1][0]) << endl;
    }
    else{
        dp[0][1]=A[0];
        dp[2][0]=A[2];
        dp[2][1]=dp[0][0]+A[2];
        for(int i=2; i*2<N; ++i){
            dp[i*2-1][0]=max(dp[i*2-4][1], dp[i*2-3][0])+A[i*2-1];
            dp[i*2][0]=max({dp[i*2-4][1], dp[i*2-3][0], dp[i*2-2][0]})+A[i*2];
            dp[i*2][1]=dp[i*2-2][1]+A[i*2];
        }
        cout << max({dp[N-3][1], dp[N-2][0], dp[N-1][0]}) << endl;
    }
    return 0;
}


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

/**
 *     author: qodjf
 *     created: 04.18.2020 02:04:55
 */
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  vector<ll> dp(N + 10, 0);

  ll sum = 0;
  for (int i = N - 1; i >= 1; i -= 2) {
    sum += a[i];
    dp[i - 1] = max(a[i - 1] + dp[i + 1], sum);
  }
  for (int i = N - 1; i >= 0; i -= 2) {
    dp[i] = max(dp[i + 2] + a[i], dp[i + 1]);
  }
  cout << dp[0] << endl;
}


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

#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const ll INF = 1e18;

//i個までみてxをjこ入れたときのmax
ll dp[200005][4];

int main(void){
  ll n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n)cin >> a[i];
  //oxoxoxoxoの並びの中にxを入れる
  //入れる必要のあるxの個数
  //偶数->1
  //奇数->2
  ll k = 1 + n%2;
  REP(i, n+1) REP(j, k+1) dp[i][j] = -INF;
  dp[0][0] = 0;
  REP(i, n) REP(j, k+1){
    //xを入れる->a[i]をスキップする場合
    chmax(dp[i+1][j+1], dp[i][j]);
    ll now = dp[i][j];
    //xを1個入れるとoの位置が1つずれる
    //0 -> そのまま
    //1 -> 1つずれる
    //2 -> もう1つずれてもとに戻る
    if((i+j)%2 == 0) now += a[i];
    chmax(dp[i+1][j], now);
  }
  cout << dp[n][k] << endl;
  return 0;
}

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

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* na, Arg1&& arg1, Args&&... args) {
  const char* c = strchr(na + 1, ',');
  cerr.write(na, c - na) << " : " << arg1 << " , ";
  __f(c + 1, args...);
}
#define endl "\n"
#define all(v) v.begin(), v.end()
#define UNIQUE(v) sort(all(v)),v.erase(unique(all(v)),v.end())
typedef long long LL;
typedef pair <int,int> pii;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int inf = 1e9;
const LL INF = 1e16;
const int N = 2e5 + 5;

gp_hash_table <LL,LL> dp[ N ];
int n;
LL a[ N ];

LL solve(int idx, int taken) {
  int need = n/2 - (n - idx + 1)/2;
  if (taken < need) return -INF;
  if (idx >= n) return taken == n/2 ? 0 : -INF;
  if (dp[idx][taken] return dp[idx][taken];
  LL ret = -INF;
  ret = max(ret, solve(idx + 2, taken + 1) + a[idx]);
  ret = max(ret, solve(idx + 1, taken));
  return dp[idx][taken] = ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif // LOCAL
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << solve(0, 0) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'LL solve(int, int)':
a.cc:37:21: error: expected ';' before 'return'
   37 |   if (dp[idx][taken] return dp[idx][taken];
      |                     ^~~~~~~
      |                     ;
a.cc:38:16: error: expected ')' before ';' token
   38 |   LL ret = -INF;
      |                ^
      |                )
a.cc:37:6: note: to match this '('
   37 |   if (dp[idx][taken] return dp[idx][taken];
      |      ^
a.cc:39:3: error: 'ret' was not declared in this scope
   39 |   ret = max(ret, solve(idx + 2, taken + 1) + a[idx]);
      |   ^~~
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
ll dp[200010][4];
int main(){
    ll n;cin>>n;
    vl a(n);rep(i,n)cin>>a[i];
    ll k=1+n%2;
    rep(i,200010){
        rep(j,4){
            dp[i][j]=-INF;
        }
    }
    dp[0][0]=0;
    rep(i,n){
        rep(j,k+1){
            chmax(dp[i+1][j+1],dp[i][j]);
            ll now=dp[i][j];
            if((i+j)%2==0) now+=a[i];
            chmax(dp[i+1][j],now);
        }
    }
    ll ans=dp[n][k];
    cout<<ans<<endl;
    return 0;
}

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

#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <iostream>
#include <limits>
#include <numeric>
#include <type_traits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define MOD 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define REVERSE(s) reverse(s.begin(), s.end());
#define SUM(s) accumulate(s.begin(), s.end(), 0LL);
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
//#define int ll
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int ndx[8] = { 0,1,0,-1, 1,1,-1,-1 };
int ndy[8] = { 1,0,-1,0, 1,-1,-1,1 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }

template <class T>
void VecRowShow(vector<T> vec) {
	rep(i, vec.size()) {
		if (i != vec.size() - 1) cout << vec[i] << " ";
		else cout << vec[i] << endl;
	}
}

unsigned euclidean_gcd(unsigned a, unsigned b) {
	if (a < b) return euclidean_gcd(b, a);
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}

int main() {

	ll n;
	cin >> n;
	vector<ll> e(n), o(n), q(n);
	rep(i, n) {
		ll a;
		cin >> a;
		q[i] = a;
		if (i % 2 == 0) {
			if (i == 0) {
				e[0] = a;
			}
			else {
				ll z = e[i - 2];
				e[i] = z + a;
			}
		}
		else {
			if (i == 1) {
				o[1] = a;
			}
			else {
				ll z = o[i - 2];
				o[i] = z + a;
			}
		}
	}

	vector<vector<pair<ll, ll>>> li(n);
	rep(i, n) {
		if (i == 0) {
			li[0].push_back(make_pair(0, 0));
			li[0].push_back(make_pair(1, q[0]));
		}
		else if (i == 1) {
			li[1].push_back(make_pair(0, 0));
			li[1].push_back(make_pair(1, q[1]));
		}
		else {
			ll m1 = (i + 1) / 2;
			ll m1m = -10000000000000000;
			FOR(j, 2, 7) {
				if (i - j < 0) {
					break;
				}
				rep(k, li[i - j].size()) {
					if (li[i - j][k].first == m1 - 1) {
						m1m = max(m1m, li[i - j][k].second);
					}
				}
			}
			li[i].push_back(make_pair(m1, m1m + q[i]));


			ll m2 = (i + 2) / 2;
			ll m2m = -10000000000000000;
			FOR(j, 2, 7) {
				if (i - j < 0) {
					break;
				}
				rep(k, li[i - j].size()) {
					if (li[i - j][k].first == m2 - 1) {
						m2m = max(m2m, li[i - j][k].second);
					}
				}
			}
			li[i].push_back(make_pair(m2, m2m + q[i]));
		}
	}

	ll i = n - 1;
	ll m3 = n / 2;
	ll m3m = -10000000000000000;
	FOR(j, 0, 7) {
		if (i - j < 0) {
			break;
		}
		rep(k, li[i - j].size()) {
			if (li[i - j][k].first == m3) {
				m3m = max(m3m, li[i - j][k].second);
			}
		}
	}
	cout << m3m << 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>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long int ll;
typedef pair<int, int> P;

const ll INF = -1e18;
int n;

vector<ll> a(202020);
vector<vector<ll>> dp(3, vector<ll>(202020, INF));

int main()
{
    cin >> n;
    rep(i, n) cin >> a[i];
  	
    rep(i, 3) dp[i][i] = a[i];
    for(int i = 0; i < n - 2; i++)
    {
        
        dp[0][i + 2] = max(dp[0][i + 2], dp[0][i] + a[i + 2]);
        dp[1][i + 3] = max(dp[1][i + 3], dp[0][i] + a[i + 3]);
        dp[2][i + 4] = max(dp[2][i + 4], dp[0][i] + a[i + 4]);
        
        dp[1][i + 2] = max(dp[1][i + 2], dp[1][i] + a[i + 2]);
        dp[2][i + 3] = max(dp[2][i + 3], dp[1][i] + a[i + 3]);
        

        dp[2][i + 2] = max(dp[2][i + 2], dp[2][i] + a[i + 2]);
    }
    rep(i, 3){ rep(j, n) cout << dp[i][j] << " "; cout << endl;}

    
    ll res = INF;
    if(n % 2 == 1)
    {
        res = max(res, dp[0][n - 3]);
        res = max(res, dp[1][n - 2]);
        res = max(res, dp[2][n - 1]);
    }
    else
    {
        res = max(res, dp[0][n - 2]);
        res = max(res, dp[1][n - 1]);
    }
    
    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;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long int ll;
typedef pair<int, int> P;

const ll INF = -1e18;
int n;
vector<ll> a(202020);
vector<vector<ll>> dp(3, vector<ll>(202020, INF));

int main()
{
    cin >> n;
    rep(i, n) cin >> a[i];
    if(n % 2 == 0)
    {

        cout << endl;
        //return 0;
    }

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

        dp[1][i + 2] = max(dp[1][i + 2], dp[1][i] + a[i + 2]);
        dp[2][i + 3] = max(dp[2][i + 3], dp[1][i] + a[i + 3]);

        dp[2][i + 2] = max(dp[2][i + 2], dp[2][i] + a[i + 2]);
    }

    rep(i, 3) { rep(j, n) cout << dp[i][j] << " "; cout << endl;}
    
    ll res = 0;
    rep(i, 3)
    {
        res = max(res, dp[i][n - 1]);
    }
    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;
#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define fi first
#define se second 

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

void buff() { ios::sync_with_stdio( false ); cin.tie( nullptr ); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod( ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b&1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}


constexpr int ms = 1e5 + 13;
ll dp[ms][2];
ll v[ms];
ll padding = -MOD;
ll safe_min = padding * 1ll * ms;
int n;

ll solve(int cur_index, int remaining) {
    // se ja computamos
    if(dp[cur_index][remaining] != (safe_min - 13) ) return dp[cur_index][remaining];
    if(remaining == 0) return dp[cur_index][remaining] = 0;    
    if(cur_index >= n && remaining > 0) return padding;
    // agora tenho que escolher entre usar ou nao 
    ll ans = max( solve(cur_index + 1, remaining), solve(cur_index + 2, remaining - 1) + v[cur_index] );
    return dp[cur_index][remaining] = ans;
}
// End of template code!
int main() 
{
    buff();
    cin >> n;
    for(int i = 0; i < n + 11; ++i) dp[i][0] = dp[i][1] = (safe_min - 13);
    for(int i = 0; i < n; ++i) cin >> v[i]; 

    cout << solve(0, n / 2) << '\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;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define irp(i,s,e) for(int i=(s);i>(e);--i)
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
// #define NMAX 1000000000

using VL = vector<ll>;
using VVL = vector<VL>;
using TPL = tuple<ll,set<int>>; // <value,{index}>
using VT = vector<TPL>;

ll INF = LLONG_MAX>>2;

int N;
VL A;
ll ans;

ll solve(){

	VVL dp(N/2+2, VL(N+2, -INF)); // dp[j][i]

	rp(i,1,N+1) dp[1][i] = A[i-1];

	rp(i, 2, N+1){
		ll a = A[i-1];
		int j = i/2;
		dp[j][i] = max(dp[j][i], dp[j-1][i-2] + a);
		dp[j][i] = max(dp[j][i], dp[j][i-1]);
	}

	// cout<<"   ";//
	// rp(i,0,dp[0].size())printf("%2d ",i);puts("");//
	// rp(i,0,dp.size()){
	// 	cout<<i<<": ";
	// 	rp(j,0,dp[i].size()){
	// 		if(dp[i][j]==-INF) cout<<"-- ";
	// 		else printf("%2lld ",dp[i][j]);
	// 	}puts("");
	// }puts("---");

	return dp[N/2][N];
}

int main(){
	cin>>N;
	A.resize(N);
	rp(i, 0, N) cin>>A[i];
	cout<< solve() <<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;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 1000000002;

int main(){
	int n; cin >> n;
	vl a(n); rep(i,n) cin >> a[i];
	vector<vector<vl>> dp(n+1, vector<vl>(2, vl(3, -INF)));
	dp[0][1][0] = 0

	rep(i,n)rep(j,2)rep(k,3){
		if(k+j<3) dp[i+1][1][k+j] = max(dp[i][j][k], dp[i+1][1][k+j]);
		if(j){
			dp[i+1][0][k] = max(dp[i][j][k]+a[i], dp[i+1][0][k]);	
		}
	}
	
	if(n%2) cout << max(dp[n][1][1], dp[n][0][2]);
	else cout << max(dp[n][0][1], dp[n][1][0]); 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: expected ';' before 'for'
   19 |         dp[0][1][0] = 0
      |                        ^
      |                        ;
a.cc:21:13: error: 'i' was not declared in this scope
   21 |         rep(i,n)rep(j,2)rep(k,3){
      |             ^
a.cc:10:31: note: in definition of macro 'rep'
   10 | #define rep(i,N) for(int i=0; i < (int)N; i++)
      |                               ^
a.cc:21:21: error: 'j' was not declared in this scope
   21 |         rep(i,n)rep(j,2)rep(k,3){
      |                     ^
a.cc:10:31: note: in definition of macro 'rep'
   10 | #define rep(i,N) for(int i=0; i < (int)N; i++)
      |                               ^
a.cc:21:29: error: 'k' was not declared in this scope
   21 |         rep(i,n)rep(j,2)rep(k,3){
      |                             ^
a.cc:10:31: note: in definition of macro 'rep'
   10 | #define rep(i,N) for(int i=0; i < (int)N; i++)
      |                               ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 100000002;

int main(){
	int n; cin >> n;
	vl a(n); rep(i,n) cin >> a[i];
	vector<vector<vl>> dp(n+1, vector<vl>(2, vl(3, -INF)));
	rep(i,2)rep(j,3)dp[0][i][j] = 0;

	rep(i,n)rep(j,2)rep(k,3){
		if(k+j<3) dp[i+1][1][k+j] = max(dp[i][j][k], dp[i+1][1][k+j]);
		
		//if(j) dp[i+1][0][k] = max(dp[i][j][k]+a[i], dp[i+1][0][k]);
		if(j){
			dp[i+1][0][k] = max(dp[i][j][k]+a[i], dp[i+1][0][k]);	
			
			}
		}
		//cout <<i+1 << " " << j << " "<< dp[i+1][1][2] << " " <<  dp[i+1][0][2] << endl;
	}
	
	if(n%2) cout << max(dp[n][1][1], dp[n][0][2]);
	else cout << max(dp[n][0][1], dp[n][1][0]); 
}

Compiler output:
a.cc:33:9: error: expected unqualified-id before 'if'
   33 |         if(n%2) cout << max(dp[n][1][1], dp[n][0][2]);
      |         ^~
a.cc:34:9: error: expected unqualified-id before 'else'
   34 |         else cout << max(dp[n][0][1], dp[n][1][0]);
      |         ^~~~
a.cc:35:1: error: expected declaration before '}' token
   35 | }
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define FOR(i,N) for(int i=0; i < (int)N; i++)
int N;
ll A[202020];
 
ll dp[202020][2][3];
 
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	
	FOR(i,N+1) FOR(x,2) FOR(y,3) dp[i][x][y]=-1LL<<60;
	dp[0][1][0]=0;
	
	FOR(i,N) {
		cin>>x;
		FOR(j,2) FOR(k,3) {
			// not take
			if(k+j<3) dp[i+1][1][k+j]=max(dp[i+1][1][k+j],dp[i][j][k]);
			// take
			if(j==1) dp[i+1][0][k]=max(dp[i+1][0][k],dp[i][j][k]+x);
		}
	}
	
	if(N%2==0) cout<<max(dp[N][1][0],dp[N][0][1])<<endl;
	else cout<<max(dp[N][0][2],dp[N][1][1])<<endl;
}

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

#define FOR(i,N) for(int i=0; i < (int)N; i++)
int N;
ll A[202020];

ll dp[202020][2][3];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	
	FOR(i,N+1) FOR(x,2) FOR(y,3) dp[i][x][y]=-1LL<<60;
	dp[0][1][0]=0;
	
	FOR(i,N) {
		cin>>x;
		FOR(j,2) FOR(k,3) {
			// not take
			if(k+j<3) dp[i+1][1][k+j]=max(dp[i+1][1][k+j],dp[i][j][k]);
			// take
			if(j==1) dp[i+1][0][k]=max(dp[i+1][0][k],dp[i][j][k]+x);
		}
	}
	
	if(N%2==0) cout<<max(dp[N][1][0],dp[N][0][1])<<endl;
	else cout<<max(dp[N][0][2],dp[N][1][1])<<endl;
}

Compiler output:
a.cc:3:1: error: 'll' does not name a type
    3 | ll A[202020];
      | ^~
a.cc:5:1: error: 'll' does not name a type
    5 | ll dp[202020][2][3];
      | ^~
a.cc: In function 'void solve()':
a.cc:8:28: error: 'string' was not declared in this scope
    8 |         int i,j,k,l,r,x,y; string s;
      |                            ^~~~~~
a.cc:10:9: error: 'cin' was not declared in this scope
   10 |         cin>>N;
      |         ^~~
a.cc:12:38: error: 'dp' was not declared in this scope
   12 |         FOR(i,N+1) FOR(x,2) FOR(y,3) dp[i][x][y]=-1LL<<60;
      |                                      ^~
a.cc:13:9: error: 'dp' was not declared in this scope
   13 |         dp[0][1][0]=0;
      |         ^~
a.cc:19:51: error: 'max' was not declared in this scope
   19 |                         if(k+j<3) dp[i+1][1][k+j]=max(dp[i+1][1][k+j],dp[i][j][k]);
      |                                                   ^~~
a.cc:21:48: error: 'max' was not declared in this scope
   21 |                         if(j==1) dp[i+1][0][k]=max(dp[i+1][0][k],dp[i][j][k]+x);
      |                                                ^~~
a.cc:25:20: error: 'cout' was not declared in this scope
   25 |         if(N%2==0) cout<<max(dp[N][1][0],dp[N][0][1])<<endl;
      |                    ^~~~
a.cc:25:26: error: 'max' was not declared in this scope
   25 |         if(N%2==0) cout<<max(dp[N][1][0],dp[N][0][1])<<endl;
      |                          ^~~
a.cc:25:56: error: 'endl' was not declared in this scope
   25 |         if(N%2==0) cout<<max(dp[N][1][0],dp[N][0][1])<<endl;
      |                                                        ^~~~
a.cc:26:14: error: 'cout' was not declared in this scope
   26 |         else cout<<max(dp[N][0][2],dp[N][1][1])<<endl;
      |              ^~~~
a.cc:26:20: error: 'max' was not declared in this scope
   26 |         else cout<<max(dp[N][0][2],dp[N][1][1])<<endl;
      |                    ^~~
a.cc:26:50: error: 'endl' was not declared in this scope
   26 |         else cout<<max(dp[N][0][2],dp[N][1][1])<<endl;
      |                                                  ^~~~
Language: C

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

int main() {
    ll n;
    cin>>n;
    V a(n);
    rep(i,n)cin>>a[i];
    VVV dp(n+1,VV(n+1,V(2,1e10)));
    rep(i,n){
        for(ll j=max((int)(i/2)-2,0);j<=(i+1)/2;j++){
            if(dp[i][j][0]==1e10){
                if(dp[i][j][1]!=1e10){
                    dp[i+1][j][0]=dp[i][j][1];
                }
            }else{
                if(dp[i][j][1]==1e10){
                    dp[i+1][j][0]=dp[i][j][0];
                }else{
                    dp[i+1][j][0]=max(dp[i][j][0],dp[i][j][1]);
                }
            }
            if(i%2==0 || j!=(i+1)/2){
                if(dp[i][j][0]==1e10){
                    dp[i+1][j+1][1]=a[i];
                }else{
                    dp[i+1][j+1][1]=dp[i][j][0]+a[i];
                }
            }
        }
    }
    cout<<max(dp[n][n/2][0],dp[n][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

import sys
sys.setrecursionlimit(500000)
INF = -10000000001

n = int(input())
l = list(map(int, input().split()))

a = int(n/2)

dpa = [[INF for j in range(a+1)] for i in range(n+1)]

def dp(x,y):
	ret = 0
	if 2*y-1 > x:
		ret = INF
	elif y == 0:
		ret = 0
	else:
		if dpa[x][y] != INF:
			ret = dpa[x][y]
		else:
			ret = max(dp(x-2,y-1)+l[x-1],dp(x-1,y))
#	print(x,y,ret)
	return ret

print(dp(n,a))

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import sys
      | ^~~~~~
main.c:2:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'sys'
    2 | sys.setrecursionlimit(500000)
      | ^~~
main.c:23:9: error: invalid preprocessing directive #print
   23 | #       print(x,y,ret)
      |         ^~~~~
Language: C

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

template<class T> using OS = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ld double
#define ull unsigned long long

const int N = 2e5 + 5;
ll n, a[N], dp[N], pre[N];

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

    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i], (i & 1) ? pre[i] += a[i] + pre[i - 1] : 0;

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.141592653589793238462643383279;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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 main(void){
    int N; cin >> N;
    VL A(N); REP(i,N) cin >> A[i];

    ll dp[N+1][3][2]; REP(i,N+1)REP(j,3)REP(k,2) dp[i][j][k] = -LINF;
    dp[0][1][0] = 0;
    REP(i,N)REP(j,3)REP(k,2){
        int t = i/2 + j + 1 - (i+1)/2;
        if(t < 3) chmax(dp[i+1][t][1], dp[i][j][0] + A[i]);
        if(t > 0) chmax(dp[i+1][t-1][0], dp[i][j][k]);
    }
    ll ans = max(dp[N][1][0], dp[N][1][1]);
    cout << ans << 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;
using P = pair<int,int>;
using ll = long long;
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
  int n;
  vector<int> a(n);
  cin >> n;
  rep(i,n) cin >> a[i];
  sort(a.rbegin(),a.rend());
  int ans =0;
  rep(i,n/2) ans += a[i];
  cout << ans << endl;

  return 0;

}　

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

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <climits>

using namespace std;

long long takeAfter(const vector<long long>& a, size_t prevIndex, size_t currIndex, int outstandingNb, long long minimum, vector<vector<bool> >& done, vector<vector<long long> >& cache) {
    if (outstandingNb == 0) {
        return 0ll;
    }
    bool cond = currIndex < a.size();
    cond &= (a.size() - currIndex + 1) / 2 >= (size_t)outstandingNb;
    if (!cond) {
        return minimum;
    }
    //if (done[currIndex][outstandingNb]) {
    //    return cache[currIndex][outstandingNb];
    //}
    if (currIndex - prevIndex == 1) {
        return takeAfter(a, prevIndex, currIndex + 1, outstandingNb, minimum, done, cache);
    }
    long long ret = max(
        takeAfter(a, currIndex, currIndex + 1, outstandingNb - 1, minimum, done, cache) + a[currIndex]
        , takeAfter(a, prevIndex, currIndex + 1, outstandingNb, minimum, done, cache)
    );
    //done[currIndex][outstandingNb] = true;
    //cache[currIndex][outstandingNb] = ret;
    return ret;
}

int main() {
    int N;
    cin >> N;
    vector<long long> A(N, 0ll);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    long long minimum = 0;
    for (int i = 0; i < N; ++i) {
        if (A[i] < 0) {
            minimum += A[i];
        }
    }

    //vector<vector<bool> > done(N, vector<bool>(1 + N / 2, false));
    //vector<vector<long long> > cache(N, vector<long long>(1 + N / 2, minimum));

    long long ans = takeAfter(A, -2, 0, N / 2, minimum, done, cache);
    cout << ans << endl;
    //cout << setprecision(15) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:57: error: 'done' was not declared in this scope
   55 |     long long ans = takeAfter(A, -2, 0, N / 2, minimum, done, cache);
      |                                                         ^~~~
a.cc:55:63: error: 'cache' was not declared in this scope
   55 |     long long ans = takeAfter(A, -2, 0, N / 2, minimum, done, cache);
      |                                                               ^~~~~
Language: C++

#include "iostream"
using namespace std;int N=2e5+5;int64_t a[N],d[N],s[N],n,i;main(){cin>>n;for(;i<n;++i)cin>>a[i],s[i]=(i>1?s[i-2]:0)+a[i];for(i=1;i<n;++i)d[i]=max((i&1?s:d)[i-1],d[i-2]+a[i]);cout<<d[n-1];}

Compiler output:
a.cc:2:43: error: size of array 'a' is not an integral constant-expression
    2 | using namespace std;int N=2e5+5;int64_t a[N],d[N],s[N],n,i;main(){cin>>n;for(;i<n;++i)cin>>a[i],s[i]=(i>1?s[i-2]:0)+a[i];for(i=1;i<n;++i)d[i]=max((i&1?s:d)[i-1],d[i-2]+a[i]);cout<<d[n-1];}
      |                                           ^
a.cc:2:48: error: size of array 'd' is not an integral constant-expression
    2 | using namespace std;int N=2e5+5;int64_t a[N],d[N],s[N],n,i;main(){cin>>n;for(;i<n;++i)cin>>a[i],s[i]=(i>1?s[i-2]:0)+a[i];for(i=1;i<n;++i)d[i]=max((i&1?s:d)[i-1],d[i-2]+a[i]);cout<<d[n-1];}
      |                                                ^
a.cc:2:53: error: size of array 's' is not an integral constant-expression
    2 | using namespace std;int N=2e5+5;int64_t a[N],d[N],s[N],n,i;main(){cin>>n;for(;i<n;++i)cin>>a[i],s[i]=(i>1?s[i-2]:0)+a[i];for(i=1;i<n;++i)d[i]=max((i&1?s:d)[i-1],d[i-2]+a[i]);cout<<d[n-1];}
      |                                                     ^
a.cc:2:60: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | using namespace std;int N=2e5+5;int64_t a[N],d[N],s[N],n,i;main(){cin>>n;for(;i<n;++i)cin>>a[i],s[i]=(i>1?s[i-2]:0)+a[i];for(i=1;i<n;++i)d[i]=max((i&1?s:d)[i-1],d[i-2]+a[i]);cout<<d[n-1];}
      |                                                            ^~~~