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

import java.util.*;

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


Compiler output:
Main.java:16: error: no suitable method found for max(int,int,int)
        	dp[i][0] = Math.max(Math.max(dp[i-1][0], dp[i-1][1], dp[i-1][2])) + Math.max(b[i-1], c[i-1]);
        	                        ^
    method Math.max(int,int) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(long,long) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(float,float) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(double,double) is not applicable
      (actual and formal argument lists differ in length)
Main.java:17: error: no suitable method found for max(int,int,int)
            dp[i][1] = Math.max(Math.max(dp[i-1][1],dp[i-1][0], dp[i-1][2])) + Math.max(a[i-1], c[i-1]);
                                    ^
    method Math.max(int,int) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(long,long) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(float,float) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(double,double) is not applicable
      (actual and formal argument lists differ in length)
Main.java:18: error: no suitable method found for max(int,int,int)
            dp[i][2] = Math.max(Math.max(dp[i-1][2],dp[i-1][1], dp[i-1][0])) + Math.max(b[i-1], a[i-1]);
                                    ^
    method Math.max(int,int) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(long,long) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(float,float) is not applicable
      (actual and formal argument lists differ in length)
    method Math.max(double,double) is not applicable
      (actual and formal argument lists differ in length)
3 errors
Language: Java

import java.util.*

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

Compiler output:
Main.java:1: error: ';' expected
import java.util.*
                  ^
Main.java:8: error: ';' expected
        int a[] = new int[n]
                            ^
2 errors
Language: C

#include<bits/stdc++.h>

using namespace std;

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

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


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

#include <bits/stdc++.h>

using namespace std;

int main(){
  int n;
  cin>>n;
  int a[n];
  int b[n];
  int c[n];
  for(int i=0;i<n;i++){
  	cin>>a[i]>>b[i]>>c[i];
  }
  
  int dpa[n];
  int dpb[n];
  int dpc[n];
  
  dpa[0]=a[0];
  dpb[0]=b[0];
  dpc[0]=c[0];
  
  for(int i=1;i<n;i++){
  	dpa[i]=dpa[i-1]+max(dpb[i-1],dpc[i-1]);
    dpb[i]=dpb[i-1]+max(dpa[i-1],dpc[i-1]);
    dpc[i]=dpc[i-1]+max(dpa[i-1],dpb[i-1]);
  }
  
  cout<<max(dpa[n-1],dpb[n-1],dpc[n-1])<<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:29:12:   required from here
   29 |   cout<<max(dpa[n-1],dpb[n-1],dpc[n-1])<<endl;
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

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

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

int data_a[100000];
int data_b[100000];
int data_c[100000];

int happy_a[100000];
int happy_b[100000];
int happy_c[100000];
int max( int a, int b)
{
	return (a >= b) ? a : b;
}
int main()
{
	int N;
	cin >> N ;
	for(int i=0; i<N; i++){
		cin >> data_a[i] >> data_b[i] >> data_c[i] ;
	}

	happy_a[0]= data_a[0];	
	happy_b[0]= data_b[0];	
	happy_c[0]= data_c[0];	

	for(int i=1; i<N;i++){
		happy_a[i]= max(happy_b[i-1],happy_c[i-1])+data_a[i];
		happy_b[i]= max(happy_c[i-1],happy_a[i-1])+data_b[i];
		happy_c[i]= max(happy_a[i-1],happy_b[i-1])+data_c[i];
	}

	int ans = max(max(happy_a[N-1],happy_b[N-1]),happy_c[N-1]); 
	cout << ans << endl;
	return 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'cin' was not declared in this scope
   15 |         cin >> N ;
      |         ^~~
a.cc:31:9: error: 'cout' was not declared in this scope
   31 |         cout << ans << endl;
      |         ^~~~
a.cc:31:24: error: 'endl' was not declared in this scope
   31 |         cout << ans << endl;
      |                        ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
int data_a[10000];
int data_b[10000];
int data_c[10000];

int happy_a[10000];
int happy_b[10000];
int happy_c[10000];
int max( int a, int b)
{
	return (a >= b) ? a : b;
}
void main()
{
	int N;
	cin >> N ;
	for(int i=0; i<N; i++){
		cin >> data_a[i] >> data_b[i] >> data_c[i] ;
	}

	happy_a[0]= data_a[0];	
	happy_b[0]= data_b[0];	
	happy_c[0]= data_c[0];	

	for(int i=1; i<N;i++){
		happy_a[i]= max(happy_b[i-1],happy_c[i-1])+data_a[i];
		happy_b[i]= max(happy_c[i-1],happy_a[i-1])+data_b[i];
		happy_c[i]= max(happy_a[i-1],happy_b[i-1])+data_c[i];
	}

	int ans = max(max(happy_a[N-1],happy_b[N-1]),happy_c[N-1]); 
	cout << ans << endl;
}

Compiler output:
a.cc:16:1: error: '::main' must return 'int'
   16 | void main()
      | ^~~~
Language: C++

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

ll a[100005], b[100005], c[100005];
ll cache[100005][3] = {-1};

ll dp(ll n, ll x){
	if(n == 0){
	if(x == 1)
	return cache[n][x] = max(a[n], c[n]);
	else if(x == 0)
	return cache[n][x] = max(b[n], c[n]);
	else
	return cache[n][x] = max(a[n], b[n]);
	}
	if(cache[n][x])
	return cache[n][x];
	if(x == 4)
    return cache[n][x] = max(a[n]+dp(n-1, 0), max(b[n]+dp(n-1, 1), c[n]+dp(n-1, 2)))
	else if(x == 0)
	return cache[n][x] =  max(b[n]+dp(n-1, 1), c[n]+dp(n-1, 2));
	else if(x == 1)
	return cache[n][x] = max(a[n]+dp(n-1, 0), c[n]+dp(n-1, 2));
	else
	return cache[n][x] = max(a[n]+dp(n-1, 0), b[n]+dp(n-1, 1));
}

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

Compiler output:
a.cc: In function 'long long int dp(long long int, long long int)':
a.cc:20:85: error: expected ';' before 'else'
   20 |     return cache[n][x] = max(a[n]+dp(n-1, 0), max(b[n]+dp(n-1, 1), c[n]+dp(n-1, 2)))
      |                                                                                     ^
      |                                                                                     ;
   21 |         else if(x == 0)
      |         ~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,j,dp[2],max=0,in=0,c=0,sum=0;
	cin>>n;
	int a[n][3];
	for(i=0;i<n;i++)
	{
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<3;j++)
		{
			if(a[i][j]>max && i%2==0)
			{
				max=a[i][j];
				in=j;
			}
			else if(a[i][j]>max && j!=dp[0])
			{
				max=a[i][j];
				in=j;
			}
		}
		dp[0]=in;
		sum=sum+max;
		max=0;
	}
	cout << sum <<'\n';
}#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,j,dp[2],max=0,in=0,c=0,sum=0;
	cin>>n;
	int a[n][3];
	for(i=0;i<n;i++)
	{
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<3;j++)
		{
			if(a[i][j]>max && i%2==0)
			{
				max=a[i][j];
				in=j;
			}
			else if(a[i][j]>max && j!=dp[0])
			{
				max=a[i][j];
				in=j;
			}
		}
		dp[0]=in;
		sum=sum+max;
		max=0;
	}
	cout << sum <<'\n';
}

Compiler output:
a.cc:32:2: error: stray '#' in program
   32 | }#include<bits/stdc++.h>
      |  ^
a.cc:32:3: error: 'include' does not name a type
   32 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:34:5: error: redefinition of 'int main()'
   34 | int main()
      |     ^~~~
a.cc:3:5: note: 'int main()' previously defined here
    3 | int main()
      |     ^~~~
Language: Java

import java.util.Scanner;

public class Vacation {

    public static int getMaxCost(int numberOfDays, int[] ah, int[] bh, int[] ch) {
        return getMaxCostHelper(0, numberOfDays, ah, bh, ch, 0, 0, 0);
    }

    private static int getMaxCostHelper(int day, int numberOfDays, int[] ah, int[] bh, int[] ch, int na, int nb, int nc) {
        if(day == numberOfDays) {
            return 0;
        }

        int poss1 = (na < 2) ? ah[day] + getMaxCostHelper(day + 1, numberOfDays, ah, bh, ch, na + 1, 0, 0) : Integer.MIN_VALUE;
        int poss2 = (nb < 2) ? bh[day] + getMaxCostHelper(day + 1, numberOfDays, ah, bh, ch, 0, nb + 1, 0) : Integer.MIN_VALUE;
        int poss3 = (nc < 2) ? ch[day] + getMaxCostHelper(day + 1, numberOfDays, ah, bh, ch, 0, 0 , nc + 1) : Integer.MIN_VALUE;

        return Math.max(poss1, Math.max(poss2, poss3));
    }


    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int numberOfDays = scanner.nextInt();
        int[] aH = new int[numberOfDays];
        int[] bH = new int[numberOfDays];
        int[] cH = new int[numberOfDays];

        for(int i=0; i<numberOfDays; i++) {
            aH[i] = scanner.nextInt();
            bH[i] = scanner.nextInt();
            cH[i] = scanner.nextInt();
        }

        System.out.println(getMaxCost(numberOfDays, aH, bH, cH));

    }

}

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

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

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

}

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

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

int max_except(vector<int> a, int pos) {
  int max = 0;
  for (int i = 0; i < a.size(); i++) {
    if (i != pos && a[i] > max)
      max = a[i];
  }
  return max;
}

int main() {
  int n; cin >> n;

  vector<vector<int>> a(n, vector<int> (3));
  for (int i = 0; i < n; i++)
      cin >> a[i][0] >> a[i][1] >> a[i][2];

  vector<vector<int>> sums(n, vector<int> (3));
  sums[0] = a[0];

  for (int i = 1; i < n; i++) {
    for (int j = 0; j < 3; j++) {
      sums[i][j] = a[i][j] + max_except(sums[i - 1], j);
    }
  }

  int max =  max_element(sums[n - 1].begin(), sums[n - 1].end()) - sums[n - 1].begin();
  cout << sums[n - 1][max] << "\n";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:14: error: 'max_element' was not declared in this scope
   30 |   int max =  max_element(sums[n - 1].begin(), sums[n - 1].end()) - sums[n - 1].begin();
      |              ^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<vector<int> > v;
  for(int i=0;i<n;i++)
  {
    vector<int> r;
    for(int j=0;j<3;j++)
    {
      int a;
      cin>>a;
      r.push_back(a);
    }
    v.push_back(r);
  }
  vector<pair<int,int> > comp;
  comp.push_back(make_pair(v[n-1][0],0));
  comp.push_back(make_pair(v[n-1][1],1));
  comp.push_back(make_pair(v[n-1][2],2));
  for(int i=n-2;i>=0;i--)
  {
    for(int j=0;j<3;j++)
    {
      int ans=0;
      int ind=-1;
      for(int t=0;t<3;t++)
      {
        if(t!=comp[j].second)
        {
          if(v[i][t]>=ans)
          {
            ans=v[i][t];
            ind=t;
          }
        }
      }
      comp[j].first+=ans;
      comp[j].second=ind;
    }
    int maxx=comp[0].first;
    if(max(comp[1].first,comp[2].first)>maxx)
      maxx=max(comp[1].first,comp[2].first);
    cout<<maxx;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:47:4: error: expected '}' at end of input
   47 |   }
      |    ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define int long long
typedef vector<int> VI;
typedef vector<VI> VVI;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; 
    cin >> n;
	VVI abc(3, VI(n)), dp(n + 1, VI(3));
	rep(i,n) cin >> abc[0][i] >> abc[1][i] >> abc[2][i];
	dp[0][0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < 3; j++) dp[i][j] = max(dp[i-1][(j + 1) % 3], dp[i-1][(j + 2) % 3]) + abc[j][i-1];
	}
	cout << *max_element(dp[n].begin(), dp[n].end()) << endl;
 
 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:18: error: 'max_element' was not declared in this scope
   27 |         cout << *max_element(dp[n].begin(), dp[n].end()) << endl;
      |                  ^~~~~~~~~~~
Language: C++

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

void chmax(int& a, int b){
  if(a < b){
    a = b;
  }
}

int main(){
  int N;
  cin >> N;
  vector<vector<int>> a(N + 10, vector<int>(3));
  for(int i = 0; i < N; i++){
    cin >> a.at(i).at(0) >> a.at(i).at(1) >> a.at(i).at(2);
  }
  vector<vector<int>> dp(N + 10, vector<int>(3, 0));
  for(int i = 0; i < 3; i++){
    dp.at(0).at(i) = a.at(0).at(i);
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 3; j++){
      for(int k = 0; k < 3; k++){
        if(j == k){
          continue;
        }
        chmax(dp.at(i + 1).at(j), dp.at(i).at(k) + a.at(i + 1).at(j));
      }
    }
  }
  int maximum = 0
  for(int i = 0; i < 3; i++){
    chmax(maximum, dp.at(N - 1).at(i));
  }
  cout << maximum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:3: error: expected ',' or ';' before 'for'
   32 |   for(int i = 0; i < 3; i++){
      |   ^~~
a.cc:32:18: error: 'i' was not declared in this scope
   32 |   for(int i = 0; i < 3; i++){
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    vector<int> dp(3,0);

   	for(int day =0; day < n ; day++){
   		vector<int> c(3,0);
   		vector<int> new_dp(3,0);
   		for(int i=0 ; i<3 ; i++){
   			cin >> c[i];
   		}

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

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

#include<iostream>
#include<algorithm>
#include<vector>
#define pb push_back
using namespace std;

int main(){
    int n;
    cin>>n;
    vector<vector<int> > v;

    for(int i = 0;i<n;i++){
        int a,b,c;
        cin>>a>>b>>c;
        vector<int> t;
        t.push_back(a);
        t.push_back(b);
        t.push_back(c);
        v.push_back(t);
        t.clear();

    int dp[3][100005];
    for(int i = 0;i<n;i++){
        dp[0][i] = v[i][0] + max(dp[1][i-1] , dp[2][i-1] );
        dp[1][i] = v[i][1] + max(dp[0][i-1] , dp[2][i-1] );
        dp[2][i] = v[i][2] + 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:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:7:11: note: to match this '{'
    7 | int main(){
      |           ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:76: error: 'arr' was not declared in this scope; did you mean 'ar'?
   20 |                                         new_dp[j] = max(new_dp[j], dp[i] + arr[day][j])
      |                                                                            ^~~
      |                                                                            ar
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:25:11:   required from here
   25 |         cout<<max(dp[0], dp[1], dp[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 <stdio.h> 
#include <stdlib.h> 
#include <limits.h> 
#include <vector>
#include <bits/stdc++.h> 
using namespace std;

int n;

int remaxHap(int a[][3], int n, int i){
	int b[3];
	b[0]=a[n-1][0],b[1]=a[n-1][1],b[2]=a[n-1][2];
	if(n==0){
		return 0; 
	}
	if(i!=-1){
		b[i]=INT_MIN;
		}
	// if(n==1){
	// 	int m=0;
	// 	return maxValue(a,n,i);
	// }
	
	return max(b[0]+remaxHap(a,n-1,0),max(b[1]+remaxHap(a,n-1,1),b[2]+remaxHap(a,n-1,2)));
}



int main() {
	// your code goes here
	cin>>n;
	int a[n][3];
	
	for(int i=0;i<n;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	cout<<maxHap(a,n);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:15: error: 'maxHap' was not declared in this scope; did you mean 'remaxHap'?
   38 |         cout<<maxHap(a,n);
      |               ^~~~~~
      |               remaxHap
Language: C++

#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <bits/stdc++.h> 
using namespace std;
typedef ll int;

int maxim(int a,ll b,ll c){
    return max(max(a,b),c);    
}

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

Compiler output:
a.cc:8:9: error: 'll' does not name a type
    8 | typedef ll int;
      |         ^~
a.cc:10:17: error: 'll' has not been declared
   10 | int maxim(int a,ll b,ll c){
      |                 ^~
a.cc:10:22: error: 'll' has not been declared
   10 | int maxim(int a,ll b,ll c){
      |                      ^~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int mat[10005][10005],dp[10005][10005];
 
int main() 
{
    int n;
    cin>>n;
    for (int i=0;i<n;i++){
        for (int j=0;j<3;j++){
            cin>>mat[j][i];
        }
    }
    for (int i=0;i<3;i++){
        dp[i][0]=mat[i][0];
    }
    for (int i=1;i<n;i++){
        for (int j=0;j<3;j++){
            int val=0;
            for (int t=0;t<3;t++) 
			 if (j!=t) val=max(val,dp[t][i-1]);
            dp[j][i]=res+mat[j][i];
        }
    }
    int ans=0;
    for (int j=0;j<3;j++){
        ans=max(ans,dp[j][n-1]);
    }
    cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:22: error: 'res' was not declared in this scope
   24 |             dp[j][i]=res+mat[j][i];
      |                      ^~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n;cin>>n;int a[n],b[n],c[n];
  for (int i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];
  int ans1[n],ans2[n],ans3[n];ans1[0]=a[0],ans2[0]=b[0],ans3[0]=c[0];
  for (int i=1;i<n;i++)
  {
ans1[i]=a[i]+max(ans2[i-1],ans3[i-1]);
    ans2[i]=b[i]+max(ans1[i-1],ans3[i-1]);
    ans3[i]=c[i]+max(ans1[i-1],ans2[i-1]);}
  cout<<max(ans1[n-1],max(ans2[n-1],ans3[n-1]));
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:13:49: error: expected '}' at end of input
   13 |   cout<<max(ans1[n-1],max(ans2[n-1],ans3[n-1]));
      |                                                 ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

#include <bits/stdc++.h> 
using namespace std;
#define int long long int
#define float double
#define pb push_back
#define FF first
#define SS second
#define N 201000
#define MOD 1000000007
#define fn(i,n) for(int i=0;i<n;i++)
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define pii pair<int,int>
#define INF 1000000000000000000
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

signed main() 
{
    speed;
    
    int n;
    cin>>n;
    int A[n],B[n],C[n];
    int dpa[n],dpb[n],dpc[n];
    cin>>A[0]>>B[0]>>C[0];
    dpa[0]=A[0];
    dpb[0]=B[0];
    dpc[0]=C[0];
    for(int i=1;i<n;i++)
    {
    	cin>>A[i]>>B[i]>>C[i];
    	
        dpa[i]=max(dpb[i-1],dpc[i-1])+A[i];
        dpb[i]=max(dpa[i-1],dpc[i-1])+B[i];
        dpc[i]=max(dpb[i-1],dpa[i-1])+C[i];
    	
    }
    cout<<max(dpa[n-1],dpb[n-1],dpc[n-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 = long long int; _Compare = long long int]':
a.cc:37:14:   required from here
   37 |     cout<<max(dpa[n-1],dpb[n-1],dpc[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 int long long int
#define float double
#define pb push_back
#define FF first
#define SS second
#define N 201000
#define MOD 1000000007
#define fn(i,n) for(int i=0;i<n;i++)
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define pii pair<int,int>
#define INF 1000000000000000000
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

signed main() 
{
    speed;
    
    int n;
    cin>>n;
    int A[n],B[n],C[n];
    int dpa[n],dpb[n],dpc[n];
    for(int i=0;i<n;i++)
    {
    	cin>>A[i]>>B[i]>>C[i];
    	if(i==0) 
    	{
    		dpa[i]=A[i];
    		dpb[i]=B[i];
    		dpc[i]=C[i];
    	}
    	else
    	{
    		dpa[i]=max(dpb[i-1],dpc[i-1])+A[i];
    		dpb[i]=max(dpa[i-1],dpc[i-1])+B[i];
    		dpc[i]=max(dpb[i-1],dpa[i-1])+C[i];
    	}
    }
    cout<<max(dpa[n-1],dpb[n-1],dpc[n-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:40:14:   required from here
   40 |     cout<<max(dpa[n-1],dpb[n-1],dpc[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 int long long int
#define float double
#define pb push_back
#define FF first
#define SS second
#define N 201000
#define MOD 1000000007
#define fn(i,n) for(int i=0;i<n;i++)
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define pii pair<int,int>
#define INF 1000000000000000000
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

signed main() 
{
    speed;
    
    int n;
    cin>>n;
    int A[n],B[n],C[n];
    int dpa[n],dpb[n],dpc[n];
    for(int i=0;i<n;i++)
    {
    	cin>>A[i]>>B[i]>>C[i];
    	if(i==0) 
    	{
    		dpa[i]=A[i];
    		dpb[i]=B[i];
    		dpc[i]=C[i];
    	}
    	else
    	{
    		dpa[i]=max(dpb[i-1],dpc[i-1])+A[i];
    		dpb[i]=max(dpa[i-1],dpc[i-1])+B[i];
    		dpc[i]=max(dpb[i-1],dpa[i-1])+C[i];
    	}
    }
    cout<<max(dpa[n-1],dpb[n-1],dpc[n-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 = long long int; _Compare = long long int]':
a.cc:40:14:   required from here
   40 |     cout<<max(dpa[n-1],dpb[n-1],dpc[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> 
#define ll                 long long                            
#define ra                 return a;                                          
#define pb                 push_back                                                     
#define sti                stack<ll>
#define spi                stack<pair<ll,ll>>
#define S                  second
#define msi                map<string,ll >
#define msi                map<string,ll >
#define mii                map<ll ,ll >
#define dbg(x)             { cerr<<#x<<": "<<x<< endl; }
#define dbg2(x,y)          { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z)        { cerr<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define mis                map<ll , string>
#define rep(i,a,b)         for(ll  i=a;i<b;i++)
#define mpi                map<pair<ll ,ll >,ll >                                                
#define pii                pair<ll ,ll >
#define ppb                pop_back
#define F                  first 
#define vi                 vector<ll >
#define vii                vector<pair<ll , ll >>
#define si                 set <ll>
#define vs                 vector<string>
#define all(a)             (a).begin(),(a).end()
#define sz(x)              (ll )x.size()
#define hell               1000000007
#define bs                 binary_search
#define mp                 make_pair
#define qi                 queue<ll>
#define qs                 queue<string>
#define qpi                queue<pair<ll,ll>>
#define qps                queue<pair<ll,string>> 
#define endl               '\n' 
#define itr(a,it)          for(typeof(a.begin()) it=a.begin();it!=a.end();it++)// This will produce const_iterator for const object and normal iterator for non-const object
#define ss                 set<string>
using namespace std;
#define N  300005



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    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 swim[n],bugs[n],hw[n];
    swim[0]=a[0],bugs[0]=b[0],hw[0]=c[0];
    for(ll i=1;i<n;i++)
    {
        swim[i] = a[i]+max(bugs[i-1],hw[i-1]);
        bugs[i] = b[i]+max(swim[i-1],hw[i-1]);
        hw[i] = c[i]+max(bugs[i-1],swim[i-1]);
    }
    cout<<max(swim[n-1],bugs[n-1],hw[n-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 = long long int; _Compare = long long int]':
a.cc:61:14:   required from here
   61 |     cout<<max(swim[n-1],bugs[n-1],hw[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>
#define endl "\n"
#define ll long long int
#define mem(a,val) memset(a,val,sizeof(a))

using namespace std;

int main()
{
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int dp[n+1][3+1];
    mem(dp, 0);
    int a, b, c;
    for (int i = 1; i < n + 1; ++i) {
        cin>>a>>b>>c;
        dp[i][1] = max(dp[i-1][2], dp[i-1][3]) + a;
        dp[i][2] = max(dp[i-1][1], dp[i-1][3]) + b;
        dp[i][3] = max(dp[i-1][1], dp[i-1][2]) + c;
    }

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

    return 0;
}


Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:23:14:   required from here
   23 |     cout<<max(dp[n][1], dp[n][2], dp[n][3]);
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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 <cstdlib>
using namespace std;


// 入力 // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

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

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

    // 初期化は既に 0 に初期化される
    // 初期条件も既に 0 で OK

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

    // 答え
    long long res = 0;
    for (int i = 0; i < 3; ++i) res=max(res, dp[N][i]);
    cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: redeclaration of 'long long int a [100010][3]'
   15 |     long long a[100010][3];
      |               ^
a.cc:14:13: note: 'long long int a [100010][3]' previously declared here
   14 |   long long a[100010][3];
      |             ^
Language: C++

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

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:18:11:   required from here
   18 |         cout<<max(d[n-1][1],d[n-1][0],d[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 act[100000][3];

int happy_dp[100000][3];

void happy(int n)
{
	happy_dp[0][0] = a[0];
	happy_dp[0][1] = b[0];
	happy_dp[0][2] = c[0];

	for(int i = 1; i < n; i++)
	{
		happy_dp[i][0] = max(happy_dp[i-1][1] + act[i][0], happy_dp[i-1][2] + act[i][0]);
		happy_dp[i][1] = max(happy_dp[i-1][0] + act[i][1], happy_dp[i-1][2] + act[i][1]);
		happy_dp[i][2] = max(happy_dp[i-1][0] + act[i][2], happy_dp[i-1][1] + act[i][2]);
	}

	int max_happ = max(happy_dp[n-1][0], happy_dp[n-1][1]);
	max_happ = max(max_happ, happy_dp[n-1][2]);

	cout << max_happ << endl;

}

int main()
{
	int n;
	cin >> n;

	for(int i = 0; i < n; i++)
		cin >> act[i][0] >> act[i][1] >> act[i][2];

	happy(n);
	return 0;
}


Compiler output:
a.cc: In function 'void happy(int)':
a.cc:10:26: error: 'a' was not declared in this scope
   10 |         happy_dp[0][0] = a[0];
      |                          ^
a.cc:11:26: error: 'b' was not declared in this scope
   11 |         happy_dp[0][1] = b[0];
      |                          ^
a.cc:12:26: error: 'c' was not declared in this scope
   12 |         happy_dp[0][2] = c[0];
      |                          ^
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
const int MAXN=100000+20;
int n,dp[MAXN][3];
int main() {
	cin>>n;
	for (int i=1; i<=n; i++) {
		int a,b,c;
		cin>>a>>b>>c;
		dp[i][0]=a+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=b+max(dp[i-1][0],dp[i-1][2]);
		dp[i][2]=c+max(dp[i-1][1],dp[i-1][0]);
	}
	cout<<max(max(dp[n][0],dp[n][1]),dp[n][2])<<'\n';
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin>>n;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:15:9: error: 'cout' was not declared in this scope
   15 |         cout<<max(max(dp[n][0],dp[n][1]),dp[n][2])<<'\n';
      |         ^~~~
a.cc:15:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
int func(int n,int m, vector<vector<int>>v)
{
    int a[n][m];
    for(int j=0;j<m;j++)
    a[0][j]=v[0][j];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            int min=INT_MAX;
           for(int k=0;k<m;k++)
            if(min>v[i][k]&&k!=j)
            min=v[i][k];
            a[i][j]=a[i-1][j]+min;
        }
    }
    int min=10000;
    for(int i=0;i<m;i++)
    if(min>a[n-1][i])
    min=a[n-1][i];
    return min;
}

int main() {
    int m,n,d;
    cin>>n;
  m=3;
    vector< vector<int> >v(n,vector<int>(m)) ;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>d;
            v[i][j]=(d);
    
        }
    }
    cout<<func(n,m,v);
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<vector<ll>> happiness(n, vector<ll>(3));
    for(int i=0;i<n;++i){
        for(int j=0;j<3;++j) cin >> happiness[i][j];
    }

    vector<vector<ll>> dp(n+1, vector<ll>(3, 0)); // その日の終わりの幸福度合計
    for(int i=0;i<n;++i) {  // 今日の日数
        for(int j=0;j<3;++j) {  // 今日の activity
            for(int k=0;k<3;++k) {  // 明日の activity
                if(j == k) continue;
                dp[i+1][k] = max(dp[i+1][k], dp[i][j] + happiness[i][j]);
            }
        }
    }

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

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

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

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

#include <​bits/stdc++.h>
int main()
{
	int n;
	cin >> n;
	int dp[3][n];
	cin >> dp[0][0];
	cin >> dp[1][0];
	cin >> dp[2][0];
	
	for(i=1; i<n; i++){
		int a;
		int b;
		int c;
		cin >> a;
		cin >> b;
		cin >> c;
		dp[0][i]=max(dp[1][i-1], dp[2][i-1])+a;
		dp[1][i]=max(dp[2][i-1], dp[0][i-1])+b;
		dp[2][i]=max(dp[0][i-1], dp[1][i-1])+c;
	}
	cout << max(dp[0][n-1], dp[1][n-1], dp[2][n-1]) << endl;
	
}

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

int main(void){
        int dp1[3]={0},dp2[3];
        int n;
        int a,b,c;
        int i;
        scanf("%d",&n);
        for(i=0;i<n;i++){
                scanf("%d%d%d",&a,&b,&c);
                if(i&1){
                        dp1[0]=max(dp2[1]+a,dp2[2]+a);
                        dp1[1]=max(dp2[0]+b,dp2[2]+b);
                        dp1[2]=max(dp2[0]+c,dp2[1]+c);
                }else{
                        dp2[0]=max(dp1[1]+a,dp1[2]+a);
                        dp2[1]=max(dp1[0]+b,dp1[2]+b);
                        dp2[2]=max(dp1[0]+c,dp1[1]+c);
                }
        }
        if(n&1){
                printf("%d\n",max(max(dp2[0],dp2[1]),dp2[2]));
        }else{
                printf("%d\n",max(max(dp1[0],dp1[1]),dp1[2]));
        }
        return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'scanf' was not declared in this scope
    6 |         scanf("%d",&n);
      |         ^~~~~
a.cc:10:32: error: 'max' was not declared in this scope
   10 |                         dp1[0]=max(dp2[1]+a,dp2[2]+a);
      |                                ^~~
a.cc:14:32: error: 'max' was not declared in this scope
   14 |                         dp2[0]=max(dp1[1]+a,dp1[2]+a);
      |                                ^~~
a.cc:20:35: error: 'max' was not declared in this scope
   20 |                 printf("%d\n",max(max(dp2[0],dp2[1]),dp2[2]));
      |                                   ^~~
a.cc:20:31: error: 'max' was not declared in this scope
   20 |                 printf("%d\n",max(max(dp2[0],dp2[1]),dp2[2]));
      |                               ^~~
a.cc:20:17: error: 'printf' was not declared in this scope
   20 |                 printf("%d\n",max(max(dp2[0],dp2[1]),dp2[2]));
      |                 ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void){
a.cc:22:35: error: 'max' was not declared in this scope
   22 |                 printf("%d\n",max(max(dp1[0],dp1[1]),dp1[2]));
      |                                   ^~~
a.cc:22:31: error: 'max' was not declared in this scope
   22 |                 printf("%d\n",max(max(dp1[0],dp1[1]),dp1[2]));
      |                               ^~~
a.cc:22:17: error: 'printf' was not declared in this scope
   22 |                 printf("%d\n",max(max(dp1[0],dp1[1]),dp1[2]));
      |                 ^~~~~~
a.cc:22:17: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include<bits/stdc++.h> 
using namespace std; 
//const int INF=1e9+5;
int main()
{
	int n;
	cin>>n;
	vector<int> dp(3);
	for(int i=0;i<n;i++)
	{
		vector<int> c(3);
		std::vector<int> new_dp(3,0);

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

}

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:28:14:   required from here
   28 |         int maxi=max(dp[0],dp[1],dp[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: Java

import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
      	int days = sc.nextInt();
      	int[][] input = new int[days][3];
      	for(int i=0; i< days; i++){
          input[i][0] = sc.nextInt();
          input[i][1] = sc.nextInt();
          input[i][2] = sc.nextInt(); 
        }
      	for(int j =1; j< days; j++){
        	input[j][0] += Math.min(input[j-1][1] , input[j-1][2]);
            input[j][1] += Math.min(input[j-1][0] , input[j-1][2]);
          	input[j][2] += Math.min(input[j-1][0] , input[j-1][1]);
        }
      	System.out.print(Math.min(Math.min(input[days-1][0], input[days-1][1]),input[days-1][2]));
      	scanner.close();
    }
}


Compiler output:
Main.java:18: error: cannot find symbol
      	scanner.close();
      	^
  symbol:   variable scanner
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
      	int days = sc.nextInt();
      	int[][] input = new int[days][3];
      	for(int i=0; i< days; i++){
          input[i][0] = sc.nextInt();
          input[i][1] = sc.nextInt();
          input[i][2] = sc.nextInt(); 
        }
      	for(int j =1; j< days; j++){
        	input[j][0] += Math.min(input[j-1][1] + input[j-1][2]);
            input[j][1] += Math.min(input[j-1][0] + input[j-1][2]);
          	input[j][2] += Math.min(input[j-1][0] + input[j-1][1]);
        }
      	System.out.print(Math.min(Math.min(input[days-1][0], input[days-1][1]),input[days-1][2]));
      	scanner.close();
    }
}
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
      	int days = sc.nextInt();
      	int[][] input = new int[days][3];
      	for(int i=0; i< days; i++){
          input[i][0] = sc.nextInt();
          input[i][1] = sc.nextInt();
          input[i][2] = sc.nextInt(); 
        }
      	for(int j =1; j< days; j++){
        	input[j][0] += Math.min(input[j-1][1] , input[j-1][2]);
            input[j][1] += Math.min(input[j-1][0] , input[j-1][2]);
          	input[j][2] += Math.min(input[j-1][0] , input[j-1][1]);
        }
      	System.out.print(Math.min(Math.min(input[days-1][0], input[days-1][1]),input[days-1][2]));
      	scanner.close();
    }
}


Compiler output:
Main.java:21: error: class, interface, enum, or record expected
import java.util.*;
^
1 error