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

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

int abs(int a, int b) {
  if (a >= b) return a - b;
  else return b - a;
}

int main() {
  int n;
  cin >> n;
  int a0, b0, c0;
  cin >> a0 >> b0 >> c0;
  rep(i,n-1) {
    int a1, b1, c1, a2=a0, b2=b0, c2=c0;
    cin >> a1 >> b1 >> c1;
    a0 = max(b2, c2) + a1;
    b0 = max(a2, c2) + b1;
    c0 = max(a2, b2) + c1;
  }
  cout << max(a0, b0, c0);
}


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:24:14:   required from here
   24 |   cout << max(a0, b0, c0);
      |           ~~~^~~~~~~~~~~~
/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 main()
{
       int n;
        cin >> n;
        vector<vector<int>> points(n, vector<int>(3));
        for (int i = 0; i < n; i++)
            cin >> points[i][0] >> points[i][1] >> points[i][2];
        vector<vector<int>> dp(n, vector<int>(3));
        int _max = -1e9;
        for (int i = 0; i < 3; i++)
        {
            dp[0][i] = points[0][i];
            _max = max(dp[0][i], _max);
        }
        for (int i = 1; i < n; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                int sum = INT_MIN;
                for (int k = 0; k < 3; k++)
                {
                    if (j == k)
                        continue;
                    dp[i][j] = max(points[i][j] + dp[i - 1][k], dp[i][j]);
                }
                _max = max(dp[i][j], _max);
            }
        }
        cout << _max << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:27: error: 'INT_MIN' was not declared in this scope
   24 |                 int sum = INT_MIN;
      |                           ^~~~~~~
a.cc:4:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main()
{
       int n;
        cin >> n;
        vector<vector<int>> points(n, vector<int>(3));
        for (int i = 0; i < n; i++)
            cin >> points[i][0] >> points[i][1] >> points[i][2];
        vector<vector<int>> dp(n, vector<int>(3));
        int _max = INT_MIN;
        for (int i = 0; i < 3; i++)
        {
            dp[0][i] = points[0][i];
            _max = max(dp[0][i], _max);
        }
        for (int i = 1; i < n; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                int sum = INT_MIN;
                for (int k = 0; k < 3; k++)
                {
                    if (j == k)
                        continue;
                    dp[i][j] = max(points[i][j] + dp[i - 1][k], dp[i][j]);
                }
                _max = max(dp[i][j], _max);
            }
        }
        cout << _max << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: 'INT_MIN' was not declared in this scope
   14 |         int _max = 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 |
Language: Java

import java.util.*;
import java.io.*;
public class MyClass
{
    public static int solve(int[][] arr, int n, int prev, int[][] dp){
        if(n < 0){
            return 0;
        }
        if(dp[n][prev+1] > 0){
            return dp[n][prev+1];
        }
        int ans = Integer.MIN_VALUE;
        if(prev != 0){
            ans = Math.max(ans, arr[n][0] + solve(arr, n-1, 0, dp));
        }
        if(prev != 1){
            ans = Math.max(ans, arr[n][1] + solve(arr, n-1, 1, dp));
        }
        if(prev != 2){
            ans = Math.max(ans, arr[n][2] + solve(arr, n-1, 2, dp));
        }
        return dp[n][prev+1] = ans;
    }
	public static void main(String[] args) throws Exception{
        StringTokenizer str;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[][] arr = new int[n][3];
        for(int i = 0; i < arr.length; i++){
            int j = 0;
            str = new StringTokenizer(br.readLine()," ");
            while(str.hasMoreTokens()){
                arr[i][j] = Integer.parseInt(str.nextToken());
                j++;
            }
        }
        int[][] dp = new int[n+1][4];
       System.out.println(solve(arr, n-1, -1, dp));            
    }
}


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

import java.util.*;
import java.io.*;
public class MyClass
{
    public static int solve(int[][] arr, int n, int prev, int[][] dp){
        if(n < 0){
            return 0;
        }
        if(dp[n][prev+1] > 0){
            return dp[n][prev+1];
        }
        int ans = Integer.MIN_VALUE;
        if(prev != 0){
            ans = Math.max(ans, arr[n][0] + solve(arr, n-1, 0, dp));
        }
        if(prev != 1){
            ans = Math.max(ans, arr[n][1] + solve(arr, n-1, 1, dp));
        }
        if(prev != 2){
            ans = Math.max(ans, arr[n][2] + solve(arr, n-1, 2, dp));
        }
        return dp[n][prev+1] = ans;
    }
	public static void main(String[] args) throws Exception{
        StringTokenizer str;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[][] arr = new int[n][3];
        for(int i = 0; i < arr.length; i++){
            int j = 0;
            str = new StringTokenizer(br.readLine()," ");
            while(str.hasMoreTokens()){
                arr[i][j] = Integer.parseInt(str.nextToken());
                j++;
            }
        }
        int[][] dp = new int[n+1][4];
       System.out.println(solve(arr, n-1, -1, dp));            
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.*;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class MyClass
      | ^~~~~~
Language: C++

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

template<class T> inline bool chmin(T &a, T b) {
    if (b < a) {
        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 play[100010][3]; // play[i][j] = i日目の遊びjで得られる幸福度

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 >> play[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] + play[i][k]);
            }
        }
    }

    long long res = 0;
    for (int j = 0; j < 3; j++) {
        chmax(res, dp[N][j]);
    }
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc:25:1: error: expected initializer before 'int'
   25 | int main() {
      | ^~~
Language: Java

package javaapplication9;
import java.util.*;
import java.io.*;
public class Main {
// 
// public static int frog(int arr[], int i, int prev){
//     if(i >= arr.length)
//           return 0;
//     if(i == arr.length-1)
//         return Math.abs(arr[prev]- arr[i]);
//     int a = 0; int b = 0;
//     if(prev == -1){
//        return Math.min(0+frog(arr,i+1,0),0+frog(arr,i+2,0));
//     }
//    
//     else{
//            // System.out.println(arr[prev]+ " - " + arr[i] );
//             a =   Math.abs(arr[prev] - arr[i]) + frog(arr,i+1,i);
//             b =   Math.abs(arr[prev] - arr[i]) + frog(arr,i+2,i);
//     
//     }
//  
// return Math.min(a,b);
//  
// }
 
 public static long vecation(int n, int prev, List<ArrayList<Integer>> l,long[][] dp){
 
     if(n == -1)
         return 0;
   if( dp[prev+1][n+1] > -1){
   return dp[prev+1][n+1];
   }
     long ans = 0;
     if(prev != 0){
        // System.out.println("used");
       ans = Math.max(ans,l.get(n).get(0) + vecation(n-1,0,l,dp));
     }
     
     if(prev != 1){
       ans = Math.max(ans,l.get(n).get(1) + vecation(n-1,1,l,dp));
     }
     
     if(prev != 2){
       ans = Math.max(ans,l.get(n).get(2) + vecation(n-1,2,l,dp));
     }
     
     return dp[prev+1][n+1] =  ans;
     
     
     
 }
 
 
    public static void main(String[] args) throws Exception {
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   
//        int n = Integer.parseInt(br.readLine());
//        int[] arr = new int[n+1];
//        StringTokenizer str  = new StringTokenizer(br.readLine()," ");
//        int i = 0;
//        while(str.hasMoreTokens()){
//            arr[i] = Integer.parseInt(str.nextToken());
//            i++;
//        }
//        
//           int[] dp = new int[arr.length];
//           Arrays.fill(dp,-1);
//           
        
        
        int n = Integer.parseInt(br.readLine());
      long[][] dp = new int[n+10][n+10];
      for(int i = 0; i < dp.length; i++){
        Arrays.fill(dp[i],-1);
      
      }
        List<ArrayList<Integer>>  l = new ArrayList<>();
       
        for(int i = 0; i< n; i++){
            String str[] = br.readLine().split(" ");
            List<Integer> ll = new ArrayList<>();
            for(String k : str){
                
                ll.add(Integer.parseInt(k));
                
            }
            l.add(new ArrayList<>(ll));
            ll.clear();
        }
       // System.out.println(l);
            System.out.println(vecation(n-1,-1,l,dp));
        
     //   System.out.println(Arrays.toString(dp));
    }
    
}


Compiler output:
Main.java:72: error: incompatible types: int[][] cannot be converted to long[][]
      long[][] dp = new int[n+10][n+10];
                    ^
1 error
Language: C++

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

int main(){
  int n;
  cin>>n;
  vector<vector<int>>dp(n,vector<int>(3));
  vector<int>a(3);
  cin>>a[0]>>a[1]>>a[2];
  dp[0][0]=a[0];
  dp[0][1]=a[1];
  dp[0][2]=a[2];
  for(int i=0;i<n;i++){
    cin>>a[0]>>a[1]>>a[2];
    for(int j=0;j<3;j++){
      dp[i][j]=max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+a[j];
    }
  }
  int ans = max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
  cout<<ans<<endl;
      

Compiler output:
a.cc: In function 'int main()':
a.cc:20:19: error: expected '}' at end of input
   20 |   cout<<ans<<endl;
      |                   ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

	scanf("%d%d%d",&a, &b, &c);
	if(a > b && a > c){
		flag = 'a';
		ans = a;
	}
	else if(b > c && b > a) {
		flag = 'b';
		ans = b;
	}
	else {
		flag = 'c';
		ans = c;
	}
	for(int i = 1; i < n; i++) {
		scanf("%d %d %d",&a,&b,&c);
		if(flag == 'a') {
			if (b > c) {
				ans += b;
				flag = 'b';
			}else{
				ans += c;
				flag = 'c';
			}
		}
	    else if(flag == 'b') {
			if (a > c) {
				ans += a;
				flag = 'a';
			}else{
				ans += c;
				flag = 'c';
			}
		}
		else{
			if (b > a) {
				ans += b;
				flag = 'b';
			}else{
				ans += a;
				flag = 'a';
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc:1:14: error: expected constructor, destructor, or type conversion before '(' token
    1 |         scanf("%d%d%d",&a, &b, &c);
      |              ^
a.cc:2:9: error: expected unqualified-id before 'if'
    2 |         if(a > b && a > c){
      |         ^~
a.cc:6:9: error: expected unqualified-id before 'else'
    6 |         else if(b > c && b > a) {
      |         ^~~~
a.cc:10:9: error: expected unqualified-id before 'else'
   10 |         else {
      |         ^~~~
a.cc:14:9: error: expected unqualified-id before 'for'
   14 |         for(int i = 1; i < n; i++) {
      |         ^~~
a.cc:14:24: error: 'i' does not name a type
   14 |         for(int i = 1; i < n; i++) {
      |                        ^
a.cc:14:31: error: 'i' does not name a type
   14 |         for(int i = 1; i < n; i++) {
      |                               ^
a.cc:44:15: error: expected constructor, destructor, or type conversion before '(' token
   44 |         printf("%d\n",ans);
      |               ^
a.cc:45:9: error: expected unqualified-id before 'return'
   45 |         return 0;
      |         ^~~~~~
a.cc:46:1: error: expected declaration before '}' token
   46 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <array>

using namespace std;

int main() {
    int N;
    cin>>N;
    vector<int> dp(3);
    for (int i=0; i<N; i++) {
        vector<int> ne(3, 0);
        vector<int> a(3);
        for (int z=0; z<3; z++) {
            cin >> a[z];
        }
        for (int p=0; p<3; p++) {
            for (int j=0; j<3; j++) {
                if (p != j) {
                    ne[j] = max(ne[j], a[j] + dp[i]);
                }
            }
        }
        dp = ne;
    }
    
    cout << max({dp[0], dp[1], dp[2]}) << "\n";
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   27 |     cout << max({dp[0], dp[1], dp[2]}) << "\n";
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~
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;
int main(){
  int n;
  scanf("%d",&n);
  vector<int> dp(3);
  for(int day=0;day<n;++i){
    vector<int> new_dp(3,0);
    vector<int> c(3);
    for(int i=0;i<3;++){
    	scanf("%d",&c[i]);
    }
    for(int i=0;i<3;++i){
      for(int j=0;j<3;++j){
        if(i!=j){
          new_dp[i] = max(new_dp[i],dp[i]+c[j]);
        }
      }
    }
    dp = new_dp;
  }
  printf("%d\n",max({dp[0],dp[1],dp[2]}));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:25: error: 'i' was not declared in this scope
    7 |   for(int day=0;day<n;++i){
      |                         ^
a.cc:10:23: error: expected primary-expression before ')' token
   10 |     for(int i=0;i<3;++){
      |                       ^
Language: C++

// CPP program to illustrate 
// Implementation of push() function 
#include <iostream> 
#include <stack> 
using namespace std; 

int main() 
{ int n,mx=0,my=0,mz=0;
cin>>n;
 if(n==1)
 {
 cin>>a>>b>>c;
   int M= max(a,b);
   cout<<max(M,c);
   return 0;
 }
n--;
int a,b,c;
cin>>a>>b>>c;
int tempa=a,tempb=b,tempc=c;
while(n--){
cin>>a>>b>>c;
mx=a+max(tempb,tempc);
my=b+max(tempa,tempc);
mz=c+max(tempa,tempb);
tempa=mx;
tempb=my;
tempc=mz;
	} 
int m= max(mx,my);
cout<<max(m,mz);
    
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'a' was not declared in this scope
   12 |  cin>>a>>b>>c;
      |       ^
a.cc:12:10: error: 'b' was not declared in this scope
   12 |  cin>>a>>b>>c;
      |          ^
a.cc:12:13: error: 'c' was not declared in this scope
   12 |  cin>>a>>b>>c;
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int arr[100005][3];
int dp[100005][3];
int main(){
	int n;
	cin>>n;
	memset(dp,0,sizeof(dp));
	for(int i =0;i<n;i++){
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
		
	}
	dp[0][0]=arr[0][0];
	dp[0][1]=arr[0][1];
	dp[0][2]=arr[0][2];
	for(int i=1;i<n;i++){
		dp[i][0]=max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=max(dp[i-1][0],dp[i-1][2]);
		dp[i][2]=max(dp[i-1][1],dp[i-1][0]);
	}
	cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
	getch();
return 0;
}

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

import java.util.*;
public class MyClass {
    int arr[][];
    int n;
    private void enter()
    {
        //System.out.print("Enter the size: ");
        Scanner sc=new Scanner(System.in);
        arr=new int[n=sc.nextInt()][3];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<3;j++)
                arr[i][j]=sc.nextInt();
        }
    }
    private void solve()
    {
        enter();
        for(int i=n-2;i>=0;i--)
        {
            arr[i][0]+=arr[i+1][1]>arr[i+1][2]?arr[i+1][1]:arr[i+1][2];
            arr[i][1]+=arr[i+1][0]>arr[i+1][2]?arr[i+1][0]:arr[i+1][2];
            arr[i][2]+=arr[i+1][1]>arr[i+1][0]?arr[i+1][1]:arr[i+1][0];
        }
    }
    private void finans()
    {
        solve();
        System.out.println(arr[0][0]>arr[0][1]?arr[0][0]>arr[0][2]?arr[0][0]:arr[0][2]:arr[0][1]>arr[0][2]?arr[0][1]:arr[0][2]);
    }
    public static void main(String args[]) {
      MyClass ob=new MyClass();
      ob.finans();
    }
}

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

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define out(ans) cout << ans << endl
#define in(n) cin >> n
#define floop(i, N) for (ll i = 0; i < N; i++)
#define floop1(i, N) for (ll i = 1; i <= N; i++)
#define floopi(i, j, N) for (ll j = i + 1; j < N; j++)

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

constexpr ll inf = 1e18;

void solve();

int main()
{
    solve();
}

void solve()
{
    ll n;
    in(n);
    ll a[n][3];
    floop(i, n)
    {
        floop(j, 3)
        {
            in(a[i][j]);
        }
    }
    ll dp[3][n + 1];
    floop(i, n + 1)
    {
        floop(j, 3)
        {
            dp[i][j] = 0;
        }
    }
    floop(i, n)
    {
        floop(j, 3)
        {
            floop(k, 3)
            {
                if (j == k)
                {
                    continue;
                }
                chmax(dp[i + 1][j], dp[i][k] + a[i][j]);
            }
        }
    }
    ll ans = max(dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]);
    out(ans);
}

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:76:17:   required from here
   76 |     ll ans = 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>

using namespace std;
typedef long long ll;

#define out(ans) cout << ans << endl
#define in(n) cin >> n
#define floop(i, N) for (ll i = 0; i < N; i++)
#define floop1(i, N) for (ll i = 1; i <= N; i++)
#define floopi(i, j, N) for (ll j = i + 1; j < N; j++)

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

constexpr ll inf = 1e18;

void solve();

int main()
{
    solve();
}

void solve()
{
    ll n;
    in(n);
    ll a[n], b[n], c[n];
    floop(i, n)
    {
        in(a[i]);
        in(b[i]);
        in(c[i]);
    }
    ll dp[3][n + 1];
    floop(i, 3)
    {
        floop(j, n + 1)
        {
            dp[i][j] = 0;
        }
    }
    floop(i, n)
    {
        chmax(dp[0][i + 1], dp[1][i] + a[i]);
        chmax(dp[0][i + 1], dp[2][i] + a[i]);
        chmax(dp[1][i + 1], dp[0][i] + b[i]);
        chmax(dp[1][i + 1], dp[2][i] + b[i]);
        chmax(dp[2][i + 1], dp[0][i] + c[i]);
        chmax(dp[2][i + 1], dp[1][i] + c[i]);
    }
    ll ans = max(dp[0][n - 1], dp[1][n - 1], dp[2][n - 1]);
    out(ans);
}

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:70:17:   required from here
   70 |     ll ans = max(dp[0][n - 1], dp[1][n - 1], dp[2][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<bits/stdc++.h> 
using namespace std; 

int main(){
  
  int n; 
  int a[n][3];
  
  for(int i = 0; i<n; i++)
    for(int j =0; j<3; j++)
      cin>>a[i][j];
  
  int dp[n+1][3];
  
  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++){
    for(int j = 0; j<3; j++){
      if(j == 0)
        dp[i][j] = a[i][j] + max(dp[i-1][1], dp[i-1][2])
      if(j == 1)
        dp[i][j] = a[i][j] + max(dp[i-1][0], dp[i-1][2])
      if(j == 2)
        dp[i][j] = a[i][j] + max(dp[i-1][0], dp[i-1][1])
    }
  }
  int ans = max(dp[n-1][0], max(dp[n-1][1],dp[n-1][2]));
  cout<<ans<<endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:57: error: expected ';' before 'if'
   22 |         dp[i][j] = a[i][j] + max(dp[i-1][1], dp[i-1][2])
      |                                                         ^
      |                                                         ;
   23 |       if(j == 1)
      |       ~~
Language: C++

#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// ****************************************CODE***************************************//


ll n;
ll a[110000],b[110000],c[110000];
ll dp[110000][3];

int main() {
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i] >> c[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][k] = min(dp[i][k], dp[i][j] + a[k]);
                dp[i][k] = min(dp[i][k], dp[i][j] + b[k]);
                dp[i][k] = min(dp[i][k], dp[i][j] + c[k]);
            }
        }
    }

    ll res;
    for(int i = 0; i < 3; i++){
        res = max(res, dp[n-1][i])
    }
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:35: error: expected ';' before '}' token
   61 |         res = max(res, dp[n-1][i])
      |                                   ^
      |                                   ;
   62 |     }
      |     ~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, a, b, c;
    cin >> n;
    vector<int> a_i, b_i, c_i;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b >> c;
        a_i.push_back(a);
        b_i.push_back(b);
        c_i.push_back(c);
    }
    a = 0, b = 0, c = 0 ;
    for (int i = 0; i < n; ++i) {
        int next_a = a_i[i] + max(b, c);
        int next_b = b_i[i] + max(a, c);
        int next_c = c_i[i] + max(a, b);
        a = next_a;
        b = next_b;
        c = next_c;
    }
    cout << max({a, b, c}) << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:16: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   25 |     cout << max({a, b, c}) << "\n";
      |             ~~~^~~~~~~~~~~
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 <iostream>
#include <vector>

using namespace std;

int main() {
    int n, a, b, c;
    cin >> n;
    vector<int> a_i, b_i, c_i;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b >> c;
        a_i.push_back(a);
        b_i.push_back(b);
        c_i.push_back(c);
    }
    a = 0, b = 0, c = 0 ;
    for (int i = 0; i < n; ++i) {
        int next_a = a_i[i] + max(b, c);
        int next_b = b_i[i] + max(a, c);
        int next_c = c_i[i] + max(a, b);
        a = next_a;
        b = next_b;
        c = next_c;
    }
    cout << max({a, b, c}) << "\n";
    return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #Include; did you mean #include?
    1 | #Include <iostream>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> n;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <vector>
  +++ |+#include <iostream>
    3 | 
a.cc:25:5: error: 'cout' was not declared in this scope
   25 |     cout << max({a, b, c}) << "\n";
      |     ^~~~
a.cc:25:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:16: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   25 |     cout << max({a, b, c}) << "\n";
      |             ~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:2:
/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 <stdio.h>

#define MAX_N 100000
#define MAX_H 10000
#define MAX_K 3

int N;
typedef struct {
    int a;
    int b;
    int c;
} happiness;
int H[MAX_N][MAX_K+1];
int tmp[MAX_N+1][MAX_K+1];

int max(int a,int b){
    if(a<b){
        return b;
    }else{
        return a;
    }
}

void print_table(int *table,int height,int width, int max_width){
    for(int h=0;h<height;h++){
        printf("| ");
        for(int w=0;w<width;w++){
            printf("%d ",*(table + w + width * h));
        }
        printf("|\n");
    }
}

int ans(){
    if(N==1){
        return max(H[0][0],max(H[0][1],H[0][2]));
    }
    for(int i=2;i<=N;i++){
        int *x_2 = H[i-2];
        int *x_1 = H[i-1];

        for(int j=0;j<MAX_K;j++){
            int m=0;
            for(int k=0;k<MAX_K;k++){
                if(k!=j){
                    for(int l=0;l<MAX_K;l++){
                        if(k!=l){
                            m = max(m,tmp[i-2][l]+x_2[k]);
                        }
                    }
                    tmp[i-1][k] = m;
                }
                
            }
            m=0;
            for(int k=0;k<MAX_K;k++){
                if(k!=j){
                    m=max(m,tmp[i-1][k] + x_1[j]);
                }
            }
            tmp[i][j]=m;
        }
    }
    return max(max(tmp[N][0],tmp[N][1]),tmp[N][2]);
}

int main(){
    scanf("%d",&N);

    for(int i=0;i<N;i++){
        scanf("%d %d %d",&H[i][0],&H[i][1],&H[i][2]);
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<MAX_K+1;j++){
            tmp[i][j] = 0;
        }
    }
    printf("%d\n",ans());
    print_table(tmp,N+1,MAX_K,MAX_K+1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:17: error: cannot convert 'int (*)[4]' to 'int*'
   79 |     print_table(tmp,N+1,MAX_K,MAX_K+1);
      |                 ^~~
      |                 |
      |                 int (*)[4]
a.cc:24:23: note:   initializing argument 1 of 'void print_table(int*, int, int, int)'
   24 | void print_table(int *table,int height,int width, int max_width){
      |                  ~~~~~^~~~~
Language: C++

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

int dp[10001][3];

int main() {
  int n; cin >> n;
  int a[n][3];
  REP(i,n) REP(j,3) cin >> a[i][j];

  REP(i,n) {
    REP(j, 3) {
      REP(k, 3) {
        if (j==k) continue;
        dp[i+1][j] = max(dp[i+1][j], dp[i][k] + a[i][j]);
      }
    }
  }
  ll ans = 0;
  REP(i,3) ans = max(ans, dp[n][i]);
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:21: error: no matching function for call to 'max(ll&, int&)'
   22 |   REP(i,3) ans = max(ans, dp[n][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: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:   template argument deduction/substitution failed:
a.cc:22:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   22 |   REP(i,3) ans = max(ans, dp[n][i]);
      |                  ~~~^~~~~~~~~~~~~~~
/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, 2 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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:22:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |   REP(i,3) ans = max(ans, dp[n][i]);
      |                  ~~~^~~~~~~~~~~~~~~
Language: C

#include <bits/stdc++.h>
using namespunoe std;
typedef long long llong;
typedef long long int lint;
typedef long double ld;
const int oo = 1e9;

int n;
const int entrada = 1e5+5;
int uno[entrada][3];
int dos[3][entrada];
int go(int a, int i)
{
	if(i==n) return 0;
	if(dos[a][i] != -1) return dos[a][i];
	int& ans = dos[a][i];
	if(a==0)
	{
		ans=max(ans, go(1, i+1)+uno[i][0]);
		ans=max(ans, go(2, i+1)+uno[i][0]);
	}
	if(a==1)
	{
		ans=max(ans, go(0, i+1)+uno[i][1]);
		ans=max(ans, go(2, i+1)+uno[i][1]);
	}
	if(a==2)
	{
		ans=max(ans, go(0, i+1)+uno[i][2]);
		ans=max(ans, go(1, i+1)+uno[i][2]);
	}
	
	return ans;
	
}
int main()
{
    cin>>n;
    for(int i=0; i<n; i++) cin>>uno[i][0]>>uno[i][1]>>uno[i][2];
    memset(dos, -1, sizeof dos);
    cout<<max(go(0,0), max(go(1,0),go(2,0)))<<"\n";
    return 0;
}
	

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

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define rrep(n,i) for(int i = n-1; i>=0; --i)
#define PI 3.14159265
#define INF 1e9
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(int &a,int b){
	a = min(a,b);
}

int main(){
	int n; cin >>n;
	vector<vector<int>> arr(n,vector<int> (3));
	rep(i,n) rep(j,3){
		cin >> arr[i][j];
	}

	vector<vector<ll>> dp(n,vector<ll> (3));
	rep(i,n){
		rep(j,3){
			if(i==0) dp[i][j] = arr[i][j];
			else{
				ll pre = INT_MIN;
				for(int k = 0; k<3;k++){
					if(k==j) continue;
					self_max(pre,dp[i-1][k]);
				} 
				dp[i][j] = pre+ arr[i][j];
			}
		}
	}

	ll ans = INT_MIN;
	rep(j,3) self_max(ans,dp[n-1][j]);
	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:50: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'll' {aka 'long long int'}
   30 |                                         self_max(pre,dp[i-1][k]);
      |                                                  ^~~
a.cc:8:20: note:   initializing argument 1 of 'void self_max(int&, int)'
    8 | void self_max(int &a,int b){
      |               ~~~~~^
a.cc:38:27: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'll' {aka 'long long int'}
   38 |         rep(j,3) self_max(ans,dp[n-1][j]);
      |                           ^~~
a.cc:8:20: note:   initializing argument 1 of 'void self_max(int&, int)'
    8 | void self_max(int &a,int b){
      |               ~~~~~^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n) ; ++i)
#define rrep(n,i) for(int i = n-1; i>=0; --i)
#define PI 3.14159265
#define INF 1e9
using namespace std;
using ll = long long;
void self_max(int &a,int b){
	a = max(a,b);
}
void self_min(int &a,int b){
	a = min(a,b);
}

int main(){
	int n; cin >>n;
	vector<vector<int>> arr(n,vector<int> (3));
	rep(i,n) rep(j,3){
		cin >> arr[i][j];
	}

	vector<vector<ll>> arr(n,vector<int> (3));
	rep(i,n){
		rep(j,3){
			if(i==0) dp[i][j] = arr[i][j];
			else{
				ll pre = INT_MIN;
				for(int k = 0; k<3;k++){
					if(k==j) continue;
					self_max(pre,dp[i-1][k]);
				} 
				dp[i][j] = pre+ arr[i][j];
			}
		}
	}

	ll ans = INT_MIN;
	rep(j,3) self_max(ans,dp[n-1][j]);
	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:28: error: conflicting declaration 'std::vector<std::vector<long long int> > arr'
   22 |         vector<vector<ll>> arr(n,vector<int> (3));
      |                            ^~~
a.cc:17:29: note: previous declaration as 'std::vector<std::vector<int> > arr'
   17 |         vector<vector<int>> arr(n,vector<int> (3));
      |                             ^~~
a.cc:25:34: error: 'dp' was not declared in this scope; did you mean 'dup'?
   25 |                         if(i==0) dp[i][j] = arr[i][j];
      |                                  ^~
      |                                  dup
a.cc:30:54: error: 'dp' was not declared in this scope; did you mean 'dup'?
   30 |                                         self_max(pre,dp[i-1][k]);
      |                                                      ^~
      |                                                      dup
a.cc:32:33: error: 'dp' was not declared in this scope; did you mean 'dup'?
   32 |                                 dp[i][j] = pre+ arr[i][j];
      |                                 ^~
      |                                 dup
a.cc:38:31: error: 'dp' was not declared in this scope; did you mean 'dup'?
   38 |         rep(j,3) self_max(ans,dp[n-1][j]);
      |                               ^~
      |                               dup
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main(){
	oneforall
	int n;
	cin>>n;
	int a,b,c;
	int dp[100000][3];
	dp[0][0] = dp[0][1] = dp[0][2] = 0;
	FOR(i,1,n+1){
		cin>>a>>b>>c;
		int x1,x2,x3;
		x1 = a+max(dp[i-1][1],dp[i-1][2]);
		x2 = b+max(dp[i-1][0],dp[i-1][2]);
		x3 = c+max(dp[i-1][0],dp[i-1][1]);
		dp[i][0] = x1;
		dp[i][1] = x2;
		dp[i][2] = x3;
	}
	cout<<max(dp[n][0],dp[n][1],dp[n][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:27:11:   required from here
   27 |         cout<<max(dp[n][0],dp[n][1],dp[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++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main(){
	oneforall
	int n;
	cin>>n;
	int a,b,c;
	int dp[100000][3];
	dp[0][0] = dp[0][1] = dp[0][2] = 0;
	FOR(i,1,n+1){
		cin>>a>>b>>c;
		int x1,x2,x3;
		x1 = a+max(dp[i-1][1],dp[i-1][2]);
		x2 = b+max(dp[i-1][0],dp[i-1][2]);
		x3 = c+max(dp[i-1][0],dp[i-1][1]);
		dp[i][0] = x1;
		dp[i][1] = x2;
		dp[i][3] = x3;
	}
	cout<<max(dp[n][0],dp[n][1],dp[n][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:27:11:   required from here
   27 |         cout<<max(dp[n][0],dp[n][1],dp[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++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main(){
	oneforall
	int n;
	cin>>n;
	int a,b,c;
	int dp[100000][3]
	dp[0][0] = dp[0][1] = dp[0][2] = 0;
	FOR(i,1,n+1){
		cin>>a>>b>>c;
		int x1,x2,x3;
		x1 = a+max(dp[i-1][1],dp[i-1][2]);
		x2 = b+max(dp[i-1][0],dp[i-1][2]);
		x3 = c+max(dp[i-1][0],dp[i-1][1]);
		dp[i][0] = x1;
		dp[i][1] = x2;
		dp[i][3] = x3;
	}
	cout<<max(dp[n][0],dp[n][1],dp[n][2]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: expected initializer before 'dp'
   16 |         dp[0][0] = dp[0][1] = dp[0][2] = 0;
      |         ^~
a.cc:20:28: error: 'dp' was not declared in this scope; did you mean 'dup'?
   20 |                 x1 = a+max(dp[i-1][1],dp[i-1][2]);
      |                            ^~
      |                            dup
a.cc:27:19: error: 'dp' was not declared in this scope; did you mean 'dup'?
   27 |         cout<<max(dp[n][0],dp[n][1],dp[n][2]);
      |                   ^~
      |                   dup
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
typedef long double ld;
const int oo = 1e9;

int nn;
const int nxx = 1e5+5;
int acc[nxx][3];
int dpp[3][nxx];
int go(int aa, int ii)
{
	if(ii==nn) return 0;
	if(dpp[aa][ii] != -1) return dpp[aa][ii];
	int& ans = dpp[aa][ii];
	if(aa==0)
	{
		ans=max(ans, go(1, ii+1)+acc[ii][0]);
		ans=max(ans, go(2, i+1)+acc[ii][0]);
	}
	if(aa==1)
	{
		ans=max(ans, go(0, i+1)+acc[ii][1]);
		ans=max(ans, go(2, i+1)+acc[ii][1]);
	}
	if(aa==2)
	{
		ans=max(ans, go(0, ii+1)+acc[ii][2]);
		ans=max(ans, go(1, ii+1)+acc[ii][2]);
	}

	return ans;

}
int main()
{
    cin>>nn;
    for(int ii=0; ii<nn; ii++) cin>>acc[ii][0]>>acc[ii][1]>>acc[ii][2];
    memset(dpp, -1, sizeof dpp);
    cout<<max(go(0,0), max(go(1,0),go(2,0)))<<"\n";
    return 0;
}


Compiler output:
a.cc: In function 'int go(int, int)':
a.cc:20:36: error: 'i' was not declared in this scope; did you mean 'ii'?
   20 |                 ans=max(ans, go(2, i+1)+acc[ii][0]);
      |                                    ^
      |                                    ii
a.cc:24:36: error: 'i' was not declared in this scope; did you mean 'ii'?
   24 |                 ans=max(ans, go(0, i+1)+acc[ii][1]);
      |                                    ^
      |                                    ii
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int lli;
typedef long double ld;
const int oo = 1e9;

int nn;
const int nxx = 1e5+5;
int acc[nxx][3];
int dpp[3][nx];
int go(int aa, int ii)
{
	if(ii==n) return 0;
	if(dp[aa][ii] != -1) return dp[aa][ii];
	int& ans = dp[aa][ii];
	if(a==0)
	{
		ans=max(ans, go(1, ii+1)+acc[ii][0]);
		ans=max(ans, go(2, i+1)+acc[ii][0]);
	}
	if(aa==1)
	{
		ans=max(ans, go(0, i+1)+acc[ii][1]);
		ans=max(ans, go(2, i+1)+acc[ii][1]);
	}
	if(aa==2)
	{
		ans=max(ans, go(0, ii+1)+acc[ii][2]);
		ans=max(ans, go(1, ii+1)+acc[ii][2]);
	}

	return ans;

}
int main()
{
    cin>>nn;
    for(int ii=0; ii<nn; ii++) cin>>acc[ii][0]>>acc[ii][1]>>acc[ii][2];
    memset(dp, -1, sizeof dp);
    cout<<max(go(0,0), max(go(1,0),go(2,0)))<<"\n";
    return 0;
}

Compiler output:
a.cc:11:12: error: 'nx' was not declared in this scope; did you mean 'nxx'?
   11 | int dpp[3][nx];
      |            ^~
      |            nxx
a.cc: In function 'int go(int, int)':
a.cc:14:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   14 |         if(ii==n) return 0;
      |                ^
      |                yn
a.cc:15:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   15 |         if(dp[aa][ii] != -1) return dp[aa][ii];
      |            ^~
      |            dup
a.cc:16:20: error: 'dp' was not declared in this scope; did you mean 'dup'?
   16 |         int& ans = dp[aa][ii];
      |                    ^~
      |                    dup
a.cc:17:12: error: 'a' was not declared in this scope; did you mean 'aa'?
   17 |         if(a==0)
      |            ^
      |            aa
a.cc:20:36: error: 'i' was not declared in this scope; did you mean 'ii'?
   20 |                 ans=max(ans, go(2, i+1)+acc[ii][0]);
      |                                    ^
      |                                    ii
a.cc:24:36: error: 'i' was not declared in this scope; did you mean 'ii'?
   24 |                 ans=max(ans, go(0, i+1)+acc[ii][1]);
      |                                    ^
      |                                    ii
a.cc: In function 'int main()':
a.cc:40:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   40 |     memset(dp, -1, sizeof dp);
      |            ^~
      |            dup
Language: Java

import java.util.Scanner;

/**
 *
 * @author German le yo
 */
public class DynamicProgrammingContest {
    
    // State contins the last action and the curent max happyness
    static int[][] state;
    static int[][] days;
    
    static int[] getOther(int j){
        switch(j){
            case 0: return new int[]{1, 2};
            case 1: return new int[]{0, 2};
            case 2: return new int[]{0, 1};
        }
        
        return null;
    }
    
    static int getMax(int i, int j){
        // Calulated
        if(state[i][j] != 0) return state[i][j];
        // Base case
        if(i == 0) return days[0][j];
        
        // Get max of others
        int[] other = getOther(j);
        int maxOther = -1, maxTmp;
        for(int otherI: other){
            maxTmp = getMax(i - 1, otherI);
            if(maxTmp > maxOther) maxOther = maxTmp; 
        }
       
       return state[i][j] = maxOther + days[i][j];
    }
    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        // Input
        int N = scan.nextInt();
        state = new int[N][3];
        days = new int[N][3];
        for(int i = 0; i < N; i++){
            days[i] = new int[]{scan.nextInt(), scan.nextInt(), scan.nextInt()};
        }
        
        int max0 = getMax(N - 1, 0);
        int max1 = getMax(N - 1, 1);
        int max2 = getMax(N - 1, 2);

        System.out.println(Math.max(Math.max(max0, max1), max2));
    }
    
}

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