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

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>

#define ll long long

int main()
{
    int N;
    std::cin >> N;

    ll table[N][3];
    memset(table, 0, sizeof(table));
    for (int i=0; i<N; ++i)
    {
        std::cin >> table[i][0] >> table[i][1] >> table[i][2];
    }

    ll dp[N+1][3];
    memset(dp, 0, sizeof(dp));

    for (int i=0; i<N; ++i)
    {
        // a を選択したとき -> 直前に b or c を選択した方のよりよい方
        dp[i+1][0] += std::max(dp[i][1], dp[i][2]) + table[i][0];

        // b を選択したとき
        dp[i+1][1] += std::max(dp[i][0], dp[i][2]) + table[i][1];

        // c を選択したとき
        dp[i+1][2] += std::max(dp[i][0], dp[i][1]) + table[i][2];
    }

    ll max = 0;
    for (int i=0; i<3; ++i)
    {
        if (max < dp[N][i])
            max = dp[N][i];
    }

    std::cout << max << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'memset' was not declared in this scope
   15 |     memset(table, 0, sizeof(table));
      |     ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <cmath>
  +++ |+#include <cstring>
    6 |
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>

#define ll long long

int main()
{
    int N;
    std::cin >> N;

    ll table[N][3];
    for (int i=0; i<N; ++i)
    {
        std::cin >> table[i][0] >> table[i][1] >> table[i][2];
    }

    ll dp[N+1][3];
    memset(dp, 0, sizeof(dp));

    for (int i=0; i<N; ++i)
    {
        // a を選択したとき -> 直前に b or c を選択した方のよりよい方
        dp[i+1][0] += std::max(dp[i][1], dp[i][2]) + table[i][0];

        // b を選択したとき
        dp[i+1][1] += std::max(dp[i][0], dp[i][2]) + table[i][1];

        // c を選択したとき
        dp[i+1][2] += std::max(dp[i][0], dp[i][1]) + table[i][2];
    }

    ll max = 0;
    for (int i=0; i<3; ++i)
    {
        if (max < dp[N][i])
            max = dp[N][i];
    }

    std::cout << max << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'memset' was not declared in this scope
   21 |     memset(dp, 0, sizeof(dp));
      |     ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <cmath>
  +++ |+#include <cstring>
    6 |
Language: C++


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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String in[] = br.readLine().split(" ");
        int n = Integer.parseInt(in[0]);
        int arr[][]=new int[n][3];
        int dp[][] = new int[n+1][3];
        for(int i=0;i<n;i++){
            in = br.readLine().split(" ");
            arr[i][0] = Integer.parseInt(in[0]);
            arr[i][1] = Integer.parseInt(in[1]);
            arr[i][2] = Integer.parseInt(in[2]);
        }
        for(int i=1;i<=n;i++){
            dp[i][0] = Math.max(dp[i-1][1], dp[i-1][2])+arr[i-1][0];
            dp[i][1] = Math.max(dp[i-1][0], dp[i-1][2])+arr[i-1][1];
            dp[i][2] = Math.max(dp[i-1][1], dp[i-1][0])+arr[i-1][2];
        }
        System.out.println(Math.max(Math.max(dp[n][0],dp[n][1]), dp[n][2]));
    }
}



Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.BufferedReader;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.IOException;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.Arrays;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
    7 | public class Main {
      | ^~~~~~
Language: C++

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

int f = -1;
int findMax(vector <int> x){
    int mx = 0, j = -1;
    for(int i=0; i<3; ++i){
        if(f != i){
            
            if(mx < x[i]){
                mx = x[i];
                j = i;
            }
        }
    }
    f = j;
    return mx;
}

int main(){
    vector <int> dp(3, 0);
    int n;  //days
    cin>>n;
    
    for(int i=0; i<n; ++i){
        vector <int> x(3);    //swim, catch, hw
        vector <int> temp(3, 0);

        cin>>x[0]>>x[1]>>x[2];   //same act cant be done >= 2 consec. days
        
        for(int j=0; j<3; ++j){
            for(int k=0; k<3; ++k){
                if(j != k){
                    temp[k] = max(temp[k], x[k] + dp[j]);
                }
            }
        }
        dp = temp;
    }
    cout<<max(dp[0], dp[1], dp[2])<<endl;
    //to find - max possible total points

    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(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<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<stack>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
#define MAX 510000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
using namespace std;


int main(){
  ll N,ans=0;
  cin>>N;
  ll A[N],B[N],C[N],DP[N][2];
  REP(i,N){
    cin>>A[i]>>B[i]>>C[i];
    DP[i][0]=INF;
    DP[i][1]=INF;
    DP[i][2]=INF;
  }
  DP[i][0]=A[0];
  DP[i][1]=B[0];
  DP[i][2]=C[0];
  
  for(int i=1; i<N; ++i){
    DP[i][0]=A[i]+max(DP[i][1],DP[i][2]);
    DP[i][1]=B[i]+max(DP[i][2],DP[i][0]);
    DP[i][2]=C[i]+max(DP[i][0],DP[i][1]);
  }
  
  cout<<max(DP[N-1][0],max(DP[N-1][1],DP[N-1][2]))<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:6: error: 'i' was not declared in this scope
   43 |   DP[i][0]=A[0];
      |      ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:17:43: error: expected ';' before 'dp'
   17 |     dp[i][0]=a1+max(dp[i-1][1],dp[i-1][2])
      |                                           ^
      |                                           ;
   18 |       dp[i][1]=b1+max(dp[i-1][0],dp[i-1][2])
      |       ~~
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: expected primary-expression before '<=' token
   13 |   for(int i=2;<=n;i++)
      |               ^~
a.cc:17:43: error: expected ';' before 'dp'
   17 |     dp[i][0]=a1+max(dp[i-1][1],dp[i-1][2])
      |                                           ^
      |                                           ;
   18 |       dp[i][1]=b1+max(dp[i-1][0],dp[i-1][2])
      |       ~~
Language: C++

#include <iostream>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   17 |   cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]});
      |           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 arr[n][3];
  for(int i = 0; i < n; i++) cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
  int dp[n][3];
  dp[0][0] = arr[0][0];
  dp[0][1] = arr[0][1];
  dp[0][2] = arr[0][2];
  for(int i = 1; i < n; i++)
  {
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + arr[i][0];
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + arr[i][1];
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + arr[i][2];
  }
  cout << max(dp[n-1][0], dp[n-1][1], dp[n-1][2])<<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:20:14:   required from here
   20 |   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<string>
#include<limits>
#include<queue>
#include<stack>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include <algorithm>
#include<utility>
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define vi  vector<int>
#define ll long long
#define pb push_back
#define ff first
#define ss second 
#define rep(n) for(int i=0; i<n ; i++)
#define input(n) for(int i=0; i<n ; i++){cin>>arr[i];}
#define output(n) for(int i=0; i<n ; i++){cout<<arr[i]<<" ";}
#define tc int t; cin>>t; while(t--)
using namespace std;
int32_t main()
{
	int n;
	cin>>n;
	

	int a[n];
	int b[n];
	int c[n];

	rep(n)
	{
		cin>>a[i]>>b[i]>>c[i];
	}

	int dp[n][3];

	memset(dp,0,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][2],dp[i-1][0]);
		dp[i][2] = c[i] + max(dp[i-1][1],dp[i-1][0]);
	}

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


	

	return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:41:9: error: 'memset' was not declared in this scope
   41 |         memset(dp,0,sizeof(dp));
      |         ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include<utility>
  +++ |+#include <cstring>
   12 | #define pii pair<int,int>
Language: C++

#include<bits/stdc++.h> 
using namespace std;
int xyz(int i,vector<int> &a,vector<int> &b,vector<int> &c,int p)
 {
  int x;
  if(p==3)
  {
  x=max(a[i],b[i]);
  if(a[i]==b[i])
    {
    if(a[i+1]>b[i+1])
      p=2;
    else p=1;
    }
  else if (x==a[i])
    p=1;
  else if (x==b[i])
    p=2;
   }
  else if(p==2)
  {
  x=max(a[i],c[i]);
  if(a[i]==c[i])
    {
    if(a[i+1]>c[i+1])
      p=3;
    else p=1;
    }
  else if (x==a[i])
    p=1;
  else if (x==c[i])
    p=3;
   }
  else if(p==1)
  {
  x=max(c[i],b[i]);
  if(c[i]==b[i])
    {
    if(c[i+1]>b[i+1])
      p=2;
    else p=3;
    }
  else if (x==c[i])
    p=3;
  else if (x==b[i])
    p=2;
   }
  return p;
  }
int main() 
{ 
  int n,i,j=0,p;
  cin>>n;
  vector<int>a(n);
  vector<int>b(n);
  vector<int>c(n);
  vector<int>x(n);
  vector<int>y(n);
  for(i=0;i<n;i++)
    {
    cin>>a[i];
    cin>>b[i];
    cin>>c[i];
    }
 while(j!=n)
 {
   if(a[j]==b[j] && b[j]==c[j])
     {
     if(j==0)
       y[j]=a[j]
     else
      y[j]=y[j]+y[j-1];
     j++;
      }
   else 
     break;
  }
  if(a[j]==b[j] && a[j]>c[j])
    {
    if (a[j+1]>b[j+1])
      p=2;
    else
      p=1;
    }
  if(a[j]==c[j] && a[j]>b[j])
    {
    if (a[j+1]>c[j+1])
      p=3;
    else
      p=1;
    }
  if(c[j]==b[j] && c[j]>a[j])
    {
    if (c[j+1]>b[j+1])
      p=2;
    else
      p=3;
    }
  else if (a[j]>b[j] && a[j]>c[j])
    p=1;
  else if (c[j]>b[j] && a[j]<c[j])
    p=3;
  else if (a[j]<b[j] && b[j]>c[j])
    p=2;
  if(p==1)
  {
    if(j==0)
      y[j]=a[j];
    else
      y[j]=a[j]+y[j-1];
  }
  else if(p==2)
  {
    if(j==0)
      y[j]=b[j];
    else
      y[j]=b[j]+y[j-1];
  }
  else if(p==3)
  {
    if(j==0)
      y[j]=c[j];
    else
      y[j]=c[j]+y[j-1];
  }
  for (i=j+1;i<n;i++)
  {
    p=xyz(i,a,b,c,p);
    if(p==3)
      y[i]=y[i-1]+c[i];
    else if(p==2)
      y[i]=y[i-1]+b[i];
    else if(p==1)
      y[i]=y[i-1]+a[i];
    }
  cout<<y[n-1]<<endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:70:17: error: expected ';' before 'else'
   70 |        y[j]=a[j]
      |                 ^
      |                 ;
   71 |      else
      |      ~~~~
Language: C++

#include<bits/stdc++.h> 
using namespace std;
int xyz(int i,int a[],int b[],int c[],int p)
 {
  int x;
  if(p==3)
  {
  x=max(a[i],b[i]);
  if(a[i]==b[i])
    {
    if(a[i+1]>b[i+1])
      p=2;
    else p=1;
    }
  else if (x==a[i])
    p=1;
  else if (x==b[i])
    p=2;
   }
  else if(p==2)
  {
  x=max(a[i],c[i]);
  if(a[i]==c[i])
    {
    if(a[i+1]>c[i+1])
      p=3;
    else p=1;
    }
  else if (x==a[i])
    p=1;
  else if (x==c[i])
    p=3;
   }
  if(p==1)
  {
  x=max(c[i],b[i]);
  if(c[i]==b[i])
    {
    if(c[i+1]>b[i+1])
      p=2;
    else p=3;
    }
  else if (x==c[i])
    p=3;
  else if (x==b[i])
    p=2;
   }
  return p;
  }
int main() 
{ 
  int n,i,j=0,p;
  cin>>n;
  int a[n],b[n],c[n],y[n],x[n];
  for(i=0;i<n;i++)
    {
    cin>>a[i];
    cin>>b[i];
    cin>>c[i];
    }
 while(j!=n)
 {
   if(a[j]==b[j] && b[j]==c[j])
     {y[j]=a[j];
      y[j]=y[j]+y[j-1];
     j++;
      }
   else 
     break;
  }
  if(a[j]==b[j] && a[j]>c[j])
    {
    if (a[j+1]>b[j+1])
      p=2;
    else
      p=1;
    }
  if(a[j]==c[j] && a[j]>b[j])
    {
    if (a[j+1]>c[j+1])
      p=3;
    else
      p=1;
    }
  if(c[j]==b[j] && c[j]>a[j])
    {
    if (c[j+1]>b[j+1])
      p=2;
    else
      p=3;
    }
  else if (a[j]>b[j] && a[i]>c[i])
    p=1;
  else if (c[j]>b[j] && a[i]<c[i])
    p=3;
  else if (a[j]<b[j] && b[i]>c[i])
    p=2;
  if(p==1)
    y[j]=a[j]+y[j-1];
  else if(p==2)
    y[j]=b[j]+y[j-1];
  else if(p==3)
    y[j]=c[j]+y[j-1];
  for (i=j+1;i<n;i++)
  {
    p=xyz(i,a[n],b[n],c[n],p);
    if(p==3)
      y[i]=c[i];
    else if(p==2)
      y[i]=b[i];
    else if(p==1)
      y[i]=a[i];
    y[i]=y[i]+y[i-1];
    }
  cout<<y[n-1]<<endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:106:16: error: invalid conversion from 'int' to 'int*' [-fpermissive]
  106 |     p=xyz(i,a[n],b[n],c[n],p);
      |             ~~~^
      |                |
      |                int
a.cc:3:19: note:   initializing argument 2 of 'int xyz(int, int*, int*, int*, int)'
    3 | int xyz(int i,int a[],int b[],int c[],int p)
      |               ~~~~^~~
a.cc:106:21: error: invalid conversion from 'int' to 'int*' [-fpermissive]
  106 |     p=xyz(i,a[n],b[n],c[n],p);
      |                  ~~~^
      |                     |
      |                     int
a.cc:3:27: note:   initializing argument 3 of 'int xyz(int, int*, int*, int*, int)'
    3 | int xyz(int i,int a[],int b[],int c[],int p)
      |                       ~~~~^~~
a.cc:106:26: error: invalid conversion from 'int' to 'int*' [-fpermissive]
  106 |     p=xyz(i,a[n],b[n],c[n],p);
      |                       ~~~^
      |                          |
      |                          int
a.cc:3:35: note:   initializing argument 4 of 'int xyz(int, int*, int*, int*, int)'
    3 | int xyz(int i,int a[],int b[],int c[],int p)
      |                               ~~~~^~~
Language: C++

#include<bits/stdc++.h> 
using namespace std;
int xyz(int i,int a[],int b[],int c[],int p)
 {
  int x;
  if(p==3)
  {
  x=max(a[i],b[i]);
  if(a[i]==b[i])
    {
    if(a[i+1]>b[i+1])
      p=2;
    else p=1;
    }
  else if (x==a[i])
    p=1;
  else if (x==b[i])
    p=2;
   }
  else if(p==2)
  {
  x=max(a[i],c[i]);
  if(a[i]==c[i])
    {
    if(a[i+1]>c[i+1])
      p=3;
    else p=1;
    }
  else if (x==a[i])
    p=1;
  else if (x==c[i])
    p=3;
   }
  if(p==1)
  {
  x=max(c[i],b[i]);
  if(c[i]==b[i])
    {
    if(c[i+1]>b[i+1])
      p=2;
    else p=3;
    }
  else if (x==c[i])
    p=3;
  else if (x==b[i])
    p=2;
   }
  return p;
  }
int main() 
{ 
  int n,i,j=0;
  cin>>n;
  int a[n],b[n],c[n],y[n],x[n];
  for(i=0;i<n;i++)
    {
    cin>>a[i];
    cin>>b[i];
    cin>>c[i];
    }
 while(j!=n)
 {
   if(a[j]==b[j] && b[j]==c[j])
     {y[j]=a[j];
      y[j]=y[j]+y[j-1];
     j++;
      }
   else 
     break;
  }
  if(a[j]==b[j] && a[j]>c[j])
    {
    if (a[j+1]>b[j+1])
      p=2;
    else
      p=1;
    }
  if(a[j]==c[j] && a[j]>b[j])
    {
    if (a[j+1]>c[j+1])
      p=3;
    else
      p=1;
    }
  if(c[j]==b[j] && c[j]>a[j])
    {
    if (c[j+1]>b[j+1])
      p=2;
    else
      p=3;
    }
  else if (a[j]>b[j] && a[i]>c[i])
    p=1;
  else if (c[j]>b[j] && a[i]<c[i])
    p=3;
  else if (a[j]<b[j] && b[i]>c[i])
    p=2;
  if(p==1)
    y[j]=a[j]+y[j-1];
  else if(p==2)
    y[j]=b[j]+y[j-1];
  else if(p==3)
    y[j]=c[j]+y[j-1];
  for (i=j+1;i<n;i++)
  {
    p=xyz(i,a[n],b[n],c[n],p);
    if(p==3)
      y[i]=c[i];
    else if(p==2)
      y[i]=b[i];
    else if(p==1)
      y[i]=a[i];
    y[i]=y[i]+y[i-1];
    }
  cout<<y[n-1]<<endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:74:7: error: 'p' was not declared in this scope
   74 |       p=2;
      |       ^
a.cc:76:7: error: 'p' was not declared in this scope
   76 |       p=1;
      |       ^
a.cc:81:7: error: 'p' was not declared in this scope
   81 |       p=3;
      |       ^
a.cc:83:7: error: 'p' was not declared in this scope
   83 |       p=1;
      |       ^
a.cc:88:7: error: 'p' was not declared in this scope
   88 |       p=2;
      |       ^
a.cc:90:7: error: 'p' was not declared in this scope
   90 |       p=3;
      |       ^
a.cc:93:5: error: 'p' was not declared in this scope
   93 |     p=1;
      |     ^
a.cc:95:5: error: 'p' was not declared in this scope
   95 |     p=3;
      |     ^
a.cc:97:5: error: 'p' was not declared in this scope
   97 |     p=2;
      |     ^
a.cc:98:6: error: 'p' was not declared in this scope
   98 |   if(p==1)
      |      ^
a.cc:106:5: error: 'p' was not declared in this scope
  106 |     p=xyz(i,a[n],b[n],c[n],p);
      |     ^
Language: C++

#include<iostream>
using namespace std;

#define Max 100001
int a[Max];
int b[Max];
int c[Max];
int dp[Max][3];

int main(){
	int n;
	memset(dp,0,sizeof(dp));
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i]>>c[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][1],dp[i-1][0])+c[i];
	}
	int ans=max(max(dp[n][0],dp[n][1]),dp[n][2]);
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'memset' was not declared in this scope
   12 |         memset(dp,0,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 <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#include<iomanip>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define MOD 1000000007

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

int main() {
	vt n;
	cin >> n;
	vector<vector<vt>> abc(n, vector<vt>(3));
	rep(i, n) rep(j, 3) cin >> abc.at(i).at(j);
	vector<vector<vt>> dp(n, vector<vt>(3, -1));
	if (n == 1) {
		cout << max(abc.at(0).at(0), abc.at(0).at(1), abc.at(0).at(2));
		return 0;
	}
	rep(i, n) {
		rep(j, 3) {
			rep(k, 3) {
				if (j != k) {
					chmax(dp.at(i), dp(i - 1) +
				}
			}
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:59: error: no match for call to '(std::vector<std::vector<long long int> >) (vt)'
   50 |                                         chmax(dp.at(i), dp(i - 1) +
      |                                                         ~~^~~~~~~
a.cc:51:33: error: expected primary-expression before '}' token
   51 |                                 }
      |                                 ^
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:43:14:   required from here
   43 |                 cout << max(abc.at(0).at(0), abc.at(0).at(1), abc.at(0).at(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;

#define int long long
template<class T> inline bool chmax(T& a, T b){
    if(a < b) {a = b; return 1; } return 0;
} 
const int INF = -1000000000;
int dp[100010][3];
int action[10010][3];
signed main(){
    int n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            cin >> action[i][j];
        }
    }
   
    for(int i = 1; i < n; i++){
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(k != j){
                    chmax(dp[i][k], dp[i - 1][j] + action[i][k]);
                }
            }
        }
    }
    cout << max({dp[n - 1][0],dp[n - 1][1],dp[n - 1][2]}) << endl;
}

Compiler output:
a.cc:1:1: error: stray '\' in program
    1 | \#include<bits/stdc++.h>
      | ^
a.cc:1:2: error: stray '#' in program
    1 | \#include<bits/stdc++.h>
      |  ^
a.cc:1:3: error: 'include' does not name a type
    1 | \#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc: In function 'int main()':
a.cc:15:13: error: 'cin' was not declared in this scope
   15 |             cin >> action[i][j];
      |             ^~~
a.cc:28:5: error: 'cout' was not declared in this scope
   28 |     cout << max({dp[n - 1][0],dp[n - 1][1],dp[n - 1][2]}) << endl;
      |     ^~~~
a.cc:28:13: error: 'max' was not declared in this scope
   28 |     cout << max({dp[n - 1][0],dp[n - 1][1],dp[n - 1][2]}) << endl;
      |             ^~~
a.cc:28:62: error: 'endl' was not declared in this scope
   28 |     cout << max({dp[n - 1][0],dp[n - 1][1],dp[n - 1][2]}) << endl;
      |                                                              ^~~~
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	dp[4][100100];
	v[4][100100];
	dp[1][0]=0;
	dp[2][0]=0;
	dp[3][0]=0;
	for(int i=1;i<=n;i++)
		cin>>v[1][i]>>v[2][i]>>v[3][i];
	for(int i=1;i<=n;i++)
		{
			dp[i][1]=max(dp[i-1][2],dp[i-1][3])+v[i][1];
			dp[i][2]=max(dp[i-1][1],dp[i-1][3])+v[i][2];
			dp[i][3]=max(dp[i-1][1],dp[i-1][2])+v[i][3];
		}
	int ans=dp[n][1];
	if(dp[n][1]>max(dp[n][2],dp[n][3]))
	cout<<dp[n][1];
	else
	cout<<max(dp[n][2],dp[n][3]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'dp' was not declared in this scope
    7 |         dp[4][100100];
      |         ^~
a.cc:8:9: error: 'v' was not declared in this scope
    8 |         v[4][100100];
      |         ^
Language: C++

/*3
10 40 70
20 50 80
30 60 90*/
int main(){
	int n;
	cin>>n;
	dp[4][100100];
	v[4][100100];
	dp[1][0]=0;
	dp[2][0]=0;
	dp[3][0]=0;
	for(int i=1;i<=n;i++)
		cin>>v[1][i]>>v[2][i]>>v[3][i];
	for(int i=1;i<=n;i++)
		{
			dp[i][1]=max(dp[i-1][2],dp[i-1][3])+v[i][1];
			dp[i][2]=max(dp[i-1][1],dp[i-1][3])+v[i][2];
			dp[i][3]=max(dp[i-1][1],dp[i-1][2])+v[i][3];
		}
	int ans=dp[n][1];
	if(dp[n][1]>max(dp[n][2],dp[n][3]))
	cout<<dp[n][1];
	else
	cout<<max(dp[n][2],dp[n][3]);
}

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:8:9: error: 'dp' was not declared in this scope
    8 |         dp[4][100100];
      |         ^~
a.cc:9:9: error: 'v' was not declared in this scope
    9 |         v[4][100100];
      |         ^
a.cc:17:34: error: 'max' was not declared in this scope
   17 |                         dp[i][1]=max(dp[i-1][2],dp[i-1][3])+v[i][1];
      |                                  ^~~
a.cc:22:21: error: 'max' was not declared in this scope
   22 |         if(dp[n][1]>max(dp[n][2],dp[n][3]))
      |                     ^~~
a.cc:23:9: error: 'cout' was not declared in this scope
   23 |         cout<<dp[n][1];
      |         ^~~~
a.cc:25:9: error: 'cout' was not declared in this scope
   25 |         cout<<max(dp[n][2],dp[n][3]);
      |         ^~~~
Language: C++

#include<bits/stdc++.h> 
using namespace std;
int xyz(int i,int a[],int b[],int c[],int p)
 {
  int x;
  if(p==3)
  {
  x=max(a[i],b[i]);
  if(a[i]==b[i])
    {
    if(a[i+1]>b[i+1])
      p=2;
    else p=1;
    }
  else if (x==a[i])
    p=1;
  else if (x==b[i])
    p=2;
   }
  else if(p==2)
  {
  x=max(a[i],c[i]);
  if(a[i]==c[i])
    {
    if(a[i+1]>c[i+1])
      p=3;
    else p=1;
    }
  else if (x==a[i])
    p=1;
  else if (x==c[i])
    p=3;
   }
  if(p==1)
  {
  x=max(c[i],b[i]);
  if(c[i]==b[i])
    {
    if(c[i+1]>b[i+1])
      p=2;
    else p=3;
    }
  else if (x==c[i])
    p=3;
  else if (x==b[i])
    p=2;
   }
  return p;
  }
int main() 
{ 
  int n,i,j=0;
  cin>>n;
  int a[n],b[n],c[n],y[n],x[n];
  for(i=0;i<n;i++)
    {
    cin>>a[i];
    cin>>b[i];
    cin>>c[i];
    }
 while(j!=n)
 {
   if(a[j]==b[j] && b[j]==c[j])
     {y[j]=a[j];
      y[j]=y[j]+y[j-1];
     j++;
      }
   else 
     break;
  }
  if(a[j]==b[j] && a[j]>c[j])
    {
    if (a[j+1]>b[j+1])
      p=2;
    else
      p=1;
    }
  if(a[j]==c[j] && a[j]>b[j])
    {
    if (a[j+1]>c[j+1])
      p=3;
    else
      p=1;
    }
  if(c[j]==b[j] && c[j]>a[j])
    {
    if (c[j+1]>b[j+1])
      p=2;
    else
      p=3;
    }
  else if (a[j]>b[j] && a[i]>c[i])
    p=1;
  else if (c[j]>b[j] && a[i]<c[i])
    p=3;
  else if (a[j]<b[j] && b[i]>c[i])
    p=2;
  if(p==1)
    y[j]=a[j]+y[j-1];
  else if(p==2)
    y[j]=b[j]+y[j-1];
  else if(p==3)
    y[j]=c[j]+y[j-1];
  for (i=j+1;i<n;i++)
  {
    p=xyz(i,a[n],b[n],c[n],p);
    if(p==3)
      y[i]=c[i];
    else if(p==2)
      y[i]=b[i];
    else if(p==1)
      y[i]=a[i];
    y[i]=y[i]+y[i-1];
    }
  cout<<y[n-1]<<endl;
  

Compiler output:
a.cc: In function 'int main()':
a.cc:74:7: error: 'p' was not declared in this scope
   74 |       p=2;
      |       ^
a.cc:76:7: error: 'p' was not declared in this scope
   76 |       p=1;
      |       ^
a.cc:81:7: error: 'p' was not declared in this scope
   81 |       p=3;
      |       ^
a.cc:83:7: error: 'p' was not declared in this scope
   83 |       p=1;
      |       ^
a.cc:88:7: error: 'p' was not declared in this scope
   88 |       p=2;
      |       ^
a.cc:90:7: error: 'p' was not declared in this scope
   90 |       p=3;
      |       ^
a.cc:93:5: error: 'p' was not declared in this scope
   93 |     p=1;
      |     ^
a.cc:95:5: error: 'p' was not declared in this scope
   95 |     p=3;
      |     ^
a.cc:97:5: error: 'p' was not declared in this scope
   97 |     p=2;
      |     ^
a.cc:98:6: error: 'p' was not declared in this scope
   98 |   if(p==1)
      |      ^
a.cc:106:5: error: 'p' was not declared in this scope
  106 |     p=xyz(i,a[n],b[n],c[n],p);
      |     ^
a.cc:115:22: error: expected '}' at end of input
  115 |   cout<<y[n-1]<<endl;
      |                      ^
a.cc:51:1: note: to match this '{'
   51 | {
      | ^
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class A {
	public static void main (String[] args) {
		Scanner s=new Scanner(System.in);    
		int N=s.nextInt();		
		long A[][]=new long[N][3];
      for(int i=0;i<N;i++)
      {
         for(int j=0;j<3;j++)
         {
           A[i][j]=s.nextInt();
         }
      }
      long a=A[N-1][0],b=A[N-1][1],c=A[N-1][2];
      System.out.println(a+" "+b+" "+c);
      for(int i=N-2;i>=0;i--)
      {
    	long p=a,q=b,r=c;  
        a=(long)Math.max(q+A[i][0],r+A[i][0]);
        b=(long)Math.max(p+A[i][1],r+A[i][1]);
        c=(long)Math.max(p+A[i][2],q+A[i][2]);
      //  System.out.println(a+" "+b+" "+c);
      }
      long m=(long)Math.max(a,(long)Math.max(b,c));
      System.out.println(m);
	}
}


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

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<stdbool.h>
typedef long long ll;
#define elif else if
#define mod 1000000007

ll maxx(ll a, ll b)
{
	return (a>b)?a:b;
}
int main(void)
{
	ll n;
	scanf("%lld",&n);
	ll arr[n][3];
	for(ll i = 0;i<n;i++)
	{
		scanf("%lld %lld %lld",&arr[i][0],&arr[i][1],&arr[i][2]);
	}

	ll dp[n][3],ans;
	memset(dp,0,sizeof(dp));
	dp[0][0] = arr[0][0];
	dp[0][1] = arr[0][1];
	dp[0][2] = arr[0][2];
	for(ll i = 1;i<n;i++)
	{
		dp[i][0] = arr[i][0] + maxx(dp[i-1][1],dp[i-1][2]);
		dp[i][1] = arr[i][1] + maxx(dp[i-1][0],dp[i-1][2]);
		dp[i][2] = arr[i][2] + maxx(dp[i-1][1],dp[i-1][0]);
	}
	// ans = maxx
	ans = maxx(dp[n-1][0],maxx(dp[n-1][1],dp[n-1][2]));
	prllf("%lld\n",ans);
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:37:9: error: implicit declaration of function 'prllf' [-Wimplicit-function-declaration]
   37 |         prllf("%lld\n",ans);
      |         ^~~~~
Language: C++

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<stdbool.h>
#define int long long
#define elif else if
#define mod 1000000007

int maxx(int a, int b)
{
	return (a>b)?a:b;
}
int main(void)
{
	int n;
	scanf("%lld",&n);
	int arr[n][3];
	for(int i = 0;i<n;i++)
	{
		scanf("%lld %lld %lld",&arr[i][0],&arr[i][1],&arr[i][2]);
	}

	int dp[n][3],ans;
	memset(dp,0,sizeof(dp));
	dp[0][0] = arr[0][0];
	dp[0][1] = arr[0][1];
	dp[0][2] = arr[0][2];
	for(int i = 1;i<n;i++)
	{
		dp[i][0] = arr[i][0] + maxx(dp[i-1][1],dp[i-1][2]);
		dp[i][1] = arr[i][1] + maxx(dp[i-1][0],dp[i-1][2]);
		dp[i][2] = arr[i][2] + maxx(dp[i-1][1],dp[i-1][0]);
	}
	// ans = maxx
	ans = maxx(dp[n-1][0],maxx(dp[n-1][1],dp[n-1][2]));
	printf("%lld\n",ans);
	return 0;
}


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

#include<bits/stdc++.h> 
using namespace std;
int xyz(int i,int a[n],int b[n],int c[n],p)
 {
  int x;
  if(p==3)
  {
  x=max(a[i],b[i]);
  if(a[i]==b[i])
    {
    if(a[i+1]>b[i+1])
      p=2;
    else p=1;
    }
  else if (x==a[i])
    p=1;
  else if (x==b[i])
    p=2;
   }
  else if(p==2)
  {
  x=max(a[i],c[i]);
  if(a[i]==c[i])
    {
    if(a[i+1]>c[i+1])
      p=3;
    else p=1;
    }
  else if (x==a[i])
    p=1;
  else if (x==c[i])
    p=3;
   }
  if(p==1)
  {
  x=max(c[i],b[i]);
  if(c[i]==b[i])
    {
    if(c[i+1]>b[i+1])
      p=2;
    else p=3;
    }
  else if (x==c[i])
    p=3;
  else if (x==b[i])
    p=2;
   }
  return p;
  }
int main() 
{ 
  int n,i,j=0;
  cin>>n;
  int a[n],b[n],c[n],y[n],x[n];
  for(i=0;i<n;i++)
    {
    cin>>a[i];
    cin>>b[i];
    cin>>c[i];
    }
 while(j!=n)
 {
   if(a[j]==b[j] && b[j]==c[j])
     {y[j]=a[j];
      y[j]=y[j]+y[j-1];
     j++;
      }
   else 
     break;
  }
  if(a[j]==b[j] && a[j]>c[j])
    {
    if (a[j+1]>b[j+1])
      p=2;
    else
      p=1;
    }
  if(a[j]==c[j] && a[j]>b[j])
    {
    if (a[j+1]>c[j+1])
      p=3;
    else
      p=1;
    }
  if(c[j]==b[j] && c[j]>a[j])
    {
    if (c[j+1]>b[j+1])
      p=2;
    else
      p=3;
    }
  else if (a[j]>b[j] && a[i]>c[i])
    p=1;
  else if (c[j]>b[j] && a[i]<c[i])
    p=3;
  else if (a[j]<b[j] && b[i]>c[i])
    p=2;
  if(p==1)
    y[j]=a[j]+y[j-1];
  else if(p==2)
    y[j]=b[j]+y[j-1];
  else if(p==3)
    y[j]=c[j]+y[j-1];
  for (i=j+1;i<n;i++)
  {
    p=xyz(i,a[n],b[n],c[n],p);
    if(p==3)
      y[i]=c[i];
    else if(p==2)
      y[i]=b[i];
    else if(p==1)
      y[i]=a[i];
    y[i]=y[i]+y[i-1];
    }
  cout<<y[n-1]<<endl;
  }
       
    
  

Compiler output:
a.cc:3:21: error: 'n' was not declared in this scope
    3 | int xyz(int i,int a[n],int b[n],int c[n],p)
      |                     ^
a.cc:3:23: error: expected ')' before ',' token
    3 | int xyz(int i,int a[n],int b[n],int c[n],p)
      |        ~              ^
      |                       )
a.cc:3:24: error: expected unqualified-id before 'int'
    3 | int xyz(int i,int a[n],int b[n],int c[n],p)
      |                        ^~~
a.cc: In function 'int main()':
a.cc:74:7: error: 'p' was not declared in this scope
   74 |       p=2;
      |       ^
a.cc:76:7: error: 'p' was not declared in this scope
   76 |       p=1;
      |       ^
a.cc:81:7: error: 'p' was not declared in this scope
   81 |       p=3;
      |       ^
a.cc:83:7: error: 'p' was not declared in this scope
   83 |       p=1;
      |       ^
a.cc:88:7: error: 'p' was not declared in this scope
   88 |       p=2;
      |       ^
a.cc:90:7: error: 'p' was not declared in this scope
   90 |       p=3;
      |       ^
a.cc:93:5: error: 'p' was not declared in this scope
   93 |     p=1;
      |     ^
a.cc:95:5: error: 'p' was not declared in this scope
   95 |     p=3;
      |     ^
a.cc:97:5: error: 'p' was not declared in this scope
   97 |     p=2;
      |     ^
a.cc:98:6: error: 'p' was not declared in this scope
   98 |   if(p==1)
      |      ^
a.cc:106:5: error: 'p' was not declared in this scope
  106 |     p=xyz(i,a[n],b[n],c[n],p);
      |     ^
Language: C++

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

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


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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} in assignment
   12 |   dp[0][0] = a[0];
      |                 ^
a.cc:13:17: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} in assignment
   13 |   dp[0][1] = a[1];
      |                 ^
a.cc:14:17: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} in assignment
   14 |   dp[0][2] = a[2];
      |                 ^
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:21:12:   required from here
   21 |   cout<<max(dp[n-1][0] , dp[n-1][1] , dp[n-1][2]);
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: expected primary-expression before ';' token
    8 |   for(int i = ; i < n; i ++)
      |               ^
a.cc:9:10: error: 'a' was not declared in this scope
    9 |     cin>>a[0]>>a[1]>>a[2];
      |          ^
a.cc:12:14: error: 'a' was not declared in this scope
   12 |   dp[0][0] = a[0];
      |              ^
a.cc:21:39: error: 'd' was not declared in this scope; did you mean 'dp'?
   21 |   cout<<max(dp[n-1][0] , dp[n-1][1] , d[n-1][2]);
      |                                       ^
      |                                       dp
Language: C++

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

int main() 
{ 
  int n,i;
  cin>>n;
  int a[n],b[n],c[n],y[n],x[n];
  for(i=0;i<n;i++)
    {
    cin>>a[i];
    cin>>b[i];
    cin>>c[i];
    }
  int p=Max(a[0],b[0]);
  y[0]=Max(p,c[0]);
  for(i=0;i<n;i++)
  {
    if(x[i-1]==c[i-1])
      x[i]=Max(a[i],b[i]);
    else if(x[i-1]==b[i-1])
      x[i]=Max(a[i],c[i]);
    else if(x[i-1]==a[i-1])
      x[i]=Max(c[i],b[i]);
    y[i]=x[i];
    y[i]=y[i-1]+y[i];
    }
  cout<<y[n-1]<<endl

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin>>n;
      |   ^~~
a.cc:15:9: error: 'Max' was not declared in this scope
   15 |   int p=Max(a[0],b[0]);
      |         ^~~
a.cc:28:3: error: 'cout' was not declared in this scope
   28 |   cout<<y[n-1]<<endl
      |   ^~~~
a.cc:28:17: error: 'endl' was not declared in this scope
   28 |   cout<<y[n-1]<<endl
      |                 ^~~~
a.cc:28:21: error: expected '}' at end of input
   28 |   cout<<y[n-1]<<endl
      |                     ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

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

int main() 
{ 
  int n,i;
  cin>>n;
  int a[n],b[n],c[n],y[n],x[n];
  for(i=0;i<n;i++)
    {
    cin>>a[i];
    cin>>b[i];
    cin>>c[i];
    }
  int p=Max(a[0],b[0]);
  y[0]=Max(p,c[0]);
  for(i=0;i<n;i++)
  {
    if(x[i-1]==c[i-1])
      x[i]=Max(a[i],b[i]);
    else if(x[i-1]==b[i-1])
      x[i]=Max(a[i],c[i]);
    else if(x[i-1]==a[i-1])
      x[i]=Max(c[i],b[i]);
    y[i]=x[i];
    y[i]=y[i-1]+y[i];
    }
  cout<<y[n-1]<<endl;

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin>>n;
      |   ^~~
a.cc:15:9: error: 'Max' was not declared in this scope
   15 |   int p=Max(a[0],b[0]);
      |         ^~~
a.cc:28:3: error: 'cout' was not declared in this scope
   28 |   cout<<y[n-1]<<endl;
      |   ^~~~
a.cc:28:17: error: 'endl' was not declared in this scope
   28 |   cout<<y[n-1]<<endl;
      |                 ^~~~
a.cc:28:22: error: expected '}' at end of input
   28 |   cout<<y[n-1]<<endl;
      |                      ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:21: error: assigning to an array from an initializer list
    5 |   int dp[N][3];dp[0]={a,b,c};
      |                ~~~~~^~~~~~~~
a.cc:12:28: error: 'i' was not declared in this scope
   12 |   cout<<max({dp[N-1][0],dp[i-1][1],dp[i-1][2]})<<endl;
      |                            ^
a.cc:12:12: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   12 |   cout<<max({dp[N-1][0],dp[i-1][1],dp[i-1][2]})<<endl;
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 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
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:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include<bits/stdc++.h>
using namespace std;
struct three{
    ll a;
	ll b;
	ll c;
};
int main(){
    ll n;
    cin>>n;
    three d[n+1],mas[n+1];
    for(ll k=1;k<=n;k++){
        ll x,y,z;
        cin>>x>>y>>z;
        mas[k].a=x;
        mas[k].b=y;
        mas[k].c=z;
    }
    d[1]=mas[1];
    for(ll k=2;k<=n;k++){
        d[k].a=mas[k].a+max(d[k-1].b,d[k-1].c);
        d[k].b=mas[k].b+max(d[k-1].c,d[k-1].a);
        d[k].c=mas[k].c+max(d[k-1].a,d[k-1].b);
    }
    cout<<max(max(d[n].a,d[n].b),d[n].c);
}

Compiler output:
a.cc:4:5: error: 'll' does not name a type
    4 |     ll a;
      |     ^~
a.cc:5:9: error: 'll' does not name a type
    5 |         ll b;
      |         ^~
a.cc:6:9: error: 'll' does not name a type
    6 |         ll c;
      |         ^~
a.cc: In function 'int main()':
a.cc:9:5: error: 'll' was not declared in this scope
    9 |     ll n;
      |     ^~
a.cc:10:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 |     cin>>n;
      |          ^
      |          yn
a.cc:12:11: error: expected ';' before 'k'
   12 |     for(ll k=1;k<=n;k++){
      |           ^~
      |           ;
a.cc:12:16: error: 'k' was not declared in this scope
   12 |     for(ll k=1;k<=n;k++){
      |                ^
a.cc:13:11: error: expected ';' before 'x'
   13 |         ll x,y,z;
      |           ^~
      |           ;
a.cc:14:14: error: 'x' was not declared in this scope
   14 |         cin>>x>>y>>z;
      |              ^
a.cc:14:17: error: 'y' was not declared in this scope; did you mean 'yn'?
   14 |         cin>>x>>y>>z;
      |                 ^
      |                 yn
a.cc:14:20: error: 'z' was not declared in this scope
   14 |         cin>>x>>y>>z;
      |                    ^
a.cc:15:9: error: 'mas' was not declared in this scope
   15 |         mas[k].a=x;
      |         ^~~
a.cc:19:5: error: 'd' was not declared in this scope
   19 |     d[1]=mas[1];
      |     ^
a.cc:19:10: error: 'mas' was not declared in this scope
   19 |     d[1]=mas[1];
      |          ^~~
a.cc:20:11: error: expected ';' before 'k'
   20 |     for(ll k=2;k<=n;k++){
      |           ^~
      |           ;
a.cc:20:16: error: 'k' was not declared in this scope
   20 |     for(ll k=2;k<=n;k++){
      |                ^