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

#include <iostream>
#include <vector>
#include <cstdlib>
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];

long long dp[100010][3];

int main(){
  int N;
  cin>>N;
  for(int i=0; i<N; i++) for (int j=0; j<3; j++) cin>>a[i][j];
  
  for (int i=0; i<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 i=0; i<3; i++) t=chmax(res, dp[N-1][i]);
  cout<<res<<endl;
}
  
    

Compiler output:
a.cc: In function 'int main()':
a.cc:22:37: error: expected ';' before '}' token
   22 |   chmax(dp[i+1][k],dp[i][j]+a[i][k])
      |                                     ^
      |                                     ;
   23 |       }
      |       ~                              
a.cc:28:25: error: 't' was not declared in this scope
   28 |  for(int i=0; i<3; i++) t=chmax(res, dp[N-1][i]);
      |                         ^
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
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];

long long dp[100010][3]:

int main(){
  int N;
  cin>>N;
  for(int i=0; i<N; i++) for (int j=0; j<3; j++) cin>>a[i][j];
  
  for (int i=0; i<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 i=0; i<3; i++) t=chmax(res, dp[N-1][i]);
  cout<<res<<endl;
}
  
    

Compiler output:
a.cc:11:24: error: expected initializer before ':' token
   11 | long long dp[100010][3]:
      |                        ^
Language: C++

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

int main() {
    int n;
    cin>>n;
    int ma = 0;
    int mb = 0;
    int mc = 0;
    while(n > 0){
        cin>>a>>b>>c;
        int x = a + max(mb, mc);
        int y = b + max(ma, mc);
        int z = c + max(ma, mb);
        ma = x;
        mb = y;
        mc = z;
        n--;
    }
    cout<<max(ma, max(mb, mc));
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: 'a' was not declared in this scope; did you mean 'ma'?
   12 |         cin>>a>>b>>c;
      |              ^
      |              ma
a.cc:12:17: error: 'b' was not declared in this scope; did you mean 'mb'?
   12 |         cin>>a>>b>>c;
      |                 ^
      |                 mb
a.cc:12:20: error: 'c' was not declared in this scope; did you mean 'mc'?
   12 |         cin>>a>>b>>c;
      |                    ^
      |                    mc
Language: C++

//https://atcoder.jp/contests/dp/tasks/dp_c
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll N;
vector<vector<ll>> Input;
vector<ll> A;
vector<ll> B;
vector<ll> C;
vector<ll> Hist;
vector<vector<ll>> S(10001, vector<ll>(3, 0));

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return b/gcd(a,b)*b;}

void memo(ll n) {
  if (n == 0) rep(i, 3) S[n][i] = Input[n][i];
  else {
    S[n][0] = Input[n][0] + max(S[n-1][1], S[n-1][2]);
    S[n][1] = Input[n][1] + max(S[n-1][0], S[n-1][2]);
    S[n][2] = Input[n][2] + max(S[n-1][0], S[n-1][1]);
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> N;
  Input.resize(N);
  rep(i, N) {
    Input[i].resize(3);
    cin >> Input[i][0] >> Input[i][1] >> Input[i][2];
  }
  rep(i, N) {
    memo(i);
  }
  //cout << *max_element(S[N-1].begin(), S[N-1].end()) << endl;
  cout << max(S[N-1][0], S[N-1][1], S[N-1][2]) << endl;
  return 0;
}


Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/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:49:14:   required from here
   49 |   cout << max(S[N-1][0], S[N-1][1], S[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;
#define ll long long int
ll dp[2][2][2][100001];
vector <ll> a,b,c;
ll solve(ll x,ll y,ll z,ll n){
	if(n==0){return 0;}
  	if(dp[x][y][z][n]!=-1){return dp[x][y][z][n];}
  	else{
    	if(x==1){return dp[x][y][z][n] = max(solve(0,1,0,n-1)+b[n-1],solve(0,0,1,n-1)+c[n-1]);}
      	else if(y==1){return dp[x][y][z][n] = max(solve(1,0,0,n-1)+a[n-1],solve(0,0,1,n-1)+c[n-1]);}
      	else if(z==1){return dp[x][y][z][n] = max(solve(1,0,0,n-1)+a[n-1],solve(0,1,0,n-1)+b[n-1]);}
      	else{return dp[x][y][z][n] = max(solve(1,0,0,n-1)+a[n-1],max(solve(0,0,1,n-1)+c[n-1],solve(0,1,0,n-1)+b[n-1]));}
    }
}
int main(){
	
  	ll i=0,j=0,k=0,n=0,z=0,x=0,y=0,d=0,e=0,f=0;
  	cin >> n;
  	memset(dp,-1,sizeof(dp));
  	for(i=0;i<n;i++){
    	cin >> x >> y >> z;
      	a.push_back(x);
      	b.push_back(y);
      	c.push_back(z);
    }
  	k = solve(a,b,c,0,0,0,n);
  	//for(i=0;i<=n;i++){cout << dp[i]<<endl;}
  	d = max(dp[0][0][1][n],dp[0][0][0][n]);
  	e = max(dp[0][1][0][n],dp[0][1][1][n]);
  	f = max(dp[1][0][0][n],dp[1][1][1][n]);
  	z = max(dp[1][0][1][n],dp[1][1][0][n]);
  	cout << max(max(d,e),max(f,z))<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:19: error: cannot convert 'std::vector<long long int>' to 'long long int'
   27 |         k = solve(a,b,c,0,0,0,n);
      |                   ^
      |                   |
      |                   std::vector<long long int>
a.cc:6:13: note:   initializing argument 1 of 'long long int solve(long long int, long long int, long long int, long long int)'
    6 | ll solve(ll x,ll y,ll z,ll n){
      |             ^
Language: C++

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

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

#include<bits/stdc++.h>
using namespace std;
typdef long long ll;
int main()
{
  ll n;
  cin>>n;
  ll a,b,c;
  cin>>a>>b>>c;
  for(ll i=1;i<n;i++)
  {
    ll e,f,g;
    cin>>e>>f>>g;
    ll x,y,z;
    x=a;
    y=b;
    z=c;
    a=e+max(y,z);
    b=f+max(x,z);
    c=g+max(x,y);
  }
  cout<<max(max(a,b),c);
  return 0;
  
  
  
  

Compiler output:
a.cc:3:1: error: 'typdef' does not name a type; did you mean 'typedef'?
    3 | typdef long long ll;
      | ^~~~~~
      | typedef
a.cc: In function 'int main()':
a.cc:6:3: error: 'll' was not declared in this scope
    6 |   ll n;
      |   ^~
a.cc:7:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin>>n;
      |        ^
      |        yn
a.cc:8:5: error: expected ';' before 'a'
    8 |   ll a,b,c;
      |     ^~
      |     ;
a.cc:9:8: error: 'a' was not declared in this scope
    9 |   cin>>a>>b>>c;
      |        ^
a.cc:9:11: error: 'b' was not declared in this scope
    9 |   cin>>a>>b>>c;
      |           ^
a.cc:9:14: error: 'c' was not declared in this scope
    9 |   cin>>a>>b>>c;
      |              ^
a.cc:10:9: error: expected ';' before 'i'
   10 |   for(ll i=1;i<n;i++)
      |         ^~
      |         ;
a.cc:10:14: error: 'i' was not declared in this scope
   10 |   for(ll i=1;i<n;i++)
      |              ^
a.cc:12:7: error: expected ';' before 'e'
   12 |     ll e,f,g;
      |       ^~
      |       ;
a.cc:13:10: error: 'e' was not declared in this scope
   13 |     cin>>e>>f>>g;
      |          ^
a.cc:13:13: error: 'f' was not declared in this scope
   13 |     cin>>e>>f>>g;
      |             ^
a.cc:13:16: error: 'g' was not declared in this scope
   13 |     cin>>e>>f>>g;
      |                ^
a.cc:14:7: error: expected ';' before 'x'
   14 |     ll x,y,z;
      |       ^~
      |       ;
a.cc:15:5: error: 'x' was not declared in this scope
   15 |     x=a;
      |     ^
a.cc:16:5: error: 'y' was not declared in this scope; did you mean 'yn'?
   16 |     y=b;
      |     ^
      |     yn
a.cc:17:5: error: 'z' was not declared in this scope
   17 |     z=c;
      |     ^
a.cc:23:12: error: expected '}' at end of input
   23 |   return 0;
      |            ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C

#include<bits/stdc++.h>
using namespace std;
typdef long long ll;
int main()
{
  ll n;
  cin>>n;
  ll a,b,c;
  cin>>a>>b>>c;
  for(ll i=1;i<n;i++)
  {
    ll e,f,g;
    cin>>e>>f>>g;
    ll x,y,z;
    x=a;
    y=b;
    z=c;
    a=e+max(y,z);
    b=f+max(x,z);
    c=g+max(x,y);
  }
  cout<<max(max(a,b),c);
  return 0;
  
  
  
  

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

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int[][] arr=new int[n][3];
    for(int i=0;i<n;i++){
      arr[i][0]=s.nextInt();
      arr[i][1]=s.nextInt();
      arr[i][2]=s.nextInt();
    }
    int[][] dp=new int[n][3];
    for(int i=0;i<n;i++){
      for(int j=0;i<3;j++){
        if(i==0){
          dp[i][j]=arr[i][j];
        }
        else{
          if(j==0)
            dp[i][j]=Math.max(dp[i-1][1],dp[i-1][2])+arr[i][j];
          else if(j==1)
            dp[i][j]=Math.max(dp[i-1][0],dp[i-1][2])+arr[i][j];
          else
            dp[i][j]=Math.max(dp[i-1][0],dp[i-1][1])+arr[i][j];
        }
      }
      int max=Integer.MIN_VALUE;
      for(int i=0;i<3;i++){
        max=Math.max(dp[n-1][i],max);
      }
      System.out.println(max);
    }
  }
  
        
    import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int[][] arr=new int[n][3];
    for(int i=0;i<n;i++){
      arr[i][0]=s.nextInt();
      arr[i][1]=s.nextInt();
      arr[i][2]=s.nextInt();
    }
    int[][] dp=new int[n][3];
    for(int i=0;i<n;i++){
      for(int j=0;i<3;j++){
        if(i==0){
          dp[i][j]=arr[i][j];
        }
        else{
          if(j==0)
            dp[i][j]=Math.max(dp[i-1][1],dp[i-1][2])+arr[i][j];
          else if(j==1)
            dp[i][j]=Math.max(dp[i-1][0],dp[i-1][2])+arr[i][j];
          else
            dp[i][j]=Math.max(dp[i-1][0],dp[i-1][1])+arr[i][j];
        }
      }
    }
      int max=Integer.MIN_VALUE;
      for(int i=0;i<3;i++){
        max=Math.max(dp[n-1][i],max);
      }
      System.out.println(max);
    }
  }
  
        
    

Compiler output:
Main.java:36: error: illegal start of type
    import java.util.*;
    ^
Main.java:36: error: <identifier> expected
    import java.util.*;
                     ^
Main.java:69: error: reached end of file while parsing
  }
   ^
3 errors
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int[][] arr=new int[n][3];
    for(int i=0;i<n;i++){
      arr[i][0]=s.nextInt();
      arr[i][1]=s.nextInt();
      arr[i][2]=s.nextInt();
    }
    int[][] dp=new int[n][3];
    for(int i=0;i<n;i++){
      for(int j=0;i<3;j++){
        if(i==0){
          dp[i][j]=arr[i][j];
        }
        else{
          if(j==0)
            dp[i][j]=Math.max(dp[i-1][1],dp[i-1][2])+arr[i][j];
          else if(j==1)
            dp[i][j]=Math.max(dp[i-1][0],dp[i-1][2])+arr[i][j];
          else
            dp[i][j]=Math.max(dp[i-1][0],dp[i-1][1])+arr[i][j];
        }
      }
      int max=Integer.MIN_VALUE;
      for(int i=0;i<3;i++){
        max=Math.max(dp[n-1][i],max);
      }
      System.out.println(max);
    }
  }
  
        
    

Compiler output:
Main.java:33: error: reached end of file while parsing
  }
   ^
1 error
Language: C++

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

int main(){
	
  int N;
  cin >> N;
  vector<vector<int>> input(N, vector<int>(3));
  vector<int> dp(3);
  for(int i = 0; i < N; i++){
  	for(int j = 0; j < 3; j++){
    	cin >> input[i][j];
    }
  }
  dp[0] = input[0][0];
  dp[0] = input[0][1];
  dp[0] = input[0][2];
  
  for(int i = 1; i < N; i++){
    vector<int> new_dp(3);
  	new_dp[0] = input[i][0] + max(dp[1], dp[2]);
    new_dp[1] = input[i][1] + max(dp[2], dp[0]);
    new_dp[2] = input[i][2] + max(dp[0], dp[1]);
    dp = new_dp;
  }
  
  int res = max(dp0], max(dp[1], dp[2]));
  cout << res << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: 'dp0' was not declared in this scope; did you mean 'dp'?
   28 |   int res = max(dp0], max(dp[1], dp[2]));
      |                 ^~~
      |                 dp
Language: C++

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

int main(){
	
  int N;
  cin >> N;
  vector<vector<int>> input(N, vector<int>(3));
  vector<int> dp(3);
  for(int i = 0; i < N; i++){
  	for(int j = 0; j < 3; j++){
    	cin >> input[i][j];
    }
  }
  dp[0] = input[0][0];
  dp[0] = input[0][1];
  dp[0] = input[0][2];
  
  for(int i = 1; i < N; i++){
    vector<int> new_dp(3)
  	new_dp[0] = input[i][0] + max(dp[1], dp[2]);
    new_dp[1] = input[i][1] + max(dp[2], dp[0]);
    new_dp[2] = input[i][2] + max(dp[0], dp[1]);
    dp = new_dp;
  }
  
  int res = max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]));
  cout << res << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: expected ',' or ';' before 'new_dp'
   22 |         new_dp[0] = input[i][0] + max(dp[1], dp[2]);
      |         ^~~~~~
a.cc:28:24: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   28 |   int res = max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]));
      |                        ^
a.cc:28:40: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   28 |   int res = max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]));
      |                                        ^
a.cc:28:52: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   28 |   int res = max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]));
      |                                                    ^
Language: C++

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

int main(){
	
  int N;
  cin >> N;
  vector<vector<int>> input(N, vector<int>(3));
  vector<vector<int>> dp(N, vector<int>(3));
  for(int i = 0; i < N; i++){
  	for(int j = 0; j < 3; j++){
    	cin >> input[i][j];
    }
  }
  dp[0][0] = input[0][0];
  dp[0][1] = input[0][1];
  dp[0][2] = input[0][2];
  
  for(int i = 1; i < N; i++){
  	dp[i][0] = input[i][0] + max(dp[i-1][1], dp[i-1][2]);
    dp[i][1] = input[i][1] + max(dp[i-1][2], dp[i-1][0]);
    dp[i][2] = input[i][2] + max(dp[i-1][0], dp[i-1][1]);
  }
  
  int res = max({dp[N-1][0], dp[N-1][1], dp[N-1][2]});
  cout << res << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:16: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   26 |   int res = 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: Java

import java.util.*;
import java.io.*;
public class Solution
{
    static int solve(int A[],int B[],int C[])
    {
        int dp[][] = new int[A.length][3];
        dp[0][0]=A[0];
        dp[0][1]=B[0];
        dp[0][2]=C[0];
        for(int i=1;i<A.length;i++)
        {
            dp[i][0]=Math.max(dp[i-1][1],dp[i-1][2])+A[i];
            dp[i][1]=Math.max(dp[i-1][0],dp[i-1][2])+B[i];
            dp[i][2]=Math.max(dp[i-1][0],dp[i-1][1])+C[i];
        }
        return Math.max(Math.max(dp[A.length-1][0],dp[A.length-1][1]),dp[A.length-1][2]);
    }
    public static void main(String []args)throws Exception
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        int A[] = new int[n];
        int B[] = new int[n];
        int C[] = new int[n];
        for(int i=0;i<n;i++)
        {
            int abc[] = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
            A[i] = abc[0];
            B[i] = abc[1];
            C[i] = abc[2];
        }
        bw.write(Integer.toString(solve(A,B,C)));
        br.close();
        bw.close();
    }
}


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

import java.util.*;
import java.lang.*;
import java.io.*;
 
public final class Main
{
    public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n+1];
        int[] b = new int[n+1];
        int[] c = new int[n+1];
        int[][] dp = new int[n+1][4];
        for(int i =0; i< n; i++){
          a[i] = in.nextInt();
          b[i] = in.nextInt();
          c[i] = in.nextInt();
        }
        dp[1][1] = a[1];
        dp[1][2] = b[1];
        dp[1][3] = c[1];

        for(int i =2; i<=n; i++){
           for(int  j =1; j<=3; j++){
              if(j==1){
                dp[i][j] =a[i]+ Math.max(pd[i-1][2],dp[i-1][3]);
              }else if (j == 2) {
                dp[i][j] = b[i] + Math.max(dp[i -1][1], dp[i -1][3]);
              } else {
                dp[i][j] = c[i] + Math.max(dp[i -1][1], dp[i -1][2]);
              }
            }
        }   
      System.out.println(Math.max(dp[n][1], Math.max(dp[n][2], Math.dp[n][3])));
    }
}

Compiler output:
Main.java:26: error: cannot find symbol
                dp[i][j] =a[i]+ Math.max(pd[i-1][2],dp[i-1][3]);
                                         ^
  symbol:   variable pd
  location: class Main
Main.java:34: error: cannot find symbol
      System.out.println(Math.max(dp[n][1], Math.max(dp[n][2], Math.dp[n][3])));
                                                                   ^
  symbol:   variable dp
  location: class Math
2 errors
Language: Java

import java.util.*;
import java.lang.*;
import java.io.*;
 
public final class Main
{
    public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n+1];
        int[] b = new int[n+1];
        int[] c = new int[n+1];
        int[][] dp = new int[n+1][4];
        for(int i =0; i< n; i++){
          a[i] = in.nextInt();
          b[i] = in.nextInt();
          c[i] = in.nextInt();
        }
        dp[1][1] = a[1];
        dp[1][2] = b[1];
        dp[1][3] = c[1];

        for(int i =2; i<=n; i++){
           for(int  j =1; j<=3; j++){
              if(j==1){
                dp[i][j] =a[i]+ Math.max(pd[i-1][2],dp[i-1][3]);
              }else if (j == 2) {
                dp[i][j] = b[i] + Math.max(dp[i -1][1], dp[i -1][3]);
              } else {
                dp[i][j] = c[i] + Math.max(dp[i -1][1], dp[i -1][2]);
              }
        }
             
      System.out.println(Math.max(dp[n][1], Math.max(dp[n][2], Math.dp[n][3])));
    }
}

Compiler output:
Main.java:36: error: reached end of file while parsing
}
 ^
1 error
Language: C

    #include<bits/stdc++.h>
    #define vi vector<int>
    #include <algorithm>
    #include <iterator>
    #include<iostream>
     
    using namespace std;
     
    int main()
    {
        int n;
        cin>>n;
        int dp[3]={0};
        for(int d=0;d<n;d++){
            int arr[3];
            for(int i=0;i<3;i++) scanf("%d", &arr[i]);
            int curr[3] = {0};
            for(int i=0;i<3;i++){
                for(int j=0;j<3;j++){
                    if(i==j)continue;
                    curr[j] = max(curr[j], dp[i] + arr[j]);
                }
            }
     
            for(int z = 0;z<3;z++){
                dp[z] = curr[z];
            }
        }
        printf("%d", max({dp[0], dp[1], dp[2]}));
       return 0;
    }

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

#include <bits/stdc++.h>

using namespace std;

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

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

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

int main(){
vector <vector<int>> a(3),h(3);
int n,tmp;
//int n,a[3][3];
cin >> n;
for (int i=0;i<n;i++){
  for (int j=0;j<3;j++){
    cin >>tmp;
    a[j].push_back(tmp);
  }
}

h[0].push_back(a[0][0]);
h[1].push_back(a[1][0]);
h[2].push_back(a[2][0]);
for (int i=1;i<n;i++){
  h[0].push_back(a[0][i]+max(h[2][i-1],h[1][i-1]));
  h[1].push_back(a[1][i]+max(h[2][i-1],h[0][i-1]));
  h[2].push_back(a[2][i]+max(h[1][i-1],h[0][i-1]));
  //cout <<h[0][i]<<' '<<h[1][i]<<' '<<h[2][i]<<' '<<endl;
}
cout << max(h[0][n-1],max(h[1][n-1],h[2][n-1]));
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:1: error: 'vector' was not declared in this scope
    6 | vector <vector<int>> a(3),h(3);
      | ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include<algorithm>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:6:16: error: expected primary-expression before 'int'
    6 | vector <vector<int>> a(3),h(3);
      |                ^~~
a.cc:13:5: error: 'a' was not declared in this scope
   13 |     a[j].push_back(tmp);
      |     ^
a.cc:17:1: error: 'h' was not declared in this scope
   17 | h[0].push_back(a[0][0]);
      | ^
a.cc:17:16: error: 'a' was not declared in this scope
   17 | h[0].push_back(a[0][0]);
      |                ^
Language: C++

q#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main (){
ll n,a[100009],b[100009],c[100009];
cin>>n;
for(int i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];
for(int i=1;i<n;i++)
a[i]=max(b[i-1]+a[i],c[i-1]+a[i]),
b[i]=max(c[i-1]+b[i],a[i-1]+b[i]),
c[i]=max(b[i-1]+c[i],a[i-1]+c[i]);

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

}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | q#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'q' does not name a type
    1 | q#include<bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:6:1: error: 'cin' was not declared in this scope
    6 | cin>>n;
      | ^~~
a.cc:9:6: error: 'max' was not declared in this scope
    9 | a[i]=max(b[i-1]+a[i],c[i-1]+a[i]),
      |      ^~~
a.cc:13:1: error: 'cout' was not declared in this scope
   13 | cout<<max(max(a[n-1],b[n-1]),c[n-1])<<endl;
      | ^~~~
a.cc:13:11: error: 'max' was not declared in this scope
   13 | cout<<max(max(a[n-1],b[n-1]),c[n-1])<<endl;
      |           ^~~
a.cc:13:7: error: 'max' was not declared in this scope
   13 | cout<<max(max(a[n-1],b[n-1]),c[n-1])<<endl;
      |       ^~~
a.cc:13:39: error: 'endl' was not declared in this scope
   13 | cout<<max(max(a[n-1],b[n-1]),c[n-1])<<endl;
      |                                       ^~~~
Language: C++

#include <iostream>
#include<string>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<set>
#include <limits>
#include <numeric>
#include <type_traits>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reprev(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define MAX 100100
#define MAX_N 200100
#define SENTINEL 2000000000
#define MAX_B 1001001
#define NIL -1
#define MOD 1000000007
#define INF 1 << 29
#define INFTY 1000000000000000000LL
int n;
int a[MAX][3];
ll dp[MAX][3];
int main(){
    cin>>n;
    rep(i,n)rep(j,3)cin>>a[i][j];
    
    //dpの準備
    memset(dp,0,sizeof(dp));
    rep(i,n){
        rep(j,3)rep(k,3){
            if(j==k)continue;
            dp[i+1][j]=max(dp[i][k]+a[i][j],dp[i+1][j]);
    }
    }
    ll res=0;
    rep(i,3)if(res<dp[n][i])res=dp[n][i];
    cout<<res<<endl;
}

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

import java.io.*;
import java.util.*;
public class Sol3{
	public static int dp[][] = new int[201][201];
	final public static int MOD = (int)1e9+7;
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int dp[][] = new int[n][3];
		int a[] = new int[n];
		int b[] = new int[n];
		int c[] = new int[n];
		for(int i=0; i<n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
			
		}
		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] = Math.max(dp[i-1][1], dp[i-1][2]) + a[i];
			dp[i][1] = Math.max(dp[i-1][0], dp[i-1][2]) + b[i];
			dp[i][2] = Math.max(dp[i-1][0], dp[i-1][1]) + c[i];
		}
		int max = Math.max(dp[n-1][0], dp[n-1][1]);
		max = Math.max(max, dp[n-1][2]);
		System.out.println(max);
		sc.close();
	}
}


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

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define big 1000000007
vector<vector<ll>> memo(200000, vector<ll>(3));
vector<vector<ll>> done(200000, vector<ll>(3));
ll n;
vector<ll>a, b, c;
ll dp(int m, int p)
{ //(基本的にpは0,1,2で前の状態をあら合わす。)
    if (m == n)
    {
        return 0;
    }
 if (p != -1)
    {
        if (done[m][p] == 1)
        {
            //    cout <<"dakfa";
            return memo[m][p];
        }
    }
    ll res = -1;
    ll count;
    for (int i = 0; i < 3; i++)
    {
        if (i == p)
        {
            continue;
        }
        count = data[m][i] + dp(m + 1, i, data);
        if (res == -1)
        {
            res = count;
        }
        else
        {
            res = max(res, count); //とりあえず
        }
    }
    ll res1 = 0, res2 = 0, res3 = 0;
	if (p != 0) res1 = dp(m + 1, 0) + a[m];
	if (p != 1) res2 = dp(m + 1, 1) + b[m];
	if (p != 2) res3 = dp(m + 1, 2) + c[m];
   res= max({ res1, res2, res3 });
    if (p != -1)
    {
        memo[m][p] = res;
        done[m][p] = 1;
    }

    return res;
}
int main()
{

    cin >> n;
   a.resize(n); b.resize(n); c.resize(n);
	rep(i, n) cin >> a[i] >> b[i] >> c[i];
    memo.resize(n);
	rep(i, memo.size()) memo[i].resize(3, 0);memo.resize(n);
	rep(i, memo.size()) done[i].resize(3, 0);
    cout << dp(0, -1) << endl; //前の状態が指定された時の今後の最大値
                                     /* rep(i,n){
  rep(j,3){
  cout <<done[i][j];
  
  }
  }*/
}


Compiler output:
a.cc: In function 'long long int dp(int, int)':
a.cc:32:21: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   32 |         count = data[m][i] + dp(m + 1, i, data);
      |                     ^
a.cc:32:32: error: too many arguments to function 'long long int dp(int, int)'
   32 |         count = data[m][i] + dp(m + 1, i, data);
      |                              ~~^~~~~~~~~~~~~~~~
a.cc:10:4: note: declared here
   10 | ll dp(int m, int p)
      |    ^~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll n;
ll a[maxn];
ll b[maxn];
ll c[maxn];
ll dp[maxn][4];
int main()
{
    cin>>n;
    for (int i = 1;i <= n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    dp[1][1]=a[1];
    dp[1][2]=b[1];
    dp[1][3]=c[1];
    for (int i = 2;i <= n;i++)
    {
        dp[i][1]+=max(dp[i-1][2],dp[i-1][3])+a[i];
        dp[i][2]+=max(dp[i-1][1],dp[i-1][3])+b[i];
        dp[i][3]+=max(dp[i-1][1],dp[i-1][2])+c[i];
    }
    cout<<max(dp[n][3],max(dp[n][1],dp[n][2]));
    return 0;
}

Compiler output:
a.cc:6:6: error: 'maxn' was not declared in this scope
    6 | ll a[maxn];
      |      ^~~~
a.cc:7:6: error: 'maxn' was not declared in this scope
    7 | ll b[maxn];
      |      ^~~~
a.cc:8:6: error: 'maxn' was not declared in this scope
    8 | ll c[maxn];
      |      ^~~~
a.cc:9:7: error: 'maxn' was not declared in this scope
    9 | ll dp[maxn][4];
      |       ^~~~
a.cc: In function 'int main()':
a.cc:15:14: error: 'a' was not declared in this scope
   15 |         cin>>a[i]>>b[i]>>c[i];
      |              ^
a.cc:15:20: error: 'b' was not declared in this scope
   15 |         cin>>a[i]>>b[i]>>c[i];
      |                    ^
a.cc:15:26: error: 'c' was not declared in this scope
   15 |         cin>>a[i]>>b[i]>>c[i];
      |                          ^
a.cc:17:5: error: 'dp' was not declared in this scope
   17 |     dp[1][1]=a[1];
      |     ^~
a.cc:17:14: error: 'a' was not declared in this scope
   17 |     dp[1][1]=a[1];
      |              ^
a.cc:18:14: error: 'b' was not declared in this scope
   18 |     dp[1][2]=b[1];
      |              ^
a.cc:19:14: error: 'c' was not declared in this scope
   19 |     dp[1][3]=c[1];
      |              ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll n;
ll a[maxn];
ll b[maxn];
ll c[maxn];
ll dp[maxn][4];
int main()
{
    int n;
    cin>>n;
    for (int i = 1;i <= n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    dp[1][1]=a[1];
    dp[1][2]=b[1];
    dp[1][3]=c[1];
    for (int i = 2;i <= n;i++)
    {
        dp[i][1]+=max(dp[i-1][2],dp[i-1][3])+a[i];
        dp[i][2]+=max(dp[i-1][1],dp[i-1][3])+b[i];
        dp[i][3]+=max(dp[i-1][1],dp[i-1][2])+c[i];
    }
    cout<<max(dp[n][3],max(dp[n][1],dp[n][2]));
    return 0;
}

Compiler output:
a.cc:6:6: error: 'maxn' was not declared in this scope
    6 | ll a[maxn];
      |      ^~~~
a.cc:7:6: error: 'maxn' was not declared in this scope
    7 | ll b[maxn];
      |      ^~~~
a.cc:8:6: error: 'maxn' was not declared in this scope
    8 | ll c[maxn];
      |      ^~~~
a.cc:9:7: error: 'maxn' was not declared in this scope
    9 | ll dp[maxn][4];
      |       ^~~~
a.cc: In function 'int main()':
a.cc:16:14: error: 'a' was not declared in this scope
   16 |         cin>>a[i]>>b[i]>>c[i];
      |              ^
a.cc:16:20: error: 'b' was not declared in this scope
   16 |         cin>>a[i]>>b[i]>>c[i];
      |                    ^
a.cc:16:26: error: 'c' was not declared in this scope
   16 |         cin>>a[i]>>b[i]>>c[i];
      |                          ^
a.cc:18:5: error: 'dp' was not declared in this scope
   18 |     dp[1][1]=a[1];
      |     ^~
a.cc:18:14: error: 'a' was not declared in this scope
   18 |     dp[1][1]=a[1];
      |              ^
a.cc:19:14: error: 'b' was not declared in this scope
   19 |     dp[1][2]=b[1];
      |              ^
a.cc:20:14: error: 'c' was not declared in this scope
   20 |     dp[1][3]=c[1];
      |              ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long ll;
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
ll n;
ll a[maxn];
ll b[maxn];
ll c[maxn];
ll dp[maxn][5];

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

inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:5: error: 'gbtb' was not declared in this scope
   24 |     gbtb;
      |     ^~~~
a.cc:26:10: error: 'i' was not declared in this scope
   26 |     repd(i,1,n)
      |          ^
a.cc:26:5: error: 'repd' was not declared in this scope
   26 |     repd(i,1,n)
      |     ^~~~
Language: C++

n = int(input())

days = []
for day in range(n):
  a_i, b_i, c_i = map(int, input().split())
  days.append((a_i, b_i, c_i))

dp = {} # (is repetition, activity today, day number) -> happiness up to that day

for activity in range(3):
  dp[True, activity, -1] = 0
  dp[False, activity, -1] = 0

for day in range(n):
  for activity in range(3):
    dp[True, activity, day] = days[day][activity] + dp[False, activity, day - 1]
    dp[False, activity, day] = days[day][activity] + max(
      dp[False, (activity + 1) % 3, day - 1],
      dp[True, (activity + 1) % 3, day - 1],
      dp[False, (activity - 1) % 3, day - 1],
      dp[True, (activity - 1) % 3, day - 1]
    )

answer = -1
for activity in range(3):
  answer = max(answer, dp[True, activity, n - 1], dp[False, activity, n - 1])
    
print(answer)

Compiler output:
a.cc:8:9: error: stray '#' in program
    8 | dp = {} # (is repetition, activity today, day number) -> happiness up to that day
      |         ^
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
a.cc:8:14: error: expected ')' before 'repetition'
    8 | dp = {} # (is repetition, activity today, day number) -> happiness up to that day
      |           ~  ^~~~~~~~~~~
      |              )
Language: Java


class Main{

    /**
     * https://atcoder.jp/contests/dp/tasks/dp_c
     */

    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] dp = new int[3];

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

            int[] temp = new int[3];
            int[] h = new int[3];
            for(int j = 0; j < 3; j++){
                h[j] = in.nextInt();
            }

            for(int k = 0; k < 3; k++){
                for(int x = 0; x < 3; x++){
                    if(k!=x)
                        temp[x] = Math.max(temp[x], dp[k] + h[x]);
                }
            }
            dp = temp;
        }
        System.out.println(Math.max(dp[0], Math.max(dp[1], dp[2])));
    }
}

Compiler output:
Main.java:10: error: cannot find symbol
        Scanner in = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:10: error: cannot find symbol
        Scanner in = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
int main() {
 int n;
    cin >> n;
    vi a(n+1), b(n+1), c(n+1);
    for(int i=1; i<=n; ++i) 
      cin >> a[i] >> b[i] >> c[i];
 
    vvi dp(n+1, vi(3));
 dp[0][A] = dp[0][B] = dp[0][C] = 0;
    for(int i=1; i<=n; ++i){
        dp[i][A] = max(dp[i-1][C], dp[i-1][B]) + a[i];
        dp[i][B] = max(dp[i-1][A], dp[i-1][C]) + b[i];
        dp[i][C] = max(dp[i-1][A], dp[i-1][B]) + c[i];
    }
    int ans = max(dp[n][A], max(dp[n][B], dp[n][C])); 
    cout << ans << endl;
 
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: 'A' was not declared in this scope
   13 |  dp[0][A] = dp[0][B] = dp[0][C] = 0;
      |        ^
a.cc:13:19: error: 'B' was not declared in this scope
   13 |  dp[0][A] = dp[0][B] = dp[0][C] = 0;
      |                   ^
a.cc:13:30: error: 'C' was not declared in this scope
   13 |  dp[0][A] = dp[0][B] = dp[0][C] = 0;
      |                              ^
Language: C++

#include <iostream>
#include <vector>
#include <cstdlib>
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 main() {
	int N;
	long long a[100010][3]; 
	long long dp[100010][3];

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

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

    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:14:9: error: redeclaration of 'int N'
   14 |     int N; cin >> N;
      |         ^
a.cc:10:13: note: 'int N' previously declared here
   10 |         int N;
      |             ^
Language: C++

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

//上無限
const long long Inf = 1LL << 60;

//下無限
const long long MInf = -(Inf);


//2要素比較して小さいほうを第一引数に代入
template <class T> inline bool chmin(T&a,T b);
//2要素比較して大きいほうを第一引数に代入
template <class T> inline bool chmax(T&a,T b);

int main()
{
    int N;
    cin >> N;
    long long a[100010][3];
    for(int i = 0; i < N;i++)
    {
        for(int j = 0;j < N;j++)
        {
            cin >> a[i][j];
        }
    }
    long long dp[100010][3];
    for(int i = 0;i < N;i++)
    {
        for(int j = 0;j < 3;j++)
        {
            for(int k = 0; k < N;k++)
            {
                if(j == k)
                    continue;
                chmax(dp[i + 1][k],dp[i][j] + a[i][k]);
            }
        }
    }
    cout << max(dp[N][0],max(dp[N][1],dp[N][2])) <<endl;;
}


Compiler output:
a.cc:16:32: warning: inline function 'bool chmax(T&, T) [with T = long long int]' used but never defined
   16 | template <class T> inline bool chmax(T&a,T b);
      |                                ^~~~~
/usr/bin/ld: /tmp/cc620g5r.o: in function `main':
a.cc:(.text+0x122): undefined reference to `bool chmax<long long>(long long&, long long)'
collect2: error: ld returned 1 exit status
Language: C++

// It’s always great to set new goals, keep trying, keep training, and then achieve those goals.
#include <bits/stdc++.h>
#define ll long long int
#define f(i,n) for(ll i=0;i<n;i++)
#define rf(i,n) for(ll i=n;i>=0;i--)
#define endl '\n'
#define pub push_back
#define vf v[i].first
#define vs v[i].second
#define mp make_pair
#define z 998244353   
using namespace std;
ll powMod(ll x,ll y){ll p=1; while(y){if(y%2){p=(p*x)%z;} y/=2; x=(x*x)%z;} return p;}
ll invMod(ll x){return powMod(x,z-2);}
ll gcd(ll a, ll b) {return b == 0 ? a : gcd(b, a % b);}

const int N = (int)2e5 + 100;
set<char> st[N];
ll visited[N];

void solve(){ 
    ll n,k;
    cin>>n;
    ll a[n][3];
    ll dp[n][3];
    
    f(i,n){
        f(j,3){
            cin>>a[i][j];
        }
    }

    f(i,n){
        f(j,3){
            if(i==0){
                dp[i][j] = a[i][j];
            }    
            else {
                ll x = (j+1)%3;
                ll y = (j+2)%3;
                dp[i][j] = max(dp[i-1][x]+a[i][j],dp[i-1][y]+a[i][j]);
            }
            // cout<<dp[i][j]<<" ";
        }
        // cout<<endl;
    }
    ll Max = INT_MIN;
    f(i,3){
        Max = max(Max,dp[n-1][i]);
    }
    cout<<Max<<endl;
}
int main(){
    ios_base::sync_with_stdio(0) ;
    cin.tie(0) ; cout.tie(0) ;

    
    #endif
    solve();
   
    return 0;
}

Compiler output:
a.cc:58:6: error: #endif without #if
   58 |     #endif
      |      ^~~~~
Language: C++

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

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

int main()
{
	int n ;  cin >> n;
	int a[n+1],b[n+1],c[n+1],g = 0;
	int i = 1;
	while(i<=n)
	{
		cin >> a[i] >> b[i] >> c[i] ;
		i ++ ;
	}
	
	
	
	int da[n+1] = {0} ,db[n+1]= {0},dc[n+1] = {0};
	da[1] = a[1];
	db[1] = b[1];
	dc[1] = c[1];
	

	int i = 2;
	while(i<=n )
	{
		da[i] = a[i] +max(db[i-1],dc[i-1]);
		db[i] = b[i] +max(da[i-1],dc[i-1]);
		dc[i] = c[i] +max(db[i-1],da[i-1]);
		i++;
	}
	cout<< maxi(da[n],db[n],dc[n]) ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: redeclaration of 'int i'
   28 |         int i = 2;
      |             ^
a.cc:13:13: note: 'int i' previously declared here
   13 |         int i = 1;
      |             ^
Language: C++


#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include <iostream>
#include <cstdlib>
using namespace std;
using ll = long long;
const int INF = 1e9 + 5;

int main(){
    int n,temp;
    cin>>n;
    vector<int> dp(3);
    // dp[i] - total cost such that we did activity i on the last day
    for(int day = 0; day < n; day++){
            vector<int> new_dp(3, 0);
            vector<int> c(3);
    for(int i = 0; i < 3; i++){
        cin>>c[i];
    }
        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                if(j != i){
                    new_dp[j] = max(new_dp[j], dp[i] + c[j]);
                }
            }
        }
    dp = new_dp;
    }
    cout<<max(dp[0], dp[1], dp[2]);

    return 0;
}



Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/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:34:14:   required from here
   34 |     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;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
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; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


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) {    //i日目
        for (int j = 0; j < 3; ++j) {       //i+1日目の行動を選ぶ
            for (int k = 0; k < 3; ++k) {   //i日目の行動
                if (j == k) continue;   //i日目とi+1日目の行動は異なる
                chmax(dp[i + 1][k], dp[i][j] + a[i][k]);  //行動kのi日目から行動jのi+1日目までの遷移
            }
        }
    }

    ll ans = max(dp[N][0],dp[N][1]); //dp[i] はi日目なので注意,
    ans = max(ans,dp[N][2]);         //N日目はN-1でなく、dp[N]なので注意
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:68: error: 'a' was not declared in this scope
   14 |     for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];
      |                                                                    ^
a.cc:24:23: error: 'dp' was not declared in this scope; did you mean 'dup'?
   24 |                 chmax(dp[i + 1][k], dp[i][j] + a[i][k]);  //行動kのi日目から行動jのi+1日目までの遷移
      |                       ^~
      |                       dup
a.cc:24:48: error: 'a' was not declared in this scope
   24 |                 chmax(dp[i + 1][k], dp[i][j] + a[i][k]);  //行動kのi日目から行動jのi+1日目までの遷移
      |                                                ^
a.cc:29:18: error: 'dp' was not declared in this scope; did you mean 'dup'?
   29 |     ll ans = max(dp[N][0],dp[N][1]); //dp[i] はi日目なので注意,
      |                  ^~
      |                  dup
Language: C++

#include <bits/stdc++.h>
#define ll long long

using namespace std;
ll n, a[200005], b[200005], c[200005], i, dpa[200005], dpb[200005], dpc[200005];
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
        {cin>>a[i]>>b[i]>>c[i];
    dpa[0]=0;dpb[0]=0;dpc[0]=0;

    for(i=1;i<=n;i++){
        dpa[i]=max(dpb[i-1]+a[i],dpc[i-1]+a[i]);
         dpb[i]=max(dpa[i-1]+b[i],dpc[i-1]+b[i]);
          dpc[i]=max(dpb[i-1]+c[i],dpa[i-1]+c[i]);
    }

    cout<<max(dpa[n],max(dpb[n],dpc[n]));
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^