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

include "bits/stdc++.h"
using namespace std;
 
const int N = 1e5+10;
 
int n;
int a[N][3];
int dp[N][3];
 
int solve (int day, int bef) {
	if (day > n)
		return 0;
	
	int &r = dp[day][bef];
	if (r != -1) return r;
	for (int i = 0; i < 3; i++)
		if (i != bef)
			r = max (r, solve (day+1, i) + a[day][i]);
		
	return r;
}
 
int main () {
	memset (dp, -1, sizeof dp);
	scanf ("%d", &n);
	for (int i = 1; i <= n; i++)
		for (int j = 0; j < 3; j++)
			scanf ("%d", &a[i][j]);
		
	int ans = -1;
	for (int i = 0; i < 3; i++)
		ans = max (ans, solve (2, i) + a[1][i]);
	printf ("%d\n", ans);
 
	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include "bits/stdc++.h"
      | ^~~~~~~
a.cc: In function 'int solve(int, int)':
a.cc:18:29: error: 'max' was not declared in this scope
   18 |                         r = max (r, solve (day+1, i) + a[day][i]);
      |                             ^~~
a.cc: In function 'int main()':
a.cc:24:9: error: 'memset' was not declared in this scope
   24 |         memset (dp, -1, sizeof dp);
      |         ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | include "bits/stdc++.h"
a.cc:25:9: error: 'scanf' was not declared in this scope
   25 |         scanf ("%d", &n);
      |         ^~~~~
a.cc:32:23: error: 'max' was not declared in this scope
   32 |                 ans = max (ans, solve (2, i) + a[1][i]);
      |                       ^~~
a.cc:33:9: error: 'printf' was not declared in this scope
   33 |         printf ("%d\n", ans);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include "bits/stdc++.h"
Language: C++

include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define len(x) ((int)(x).size())
using pii = pair<int, int>;
using ll = long long;
using llu = long long unsigned;
using ld = long double;
 
const ld EPS = 1e-9;
inline int cmp(ld x, ld y = 0, ld tol = EPS) {
	return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
 
const int MOD = 1;
inline int mod (ll x, int m = MOD) {
	return (int)(((x%m) + m)%m);
}
 
////////////////////////// Solution starts below. //////////////////////////////
 
const int N = 1e5+10;
 
int n;
int a[N][3];
int dp[N][3];
 
int solve (int day, int bef) {
	if (day > n)
		return 0;
	
	int &r = dp[day][bef];
	if (r != -1) return r;
	for (int i = 0; i < 3; i++)
		if (i != bef)
			r = max (r, solve (day+1, i) + a[day][i]);
		
	return r;
}
 
int main () {
	memset (dp, -1, sizeof dp);
	scanf ("%d", &n);
	for (int i = 1; i <= n; i++)
		for (int j = 0; j < 3; j++)
			scanf ("%d", &a[i][j]);
		
	int ans = -1;
	for (int i = 0; i < 3; i++)
		ans = max (ans, solve (2, i) + a[1][i]);
	printf ("%d\n", ans);
 
	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include "bits/stdc++.h"
      | ^~~~~~~
a.cc:8:13: error: 'pair' does not name a type
    8 | using pii = pair<int, int>;
      |             ^~~~
a.cc: In function 'int solve(int, int)':
a.cc:39:29: error: 'max' was not declared in this scope
   39 |                         r = max (r, solve (day+1, i) + a[day][i]);
      |                             ^~~
a.cc: In function 'int main()':
a.cc:45:9: error: 'memset' was not declared in this scope
   45 |         memset (dp, -1, sizeof dp);
      |         ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | include "bits/stdc++.h"
a.cc:46:9: error: 'scanf' was not declared in this scope
   46 |         scanf ("%d", &n);
      |         ^~~~~
a.cc:53:23: error: 'max' was not declared in this scope
   53 |                 ans = max (ans, solve (2, i) + a[1][i]);
      |                       ^~~
a.cc:54:9: error: 'printf' was not declared in this scope
   54 |         printf ("%d\n", ans);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include "bits/stdc++.h"
Language: Java

import java.util.Scanner;

public class FindMaxGain {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int rows = sc.nextInt();
        int[][] input = new int[rows][3];
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < 3; j++) {
                int happiness = sc.nextInt();
                input[i][j] = happiness;
            }
        }
        System.out.println(findMaxGain(input));

    }

    public static int findMaxGain(int[][] happinessArr){

        int[] dp = new int[3];

        for (int i = 0; i < 3; i++) {
            dp[i] = happinessArr[0][i];
        }

        int rows = happinessArr.length;
        for (int row = 1; row < rows; row++) {
            MaxAndSecondMax maxAndSecondMax = findMaxAndSecMax(dp);
            for (int col = 0; col < 3; col++) {
                dp[col] = happinessArr[row][col] + findMaxHappTillPrevDay(maxAndSecondMax, col);
            }
        }

        MaxAndSecondMax maxAndSecMax = findMaxAndSecMax(dp);
        return maxAndSecMax.getMax();
    }


    private static MaxAndSecondMax findMaxAndSecMax(int[] arr){
        MaxAndSecondMax obj = new MaxAndSecondMax();
        int length = arr.length;
        for (int i = 0; i < length; i++) {
            if(obj.getMax() < arr[i]){
                obj.setSecndMax(obj.getMax());
                obj.setSecndMaxIndex(obj.getMaxIndex());
                obj.setMax(arr[i]);
                obj.setMaxIndex(i);
            }

            if(arr[i] > obj.getSecndMax() && arr[i] < obj.getMax()){
                obj.setSecndMax(arr[i]);
                obj.setSecndMaxIndex(i);
            }
        }

        return obj;
    }

    private static int findMaxHappTillPrevDay(MaxAndSecondMax maxAndSecondMax, int col){
        if(col != maxAndSecondMax.getMaxIndex()){
            return maxAndSecondMax.getMax();
        } else {
            return maxAndSecondMax.getSecndMax();
        }
    }
}

class MaxAndSecondMax {
    int max = -1;
    int maxIndex = -1;
    int secndMax = -2;
    int secndMaxIndex = -1;

    public int getMax() {
        return max;
    }

    public int getMaxIndex() {
        return maxIndex;
    }

    public int getSecndMax() {
        return secndMax;
    }

    public int getSecndMaxIndex() {
        return secndMaxIndex;
    }

    public void setMax(int max) {
        this.max = max;
    }

    public void setMaxIndex(int maxIndex) {
        this.maxIndex = maxIndex;
    }

    public void setSecndMax(int secndMax) {
        this.secndMax = secndMax;
    }

    public void setSecndMaxIndex(int secndMaxIndex) {
        this.secndMaxIndex = secndMaxIndex;
    }
}


Compiler output:
Main.java:3: error: class FindMaxGain is public, should be declared in a file named FindMaxGain.java
public class FindMaxGain {
       ^
1 error
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];
    long long m = max({a[0], b[0], c[0]});
    int pIdx;
    if (m == a[0]) pIdx = 0;
    if (m == b[0]) pIdx = 1;
    if (m == c[0]) pIdx = 2;
    for (int i = 1; i < n; ++i) {
    	int dm = 0;
    	if (pIdx == 0) {
    		dm = max(b[0], c[0]);
    	} else if (pIdx == 1) {
    		dm = max(a[0], c[0]);
    	} else {
    		dm = max(a[0], b[0]);
    	}
    	if (dm == a[0]) pIdx = 0;
    	if (dm == b[0]) pIdx = 1;
    	if (dm == c[0]) pIdx = 2;
    	m += dm;
    }
    return dm;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:12: error: 'dm' was not declared in this scope; did you mean 'm'?
   28 |     return dm;
      |            ^~
      |            m
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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; }
const int64_t INF = 1LL << 60;


int main() {
  int N;
  int64_t a[100010][3];
  int64_t dp[100010][3];
  
  cin>>N;
   int N; cin >> N;
    for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];


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

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

  return 0;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: redeclaration of 'int N'
   15 |    int N; cin >> N;
      |        ^
a.cc:10:7: note: 'int N' previously declared here
   10 |   int N;
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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; }
const int64_t INF = 1LL << 60;


int main() {
  int N;cin>>N;
  int64_t a[100010][3];
  int64_t dp[100010][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;}
        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;



  //cout<<max({dp[N][0],dp[N][1],dp[N][2]})<<endl;
  return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:38: error: no matching function for call to 'chmax(long long int&, int64_t&)'
   28 |     for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
      |                                 ~~~~~^~~~~~~~~~~~~~~
a.cc:4:31: note: candidate: 'template<class T> bool chmax(T&, T)'
    4 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
      |                               ^~~~~
a.cc:4:31: note:   template argument deduction/substitution failed:
a.cc:28:38: note:   deduced conflicting types for parameter 'T' ('long long int' and 'long int')
   28 |     for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
      |                                 ~~~~~^~~~~~~~~~~~~~~
Language: C++

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

int main()
{
  int n;
  cin>>n;
  vector<int> v(n+1);
  int x,y,z;
  for (int i=1;i<=n;i++)
    {
      cin>>x>>y>>z;
      v[i].push_back(x);
      v[i].push_back(y);
      v[i].push_back(z);
    }
  int dp[n+1][3];
  dp[0][0]=dp[0][1]=dp[0][2]=0;
  for (int i=1;i<n;i++)
  {
    dp[i][0]=v[i][0]+max(dp[i-1][1],dp[i-1][2]);
    dp[i][1]=v[i][1]+max(dp[i-1][0],dp[i-1][2]);
    dp[i][2]=v[i][2]+max(dp[i-1][0],dp[i-1][1]);
  }
  cout<<max(max(dp[n][0],dp[n][1]),dp[n][2]);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: request for member 'push_back' in 'v.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   13 |       v[i].push_back(x);
      |            ^~~~~~~~~
a.cc:14:12: error: request for member 'push_back' in 'v.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   14 |       v[i].push_back(y);
      |            ^~~~~~~~~
a.cc:15:12: error: request for member 'push_back' in 'v.std::vector<int>::operator[](((std::vector<int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   15 |       v[i].push_back(z);
      |            ^~~~~~~~~
a.cc:21:18: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   21 |     dp[i][0]=v[i][0]+max(dp[i-1][1],dp[i-1][2]);
      |                  ^
a.cc:22:18: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   22 |     dp[i][1]=v[i][1]+max(dp[i-1][0],dp[i-1][2]);
      |                  ^
a.cc:23:18: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   23 |     dp[i][2]=v[i][2]+max(dp[i-1][0],dp[i-1][1]);
      |                  ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: 'v' was not declared in this scope
   11 |       cin>>v[i][j];
      |            ^
a.cc:13:13: error: 'v' was not declared in this scope
   13 |   dp[0]=max(v[0][0],max(v[0][1],v[0][2]));
      |             ^
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
int main(){
int N;
cin>>N;
int a[N+1];
int b[N+1];
int c[N+1];
a[0]=0;
b[0]=0;
c[0]=0;
for (int i=1;i<=N;++i)cin>>a[i]>>b[i]>>c[i];

int dp [3][100100];

dp[0][0]=0;
dp[1][0]=0;
dp[2][0]=0;
dp[0][i]=dp[1][i-1]*a[i]+dp[2][i-1]*a[i];
dp[1][i]=dp[0][i-1]*b[i]+dp[2][i-1]*b[i];
dp[2][i]=dp[0][i-1]*c[i]+dp[1][i-1]*c[i];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: 'i' was not declared in this scope
   20 | dp[0][i]=dp[1][i-1]*a[i]+dp[2][i-1]*a[i];
      |       ^
Language: C++

// #include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<map>

using namespace std;
#define mod 1000000007
#define ll long long 


int n, a[100009], b[100009], c[100009];
int dp[100009][4];
 
int solve(int idx, int prev) {
    if(idx == n)
        return 0;
    
    if(dp[idx][prev] != -1)
        return dp[idx][prev];
 
    int ans = INT_MIN;
 
    if(prev == 0) {
        ans = max(ans, b[idx] + solve(idx + 1, 1));
        ans = max(ans, c[idx] + solve(idx + 1, 2));
    } else if (prev == 1) {
        ans = max(ans, c[idx] + solve(idx + 1, 2));
        ans = max(ans, a[idx] + solve(idx + 1, 0));
    } else if (prev == 2){
        ans = max(ans, a[idx] + solve(idx + 1, 0));
        ans = max(ans, b[idx] + solve(idx + 1, 1));
    } else {
        ans = max(ans, a[idx] + solve(idx + 1, 0));
        ans = max(ans, b[idx] + solve(idx + 1, 1));
        ans = max(ans, c[idx] + solve(idx + 1, 2));
    }
 
    return dp[idx][prev] = ans;
}
 
int main() {
 
    // int t;
    // cin>>t;
    // while(t--) {
        cin>>n;
        memset(dp, -1, sizeof(dp));
        for(int i = 0; i < n; i++) {
            cin>>a[i]>>b[i]>>c[i];
        }
 
        cout<<solve(0, 3)<<endl;
    // }
}

Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:23:15: error: 'INT_MIN' was not declared in this scope
   23 |     int ans = INT_MIN;
      |               ^~~~~~~
a.cc:7:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<map>
  +++ |+#include <climits>
    7 | 
a.cc: In function 'int main()':
a.cc:49:9: error: 'memset' was not declared in this scope
   49 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include<map>
  +++ |+#include <cstring>
    7 |
Language: C++

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

int main()
{
  int n;
  cin>>n;
 vector<int> dp(3,0);
  for(int i=0;i<n;i++)
  {
      vector<int>c(3);
      vector<int>newdp(3,0);
      for(int j=0;j<3;j++)
        cin>>c[j];
      for(int i=0;i<3;i++){
        for(int j=0;j<3;j++)
          {
              if(i!=j)
                newdp[j]=max(c[j]+dp[i],new_dp[j]);
          }
      
      }
      dp=newdp;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:20:41: error: 'new_dp' was not declared in this scope; did you mean 'newdp'?
   20 |                 newdp[j]=max(c[j]+dp[i],new_dp[j]);
      |                                         ^~~~~~
      |                                         newdp
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define w(t) ll t;cin>>t; while(t--)

int main()
{
  
  ll i,j,n;
  cin>>n;
  ll a[n][3],dp[n+1][3]={0};
    
  
  for(i=0;i<n;i++)
  {
    for(j=0;j<3;j++)
    {
      cin>>a[i][j];//>>b[i][j]>>c[i][j];
      //cout<<a[i][j];//<<b[i][j]<<c[i][j];
    }
  }

 for(i=0;i<3;i++)
  {
    
    dp[0][i]=a[0][i];
    cout<<dp[0][i]<<" ";
    }
    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]));
      
      }





  /*for(i=0;i<n;i++)
  {
    cin>>b[i];
    
    //cout<<a[i];
  }
  for(i=0;i<n;i++)
  {
    s+=a[i];
    k+=b[i];
    if(s==k && a[i]==b[i])
    z+=a[i];
    
    }
    cout<<z<<endl;
 /* for(i=0;i<5;i++)
  {
    s+=a[i]*p;
    //cout<<s;
    }
    if(s<=120)
    flag=1;
    
    if(flag==1)
      cout<<"No"<<endl;
      else
      cout<<"Yes"<<endl;*/
    
  }

Compiler output:
a.cc:73:3: error: expected declaration before '}' token
   73 |   }
      |   ^
Language: C++

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

int main() {
  int n; cin >> n;
  int happy[n][3];
    for (int i = 0; i < n; i++)
      for (int j; j < 3; j++)
        cin >> happy[i][j];
  //入力
  int dp[n][3]:
  for (int i = 0; i < 3; i++) dp[0][i] = happy[0][i];
  //dp表
  for (int i = 1; i < n; i++){
    dp[i][0] = min(dp[i-1][1],dp[i-1][2])+happy[i][0];
    dp[i][1] = min(dp[i-1][2],dp[i-1][0])+happy[i][1];
    dp[i][2] = min(dp[i-1][0],dp[i-1][1])+happy[i][2];
  }
  cout << min(dp[n-1,0],min(dp[n-1,1],dp[n-1][2])) <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: expected initializer before ':' token
   11 |   int dp[n][3]:
      |               ^
a.cc:12:19: error: 'i' was not declared in this scope
   12 |   for (int i = 0; i < 3; i++) dp[0][i] = happy[0][i];
      |                   ^
a.cc:15:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   15 |     dp[i][0] = min(dp[i-1][1],dp[i-1][2])+happy[i][0];
      |     ^~
      |     dup
a.cc:19:15: error: 'dp' was not declared in this scope; did you mean 'dup'?
   19 |   cout << min(dp[n-1,0],min(dp[n-1,1],dp[n-1][2])) <<endl;
      |               ^~
      |               dup
Language: Java

import java.util.*;
public Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
  int m=sc.nextInt();
  int arr[][]=new int[m][3];
  for(int i=0;i<m;i++){
    for(int j=0;j<3;j++){
    arr[i][j]=sc.nextInt();
    }
  }
  int sto[][]=new int[m+1][3];
  sto[1][0]=arr[0][0];
  sto[1][1]=arr[0][1];
  sto[1][2]=arr[0][2];
  for(int i=2;i<=m;i++){
  sto[i][0]=arr[i-1][0]+Math.max(sto[i-1][1],sto[i-1][2]);
    sto[i][1]=arr[i-1][1]+Math.max(sto[i-1][0],sto[i-1][2]);
    sto[i][2]=arr[i-1][2]+Math.max(sto[i-1][1],sto[i-1][0]);
  }
  int maxi=Math.max(sto[m][0],Math.max(sto[m][1],sto[m][2]));
  System.out.println(maxi);
}
 
}

Compiler output:
Main.java:2: error: class, interface, enum, or record expected
public Main{
       ^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String args[]){
              ^
  (use --enable-preview to enable unnamed classes)
Main.java:25: error: class, interface, enum, or record expected
}
^
3 errors
Language: Java

class Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
  int m=sc.nextInt();
  int arr[][]=new int[m][3];
  for(int i=0;i<m;i++){
    for(int j=0;j<3;j++){
    arr[i][j]=sc.nextInt();
    }
  }
  int sto[][]=new int[m+1][3];
  sto[1][0]=arr[0][0];
  sto[1][1]=arr[0][1];
  sto[1][2]=arr[0][2];
  for(int i=2;i<=m;i++){
  sto[i][0]=arr[i-1][0]+Math.max(sto[i-1][1],sto[i-1][2]);
    sto[i][1]=arr[i-1][1]+Math.max(sto[i-1][0],sto[i-1][2]);
    sto[i][2]=arr[i-1][2]+Math.max(sto[i-1][1],sto[i-1][0]);
  }
  int maxi=Math.max(sto[n][0],Math.max(sto[n][1],sto[n][2]));
  System.out.println(maxi);
}
 
}

Compiler output:
Main.java:3: error: cannot find symbol
Scanner sc=new Scanner(System.in);
^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
Scanner sc=new Scanner(System.in);
               ^
  symbol:   class Scanner
  location: class Main
Main.java:20: error: cannot find symbol
  int maxi=Math.max(sto[n][0],Math.max(sto[n][1],sto[n][2]));
                        ^
  symbol:   variable n
  location: class Main
Main.java:20: error: cannot find symbol
  int maxi=Math.max(sto[n][0],Math.max(sto[n][1],sto[n][2]));
                                           ^
  symbol:   variable n
  location: class Main
Main.java:20: error: cannot find symbol
  int maxi=Math.max(sto[n][0],Math.max(sto[n][1],sto[n][2]));
                                                     ^
  symbol:   variable n
  location: class Main
5 errors
Language: Java

public Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
  int m=sc.nextInt();
  int arr[][]=new int[m][3];
  for(int i=0;i<m;i++){
    for(int j=0;j<3;j++){
    arr[i][j]=sc.nextInt();
    }
  }
  int sto[][]=new int[m+1][3];
  sto[1][0]=arr[0][0];
  sto[1][1]=arr[0][1];
  sto[1][2]=arr[0][2];
  for(int i=2;i<=m;i++){
  sto[i][0]=arr[i-1][0]+Math.max(sto[i-1][1],sto[i-1][2]);
    sto[i][1]=arr[i-1][1]+Math.max(sto[i-1][0],sto[i-1][2]);
    sto[i][2]=arr[i-1][2]+Math.max(sto[i-1][1],sto[i-1][0]);
  }
  int maxi=Math.max(sto[n][0],Math.max(sto[n][1],sto[n][2]));
  System.out.println(maxi);
}

}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
public Main{
       ^
Main.java:2: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String args[]){
              ^
  (use --enable-preview to enable unnamed classes)
Main.java:24: error: class, interface, enum, or record expected
}
^
3 errors
Language: C++

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

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; }
const long long INF = 1LL << 60;

class CVacation {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        int n;cin >>n;
        vector<vector<int>> data(100010, vector<int>(3));
        vector<vector<int>> dp(100010, vector<int>(3,0));

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


        for(int i =1;i<n;++i){
            chmax(dp[i][0],dp[i-1][1]+data[i][0]);
            chmax(dp[i][0],dp[i-1][2]+data[i][0]);
            chmax(dp[i][1],dp[i-1][0]+data[i][1]);
            chmax(dp[i][1],dp[i-1][2]+data[i][1]);
            chmax(dp[i][2],dp[i-1][0]+data[i][2]);
            chmax(dp[i][2],dp[i-1][1]+data[i][2]);
        }

        int maxans = max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
        cout<<maxans<<endl;

	}
};


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
struct happiness{
 int a,b,c;
};
/*int maxHappy(happiness arr[],int n,int startDay,int day){
  if(day==n+1){
    return 0;
  }
  int maxm = INT_MIN;
  if(startDay == 0){
    maxm = max(arr[day].a+maxHappy(arr,n,1,day+1),max(arr[day].b+maxHappy(arr,n,2,day+1),arr[day].c+maxHappy(arr,n,3,day+1)));
  }
  if(startDay == 1){
    maxm = max(arr[day].b+maxHappy(arr,n,2,day+1),arr[day].c+maxHappy(arr,n,3,day+1));
  }
  if(startDay == 2){
    maxm = max(arr[day].a+maxHappy(arr,n,1,day+1),arr[day].c+maxHappy(arr,n,3,day+1));
  }
  if(startDay == 3){
    maxm = max(arr[day].b+maxHappy(arr,n,2,day+1),arr[day].a+maxHappy(arr,n,1,day+1));
  }
 return maxm;
}*/
//Using recursion
int maxHappy1(happiness arr[],int n,int startDay,int day){
 if(day == 0){
    return 0;
 }

int maxHappydp(happiness arr[],int n,int startDay,int day,int dp[][4]){
 if(day == 0){
    return 0;
 }
 if(dp[day][startDay]!=0){
    return dp[day][startDay];
 }
 //recursive steps
 int maxm = INT_MIN;
 if(startDay == 0){
    maxm = max(arr[day].a+maxHappydp(arr,n,1,day-1,dp),max(arr[day].b+maxHappydp(arr,n,2,day-1,dp),arr[day].c+maxHappydp(arr,n,3,day-1,dp)));
 }
 if(startDay == 1){
    maxm = max(arr[day].b+maxHappydp(arr,n,2,day-1,dp),arr[day].c+maxHappydp(arr,n,3,day-1,dp));
  }
  if(startDay == 2){
    maxm = max(arr[day].a+maxHappydp(arr,n,1,day-1,dp),arr[day].c+maxHappydp(arr,n,3,day-1,dp));
  }
  if(startDay == 3){
    maxm = max(arr[day].b+maxHappydp(arr,n,2,day-1,dp),arr[day].a+maxHappydp(arr,n,1,day-1,dp));
  }
  return dp[day][startDay] = maxm;
}
int main(){
 int n;
 cin>>n;
 happiness arr[n+1];
 for(int i=1;i<=n;i++){
    int a1,b1,c1;
    cin>>a1>>b1>>c1;
    arr[i].a = a1;
    arr[i].b = b1;
    arr[i].c = c1;
 }
 int startDay = 0;
 int day = 1;
 int dp[n+1][4]={0};
 cout<<maxHappydp(arr,n,0,n,dp)<<endl;


}


Compiler output:
a.cc: In function 'int maxHappy1(happiness*, int, int, int)':
a.cc:31:71: error: a function-definition is not allowed here before '{' token
   31 | int maxHappydp(happiness arr[],int n,int startDay,int day,int dp[][4]){
      |                                                                       ^
a.cc:54:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   54 | int main(){
      |         ^~
a.cc:54:9: note: remove parentheses to default-initialize a variable
   54 | int main(){
      |         ^~
      |         --
a.cc:54:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:54:11: error: a function-definition is not allowed here before '{' token
   54 | int main(){
      |           ^
a.cc:71:2: error: expected '}' at end of input
   71 | }
      |  ^
a.cc:26:58: note: to match this '{'
   26 | int maxHappy1(happiness arr[],int n,int startDay,int day){
      |                                                          ^
a.cc:71:2: warning: control reaches end of non-void function [-Wreturn-type]
   71 | }
      |  ^
Language: Java



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

public class Vacation {

	int ar[][];
	int dp[][];

	Vacation(int n) {

		ar = new int[n][3];
		dp = new int[n][3];
	}

	public int func(int i, int j) {

		if (i == ar.length - 1)
			return dp[i][j] = ar[i][j];

		if (dp[i][j] != -1)
			return dp[i][j];

		int max = Integer.MIN_VALUE;

		for (int x = 0; x < 3; x++) {

			if (x != j)
				max = Math.max(max, (ar[i][j] + func(i + 1, x)));
		}
		return dp[i][j] = max;
	}

	public static void main(String[] args) throws Exception {
		MyScanner sc = new MyScanner();
		PrintWriter pr = new PrintWriter(System.out);
		int n = sc.nextInt();
		Vacation a = new Vacation(n);

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

			a.ar[i][0] = sc.nextInt();
			a.ar[i][1] = sc.nextInt();
			a.ar[i][2] = sc.nextInt();

			for (int j = 0; j < 3; j++)
				a.dp[i][j] = -1;
		}

		int x = a.func(0, 0);
		int b = a.func(0, 1);
		int c = a.func(0, 2);
		pr.println(Math.max(x, Math.max(b, c)));
		pr.close();
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

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

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

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			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>//for cin cout endl
#include <cstdlib>//for abs()
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int N;cin>>N;
    for (int i =0 ; i<N;++i){
        for (int j=0;j<3;++j)cin>>a[i][j];
    };

    for (int i=0;i<100010;++i){
        for (int j=0;j<3;++j){
            chmax(dp[i+1][0],dp[i][1]+a[i][0]);
            chmax(dp[i+1][0],dp[i][2]+a[i][0]);
            chmax(dp[i+1][1],dp[i][0]+a[i][1]);
            chmax(dp[i+1][1],dp[i][2]+a[i][1]);
            chmax(dp[i+1][2],dp[i][0]+a[i][2]);
            chmax(dp[i+1][2],dp[i][1]+a[i][2]);
        }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:41:46: error: expected ';' before '}' token
   41 |     for (int i=0;i<3;++i){chmax(res,dp[N][i])};
      |                                              ^
      |                                              ;
Language: C++

#include <iostream>//for cin cout endl
#include <cstdlib>//for abs()
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    int N;cin>>N;
    for (int i =0 ; i<N;++i){
        for (int j=0;j<3;++j)cin>>a[i][j];
    };

    for (int i=0;i<100010;++i){
        for (int j=0;j<3;++j){
            chmax(dp[i+1][0],dp[i][1]+a[i][0]);
            chmax(dp[i+1][0],dp[i][2]+a[i][0]);
            chmax(dp[i+1][1],dp[i][0]+a[i][1]);
            chmax(dp[i+1][1],dp[i][2]+a[i][1]);
            chmax(dp[i+1][2],dp[i][0]+a[i][2]);
            chmax(dp[i+1][2],dp[i][1]+a[i][2]);
        }

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

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

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

const int inf = 1e9+5;
int main(void)
{
	int n;
	scanf("%d",&n);
	vector<int> dp(3);
	for(int day=0;day<n;day++){
		vector<int> c(3);
		vector<int> pd(3,0);
		for(int j=0;j<3;j++){
			scanf("%d",&c[j]);
		}
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				if(i!=j)
					pd[j] = max(pd[j] , pd[i] + c[j]);
			}
		}
		dp = pd;
	}
	printf("%d\n",max(dp[2],dp[0],dp[1]));
	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:24:19:   required from here
   24 |         printf("%d\n",max(dp[2],dp[0],dp[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;
#define ll long long int

ll dp_BU[100000][3]={0};

ll vacay_BU(vector<vector<int> >v,int N){
    dp[0][0]=v[0][0];
    dp[0][1]=v[0][1];
    dp[0][2]=v[0][2];
    for(int i=1;i<N;i++){
        dp[i][0]=v[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=v[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=v[i][2]+max(dp[i-1][0],dp[i-1][1]);
    }
    return max(dp[N-1][0],max(dp[N-1][1],dp[N-1][2]));
}

int main(){
    
    int N,temp;
    cin>>N;
    vector<vector<int> > happiness(N);
    for(int i=0;i<N;i++){
        for(int j=0;j<3;j++){
            cin>>temp;
            happiness[i].push_back(temp);
        }
    }
    cout<<vacay_BU(happiness,N);
}

Compiler output:
a.cc: In function 'long long int vacay_BU(std::vector<std::vector<int> >, int)':
a.cc:8:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
    8 |     dp[0][0]=v[0][0];
      |     ^~
      |     dup
Language: C++

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

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


int main() {
    int n;cin>>n;
    ll a[100010][3];
    ll dp[100010][3];
    rep(i,n)rep(j,3) cin>>a[i][j];

    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;

}


Compiler output:
a.cc:11:9: warning: ISO C++11 requires whitespace after the macro name
   11 | #define P=pair<int,int>;
      |         ^
a.cc: In function 'int main()':
a.cc:23:58: error: 'i' was not declared in this scope
   23 |     rep(i,n)rep(j,3)rep(k,3) if(j==k) continue; chmax(dp[i+1][k], dp[i][j]+ a[i][k]);
      |                                                          ^
a.cc:23:63: error: 'k' was not declared in this scope
   23 |     rep(i,n)rep(j,3)rep(k,3) if(j==k) continue; chmax(dp[i+1][k], dp[i][j]+ a[i][k]);
      |                                                               ^
a.cc:23:73: error: 'j' was not declared in this scope
   23 |     rep(i,n)rep(j,3)rep(k,3) if(j==k) continue; chmax(dp[i+1][k], dp[i][j]+ a[i][k]);
      |                                                                         ^
Language: C++

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

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


int main() {
    int n;cin>>n;
    ll a[100010][3];
    ll dp[100010][3];
    rep(i,n)rep(j,3) cin>>a[i][j];

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

    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;

}

Compiler output:
a.cc:11:9: warning: ISO C++11 requires whitespace after the macro name
   11 | #define P=pair<int,int>;
      |         ^
a.cc: In function 'int main()':
a.cc:24:15: error: conflicting declaration 'long long int dp [100010]'
   24 |     long long dp[100010];
      |               ^~
a.cc:20:8: note: previous declaration as 'll dp [100010][3]'
   20 |     ll dp[100010][3];
      |        ^~
a.cc:26:58: error: 'i' was not declared in this scope
   26 |     rep(i,n)rep(j,3)rep(k,3) if(j==k) continue; chmax(dp[i+1][k], dp[i][j]+ a[i][k]);
      |                                                          ^
a.cc:26:63: error: 'k' was not declared in this scope
   26 |     rep(i,n)rep(j,3)rep(k,3) if(j==k) continue; chmax(dp[i+1][k], dp[i][j]+ a[i][k]);
      |                                                               ^
a.cc:26:73: error: 'j' was not declared in this scope
   26 |     rep(i,n)rep(j,3)rep(k,3) if(j==k) continue; chmax(dp[i+1][k], dp[i][j]+ a[i][k]);
      |                                                                         ^
Language: C++

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

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
    2 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin >> n;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:10: error: 'd' was not declared in this scope; did you mean 'dp'?
    9 |   cin >> d[0] >> dp[1] >> dp[2];
      |          ^
      |          dp
a.cc:13:21: error: 'max' was not declared in this scope; did you mean 'std::max'?
   13 |     dp[0] = dp[0] + max(b,c);
      |                     ^~~
      |                     std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:17:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   17 |   cout << max(dp[0], max(dp[2], dp[2])) << "\n";
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:17:22: error: 'max' was not declared in this scope; did you mean 'std::max'?
   17 |   cout << max(dp[0], max(dp[2], dp[2])) << "\n";
      |                      ^~~
      |                      std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:17:11: error: 'max' was not declared in this scope; did you mean 'std::max'?
   17 |   cout << max(dp[0], max(dp[2], dp[2])) << "\n";
      |           ^~~
      |           std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include <iostream>
#include<map>
#include<vector>
#include<algorithm>
#include <stdio.h>
#include<set>
#include<string>
#include<unordered_map>
#include<math.h>
#include<cmath>
#include<iomanip>
#include<queue>
#include<stack>
#include<bitset>
#define ll long long 
using namespace std;
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

int arr[100005][3];
int n;
ll dp[100005][3];
ll fun(int day, int pre) {
	if (day == n + 1)
		return 0;
	if (dp[day][pre] != -1)
		return dp[day][pre];
	if (pre == 1)
		return dp[day][pre]=max(arr[day][2] + fun(day + 1, 2), arr[day][3] + fun(day + 1, 3));
	if (pre == 2)
		return dp[day][pre] = max(arr[day][1] + fun(day + 1, 1), arr[day][3] + fun(day + 1, 3));
	if (pre == 3)
		return dp[day][pre] = max(arr[day][1] + fun(day + 1, 1), arr[day][2] + fun(day + 1, 2));
}
int main()
{
	  cin >> n;
	  for (int i = 1; i <= n; i++)
		  for (int j= 1;j<= 3; j++)
			  cin >> arr[i][j];
	  memset(dp, -1, sizeof dp);
	  cout<< max({ arr[1][1]+fun(2,1),arr[1][2]+fun(2,2),arr[1][3]+fun(2,3) });

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:11: error: 'memset' was not declared in this scope
   40 |           memset(dp, -1, sizeof dp);
      |           ^~~~~~
a.cc:15:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   14 | #include<bitset>
  +++ |+#include <cstring>
   15 | #define ll long long
a.cc: In function 'long long int fun(int, int)':
a.cc:33:1: warning: control reaches end of non-void function [-Wreturn-type]
   33 | }
      | ^
Language: C++

/*Author : Hrishi*/

/*When I wrote this, only God and I understood what I was doing.
Now, only God knows.*/

#include <bits/stdc++.h>

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int,int>
#define pl pair<ll,ll> 
#define ff first
#define ss second
#define PB push_back
#define F(i,L,R) for(auto i=L; i<R ;i++)
#define FR(i,R,L) for(auto i=R;i>L;i--)
#define all(x) (x).begin(),(x).end()
#define show(x) cout<<(#x)<<" = "<<(x)<<"\n";
#define show2(x,y) cout<<(#x)<<" = "<<(x)<<" & "<<(#y)<<" = "<<(y)<<"\n";
#define show3(x,y,z) cout<<(#x)<<" = "<<(x)<<" & "<<(#y)<<" = "<<(y)<<" & "<<(#z)<<" = "<<(z)<<"\n";
#define endln "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define M 1000000007

using namespace std;

ll arr[100005][3];
ll dp[100005][3];

int main() 
{
	fastio;
	int n;
	cin>>n;
	F(i,0,n)
	    cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	    
    F(i,0,3)
        dp[0][i] = arr[0][i];
        
    F(i,1,n)
    {
        dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + arr[i][0];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + arr[i][1];
        dp[i][2] = max(dp[i-1][0],dp[i-1][1]) + arr[i][2];
    }
    cout<<max(dp[n-1][0],dp[n-1][1],dp[n-1][2]);

}




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:6:
/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:48:14:   required from here
   48 |     cout<<max(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

int nilai(int kue[][3],int n)
	{
  		int i,j;
  		int sum;
  		int tidak; 
		for(i=0;i<n;i++)
        	{
        		if(i==0)
                	{
                  		sum=max(kue[i][0],kue[i][1],kue[i][2]);
                  		for(int j=0;j<3;j++)
                        	{
                          		if(kue[i][j]==sum){tidak=j;break;}
                        	}
                	}
          		else
                	{
                  		int banding=INT_MIN;int cek_tidak=INT_MIN;
                		for(int j=0;j<3;j++)
                        	{
                          		if(j!=tidak)
                                	{	
                                  		banding=max(banding,kue[i][j]);	
                                    	if(banding==kue[i][j])cek_tidak=j;
                                	}
                        	}
                  		tidak=cek_tidak;
                  		sum+=banding;
                	}
        	}
 		return sum;
	}	

int main()
	{
		
  		int a,b,c,t;
  		cin>>t;
  		int data[t][3];
  		for(int mul=0;mul<t;mul++)
        	{
        		cin>>a>>b>>c;
          		data[mul][0]=a;
          		data[mul][1]=b;
                data[mul][2]=c;
        	}
  		cout<<nilai(data,t);
	}

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:13:28:   required from here
   13 |                                 sum=max(kue[i][0],kue[i][1],kue[i][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;

const int size=100000;

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

	int a[size][3]={};dp[size][3]={0};

	for (int i = 0; i < n; i++)
	{
		for(int j=0;j<3;j++)
		cin>>a[i][j];
	}

	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	int cur;
	for (int i = 1; i < n; i++)
	{
		for(int j=0;j<3;j++){
			dp[i][j]=INT_MIN;
			for(int k=0;k<3;k++){
				if(j==k) continue;
				dp[i][j]=max (dp[i][j],dp[i-1][k]+ a[i][j]);
			}
		}
	}
	
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:11:15: error: reference to 'size' is ambiguous
   11 |         int a[size][3]={};dp[size][3]={0};
      |               ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:4:11: note:                 'const int size'
    4 | const int size=100000;
      |           ^~~~
a.cc:11:27: error: 'dp' was not declared in this scope; did you mean 'dup'?
   11 |         int a[size][3]={};dp[size][3]={0};
      |                           ^~
      |                           dup
a.cc:11:30: error: reference to 'size' is ambiguous
   11 |         int a[size][3]={};dp[size][3]={0};
      |                              ^~~~
/usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
  272 |     size(const _Tp (&)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note:                 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
  262 |     size(const _Container& __cont) noexcept(noexcept(__cont.size()))
      |     ^~~~
a.cc:4:11: note:                 'const int size'
    4 | const int size=100000;
      |           ^~~~
a.cc:16:22: error: 'a' was not declared in this scope
   16 |                 cin>>a[i][j];
      |                      ^
a.cc:19:18: error: 'a' was not declared in this scope
   19 |         dp[0][0]=a[0][0];
      |                  ^