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

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.cpp
 * Author: Allen
 *
 * Created on January 12, 2019, 5:08 PM
 */

#include <cstdlib>
#include <iostream>
#include <stdio.h>
using namespace std;

/*
 * 
 */
int main(int argc, char** argv) {
    int n;
    cin>>n;
    int a,b,c;
    int dp[n+1][3];
    dp[0][0]=0;
    dp[0][1]=0;
    dp[0][2]=0;
    for(int i=1;i<=n;i++){
        cin>>a>>b>>c;
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a;
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b;
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c;
    }
    printf("%d",max(dp[n][0]max(dp[n][1],dp[n][2]));
    return 0;
}



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:36:29: error: expected ')' before 'max'
   36 |     printf("%d",max(dp[n][0]max(dp[n][1],dp[n][2]));
      |                    ~        ^~~
      |                             )
a.cc:36:20: error: no matching function for call to 'max(int&)'
   36 |     printf("%d",max(dp[n][0]max(dp[n][1],dp[n][2]));
      |                 ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:15:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>



using namespace std;

int main()
{
    int n;
  	vector<int> h;
  	int cost[1000000];
  	int dp[100000];
  	
    cin >> n; cin.ignore();
    for (int i = 0; i < n; i++) {
        int k,l,m;
        cin >> k >>l>>m; cin.ignore();
        h.push_back(k);
      	h.push_back(l);
	    h.push_back(m);
    }
  	
  	for(int i = 0; i<3; i++){
      cost[i] = h[i];
    }
  	dp[0] = max(cost[0],cost[1],cost[2]); 	
  
  	for(int i = 1; i<n; i++){
	  cost[3*i] = h[3*i]+max(cost[3*(i-1)+1],cost[3*(i-1)+2]);
      cost[3*i+1] = h[3*i+1]+max(cost[3*(i-1)],cost[3*(i-1)+2]);
      cost[3*i+2] = h[3*i+2]+max(cost[3*(i-1)],cost[3*(i-1)+1]);
      dp[i] = max({cost[3*i],cost[3*i+1],cost[3*i+2]}); 
    }
    cout<<dp[n-1]<<endl;
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:29:15:   required from here
   29 |         dp[0] = max(cost[0],cost[1],cost[2]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int mat[100050][3];
int dp[100050][3];

int main(){
    int n,a,b,c,sol=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a>>b>>c;
        mat[i][0]=a;
        mat[i][1]=b;
        mat[i][2]=c
    }

    dp[0][0]=a;
    dp[0][1]=b;
    dp[0][2]=c;
    for(int i=1;i<n;i++){
        dp[i][0]=mat[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=mat[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=mat[i][2]+max(dp[i-1][0],dp[i-1][1]);
    }

    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));



    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: expected ';' before '}' token
   17 |         mat[i][2]=c
      |                    ^
      |                    ;
   18 |     }
      |     ~
Language: C++

#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
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;}
const long long INF=1LL<<60;

//入力
int N;
long long a[100010][3];

//dpテーブル
long long dp[100010][3];

int main(){
    int N;
    cin>>N;
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(j==k){
                    continue;
                }
                chmax(dp[i+1][j],dp[i][j]+a[i][k]);
            }
        }
    }
    long long res=0;
    for(int i=0;i<3;i++){
        chmax(res,dp[N][i]);
    }
    cout<<res<<endl;
}
  
  



Compiler output:
a.cc:5:36: error: 't' was not declared in this scope
    5 | template<class T>inline bool chmin(t& a, T b){if(a>b){a=b;return true;}return false;}
      |                                    ^
a.cc:5:39: error: 'a' was not declared in this scope
    5 | template<class T>inline bool chmin(t& a, T b){if(a>b){a=b;return true;}return false;}
      |                                       ^
a.cc:5:44: error: expected primary-expression before 'b'
    5 | template<class T>inline bool chmin(t& a, T b){if(a>b){a=b;return true;}return false;}
      |                                            ^
a.cc:5:45: error: expression list treated as compound expression in initializer [-fpermissive]
    5 | template<class T>inline bool chmin(t& a, T b){if(a>b){a=b;return true;}return false;}
      |                                             ^
a.cc:5:46: error: expected ';' before '{' token
    5 | template<class T>inline bool chmin(t& a, T b){if(a>b){a=b;return true;}return false;}
      |                                              ^
      |                                              ;
Language: C++

#include<iostream>
#include<cmath>

using namespace std;

int happy[3];
int buf[3];
int v[3];
int n;

int main() {
    cin >> n;
    happy[0] = happy[1] = happy[2] = 0;
    for (int i = 0; i < n; ++i) {
        cin >> v[0] >> v[1] >> v[2];
        buf[0] = v[0] + max(happy[1], happy[2]);
        buf[1] = v[1] + max(happy[0], happy[2]);
        buf[2] = v[2] + max(happy[0], happy[1]);
        happy[0] = buf[0];
        happy[1] = buf[1];
        happy[2] = buf[2];
    }
    cout << max({happy[0], happy[1], happy[2]}) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:16: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   23 |     cout << max({happy[0], happy[1], happy[2]}) << endl;
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
const int MAX = 100001;
int n, k,arr[3][MAX], dp[MAX];
 
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  cin >> n >> k;
  
  memset(dp, 0x3f, sizeof(dp));
  dp[0] = 0;
  
  for(int i=1;i<=n;i++)cin>>arr[0][i]>>arr[1][i]>>arr[2][i];
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(j==k)continue;
      	dp[i+1][k]=max(dp[i+1][k], dp[i][j]+arr[k][i+1]);
      }
    }
  }
  cout<<max(dp[0][n],max(dp[1][n],dp[2][n]))<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: invalid types 'int[int]' for array subscript
   22 |         dp[i+1][k]=max(dp[i+1][k], dp[i][j]+arr[k][i+1]);
      |                ^
a.cc:22:31: error: invalid types 'int[int]' for array subscript
   22 |         dp[i+1][k]=max(dp[i+1][k], dp[i][j]+arr[k][i+1]);
      |                               ^
a.cc:22:41: error: invalid types 'int[int]' for array subscript
   22 |         dp[i+1][k]=max(dp[i+1][k], dp[i][j]+arr[k][i+1]);
      |                                         ^
a.cc:26:18: error: invalid types 'int[int]' for array subscript
   26 |   cout<<max(dp[0][n],max(dp[1][n],dp[2][n]))<<endl;
      |                  ^
a.cc:26:31: error: invalid types 'int[int]' for array subscript
   26 |   cout<<max(dp[0][n],max(dp[1][n],dp[2][n]))<<endl;
      |                               ^
a.cc:26:40: error: invalid types 'int[int]' for array subscript
   26 |   cout<<max(dp[0][n],max(dp[1][n],dp[2][n]))<<endl;
      |                                        ^
Language: C++

// https://atcoder.jp/contests/dp/tasks/dp_c
// AC 26ms 4992KB

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

#define rep(i,a,b) for (int (i) = a; (i) < b; ++(i))
#define maxi(a, b) ((a) = max((a), (b)))

int N;
int arr[100005][3];
int dp[100005][3];

void read() {
	cin >> N;
	rep(i,1,N+1) rep(j,0,3)
		cin >> arr[i][j];
}

void solve() {
	rep(i,0,3) dp[0][i]=0;

	rep(i,1,N+1) {
		rep(p,0,3) dp[i][p]=INT_MIN;
		rep(j,0,3) rep(k,0,3)
			if (k != j) maxi(dp[i][j], arr[i][j] + dp[i-1][k]);
	}

	ll ans = INT_MIN;
	rep(i,0,3) maxi(ans, dp[N][i]);
	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	read();
	solve();
	return 0;
}



Compiler output:
a.cc: In function 'void solve()':
a.cc:29:9: error: 'll' was not declared in this scope
   29 |         ll ans = INT_MIN;
      |         ^~
a.cc:30:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |         rep(i,0,3) maxi(ans, dp[N][i]);
      |                         ^~~
a.cc:8:22: note: in definition of macro 'maxi'
    8 | #define maxi(a, b) ((a) = max((a), (b)))
      |                      ^
a.cc:31:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   31 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

    #include <stdio.h>
    #include <map>
    #include <utility>
    using namespace std;
    const int N=1e5+10;
    int max(int a,int b){return a>b?a:b;}
    map<pair<int,int>,int> m;
    int a[N][3];
    int dp(int n,int last){
    if(n==0)return 0;
    if(m.find({n,last})!=m.end())return m[{n,last}];
    return m[{n,last}]=max(dp(n-1,(last+1)%3)+a[n][(last+1)%3],dp(n-1,(last+2)%3)+a[n][(last+2)%3]);
    }
    int main(){
    int n;
      scanf("%d",&n);
      for(int i=1;i<=n;i++)scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);
      printf("%d\n",max(dp(n,0),max(dp(n,1),dp(n,2)));
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:18:54: error: expected ')' before ';' token
   18 |       printf("%d\n",max(dp(n,0),max(dp(n,1),dp(n,2)));
      |             ~                                        ^
      |                                                      )
Language: C++

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

int main(int argc, char *argv[]) {
    int n;
    cin >> n;

    vector<int> a, b, c;
    for(int i = 0; i < n; ++i) {
        int aa, bb, cc;
        cin >> aa >> bb >> cc;
        a.emplace_back(aa);
        b.emplace_back(bb);
        c.emplace_back(cc);
    }

    vector<vector<int>> dp(3, vector<int>(n, INT_MIN));
    dp[0].back() = a.back();
    dp[1].back() = b.back();
    dp[2].back() = c.back();

    vector<int>* abc[3] = {&a, &b, &c};
    for(int i = n - 1; i >= 0; --i) {
        for(int j = 0; j < 3; ++j) {
            for(int k = 0; k < 3; ++k) {
                if(k == j) continue;
                dp[j][i] = max(dp[j][i], (*abc[j])[i] + dp[k][i + 1]);
            }
        }
    }

    cout << max(dp[0][0], max(dp[1][0], dp[2][0])) << '\n';
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:18:46: error: 'INT_MIN' was not declared in this scope
   18 |     vector<vector<int>> dp(3, vector<int>(n, INT_MIN));
      |                                              ^~~~~~~
a.cc:3:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
  int n,i;
  scanf("%d",&n);
  vector<vector<int>>a(n,vector<int>(3,0));
  vector<vector<int>>dp(n,vector<int>(3,0));
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
  }
  dp[n-1][0] = a[i][0];
  dp[n-1][1] = a[i][1];
  dp[n-1][2] = a[i][2];
  for(i=n-2;i>=0;i--){
    dp[i][0] = a[i][0] + max(dp[i+1][1],dp[i+1][2]);
    dp[i][1] = a[i][1] + max(dp[i+1][0],dp[i+1][2]);
    dp[i][2] = a[i][2] + max(dp[i+1][0],dp[i+1][1]);
  }
  printf("%d",max({dp[0][0],dp[0][1],dp[0][2]}));
}
#include <bits/stdc++.h>

using namespace std;

int main(){
  int n,i;
  scanf("%d",&n);
  vector<vector<int>>a(n,vector<int>(3,0));
  vector<vector<int>>dp(n,vector<int>(3,0));
  for(i=0;i<n;i++){
    scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
  }
  dp[n-1][0] = a[n-1][0];
  dp[n-1][1] = a[n-1][1];
  dp[n-1][2] = a[n-1][2];
  for(i=n-2;i>=0;i--){
    dp[i][0] = a[i][0] + max(dp[i+1][1],dp[i+1][2]);
    dp[i][1] = a[i][1] + max(dp[i+1][0],dp[i+1][2]);
    dp[i][2] = a[i][2] + max(dp[i+1][0],dp[i+1][1]);
  }
  printf("%d",max({dp[0][0],dp[0][1],dp[0][2]}));
}


Compiler output:
a.cc:27:5: error: redefinition of 'int main()'
   27 | int main(){
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main(){
      |     ^~~~
Language: C++

/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> dp1(n), dp2(n), dp3(n),arr1(n),arr2(n),arr3(n);
    for(int i=0; i<n; i++)
    {
        cin >> arr1[i] >> arr2[i] >> arr3[i];
    }
    dp1[0] = arr1[0];
    dp2[0] = arr2[0];
    dp3[0] = arr3[0];
    for(int i=1; i<n; i++)
    {
        dp1[i] = arr1[i]+max(dp2[i-1],dp3[i-1]);
        dp2[i] = arr2[i]+max(dp1[i-1],dp3[i-1]);
        dp3[i] = arr3[i]+max(dp1[i-1],dp2[i-1]);
    }
    int ans = max(dp1[n-1],max(dp2[n-1],dp3[n-1]));
    cout << ans;
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:34:14: error: expected '}' at end of input
   34 |     return 0;
      |              ^
a.cc:15:1: note: to match this '{'
   15 | {
      | ^
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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.rbegin(), v.rend());//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  ll dp[100010][3];
  ll happy[10010][3];

  REP(i,n){
    cin >> happy[i][0] >>happy[i][1] >> happy[i][2];
    dp[i][0]=0;dp[i][1]=0;dp[i][2]=0;
  }
  dp[1][0] = happy[0][0];
  dp[1][1] = happy[0][1];
  dp[1][2] = happy[0][2];

  for(int i=1;i<=n;i++){
      dp[i+1][0] = max(dp[i][1],dp[i][2])+happy[i][0],;//aを選ぶ
      dp[i+1][1] = max(dp[i][0],dp[i][2])+happy[i][1];//bを選ぶ
      dp[i+1][2] = max(dp[i][0],dp[i][1])+happy[i][2];//cを選ぶ
    }
  
  ll ans=0;

  REP(i,3){
    ans = max(ans,dp[n][i]);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:55: error: expected primary-expression before ';' token
   43 |       dp[i+1][0] = max(dp[i][1],dp[i][2])+happy[i][0],;//aを選ぶ
      |                                                       ^
Language: C++

#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<utility>
#include <math.h>
#include <cmath>
#include <string.h>
#define __STDC_LIMIT_MACROS
#include <stdint.h>

using namespace std;
typedef long long ll;

ll dp[4][100005];
ll a[10005];
ll b[10005];
ll c[10005];

ll n=0;
int prev=-1;//0-a,1-b,2,c
ll dpfun(int ij,int prev)
{
	if(dp[prev][ij]!= -1)
		return dp[prev][ij];
	ll i,max1 = INT_MIN;
	if(ij==n-1)
	{	
		if(prev==0)
		{
			max1=max(c[ij],b[ij]);
			max1=max(max1,c[ij]);
			dp[prev][ij]=max1;
			return max1;
		}	
		if(prev==1)
		{
			max1=max(max1,a[ij]);
			max1=max(max1,c[ij]);
			dp[prev][ij]=max1;
			return max1;
		}	
		if(prev==2)
		{
			max1=max(max1,b[ij]);
			max1=max(max1,a[ij]);
			dp[prev][ij]=max1;
			return max1;
		}	
	}
	if(prev==0)//a
	{
			max1= max(dpfun(ij+1,1)+ b[ij] ,dpfun(ij+1,2) + c[ij]);
		dp[prev][ij]=max1;
		return max1;
	}
	if(prev==1)//b
	{
			max1= max(dpfun(ij+1,0)+ a[ij] ,dpfun(ij+1,2) + c[ij]);
		dp[prev][ij]=max1;
		return max1;
	}
	if(prev==2)//c
	{
			max1= max(dpfun(ij+1,0)+ a[ij] ,dpfun(ij+1,1) + b[ij]);
		dp[prev][ij]=max1;
		return max1;
	}
	return 0;

}

int main()
{
	ios_base::sync_with_stdio(false); 
	cin>>n;
	if(n==0)
		return 0;
	memset(dp,-1, sizeof dp);
	ll i;
	for(i=0;i<n;i++)
		cin>>a[i]>>b[i]>>c[i];

	ll ans=INT_MIN;
		dp[0][0]=dpfun(0,0);
	// memset(dp,-1, sizeof dp);
		dp[1][0]=dpfun(0,1);
	// memset(dp,-1, sizeof dp);
		dp[2][0]=dpfun(0,2);

		ans=max(ans,dp[0][0]);
		ans=max(ans,dp[1][0]);
		ans=max(ans,dp[2][0]);
ll j;
	cout<<ans<<endl;
			// for(i=0;i<n;i++)
		// {
		// 	for(j=0;j<3;j++)
		// 		cout<<dp[j][i]<<" ";
		// 	cout<<endl;
		// }
	return 0;
}

Compiler output:
a.cc: In function 'll dpfun(int, int)':
a.cc:26:21: error: 'INT_MIN' was not declared in this scope
   26 |         ll i,max1 = INT_MIN;
      |                     ^~~~~~~
a.cc:11:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include <stdint.h>
  +++ |+#include <climits>
   11 | 
a.cc: In function 'int main()':
a.cc:84:16: error: 'INT_MIN' was not declared in this scope
   84 |         ll ans=INT_MIN;
      |                ^~~~~~~
a.cc:84:16: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<utility>
#include <math.h>
#include <cmath>

using namespace std;
typedef long long ll;

ll dp[4][100005];
ll a[10005];
ll b[10005];
ll c[10005];

ll n=0;
int prev=-1;//0-a,1-b,2,c
ll dpfun(int ij,int prev)
{
	if(dp[prev][ij]!= -1)
		return dp[prev][ij];
	ll i,max1 = INT_MIN;
	if(ij==n-1)
	{	
		if(prev==0)
		{
			max1=max(c[ij],b[ij]);
			max1=max(max1,c[ij]);
			dp[prev][ij]=max1;
			return max1;
		}	
		if(prev==1)
		{
			max1=max(max1,a[ij]);
			max1=max(max1,c[ij]);
			dp[prev][ij]=max1;
			return max1;
		}	
		if(prev==2)
		{
			max1=max(max1,b[ij]);
			max1=max(max1,a[ij]);
			dp[prev][ij]=max1;
			return max1;
		}	
	}
	if(prev==0)//a
	{
			max1= max(dpfun(ij+1,1)+ b[ij] ,dpfun(ij+1,2) + c[ij]);
		dp[prev][ij]=max1;
		return max1;
	}
	if(prev==1)//b
	{
			max1= max(dpfun(ij+1,0)+ a[ij] ,dpfun(ij+1,2) + c[ij]);
		dp[prev][ij]=max1;
		return max1;
	}
	if(prev==2)//c
	{
			max1= max(dpfun(ij+1,0)+ a[ij] ,dpfun(ij+1,1) + b[ij]);
		dp[prev][ij]=max1;
		return max1;
	}
	return 0;

}

int main()
{
	ios_base::sync_with_stdio(false); 
	cin>>n;
	if(n==0)
		return 0;
	memset(dp,-1, sizeof dp);
	ll i;
	for(i=0;i<n;i++)
		cin>>a[i]>>b[i]>>c[i];

	ll ans=INT_MIN;
		dp[0][0]=dpfun(0,0);
	// memset(dp,-1, sizeof dp);
		dp[1][0]=dpfun(0,1);
	// memset(dp,-1, sizeof dp);
		dp[2][0]=dpfun(0,2);

		ans=max(ans,dp[0][0]);
		ans=max(ans,dp[1][0]);
		ans=max(ans,dp[2][0]);
ll j;
	cout<<ans<<endl;
			// for(i=0;i<n;i++)
		// {
		// 	for(j=0;j<3;j++)
		// 		cout<<dp[j][i]<<" ";
		// 	cout<<endl;
		// }
	return 0;
}

Compiler output:
a.cc: In function 'll dpfun(int, int)':
a.cc:23:21: error: 'INT_MIN' was not declared in this scope
   23 |         ll i,max1 = INT_MIN;
      |                     ^~~~~~~
a.cc:8:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <cmath>
  +++ |+#include <climits>
    8 | 
a.cc: In function 'int main()':
a.cc:76:9: error: 'memset' was not declared in this scope
   76 |         memset(dp,-1, sizeof dp);
      |         ^~~~~~
a.cc:8:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    7 | #include <cmath>
  +++ |+#include <cstring>
    8 | 
a.cc:81:16: error: 'INT_MIN' was not declared in this scope
   81 |         ll ans=INT_MIN;
      |                ^~~~~~~
a.cc:81:16: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <algorithm<
using namespace std;
int main(){
  int n;
  int a[100000];
  int b[100000];
  int c[100000];
  int dpa[100000];
  int dpb[100000];
  int dpc[100000];
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> a[i] >> b[i] >> c[i];
  }
  dpa[0] = a[0];
  dpb[0] = b[0];
  dpc[0] = c[0];
  for(int i = 1;i < n;i++){
    dpa[i] = max(dpb[i - 1], dpc[i - 1]) + a[i];
    dpb[i] = max(dpa[i - 1], dpc[i - 1]) + b[i];
    dpc[i] = max(dpa[i - 1], dpb[i - 1]) + c[i];
  }
  cout << max(max(dpa[n - 1], dpb[n - 1]), dpc[n - 1]) << endl;
}

Compiler output:
a.cc:2:21: error: missing terminating > character
    2 | #include <algorithm<
      |                     ^
a.cc:2:10: fatal error: algorithm<: No such file or directory
    2 | #include <algorithm<
      |          ^
compilation terminated.
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n;
  int a[100000];
  int b[100000];
  int c[100000];
  int dpa[100000];
  int dpb[100000];
  int dpc[100000];
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> a[i] >> b[i] >> c[i];
  }
  dpa[0] = a[0];
  dpb[0] = b[0];
  dpc[0] = c[0];
  for(int i = 1;i < n;i++){
    dpa[i] = max(dpb[i - 1], dpc[i - 1]) + a[i];
    dpb[i] = max(dpa[i - 1], dpc[i - 1]) + b[i];
    dpc[i] = max(dpa[i - 1], dpb[i - 1]) + c[i];
  }
  cout << max(max(dpa[n - 1], dpb[n - 1]), dpc[n - 1]); << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:57: error: expected primary-expression before '<<' token
   24 |   cout << max(max(dpa[n - 1], dpb[n - 1]), dpc[n - 1]); << endl;
      |                                                         ^~
Language: C++

#include <iostream>
#include <algorithm<
using namespace std;
int main(){
  int n;
  int a[100000];
  int b[100000];
  int c[100000];
  int dpa[100000];
  int dpb[100000];
  int dpc[100000];
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> a[i] >> b[i] >> c[i];
  }
  dpa[0] = a[0];
  dpb[0] = b[0];
  dpc[0] = c[0];
  for(int i = 1;i < n;i++){
    dpa[i] = max(dpb[i - 1], dpc[i - 1]) + a[i];
    dpb[i] = max(dpa[i - 1], dpc[i - 1]) + b[i];
    dpc[i] = max(dpa[i - 1], dpb[i - 1]) + c[i];
  }
  cout << max(max(dpa[n - 1], dpb[n - 1]), dpc[n - 1]); << endl;
}

Compiler output:
a.cc:2:21: error: missing terminating > character
    2 | #include <algorithm<
      |                     ^
a.cc:2:10: fatal error: algorithm<: No such file or directory
    2 | #include <algorithm<
      |          ^
compilation terminated.
Language: Java

import java.util.*;
import java.io.*;

public class Vacation {
	static BufferedReader br;
	static StringTokenizer tokenizer;

	public static void main(String[] args) throws Exception {
		br = new BufferedReader(new InputStreamReader(System.in));
		int n = nextInt();
		int[][] arr = new int[n][3];
		int[][] dp = new int[n][3];
		for(int i = 0; i < n; i++) {
			for(int k = 0; k < 3; k++)
				arr[i][k] = nextInt();
		}
		dp[0][0] = arr[0][0];
		dp[0][1] = arr[0][1];
		dp[0][2] = arr[0][2];
		for(int i = 0; i < n - 1; i++) {
			for(int k = 0; k < 3; k++) {
				dp[i + 1][(k + 1) % 3] = Math.max(dp[i + 1][(k + 1) % 3], dp[i][k] + arr[i + 1][(k + 1) % 3]);
				dp[i + 1][(k + 2) % 3] = Math.max(dp[i + 1][(k + 2) % 3], dp[i][k] + arr[i + 1][(k + 2) % 3]);
			}
		}
		System.out.println((int) Math.max(Math.max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]));
	}

	public static String next() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null)
				throw new IOException();
			tokenizer = new StringTokenizer(line);
		}
		return tokenizer.nextToken();
	}

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


Compiler output:
Main.java:4: error: class Vacation is public, should be declared in a file named Vacation.java
public class Vacation {
       ^
1 error
Language: C++

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

int main(){
  int n;cin>>n;
  int dp[3]={};
  cin>>dp[0]>>dp[1]>>dp[2];
  int a,b,c,x,y,z;
  fol(i,n-1){
    cin>>a>>b>>c;
    a += max(dp[1],dp[2]),
    b +=max(dp[0],dp[2]),
    c +=max(dp[0],dp[1]),
    dp[0] = a, dp[1] = b, dp[2] = c;
  }
  printf("%d\n",max(dp[0],dp[1],dp[2]));
  return 0;
}


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

#include <iostream>
#include <cmath>
#include <tuple>
typedef long long ll;

using namespace std;

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

  int a[N - 1], b[N - 1], c[N - 1];
  
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    cin >> b[i];
    cin >> c[i];
  }
  int dp[N];
  dp[0] = 0;

  int prev[N - 1];

  for (int i = 0; i < N; i++) {
    int max_h;
    if (i == 0) {
      max_h = max({a[i], b[i], c[i]});
      dp[i + 1] = dp[i] + max_h;
      if (max_h == a[i]) prev[i] = 0;
      else if (max_h == b[i]) prev[i] = 1;
      else prev[i] = 2;
    }
    else {
      if (prev[i - 1] == 0) a[i] = 0;
      else if (prev[i - 1] == 1) b[i] = 0;
      else c[i] = 0;
      max_h = max({a[i], b[i], c[i]});
      dp[i + 1] = dp[i] + max_h;
      if (max_h == a[i]) prev[i] = 0;
      else if (max_h == b[i]) prev[i] = 1;
      else prev[i] = 2;
    }
    cout << a[i] << " " << b[i] << " " << c[i] << "*" << prev[i] << endl;
    cout << dp[i + 1] << endl;
  }
  cout << dp[N] << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:18: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   27 |       max_h = max({a[i], b[i], c[i]});
      |               ~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
a.cc:37:18: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   37 |       max_h = max({a[i], b[i], c[i]});
      |               ~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
Language: C++

N = int(input())
Happiness = [[int(h) for h in input().split()] for n in range(N)]

MaxTotalHappiness = [[0, 0, 0] for n in range(N)]
MaxTotalHappiness[0] = Happiness[0]

for i in range(N-1):
    MaxTotalHappiness[i+1][0] = max(MaxTotalHappiness[i+1][0], max(MaxTotalHappiness[i][1], MaxTotalHappiness[i][2]) + Happiness[i+1][0])
    MaxTotalHappiness[i+1][1] = max(MaxTotalHappiness[i+1][1], max(MaxTotalHappiness[i][0], MaxTotalHappiness[i][2]) + Happiness[i+1][1])
    MaxTotalHappiness[i+1][2] = max(MaxTotalHappiness[i+1][2], max(MaxTotalHappiness[i][0], MaxTotalHappiness[i][1]) + Happiness[i+1][2])

print(max(MaxTotalHappiness[N-1]))

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C++

#include<iostream>
using namespace std;
int n;
int cache[100000][100000]={0};
int a[100000]={0},b[100000]={0},c[100000]={0};
int max_hap(int i,int ch)
{
	if(i>n-1)
	return 0;
	if(cache[i][ch]!=0)
	return cache[i][ch];
	if(ch==2)
	{
		int x=a[i]+max_hap(i+1,1);
		int y=c[i]+max_hap(i+1,3);
		cache[i][ch]=x>y?x:y;
		return cache[i][ch];
	}
		else if(ch==1)
	{
		int x=b[i]+max_hap(i+1,2);
		int y=c[i]+max_hap(i+1,3);
		cache[i][ch]=x>y?x:y;
		return cache[i][ch];
	}
		else if(ch==3)
	{
		int x=a[i]+max_hap(i+1,1);
		int y=b[i]+max_hap(i+1,2);
		cache[i][ch]=x>y?x:y;
		return cache[i][ch];
	}
	else if(ch==0)
	{int x=a[i]+max_hap(i+1,1);
		int y=b[i]+max_hap(i+1,2);
		int z=c[i]+max_hap(i+1,3);
		if(x>=y&&x>=z)
		cache[i][ch]=x;
		else if(y>=x&&y>=z)
		cache[i][ch]=y;
		else if(z>=x&&z>=y)
		cache[i][ch]=z;
		return cache[i][ch];
	}
}
int main()
{
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i]>>b[i]>>c[i];
int x= max_hap(0,0);
cout<<x;	
}

Compiler output:
a.cc: In function 'int max_hap(int, int)':
a.cc:45:1: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      | ^
/tmp/cceKayZA.o: in function `max_hap(int, int)':
a.cc:(.text+0x95): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cceKayZA.o
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/cceKayZA.o
a.cc:(.text+0x15f): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cceKayZA.o
a.cc:(.text+0x18d): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/cceKayZA.o
a.cc:(.text+0x229): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cceKayZA.o
a.cc:(.text+0x257): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cceKayZA.o
a.cc:(.text+0x2f3): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cceKayZA.o
a.cc:(.text+0x321): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cceKayZA.o
a.cc:(.text+0x34f): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/cceKayZA.o
/tmp/cceKayZA.o: in function `main':
a.cc:(.text+0x48a): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cceKayZA.o
a.cc:(.text+0x4b6): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

n = gets.to_i
dp = Array.new(n+1){[]}
dp[0] = [0,0,0]
n.times do |i|
  h = gets.split.map(&:to_i)
  dp[i+1][0] = [dp[i][1], dp[i][2]].max + h[0]
  dp[i+1][1] = [dp[i][0], dp[i][2]].max + h[1]
  dp[i+1][2] = [dp[i][0], dp[i][1]].max + h[2]
end
p dp[n].max


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = gets.to_i
      | ^
a.cc:3:1: error: 'dp' does not name a type
    3 | dp[0] = [0,0,0]
      | ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
double ans[200005];
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long int lli;
int main()
{
    fio;
    int n;
    cin>>n;
    int a,b,c;
    cin>>a>>b>>c;
    int la=a,pa=1,lb=b,pb=b,lc=c,pc=c;
    int dp[n+1][3]={0};
    dp[0][0]=a;dp[0][1]=b;dp[0][2]=c;

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

            int in[3];
            cin>>in[0]>>in[1]>>in[2];
            for(int j=0;j<3;j++)
            {

                for(int k=0;k<3;k++)
                {
                    if(j!=k)
                    dp[i][j]=max(dp[i][j],dp[i-1][k]+in[j]);
                }
               // cout<<dp[i][j]<< " ";
            }
            //3
10 40 70
20 50 80
30 60 90cout<<"\n";


        }

        cout<<*max_element(dp[n-1],dp[n-1]+3);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:3: error: expected ';' before numeric constant
   33 | 10 40 70
      |   ^~~
      |   ;
Language: C++

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

#define int long long

int N;
vector<vector<int> > arr, grid;

int dp(int i , int prev)
{
    if(grid[i][prev] != -1)
        return grid[i][prev];

    int ans=0;

    if(i==N){
         if(prev == 0) ans += max(arr[i][1] , max(arr[i][2] , arr[i][3]) );
    else if(prev == 1) ans += max(arr[i][2] , arr[i][3]);
    else if(prev == 2) ans += max(arr[i][1] , arr[i][3]);
    else if(prev == 3) ans += max(arr[i][1] , arr[i][2]);
    }

    else
    if(prev == 0)
        ans += max(max(dp(i+1, 1)+arr[i][1] , dp(i+1, 2)+arr[i][2]) , dp(i+1 , 3)+arr[i][3]);
    else if(prev == 1)
        ans += max(dp(i+1, 2)+arr[i][2] , dp(i+1 , 3)+arr[i][3]);
    else if(prev == 2)
        ans += max(dp(i+1, 1)+arr[i][1] , dp(i+1 , 3)+arr[i][3]);
    else if(prev == 3)
        ans += max(dp(i+1, 2)+arr[i][2] , dp(i+1 , 1)+arr[i][1]);

    return grid[i][prev] = ans;
}

int main()
{
    cin>>N;

    arr.resize(N+1 , vector<int>(4));

    grid.resize(N+1, vector<int>(4,-1));

    for(int i=1 ; i<=N ; i++)
        for(int j=1 ; j<=3 ; j++)
            cin>>arr[i][j];

   cout<<dp(1,0);
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

int arr[3][100005];
int dp[100005];

int solve(int n){
  for(int i = 0; i<3; ++i)dp[i][n] = arr[i][n];
  for(int i = (n-1); i>=1; --i){
    for(int j = 0; j<3; ++j){
    	for(int k = 0; k<3; ++k){
          if(j==k)continue;
          dp[j][i] = max(dp[j][i],dp[k][i+1]+arr[j][i]);
        }
    }
  }
  return max(dp[0][1],max(dp[1][1],dp[2][1]));
}

int main(){
  int n,k;
  scanf("%d",&n);
  for(int i = 1; i<=n; ++i){
    for(int j = 0; j<3; ++j)scanf("%d",&arr[j][i]);
  }
  printf("%d\n",solve(n));
  return 0;
}

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:9:32: error: invalid types 'int[int]' for array subscript
    9 |   for(int i = 0; i<3; ++i)dp[i][n] = arr[i][n];
      |                                ^
a.cc:14:16: error: invalid types 'int[int]' for array subscript
   14 |           dp[j][i] = max(dp[j][i],dp[k][i+1]+arr[j][i]);
      |                ^
a.cc:14:31: error: invalid types 'int[int]' for array subscript
   14 |           dp[j][i] = max(dp[j][i],dp[k][i+1]+arr[j][i]);
      |                               ^
a.cc:14:40: error: invalid types 'int[int]' for array subscript
   14 |           dp[j][i] = max(dp[j][i],dp[k][i+1]+arr[j][i]);
      |                                        ^
a.cc:18:19: error: invalid types 'int[int]' for array subscript
   18 |   return max(dp[0][1],max(dp[1][1],dp[2][1]));
      |                   ^
a.cc:18:32: error: invalid types 'int[int]' for array subscript
   18 |   return max(dp[0][1],max(dp[1][1],dp[2][1]));
      |                                ^
a.cc:18:41: error: invalid types 'int[int]' for array subscript
   18 |   return max(dp[0][1],max(dp[1][1],dp[2][1]));
      |                                         ^
Language: C++

n = int(input())
lis = [list(map(int,input().split())) for i in range(n)]
ans = [[10 ** 10] * 3 for i in range(n+1)]
ans[0] = [0,0,0]
for i in range(1,n+1):
    ans[i][0] = max(ans[i-1][1],ans[i-1][2])+lis[i-1][0]
    ans[i][1] = max(ans[i-1][2],ans[i-1][0])+lis[i-1][1]
    ans[i][2] = max(ans[i-1][0],ans[i-1][1])+lis[i-1][2]
print(max(ans[n]))

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <stdio.h>

int main(void) {
    int days, i, ,temp, sum;
    int a[100005], b[100005], c[100005];

    scanf("%d", &days);
    for(i=0; i<days; i++){
        scanf("%d %d %d", a[i], b[i], c[i]);
    }

    sum = 0;
    for(i=0; i<days; i++){
        temp = a[i];
        if (b[i] > a[i]){
            if(c[i] > b[i]){
                temp = c[i];
            }
            else {
                temp = b[i];
            }
        }
        else if(c[i] > a[i]) {
            temp = c[i];
        }
        else {
            temp = a[i];
        }
        sum += temp;
    }

    print(sum);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:18: error: expected unqualified-id before ',' token
    4 |     int days, i, ,temp, sum;
      |                  ^
a.cc:32:5: error: 'print' was not declared in this scope; did you mean 'printf'?
   32 |     print(sum);
      |     ^~~~~
      |     printf
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;

int N, D[100100][3];
int main()
{
	scanf("%d", &N);

	for (int i=1;i<=N;i++){
		int a,b,c; scanf ("%d %d %d",&a,&b,&c);
		int p = a + max(D[i-1][1], D[i-1][2]);
		int q = b + max(D[i-1][0], D[i-1][2]);
		int r = c + max(D[i-1][1], D[i-1][0]);
		D[i][0] = p;
		D[i][1] = q;
		D[i][2] = r;
	}
	printf ("%d\n",max(D[N][0],D[N][1],D[N][2]));

	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:19:20:   required from here
   19 |         printf ("%d\n",max(D[N][0],D[N][1],D[N][2]));
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#define _CRT_SECURE_NO_WARINGS
#include <iostream>
#include <iomanip>
#include <map>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <fstream>
#include <map>
#include <unordered_map>

using namespace std;
typedef int me;
typedef long long ll;
typedef unsigned long long ull;

#define andrew ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define sz(v) (int)(v.size())
#define all(v) v.begin(), v.end()
#define PI 3.1415926535
#define sin(i) (long double)sin(i *PI / 180.0)
#define cos(i) (long double)cos(i * PI/ 180.0)

ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ull lcm(ll x, ll y) { return x / gcd(x, y) * y; }

int dy8[] = { 0, 0, 1, -1, 1, -1, -1, 1 };
int dx8[] = { 1, -1, 0, 0, 1, -1, 1, -1 };
int id8[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
struct item
{
    int w;
    ll v;
};
int n, w;
vector<item>v;
ll mem[101][100005];
ll solve(int i, int ww)
{
   
    if (i == n)
        return 0;
   
    if (mem[i][ww] != -1)
        return mem[i][ww];

    mem[i][ww] = solve(i + 1, ww);

    if (ww - v[i].w >= 0)
        mem[i][ww] = max(mem[i][ww], solve(i + 1, ww - v[i].w) + v[i].v);

    return mem[i][ww];
}
int main()
{
    andrew;   

    cin >> n >> w;
    v.resize(n);
    for (auto& it : v)
        cin >> it.w >> it.v;

    memset(mem, -1, sizeof(mem));

    cout << solve(0, w) << endl;



  

}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:5: error: 'memset' was not declared in this scope
   70 |     memset(mem, -1, sizeof(mem));
      |     ^~~~~~
a.cc:17:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   16 | #include <unordered_map>
  +++ |+#include <cstring>
   17 |
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>

using namespace std;

long int getValue(int num, int capacity, long int input [num][2], long int dp [num][capacity]) {

  if (dp[num][capacity] != -1) {
    return dp[num][capacity];
  }

  // base case : if weight is 0, max value is 0
  if (num == 0 || capacity == 0) {
    dp[num][capacity] = 0;
    return 0;
  }
  else if (input[num - 1][0] > capacity) {
    long int result = getValue(num - 1, capacity, input, dp);
    dp[num][capacity] = result;
    return result;
  }
    
  else {
    // either can take or dont take
    long int valueOne = getValue(num - 1, capacity, input, dp);
    long int valueTwo = input[num - 1][1] + getValue(num - 1, capacity - input[num - 1][0], input, dp);

    long int result = max(valueOne, valueTwo);
    dp[num][capacity] = result;
    return result;
  }
}

int main() {
  
  int numItems;
  int capacity;
  cin >> numItems;
  cin >> capacity;

  long int input[numItems][2];

  for (int i = 0; i < numItems; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> input[i][j];
    }
  }

  // init dp array
  long int dp[numItems][capacity];
  for (int i = 0; i < numItems; i++) {
    for (int j = 0; j < capacity; j++) {
      dp[i][j] = -1;
    }
  }


  long int value = getValue(numItems, capacity, input, dp);
  cout << value;

  return 0;
}

Compiler output:
a.cc:8:61: error: use of parameter outside function body before ']' token
    8 | long int getValue(int num, int capacity, long int input [num][2], long int dp [num][capacity]) {
      |                                                             ^
a.cc:8:65: error: expected ')' before ',' token
    8 | long int getValue(int num, int capacity, long int input [num][2], long int dp [num][capacity]) {
      |                  ~                                              ^
      |                                                                 )
a.cc:8:67: error: expected unqualified-id before 'long'
    8 | long int getValue(int num, int capacity, long int input [num][2], long int dp [num][capacity]) {
      |                                                                   ^~~~
Language: C++

#include <iostream>
#define INT_MAX 1000000
#include <cstring>
#include <unordered_map>
#include <vector>
using namespace std;

int helper(vector<int>&val,  vector<int>&weights, int i, int n, int w, vector<vector<int>>& map)
{
  if (i>=n || w == 0)
    return 0;
  if (map[i][w])
    return map[i];
  if (weights[i] > w)
    return helper(val, weights, i+1, n, w, map);
  int ans = max(val[i] + helper(val, weights, i+1, n, w, map), helper(val, weights, i+1, n, w, map));
  map[i][w] = ans;
  return ans;
}

int main()
{
  int n, w;
  cin >> n >> w;
  vector<int> val(n, 0);
  vector<int> weights(n, 0);
  vector<vector<int>> map(n, vector<int>(w, 0));
  for(int i=0; i<n; i++)
    cin >> arr[i] >> weights[i];
  cout<<helper(arr, weights, 0, n, w, map);
  return 0;
}

Compiler output:
a.cc: In function 'int helper(std::vector<int>&, std::vector<int>&, int, int, int, std::vector<std::vector<int> >&)':
a.cc:13:17: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int' in return
   13 |     return map[i];
      |                 ^
a.cc: In function 'int main()':
a.cc:29:12: error: 'arr' was not declared in this scope
   29 |     cin >> arr[i] >> weights[i];
      |            ^~~
a.cc:30:16: error: 'arr' was not declared in this scope
   30 |   cout<<helper(arr, weights, 0, n, w, map);
      |                ^~~
Language: C

#include <bits/stdc++.h>
using namespace std;
long long arr [110000];
 
int main ()
{
int n,w;
int wi,vi;
cin >>n>>w;
int i,j;
for (i = 1 ;i <= n;i++)
{
cin >>wi>>vi;
for (j = w - wi;j >= 0;j --)
{
arr [j + wi] = max (arr [j + wi] , arr [j] + vi);
}
}
long long t ;
t = 0;
for (i = 0 ; i <= w;i ++)
{
t = max (t , arr [i]);
}
cout <<t<<'\n';
 
}


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

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

int getMaxVal(int *w, int *v, int W, int N) {
	
	int memo[N+1][W+1];
	
	for(int i=0; i<=N; i++) {
		for(int j=0; j<=W; j++) {
			if(i == 0 || j == 0) {
				memo[i][j] = 0;
			} else if(w[i-1] <= j) {
				memo[i][j] = max(v[i-1] + memo[i-1][j-w[i-1]], memo[i-1][j]);
			} else {
				memo[i][j] = memo[i-1][j];
			}
		}
	}
	
	return memo[N][W];
}

int main() {
	int n,w;
	cin>>n>>w;
	
	int weight[n];
	int value[n];
	for(int i=0; i<n; i++) {
		cin>>weight[i]>>value[i];
	}
	
	int memo[]
	
	
	cout<<getMaxVal(weight, value, w, n);
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: expected initializer before 'cout'
   37 |         cout<<getMaxVal(weight, value, w, n);
      |         ^~~~
Language: Java

public class Main{
	public static void main(String[] args) throws Exception{
		//BufferedInputStream bs = new BufferedInputStream(new FileInputStream(new File("data.txt")));
		//Scanner sc = new Scanner(bs);
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int W = sc.nextInt();
		int[][] items = new int[N+1][2];
		long[][] dp = new long[N+1][W+1];
		for(int i = 1; i <= N; i++) {
			for(int j = 0; j < 2; j++) {
				items[i][j] = sc.nextInt();
			}
		}
		for(int i = 1; i <= N; i++) {
			for(int j = 0; j <= W; j++) {
				if(j < items[i][0]) dp[i][j] = dp[i-1][j];
				else {
					dp[i][j] = Math.max(dp[i-1][j],dp[i-1][j-items[i][0]]+items[i][1]);
				}
			}
		}
		System.out.println(dp[N][W]);
	}
	public static void print(int[][] arr) {
		for(int[] a : arr)System.out.println(Arrays.toString(a));
	}
}


Compiler output:
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:26: error: cannot find symbol
		for(int[] a : arr)System.out.println(Arrays.toString(a));
		                                     ^
  symbol:   variable Arrays
  location: class Main
3 errors