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

#include <bits/stdc++.h>
using namespace std;
#define INF 100000000
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    int N;
    cin >> N;
    ll a[10010][3];
    REP(i,N) REP(j,3) cin >> a[i][j];
    ll dp[10020][3];
    REP(i,10020) REP(j,3) dp[i][j] = 0;

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

    ll ans = 0;
    REP(i,3) chmax(ans,dp[N][i])
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:33: error: expected ';' before 'cout'
   32 |     REP(i,3) chmax(ans,dp[N][i])
      |                                 ^
      |                                 ;
   33 |     cout << ans << endl;
      |     ~~~~
Language: C++

#include<bits/stdc++.h>
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
//const int INF=1e9+5; 
int main()
{
	fastio;
	int n;
	cin>>n;
	vector<int>dp(3,0);
	vector<int>newdp(3,0);
	vector<int>c(3);
	for(int day=0;day<n;day++)
	{
		cin>>c[0]>>c[1]>>c[2];
		memset(newdp,0,sizeof(newdp));
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				if(i!=j)
				{
					newdp[j]=max(newdp[j],dp[i]+c[j]);
				}
			}
		}
		dp=newdp;
	}	
	cout<<max({dp[0],dp[1],dp[2]});
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: cannot convert 'std::vector<int>' to 'void*'
   17 |                 memset(newdp,0,sizeof(newdp));
      |                        ^~~~~
      |                        |
      |                        std::vector<int>
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
//const int INF=1e9+5; 
int main()
{
	fastio;
	int n;
	cin>>n;
	vector<int>dp(3,0);
	vector<int>newdp(3,0)
	vector<int>c(3);
	for(int day=0;day<n;day++)
	{
		cin>>c[0]>>c[1]>>c[2];
		memset(newdp,0,sizeof(newdp));
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				if(i!=j)
				{
					newdp[j]=max(newdp[j],dp[i]+c[j]);
				}
			}
		}
		dp=newdp;
	}	
	cout<<max({dp[0],dp[1],dp[2]});
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: expected ',' or ';' before 'vector'
   13 |         vector<int>c(3);
      |         ^~~~~~
a.cc:16:22: error: 'c' was not declared in this scope
   16 |                 cin>>c[0]>>c[1]>>c[2];
      |                      ^
a.cc:17:24: error: cannot convert 'std::vector<int>' to 'void*'
   17 |                 memset(newdp,0,sizeof(newdp));
      |                        ^~~~~
      |                        |
      |                        std::vector<int>
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
Language: C++

#include<bits/stdc++.h>
#define endl "\n"
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
//const int INF=1e9+5; 
int main()
{
	fastio;
	int n,a,b,c;
	cin>>n;
	vector<int>dp(3,0);
	vector<int>newdp(3,0)
	vector<int>c(3);
	for(int day=0;day<n;day++)
	{
		cin>>c[0]>>c[1]>>c[2];
		memset(newdp,0,sizeof(newdp));
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				if(i!=j)
				{
					newdp[j]=max(newdp[j],dp[i]+c[j]);
				}
			}
		}
		dp=newdp;
	}	
	cout<<max({dp[0],dp[1],dp[2]});
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: expected ',' or ';' before 'vector'
   13 |         vector<int>c(3);
      |         ^~~~~~
a.cc:16:23: error: invalid types 'int[int]' for array subscript
   16 |                 cin>>c[0]>>c[1]>>c[2];
      |                       ^
a.cc:16:29: error: invalid types 'int[int]' for array subscript
   16 |                 cin>>c[0]>>c[1]>>c[2];
      |                             ^
a.cc:16:35: error: invalid types 'int[int]' for array subscript
   16 |                 cin>>c[0]>>c[1]>>c[2];
      |                                   ^
a.cc:17:24: error: cannot convert 'std::vector<int>' to 'void*'
   17 |                 memset(newdp,0,sizeof(newdp));
      |                        ^~~~~
      |                        |
      |                        std::vector<int>
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
a.cc:24:70: error: invalid types 'int[int]' for array subscript
   24 |                                         newdp[j]=max(newdp[j],dp[i]+c[j]);
      |                                                                      ^
Language: C++

#include<algorithm>
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
long long N=0;
long long a[10010]={0},b[10010]={0},c[10010]={0};
long long dp[10010][4]={0};
int main(void){
	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 j=0;j<N-1;j++){
		for(int i=0;i<3;i++){
			if(i==0){
				if(a[j+1]>max(b[j+1],c[j+1])&&a[10009]!=1){
					dp[j+1][0]=dp[j][0]+a[j+1];
					a[10009]=1;
				}
				else{
					dp[j+1][0]=max(dp[j][1],dp[j][2])+a[j+1];
					a[10009]=0;
				}
			}
			else if(i==1){
				if(b[j+1]>max(a[j+1],c[j+1])&&b[10009]!=1){
					dp[j+1][1]=dp[j][1]+b[j+1];
					b[10009]=1;
				}
				else{
					dp[j+1][1]=max(dp[j][0],dp[j][2])+b[j+1];
					b[10009]=0;
				}
			}
			else{
				if(c[j+1]>max(a[j+1],b[j+1])&&c[10009]!=1){
					dp[j+1][2]=dp[j][2]+c[j+1];
					c[10009]=1;
				}
				else{
					dp[j+1][2]=max(dp[j][0],dp[j][1])+c[j+1];
					c[10009]=0;
			}
		}
	}
	cout<<max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2]))<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:2: error: expected '}' at end of input
   52 | }
      |  ^
a.cc:9:15: note: to match this '{'
    9 | int main(void){
      |               ^
Language: C++

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

int minn=INT_MAX;
int a,b,c,f1[101010],f2[101001],f3[101101];
int n;

main()
{
    cin >> n;
    for(int i=1; i<=n; i++) f[i]=1e9;
    for(int i=1; i<=n; i++)
    {
        cin >> a >> b >> c;
        f1[i]=max(f2[i-1],f3[i-1])+a;
        f2[i]=max(f1[i-1],f3[i-1])+b;
        f3[i]=max(f1[i-1],f2[i-1])+c;
    }
    cout << max(f1[n],max(f2[n],f3[n]);
}



Compiler output:
a.cc:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:11:29: error: 'f' was not declared in this scope
   11 |     for(int i=1; i<=n; i++) f[i]=1e9;
      |                             ^
a.cc:19:39: error: expected ')' before ';' token
   19 |     cout << max(f1[n],max(f2[n],f3[n]);
      |                ~                      ^
      |                                       )
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int n;
  //ai = a[i][0],bi = a[i][1],ci = a[i][2] とする
  long long a[100010][3];
  //dpテーブル
  long long dp[100010][3];

  cin >> 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; ++i){
      for(int k = 0; k < 3; ++k){
        if (j != k){
          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;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:45: error: expected ';' before '}' token
   41 |           chmax(dp[i+1][k],dp[i][j]+a[i][k])
      |                                             ^
      |                                             ;
   42 |         }
      |         ~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int n;
  //ai = a[i][0],bi = a[i][1],ci = a[i][2] とする
  long long a[100010][3];
  //dpテーブル
  long long dp[100010][3];

  cin >> n;
  for (int i = 0; i < n; ++i){
    for (int j = 0; j < 3; ++j){
      cin >> a[i][j];
    }
  }
  dp[0] =
  for(int i = 1; i < n; ++i){
    for(int j = 0; j < 3; ++i){
      for(int k = 0; k < 3; ++k){
        if (j != k){
          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;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:3: error: expected primary-expression before 'for'
   38 |   for(int i = 1; i < n; ++i){
      |   ^~~
a.cc:38:18: error: 'i' was not declared in this scope
   38 |   for(int i = 1; i < n; ++i){
      |                  ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:24:53: error: invalid operands of types 'const int' and '<unresolved overloaded function type>' to binary 'operator<<'
   24 |   int ans=max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
Language: C++

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

int main(){
  int n;
  cin>>n;
  int arr[n][3];
  for(int i=0; i<n; i++)
    cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
  int cost[n][3];
  cost[0][0] = arr[0][0];
  cost[0][1] = arr[0][1];
  cost[0][2] = arr[0][2];
  for(int i=1; i<n; i++){
    cost[i][0] = arr[i][0] + max(cost[i-1][1], cost[i-1][2]);
    cost[i][1] = arr[i][1] + max(cost[i-1][0], cost[i-1][2]);
    cost[i][2] = arr[i][2] + max(cost[i-1][1], cost[i-1][0]);
  }
  int r = max(cost[n-1][0], max(cost[n-1][1], cost[n-1][2]));
  print(r);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:3: error: 'print' was not declared in this scope; did you mean 'printf'?
   21 |   print(r);
      |   ^~~~~
      |   printf
Language: Java

import java.util.Scanner;

public class C_Vacation {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N + 1];
    int[] b = new int[N + 1];
    int[] c = new int[N + 1];
    int cnt = 0;
    while (++cnt <= N) {
      a[cnt] = sc.nextInt();
      b[cnt] = sc.nextInt();
      c[cnt] = sc.nextInt();
    }
    int[] dpA = new int[N + 1];
    int[] dpB = new int[N + 1];
    int[] dpC = new int[N + 1];
    for (int i = 1; i <= N; i++) {
      dpA[i] = Math.max(dpB[i - 1], dpC[i - 1]) + a[i];
      dpB[i] = Math.max(dpC[i - 1], dpA[i - 1]) + b[i];
      dpC[i] = Math.max(dpA[i - 1], dpB[i - 1]) + c[i];
    }

    System.out.println(Math.max(Math.max(dpA[N], dpB[N]), dpC[N]));
  }
}

Compiler output:
Main.java:3: error: class C_Vacation is public, should be declared in a file named C_Vacation.java
public class C_Vacation {
       ^
1 error
Language: Java


import java.util.Scanner;

public class DP {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] arr = new int[N+1000][3];
        int[][] memo = new int[N+1000][3];

        for (int i = 0; i < N; i++) {
            arr[i][0] = sc.nextInt();
            arr[i][1] = sc.nextInt();
            arr[i][2] = sc.nextInt();
            memo[i][0]=-1;
            memo[i][1]=-1;
            memo[i][2]=-1;
        }
//        int[][] dp = new int[N+1000][3];
//        for (int i = 0; i <dp.length ; i++) {
//            dp[i] = Integer.MAX_VALUE;
//        }

//        dp[1][0] = arr[0][0];
//        dp[1][1] = arr[0][1];
//        dp[1][2] = arr[0][2];
//
//        for (int i = 1; i <= N-1 ; i++) {
//            //A
//            dp[i+1][0]=Math.max(dp[i][1],dp[i][2]) + arr[i][0];
//            dp[i+1][1]=Math.max(dp[i][0],dp[i][2]) + arr[i][1];
//            dp[i+1][2]=Math.max(dp[i][0],dp[i][1]) + arr[i][2];
//        }
//
//        System.out.println(Math.max(Math.max(dp[N][0],dp[N][1]),dp[N][2]));

        System.out.println(recur(arr,memo,N));

    }

    static public int recur(int[][] arr,int[][] memo,int N){
        return Math.max(
                    Math.max(
                        recur(arr,memo,N, 0),
                        recur(arr,memo,N, 1)),
                    recur(arr,memo,N, 2)
                );
    }

    static public int recur(int[][] arr,int[][] memo, int idx, int type){
    //    if(memo[idx][type]!=-1) return memo[idx][type];
        if(idx ==0){
            return arr[0][type];
        }

        int  max = 0;
        for (int i = 0; i < 3; i++) {
            if(i!=type){
                max = Math.max(max,recur(arr,memo,idx-1, i));
            }
        }
        max += arr[idx][type];

        memo[idx][type] =max;
        return max;
    }


}

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

//
// Created by yuu on 2019-04-18.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>

using namespace std;


int main(void){

    int N;
    int A[10010][3];

    cin>>N;


    long long dp[10010][3] = {};

    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;
                dp[i+1][k] = max(dp[i+1][k], dp[i][j] + A[i][k]);
            }
        }
    }

    cout<<max(dp[N][0],dp[N][1],dp[N][2])<<endl;

    return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:5:
/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:43:14:   required from here
   43 |     cout<<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: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Vacation {
	static FastReader input = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	static int n;
	static int m = 3;

	static int[][] a, memo;
	static int _INF = (int) -1e9;

	static int solve(int n, int nextActivity) {

		if (n == -1) {
			return 0;
		}

		if (memo[n][nextActivity] != -1)
			return memo[n][nextActivity];

		int max = _INF;

		for (int i = 0; i < m; i++) {
			if (i != nextActivity) {
				max = Math.max(max, a[n][i] + solve(n - 1, i));
			}
		}

		return memo[n][nextActivity] = max;

	}

	public static void main(String[] args) throws NumberFormatException, IOException {

		n = input.nextInt();

		a = new int[n][m];
		memo = new int[n + 10][m+5];

		for (int i = 0; i < n; i++) {
			Arrays.fill(memo[i], -1);
			for (int j = 0; j < m; j++) {
				a[i][j] = input.nextInt();
			}
		}
		
		System.out.println(solve(n-1,4));

	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		String nextLine() throws IOException {
			String str = "";
			str = br.readLine();
			return str;
		}
	}
}


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

#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define modbig (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int n;
  cin>>n;
  int a[n],b[n],c[n],la[n],lb[n];lc[n];
  rep(i,n){
    cin>>a[n]>>b[n]>>c[n];
  }
  la[0]=0
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:34: error: 'lc' was not declared in this scope; did you mean 'lb'?
   17 |   int a[n],b[n],c[n],la[n],lb[n];lc[n];
      |                                  ^~
      |                                  lb
a.cc:21:10: error: expected ';' before '}' token
   21 |   la[0]=0
      |          ^
      |          ;
   22 | }
      | ~
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
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; }
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const int MOD = 1000000007;
ll dp[100010][3];
void print(const std::vector<int>& v)
{
  std::for_each(v.begin(), v.end(), [](int x) {
    std::cout << x << " ";
  });
  std::cout << std::endl;
}
//dp[i] i-1日目までで得られる幸福度の最大値
//dp[ i + 1 ][ j ] := i 日目までの活動履歴のうち、
//最終日である i 日目には活動 j (0: A, 1: B, 2: C) を選んだ場合の、得られる幸福度の最大値
int main ()
{
    int N;cin>>N;
    vector<vector<int>> a(N,vector<int>(3));
    REP(i,N)
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    REP(i,N){
        REP(j,3){
            REP(k,3){
                if(j==k) continue;//同じのはだめ
                chmax(dp[i+1][k],dp[i][j]+a[i][k]);
            }

        }
    }
    ll res = 0;
    REP(j,3) chmax(res,dp[N][j]);
    cout<<res<<endl;
  return 0;
}

Compiler output:
a.cc:2:18: error: expected unqualified-id before 'for'
    2 | #define REP(i,n) for(ll i = 0; i < (ll)n; i++)
      |                  ^~~
a.cc:32:5: note: in expansion of macro 'REP'
   32 |     REP(i,N){
      |     ^~~
a.cc:32:9: error: 'i' does not name a type
   32 |     REP(i,N){
      |         ^
a.cc:2:32: note: in definition of macro 'REP'
    2 | #define REP(i,n) for(ll i = 0; i < (ll)n; i++)
      |                                ^
a.cc:32:9: error: 'i' does not name a type
   32 |     REP(i,N){
      |         ^
a.cc:2:43: note: in definition of macro 'REP'
    2 | #define REP(i,n) for(ll i = 0; i < (ll)n; i++)
      |                                           ^
a.cc:2:18: error: expected unqualified-id before 'for'
    2 | #define REP(i,n) for(ll i = 0; i < (ll)n; i++)
      |                  ^~~
a.cc:42:5: note: in expansion of macro 'REP'
   42 |     REP(j,3) chmax(res,dp[N][j]);
      |     ^~~
a.cc:42:9: error: 'j' does not name a type
   42 |     REP(j,3) chmax(res,dp[N][j]);
      |         ^
a.cc:2:32: note: in definition of macro 'REP'
    2 | #define REP(i,n) for(ll i = 0; i < (ll)n; i++)
      |                                ^
a.cc:42:9: error: 'j' does not name a type
   42 |     REP(j,3) chmax(res,dp[N][j]);
      |         ^
a.cc:2:43: note: in definition of macro 'REP'
    2 | #define REP(i,n) for(ll i = 0; i < (ll)n; i++)
      |                                           ^
a.cc:43:5: error: 'cout' does not name a type
   43 |     cout<<res<<endl;
      |     ^~~~
a.cc:44:3: error: expected unqualified-id before 'return'
   44 |   return 0;
      |   ^~~~~~
a.cc:45:1: error: expected declaration before '}' token
   45 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  int a[N][3];
  for (int i = 0; i < N; i++) cin >> a[i][0] >> a[i][1] >> a[i][2];
  int dp[N][3];
  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] = arr[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
    dp[i][1] = arr[i][1] + max(dp[i - 1][2], dp[i - 1][0]);
    dp[i][2] = arr[i][2] + max(dp[i - 1][0], dp[i - 1][1]);
	}
	cout << max (dp[N - 1][0], max(dp[N - 1][1], dp[N - 1][2])) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: 'arr' was not declared in this scope
   10 |   dp[0][0] = arr[0][0]; dp[0][1] = arr[0][1]; dp[0][2] = arr[0][2];
      |              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  int a[N][3];
  for (int i = 0; i < N; i++) cin >> a[i][0] >> a[i][1] >> a[i][2];
  int dp[n][3];
  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] = arr[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
    dp[i][1] = arr[i][1] + max(dp[i - 1][2], dp[i - 1][0]);
    dp[i][2] = arr[i][2] + max(dp[i - 1][0], dp[i - 1][1]);
	}
	cout << max (dp[N - 1][0], max(dp[N - 1][1], dp[N - 1][2])) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: 'n' was not declared in this scope
    9 |   int dp[n][3];
      |          ^
a.cc:10:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   10 |   dp[0][0] = arr[0][0]; dp[0][1] = arr[0][1]; dp[0][2] = arr[0][2];
      |   ^~
      |   dup
a.cc:10:14: error: 'arr' was not declared in this scope
   10 |   dp[0][0] = arr[0][0]; dp[0][1] = arr[0][1]; dp[0][2] = arr[0][2];
      |              ^~~
Language: C++

#include <bits/stdc++.h> 

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

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 argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input values
    int N;
    cin >> N;

    vector<vector<int>> a(N, vector<int>(3, 0));
    rep (i, N) {
        rep (j, 3) {
            cin >> a[i][j];
        }
    }

    // dp table
    vector<vector<int>> dp(100100, vector<int>(3, 0));
    
    // init dp table

    // init condition

    // loop
    rep (i, N) {
        rep (j, 3) {
            rep (k, 3) {
                if (j == k) {
                    continue;
                }
                chmax(dp[i+1][k], dp[i][j] + a[i][k]);
            }
        }
    }

    ll ans = max(, max(dp[N][1], dp[N][2]));

    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:71:18: error: expected primary-expression before ',' token
   71 |     ll ans = max(, max(dp[N][1], dp[N][2]));
      |                  ^
Language: C++

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

int main() {
	int N; cin >> N;
	vector<int> a(N), b(N), c(N);
	for (int i = 0; i < N; i++)cin >> a[i] >> b[i] >> c[i];

	vector<vector<int>> dp(N, vector<int>(3));
	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 - 1][1], dp[i - 1][2]) + a[i];
		dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];
		dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];
	}

	int ans = max(dp[N - 1][0], max(dp[N - 1][1], dp[N - 1][2]));
	cout << ans << endl;
}

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,a,b,c;
int A[100010],B[100010],C[100010];
int main(){
    cin >> N;
    cin >> a >> b >> c;
    A = a; B = b; C = c;
    for(int i = 1; i < N; i++){
        cin >> a >> b >> c;
        A[i] = max(B[i-1],C[i-1]) + a;
        B[i] = max(A[i-1],C[i-1]) + b;
        C[i] = max(A[i-1],B[i-1]) + c;
    }
    cout << max(A[N-1], max(B[N-1],C[N-1])) << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:7: error: incompatible types in assignment of 'int' to 'int [100010]'
   22 |     A = a; B = b; C = c;
      |     ~~^~~
a.cc:22:14: error: incompatible types in assignment of 'int' to 'int [100010]'
   22 |     A = a; B = b; C = c;
      |            ~~^~~
a.cc:22:21: error: incompatible types in assignment of 'int' to 'int [100010]'
   22 |     A = a; B = b; C = c;
      |                   ~~^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,a,b,c;
int A[100010],B[100010],C[100010];
int main(){
    cin >> N;
    cin >> a >> b >> c;
    A = a; B = b; C = c;
    for(int i = 1; i < N; i++){
        cin >> a >> b >> c;
        A[i] = max(B[i-1],C[i-1]) + a;
        B[i] = max(A[i-1],C[i-1]) + b;
        C[i] = max(A[i-1],B[i-1]) + c;
    }
    cout << max(A[i], max(B[i],C[i])) << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:22:7: error: incompatible types in assignment of 'int' to 'int [100010]'
   22 |     A = a; B = b; C = c;
      |     ~~^~~
a.cc:22:14: error: incompatible types in assignment of 'int' to 'int [100010]'
   22 |     A = a; B = b; C = c;
      |            ~~^~~
a.cc:22:21: error: incompatible types in assignment of 'int' to 'int [100010]'
   22 |     A = a; B = b; C = c;
      |                   ~~^~~
a.cc:29:19: error: 'i' was not declared in this scope
   29 |     cout << max(A[i], max(B[i],C[i])) << endl;
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
#define ll long long
const ll inf = 1e18;
int main(){
  int n;
  scanf("%d",&n);
  vector<ll> c(3,0);
  vector<ll> dp(3,0);
  for(int i=0;i<n;++i){
    for(int j=0;j<3;++j)cin>>c[j];
	vector<ll> ndp(3,0);
    for(int j=0;j<3;++j){
      for(int k=0;k<3;++k){
        if(j !=k){
          ndp[j] = max(ndp[j],dp[j]+c[k]);
        }
      }
    }
    dp = ndp;
  }
  ll ans = 0;
  for(int i=0;i<3;++i)ans = max(ans,dp[i]));
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:43: error: expected ';' before ')' token
   24 |   for(int i=0;i<3;++i)ans = max(ans,dp[i]));
      |                                           ^
      |                                           ;
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main(){
   int n;
   cin >> n;
   vector<vector<int>> a(n, vector<int>(3));
   for(int i = 0; i < n; i++)
   {
       cin >> a[i][0] >> a[i][1] >> a[i][2];
   }
   vector<vector<int>> dp(n+10, vector<int>(3,0));
   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][k] = max(dp[i+1][k], dp[i][j]+a[i][k]);
               }
           }
       }
   }
   cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

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

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

int dp[101010][3];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: lvalue required as increment operand
   13 |       for(int k=0;k<3++k){
      |                     ^
a.cc:13:24: error: expected ';' before 'k'
   13 |       for(int k=0;k<3++k){
      |                        ^
      |                        ;
Language: C

#include <stdio.h>
#include <stdlib.h>
long judge(long,long,long);
int main(){
  int n,luck[3][100000];
  long dp[3][100000],max;
  scanf("%d",&n);
  for (int i=0;i<n;i++){
    for (int j=0;j<3;j++) scanf("%d",&luck[j][i]);
  }
  dp[0][0]=(long)luck[0][0];
  dp[1][0]=(long)luck[1][0];
  dp[2][0]=(long)luck[2][0];
  for (int i=1;i<n;i++){
    if (dp[0][i-1]+luck[1][i]>dp[0][i-1]+luck[2][i]){
      dp[0][i]=dp[0][i-1]+luck[1][i];
    }
    else dp[0][i]=dp[0][i-1]+luck[2][i];
    
    if (dp[1][i-1]+luck[2][i]>dp[1][i-1]+luck[0][i]){
      dp[1][i]=dp[1][i-1]+luck[2][i];
    }
    else dp[1][i]=dp[1][i-1]+luck[0][i];
    
    if (dp[2][i-1]+luck[0][i]>dp[2][i-1]+luck[1][i]){
      dp[2][i]=dp[2][i-1]+luck[0][i];
    }
    else dp[2][i]=dp[2][i-1]+luck[1][i];
  }
  max=judge(dp[0][n-1],dp[1][n-1],dp[2][n-1])
  return 0;
}
long judge(long a,long b,long c){
  long max=a;
  if (b>max) max=b;
  if (c>max) max=c;
  return max;
}

Compiler output:
main.c: In function 'main':
main.c:30:46: error: expected ';' before 'return'
   30 |   max=judge(dp[0][n-1],dp[1][n-1],dp[2][n-1])
      |                                              ^
      |                                              ;
   31 |   return 0;
      |   ~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long int;
int main()
{
    ll n;
    cin>>n;
    ll a[n][3];
    ll i,j;
    for (i=0;i<n;i++)
    {

        for (j=0;j<3;j++)
        {

            cin>>a[i][j];
        }
    }
    ll dp[n][n];
    dp[0][0]=a[0][0];
    dp[0][1]=a[0][1];
    dp[0][2]=a[0][2];
    for (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][1],dp[i-1][0])+a[i][2];


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


Compiler output:
a.cc: In function 'int main()':
a.cc:3:22: error: declaration does not declare anything [-fpermissive]
    3 | #define ll long long int;
      |                      ^~~
a.cc:6:5: note: in expansion of macro 'll'
    6 |     ll n;
      |     ^~
a.cc:6:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |     ll n;
      |        ^
      |        yn
a.cc:3:22: error: declaration does not declare anything [-fpermissive]
    3 | #define ll long long int;
      |                      ^~~
a.cc:8:5: note: in expansion of macro 'll'
    8 |     ll a[n][3];
      |     ^~
a.cc:8:8: error: 'a' was not declared in this scope
    8 |     ll a[n][3];
      |        ^
a.cc:3:22: error: declaration does not declare anything [-fpermissive]
    3 | #define ll long long int;
      |                      ^~~
a.cc:9:5: note: in expansion of macro 'll'
    9 |     ll i,j;
      |     ^~
a.cc:9:8: error: 'i' was not declared in this scope
    9 |     ll i,j;
      |        ^
a.cc:9:10: error: 'j' was not declared in this scope; did you mean 'jn'?
    9 |     ll i,j;
      |          ^
      |          jn
a.cc:3:22: error: declaration does not declare anything [-fpermissive]
    3 | #define ll long long int;
      |                      ^~~
a.cc:19:5: note: in expansion of macro 'll'
   19 |     ll dp[n][n];
      |     ^~
a.cc:19:8: error: 'dp' was not declared in this scope; did you mean 'dup'?
   19 |     ll dp[n][n];
      |        ^~
      |        dup
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n);
  for(int i=0;i<n;i++)
    cin >> a[i] >> b[i] >> c[i];
  vector<int> dpa(n+1,0), dpb(n+1,0), dpc(n+1,0);
  for(int i=n-1;i>=0;i--){
    dpa[i] = max(dpb[i+1]+b[i], dpc[i+1]+c[i]);
    dpb[i] = max(dpa[i+1]+a[i], dpc[i+1]+c[i]);
    dpc[i] = max(dpa[i+1]+a[i], dpb[i+1]+b[i]);
  }
  cout << max(dpa[0], dpb[0], dpc[0]);
  return 0; 
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:17:14:   required from here
   17 |   cout << max(dpa[0], dpb[0], dpc[0]);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/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 <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
//#include <bits/stdc++.h>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAX 9223372036854775800

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

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

int main() {
  ll N;
  cin >> N;
	ll A[N];
	ll B[N];
	ll C[N];  
  ll dp[N][3];
  ll ans=0;

	FOR(i,0,N-1){
		cin>>A[i]>>B[i]>>C[i];
    dp[i][0]=-LLONG_MAX;
    dp[i][1]=-LLONG_MAX;
    dp[i][2]=-LLONG_MAX;
	}

    dp[0][0]=A[0];
    dp[0][1]=B[0];
    dp[0][2]=C[0];
0
	FOR(i,1,N-1){
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+A[i];
    dp[i][1]=max(dp[i-1][2],dp[i-1][0])+B[i];
    dp[i][2]=max(dp[i-1][0],dp[i-1][1])+C[i];
	}
  ans=max(dp[N-1][0],dp[N-1][1]);
  ans=max(ans,dp[N-1][2]);
  cout<<ans<<endl;

	FOR(i,0,N-1){
  //cout<<dp[i]<<endl;
	}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:92:2: error: expected ';' before 'for'
   92 | 0
      |  ^
      |  ;
a.cc:93:13: error: 'i' was not declared in this scope
   93 |         FOR(i,1,N-1){
      |             ^
a.cc:27:37: note: in definition of macro 'FOR'
   27 | #define FOR(i, a, b) for( int i=(a);i<=(b);i++)
      |                                     ^
a.cc: In function 'constexpr ll max(ll, ll)':
a.cc:68:1: warning: control reaches end of non-void function [-Wreturn-type]
   68 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[10001],b[10001],c[10001];
long long d[10001][4];
int main()
{
    cin>>n;
    for(long i=0;i<n;i++)
        cin>>a[i]>>b[i]>>c[i];
        d[0][0]=a[0];
        d[0][1]=b[0];
        d[0][2]=c[0];
    for(long i=1;i<n;i++)
    {
        d[i][0]=max(d[i-1][1],d[i-1][2])+a[i];
        d[i][1]=max(d[i-1][0],d[i-1][2])+b[i];
        d[i][2]=max(d[i-1][1],d[i-1][0])+c[i];
    }
    cout<<max(dp[n-1][1],max(dp[n-1][0],dp[n-1][2]));
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: 'dp' was not declared in this scope; did you mean 'dup'?
   20 |     cout<<max(dp[n-1][1],max(dp[n-1][0],dp[n-1][2]));
      |               ^~
      |               dup
Language: C++

#include<bits/stdc++.h>
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;
  	int h[N+1][3];
  for (int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      cin >>h[i][j];
    }
  }
  int mem[N+3][3];
  fill(mem[0],mem[N+3],0);
  
  for (int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(j!=k)chMax(mem[i+1][j],mem[i][k]+h[i][k]);
      }
    }
  }

  cout << max(mem[N][0],mem[N][1],mem[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 = int; _Compare = int]':
a.cc:25:14:   required from here
   25 |   cout << max(mem[N][0],mem[N][1],mem[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>
using namespace std;
template <class T> inline void chMax{if(a<b)a=b;}

int main(){
	int N;
  	cin >>N;
  	int h[N+1][3];
  for (int i=0;i<N;i++)cin >>h[i][0] >>h[i][1] >>h[i][2];
  	int mem[N+10][3];
    for (int i=0,i<3;i++)mem[0][i]=0;
    for (int i=0,i<3;i++)mem[1][i]=h[1][i];
   
  
 int dp(int i,int c){
    if(mem[i][c]!=-1)return mem[i][c];
  	if (i==0){memretrun mem[i][c]=0;}     
    if (c==0)return mem[i][c]= max(dp(i-1,1),dp(i-1,2))+h[i][0];
    if (c==1)return mem[i][c]=max(dp(i-1,0),dp(i-1,2))+h[i][1];
    if (c==2)return mem[i][c]=max(dp(i-1,0),dp(i-1,1))+h[i][2];
 } 
  cout << max(mem[N][0],mem[N][1],mem[N][2])<<endl;
  
}

Compiler output:
a.cc:3:32: error: variable or field 'chMax' declared void
    3 | template <class T> inline void chMax{if(a<b)a=b;}
      |                                ^~~~~
a.cc:3:38: error: expected primary-expression before 'if'
    3 | template <class T> inline void chMax{if(a<b)a=b;}
      |                                      ^~
a.cc:3:38: error: expected '}' before 'if'
    3 | template <class T> inline void chMax{if(a<b)a=b;}
      |                                     ~^~
a.cc:3:49: error: expected declaration before '}' token
    3 | template <class T> inline void chMax{if(a<b)a=b;}
      |                                                 ^
a.cc: In function 'int main()':
a.cc:11:19: error: expected ';' before '<' token
   11 |     for (int i=0,i<3;i++)mem[0][i]=0;
      |                   ^
      |                   ;
a.cc:11:19: error: expected primary-expression before '<' token
a.cc:12:19: error: expected ';' before '<' token
   12 |     for (int i=0,i<3;i++)mem[1][i]=h[1][i];
      |                   ^
      |                   ;
a.cc:12:19: error: expected primary-expression before '<' token
a.cc:15:21: error: a function-definition is not allowed here before '{' token
   15 |  int dp(int i,int c){
      |                     ^
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:22:14:   required from here
   22 |   cout << max(mem[N][0],mem[N][1],mem[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>
using namespace std;
#define ll long long
#define vi vector<int>
ll int x[100001]={'\0'};
ll int y[100001]={'\0'};
ll int z[100001]={'\0'};
int n;
int solve(int arr[100001][3],int n,int j)
{
	if(n==0)
	{
		if(j==1)
		{
			return max(arr[0][2],arr[0][0]);
		}
		else if(j==2)
		{
			return max(arr[0][1],arr[0][0]);
		}
		return max(arr[0][2],arr[0][1]);
	}
	else if(j==0)
	{
		if(y[n]!=0&&z[n]!=0)
		{
			return max(arr[n][1]+y[n],arr[n][2]+z[n]);
		}
		else
		{
			if(y[n]==0)
			y[n]=solve(arr,n-1,1);
			if(z[n]==0)
			z[n]=solve(arr,n-1,2);
			return max(arr[n][1]+y[n],arr[n][2]+z[n]);
		}
	}
	else if (j==1)
	{
		if(x[n]!=0&&z[n]!=0)
		{
			return max(arr[n][0]+x[n],arr[n][2]+z[n]);
		}
		else
		{
			if(x[n]==0)
			x[n]=solve(arr,n-1,0);
			if(z[n]==0)
			z[n]=solve(arr,n-1,2);
			return max(arr[n][0]+x[n],arr[n][2]+z[n]);
		}
	}
	else 
	{
			if(x[n]!=0&&y[n]!=0)
			{
			return max(arr[n][0]+x[n],arr[n][1]+y[n]);
			}
		else
		{
			if(x[n]==0)
			x[n]=solve(arr,n-1,0);
			if(y[n]==0)
			y[n]=solve(arr,n-1,1);
			return max(arr[n][0]+x[n],arr[n][1]+y[n]);
		}
	}
	
}
int main()
{
	cin>>n;
	if(n>1){
	int arr[100001][3];
	ll i;
	for(i=0;i<n;i++)
	{
		cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	}
	ll a = arr[n-1][0]+solve(arr,n-2,0);
	ll b = arr[n-1][1]+solve(arr,n-2,1);
	ll c = arr[n-1][2]+solve(arr,n-2,2);
	cout<<max(max(a,b),c)<<"\n"	
	}
	else
	{
		ll a , b , c ;
		cin>>a>>b>>c;
		cout<<max(max(a,b),c)<<"\n"
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:40: error: expected ';' before '}' token
   83 |         cout<<max(max(a,b),c)<<"\n"
      |                                    ^    
      |                                        ;
   84 |         }
      |         ~                           
a.cc:89:44: error: expected ';' before '}' token
   89 |                 cout<<max(max(a,b),c)<<"\n"
      |                                            ^
      |                                            ;
   90 |         }
      |         ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define INF 1e9+5
int main() {
	int n;
	cin>>n;
	vector<vector<int> > v(n);
	for(auto &i : v) {
		i.resize(3);
	}
	
	for(auto &ve : v) {
		for(int &i : ve) {
			cin>>i;
		}
	}
	
	vector<vector<int> > dp(n);
	for(auto &ve : dp) {
		ve.resize(3);
	}
		
	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++) {
		for(int j=0;j<3;j++) {
			dp[i][j] = max(dp[i-1][(j+1)%3] + v[i][j], dp[i-1][(j+2)%3] + v[i][j]);
		}
	}
	
	int ma = 0;
	for(int i=0;i<3;i++) {
		ma = max(ma,dp[n-1][i]);3
	}
	cout<<ma;
}

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

#include <stdio.h>
// #include <bits/std++.h>

#include <algorithm>
#define MAX_N 100010 

using namespace std;

int n;
long long hap[MAX_N][3];
long long dp[MAX_N][3];


int main(int argc,char* argv[]){
    scanf("%d\n",&n);


    for(int i = 0; i < n; i++)
    {
        scanf("%lld %lld %lld",&hap[i][0],&hap[i][1],&hap[i][2]);
    }

    for(int i = n - 1;i >= 0; i--){
        dp[i][0] = hap[i][0] + max(dp[i+1][1],dp[i+1][2]);

        dp[i][1] = hap[i][1] + max(dp[i+1][0],dp[i+1][2]);

        dp[i][2] = hap[i][2] + max(dp[i+1][1],dp[i+1][0]);
    }

    // printf("\n");

    for(int i = 0; i < n; i++)
    {
        for(int k = 0; k < 3; k++)
        {
            printf("[%d] ",dp[i][k]);
        }
        printf("\n");
    }
    
    long long out = max(dp[0][0],max(dp[0][1],dp[0][2]));
    printf("%lld",out);dp[i][1] = hap[i][1] + max(dp[i+1][0],dp[i+1][2]);


    return 0;
}



Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:43:27: error: 'i' was not declared in this scope
   43 |     printf("%lld",out);dp[i][1] = hap[i][1] + max(dp[i+1][0],dp[i+1][2]);
      |                           ^