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

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

int helper(int arr[][3],int n,int i,int state,int dp[][3])
{
  if(i==n)
  return 0;
  if(dp[i][state]!=-1)
  return dp[i][state];

  int MAX=INT_MIN;
  for(int j=0;j<3;j++)
  {
    if(j!=state)
    {
      MAX=max(MAX,helper(arr,n,i+1,j,dp));
    }
  }

  return dp[i][state]=arr[i][state]+MAX;

}
 
int main()
{
   int m,n;
   cin>>n;
   int arr[n][3];
   for(int i=0;i<n;i++)
   {
     for(int j=0;j<3;j++)
     cin>>arr[i][j];
   }
   int dp[n][3];
   memset(dp,-1,sizeof(dp));
    cout<<max(helper(arr,n,0,0,dp),max(helper(arr,n,0,1,dp),helper(arr,n,0,2,dp)));



    return 0;
}

Compiler output:
a.cc: In function 'int helper(int (*)[3], int, int, int, int (*)[3])':
a.cc:14:11: error: 'INT_MIN' was not declared in this scope
   14 |   int MAX=INT_MIN;
      |           ^~~~~~~
a.cc:5:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<string.h>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:50: error: expected ']' before ')' token
   17 |     cout<<max(dp[0][n-1],max(dp[1][n-1],dp[2][n-1));
      |                                                  ^
      |                                                  ]
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:29:78: error: expected '}' at end of input
   29 |     cout << max(maxi[n - 1][0], max(maxi[n - 1][1], maxi[n - 1][2])) << "\n";
      |                                                                              ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:30:78: error: expected '}' at end of input
   30 |     cout << max(maxi[n - 1][0], max(maxi[n - 1][1], maxi[n - 1][2])) << "\n";
      |                                                                              ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include <iostream>
using namespace std;
struct Day{
    long long a,b,c;
    void set(Day &d){
        this->a = d.a;
        this->b = d.b;
        this->c = d.c;
    }
};

int main() {

    int n;
   scanf("%d", &n);
    Day dp[2];
    Day a[2];
    
	scanf("%lld%lld%lld", &a[0].a , &a[0].b , &a[0].c);
    dp[0].set(a[0]);

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


Compiler output:
a.cc: In function 'int main()':
a.cc:28:72: error: expected ')' before ';' token
   28 |     printf("%lld",max(dp[(n-1)%2].a, max(dp[(n-1)%2].b, dp[(n-1)%2].c));
      |           ~                                                            ^
      |                                                                        )
Language: C++

#include <iostream>
using namespace std;
struct Day{
    long long a,b,c;
    void set(long long a=0, long long b=0, long long c=0){
        this->a = a;
        this->b = b;
        this->c = c;
    }
    void set(Day &d){
        this->a = d.a;
        this->b = d.b;
        this->c = d.c;
    }
};

int main() {
    Day *dp, *a;
    int n;
   scanf("%d", &n);
    dp = new Day[2];
    a = new Day[2];
    
	scanf("%lld%lld%lld", &a[0].a , &a[0].b , &a[0].c);
    dp[0].set(a[0]);

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


Compiler output:
a.cc: In function 'int main()':
a.cc:33:12: error: unable to find string literal operator 'operator""max' with 'const char [5]', 'long unsigned int' arguments
   33 |     printf("%lld"max(dp[(n-1)%2].a, max(dp[(n-1)%2].b, dp[(n-1)%2].c));
      |            ^~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
#define ll long long int
#define mod 1e9+7
ll maxPoints(int n) {
	int a, b, c;

	ll* dp = new ll[n + 1];
	cin >> a >> b >> c;
	string last;
	dp[1] = max(a, max(b, c));
	dp[1] == a ? last = "a" : dp[1] == b ? last = "b" : last = "c";

	for (int i = 2; i <= n; i++) {
		cin >> a >> b >> c;
		if (last == "a") {
			dp[i] = max(b, c);
			dp[i] == b ? last = "b" : last = "c";
		}
		else if (last == "b") {
			dp[i] = max(a, c);
			dp[i] == a ? last = "a" : last = "c";
		}
		else {
			dp[i] = max(a, b);
			dp[i] == a ? last = "a" : last = "b";
		}
		dp[i] = ((dp[i] % mod) + (dp[i - 1] % mod)) % mod;
	}
	return dp[n];
}


int main() {
	int n;
	cin >> n;
	cout << maxPoints(n) << endl;

}

Compiler output:
a.cc: In function 'long long int maxPoints(int)':
a.cc:28:33: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   28 |                 dp[i] = ((dp[i] % mod) + (dp[i - 1] % mod)) % mod;
      |                           ~~~~~ ^
      |                               |
      |                               long long int
a.cc:28:53: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   28 |                 dp[i] = ((dp[i] % mod) + (dp[i - 1] % mod)) % mod;
      |                                           ~~~~~~~~~ ^
      |                                                   |
      |                                                   long long int
Language: Java

import java.util.Scanner;
public class atcoder{
	
	
	private static Scanner sc=new Scanner(System.in);
	
	private static int dp[][];
	
	public static int maxHappiness(int arr[][],int day,int act){
		if(day>=arr.length)
			return 0;
		
		if(dp[day][act]!=0)
			return dp[day][act];
		
		int curHappiness=Integer.MIN_VALUE;
		
		for(int i=0;i<3;i++){
			if(i==act)
				continue;
			curHappiness=Math.max(curHappiness,maxHappiness(arr,day+1,i)+arr[day][i]);
		}
		dp[day][act]=curHappiness;
		return curHappiness;
		
	}
	
	
	public static void main(String []args){
		
		int n=sc.nextInt();
		int arr[][]=new int[n][3];
		dp=new int[n][3];
		for(int i=0;i<n;i++){
			arr[i][0]=sc.nextInt();
			arr[i][1]=sc.nextInt();
			arr[i][2]=sc.nextInt();			
		}
		
	
		
		int a=maxHappiness(arr,1,0)+arr[0][0];
		int b=maxHappiness(arr,1,1)+arr[0][1];
		int c=maxHappiness(arr,1,2)+arr[0][2];
		
		System.out.println(Math.max(a,Math.max(b,c)));
		
	}
}

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

#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n][3];
	for(int i=0;i<n;i++)
		for(int j=0;j<3;j++)
			cin>>a[i][j];
	for(int i=1;i<n;i++)
		for(int j=0;j<3;j++)
			a[i][j] = a[i][j]+max(a[i-1][(j+1)%3],a[i-1][(j+2)%3]);
	int maxi = INT_MIN;
	for(int i = 0;i<3;i++)
		maxi = max(maxi,a[n-1][i]);
	cout<<maxi<<endl;
	return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
int dp[100005][3];
struct abc{
  int a,b,c;
};
int solve(abc ar[],int n){
//base case
 dp[1][0]=ar[1].a;
 dp[1][1]=ar[1].b; 
 dp[1][2]=ar[1].c;

for(int i=2;i<=n;i++){
  dp[i][0]=ar[i].a+max(dp[i-1][1],dp[i-1][2]);
  dp[i][1]=ar[i].a+max(dp[i-1][0],dp[i-1][2]);
  dp[i][2]=ar[i].a+max(dp[i-1][0],dp[i-1][1]);
 }
  return max(dp[n][0],dp[n][0],dp[n][0]);
}
int main(){
   memset(dp, 0, sizeof(dp)); 
  int n;
  cin>>n;
  struct abc ar[n+1];
  for(int i=1;i<n;i++)
    cin>>ar[i].a>>ar[i].b>>ar[i].c;

  cout<<solve(ar,n);

  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:18:13:   required from here
   18 |   return max(dp[n][0],dp[n][0],dp[n][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>
using namespace std;
int dp[100005][3];
struct abc{
  int a,b,c;
};
int solve(abc ar[],int n){
//base case
 dp[1][0]=ar[i].a;
 dp[1][1]=ar[i].b; 
 dp[1][2]=ar[i].c;

for(int i=2;i<=n;i++){
  dp[i][0]=ar[i].a+max(dp[i-1][1],dp[i-1][2]);
  dp[i][1]=ar[i].a+max(dp[i-1][0],dp[i-1][2]);
  dp[i][2]=ar[i].a+max(dp[i-1][0],dp[i-1][1]);
 }
  return max(dp[n][0],dp[n][0],dp[n][0]);
}
int main(){
   memset(dp, 0, sizeof(dp)); 
  int n;
  cin>>n;
  struct abc ar[n+1];
  for(int i=1;i<n;i++)
    cin>>ar[i].a>>ar[i].b>>ar[i].c;

  cout<<solve(ar,n);

  return 0;
  
}


Compiler output:
a.cc: In function 'int solve(abc*, int)':
a.cc:9:14: error: 'i' was not declared in this scope
    9 |  dp[1][0]=ar[i].a;
      |              ^
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:18:13:   required from here
   18 |   return max(dp[n][0],dp[n][0],dp[n][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>
using namespace std;
int dp[100005][3];
struct abc{
  int a,b,c;
};
int solve(abc ar[],int n){
//base case
 dp[1][0]=ar[i].a;
 dp[1][1]=ar[i].b; 
 dp[1][2]=ar[i].c;

for(int i=2;i<=n;i++){
  dp[i][0]=ar[i].a+max(dp[i-1][1],dp[i-1][2]);
  dp[i][1]=ar[i].a+max(dp[i-1][0],dp[i-1][2]);
  dp[i][2]=ar[i].a+max(dp[i-1][0],dp[i-1][1]);
 }
  return max(dp[n][0],dp[n][0],dp[n][0])
}
int main(){
   memset(dp, 0, sizeof(dp)); 
  int n;
  cin>>n;
  struct abc ar[n+1];
  for(int i=1;i<n;i++)
    cin>>ar[i].a>>ar[i].b>>ar[i].c;

  cout<<solve(ar,n);

  return 0;
  
}


Compiler output:
a.cc: In function 'int solve(abc*, int)':
a.cc:9:14: error: 'i' was not declared in this scope
    9 |  dp[1][0]=ar[i].a;
      |              ^
a.cc:18:41: error: expected ';' before '}' token
   18 |   return max(dp[n][0],dp[n][0],dp[n][0])
      |                                         ^
      |                                         ;
   19 | }
      | ~                                        
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:18:13:   required from here
   18 |   return max(dp[n][0],dp[n][0],dp[n][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: Java

import java.io.*;
import java.util.*;
public class Main{
  	/*public int minRec(int a[],int dp[],int i,int j)
    {
      if(i==n && j==n)
        	return dp[n][n];
      if(
        return Math.min( Math.abs(a[]
    }*/
	public static void main(String args[]) throws IOException{
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();

      int arr[][]=new int[n][3];
      
      for(int i=0; i<n; i++)
        for(int j=0; j<3; j++)
        	arr[i][j]=sc.nextInt();
      
      int dp[][] =  new int[n][3];
      Arrays.fill(dp, Integer.MIN_VALUE);
      
      System.out.println(maxHappiness(arr, 0, -1, dp));
      
    }
  
  public static int maxHappiness(int arr[][], int pos, int prevSelected, int dp[][]){
  	if(pos >= arr.length)
      return 0;
    
    if(dp[pos][prevSelected] != Integer.MIN_VALUE)
      return dp[pos][prevSelected]
    
    int max = Integer.MIN_VALUE;
    
    for(int i=0;i<3; i++){
         if(i != prevSelected && max < arr[pos][i])
           max = Math.max(max,arr[pos][i] + maxHappiness(arr, pos+1,i,dp ));
    }
    
    if(prevSelected != -1)
       	dp[pos][prevSelected] = max;
    
    return max;
    
  }
}


Compiler output:
Main.java:33: error: ';' expected
      return dp[pos][prevSelected]
                                  ^
1 error
Language: C++

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

int maxHappiness(vector<vector<int>> &happiness){
    int days= happiness.size();
    int activities = happiness[0].size();
for(int j=0;j<activities;j++){
        dp[0][j] = happiness[0][j];
    }
        for(int i=1; i<days; i++){
        for(int j=0;j<activities;j++){
int maxAns = INT_MIN;
    for(int k=0;k<activities;k++){
        if(k!=j) maxAns = max(dp[i-1][k], maxAns);
}
dp[i][j] = happiness[i][j] + maxAns;
}
    }
    int ans = INT_MIN;
    for(int i=0;i<activities;i++){
        ans = max(ans, dp[days-1][i]);
    }
    return ans;
}

int main(){
 int n;
        cin>>n;
        vector<vector<int>> happiness(n, vector<int>(3));
        vector<vector<int>> dp(n, vector<int>(3, -1));
        for(int i=0; i<n; i++){
                for(int j=0; j<3; j++){
                cin>>happiness[i][j];
}
        }
    cout<<maxHappiness(happiness)<<endl;

}







Compiler output:
a.cc: In function 'int maxHappiness(std::vector<std::vector<int> >&)':
a.cc:8:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
    8 |         dp[0][j] = happiness[0][j];
      |         ^~
      |         dup
a.cc:14:31: error: 'dp' was not declared in this scope; did you mean 'dup'?
   14 |         if(k!=j) maxAns = max(dp[i-1][k], maxAns);
      |                               ^~
      |                               dup
a.cc:16:1: error: 'dp' was not declared in this scope; did you mean 'dup'?
   16 | dp[i][j] = happiness[i][j] + maxAns;
      | ^~
      | dup
a.cc:21:24: error: 'dp' was not declared in this scope; did you mean 'dup'?
   21 |         ans = max(ans, dp[days-1][i]);
      |                        ^~
      |                        dup
Language: C++

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

int maxHappiness(vector<vector<int>> &happiness){
for(int j=0;j<happiness[0].size();j++){
        dp[0][j] = happiness[0][j];
    }
        for(int i=1; i<happiness.size(); i++){
        for(int j=0;j<happiness[0].size();j++){
int maxAns = INT_MIN;
    for(int k=0;k<3;k++){
        if(k!=j) maxAns = max(dp[i-1][k], maxAns);
}
dp[i][j] = happiness[i][j] + maxAns;
}
    }
    int ans = INT_MIN;
    for(int i=0;i<3;i++){
        ans = max(ans, dp[n-1][i]);
    }
    return ans;
}

int main(){
 int n;
        cin>>n;
        vector<vector<int>> happiness(n, vector<int>(3));
        vector<vector<int>> dp(n, vector<int>(3, -1));
        for(int i=0; i<n; i++){
                for(int j=0; j<3; j++){
                cin>>happiness[i][j];
}
        }
    cout<<maxHappiness(happiness)<<endl;

}







Compiler output:
a.cc: In function 'int maxHappiness(std::vector<std::vector<int> >&)':
a.cc:6:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
    6 |         dp[0][j] = happiness[0][j];
      |         ^~
      |         dup
a.cc:12:31: error: 'dp' was not declared in this scope; did you mean 'dup'?
   12 |         if(k!=j) maxAns = max(dp[i-1][k], maxAns);
      |                               ^~
      |                               dup
a.cc:14:1: error: 'dp' was not declared in this scope; did you mean 'dup'?
   14 | dp[i][j] = happiness[i][j] + maxAns;
      | ^~
      | dup
a.cc:19:24: error: 'dp' was not declared in this scope; did you mean 'dup'?
   19 |         ans = max(ans, dp[n-1][i]);
      |                        ^~
      |                        dup
a.cc:19:27: error: 'n' was not declared in this scope
   19 |         ans = max(ans, dp[n-1][i]);
      |                           ^
Language: C++

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

int maxHappiness(vector<vector<int>> &happiness,vector<vector<int>> &dp, int days, int activity){
   if(dp[days][activity] !=-1){
      return dp[days][activity];
   }
    if(days == 0){
        dp[days][activity] = happiness[0][activity];
        return happiness[0][activity];
    }
    int maxPast = INT_MIN;
    for(int i=0;i <3; i++){
        if(i != activity){
            maxPast = max(maxHappiness(happiness,days -1, i), maxPast);
        }
    }
    dp[days][activity] = happiness[days][activity] + maxPast;
    return dp[days][activity];
}
int main(){
    int n;
    cin>>n;
    vector<vector<int>> happiness(n, vector<int>(3));
    vector<vector<int>> dp(n, vector<int>(3, -1));
    for(int i=0; i<n; i++){
        for(int j=0; j<3; j++){
            cin>>happiness[i][j];
}
    }
    
    int ans = INT_MIN;
    for(int i=0; i<3; i++){
        int x = maxHappiness(happiness, dp, n-1, i);
        ans = max(ans, x);
}
cout<<ans<<endl;
return 0;
}







Compiler output:
a.cc: In function 'int maxHappiness(std::vector<std::vector<int> >&, std::vector<std::vector<int> >&, int, int)':
a.cc:15:55: error: invalid initialization of non-const reference of type 'std::vector<std::vector<int> >&' from an rvalue of type 'int'
   15 |             maxPast = max(maxHappiness(happiness,days -1, i), maxPast);
      |                                                  ~~~~~^~
a.cc:4:70: note: in passing argument 2 of 'int maxHappiness(std::vector<std::vector<int> >&, std::vector<std::vector<int> >&, int, int)'
    4 | int maxHappiness(vector<vector<int>> &happiness,vector<vector<int>> &dp, int days, int activity){
      |                                                 ~~~~~~~~~~~~~~~~~~~~~^~
Language: C++

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

int maxHappiness(vector<vector<int>> &happiness, int days, int activity){
    if(days == 0){
        return happiness[0][activity];
}
    int pastMaxHappiness = INT_MIN;
    for(int i=0;i <3; i++){
        if(i != activity){
            int pastMaxHappiness = max(maxHappiness, days -1, i);
        }
    }
    return happiness[days][activity] + pastMaxHappiness;
}
int main(){
    int n;
    cin>>n;
    vector<vector<int>> happiness;
    for(int i=0; i<n; i++){
        for(int j=0; j<3; j++){
            cin>>happiness[i][j];
}
    }
    
    int ans = INT_MIN;
    for(int i=0; i<3; i++){
        ans = max(ans, maxHappiness(happiness, n-1, i));
}
return ans;
}


Compiler output:
a.cc: In function 'int maxHappiness(std::vector<std::vector<int> >&, int, int)':
a.cc:11:39: error: no matching function for call to 'max(int (&)(std::vector<std::vector<int> >&, int, int), int, int&)'
   11 |             int pastMaxHappiness = max(maxHappiness, days -1, i);
      |                                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 3 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:   template argument deduction/substitution failed:
a.cc:11:39: note:   deduced conflicting types for parameter 'const _Tp' ('int(std::vector<std::vector<int> >&, int, int)' and 'int')
   11 |             int pastMaxHappiness = max(maxHappiness, days -1, i);
      |                                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 3 provided
Language: C++

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

void foo(vector<vector<int>> &vec, vector<vector<int>> &dp) {
  int n = vec.size();
  dp[1][0] = arr[1][0];
  dp[1][1] = arr[1][1];
  dp[1][2] = arr[1][2];
  int mx = 0;
  for (int i = 2; i < n; i++) {
    dp[i][0] = vec[i][0] + max(dp[i-1][1], dp[i-1][2]);
    dp[i][1] = vec[i][1] + max(dp[i-1][0], dp[i-1][2]);
    dp[i][2] = vec[i][2] + max(dp[i-1][0], dp[i-1][1]);
    mx = max(dp[i][0], max(dp[i][1], dp[i][2]));
  }
  cout << mx;
}

int main() {
  int n;
  cin >> n;
  vector<vector<int>> vec(n + 1, vector<int>(3, 0));
  vector<vector<int>> dp(n + 1, vector<int>(3, 0));
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> vec[i][j];
    }
  }
  foo(vec, dp);
  return 0;
}


Compiler output:
a.cc: In function 'void foo(std::vector<std::vector<int> >&, std::vector<std::vector<int> >&)':
a.cc:6:14: error: 'arr' was not declared in this scope
    6 |   dp[1][0] = arr[1][0];
      |              ^~~
Language: C++

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

void foo(vector<vector<int>> &vec, vector<vector<int>> &dp) {
  int n = vec.size();
  dp[1][0] = arr[1][0];
  dp[1][1] = arr[1][1];
  dp[1][2] = arr[1][2];
  int mx = 0;
  for (int i = 2; i <= n; i++) {
    dp[i][0] = vec[i][0] + max(dp[i-1][1], dp[i-1][2]);
    dp[i][1] = vec[i][1] + max(dp[i-1][0], dp[i-1][2]);
    dp[i][2] = vec[i][2] + max(dp[i-1][0], dp[i-1][1]);
    mx = max(dp[i][0], max(dp[i][1], dp[i][2]));
  }
  cout << mx;
}

int main() {
  int n;
  cin >> n;
  vector<vector<int>> vec(n + 1, vector<int>(3, 0));
  vector<vector<int>> dp(n + 1, vector<int>(3, 0));
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> vec[i][j];
    }
  }
  foo(vec, dp);
  return 0;
}

Compiler output:
a.cc: In function 'void foo(std::vector<std::vector<int> >&, std::vector<std::vector<int> >&)':
a.cc:6:14: error: 'arr' was not declared in this scope
    6 |   dp[1][0] = arr[1][0];
      |              ^~~
Language: C++

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

int main()
{
  int n,k;
  cin >> n;
  vector<vector<int> > v(n,vector<int>(3));
  for(int i = 0;i<n;i++)
  {
    cin >> v[i][0];
    cin >> v[i][1];
    cin >> v[i][2];
  }
  int a = v[0][0],b= v[0][1],c = v[0][2];
  for(int i = 1;i<n;i++)
  {
    a = v[i][0] + max(b,c);
    b = v[i][1] + max(a,c);
    c = v[i][2] + max(a,b);
  }
  cout << max(a,max(b,c)) << endl
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:34: error: expected ';' before 'return'
   22 |   cout << max(a,max(b,c)) << endl
      |                                  ^
      |                                  ;
   23 |   return 0;
      |   ~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define AC ios::sync_with_stdio(0),cin.tie(0);
const int N=1e5+5;
int a[N][3];
int dp[N][3];
int main(){
	AC
	int n;
	cin>>n;
	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];
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			dp[i][j]=max(dp[i][j]+dp[i-1][(j+1)%3],dp[i][j]+dp[i-1][(j+2)%3],dp[i-1][j]);
		}
	}
	cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<endl;
}


Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:21:16:   required from here
   21 |                         dp[i][j]=max(dp[i][j]+dp[i-1][(j+1)%3],dp[i][j]+dp[i-1][(j+2)%3],dp[i-1][j]);
      |                                  ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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.util.*;
import java.io.*;

public class Main {
   public static void main(String[]abc) {
      Main ans = new Main();
      long solution = ans.solve();
      System.out.println(solution);
   }
  
   private long solve() {
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int [] dp = new int[3];
      int best_a=0, best_b=0, best_c=0;
      for(int i=0;i<N;i++){
         if (i==0) {
            best_a = sc.nextInt();
            best_b = sc.nextInt();
            best_c = sc.nextInt();
         } else {
            best_a = Math.max(dp[0], Math.max(best.b, best.c));
            best_b = Math.max(dp[1], Math.max(best.a, best.c));
            best_c = Math.max(dp[2], Math.max(best.b, best.a));
         }
         dp[0] = best_a;
         dp[1] = best_b;
         dp[2] = best_c;        
      }
      return Math.max(dp[0], Math.max(dp[1], dp[2]));
      
   }
}

Compiler output:
Main.java:22: error: cannot find symbol
            best_a = Math.max(dp[0], Math.max(best.b, best.c));
                                              ^
  symbol:   variable best
  location: class Main
Main.java:22: error: cannot find symbol
            best_a = Math.max(dp[0], Math.max(best.b, best.c));
                                                      ^
  symbol:   variable best
  location: class Main
Main.java:23: error: cannot find symbol
            best_b = Math.max(dp[1], Math.max(best.a, best.c));
                                              ^
  symbol:   variable best
  location: class Main
Main.java:23: error: cannot find symbol
            best_b = Math.max(dp[1], Math.max(best.a, best.c));
                                                      ^
  symbol:   variable best
  location: class Main
Main.java:24: error: cannot find symbol
            best_c = Math.max(dp[2], Math.max(best.b, best.a));
                                              ^
  symbol:   variable best
  location: class Main
Main.java:24: error: cannot find symbol
            best_c = Math.max(dp[2], Math.max(best.b, best.a));
                                                      ^
  symbol:   variable best
  location: class Main
6 errors
Language: Java

 //package cp;
import java.io.*;
import java.math.*;
import java.util.*;
public class Cf_three {
	long gcd(long a,long b) {if(b==0)return a;else return gcd(b,a%b);}
	void swap(long a,long b) {long temp=a;a=b;b=temp;}
	StringBuilder sb=new StringBuilder();
	BigInteger RES=new BigInteger("0");
	//(Initialize as string) - (a.add(b)) - (array initialized with null and not 0)
	Integer[] ARR=new Integer[5];
	//Integer sort-TLE-Initialize object elements i.e a[0].
	void divisor(long n,int start) {
		int cnt=0;for(int i=start;i<=Math.sqrt(n);i++) {
		if(n%i==0) {if(i==n/i)cnt++;else cnt+=2;}}}
	static long[][] dp;
	public static void main(String[] args) throws IOException {	
		PrintWriter out = new PrintWriter(System.out);
		Readers.init(System.in);
		//Cf_three obj=new Cf_three();
		int n=Readers.nextInt();
		long[][] a=new long[n][3];
		dp=new long[n][3];long maxx=0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 3; j++) {
				a[i][j]=Readers.nextLong();
				if(i==0)dp[i][j]=a[i][j];
				else dp[n][j]=a[n][j]+Math.max(dp[n-1][(j+1)%3], dp[n-1][(j+2)%3]);
				maxx=Math.max(maxx, dp[n][j]);
			}
		}
//		System.out.println(Math.max(dp[n-1][0], Math.max(dp[n-1][1], dp[n-1][2])));
		out.flush();
	}
}
class Readers {
 
    static BufferedReader reader;
 
    static StringTokenizer tokenizer;
 
 
 
    /** call this method to initialize reader for InputStream */
 
    static void init(InputStream input) {
 
        reader = new BufferedReader(
 
                     new InputStreamReader(input) );
 
        tokenizer = new StringTokenizer("");
 
    }
 
 
 
    /** get next word */
 
    static String next() throws IOException {
 
        while ( ! tokenizer.hasMoreTokens() ) {
 
            //TODO add check for eof if necessary
 
            tokenizer = new StringTokenizer(
 
                   reader.readLine() );
 
        }
 
        return tokenizer.nextToken();
 
    }
 
 
 
    static int nextInt() throws IOException {
 
        return Integer.parseInt( next() );
 
    }
 
	
 
    static double nextDouble() throws IOException {
 
        return Double.parseDouble( next() );
 
    }
    
    
    static long nextLong() throws IOException{
    	
		return Long.parseLong(next());
	}
 
}

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

// package cp;
import java.io.*;
import java.math.*;
import java.util.*;
public class Cf_three {
	long gcd(long a,long b) {if(b==0)return a;else return gcd(b,a%b);}
	void swap(long a,long b) {long temp=a;a=b;b=temp;}
	StringBuilder sb=new StringBuilder();
	BigInteger RES=new BigInteger("0");
	//(Initialize as string) - (a.add(b)) - (array initialized with null and not 0)
	Integer[] ARR=new Integer[5];
	//Integer sort-TLE-Initialize object elements i.e a[0].
	void divisor(long n,int start) {
		int cnt=0;for(int i=start;i<=Math.sqrt(n);i++) {
		if(n%i==0) {if(i==n/i)cnt++;else cnt+=2;}}}
	static long[][] dp;
	void f(int n,int j,long[][] a) {
		dp[n][j]=a[n][j]+Math.max(dp[n-1][(j+1)%3], dp[n-1][(j+2)%3]);
	}
	public static void main(String[] args) throws IOException {	
		PrintWriter out = new PrintWriter(System.out);
		Readers.init(System.in);
		Cf_three obj=new Cf_three();
		int n=Readers.nextInt();
		long[][] a=new long[n][3];
		dp=new long[n][3];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 3; j++) {
				a[i][j]=Readers.nextLong();
				if(i==0)dp[i][j]=a[i][j];
			}
		}
		for (int i = 1; i < n; i++) {
			for (int j = 0; j < 3; j++) {
				obj.f(i, j,a);
			}
		}
//		System.out.println(Arrays.deepToString(dp));
		System.out.println(Math.max(dp[n-1][0], Math.max(dp[n-1][1], dp[n-1][2])));
		out.flush();
	}
}
class Readers {
 
    static BufferedReader reader;
 
    static StringTokenizer tokenizer;
 
 
 
    /** call this method to initialize reader for InputStream */
 
    static void init(InputStream input) {
 
        reader = new BufferedReader(
 
                     new InputStreamReader(input) );
 
        tokenizer = new StringTokenizer("");
 
    }
 
 
 
    /** get next word */
 
    static String next() throws IOException {
 
        while ( ! tokenizer.hasMoreTokens() ) {
 
            //TODO add check for eof if necessary
 
            tokenizer = new StringTokenizer(
 
                   reader.readLine() );
 
        }
 
        return tokenizer.nextToken();
 
    }
 
 
 
    static int nextInt() throws IOException {
 
        return Integer.parseInt( next() );
 
    }
 
	
 
    static double nextDouble() throws IOException {
 
        return Double.parseDouble( next() );
 
    }
    
    
    static long nextLong() throws IOException{
    	
		return Long.parseLong(next());
	}
 
}

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

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

int main()
{
    ll n;
    cin>>n;
    ll a[n],b[n],c[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    ll dp[n][3];
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(ll 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][2],dp[i-1][0])+b[i];
        dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
    }
    cout<<max(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
    cout<<endl;
    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 = long long int; _Compare = long long int]':
a.cc:24:14:   required from here
   24 |     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<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<math.h>
#include<string>
//#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
using namespace std;

int main()
{
	int n;
	std::cin >> n;
	int** arr = new int*[n];
	for (int i = 0; i < n; i++)
	{
		arr[i] = new int[3];
	}
	for (int i = 0; i<n; i++)
	{
		int a, b, c;
		std::cin >> a >> b >> c;
		arr[i][0] = a;
		arr[i][1] = b;
		arr[i][2] = c;
	}
	int** dp = new int* [n];
	for (int i = 0; i < n; i++)
	{
		dp[i] = new int[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++)
	{
		for (int j = 0; j < 3; j++)
		{   int max=INT_MIN;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:45:29: error: 'INT_MIN' was not declared in this scope
   45 |                 {   int max=INT_MIN;
      |                             ^~~~~~~
a.cc:9:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include<math.h>
  +++ |+#include <climits>
    9 | #include<string>
Language: C++

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

int main()
{
    ll n;
    cin>>n;
    ll a[n],b[n],c[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    ll dp[n][3];
    dp[0][0]=0;
    dp[0][1]=0;
    dp[0][2]=0;
    for(ll 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][2],dp[i-1][0])+b[i];
        dp[i][2]=max(dp[i-1][0],dp[i-1][1])+c[i];
    }
    cout<<max(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
    cout<<endl;
    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 = long long int; _Compare = long long int]':
a.cc:24:14:   required from here
   24 |     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 <iostream>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <bitset>  
using namespace std;

//======================================================
#define for1(i,n)  for (int i = 0; i < (int)(n); ++i)
#define for2(i,n)  for (int i = 1; i <=(int)(n); ++i)
#define forr1(i,n)  for (int i = n - 1 ;i <= 0; --i)
#define forr2(i,n)  for (int i = n  ;i < 0; --i)
#define all(v)	   ((v).begin()), ((v).end())
#define allr(v)	   ((v).rbegin()), ((v).rend())
#define clr(v,d)   memset(v, d, sizeof(v))
#define ull        unsigned long long
#define MP(a,b)	   make_pair(a,b)
#define S          second
#define F          first
#define PI         3.14159265359
#define ll         long long
#define sz(v)	   v.size()
#define pb         push_back
#define pp         pop_back
#define bgn        begin
#define N          100000+5
#define	MOD        1e9+7
#define inf        1e18
//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ull a, ull b, ull ret = 1LL) {
	while (b--) ret = (ret * a);
	return ret;
}
//======================================================

int a[100000+5];
int b[100000+5];
int c[100000+5];


int main()
{
	int n;
	cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		int ai , bi,ci;
		cin >> ai >> bi >> ci;
		a[i] = ai;
		b[i] = bi;
		c[i] = ci;
	}


	for (size_t i1 = 1; i1 < n; i1++)
	{
		for (size_t i2 = 0; i2 < 3; i2++)
		{
			if (i2 == 0)
			{
				a[i1] = max(b[i1-1], c[i1-1]);
			}
			if (i2 == 1)
			{
				b[i1] = max(a[i1 - 1], c[i1 - 1]);

			}
			if (i2 == 2)
			{
				c[i1] = max(a[i1 - 1], b[i1 - 1]);

			}

		}
	}
	cout << max(a[n - 1], b[n - 1], c[n - 1]);


}




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

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

#define ll long long
#define ar array
#define INF INT_MAX

void solve(){
	int n;
	cin>>n;
	int a[n],b[n],c[n],dp[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	dp[0]=max(a[0],b[0],c[0]);
	for (int i = 1; i < n; ++i)
	{
		dp[i]=dp[i-1]+max(a[i],max(b[i],c[i]));
	}
	cout<<dp[n-1]<<endl;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif
	solve();
	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:16:11:   required from here
   16 |         dp[0]=max(a[0],b[0],c[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> 
using namespace std;

#define ll long long
#define ar array
#define INF INT_MAX

void solve(){
	int n;
	cin>>n;
	int a[n],b[n],c[n],dp[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	dp[0]=max(a[0],b[0],c[0]);
	for (int i = 1; i < n; ++i)
	{
		dp[i]=dp[i-1]+max({a[i],b[i],c[i]});
	}
	cout<<dp[n-1]<<endl;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif
	solve();
	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:16:11:   required from here
   16 |         dp[0]=max(a[0],b[0],c[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> 
using namespace std;

#define ll long long
#define ar array
#define INF INT_MAX

void solve(){
	int n;
	cin>>n;
	int a[n],b[n],c[n],dp[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i]>>b[i]>>c[i];
	}
	dp[0]=max(a[0],b[0],c[0]);
	for (int i = 1; i < n; ++i)
	{
		dp[i]=dp[i-1]+max(a[i],b[i],c[i]);
	}
	cout<<dp[n-1]<<endl;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif
	solve();
	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:16:11:   required from here
   16 |         dp[0]=max(a[0],b[0],c[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 <iostream>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <bitset>  
using namespace std;

//======================================================
#define for1(i,n)  for (int i = 0; i < (int)(n); ++i)
#define for2(i,n)  for (int i = 1; i <=(int)(n); ++i)
#define forr1(i,n)  for (int i = n - 1 ;i <= 0; --i)
#define forr2(i,n)  for (int i = n  ;i < 0; --i)
#define all(v)	   ((v).begin()), ((v).end())
#define allr(v)	   ((v).rbegin()), ((v).rend())
#define clr(v,d)   memset(v, d, sizeof(v))
#define ull        unsigned long long
#define MP(a,b)	   make_pair(a,b)
#define S          second
#define F          first
#define PI         3.14159265359
#define ll         long long
#define sz(v)	   v.size()
#define pb         push_back
#define pp         pop_back
#define bgn        begin
#define N          100000+5
#define	MOD        1e9+7
#define inf        1e18
//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ull a, ull b, ull ret = 1LL) {
	while (b--) ret = (ret * a);
	return ret;
}
//======================================================

int a[10001];
int b[10001];
int c[10001];
long long dp[100001][3];
long long  findMin(int index, int type)
{
	if (index == -1)
	{
		return 0;
	}
	if (dp[index][type] != -1)
		return dp[index][type];

	long long r = INT_MIN;
	if (type != 0)
	{
		r = max(findMin(index - 1, 0)+a[index],r);
	}
	if (type != 1)
	{
		r = max(findMin(index - 1, 1)+b[index], r);

	}
	if (type != 2)
	{
		r = max(findMin(index - 1, 2)+c[index], r) ;

	}
	dp[index][type] = r;
	return r;
}



int main()
{
	int n;
	cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		int ai , bi,ci;
		cin >> ai >> bi >> ci;
		a[i] = ai;
		b[i] = bi;
		c[i] = ci;
	}
	for (size_t i1 = 0; i1 < 100001; i1++)
	{
		for (size_t i2 = 0; i2 < 3; i2++)
		{
			dp[i1][i2] = -1;
		}
	}
	cout << findMin(n - 1, -1);

}




Compiler output:
a.cc: In function 'long long int findMin(int, int)':
a.cc:61:23: error: 'INT_MIN' was not declared in this scope
   61 |         long long r = INT_MIN;
      |                       ^~~~~~~
a.cc:13:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include <bitset>
  +++ |+#include <climits>
   13 | using namespace std;
Language: Java

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

public class Vacation {


	public static void main(String[] args) {
		Vacation sol = new Vacation();
		long answer = sol.solve();
		System.out.println(answer);
	}

	private long solve() {

		Scanner sc =new Scanner(System.in);
		int N = sc.nextInt();
		long [] answer = new long[3];		 
		for(int i=0;i<N;i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();

			long temp_a, temp_b, temp_c;
			if (i==0) {
				temp_a = a;
				temp_b = b;
				temp_c = c;
			} else {
				 temp_a = a + Math.max(answer[1], answer[2]);
				 temp_b = b + Math.max(answer[0], answer[2]);
				 temp_c = c + Math.max(answer[0], answer[1]);				 
			}
			answer[0] = temp_a;
			answer[1] = temp_b;
			answer[2] = temp_c;
			//System.out.println(Arrays.toString(answer));
		}

		return Math.max(answer[0], Math.max(answer[1], answer[2]));
 
	}

}

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