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

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
const long long INF=1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
int main(){
int n; cin>>n;
  long long [100010][3];
  long long dp[100010][3];
for(int i=0;i<n;i++){
   for(int j=0;j<3;j++){
     cin>>a[i][j];
   }
 }
   
for(int i=0;i<n;i++){
	for(int j=0;j<3;j++){
    	for(int k=0;k<3;k++){
        	if(j==k) continue;
          	chmax(dp[i+1][k],dp[i][j]+a[i][k]);
        }
    }
}  
long long res=0;
rep(j,3) chmax(res,dp[n][j]);
  cout<<res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: expected identifier before numeric constant
    9 |   long long [100010][3];
      |              ^~~~~~
a.cc:9:14: error: expected ']' before numeric constant
    9 |   long long [100010][3];
      |              ^~~~~~
      |              ]
a.cc:9:13: error: structured binding declaration cannot have type 'long long int'
    9 |   long long [100010][3];
      |             ^
a.cc:9:13: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:9:13: error: empty structured binding declaration
a.cc:9:21: error: expected initializer before '[' token
    9 |   long long [100010][3];
      |                     ^
a.cc:13:11: error: 'a' was not declared in this scope
   13 |      cin>>a[i][j];
      |           ^
a.cc:21:43: error: 'a' was not declared in this scope
   21 |                 chmax(dp[i+1][k],dp[i][j]+a[i][k]);
      |                                           ^
Language: C++

#include <bits/stdc++.h>
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    int dp[n][3];
    dp[0][0]=a[0];
    dp[0][1]=b[0];
    dp[0][2]=c[0];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(j==0)
            {
                dp[i][j]=dp[i-1][j]+max(b[i],c[i]);
            }
            else if(j==1)
            {
                dp[i][j]=dp[i-1][j]+max(a[i],c[i]);
            }
            else if(j==2)
            {
                dp[i][j]=dp[i-1][j]+max(b[i],a[i]);
            }
        }
    }
    cout<<*max_element(dp[n-1].begin(),dp[n-1].end())<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:32: error: request for member 'begin' in 'dp[(n - 1)]', which is of non-class type 'int [3]'
   39 |     cout<<*max_element(dp[n-1].begin(),dp[n-1].end())<<endl;
      |                                ^~~~~
a.cc:39:48: error: request for member 'end' in 'dp[(n - 1)]', which is of non-class type 'int [3]'
   39 |     cout<<*max_element(dp[n-1].begin(),dp[n-1].end())<<endl;
      |                                                ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define forA(i,a,n,x) for(auto i=a;i<n;i+=x)
#define forD(i,a,n,x) for(auto i=n-1;i>=0;i-=x)
#define ranit(it,n) for(auto it:n)
#define testCases ll t;cin>>t;while(t--)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007

int main()
{
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	ll n; cin>>n; vector<vector<ll>> input; forA(i,0,n,1){ll a,b,c; cin>>a>>b>>c; vll v; v.pb(a);v.pb(b);v.pb(c); input.pb(v); }
	ll index=0; ll dp[n]; 
	dp[0]= *max_element(input[0].begin(), input[0].end()); index =max_element(input[0].begin(), input[0].end())-input[0].begin();
	forA(i,1,n,1)
	{
		while(1)
		{
			ll x= *max_element(input[i].begin(), input[i].end());
			ll tindex = max_element(input[i].begin(), input[i].end())-input[i].begin();
			if(tindex==index)input[i][tindex]=-1;
			else {index=tindex;break;}
		}
		dp[i]=dp[i-1]+input[i][index];
	}
	cout<<dp[n-1];
	return 0;
}#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define forA(i,a,n,x) for(auto i=a;i<n;i+=x)
#define forD(i,a,n,x) for(auto i=n-1;i>=0;i-=x)
#define ranit(it,n) for(auto it:n)
#define testCases ll t;cin>>t;while(t--)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007

int main()
{
	ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
	ll n; cin>>n; vector<vector<ll>> input; forA(i,0,n,1){ll a,b,c; cin>>a>>b>>c; vll v; v.pb(a);v.pb(b);v.pb(c); input.pb(v); }
	ll index=0; ll dp[n]; 
	dp[0]= *max_element(input[0].begin(), input[0].end()); index =max_element(input[0].begin(), input[0].end())-input[0].begin();
	forA(i,1,n,1)
	{
		while(1)
		{
			ll x= *max_element(input[i].begin(), input[i].end());
			ll tindex = max_element(input[i].begin(), input[i].end())-input[i].begin();
			if(tindex==index)input[i][tindex]=-1;
			else {index=tindex;break;}
		}
		dp[i]=dp[i-1]+input[i][index];
	}
	cout<<dp[n-1];
	return 0;
}

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

#include <iostream>
using namespace std;

int maxHappiness(int *a,int *b,int *c,int n){
    int dp[n][3];
    memset(dp,-1,sizeof(dp));
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(int i=1;i<n;i++){
        dp[i][0] = a[i] + max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = b[i] + max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = c[i] + max(dp[i-1][0],dp[i-1][1]);
    }
    return max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
}

int main() {
    int n;
    cin>>n;
    int a[n],b[n],c[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        cin>>b[i];
        cin>>c[i];
    }
    cout<<maxHappiness(a,b,c,n);

    return 0;
}

Compiler output:
a.cc: In function 'int maxHappiness(int*, int*, int*, int)':
a.cc:6:5: error: 'memset' was not declared in this scope
    6 |     memset(dp,-1,sizeof(dp));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define pb push_back
#define F first
#define S second
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)

# define M_PIl          3.141592653589793238462643383279502884L /* pi */

const ll M=1e9+7;
const int MaxM=100005;


void SieveOfEratosthenes(int n)                                   //all prime <= n
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }

    for (int p=2; p<=n; p++)
       if (prime[p])
          cout << p << " ";
}


bool isPowerOfTwo (int x)
{
    return x && (!(x&(x-1)));
}



bool comp(pair<int,int> a,pair<int,int> b){
  if(a.F==b.F){
    return a.S>b.S;
  }
  return a.F<b.F;
}








void solve(){

  ll n,k;
  cin>>n>>k;
ll a[n],b[n],c[n];
for(int i=0;i<n;i++){
  cin>>a[i]>>b[i]>>c[n];
}

ll dp[n][3];
  dp[0][0]=a[0];
  dp[0][1]=b[0];
  dp[0][2]=c[0];

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

int main(){


   int t=1;
//  cin>>t;
   while(t--){
      solve();
       }

 }


Compiler output:
a.cc: In function 'void solve()':
a.cc:76:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   76 |   ans=max(dp[n-1][2],max(dp[n-1][0],dp[n-1][1]));
      |   ^~~
      |   abs
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define FASTIO ios_base::sync_with_stdio(NULL); cin.tie(NULL);
#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define MOD 1000000007

using namespace std;

void init(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin) ;
  freopen("output.txt", "w", stdout) ;
  #endif
}

// code from below
int arr[int(1e5)+1][3];

void solve(){
	int n;
    cin>>n;
    FOR(i,n)
        FOR(j,3)
        cin>>arr[i][j];
    // find the answer, from bottom up

    // we have to do exaushtive search and take max from all possiblities and this
    // would be too intensive using recursion but using dp it would be easy
    for(int i=n-2;i>=0;i--){
        arr[i][0]+=max(arr[i+1][1],arr[i+1][2]);
        arr[i][1]+=max(arr[i+1][0],arr[i+1][2]);
        arr[i][2]+=max(arr[i+1][1],arr[i+1][0]);
    }

    // answer would be max at row 0
    cout<<max(arr[0][0],max(arr[0][1],arr[0][2]))<<endl;
}

int main(){
    // int t=1;
    cin>>t;
    // cin.ignore(numeric_limits<streamsize>::max(),'\n'); 
    while(t--)
        solve();
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:10: error: 't' was not declared in this scope; did you mean 'tm'?
   46 |     cin>>t;
      |          ^
      |          tm
Language: C++

#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long int ll;

ll *dp;
ll *a;
/*
ll solution(int s)
{

    if (dp[s] != 0)
    {
        return dp[s];
    }

    dp[s] += min(solution(s+1), (solution(s+2)));
    return dp[s];
}
*/
int main()
{
    int n, a1=0,b1=0,c1=0;
    cin >> n;
     ll a[n], b[n], c[n];
     ll dp[n + 1];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
        dp[i] = INT_MIN;
        //a[i] = t;
    }
    dp[0] = 0;
    for(int i=1;i<n;i++){
        a[i]+= max(b[i-1],c[i-1]);
        b[i]+= max(a[i-1],c[i-1]);
        c[i]+= max(a[i-1],b[i-1]);
    }
    cout<<max(a[n-1], max(b[n-1],c[n-1]))<<endl;

    return 0;
}


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

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

int dp[100000]={0};
int sum=0,index;
int a[100000][3]={0};
std::vector<int> v;

int rec(int i){
  if(i<=0){
    if(a[i][0]>=a[i][1]&&a[i][0]>=a[i][2]){
      sum+=a[i][0];
      return 0;
    }
    if(a[i][1]>=a[i][0]&&a[i][1]>=a[i][2]){
      sum+=a[i][1];
      return 1;
    }
    if(a[i][2]>=a[i][0]&&a[i][2]>=a[i][1]){
      sum+=a[i][2];
      return 2;
    }
  }
  else {
    int index=rec(i-1);
    if((index==0)){
      if(a[i][1]>=a[i][2]){
        sum+=a[i][1];
        return 1;
      }else{
        sum+=a[i][2];
        return 2;
      }
    }
    else if((index==1)){
      if(a[i][0]>=a[i][2]){
        sum+=a[i][0];
        return 0;
      }else{
        sum+=a[i][2];
        return 2;
      }
    }
    else if((index==2)){
      if(a[i][0]>=a[i][1]){
        sum+=a[i][0];
        return 0;
      }else{
        sum+=a[i][1];
        return 1;
      }
    }
  }
}

int main(){
  //freopen("input.txt","r",stdin);
  long long n;
  cin>>n;
  for(long long i=0;i<n;i++){
    for(long long j=0;j<3;j++)
      cin>>a[i][j];
  }
  memset(dp, -1, sizeof(dp)) ;
  rec(n-1);
  cout<<sum;
  return 0;
}

Compiler output:
a.cc:5:11: error: 'int index' redeclared as different kind of entity
    5 | int sum=0,index;
      |           ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int rec(int)':
a.cc:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:29: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   16 |             dp[i][0] = a[i] + max(dp[i - 1][1], dp[i - 1][2]);
      |                        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             int*
a.cc:17:24: error: 'b' was not declared in this scope
   17 |             dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
      |                        ^
a.cc:18:24: error: 'c' was not declared in this scope
   18 |             dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
      |                        ^
Language: Java

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

      System.out.println(Math.max(result[t-1][0],Math.max(result[t-1][1],result[t-1][2]));
    }
  
}


Compiler output:
Main.java:26: error: ')' or ',' expected
      System.out.println(Math.max(result[t-1][0],Math.max(result[t-1][1],result[t-1][2]));
                                                                                         ^
1 error
Language: C++

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

int main()
{
    int n;
    cin >> n;
    vector<int> dp(3);
    for (int d = 0; d < n; d++)
    {
        vector<int> ndp(3, 0);
        vector<int> c(3);
        for (int &it : c)
            cin >> c[i];
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (i != j)
                {
                    ndp[j] = max(ndp[j], dp[i] + c[j]);
                }
            }
        }
        dp = ndp;
    }
    cout << max({dp[0], dp[1], dp[2]});
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:22: error: 'i' was not declared in this scope; did you mean 'it'?
   14 |             cin >> c[i];
      |                      ^
      |                      it
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,i; cin>>n;
    vector<vector<int>> h(n, vector<int>(3)), dp(n,vector<int>(3));
    for(i=0;i<n;i++){
        cin>>h[i][0]>>h[i][1]>>h[i][2]; //a,b,c
        if(i==0) continue;
        dp[i][0] = max(dp[i-1][1]+h[i-1][1], dp[i-1][2]+h[i-1][2]);
        dp[i][1] = max(dp[i-1][2]+h[i-1][2], dp[i-1][0]+h[i-1][0]);
        dp[i][2] = max(dp[i-1][0]+h[i-1][0], dp[i-1][1]+h[i-1][1]);
    }
    cout<<max(dp[n-1][0],dp[n-1][1],dp[n-1][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:13:14:   required from here
   13 |     cout<<max(dp[n-1][0],dp[n-1][1],dp[n-1][2])<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:20: error: expected ';' before ')' token
    6 |     for(i=0,i<n;i++){
      |                    ^
      |                    ;
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:13:14:   required from here
   13 |     cout<<max(dp[n-1][0],dp[n-1][1],dp[n-1][2])<<endl;
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define pb                      push_back
#define MOD                     1000000007
#define endl                    "\n"

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 dp[n][3];
  for(int j=0;j<3;j++)
    dp[0][j]= arr[0][j];
  for(int i=1;i<n;i++)
  {
    for(int j=0;j<3;j++)
    { int maxi = INT_MIN;
     for(int k=0;k<3;k++)
     {
       if(j!=k)
         maxi = max(arr[i-1][j],maxi);
     }
     dp[i][j]= maxi + arr[i][j];
    }
  } int maxi = INT_MIN;
  for(int j=0;j<3;j++)
    maxi = max(maxi,dp[n-1][j];
  cout<<maxi<<endl;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:31: error: expected ')' before ';' token
   36 |     maxi = max(maxi,dp[n-1][j];
      |               ~               ^
      |                               )
Language: Java


import java.util.*;

public class Vacation {
 
	public static void main(String [] args)
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int arr[][]=new int[n][3];
		long dp[][]=new long[n][3];
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<3;j++)
			{
				arr[i][j]=sc.nextInt();
			}
		}
		for(int i=0;i<n;i++)
		{
			Arrays.fill(dp[i], -1);
		}
		long ans=rec(arr,dp,0,0);
		System.out.println(ans);
	}
 
	private static long rec(int[][] arr, long[][] dp, int ind, int sel) {
		// TODO Auto-generated method stub
		if(ind==arr.length)
		{
			return 0;
		}
		long ans=0;
		//System.out.println(ind+" "+sel);
		if(sel!=0&&dp[ind][sel-1]!=-1)
		{
			//System.out.println("y");
			return dp[ind][sel-1];
		}
		if(sel==0)
		{
			long opt1=arr[ind][0]+rec(arr,dp,ind+1,1);
			long opt2=arr[ind][1]+rec(arr,dp,ind+1,2);
			long opt3=arr[ind][2]+rec(arr,dp,ind+1,3);
			ans=Math.max(opt1, Math.max(opt2, opt3));
			return ans;
		}else if(sel==1)
		{
			long opt1=arr[ind][1]+rec(arr,dp,ind+1,2);
			long opt2=arr[ind][2]+rec(arr,dp,ind+1,3);
			ans=Math.max(opt1, opt2);
		}else if(sel==2)
		{
			long opt1=arr[ind][0]+rec(arr,dp,ind+1,1);
			long opt2=arr[ind][2]+rec(arr,dp,ind+1,3);
			ans=Math.max(opt1, opt2);
		}else {
			long opt1=arr[ind][0]+rec(arr,dp,ind+1,1);
			long opt2=arr[ind][1]+rec(arr,dp,ind+1,2);
			ans=Math.max(opt1, opt2);
		}
		//System.out.println(ind+" "+sel);
		dp[ind][sel-1]=ans;
		return ans;
	}
}

Compiler output:
Main.java:4: 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 a[100000][3];
int dp[100000][3];
 
int main()
{
int n;
  cin>>n;
  for(int i=0;i<n;i++)
  {
     for(int j=0;j<3;j++)
     {
     cin>>a[i][j];
     }
  }
  
  dp[0][0]=a[0][0];
   dp[0][1]=a[0][1];
   dp[0][2]=a[0][2];
  for(int day=1;day<n;day++)
  {
    dp[day][0]=a[day][0]+max(a[day-1][1],a[day][2]);
    dp[day][1]=a[day][1]+max(a[day-1][0],a[day][2]);
    dp[day][2]=a[day][2]+max(a[day-1][0],a[day][1]);
  }
  int answer=max(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
  cout<<answer;
  return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:27:17:   required from here
   27 |   int answer=max(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:27:17:   required from here
   27 |   int answer=max(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: invalid types 'int[int]' for array subscript
   23 |     dp[day][0]=n[day][0]+max(a[day-1][1],a[day][2]);
      |                 ^
a.cc:24:17: error: invalid types 'int[int]' for array subscript
   24 |     dp[day][1]=n[day][1]+max(a[day-1][0],a[day][2]);
      |                 ^
a.cc:25:17: error: invalid types 'int[int]' for array subscript
   25 |     dp[day][2]=n[day][2]+max(a[day-1][0],a[day][1]);
      |                 ^
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:27:17:   required from here
   27 |   int answer=max(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: invalid types 'int[int]' for array subscript
   23 |     dp[day][0]=n[day][0]+max(n[day-1][1],n[day][2]);
      |                 ^
a.cc:23:31: error: invalid types 'int[int]' for array subscript
   23 |     dp[day][0]=n[day][0]+max(n[day-1][1],n[day][2]);
      |                               ^
a.cc:23:43: error: invalid types 'int[int]' for array subscript
   23 |     dp[day][0]=n[day][0]+max(n[day-1][1],n[day][2]);
      |                                           ^
a.cc:24:17: error: invalid types 'int[int]' for array subscript
   24 |     dp[day][1]=n[day][1]+max(n[day-1][0],n[day][2]);
      |                 ^
a.cc:24:31: error: invalid types 'int[int]' for array subscript
   24 |     dp[day][1]=n[day][1]+max(n[day-1][0],n[day][2]);
      |                               ^
a.cc:24:43: error: invalid types 'int[int]' for array subscript
   24 |     dp[day][1]=n[day][1]+max(n[day-1][0],n[day][2]);
      |                                           ^
a.cc:25:17: error: invalid types 'int[int]' for array subscript
   25 |     dp[day][2]=n[day][2]+max(n[day-1][0],n[day][1]);
      |                 ^
a.cc:25:31: error: invalid types 'int[int]' for array subscript
   25 |     dp[day][2]=n[day][2]+max(n[day-1][0],n[day][1]);
      |                               ^
a.cc:25:43: error: invalid types 'int[int]' for array subscript
   25 |     dp[day][2]=n[day][2]+max(n[day-1][0],n[day][1]);
      |                                           ^
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:27:17:   required from here
   27 |   int answer=max(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: invalid types 'int[int]' for array subscript
   14 |      cin>>n[i][j];
      |            ^
a.cc:18:13: error: invalid types 'int[int]' for array subscript
   18 |   dp[0][0]=n[0][0];
      |             ^
a.cc:19:14: error: invalid types 'int[int]' for array subscript
   19 |    dp[0][1]=n[0][1];
      |              ^
a.cc:20:14: error: invalid types 'int[int]' for array subscript
   20 |    dp[0][2]=n[0][2];
      |              ^
a.cc:23:17: error: invalid types 'int[int]' for array subscript
   23 |     dp[day][0]=n[day][0]+max(n[day-1][1],n[day][2]);
      |                 ^
a.cc:23:31: error: invalid types 'int[int]' for array subscript
   23 |     dp[day][0]=n[day][0]+max(n[day-1][1],n[day][2]);
      |                               ^
a.cc:23:43: error: invalid types 'int[int]' for array subscript
   23 |     dp[day][0]=n[day][0]+max(n[day-1][1],n[day][2]);
      |                                           ^
a.cc:24:17: error: invalid types 'int[int]' for array subscript
   24 |     dp[day][1]=n[day][1]+max(n[day-1][0],n[day][2]);
      |                 ^
a.cc:24:31: error: invalid types 'int[int]' for array subscript
   24 |     dp[day][1]=n[day][1]+max(n[day-1][0],n[day][2]);
      |                               ^
a.cc:24:43: error: invalid types 'int[int]' for array subscript
   24 |     dp[day][1]=n[day][1]+max(n[day-1][0],n[day][2]);
      |                                           ^
a.cc:25:17: error: invalid types 'int[int]' for array subscript
   25 |     dp[day][2]=n[day][2]+max(n[day-1][0],n[day][1]);
      |                 ^
a.cc:25:31: error: invalid types 'int[int]' for array subscript
   25 |     dp[day][2]=n[day][2]+max(n[day-1][0],n[day][1]);
      |                               ^
a.cc:25:43: error: invalid types 'int[int]' for array subscript
   25 |     dp[day][2]=n[day][2]+max(n[day-1][0],n[day][1]);
      |                                           ^
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:27:17:   required from here
   27 |   int answer=max(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
      |              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n[100000][3];
int dp[100000][3];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: invalid types 'int[int]' for array subscript
   14 |      cin>>n[i][j];
      |            ^
a.cc:18:13: error: invalid types 'int[int]' for array subscript
   18 |   dp[0][0]=n[0][0];
      |             ^
a.cc:19:14: error: invalid types 'int[int]' for array subscript
   19 |    dp[0][1]=n[0][1];
      |              ^
a.cc:20:14: error: invalid types 'int[int]' for array subscript
   20 |    dp[0][2]=n[0][2];
      |              ^
a.cc:23:5: error: 'F' was not declared in this scope
   23 |     F[day][0]=n[day][0]+max(n[day-1][1],n[day][2]);
      |     ^
a.cc:23:16: error: invalid types 'int[int]' for array subscript
   23 |     F[day][0]=n[day][0]+max(n[day-1][1],n[day][2]);
      |                ^
a.cc:23:30: error: invalid types 'int[int]' for array subscript
   23 |     F[day][0]=n[day][0]+max(n[day-1][1],n[day][2]);
      |                              ^
a.cc:23:42: error: invalid types 'int[int]' for array subscript
   23 |     F[day][0]=n[day][0]+max(n[day-1][1],n[day][2]);
      |                                          ^
a.cc:24:16: error: invalid types 'int[int]' for array subscript
   24 |     F[day][1]=n[day][1]+max(n[day-1][0],n[day][2]);
      |                ^
a.cc:24:30: error: invalid types 'int[int]' for array subscript
   24 |     F[day][1]=n[day][1]+max(n[day-1][0],n[day][2]);
      |                              ^
a.cc:24:42: error: invalid types 'int[int]' for array subscript
   24 |     F[day][1]=n[day][1]+max(n[day-1][0],n[day][2]);
      |                                          ^
a.cc:25:16: error: invalid types 'int[int]' for array subscript
   25 |     F[day][2]=n[day][2]+max(n[day-1][0],n[day][1]);
      |                ^
a.cc:25:30: error: invalid types 'int[int]' for array subscript
   25 |     F[day][2]=n[day][2]+max(n[day-1][0],n[day][1]);
      |                              ^
a.cc:25:42: error: invalid types 'int[int]' for array subscript
   25 |     F[day][2]=n[day][2]+max(n[day-1][0],n[day][1]);
      |                                          ^
a.cc:27:18: error: 'F' was not declared in this scope
   27 |   int answer=max(F[n-1][0],F[n-1][1],F[n-1][2]);
      |                  ^
Language: Java

import java.util.*;
public class vacation {
	static Scanner sc=new Scanner(System.in);
	static int n=sc.nextInt();
	static int arr[][]=new int[n][3];
	public static void main(String args[]){
		for(int i=0;i<n;i++){
			arr[i]=new int[4];
			for(int j=1;j<4;j++){
				arr[i][j]=sc.nextInt();
			}
		}
		int ans=maxAmount(0,0);
		System.out.println(ans);
	}
	public static int maxAmount(int day,int flag){
		if(day==n){
			return 0;
		}
		int maxi=0;
		if(flag==0){
			maxi=Math.max(maxi, arr[day][1]+maxAmount(day+1,1));
			maxi=Math.max(maxi, arr[day][2]+maxAmount(day+1,2));
			maxi=Math.max(maxi, arr[day][3]+maxAmount(day+1,3));
		}
		else if(flag==1){
			maxi=Math.max(maxi, arr[day][2]+maxAmount(day+1,2));
			maxi=Math.max(maxi, arr[day][3]+maxAmount(day+1,3));
		}
		else if(flag==2){
			maxi=Math.max(maxi, arr[day][1]+maxAmount(day+1,1));
			maxi=Math.max(maxi, arr[day][3]+maxAmount(day+1,3));
		}
		else{
			maxi=Math.max(maxi, arr[day][2]+maxAmount(day+1,2));
			maxi=Math.max(maxi, arr[day][1]+maxAmount(day+1,1));
		}
		return maxi;
	}
}


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

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

// 入力
int N;
long long a[100010][3]; // 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;
    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;
                chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
            }
        }
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: 'cin' was not declared in this scope
   13 |     int N; cin >> N;
      |            ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:32:5: error: 'cout' was not declared in this scope
   32 |     cout << res << endl;
      |     ^~~~
a.cc:32:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:20: error: 'endl' was not declared in this scope
   32 |     cout << res << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[100005][4];
int dp[100005][4];
int n;

int funcc(int index, int flag) {

	if (index == n) return 0;

	if (dp[index][flag] != -1) return dp[index][flag];

	int maxi = 0;
	if (flag == 0) {
		maxi = max(maxi, a[index][1] + func(index + 1, 1));
		maxi = max(maxi, a[index][2] + func(index + 1, 2));
		maxi = max(maxi, a[index][3] + func(index + 1, 3));
	}
	else if (flag == 1) {
		maxi = max(maxi, a[index][2] + func(index + 1, 2));
		maxi = max(maxi, a[index][3] + func(index + 1, 3));
	}
	else if (flag == 2) {
		maxi = max(maxi, a[index][1] + func(index + 1, 1));
		maxi = max(maxi, a[index][3] + func(index + 1, 3));
	}
	else {
		maxi = max(maxi, a[index][1] + func(index + 1, 1));
		maxi = max(maxi, a[index][2] + func(index + 1, 2));
	}

	return dp[index][flag] = maxi;
}

int main() {

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

	memset(dp, -1, sizeof dp);

	cout << funcc(0, 0);

	return 0;
}


Compiler output:
a.cc: In function 'int funcc(int, int)':
a.cc:15:48: error: 'func' was not declared in this scope; did you mean 'funcc'?
   15 |                 maxi = max(maxi, a[index][1] + func(index + 1, 1));
      |                                                ^~~~
      |                                                funcc
a.cc:20:48: error: 'func' was not declared in this scope; did you mean 'funcc'?
   20 |                 maxi = max(maxi, a[index][2] + func(index + 1, 2));
      |                                                ^~~~
      |                                                funcc
a.cc:24:48: error: 'func' was not declared in this scope; did you mean 'funcc'?
   24 |                 maxi = max(maxi, a[index][1] + func(index + 1, 1));
      |                                                ^~~~
      |                                                funcc
a.cc:28:48: error: 'func' was not declared in this scope; did you mean 'funcc'?
   28 |                 maxi = max(maxi, a[index][1] + func(index + 1, 1));
      |                                                ^~~~
      |                                                funcc
Language: C++

int main()
{

    int n;
    cin >> n;
    int dp[n][3],a[n],b[n],c[n];

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> n;
      |     ^~~
a.cc:12:25: error: 'max' was not declared in this scope
   12 |         dp[i][0] = a[i]+max(dp[i-1][1], dp[i-1][2]);
      |                         ^~~
a.cc:16:5: error: 'cout' was not declared in this scope
   16 |     cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << '\n';
      |     ^~~~
a.cc:16:13: error: 'max' was not declared in this scope
   16 |     cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) << '\n';
      |             ^~~
Language: C++

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

int sz[2050];int val[2050];

int k,n;
int h[99999][4]; int dp[99999][4];
long long knp( int i , int f1)
{
    if(i>n) return 0;
    if( dp[i][f1] != -1 )
        return dp[i][f1];

     int ret=0;
    for (int j=1;j<=3;j++){

             if( j != f1 )
                ret = max( ret , h[i][j] + knp( i+1,j ) );

    }

    return  ( dp[i][f1] = ret );


}




int main()
{
   cin>>n;
   memset(dp,-1,sizeof(dp));

   for(int i=1;i<=n;i++){
          cin >> h[i][1] >> h[i][2] >>h[i][3];

   }
cout << knp(1,0) <<endl;


return 0;
}

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

#include <bits/stdc++.h>
#define maxn 100000+5
using namespace std;
int a[maxn],b[maxn],c[maxn],dp[maxn][3];
int main()
{
	int N;
	cin >> N;
	for(int i = 0; i < N; i++)
	{
		cin >> a[i] >> b[i] >> c[i];
	}

	dp[0][0]=a[0],dp[0][1]=b[0],dp[0][2]=c[0];
	for (int i = 1; i < N ;i ++)
	{
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
		dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i];
	}

	cout << max(dp[N-1][0], dp[N-1][1], dp[N-1][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:22:13:   required from here
   22 |         cout << max(dp[N-1][0], dp[N-1][1], dp[N-1][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 <vector>
#include <algorithms>

int main() {
  	int n;
  cin>>n;
  vector<int> a,b,c;
  for(int i=0;i<n; i++) {
    int temp1,temp2,temp3;
    cin>>temp1>>temp2>>temp3;
    a.push(back(temp1);
    b.push(back(temp2);
    c.push(back(temp3);
  }
   vector<vector<int>> dp(a,vector<int>(3,0));
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
	for(int i=0; i<n; i++) {
      	dp[i][0] = a[i] + max(dp[i-1][1],dp[i-1][2]);
      	dp[i][0] = b[i] + max(dp[i-1][0],dp[i-1][2]);
      	dp[i][0] = c[i] + max(dp[i-1][0],dp[i-1][1]);
    }
    return max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);

Compiler output:
a.cc:3:10: fatal error: algorithms: No such file or directory
    3 | #include <algorithms>
      |          ^~~~~~~~~~~~
compilation terminated.
Language: C

空じゃありません。

Compiler output:
main.c:1:17: error: stray '\343' in program
    1 | <U+7A7A><U+3058><U+3083><U+3042><U+308A><U+307E><U+305B><U+3093><U+3002>
      |                                                                 ^~~~~~~~
main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
    1 | 空じゃありません。
      | ^~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
vector<int> dp(3);
int arr[3];
int main()
{ int n,a,b,c;
  cin>>n;
  for(int m=0;m<3;m++)
  cin>>dp[m];
  for(int k=1;k<n;k++)
	{   vector<int> new_dp(3);
		for(int l=0;l<3;l++)
		cin>>arr[l];
		for(int i=0;i<3;i++)
		for(int j=0;j<3;j++)
		{ if(i==j) continue;
		  else
		  new_dp[j]= max(new_dp[j],dp[i]+arr[j]);
		}
		dp=new_dp;
	}
 cout<<max(dp[0],dp[1],dp[2]);
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc: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:11:   required from here
   23 |  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<bits/stdc++.h>
using namespace std;

vector <vector<int> > inp;

cin >> N;
for(int i=0;i<N;i++){
  vector<int>  temp1;
  for(int j=0;j<3;j++){
    cin >> temp;
    temp1.push_back(temp);

  }  
  inp.push_back(temp1);
}
int dp[inp.size()][3];
for(int i=0;i<N;i++){
  for(int j=0;j<3;j++){
    dp[i][j]=0;
  }
}
int find(int n,int A){
  if(dp[n-1][A]!=0){
    return dp[n-1][A] ;
  }
  else{
  	dp[n-1][A] = max(inp[n-1][A]+find(n-1,(A+1)%3), inp[n-1][A]+find(n-1,(A+2)%3));
    return dp[n-1][A] ;
  }
	  
}

int main(){
	
    

    
    int happ = max(find(3,0),find(3,1));
    int final_happ = max(happ,find(3,2));
    cout << final_happ;
    return 0;
  
}

Compiler output:
a.cc:6:1: error: 'cin' does not name a type
    6 | cin >> N;
      | ^~~
a.cc:7:1: error: expected unqualified-id before 'for'
    7 | for(int i=0;i<N;i++){
      | ^~~
a.cc:7:13: error: 'i' does not name a type
    7 | for(int i=0;i<N;i++){
      |             ^
a.cc:7:17: error: 'i' does not name a type
    7 | for(int i=0;i<N;i++){
      |                 ^
a.cc:16:16: error: size of array 'dp' is not an integral constant-expression
   16 | int dp[inp.size()][3];
      |        ~~~~~~~~^~
a.cc:17:1: error: expected unqualified-id before 'for'
   17 | for(int i=0;i<N;i++){
      | ^~~
a.cc:17:13: error: 'i' does not name a type
   17 | for(int i=0;i<N;i++){
      |             ^
a.cc:17:17: error: 'i' does not name a type
   17 | for(int i=0;i<N;i++){
      |                 ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

void solve()
{
    int n;
    cin >> n;
    // dp[j] - maximum points if Taro did activity j on the last day
    vector<int> dp(3);
    for (int i = 0; i < n; i++) {
        vector<int> ndp(3, 0);
        vector<int> c(3);
        for (int& _c : c) cin >> _c;
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (j != k) {
                    ndp[k] = max(ndp[k], dp[j] + c[k]);
                }
            }
        }
        dp = ndp;
    }
    cout << *max_element(dp.begin(), dp.end()) << endl;
}

int main(void)
{
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:25:14: error: 'max_element' was not declared in this scope
   25 |     cout << *max_element(dp.begin(), dp.end()) << endl;
      |              ^~~~~~~~~~~