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

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

Compiler output:
Main.java:13: error: no suitable method found for min(int)
        	input[j][0] += Math.min(input[j-1][1] + input[j-1][2]);
        	                   ^
    method Math.min(int,int) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(long,long) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(float,float) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(double,double) is not applicable
      (actual and formal argument lists differ in length)
Main.java:14: error: no suitable method found for min(int)
            input[j][1] += Math.min(input[j-1][0] + input[j-1][2]);
                               ^
    method Math.min(int,int) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(long,long) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(float,float) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(double,double) is not applicable
      (actual and formal argument lists differ in length)
Main.java:15: error: no suitable method found for min(int)
          	input[j][2] += Math.min(input[j-1][0] + input[j-1][1]);
          	                   ^
    method Math.min(int,int) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(long,long) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(float,float) is not applicable
      (actual and formal argument lists differ in length)
    method Math.min(double,double) is not applicable
      (actual and formal argument lists differ in length)
Main.java:18: error: cannot find symbol
      	scanner.close();
      	^
  symbol:   variable scanner
  location: class Main
4 errors
Language: C++

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

int main(){
  int n,a,b,c,*dp,f;
  
  scanf("%d",&n);
  
  dp=(int*)malloc((n)*sizeof(int));
  
  scanf("%d%d%d",&a,&b,&c);
  dp[0]=max(a,b,c);
  
  if(dp[0]==a) f=0;
  if(dp[0]==b) f=1;
  if(dp[0]==c) f=2;
  
  for(int i=1;i<n;i++){
    scanf("%d%d%d",&a,&b,&c);
    if(f==0){
      dp[i]=dp[i-1]+max(b,c);
      if(max(b,c)==b) f=2;
      else f=3;
    }
    else if(f==1){
      dp[i]=dp[i-1]+max(a,c);
      if(max(a,c)==a) f=1;
      else f=3;
    }
    else if(f==3){
      dp[i]=dp[i-1]+max(a,b);
      if(max(a,b)==a) f=1;
      else f=2;
    }
  }
  
  printf("%d\n",dp[n-1]);
  
  return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:12:12:   required from here
   12 |   dp[0]=max(a,b,c);
      |         ~~~^~~~~~~
/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 int lli;
#define mod 1000000007
#define F first
#define S second
#define eb emplace_back
int main()
{
    //freopen("input.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    lli t,q,n,m,i,j,a,b,h,k;
    cin>>n;
    lli input[3],dp[3]={};
    for(k=0;k<n;k++)
    {
        cin>>input[0]>>input[1]>>input[2];
        lli newDp[3]={};
        for(i=0;i<3;i++)
        {
            for(j=0;j<3;j++)
            {
                if(j!=i)
                    newDp[j]=max(newDp[j],input[j]+dp[i]);
            }
        }
        dp=newDp;
    }
    cout<<max({dp[0],dp[1],dp[2]});
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: invalid array assignment
   28 |         dp=newDp;
      |         ~~^~~~~~
Language: Java

import java.util.*;
public class Main{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int[] sea=new int[n];
    int[] bugs=new int[n];
    int[] hw=new int[n]
    for(int i=0;i<n;i++)
    {
     sea[i]=sc.nextInt();
      bugs[i]=sc.nextInt();
      hw[i]=sc.nextInt();
    }
    int [][]happiness=new int[n+1][3];
    for(int i=1;i<=n;i++)
    {
      happiness[i][0]=sea[i]+Math.max(bugs[i-1],hw[i-1]);
      happiness[i][1]=bugs[i]+Math.max(sea[i-1],hw[i-1]);
      happiness[i][2]=hw[i]+Math.max(bugs[i-1],sea[i-1]);
    }
    int max=happiness[n][0];
    for(int i=1;i<3;i++)
    {
      if(happiness[n][i]>max)
         max=happiness[n][i];
    }
    System.out.println(max);
  }
}

Compiler output:
Main.java:9: error: ';' expected
    int[] hw=new int[n]
                       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin>>n;
  vector<int>dp(3);
  vector<int>new_dp(3,0);
  vector<int>c(3);
  cin>>dp[0]>>dp[1]>>dp[2];
  for(int day = 1;day < n;day++){
    cin>>c[0]>>c[1]>>c[2];
    for(int i = 0;i<3;i++){
      for(int j = 0;j<3;j++){
        if(i!=j){
          new_dp[j]=max(new_dp[j],dp[i]+c[j]);
        }
      }
      dp = new_dp;
    }
    cout<<max(dp[0],max(dp[1],dp[2]));
    return 0;
  }

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <fstream>
#define rep(i,a,b) for (long long i = a; i < b; i++)
using namespace std;
long long n;

// long long bf(long long p, long long pp , long long sum, vector <long long>& fec){
    
//     if(dp[p]!=-1){
//         return dp[p];
//     }
//     if (pp==n-1){
//         //cout << sum  << endl;
//         return sum;
//     } else if(pp>=n){
//         return 1000000000;
//     }
//     //cout << abs(fec[pp]-fec[p]) << "  " << p << "   " << pp << endl;
//     return dp[p]= min(bf(p+1, p, sum + abs(fec[pp]-fec[p]), fec) , bf(p+2, p, sum + abs(fec[pp]-fec[p]), fec));
// }

int main(){
    
    cin >> n;
    int dp[n][3];
    //dp.assign(n+k+k,10000000000000);
    memset(dp,-1, sizeof (dp));
    int fector[n][3];
    memset(fector,-1, sizeof (fector));
    rep(i,0,n){
        rep(j,0,3){
            cin >> fector[i][j];
        }
    }
    dp[0][0] = fector[0][0];
    dp[0][1] = fector[0][1];
    dp[0][2] = fector[0][2];
    rep(i,0,n-1){
        dp[i+1][0] = fector[i+1][0] + max(dp[i][1], dp[i][2]);
        dp[i+1][1] = fector[i+1][1] + max(dp[i][0], dp[i][2]);
        dp[i+1][2] = fector[i+1][2] + max(dp[i][1], dp[i][0]);
    }
    cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2])) << "\n";
    //cout << bf(0, 0, 0, fector) << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:5: error: 'memset' was not declared in this scope
   35 |     memset(dp,-1, sizeof (dp));
      |     ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <fstream>
  +++ |+#include <cstring>
   11 | #define rep(i,a,b) for (long long i = a; i < b; i++)
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <fstream>
#define rep(i,a,b) for (long long i = a; i < b; i++)
using namespace std;
long long n;

// long long bf(long long p, long long pp , long long sum, vector <long long>& fec){
    
//     if(dp[p]!=-1){
//         return dp[p];
//     }
//     if (pp==n-1){
//         //cout << sum  << endl;
//         return sum;
//     } else if(pp>=n){
//         return 1000000000;
//     }
//     //cout << abs(fec[pp]-fec[p]) << "  " << p << "   " << pp << endl;
//     return dp[p]= min(bf(p+1, p, sum + abs(fec[pp]-fec[p]), fec) , bf(p+2, p, sum + abs(fec[pp]-fec[p]), fec));
// }

int main(){
    
    cin >> n;
    int dp[n][3];
    //dp.assign(n+k+k,10000000000000);
    memset(dp,-1, sizeof dp);
    int fector[n][3];
    memset(fector,-1, sizeof fector);
    rep(i,0,n){
        rep(j,0,3){
            cin >> fector[i][j];
        }
    }
    dp[0][0] = fector[0][0];
    dp[0][1] = fector[0][1];
    dp[0][2] = fector[0][2];
    rep(i,0,n-1){
        dp[i+1][0] = fector[i+1][0] + max(dp[i][1], dp[i][2]);
        dp[i+1][1] = fector[i+1][1] + max(dp[i][0], dp[i][2]);
        dp[i+1][2] = fector[i+1][2] + max(dp[i][1], dp[i][0]);
    }
    cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2])) << "\n";
    //cout << bf(0, 0, 0, fector) << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:5: error: 'memset' was not declared in this scope
   35 |     memset(dp,-1, sizeof dp);
      |     ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <fstream>
  +++ |+#include <cstring>
   11 | #define rep(i,a,b) for (long long i = a; i < b; i++)
Language: C++

n = int(input())
a = []
b = []
c = []
for i in range(n):
    m,v,p = map(int,input().split())
    a.append(m)
    b.append(v)
    c.append(p)
d = [[0]*3 for i in range(n)]
d[0][0]=a[0]
d[0][1]=b[0]
d[0][2]=c[0]
for i in range(n):
    for j in range(3):
        if j == 0:
            d[i][j] = max(d[i-1][1],d[i-1][2]) + a[i]
        elif j == 1:
            d[i][j] = max(d[i-1][0],d[i-1][2]) + b[i]
        else:
            d[i][j] = max(d[i-1][0],d[i-1][1]) + c[i]
print(max(d[-1][0],d[-1][1],d[-1][2]))


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>

struct Tuple {
  int a;
  int b;
  int c;
};

int main() {
  int n;
  std::cin >> n;
  
  std::vector<Tuple> t(n);
  for (auto&& ti : t) std::cin >> ti.a >> ti.b >> ti.c;

  std::vector<Tuple> h(n);
  h[0] = t[0];
  for (int i = 1; i < n; ++i) {
    h[i].a = t[i].a + std::max(h[i-1].b, h[i-1].c);
    h[i].b = t[i].b + std::max(h[i-1].a, h{i-1].c);
    h[i].c = t[i].c + std::max(h[i-1].a, h[i-1].b);
  }
  const auto& hn = h[n-1];
  std::cout << std::max({hn.a, hn.b, hn.c}) << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:43: error: expected ')' before '{' token
   22 |     h[i].b = t[i].b + std::max(h[i-1].a, h{i-1].c);
      |                               ~           ^
      |                                           )
Language: C++

#include <iostream>
using namespace std;
int main() {
	int N; cin>>N;
	int A=0,B=0,C=0;
	for(int i=0;i<N;i++){
		int a,b,c; cin>>a>>b>>c;
		a+=max(B,C); b+=max(A,C); c+=max(A,B);
		A=a; B=b; C=c;
	}
	cout<<max({A, B, C})<<"\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   11 |         cout<<max({A, B, C})<<"\n";
      |               ~~~^~~~~~~~~~~
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;

#define ll long long int
#define str string
#define sec .second

ll MOD = 1000000007, INFL = 1ll << 60, INF = 1 << 30;
ll A[1000000][3] = {}, B[1000000] = {}, weight[1000] = {}, value[1000] = {};
ll dp[100000][100002] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
vector <ll> v;
ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, n = 0, su = 0, ma = INF, mi = -1;
double ans;
pair<str, ll> S[1000];
bool an = true, bn = false;
long long mod = 1e9 + 7;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Code Line
	cin >> n;
	for (int i = 1; i <= n; i++)cin >> A[i][0] >> A[i][1] >> A[i][2];

	for (int i = 1; i <= n; i++) {
		dp[i][0] = max(dp[i - 1][1] + A[i][0], dp[i - 1][2] + A[i][0]);
		dp[i][1] = max(dp[i - 1][0] + A[i][1], dp[i - 1][2] + A[i][1]);
		dp[i][2] = max(dp[i - 1][0] + A[i][2], dp[i - 1][1] + A[i][2]);

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


Compiler output:
/tmp/cc0vDm7d.o: in function `main':
a.cc:(.text+0x2d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0vDm7d.o
a.cc:(.text+0xe9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0vDm7d.o
a.cc:(.text+0x322): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0vDm7d.o
a.cc:(.text+0x332): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0vDm7d.o
a.cc:(.text+0x34f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0vDm7d.o
a.cc:(.text+0x36c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0vDm7d.o
a.cc:(.text+0x3b9): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc0vDm7d.o
/tmp/cc0vDm7d.o: in function `__tcf_0':
a.cc:(.text+0x3ee): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/cc0vDm7d.o
a.cc:(.text+0x3f5): relocation truncated to fit: R_X86_64_PC32 against symbol `S[abi:cxx11]' defined in .bss section in /tmp/cc0vDm7d.o
/tmp/cc0vDm7d.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x41c): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cc0vDm7d.o
a.cc:(.text+0x435): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i) >> b.at(i) >> c.at(i);
    }
    //dpテーブル
    long long dp[6][n + 10];

    dp[0][0] = a.at(0);
    dp[2][0] = b.at(0);
    dp[4][0] = c.at(0);

    for (int i = 1; i < n; i++)
    {
        dp[0][i] = a.at(i) + dp[2][i - 1];
        dp[1][i] = a.at(i) + dp[4][i - 1];
        dp[2][i] = b.at(i) + dp[0][i - 1];
        dp[3][i] = b.at(i) + dp[4][i - 1];
        dp[4][i] = c.at(i) + dp[0][i - 1];
        dp[5][i] = c.at(i) + dp[2][i - 1];

        //まとめ
        dp[0][i] = max(dp[0][i], dp[1][i]);
        dp[2][i] = max(dp[2][i], dp[3][i]);
        dp[4][i] = max(dp[4][i], dp[5][i]);
    }

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


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

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


int min(int a, int b)
{
	return (a < b ? a : b);
}
int max(int a, int b)
{
	return (a > b ? a : b);
}
int abso(int x)
{
	return (x >= 0 ? x : -x);
}
static const int INF = 1e9;
int MEMO[100010][3];
int H[100010][3];
int N;
int dp(int i, int j)
{
	if (MEMO[i][j] != -1)return MEMO[i][j];
	int ans = H[i][j];
	if (i + 1 < N)
	{
		for (int k = 0; k < 3; k++)
		{
			if (k != j)
			{
				ans = max(ans, H[i][j] + dp(i + 1, k));
			}
		}
	}
	return MEMO[i][j] = ans;
}
int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)for (int j = 0; j < 3; j++)cin >> H[i][j];
	memset(MEMO, -1, sizeof MEMO);
	cout << max(dp(0, 0), max(dp(0, 1), dp(0, 2))) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:9: error: 'memset' was not declared in this scope
   43 |         memset(MEMO, -1, sizeof MEMO);
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 | #include <string>
Language: C++

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


int min(int a, int b)
{
	return (a < b ? a : b);
}
int max(int a, int b)
{
	return (a > b ? a : b);
}
int abso(int x)
{
	return (x >= 0 ? x : -x);
}
static const int INF = 1e9;
int MEMO[100010][3];
int H[100010][3];
int N;
int dp(int i, int j)
{
	if (MEMO[i][j] != -1)return MEMO[i][j];
	int ans = H[i][j];
	if (i + 1 < N)
	{
		for (int k = 0; k < 3; k++)
		{
			if (k != j)
			{
				ans = max(ans, H[i][j] + dp(i + 1, k));
			}
		}
	}
	return MEMO[i][j] = ans;
}
int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)for (int j = 0; j < 3; j++)cin >> H[i][j];
	memset(MEMO, -1, sizeof MEMO);
	cout << max(dp(0, 0), max(dp(0, 1), dp(0, 2))) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: 'memset' was not declared in this scope
   42 |         memset(MEMO, -1, sizeof MEMO);
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: Java

import java.util.*;
public class main
{
 public static void main(String args[])
 {
   Scanner sc=new Scanner(System.in);
   int days=sc.nextInt();
   int act[][]=new int[days][3];
   for(int i=0;i<days;i++)
   {
     for(int j=0;j<3;j++)
     {
       act[i][j]=sc.nextInt();
     }
   }
   int sum=0,prev=-1;;
   for(int i=0;i<days;i++)
   {
     int max=-1;
     for(int j=0;j<3;j++)
     {
       if(act[i][j]>max&&j!=prev)
       {
         max=act[i][j];
         prev=j;
       }
     }
     sum+=max;
   }
   System.out.println(sum);
 }
}

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

import java.util.*;
public class Main
{
 public static void main(String args[])
 {
   Scanner sc=new Scanner(System.in);
   int days=sc.nextInt();
   int act[]=new int[n][3];
   for(int i=0;i<n;i++)
   {
     for(int j=0;j<3;j++)
     {
       act[i][j]=sc.nextInt();
     }
   }
   int sum=0,prev=-1;;
   for(int i=0;i<n;i++)
   {
     int max=-1;
     for(int j=0;j<3;j++)
     {
       if(a[i][j]>max&&j!=prev)
       {
         max=a[i][j];
         prev=j;
       }
     }
     sum+=max;
   }
   System.out.println(sum);
 }
}

Compiler output:
Main.java:8: error: cannot find symbol
   int act[]=new int[n][3];
                     ^
  symbol:   variable n
  location: class Main
Main.java:8: error: incompatible types: int[][] cannot be converted to int[]
   int act[]=new int[n][3];
             ^
Main.java:9: error: cannot find symbol
   for(int i=0;i<n;i++)
                 ^
  symbol:   variable n
  location: class Main
Main.java:13: error: array required, but int found
       act[i][j]=sc.nextInt();
             ^
Main.java:17: error: cannot find symbol
   for(int i=0;i<n;i++)
                 ^
  symbol:   variable n
  location: class Main
Main.java:22: error: cannot find symbol
       if(a[i][j]>max&&j!=prev)
          ^
  symbol:   variable a
  location: class Main
Main.java:24: error: cannot find symbol
         max=a[i][j];
             ^
  symbol:   variable a
  location: class Main
7 errors
Language: C++

#include <bits/stdc++.h>

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMinimum(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMaximum(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */


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

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

int main() {

    int N;
    cin >> N;

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

    /**
     * 2段階の9通り検討する
     */

    dp[1][0] = a[0][0];
    dp[1][1] = a[0][1];
    dp[1][2] = a[0][2];


    for (int i = 1; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j == k) continue;
                changeMaximum(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:117:33: error: 'chmax' was not declared in this scope
  117 |     for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
      |                                 ^~~~~
Language: C++

#include <bits/stdc++.h>

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMinimum(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMaximum(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */


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

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

int main() {

    int N;
    cin >> N;

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

    /**
     * 2段階の9通り検討する
     */

    dp[1][0] = a[0][0];
    dp[1][1] = a[0][1];
    dp[1][2] = a[0][2];


    for (int i = 1; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j == k) continue;
                changeMaximum(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:110:64: error: expected ';' before '}' token
  110 |                 changeMaximum(dp[i + 1][k], dp[i][j] + a[i][k])
      |                                                                ^
      |                                                                ;
  111 |             }
      |             ~                                                   
a.cc:117:33: error: 'chmax' was not declared in this scope
  117 |     for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
      |                                 ^~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'dp' was not declared in this scope
   10 |   dp[3][n+5];
      |   ^~
Language: C++

#include <bits/stdc++.h>
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]; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

// DP テーブル
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]);
			}
		}
	}

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

	}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: redeclaration of 'int N'
   16 |     int N; cin >> N;
      |         ^
a.cc:10:5: note: 'int N' previously declared here
   10 | int N;
      |     ^
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;
	cin >> N;
	long long a[100010][3];
	for(int i=0;i<N;i++) for (int j = 0; j < 3; ++j) cin >> a[i][j];

	long long dp[100010][3];

	//for (int i = 0; i < 100010; ++i) for (int j = 0; j < 3; ++j) dp[i][j] = INF;

	// ループ
	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]);
			}
		}
	}

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

	}

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

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

int recur(int i, int id2){
    if(dp[i][id2] != -1){
        return dp[i][id2];
    }else if(i == n){
        return 0;
    }
    if(i == 0){
        dp[i][id2] = -1;
        for(int j = 0; j < 3; j++){
            dp[i][id2] = max(dp[i][id2],a[i][j] + recur(i+1, j));
        }
        return dp[i][id2];
    }else{
        dp[i][id2] = -1;
        for(int j = 0; j < 3; j++){
            if(j == id2){
                continue;
            }else{
                dp[i][id2] = max(dp[i][id2], a[i][j] + recur(i+1,j));
            }
        }
        return dp[i][id2];
    }
}


int main(){
    cin>>n;
    memset(dp,-1,sizeof dp);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < 3; j++){
            cin>>a[i][j];
        }
    }
    int id2 = 0;
    cout<<recur(0,id2);
}


Compiler output:
/tmp/ccQa3VJ8.o: in function `recur(int, int)':
a.cc:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQa3VJ8.o
a.cc:(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQa3VJ8.o
a.cc:(.text+0x6f): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccQa3VJ8.o
a.cc:(.text+0xaf): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQa3VJ8.o
a.cc:(.text+0x127): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQa3VJ8.o
a.cc:(.text+0x162): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQa3VJ8.o
a.cc:(.text+0x19a): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQa3VJ8.o
a.cc:(.text+0x1c9): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQa3VJ8.o
a.cc:(.text+0x24d): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQa3VJ8.o
a.cc:(.text+0x288): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccQa3VJ8.o
a.cc:(.text+0x2c3): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

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

int main()
{
    
	int n;
	scanf("%d",&n)
	vector <int> dp(3);
	for (int i=0;i<n;++i)
	{
		vector <int> a(3);
		vector<int> dpn(3,0);
		for(int &x:a){scanf("%d",&x);}
		for (int j=0;j<3;++j)
		{
			for(int k=0;k<n;++k)
			{
				if(j!=k)
				{
					dpn[k]=max(dpn[k],dp[j]+a[k]);
				}
			}
		}
		dp=dpn;
	}
	printf("%d\n",max({dp[0],dp[1],dp[2]}));
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:23: error: expected ';' before 'vector'
    8 |         scanf("%d",&n)
      |                       ^
      |                       ;
    9 |         vector <int> dp(3);
      |         ~~~~~~         
a.cc:21:59: error: 'dp' was not declared in this scope; did you mean 'dpn'?
   21 |                                         dpn[k]=max(dpn[k],dp[j]+a[k]);
      |                                                           ^~
      |                                                           dpn
a.cc:25:17: error: 'dp' was not declared in this scope; did you mean 'dpn'?
   25 |                 dp=dpn;
      |                 ^~
      |                 dpn
a.cc:27:28: error: 'dp' was not declared in this scope; did you mean 'dup'?
   27 |         printf("%d\n",max({dp[0],dp[1],dp[2]}));
      |                            ^~
      |                            dup
a.cc:27:26: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   27 |         printf("%d\n",max({dp[0],dp[1],dp[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: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++

using namespace std;
typedef long int ll;
typedef unsigned long long ull;
 
 
int main()
    {
        int n;
        cin >> n;
        int arr[n][3] , dp[n][3];
       for(int i=0;i<n;i++){
       		for(int j=0;j<3;j++)cin>>arr[i][j];
       }
   		for(int i=0;i<3;i++){
   			dp[0][i] = arr[0][i];
   		}
   		for(int i=1;i<n;i++){
   			for(int j=0;j<3;j++){
 
 
   			dp[i][j] = max(dp[i-1][(j+1)%3] , dp[i-1][(j+2)%3]) + arr[i][j];
   			}
   		}
        int ans = 0;
        ans = max(dp[n-1][0] , dp[n-1][1]);
        ans = max( ans , dp[n-1][2]);
        cout<<ans;
    
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+7;
vector<int> adj[N];
#define pb push_back

int recur(int person, int pre, int n)
{
    int res = INT_MIN;
    
    if(person == n+1)
        return 0;

    for(int i=0;i<adj[person].size();i++)
    {
        if(i==pre)
            continue;

        res = adj[person][i];
        res += recur(person+1,i);
    }
    return res;
}

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

    int ans;
    int maxi = INT_MIN;

    for(int i=0;i<3;i++)
    {
        if(n>1)
        {
        ans = adj[1][i] + recur(2,i,n);
        maxi = max(maxi, ans);
        }
        else if(n==1)
            maxi = max(adj[1][0], max(adj[1][1], adj[1][2]));
    }

    cout<<maxi<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int recur(int, int, int)':
a.cc:21:21: error: too few arguments to function 'int recur(int, int, int)'
   21 |         res += recur(person+1,i);
      |                ~~~~~^~~~~~~~~~~~
a.cc:8:5: note: declared here
    8 | int recur(int person, int pre, int n)
      |     ^~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: expected primary-expression before ';' token
    9 |   for(ll i=;i<n;i++)
      |            ^
a.cc:22:44: error: invalid operands of types 'const long long int' and 'const char [2]' to binary 'operator<<'
   22 |   cout<<max(dpa[n-1],max(dpb[n-1],dpc[n-1])<<"\n";
      |                      ~~~~~~~~~~~~~~~~~~~~~~^~~~~~
      |                         |                    |
      |                         const long long int  const char [2]
Language: C++

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

int main()
{
	int maxans;
	int i,j,k,n;
	cin >> n;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=3;j++)
		{
			cin >> a[i][j];
		}
	}
	dp[1][1]=a[1][1];
	dp[1][2]=a[1][2];
	dp[1][3]=a[1][3];
	for(i=2;i<=n;i++)
	{
		for(j=1;j<=3;j++)
		{
			if(j==1)
			{
				dp[i][j]+=max(dp[i-1][j+1],dp[i-1][j+2]);
			}
			if(j==2)
			{
				dp[i][j]+=max(dp[i-1][j+1],dp[i-1][j-1]);
			}
			if(j==3)
			{
				dp[i][j]+=max(dp[i-1][j-1],dp[i-1][j-2]);
			}
		}
	}
	maxans = max(dp[n][1],max(dp[n][2],dp[n][3]));
	cout << maxans << endl;
}

Compiler output:
a.cc:3:7: error: 'n' was not declared in this scope; did you mean 'yn'?
    3 | int a[n][3];
      |       ^
      |       yn
a.cc:4:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    4 | int dp[n][3];
      |        ^
      |        yn
a.cc: In function 'int main()':
a.cc:15:32: error: 'a' was not declared in this scope
   15 |                         cin >> a[i][j];
      |                                ^
a.cc:18:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   18 |         dp[1][1]=a[1][1];
      |         ^~
      |         dup
a.cc:18:18: error: 'a' was not declared in this scope
   18 |         dp[1][1]=a[1][1];
      |                  ^
Language: C++

#if 1

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

int main()
{
    scanf("%d",&n);
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= 3;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    for(int i = 1;i <= n;i++)
    {
        d[i][1] = max(d[i-1][2],d[i-1][3])+a[i][1];
        d[i][2] = max(d[i-1][1],d[i-1][3])+a[i][2];
        d[i][3] = max(d[i-1][2],d[i-1][1])+a[i][3];
    }
    printf("%d",max(d[n][1],max(d[n][2],d[n][3])));
}


Compiler output:
a.cc:1: error: unterminated #if
    1 | #if 1
Language: C++

#include <bits/stdc++.h>

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T> inline bool changeMinimum(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T> inline bool changeMaximum(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */

int main() {

    int N;cin>>N;

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

// DP テーブル
    long long dp[100010][3];
    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;}
                changeMaximum(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:82:9: error: redeclaration of 'int N'
   82 |     int N;
      |         ^
a.cc:79:9: note: 'int N' previously declared here
   79 |     int N;cin>>N;
      |         ^
a.cc:94:65: error: expected ';' before '}' token
   94 |                 changeMaximum(dp[i+1][k],dp[i][j]  + a[i][k]   )
      |                                                                 ^
      |                                                                 ;
   95 | 
   96 |             }
      |             ~                                                    
a.cc:102:33: error: 'chmax' was not declared in this scope
  102 |     for (int j = 0; j < 3; ++j) chmax(res, dp[N][j]);
      |                                 ^~~~~
Language: C++

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

Compiler output:
a.cc:4:1: error: 'll' does not name a type
    4 | ll dp[N][3];
      | ^~
a.cc: In function 'int main()':
a.cc:6:3: error: 'll' was not declared in this scope
    6 |   ll n,a,b,c;
      |   ^~
a.cc:7:10: error: 'n' was not declared in this scope
    7 |   cin >> n >> a >> b >> c;
      |          ^
a.cc:7:15: error: 'a' was not declared in this scope
    7 |   cin >> n >> a >> b >> c;
      |               ^
a.cc:7:20: error: 'b' was not declared in this scope
    7 |   cin >> n >> a >> b >> c;
      |                    ^
a.cc:7:25: error: 'c' was not declared in this scope
    7 |   cin >> n >> a >> b >> c;
      |                         ^
a.cc:8:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
    8 |   dp[0][0] = a;
      |   ^~
      |   dup
Language: C++

#include<iostream>
using namespace std;
#define ll long long

ll a[10005], b[10005], c[10005], n;
ll dp[10005][4];

ll solve(ll day, ll activity){
	if(day == n+1){
		return 0;
	}
	if(dp[day][activity] != -1){
		return dp[day][activity];
	}
	if(activity == 1){
		return dp[day][activity] = a[day] + max(solve(day+1, 2), solve(day+1, 3));
	}
	else if(activity == 2){
		return dp[day][activity] = b[day] + max(solve(day+1, 1), solve(day+1, 3));
	}
	else if(activity == 3){
		return dp[day][activity] = c[day] + max(solve(day+1, 1), solve(day+1, 2));
	}
}

int main(){
	
	cin>>n;

	for(ll i=1;i<=n;i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	memset(dp, -1, sizeof(dp));
	cout<<max(max(solve(1, 1), solve(1, 2)), solve(1, 3));

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'memset' was not declared in this scope
   33 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc: In function 'long long int solve(long long int, long long int)':
a.cc:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
Language: C++

#include<iostream>
using namespace std;
#define ll long long

ll a[10005], b[10005], c[10005], n;
ll dp[10005][4];

ll solve(ll day, ll activity){
	if(day > n){
		return 0;
	}
	if(dp[day][activity] != -1){
		return dp[day][activity];
	}
	if(activity == 1){
		return dp[day][activity] = a[day] + max(solve(day+1, 2), solve(day+1, 3));
	}
	else if(activity == 2){
		return dp[day][activity] = b[day] + max(solve(day+1, 1), solve(day+1, 3));
	}
	else if(activity == 3){
		return dp[day][activity] = c[day] + max(solve(day+1, 1), solve(day+1, 2));
	}
	return 0;
}

int main(){
	
	cin>>n;

	for(ll i=1;i<=n;i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	memset(dp, -1, sizeof(dp));
	cout<<max(max(solve(1, 1), solve(1, 2)), solve(1, 3));

	return 0;
}

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

#include<iostream>
using namespace std;
#define ll long long

ll a[10005], b[10005], c[10005], n;
ll dp[10005][4];

ll solve(ll day, ll activity){
	if(day > n){
		return 0;
	}
	if(dp[day][activity] != -1){
		return dp[day][activity];
	}
	if(activity == 1){
		return dp[day][activity] = a[day] + max(solve(day+1, 2), solve(day+1, 3));
	}
	else if(activity == 2){
		return dp[day][activity] = b[day] + max(solve(day+1, 1), solve(day+1, 3));
	}
	else if(activity == 3){
		return dp[day][activity] = c[day] + max(solve(day+1, 1), solve(day+1, 2));
	}
}

int main(){
	
	cin>>n;

	for(ll i=1;i<=n;i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	memset(dp, -1, sizeof(dp));
	cout<<max(max(solve(1, 1), solve(1, 2)), solve(1, 3));

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'memset' was not declared in this scope
   33 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc: In function 'long long int solve(long long int, long long int)':
a.cc:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^