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

#include<iostream>
#define ll long long
using namespace std;



int main(){
	int n; cin >> n;
	vector<ll> A(n + 1, 0), greedy(n + 1, 0), dp(n + 1, 0);
	
	for(int i = 1; i <= n; i ++) cin >> A[i];
	greedy[1] = A[1];
	for(int i = 3; i <= n; i += 2){
		greedy[i] = greedy[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] = max(dp[i - 2] + A[i], greedy[i - 1]);
		}
	}
	cout << dp[n] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<ll> A(n + 1, 0), greedy(n + 1, 0), dp(n + 1, 0);
      |         ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<iostream>
  +++ |+#include <vector>
    2 | #define ll long long
a.cc:2:12: error: expected primary-expression before 'long'
    2 | #define ll long long
      |            ^~~~
a.cc:9:16: note: in expansion of macro 'll'
    9 |         vector<ll> A(n + 1, 0), greedy(n + 1, 0), dp(n + 1, 0);
      |                ^~
a.cc:11:45: error: 'A' was not declared in this scope
   11 |         for(int i = 1; i <= n; i ++) cin >> A[i];
      |                                             ^
a.cc:12:9: error: 'greedy' was not declared in this scope
   12 |         greedy[1] = A[1];
      |         ^~~~~~
a.cc:12:21: error: 'A' was not declared in this scope
   12 |         greedy[1] = A[1];
      |                     ^
a.cc:18:25: error: 'dp' was not declared in this scope
   18 |                         dp[i] = max(dp[i - 1], dp[i - 2] + A[i]);
      |                         ^~
a.cc:21:25: error: 'dp' was not declared in this scope
   21 |                         dp[i] = max(dp[i - 2] + A[i], greedy[i - 1]);
      |                         ^~
a.cc:24:17: error: 'dp' was not declared in this scope
   24 |         cout << dp[n] << endl;
      |                 ^~
Language: C

#include<iostream>
#define ll long long
using namespace std;



int main(){
	int n; cin >> n;
	vector<ll> A(n + 1, 0), greedy(n + 1, 0), dp(n + 1, 0);
	
	for(int i = 1; i <= n; i ++) cin >> A[i];
	greedy[1] = A[1];
	for(int i = 3; i <= n; i += 2){
		greedy[i] = greedy[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] = max(dp[i - 2] + A[i], greedy[i - 1]);
		}
	}
	cout << dp[n] << endl;
}

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

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


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

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



int main(){
	int n; cin >> n;
	vector<ll> A(n + 1, 0), greedy(n + 1, 0), dp(n + 1, 0);
	
	for(int i = 1; i <= n; i ++) cin >> A[i];
	greedy[1] = A[1];
	for(int i = 3; i <= n; i += 2){
		greedy[i] = greedy[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] = max(dp[i - 2] + A[i], greedy[i - 1]);
		}
	}
	cout << dp[n] << 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++

v#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); 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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



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

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

  ll dp[n + 1][2][3];
  rep(i, n + 1) rep(j, 2) rep(k, 3) dp[i][j][k] = -INF;
  dp[0][1][0] = 0;
  rep(i, n) {
    rep(j, 2) {
      rep(k, 3) {
        if (j + k < 3) chmax(dp[i + 1][1][j + k], dp[i][j][k]);
        if (j == 1) chmax(dp[i + 1][0][k], dp[i][j][k] + a[i]);
      }
    }
  }
  cout << (n % 2 == 0 ? max(dp[n][1][0], dp[n][0][1]) : max(dp[n][1][1], dp[n][0][2])) << '\n';


  

  
  return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:24:3: error: 'ios' has not been declared
   24 |   ios::sync_with_stdio(false);
      |   ^~~
a.cc:25:3: error: 'cin' was not declared in this scope
   25 |   cin.tie(0);
      |   ^~~
a.cc:26:3: error: 'cout' was not declared in this scope
   26 |   cout << fixed << setprecision(25);
      |   ^~~~
a.cc:26:11: error: 'fixed' was not declared in this scope
   26 |   cout << fixed << setprecision(25);
      |           ^~~~~
a.cc:26:20: error: 'setprecision' was not declared in this scope
   26 |   cout << fixed << setprecision(25);
      |                    ^~~~~~~~~~~~
a.cc:30:3: error: 'vector' was not declared in this scope
   30 |   vector<ll> a(n);
      |   ^~~~~~
a.cc:30:12: error: expected primary-expression before '>' token
   30 |   vector<ll> a(n);
      |            ^
a.cc:30:14: error: 'a' was not declared in this scope
   30 |   vector<ll> a(n);
      |              ^
a.cc:44:25: error: 'max' was not declared in this scope
   44 |   cout << (n % 2 == 0 ? max(dp[n][1][0], dp[n][0][1]) : max(dp[n][1][1], dp[n][0][2])) << '\n';
      |                         ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); 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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }



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

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

  ll dp[n + 1][2][3];
  rep(i, n + 1) rep(j, 2) rep(k, 3) dp[i][j][k] = -INF;
  dp[0][1][0] = 0;
  rep(i, n) {
    rep(j, 2) {
      rep(k, 3) {
        if (j + k < 3) {
          chmax(dp[i + 1][1][j + k], dp[i][j][k]);
          if (j == 1) chmax(dp[i + 1][0][k], dp[i][j][k] + a[i]);
        }
      }
    }
  }
  cout << (i % 2 == 0 ? max(dp[n][1][0], dp[n][0][1]) : max(dp[n][1][1], dp[n][0][2])) << '\n';


  

  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:12: error: 'i' was not declared in this scope
   46 |   cout << (i % 2 == 0 ? max(dp[n][1][0], dp[n][0][1]) : max(dp[n][1][1], dp[n][0][2])) << '\n';
      |            ^
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 dp_0[N][N/2+1];
    ll dp_1[N][N/2+1];

    dp_0[0][0] = 0;
    dp_1[0][1] = A[0];
    // ll t;

    ll max_i,min_i,ind;
    ll tmp_0,tmp_1;
    rep(i,N-1){
        max_i = min((i+2+1)/2,N/2);
        min_i = N/2-(N-(i+2)+1)/2;
        ind = min_i;
        while(ind<=max_i){
            tmp_0 = tmp_1 = (ll)-1e15;
            if(ind <= (i+1)/2){
                tmp_0 = dp_0[i][ind];
            }
            if(ind<= (i+1+1)/2){
                if(ind>=1){
                    tmp_1 = dp_1[i][ind];
                }
            }
            dp_0[i+1][ind] = max(tmp_0,tmp_1);
            dp_1[i+1][ind] = dp_0[i][ind-1]+ A[i+1];
            ++ind;
        }
    }
    
    ll ans = max(dp_0[N-1][N/2],dp_1[N-1][N/2]);
    // cout<<dp_0[N-1][N/2]<<"\n";
    // cout<<dp_1[N-1][N/2]<<"\n";
    cout<<ans<<"\n";
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:20: error: no matching function for call to 'min(int, ll)'
   27 |         max_i = min((i+2+1)/2,N/2);
      |                 ~~~^~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:27:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   27 |         max_i = min((i+2+1)/2,N/2);
      |                 ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:27:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   27 |         max_i = min((i+2+1)/2,N/2);
      |                 ~~~^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <unordered_map>

using namespace std;

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

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

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

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

int N;
unordered_map<int, int> dp[200010]; // dp[i][j] := 2飛ばしをj回使った,3飛ばしをk回使った

signed main()
{
	cin >> N;

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


	dp[1][1] = A[1];
	dp[2][1] = A[2];

	int len = N % 2 == 0 ? 3 : 4;

	for (int i = 1; i <= N; ++i) {
		for (pii p : dp[i]) {
			int j = p.fst;
			for (int k = 2; k <= len; ++k) {
				if (j + 1 <= (N + 1) / 2) {
					chmax(dp[i + k][j + 1], dp[i][j] + A[i + k]);
				}
			}
		}
	}

	int mx = -inf;

	for (int i = 1; i <= N; ++i) {
		chmax(mx, dp[i][N / 2]);
	}

	cout << ans << endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:72:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   72 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <unordered_map>

using namespace std;

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

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

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

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

int N;
unordered_map<int, int> dp[200010]; // dp[i][j] := 2飛ばしをj回使った,3飛ばしをk回使った

signed main()
{
	cin >> N;

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

	int mx = -inf;

	dp[1][1] = A[1];
	dp[2][1] = A[2];

	int len = N % 2 == 0 ? 3 : 4;

	for (int i = 1; i <= N; ++i) {
		for (pii p : dp[i]) {
			int j = p.fst;
			for (int k = 2; k <= len; ++k) {
				if (j + k <= (N + 1 / 2)) {
					chmax(dp[i + k][j + 1], dp[i][j] + A[i + k]);
				}
			}
		}
	}

	cout << dp[N][N / 2] << endl;
}




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

#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 2e5+10;
ll pre[N][2] = {0}, aft[N][2] = {0};
ll a[N];
int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
	scanf("%lld", a+i);
	if(n % 2)
	{
		ll res = -1e18;
		for(int i = 2; i <= n; i+=2)
		{
			pre[i][0] = pre[i-2][0] + a[i - 1];
			pre[i][1] = max(pre[i - 2][0], pre[i - 2][1]) + a[i];
		}
		for(int i = n; i >= 1; i-=2)
		{
			aft[i][0] = max(aft[i+2][0], aft[i + 2][1]) + a[i - 1];
			aft[i][1] = aft[i + 2][1] + a[i];
		}
		for(int i = 1; i <= n; i+=2)
		{
			res = max(res, max(pre[i-1][0], pre[i-1][1]) + max(aft[i + 2][0], aft[i + 2][1]));
		}
		printf("%lld\n", res);
	}else
	{
		for(int i = 2; i <= n; i+=2)
		{
			pre[i][0] = pre[i-2][0] + a[i - 1];
			pre[i][1] = max(pre[i - 2][0], pre[i - 2][1]) + a[i];
			
		}
		printf("%lld\n", max(pre[n][0], pre[n][1]));
	}
} 

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

#include <bits/stdc++.h>
using namespace std;
#define int long long 
using ldb = long double;
using pa = pair < int, int >;
#define F  first
#define S  second
#define f(i,x,n) for(int i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
const int MOD = 1e9 + 7, N = 2e5 + 10;
const int LINF = LLONG_MAX;
int a[N];
int dp[N][4];
int visit[N][4];
int n;
int dfs(int pos,int skip){
    if(pos <= 0){
        return 0;
    }
    if(visit[pos][skip]){
        return dp[pos][skip];
    }
    visit[pos][skip] = 1;
    if(skip == 0){
        dp[pos][skip] = a[pos] + max({dfs(pos-2,0),dfs(pos-3,1),dfs(pos-4,2)});
    }
    else if(skip == 1){
        dp[pos][skip] = a[pos] + max(dfs(pos-2,1),dfs(pos-3,2));
    }
    else{
        dp[pos][skip] = a[pos] + dfs(pos-2,2);
    }
    return dp[pos][skip];
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    f(i,1,n+1){
        cin >> a[i];
    }
    if(n&1){
        cout << max({dfs(n,0),dfs(n-1,1),dfs(n-2,2)});
    }
    else
        cout << max(dfs(n,0),dfs(n-1,1));
    return 0;
}
 

Compiler output:
a.cc: In function 'long long int dfs(long long int, long long int)':
a.cc:20:8: error: reference to 'visit' is ambiguous
   20 |     if(visit[pos][skip]){
      |        ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:14:5: note:                 'long long int visit [200010][4]'
   14 | int visit[N][4];
      |     ^~~~~
a.cc:23:5: error: reference to 'visit' is ambiguous
   23 |     visit[pos][skip] = 1;
      |     ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:14:5: note:                 'long long int visit [200010][4]'
   14 | int visit[N][4];
      |     ^~~~~
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
//#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

ll dp[200010][3][2];

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

	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	rep(i, n + 1) rep(j, 3) rep(k, 2) dp[i][j][k] = -INF;
	dp[0][0][0] = a[0];
	dp[0][1][1] = 0;
	rep(i, n) {
		rep(j, 3) {
			chmax(dp[i + 1][j][1], dp[i][j][0]);
		}
		rep(j, 2) {
			chmax(dp[i + 1][j + 1][1], dp[i][j][1]);
		}
		rep(j, 3) {
			if (i != n - 1) chmax(dp[i + 1][j][0], dp[i][j][1] + a[i + 1]);
		}
	}
	ll ans = -INF;
	rep(j, 2) rep(k, 2) chmax(ans, dp[n][j][k]);
	if (n & 1) rep(k, 2) chmax(ans, dp[n][2][k]);
	cout << ans << '\n';
} 

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
//#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

ll dp[200010][3][2];

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

	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	rep(i, n) rep(j, 3) rep(k, 2) dp[i][j][k] = -INF;
	dp[0][0][0] = a[0];
	dp[0][1][1] = 0;
	rep(i, n) {
		rep(j, 3) {
			chmax(dp[i + 1][j][1], dp[i][j][0]);
		}
		rep(j, 2) {
			chmax(dp[i + 1][j + 1][1], dp[i][j][1]);
		}
		rep(j, 3) {
			if (i != n - 1)chmax(dp[i + 1][j][0], dp[i][j][1] + a[i + 1]);
		}
	}
	ll ans = 0;
	rep(j, 2) rep(k, 2) chmax(ans, dp[n][j][k]);
	if (n & 1) rep(k, 2) chmax(ans, dp[n][2][k]);
	cout << ans << '\n';
} 

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 debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int n;
vector<int> v;

ll Solve(int i,int j){
  if(i<0) return 0;
  if( j<(i)/2 || j>(i+2)/2) return -1001001001001001;
  static map<P<int,int>,ll> mp;
  if(mp.find({i,j}) != mp.end()) return mp[{i,j}];
  ll t = 0;
  if(i == 0){
    if(j > 1) return -1001001001001001;
    if(j == 0) return 0;
    return v[i];
  } else {
    t = max(Solve(i-2,j-1)+v[i],Solve(i-1,j));
  }
  return mp[{i,j}] = t;
}

int main(){
  cin >> n;
  v.resize(n);
  cin >> v;
  cout << Solve(n-1,n/2) << endl;
  return 0;
}


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

#include <bits/stdc++.h>
#define mk make_pair
#define pb push_back
#define scanf scanf_s
#define printf printf_s
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> pos;
const ll N = 200010, MOD = 998244353;

ll n, dp[N][3],a[N];

ll mn(ll a, ll b) {
	if (a == -1)return b;
	if (b == -1)return a;
	return min(a, b);
}

int bb(int v1) {
	if (v1 % 2 == 0)return v1 / 2 - 1;
	else return v1 / 2;
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> a[i];
	if (n % 2 == 0) {
		ll v1 = 0, v2 = 0;
		for (int i = 1; i <= n; i += 2)v1 += a[i];
		for (int i = 2; i <= n; i += 2)v2 += a[i];
		cout << max(v1, v2) << endl;
		return 0;
	}

	ll ans = INT16_MIN;
	for (int i = 0; i <= n; i++) {
		dp[i][0] = dp[i][1] = dp[i][2] = INT64_MIN;
	}
	dp[0][1] = 0;
	dp[1][2] = a[1];
	dp[2][1] = a[2];
	dp[3][1] = a[3];
	for (int i = 0; i <= n; i++) {
		if (i % 2 == 0) {
			for (int j = 0; j < 3; j++) {
				if (dp[i][j] == INT64_MIN)continue;
				int v1 = i / 2 + j - 1;
				if (v1 == n / 2)ans = max(ans, dp[i][j]);
				for (int i2 = i + 2; i2 <= n; i2++) {
					if (bb(i2) > v1 + 1)break;
					dp[i2][v1 + 2 - i2 / 2] = max(dp[i][j] + a[i2], dp[i2][v1 + 2 - i2 / 2]);
				}
			}
		}
		else {
			for (int j = 0; j < 3; j++) {
				if (dp[i][j] == INT64_MIN)continue;
				if (j == 0)continue;
				int v1 = i / 2 + j - 1;
				if (v1 == n / 2)ans = max(ans, dp[i][j]);
				for (int i2 = i + 2; i2 <= n; i2++) {
					if (bb(i2) > v1 + 1)break;
					dp[i2][v1 + 2 - i2 / 2] = max(dp[i][j] + a[i2], dp[i2][v1 + 2 - i2 / 2]);
				}
			}
		}
	}
	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 <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <climits>
#define mk make_pair
#define pb push_back
#define scanf scanf_s
#define printf printf_s
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> pos;
const ll N = 200010, MOD = 998244353;

ll n, dp[N][3],a[N];

ll mn(ll a, ll b) {
	if (a == -1)return b;
	if (b == -1)return a;
	return min(a, b);
}

int bb(int v1) {
	if (v1 % 2 == 0)return v1 / 2 - 1;
	else return v1 / 2;
}

int main() {
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> a[i];
	if (n % 2 == 0) {
		ll v1 = 0, v2 = 0;
		for (int i = 1; i <= n; i += 2)v1 += a[i];
		for (int i = 2; i <= n; i += 2)v2 += a[i];
		cout << max(v1, v2) << endl;
		return 0;
	}

	ll ans = INT16_MIN;
	for (int i = 0; i <= n; i++) {
		dp[i][0] = dp[i][1] = dp[i][2] = INT64_MIN;
	}
	dp[0][1] = 0;
	dp[1][2] = a[1];
	dp[2][1] = a[2];
	dp[3][1] = a[3];
	for (int i = 0; i <= n; i++) {
		if (i % 2 == 0) {
			for (int j = 0; j < 3; j++) {
				if (dp[i][j] == INT64_MIN)continue;
				int v1 = i / 2 + j - 1;
				if (v1 == n / 2)ans = max(ans, dp[i][j]);
				for (int i2 = i + 2; i2 <= n; i2++) {
					if (bb(i2) > v1 + 1)break;
					dp[i2][v1 + 2 - i2 / 2] = max(dp[i][j] + a[i2], dp[i2][v1 + 2 - i2 / 2]);
				}
			}
		}
		else {
			for (int j = 0; j < 3; j++) {
				if (dp[i][j] == INT64_MIN)continue;
				if (j == 0)continue;
				int v1 = i / 2 + j - 1;
				if (v1 == n / 2)ans = max(ans, dp[i][j]);
				for (int i2 = i + 2; i2 <= n; i2++) {
					if (bb(i2) > v1 + 1)break;
					dp[i2][v1 + 2 - i2 / 2] = max(dp[i][j] + a[i2], dp[i2][v1 + 2 - i2 / 2]);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

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

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

	vector<vll> dp(n, vll(2));
	//a[i]まで，j:切り捨て，切り上げ
	dp[0][0] = 0;
	dp[0][1] = a[0];
	dp[1][0] = max(a[0], a[1]);
	dp[1][1] = max(a[0], a[1]);

	vll v(n，0);
  //奇数項目まで見て切り上げ，のときの選び方は1通りなので先に求めておく．(*)
	v[0] = a[0];
	for (ll i = 2; i < n; i += 2) v[i] = v[i - 2] + a[i];

	for (ll i = 2; i < n; i++) {
    dp[i][0] = max(dp[i - 1][1], dp[i - 2][0] + a[i]);
	  if (i % 2 == 0) dp[i][1] = v[i]; // -------------------- (*)
	  else dp[i][1] = dp[i][0]; //偶数項目まで見たときは切り上げも切り捨ても変わらない
	}
	cout << dp[n - 1][0] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:15: error: 'n\U0000ff0c0' was not declared in this scope
   32 |         vll v(n，0);
      |               ^~~~
Language: C

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

ll dp[252521][3];
constexpr ll INF=1e18;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n;
  ll a[252521];
  cin>>n;
  REP(i, n){
    cin>>a[i];
  }
  int d=1+(n&1);
  REP(i, n+d){
    REP(j, d+1){
      dp[i][j]=-INF;
    }
  }
  dp[0][0]=0;
  REP(i, n+d){
    REP(j, d+1){
      if(i<n){
        CHMAX(dp[i+2][j], dp[i][j]+a[i]);
      }
      if(j<d){
        CHMAX(dp[i+1][j+1], dp[i][j]);
      }
    }
  }
  ll ans=-INF;
  REP(i, d+1){
    CHMAX(ans, dp[n+i][d]);
  }
  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

//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n;cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  if(n%2==0){
    ll p=0,q=0;
    rep(i,n){
      if(i%2==0)p+=a[i];
      if(i%2!=0)q+=a[i];
    }
    cout<<max(p,q)<<endl;
    return 0;
  }
  vl zero(n/2+1);
  vl one(n/2);
  zero[0]=a[0];
  one[0]=a[1];
  rep(i,n){
    if(i==0||i==1)continue;
    if(i%2==0)zero[i/2]=a[i]+zero[i/2-1];
    else one[i/2]=a[i]+one[i/2-1];
  }
  //rep(i,zero.size())cout<<zero[i]<<endl;
  //rep(i,one.size())cout<<one[i]<<endl;
  ll ans=-1000000007LL*500000;
  rep(i,n/2){
    //cout<<zero[i]<<" "<<one[n/2-1]-one[i]<<endl;
    ans=max(ans,zero[i]+one[n/2-1]-one[i]);
  }
  ll ans3=0;
  rep(i,n/2)ans+=a[i];
  reverse(a.begin(),a.end());
  vl zero2(n/2+1);
  vl one2(n/2);
  zero2[0]=a[0];
  one2[0]=a[1];
  rep(i,n){
    if(i==0||i==1)continue;
    if(i%2==0)zero2[i/2]=a[i]+zero2[i/2-1];
    else one2[i/2]=a[i]+one2[i/2-1];
  }
  rep(i,n/2){
    //cout<<zero[i]<<" "<<one[n/2-1]-one[i]<<endl;
    ans=max(ans,zero2[i]+one2[n/2-1]-one2[i]);
  }
  rep(i,n/2+1){
    for(ll j=i+1;j<=n/2-2;j++){
      ans=max(ans,zero[i]+one[j]-one[i]+zero[n/2]-zero[j+1]);
    }
  }
  cout<<ans<<endl;
}
    

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

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll dat[1<<18];
ll sum[1<<18];
ll dp[1<<18];
ll n;
int main(){
	cin>>n;
	for(ll i=0;i<n;i++) {
		cin>>dat[i];
		if(i>=2 and i%2==0) sum[i]=dat[i]+sum[i-2];
		else if(i==0) sum[i]=dat[i];
	}
	for(ll i=0;i<n;i++){
		if(i&1){
			dp[i]=max(dp[i-2]+dat[i] , sum[i-1]);
		}
		else{
			dp[i]=max(dp[i-2]+dat[i] , dp[i-1]);
		}
	}
	cout<<dp[n-1]<<endl;
	return 0;
}


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

#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)

















int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n){
        cin >> a[i];
    }
    if(n % 2 == 0){
        vector dp(n + 5, vector(2, -INF));
        dp[0][0] = 0;
        REP(i, n){
            dp[i + 2][0] = max(dp[i + 2][0], dp[i][0] + a[i]);
            dp[i + 1][1] = max(dp[i + 1][1], dp[i][0]);
            dp[i + 2][1] = max(dp[i + 2][1], dp[i][1] + a[i]);
        }
        ll ans = max({dp[n][0], dp[n][1], dp[n + 1][0], dp[n + 1][1]});
        cout << ans << endl;
    }
    else{
        vector dp(n + 5, vector(3, -INF));
        dp[0][0] = 0;
        REP(i, n){
            dp[i + 2][0] = max(dp[i + 2][0], dp[i][0] + a[i]);
            dp[i + 1][1] = max(dp[i + 1][1], dp[i][0]);
            dp[i + 2][1] = max(dp[i + 2][1], dp[i][1] + a[i]);
            dp[i + 1][2] = max(dp[i + 1][2], dp[i][1]);
            dp[i + 2][2] = max(dp[i + 2][2], dp[i][2] + a[i]);
        }
        ll ans = max(dp[n][0], dp[n + 1][0], dp[n][1], dp[n + 1][1], dp[n][2], dp[n + 1][2]});
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:92: error: expected ')' before '}' token
   76 |         ll ans = max(dp[n][0], dp[n + 1][0], dp[n][1], dp[n + 1][1], dp[n][2], dp[n + 1][2]});
      |                     ~                                                                      ^
      |                                                                                            )
a.cc:76:93: error: expected primary-expression before ')' token
   76 |         ll ans = max(dp[n][0], dp[n + 1][0], dp[n][1], dp[n + 1][1], dp[n][2], dp[n + 1][2]});
      |                                                                                             ^
a.cc:77:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   77 |         cout << ans << endl;
      |                 ^~~
      |                 abs
a.cc: At global scope:
a.cc:79:1: error: expected declaration before '}' token
   79 | }
      | ^
Language: C

def solve(pick, idx):

    if pick == 0: return 0
    if idx >= n: return -float('inf')

    total = max(A[idx] + solve(pick-1, idx+2), solve(pick, idx+1))

    dp[(pick, idx)] = total
    return total

n = int(input())
A = list(map(int, input().split()))
dp = {}
pick = n//2

print(solve(pick, 0))

Compiler output:
main.c:1:1: error: unknown type name 'def'
    1 | def solve(pick, idx):
      | ^~~
main.c: In function 'solve':
main.c:1:21: error: expected declaration specifiers before ':' token
    1 | def solve(pick, idx):
      |                     ^
main.c:4:32: warning: multi-character character constant [-Wmultichar]
    4 |     if idx >= n: return -float('inf')
      |                                ^~~~~
main.c:14:1: error: expected declaration specifiers before 'pick'
   14 | pick = n//2
      | ^~~~
main.c:1:5: error: type of 'pick' defaults to 'int' [-Wimplicit-int]
    1 | def solve(pick, idx):
      |     ^~~~~
main.c:1:5: error: type of 'idx' defaults to 'int' [-Wimplicit-int]
Language: C

	d[n+1][0][k  ]=MAX(d[n+1][0][k  ],d[n][j][k]);
      }
    }
  }
  a=-1e18;
  for(j=0;j<2;j++)a=MAX(a,d[n+1][j][1+n%2]);
  printf("%lld\n",a);
  return 0;
}


Compiler output:
main.c:1:11: error: 'n' undeclared here (not in a function)
    1 |         d[n+1][0][k  ]=MAX(d[n+1][0][k  ],d[n][j][k]);
      |           ^
main.c:1:19: error: 'k' undeclared here (not in a function)
    1 |         d[n+1][0][k  ]=MAX(d[n+1][0][k  ],d[n][j][k]);
      |                   ^
main.c:1:9: warning: data definition has no type or storage class
    1 |         d[n+1][0][k  ]=MAX(d[n+1][0][k  ],d[n][j][k]);
      |         ^
main.c:1:9: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
main.c:1:24: error: implicit declaration of function 'MAX' [-Wimplicit-function-declaration]
    1 |         d[n+1][0][k  ]=MAX(d[n+1][0][k  ],d[n][j][k]);
      |                        ^~~
main.c:1:48: error: 'j' undeclared here (not in a function)
    1 |         d[n+1][0][k  ]=MAX(d[n+1][0][k  ],d[n][j][k]);
      |                                                ^
main.c:2:7: error: expected identifier or '(' before '}' token
    2 |       }
      |       ^
main.c:3:5: error: expected identifier or '(' before '}' token
    3 |     }
      |     ^
main.c:4:3: error: expected identifier or '(' before '}' token
    4 |   }
      |   ^
main.c:5:3: warning: data definition has no type or storage class
    5 |   a=-1e18;
      |   ^
main.c:5:3: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:5:5: warning: overflow in conversion from 'double' to 'int' changes value from '-1.0e+18' to '-2147483648' [-Woverflow]
    5 |   a=-1e18;
      |     ^
main.c:6:3: error: expected identifier or '(' before 'for'
    6 |   for(j=0;j<2;j++)a=MAX(a,d[n+1][j][1+n%2]);
      |   ^~~
main.c:6:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    6 |   for(j=0;j<2;j++)a=MAX(a,d[n+1][j][1+n%2]);
      |            ^
main.c:6:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    6 |   for(j=0;j<2;j++)a=MAX(a,d[n+1][j][1+n%2]);
      |                ^~
main.c:7:10: error: expected declaration specifiers or '...' before string constant
    7 |   printf("%lld\n",a);
      |          ^~~~~~~~
main.c:7:19: error: expected declaration specifiers or '...' before 'a'
    7 |   printf("%lld\n",a);
      |                   ^
main.c:8:3: error: expected identifier or '(' before 'return'
    8 |   return 0;
      |   ^~~~~~
main.c:9:1: error: expected identifier or '(' before '}' token
    9 | }
      | ^
Language: C++

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

int main(){
  int x;
  cin>>x;
  vector<int>y(x);
  int odd=0;
  int even=0;
  if(x%2==0){
  for(int i=0;i<x/2;i++){
  odd+=y.at(2*i);
  even+=y.at(2*i+1);
  }
  cout<<max(odd,even)<<endl;
  }
  else{
  int odd2=0;
  for(int j=0;j<(x-1)/2;j++){
  odd2+=y.at(2*j)
  odd+=y.at(2*j+2);
  even+=y.at(2*j+1);
  }
  int z=max(odd,odd2);
  cout<<max(z,even)<<endl;
  }
}

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

include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  if(n%2==0){
    int vector<int>a(n/2); 
     int vector<int>b(n/2);
  }else
  int vector<int>a((n/2)+1);
  int vector<int>b(n/2);
  }
  
  for(int i=0;i<n;i+=2){
    cin>>a[i];
  }
  for(int i=1;i<n;i+=2){
    cin>>b[i];
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  int sum1=0;
  int sum2=0;
  for(int i=0;i<(n/2);i++){
    sum1+=a[i];
  }
  for(int i=0;i<(n/2);i++){
    sum2+=b[i];
  }
if(sum1>sum2){
  cout<<sum1;
}else{
  cout<<sum2;
}
  return 0;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:15: error: expected initializer before '<' token
    6 |     int vector<int>a(n/2);
      |               ^
a.cc:7:16: error: expected initializer before '<' token
    7 |      int vector<int>b(n/2);
      |                ^
a.cc:9:13: error: expected initializer before '<' token
    9 |   int vector<int>a((n/2)+1);
      |             ^
a.cc:10:13: error: expected initializer before '<' token
   10 |   int vector<int>b(n/2);
      |             ^
a.cc: At global scope:
a.cc:13:3: error: expected unqualified-id before 'for'
   13 |   for(int i=0;i<n;i+=2){
      |   ^~~
a.cc:13:15: error: 'i' does not name a type
   13 |   for(int i=0;i<n;i+=2){
      |               ^
a.cc:13:19: error: 'i' does not name a type
   13 |   for(int i=0;i<n;i+=2){
      |                   ^
a.cc:16:3: error: expected unqualified-id before 'for'
   16 |   for(int i=1;i<n;i+=2){
      |   ^~~
a.cc:16:15: error: 'i' does not name a type
   16 |   for(int i=1;i<n;i+=2){
      |               ^
a.cc:16:19: error: 'i' does not name a type
   16 |   for(int i=1;i<n;i+=2){
      |                   ^
a.cc:19:7: error: expected constructor, destructor, or type conversion before '(' token
   19 |   sort(a.begin(),a.end());
      |       ^
a.cc:20:7: error: expected constructor, destructor, or type conversion before '(' token
   20 |   sort(b.begin(),b.end());
      |       ^
a.cc:23:3: error: expected unqualified-id before 'for'
   23 |   for(int i=0;i<(n/2);i++){
      |   ^~~
a.cc:23:15: error: 'i' does not name a type
   23 |   for(int i=0;i<(n/2);i++){
      |               ^
a.cc:23:23: error: 'i' does not name a type
   23 |   for(int i=0;i<(n/2);i++){
      |                       ^
a.cc:26:3: error: expected unqualified-id before 'for'
   26 |   for(int i=0;i<(n/2);i++){
      |   ^~~
a.cc:26:15: error: 'i' does not name a type
   26 |   for(int i=0;i<(n/2);i++){
      |               ^
a.cc:26:23: error: 'i' does not name a type
   26 |   for(int i=0;i<(n/2);i++){
      |                       ^
a.cc:29:1: error: expected unqualified-id before 'if'
   29 | if(sum1>sum2){
      | ^~
a.cc:31:2: error: expected unqualified-id before 'else'
   31 | }else{
      |  ^~~~
a.cc:34:3: error: expected unqualified-id before 'return'
   34 |   return 0;
      |   ^~~~~~
a.cc:35:1: error: expected declaration before '}' token
   35 | }
      | ^
Language: C++

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

int main(){
  int x;
  cin>>x;
  vector<int>y(x);
  int odd=0;
  int even=0;
  if(x%2==0){
  for(int i=0;i<x/2;i++){
  odd+=y.at(2*i);
  even+=y.at(2*i+1);
  }
  }
  else{
  for(int j=0;j<(x-1)/2;j++){
  odd=y.at(0);
  odd+=y.at(2*j+2);
  even+=y.at(2*j+1);
  }
  }
  cout<<max(odd,even)<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<long long> vec(n);

    for (int i = 0; i < n; i++){
        cin >> vec.at(i);
    }
    
    if (n % 2 == 0){
        long long odd,even;
        odd = 0;
        even = 0;
        for (int i = 0; i < n; i+=2){
            odd += vec.at(i);
            even += vec.at(i+1);
        }
        if (odd > even) {
            printf("%lld\n", odd);
        }
        else {
            printf("%lld\n", even);
        }
    }
    else if ( n == 3 ){
        long long three_min = -1000000000;
        for (int i = 0; i < n; i+=2){
            if(vec.at(i)>three_min) three_min = vec.at(i);
        }
        printf("%lld\n", three_min);
    }
    else{
        vector<long long> odd(n/2 + 1);
        vector<long long> even(n/2);       
        odd.at(0) = vec.at(0);
        even.at(0) = vec.at(1);
        for (int i = 2; i < n; i+=2){
            odd.at(i/2) = odd.at(i/2-1) + vec.at(i);
        }
        for (int i = 3; i < n; i+=2){
            even.at(i/2) = even.at(i/2-1) + vec.at(i);
        }
        long long odd_min = 1000000000;
        for (int i = 0; i < n; i+=2){
            if(vec.at(i)<odd_min) odd_min = vec.at(i);
        }
        long long ans = odd.at(n/2) - odd_min;
        
        for (int i = -1; i < n-3; i+=2){
            for (int j = i + 3; j < n; j+=2){
                long long kari;
                if (i == -1){
                    kari = odd.at(n/2) - odd.at(j/2) + even.at(j/2 -1);
                }
                else {
                    kari = odd.at(n/2) - odd.at(j/2) + odd.at(i / 2) + even.at(j/2 -1) - even.at(i / 2);
                }
                if (kari > ans) ans = kari;
            }
        }
        printf("%lld\n",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 <vector>
#include <algorithm>

int main()
{
    using ll = long long;
    int N;
    std::cin >> N;

    if (N % 2 == 0) {
        ll a = 0, b = 0;
        for (int i = 0; i < N; ++i) {
            int tmp;
            std::cin >> tmp;
            if (i % 2 == 0) {
                a += tmp;
            } else {
                b += tmp;
            }
        }

        std::cout << std::max(a, b) << std::endl;
    } else {
        std::vector<ll> A(N);

        for (int i = 0; i < N; ++i) {
            std::cin >> A[i];
        }

        ll dp[200000][3] = {};
        dp[0][0] = A[0];
        dp[1][1] = A[1];
        dp[2][2] = A[2];

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

        std::cout << dp[N - 1][2] << std::endl;
    }

    return 0;
}

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


import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
// import java.io.*;
import java.util.*;
public class temp{
    public static void main(String args[])throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        int n=Integer.parseInt(br.readLine());
        StringTokenizer st = new StringTokenizer(br.readLine()); 
       int[]arr=new int[n];
       for(int i=0;i<n;i++)
       arr[i]=Integer.parseInt(st.nextToken());

       ans(arr,0,0,0);
        System.out.println(count);
       // display(dp);
    }
   public static long count=0;
    public static void ans(int[]arr,int vidx,long sum,int a){
    
        if(sum>count && a>=arr.length/2)
        count=sum;
        // if(sum>count && a>=arr.length/2 && vidx>=arr.length-1)
        // return count;
        if(vidx>=arr.length)
        return ;
    
      ans(arr,vidx+2,sum+arr[vidx],a+1);
     ans(arr,vidx+1,sum,a);

     
}
}

Compiler output:
Main.java:8: error: class temp is public, should be declared in a file named temp.java
public class temp{
       ^
1 error