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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class List1_4 {
	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);

		int n = Integer.valueOf(stdin.nextLine());
		List<List<Integer>> action = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			
			action.add(Arrays.stream(stdin.nextLine().split(" ", 3)).map(Integer::valueOf)
					.collect(Collectors.toList()));
		}

		int[][] dp = new int[n][3];
		for (int i = 0; i < 3; i++) {
			dp[0][i] = action.get(0).get(i);
		}

		for (int i = 1; i < n; i++) {
			for (int j = 0; j < 3; j++) {
				dp[i][j] = Math.max(dp[i - 1][(j + 1) % 3] + action.get(i).get(j),
						dp[i - 1][(j + 2) % 3] + action.get(i).get(j));
			}
		}

		int max = Integer.MIN_VALUE;
		for (int i = 0; i < 3; i++) {
			max = Math.max(max, dp[n - 1][i]);
		}

		System.out.println(max);

		stdin.close();
	}

}

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool comp(ll a, ll b) 
{ 
    return (a < b); 
} 
int main(){

ll n,i,j,k;
cin>>n;
vector < vector<ll> > v;
vector <ll> x;
ll dp1=0,dp2=0,dp3=0;
for(i=0;i<n;i++){
    
    for(j=0;j<3;j++){
        cin>>k;
        x.push_back(k);
    }
    v.push_back(x);
                }
for(i=0;i<n;i++){
  if(i%2==0){
    dp1+=v[i][0];
    dp2+=v[i][1];
    dp3+=v[i][2];
  }
  else{
    dp1+=std :: max(v[i][1],v[i][2],comp);
    dp2+=std :: max(v[i][0],v[i][2],comp);
    dp3+=std :: max(v[i][0],v[i][1],comp);
  }
}
cout<<std :: max({dp1,dp2,dp3,comp})<<endl;

return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   35 | cout<<std :: max({dp1,dp2,dp3,comp})<<endl;
      |       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:35:17: note:   deduced conflicting types for parameter '_Tp' ('long long int' and 'bool (*)(ll, ll)' {aka 'bool (*)(long long int, long long int)'})
   35 | cout<<std :: max({dp1,dp2,dp3,comp})<<endl;
      |       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> dp(3);
	
	for(int i=0; i<n; i++)
	{
		vector<int> c(3);
		for(int j=0; j<3; j++)
			cin>>c[i];
		vector<int> new_dp(3,0);
		for(int j=0; j<3; j++)
		{
			for(int k=0; k<3; k++)
			{
				if(j!=k)
					new_dp[k] = max(new_dp[k],(new_dp[k-1]+c[k]));
			}
		}
		cout<<max({new_dp[o],new_dp[1],new_dp[2]});
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:35: error: 'o' was not declared in this scope
   23 |                 cout<<max({new_dp[o],new_dp[1],new_dp[2]});
      |                                   ^
a.cc:23:26: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   23 |                 cout<<max({new_dp[o],new_dp[1],new_dp[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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

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

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;
}

int N;
long long a[100010][3];
// DPテーブル
long long dp[100010][3];

int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) cin >> a[i][j];
  }

  for (int i = 1; i < N; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; j < 3; ++k) {
        if (j == k) continue;
        chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
      }
    }
  }

  long long ans = 0;
  for (j = 0; j < 3; ++j) chmax(ans, dp[N][j]);
  printf("%lld", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:8: error: 'j' was not declared in this scope; did you mean 'jn'?
   42 |   for (j = 0; j < 3; ++j) chmax(ans, dp[N][j]);
      |        ^
      |        jn
Language: C++

#include <bits/stdc++.h>
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;
}

int N;
long long a[100010][3];
// DPテーブル
long long dp[100010][3];

int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 3; j++) cin >> a[i][j];
  }

  for (int i = 1; i < N; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; j < 3; ++k) {
        if (j == k) continue;
        chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
      }
    }
  }

  long long ans = 0;
  for (j = 0; j < 3; ++j) chmax(res, dp[N][j]);
  printf("%lld", ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:8: error: 'j' was not declared in this scope; did you mean 'jn'?
   42 |   for (j = 0; j < 3; ++j) chmax(res, dp[N][j]);
      |        ^
      |        jn
a.cc:42:33: error: 'res' was not declared in this scope
   42 |   for (j = 0; j < 3; ++j) chmax(res, dp[N][j]);
      |                                 ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
 
int32_t main()
{
    int n;
    cin>>n;
    int a[n+1][3];
    a[0][0]=0;
    a[0][1]=0;
    a[0][2]=0;
    for (int i=1;i<=n;i++)
    cin>>a[i][0]>>a[i][1]>>a[i][2];
    int dp[n+1][3];
    dp[0][0]=0;
    dp[0][1]=0;
    dp[0][2]=0;
    for (int it=1;it<=n;it++)
    {
        for(int i=0;i<=3;i++)
        {
            for(int j=0;j<=3;j++)
            {
                if(i!=j)
                dp[it][i]=std::max(dp[it-1][j]+a[it][i],dp[it][i]);
            }
        }
    }
    cout<<std::max(dp[n][0],dp[n][1],dp[n][2])<<endl;
}

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

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

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

int main(){
  int n; cin >> n ;
   ll a[100010][3];
  ll dp[100010][3];
  rep(i,n)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){
          dp[i+1][j]=max(dp[i+1][j],dp[i][k]+a[i][k]);}}}}
    ll res=0;
    res=max(dp[n][0],max( dp[n][1],dp[n][2]);
            cout << res << endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:45: error: expected ')' before ';' token
   24 |     res=max(dp[n][0],max( dp[n][1],dp[n][2]);
      |            ~                                ^
      |                                             )
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  int n;
  cin>>n;
  int a[n][3] dp[n][3];
  for(int i=0;i<n;i++){
    cin>>a[i][0]>>a[i][1]>>a[i][2];
  }
  dp[0][0]=a[0][0],dp[0][1]=a[0][1],dp[0][2]=a[0][2];
  for(int i=1;i<n;i++){
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
    dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
    dp[i][2]=max(dp[i-1][0],dp[i-1][1])+a[i][2];
  }
  cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: expected initializer before 'dp'
    9 |   int a[n][3] dp[n][3];
      |               ^~
a.cc:11:10: error: 'a' was not declared in this scope
   11 |     cin>>a[i][0]>>a[i][1]>>a[i][2];
      |          ^
a.cc:13:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   13 |   dp[0][0]=a[0][0],dp[0][1]=a[0][1],dp[0][2]=a[0][2];
      |   ^~
      |   dup
a.cc:13:12: error: 'a' was not declared in this scope
   13 |   dp[0][0]=a[0][0],dp[0][1]=a[0][1],dp[0][2]=a[0][2];
      |            ^
a.cc:19:12: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   19 |   cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

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

int main()
{
   int n;
   cin>>n;
   vector<int>dp(3);
   for(int i=0;i<n;i++)
   {
       vector<int>new_dp(3,0);
       vector<int>a(3);
       for(int j=0;j<3;j++)
       cin>>a[i];
   
   for(int j=0;j<3;j++)
   {
       for(int k=0;k<3;k++)
       {
           if(j!=k)
           new_dp[i][j] = max(new_dp[j],dp[k]+a[j]);
       }
       
   }
   dp=new_dp
   }
   cout<<max({dp[0],dp[1],dp[2]});
 
    
    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   21 |            new_dp[i][j] = max(new_dp[j],dp[k]+a[j]);
      |                     ^
a.cc:25:13: error: expected ';' before '}' token
   25 |    dp=new_dp
      |             ^
      |             ;
   26 |    }
      |    ~
Language: C++

#include <bits/stdc++.h>
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; }


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][k], dp[i][j] + a[i][k]);
      }
    }
  }
  
  long long res = 0;
  for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
  cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:66: error: 'a' was not declared in this scope
    9 |   for (int i = 0; i < N; ++i) for (int j = 0; j < 3; j++) cin >> a[i][j];
      |                                                                  ^
a.cc:12:17: error: expected ';' before 'i'
   12 |   for (int i = 0 i < N; ++i) {
      |                 ^~
      |                 ;
a.cc:16:15: error: 'dp' was not declared in this scope; did you mean 'dup'?
   16 |         chmax(dp[i+1][k], dp[i][j] + a[i][k]);
      |               ^~
      |               dup
a.cc:16:38: error: 'a' was not declared in this scope
   16 |         chmax(dp[i+1][k], dp[i][j] + a[i][k]);
      |                                      ^
a.cc:22:42: error: 'dp' was not declared in this scope; did you mean 'dup'?
   22 |   for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
      |                                          ^~
      |                                          dup
Language: C++

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

using namespace std;

int main()
{
	int n;
	cin>>n;
	int a[n],b[n],c[n];
	int dp[n][3];
	//ADD THIS ********
			for(int i = 0;i < n; i++) // ADDED
				for(int j = 0; j < 3; j++) // ADDED
					dp[i][j] = INT_MIN; // ADDED
	//*****************
	for(int i = 0;i < n ;i++)
		cin>>a[i]>>b[i]>>c[i]; // happiness points available on each day 
	// for(int i = 0;i<n;i++)
	// 	cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<'\n';
	for(int i = 0;i < n;i++)
	{
		for(int j = 0;j < 3;j++)
		{
			if(i == 0)		//base case
			{
				if(j == 0)
					dp[i][j] = a[i];
				else if(j == 1)
					dp[i][j] = b[i];
				else 
					dp[i][j] = c[i];
			}
			else
			{
				for(int k = 0;k < 3;k++)		//k means previous activity and j is present activity
				{
					if(j == k) 
						continue;
					else if(j == 0)
						dp[i][j] = max(dp[i][j] , dp[i-1][k] + a[i]);
					else if(j == 1)
						dp[i][j] = max(dp[i][j] , dp[i-1][k] + b[i]);
					else if(j == 2) 
						dp[i][j] = max(dp[i][j] , dp[i-1][k] + c[i]);
				}
			}
		}
	}
	cout<<max(dp[n-1][0] , max(dp[n-1][1] , dp[n-1][2]))<<'\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:52: error: 'INT_MIN' was not declared in this scope
   15 |                                         dp[i][j] = INT_MIN; // ADDED
      |                                                    ^~~~~~~
a.cc:3:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<iostream>
  +++ |+#include <climits>
    3 |
Language: C++

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

using namespace std;

int main()
{
	int n;
	cin>>n;
	int a[n],b[n],c[n];
	int dp[n][3];
	for(ll i = 0;i < n; i++)
		for(ll j = 0; j < 3; j++)
			dp[i][j] = INT_MIN;
	for(int i = 0;i < n ;i++)
		cin>>a[i]>>b[i]>>c[i]; // happiness points available on each day 
	// for(int i = 0;i<n;i++)
	// 	cout<<a[i]<<" "<<b[i]<<" "<<c[i]<<'\n';
	for(int i = 0;i < n;i++)
	{
		for(int j = 0;j < 3;j++)
		{
			if(i == 0)		//base case
			{
				if(j == 0)
					dp[i][j] = a[i];
				else if(j == 1)
					dp[i][j] = b[i];
				else 
					dp[i][j] = c[i];
			}
			else
			{
				for(int k = 0;k < 3;k++)		//k means previous activity and j is present activity
				{
					if(j == k) 
						continue;
					else if(j == 0)
						dp[i][j] = max(dp[i][j] , dp[i-1][k] + a[i]);
					else if(j == 1)
						dp[i][j] = max(dp[i][j] , dp[i-1][k] + b[i]);
					else if(j == 2) 
						dp[i][j] = max(dp[i][j] , dp[i-1][k] + c[i]);
				}
			}
		}
	}
	cout<<max(dp[n-1][0] , max(dp[n-1][1] , dp[n-1][2]))<<'\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'll' was not declared in this scope
   12 |         for(ll i = 0;i < n; i++)
      |             ^~
a.cc:12:22: error: 'i' was not declared in this scope
   12 |         for(ll i = 0;i < n; i++)
      |                      ^
a.cc:13:23: error: expected ';' before 'j'
   13 |                 for(ll j = 0; j < 3; j++)
      |                       ^~
      |                       ;
a.cc:13:31: error: 'j' was not declared in this scope
   13 |                 for(ll j = 0; j < 3; j++)
      |                               ^
a.cc:14:36: error: 'INT_MIN' was not declared in this scope
   14 |                         dp[i][j] = INT_MIN;
      |                                    ^~~~~~~
a.cc:3:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include<iostream>
  +++ |+#include <climits>
    3 |
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  dp[n][3];
  int a,b,c;
  for(int i=0;i<n;i++);
  {
    cin>>a>>b>>c;
    if(i==0)
    { dp[0][0]=a;
      dp[0][1]=b;
      dp[0][2]=c;
    }
    else
    {
      dp[i][0]=a+max(dp[i-1][1],dp[i-1][2]);
      dp[i][1]=b+max(dp[i-1][0],dp[i-1][2]);
      dp[i][2]=c+max(dp[i-1][0],dp[i-1][1]);
    }
    int m=max(dp[n-1][1],dp[n-1][2]);
    m=max(m,dp[n-1][0]);
    cout<<m;
    return 0;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'dp' was not declared in this scope
    7 |   dp[n][3];
      |   ^~
a.cc:12:8: error: 'i' was not declared in this scope
   12 |     if(i==0)
      |        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int vacations(vector<int> a,vector<int> b,vector<int> c)
{
  int N=a.size();
  int dp[N][3];
  int dp0=a[N-1],dp1=b[N-1],dp2=c[N-1];
  for(int i=N-2;i>=0;i--)
  {
    int t0=a[i]+max(dp1,dp2);
    int t1=b[i]+max(dp0,dp2);
    int t2=c[i]+max(dp0,dp1);
    dp0=t0;
    dp1=t1;
    dp2=t2;
  }
  return max(dp0,max(dp1,dp2));
}
int main()
{
  int N;
  cin>>n;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(N);
  for(int i=0;i<N;i++)
    cin>>a[i]>>b[i]>>c[i];
  cout<<vacations(a,b,c);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:8: error: 'n' was not declared in this scope
   22 |   cin>>n;
      |        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int vacations(vector<int> a,vector<int> b,vector<int> c)
{
  int N=a.size();
  int dp[N][3];
  int dp0=a[N-1],dp1=b[N-1],dp2=c[N-1];
  for(int i=N-2;i>=0;i--)
  {
    int t0=a[i]+max(dp1,dp2);
    int t1=b[i]+max(dp0,dp2);
    int t2=c[i]+max(dp0,dp1);
    dp0=t0;
    dp1=t1;
    dp2=t2;
  }
  return max(dp0,max(dp1,dp2));
}
int main()
{
  int N;
  cin>>n;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(N);
  for(int i=0;i<N;i++)
    cin>>a[i]>>b[i]>>c[i];
  cout<<vactaions(a,b,c);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:8: error: 'n' was not declared in this scope
   22 |   cin>>n;
      |        ^
a.cc:28:9: error: 'vactaions' was not declared in this scope; did you mean 'vacations'?
   28 |   cout<<vactaions(a,b,c);
      |         ^~~~~~~~~
      |         vacations
Language: C++

n = gets.to_i
a = []
b = []
c = []
n.times do
  params = gets.split.map(&:to_i)
  a << params[0]
  b << params[1]
  c << params[2]
end

dp = Array.new(n) { Array.new(3, 0) }
dp[0][0] = a[0]
dp[0][1] = b[0]
dp[0][2] = c[0]

1.upto(n - 1) do |i|
  dp[i][0] = [dp[i - 1][1], dp[i - 1][2]].max + a[i]
  dp[i][1] = [dp[i - 1][0], dp[i - 1][2]].max + b[i]
  dp[i][2] = [dp[i - 1][0], dp[i - 1][1]].max + c[i]
end

puts [dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]].max


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

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

using namespace std; 
int main()
{
  ios::sync_with_stdio(false); 
  cin.tie(0); 
  int n; 
  cin>>n; 
  vector <int> a(n); a[0]=0;
  vector <int> b(n); b[0]=0;
  vector <int> c(n); c[0]=0; 
  for (int i=1; i<n; i++){
    int x=a.back(), y=b.back(), z=c.back(); 
    a.push_back(x+max(y,z)); 
    b.push_back(y+max(x,z)); 
    c.push_back(z+max(x,y)); 
  }
  int mx=max(a.back(),b.back(),c.back()); 
  cout<<mx<<"\n"; 
  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:21:13:   required from here
   21 |   int mx=max(a.back(),b.back(),c.back());
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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 <algorithm>
#include <vector> 

using namespace std; 
int main()
{
  ios::sync_with_stdio(false); 
  cin.tie(0); 
  int n; 
  cin>>n; 
  vector <int> a(n); a[0]=0;
  vector <int> b(n); b[0]=0;
  vector <int> c(n); c[0]=0; 
  for (int i=0; i<n-1; i++){
    a[i+1]=a[i]+max(b[i],c[i]); 
    b[i+1]=b[i]+max(a[i],c[i]); 
    c[i+1]=c[i]+max(a[i],b[i]);
  }
  int mx=max(a[n-1],b[n-1],c[n-1]); 
  cout<<mx<<"\n"; 
  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:20:13:   required from here
   20 |   int mx=max(a[n-1],b[n-1],c[n-1]);
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~
/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 <string>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end() 
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout  
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ull MOD = 1e9 + 7;
const int N = (int)(5e5) + 1;


ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, a[N], b[N], c[N], dp[N][3];

int main()
{
	inp();
	cin >> n;
	
	for (int i = 0; i < n; i++)
	{
		scanf("%d", a + i);
		scanf("%d", b + i);
		scanf("%d", c + i);
	}

	memset(dp, -1, sizeof(dp));
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:67:9: error: 'inp' was not declared in this scope; did you mean 'int'?
   67 |         inp();
      |         ^~~
      |         int
Language: C

#include <iostream>
#include <cstdlib>
using namespace std;
 
int n;
long long a[10010];
long long b[10010];
long long c[10010];
long long dp[100010][3];
 
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i];
  
  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];

  for (int i = 1; i < n; ++i) {
    for (int j = 0; j <= 2; ++j) {
      dp[i][j] = 0;
    }
  }

  for (int i = 1; i < n; ++i) {
    for (int j = 0; j <= 2; ++j) {
      if (j == 0) {
        dp[i][j] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
      } else if (j == 1) {
        dp[i][j] = max(dp[i - 1][2], dp[i - 1][0]) + b[i];
      } else if (j == 2) {
        dp[i][j] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];
      }
      cout << dp[i][j] << endl;
    }
  }
  
  cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]) << endl;
  return 0;
}

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

#include<bits/stdc++.h>

using namespace std;

int main(){

  int n;
  cin>>n;
  
  int cost[n][3];
  for(int i=0;i<n;i++){cin>>cost[i][0]>>cost[i][1]>>cost[i][2];}
  
  int dp[n][3];
  dp[0][0] = cost[0][0];
  dp[0][1] = cost[0][1];
  dp[0][2] = cost[0][2];
  
  for(int i=1;i<n;i++){
  	dp[i][0] = cost[i][0] + max(dp[i-1][1],dp[i-1][2]);
    dp[i][1] = cost[i][1] + max(dp[i-1][0],dp[i-1][2]);
    dp[i][2] = cost[i][2] + max(dp[i-1][0],dp[i-1][1]);
  }
  cout<<max(dp[n-1][0],dp[n-1][1],dp[n-1][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:23:12:   required from here
   23 |   cout<<max(dp[n-1][0],dp[n-1][1],dp[n-1][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 <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int abs(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}


int main(){
  int n;
  cin >> n ;
  
  ll a[n];
  ll b[n];
  ll c[n];
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i]>>c[i];
  }
  
  ll dp[n+10];//(n+10)番目までのcostの最大値
  for(int i=0;i <n+10;i++){
    dp[i]=0;
  }
  dp[1] = max(a[0],max(b[0],c[0]));
  dp[0] = 0;
  for(int i=1; i < n; i++){
    if(a[i-2] == dp[i-1]-dp[i-2]){
      dp[i+1] = max(dp[i],max(max(dp[i-1]+b[i-1]+a[i],dp[i-1]+b[i-1]+c[i]),max(dp[i-1]+c[i-1]+a[i],dp[i-1]+c[i-1]+b[i]));
    }
    else if(b[i-2]==dp[i-1]-dp[i-2]){
      dp[i+1] = max(dp[i],max(dp[i-1]+a[i-1]+b[i],dp[i-1]+a[i-1]+c[i]),max(dp[i-1]+c[i-1]+b[i],dp[i-1]+c[i-1]+a[i]));
    }
    else if(c[i-1]==dp[i-1]-dp[i-2]){
      dp[i+1] = max(max(dp[i-1]+b[i-1]+a[i],dp[i-1]+b[i-1]+c[i]),max(dp[i-1]+a[i-1]+c[i],dp[i-1]+a[i-1]+b[i]);
    }
  }
  
  cout <<dp[n] <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:121: error: expected ')' before ';' token
   58 |       dp[i+1] = max(dp[i],max(max(dp[i-1]+b[i-1]+a[i],dp[i-1]+b[i-1]+c[i]),max(dp[i-1]+c[i-1]+a[i],dp[i-1]+c[i-1]+b[i]));
      |                    ~                                                                                                    ^
      |                                                                                                                         )
a.cc:64:110: error: expected ')' before ';' token
   64 |       dp[i+1] = max(max(dp[i-1]+b[i-1]+a[i],dp[i-1]+b[i-1]+c[i]),max(dp[i-1]+a[i-1]+c[i],dp[i-1]+a[i-1]+b[i]);
      |                    ~                                                                                         ^
      |                                                                                                              )
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:61:20:   required from here
   61 |       dp[i+1] = max(dp[i],max(dp[i-1]+a[i-1]+b[i],dp[i-1]+a[i-1]+c[i]),max(dp[i-1]+c[i-1]+b[i],dp[i-1]+c[i-1]+a[i]));
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
a.cc: In function 'int abs(int, int)':
a.cc:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
Language: C++

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

using namespace std;

int main() {

    int n;
    int a, b, c;
    int temp[3];
    int dp[3];
    cin >> n;

    cin >> a >> b >> c;
    dp[0] = a;
    dp[1] = b;
    dp[2] = c;

    for (int i = 1; i < n; i++) {
        cin >> a >> b >> c;

        temp[0] = max(dp[1] + a, dp[2] + a);
        temp[1] = max(dp[0] + b, dp[2] + b);
        temp[2] = max(dp[0] + c, dp[1] + c);


        for (int i = 0; i < 3; i++) {
            dp[i] = temp[i];
        }
    }
  
    cout << *max_element(dp, dp+3) << endl;

    return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:14: error: 'max_element' was not declared in this scope
   33 |     cout << *max_element(dp, dp+3) << endl;
      |              ^~~~~~~~~~~
Language: C

#include <stdio.h>

int chmax(int a,int b,int c){
  //c -> max
  if(b > c){c = b;}
  if(a > c){c = a;}
  return c;
}

int main(){
  int n;
  scanf("%d",&n);
  int a[n],b[n],c[n],dp[n][3];
  for(int i=0; i<n; i++){
    scanf("%d%d%d",&a[i],&b[i],&c[i]);
    for(int j=0; j<3; j++){
      dp[i][j] = 0;
    }
  }
  dp[0][0]=a[0];
  dp[0][1]=b[0];
  dp[0][2]=c[0];
  
  for(int i=1; i<n; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<3; k++){
        if(j != k){
          //ここが違う
          dp[i][j] = dp[i-1][k] + chmax(a[i], b[i], c[i]);
        }
      }
    }
  }
  
  printf("%d",chmax(dp[n-1[0],dp[n-1][1],dp[n-1][2]));
  
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:35:27: error: subscripted value is neither array nor pointer nor vector
   35 |   printf("%d",chmax(dp[n-1[0],dp[n-1][1],dp[n-1][2]));
      |                           ^
main.c:35:52: error: expected ']' before ')' token
   35 |   printf("%d",chmax(dp[n-1[0],dp[n-1][1],dp[n-1][2]));
      |                                                    ^
      |                                                    ]
main.c:35:23: error: passing argument 1 of 'chmax' makes integer from pointer without a cast [-Wint-conversion]
   35 |   printf("%d",chmax(dp[n-1[0],dp[n-1][1],dp[n-1][2]));
      |                     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       int *
main.c:3:15: note: expected 'int' but argument is of type 'int *'
    3 | int chmax(int a,int b,int c){
      |           ~~~~^
main.c:35:15: error: too few arguments to function 'chmax'
   35 |   printf("%d",chmax(dp[n-1[0],dp[n-1][1],dp[n-1][2]));
      |               ^~~~~
main.c:3:5: note: declared here
    3 | int chmax(int a,int b,int c){
      |     ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  p=n;
  vector<vector<int>>v(n,vector<int>(n));
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<3;j++)
      cin>>v[i][j];
  }
  vector<vector<int>>dp(n,vector<int>(n,0));
  dp[0][0]=v[0][0];
  dp[0][1]=v[0][1];
  dp[0][2]=v[0][2];
  for(int i=1;i<n;i++)
  {
    dp[i][0]=max(v[i][0]+v[i-1][1],v[i][0]+v[i-1][2]);
    dp[i][1]=max(v[i][1]+v[i-1][0],v[i][1]+v[i-1][2]);
    dp[i][2]=max(v[i][2]+v[i-1][0],v[i][2]+v[i-1][1]);
  }
  cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'p' was not declared in this scope
    7 |   p=n;
      |   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  vector<vector<int>> data(N,vector<int>(3));
  vector<vector<int>> summer(N,vector<int>(3));
  cin >> N;
  for (int i=0; i<N; ++i) {
    for (int j=0; j<3; ++j) {
      cin >> data.at(i).at(j);
    }
  }
  int summer.at(0).at(0) = data.at(0).at(0);
  int summer.at(0).at(1) = data.at(0).at(1);
  int summer.at(0).at(2) = data.at(0).at(2);
  for (int j=1; j<N; ++j) {
    int a,b,c,d,e,f;
    a = summer.at(j-1).at(0);
    b = summer.at(j-1).at(1);
    c = summer.at(j-1).at(2);
    d = data.at(j).at(0);
    e = data.at(j).at(1);
    f = data.at(j).at(2);
    summer.at(j).at(0) = max(d+b,d+c);
    summer.at(j).at(1) = max(e+a,e+c);
    summer.at(j).at(2) = max(f+a,f+b);
  }
  int A,B,C;
  A = summer.at(N-1).at(0);
  B = summer.at(N-1).at(1);
  C = summer.at(N-1).at(2);
  int D = max(A,max(B,C));
  cout << D << endl;
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected initializer before '.' token
   14 |   int summer.at(0).at(0) = data.at(0).at(0);
      |             ^
a.cc:15:13: error: expected initializer before '.' token
   15 |   int summer.at(0).at(1) = data.at(0).at(1);
      |             ^
a.cc:16:13: error: expected initializer before '.' token
   16 |   int summer.at(0).at(2) = data.at(0).at(2);
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  vector<vector<int>> data(N,vector<int>(3));
  vector<vector<int>> summer(N,vector<int>(3));
  cin >> N;
  for (int i=0; i<N; ++i) {
    for (int j=0; j<3; ++j) {
      cin >> data.at(i).at(j);
    }
  }
  int summer.at(0).at(0) = data.at(0).at(0);
  int summer.at(0).at(1) = data.at(0).at(1);
  int summer.at(0).at(2) = data.at(0).at(2);
  for (int j=0; j<N; ++j) {
    int a,b,c,d,e,f;
    a = summer.at(j-1).at(0);
    b = summer.at(j-1).at(1);
    c = summer.at(j-1).at(2);
    d = data.at(j).at(0);
    e = data.at(j).at(1);
    f = data.at(j).at(2);
    summer.at(j).at(0) = max(d+b,d+c);
    summer.at(j).at(1) = max(e+a,e+c);
    summer.at(j).at(2) = max(f+a,f+b);
  }
  int A,B,C;
  A = summer.at(N-1).at(0);
  B = summer.at(N-1).at(1);
  C = summer.at(N-1).at(2);
  int D = max(A,max(B,C));
  cout << D << endl;
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected initializer before '.' token
   14 |   int summer.at(0).at(0) = data.at(0).at(0);
      |             ^
a.cc:15:13: error: expected initializer before '.' token
   15 |   int summer.at(0).at(1) = data.at(0).at(1);
      |             ^
a.cc:16:13: error: expected initializer before '.' token
   16 |   int summer.at(0).at(2) = data.at(0).at(2);
      |             ^
Language: C++

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

#define rep(i, n) for(int i = o; i<n; i++);
#define SORT(a) sort((a).begin(), (a).end());
#define che(a, string) cout << string << ":" << (a) << " ";
#define ch(a, string) cout << string << ":" << (a) << " ";
#define INF 2000000000;

using namespace std;

typedef pair<int, int> p;

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; };

int main () {
    long long a[100010][3];
    long long dp[100010][3];

    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) {
                    //long long num = dp[i][j] + a[i][k];
                    chmax(dp[i+1][k], dp[i][j] + a[i][k]);
                }
            }
        }
    }

    long long ans = 0;

    for(int j = 0; j < 3; j++) {
        chmax(ans, dp[n][j]);
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:48: error: cannot bind non-const lvalue reference of type 'long long int&' to an rvalue of type 'long long int'
   39 |                     chmax(dp[i+1][k], dp[i][j] + a[i][k]);
      |                                       ~~~~~~~~~^~~~~~~~~
a.cc:19:46: note:   initializing argument 2 of 'bool chmax(T&, T&) [with T = long long int]'
   19 | template<class T> inline bool chmax(T& a, T& b) {if (a < b) { a = b; return true;} return false; };
      |                                           ~~~^
Language: C++

#include <iostream>
//#include <bits/stdc++.h>
#include <cstdlib>  // abs() for integer 絶対値求めやつ
#include <cmath>    // abs() for float, and fabs()
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)
#define SORT(a) sort((a).begin(),(a).end());
#define che(a,string) cout<<string<<":"<<(a)<<endl;
#define ch(a,string) cout<<string<<":"<<(a)<<" ";
using namespace std;
typedef pair<int,int> p;
#define INF 2000000000
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; }
	int main(){
long long a[100010][3];  //ai,bi,ciをそれぞれ、a[i][0],a[i][1],a[i][2]に格納
	long long	dp[100010][3];//一個前にaを選んだ時のi番目の幸福度の最大値をdp[i][0] 
	int n;cin>>n;
		for(int i = 0; i < n ; ++i){
			for(int j = 0 ; j<3 ;++){
				cin>>a[i][j];
			}
		}
		for(int i = 0 ; i<n ; ++i){
			for(int j=0; j<3 ; ++){	
				for (int k =0; k<3; ++k){
					if(j!=k){
						chmax(dp[i+1][k], dp[i][j]+ a[i][k]);
					}
				}
			}
		}
		long long ans = 0 ;
		for(int j = 0; j < 3; ++j){
			chmax(ans, dp[n][j]);
		}
		cout<<ans<<endl;
	}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:48: error: expected primary-expression before ')' token
   22 |                         for(int j = 0 ; j<3 ;++){
      |                                                ^
a.cc:27:46: error: expected primary-expression before ')' token
   27 |                         for(int j=0; j<3 ; ++){
      |                                              ^
Language: C++

#include<cstdio>

using namespace std;

int a[200000],b[200000],c[200000];
int dp[200000][3];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:19: error: 'max' was not declared in this scope
   14 |     dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
      |                   ^~~
a.cc:18:28: error: 'max' was not declared in this scope
   18 |   printf("%d",max(dp[n][0],max(dp[n][1],dp[n][2])));
      |                            ^~~
a.cc:18:15: error: 'max' was not declared in this scope
   18 |   printf("%d",max(dp[n][0],max(dp[n][1],dp[n][2])));
      |               ^~~
Language: C++

#include <bits/stdc++.h>

int main(){
    int n, v;
    std::vector<int> dp(3, 0), tmp_dp(3, 0);
    for(int i=0; i<3; ++i) {
        scanf("%d", &x);
        for(int j=0; j<3; ++j){
             if(i!=j){
                tmp_dp[i] = std::max(tmp_dp[i], dp[j] + v);
             }
         }
     }
    printf("%d\n", std::max({dp[0], dp[1], dp[2]}));
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:22: error: 'x' was not declared in this scope
    7 |         scanf("%d", &x);
      |                      ^
Language: Java

import java.util.*;

class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int dp[][] = new int[n+1][3];
        int a[] = new int[n];
        int b[] = new int[n];
        int c[] = new int[n];
        for (int i=0; i<n; i++) a[i] = sc.nextInt(), b[i] = sc.nextInt(), c[i] = sc.nextInt();
        dp[0][0] = dp[0][1] = dp[0][2] = 0;
        for (int i=1; i<=n; i++) {
        	dp[i][0] = Math.max(Math.max(dp[i-1][0] , dp[i-1][1] + a[i-1]), dp[i-1][2] + a[i-1]) ;
            dp[i][1] = Math.max(Math.max(dp[i-1][1],dp[i-1][0]+b[i-1]), dp[i-1][2] + b[i-1]);
            dp[i][2] = Math.max(Math.max(dp[i-1][2],dp[i-1][1]+c[i-1]), dp[i-1][0]+c[i-1]);
        }
        int ans = Math.max(dp[n][0], Math.max(dp[n][1], dp[n][2]));
        System.out.println(ans);
    }
}


Compiler output:
Main.java:11: error: ';' expected
        for (int i=0; i<n; i++) a[i] = sc.nextInt(), b[i] = sc.nextInt(), c[i] = sc.nextInt();
                                                   ^
Main.java:11: error: ';' expected
        for (int i=0; i<n; i++) a[i] = sc.nextInt(), b[i] = sc.nextInt(), c[i] = sc.nextInt();
                                                                        ^
2 errors
Language: Java

import java.util.*;

class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int dp[][] = new int[n+1][3];
        int a[] = new int[n];
        int b[] = new int[n];
        int c[] = new int[n];
        for (int i=0; i<n; i++) a[i] = sc.nextInt();
        for (int i=0; i<n; i++) b[i] = sc.nextInt();
        for (int i=0; i<n; i++) c[i] = sc.nextInt();
        dp[0][0] = dp[0][1] = dp[0][2] = 0;
        for (int i=1; i<=n; i++) {
        	dp[i][0] = Math.max(Math.max(dp[i-1][0], dp[i-1][1]), dp[i-1][2])) + Math.max(b[i-1], c[i-1]);
            dp[i][1] = Math.max(Math.max(dp[i-1][1],dp[i-1][0]), dp[i-1][2])) + Math.max(a[i-1], c[i-1]);
            dp[i][2] = Math.max(Math.max(dp[i-1][2],dp[i-1][1]), dp[i-1][0])) + Math.max(b[i-1], a[i-1]);
        }
        int ans = Math.max(dp[n][0], Math.max(dp[n][1], dp[n][2]));
        System.out.println(ans);
    }
}


Compiler output:
Main.java:16: error: ';' expected
        	dp[i][0] = Math.max(Math.max(dp[i-1][0], dp[i-1][1]), dp[i-1][2])) + Math.max(b[i-1], c[i-1]);
        	                                                                 ^
Main.java:17: error: ';' expected
            dp[i][1] = Math.max(Math.max(dp[i-1][1],dp[i-1][0]), dp[i-1][2])) + Math.max(a[i-1], c[i-1]);
                                                                            ^
Main.java:18: error: ';' expected
            dp[i][2] = Math.max(Math.max(dp[i-1][2],dp[i-1][1]), dp[i-1][0])) + Math.max(b[i-1], a[i-1]);
                                                                            ^
3 errors