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

import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;



public class B {

	public static class pair implements Comparable<pair> {
		int id;
		int ans;

		pair(int x, int y) {

			id = x;
			ans = y;

		}

		public pair() {

		}

		public int compareTo(pair o) {
			// TODO Auto-generated method stub

			return this.id - o.id;
		}
	}

//	static int mod = (int) 998244353.;
	static int mod=(int)1e9+7;
	static ArrayList<Integer> gr[];
	static int ar[][];
	static Scanner sc = new Scanner(System.in);
	static int pri[] = new int[(int) 1e6 + 5];
	static StringBuilder out = new StringBuilder();

	//static long dp[];

	public static void main(String[] args) throws IOException {
		int t =1;// sc.nextInt();
		
		while (t-- > 0) {
			int n=sc.nextInt();
			
			ar=new int[n+1][4];
			for(int i=1;i<=n;i++) {
				for(int j=1;j<=3;j++)
				ar[i][j]=sc.nextInt();
			}
		
		System.out.println(solve(n));
		}

	}
	
	static long solve(int n) {
		long dp[][]=new long[n+1][4];
		dp[0][0]=0;
		for(int i=1;i<=n;i++) {
			for(int j=1;j<=3;j++) {
				long sum=Integer.MIN_VALUE;
				for(int k=1;k<=3;k++) {
					if(k!=j)sum=Math.max(sum,dp[i-1][k]);
					
				}
				dp[i][j]=ar[i][j]+sum;
			}
		}
		
		return Math.max(dp[n][1], Math.max(dp[n][2], dp[n][3]));
		
	}


}

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

#include <iostream>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    cin >> b[i];
    cin >> c[i];
  }
  vector<vector<int>> dp(n);
  for (int i = 0; i < n; ++i) dp[i].resize(3, 0);
  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];
  for (int i = 1; i < n; ++i) {
    dp[i][0] = max(a[i] + dp[i-1][1], a[i] + dp[i-1][2]);
    dp[i][1] = max(b[i] + dp[i-1][0], b[i] + dp[i-1][2]);
    dp[i][2] = max2(c[i] + dp[i-1][0], c[i] + dp[i-1][1]);
  }
  cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'vector' was not declared in this scope
    7 |   vector<int> a(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> a(n);
      |          ^~~
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> b(n);
      |          ^~~
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> c(n);
      |          ^~~
a.cc:11:12: error: 'a' was not declared in this scope
   11 |     cin >> a[i];
      |            ^
a.cc:12:12: error: 'b' was not declared in this scope
   12 |     cin >> b[i];
      |            ^
a.cc:13:12: error: 'c' was not declared in this scope
   13 |     cin >> c[i];
      |            ^
a.cc:15:17: error: expected primary-expression before 'int'
   15 |   vector<vector<int>> dp(n);
      |                 ^~~
a.cc:16:31: error: 'dp' was not declared in this scope
   16 |   for (int i = 0; i < n; ++i) dp[i].resize(3, 0);
      |                               ^~
a.cc:17:3: error: 'dp' was not declared in this scope
   17 |   dp[0][0] = a[0];
      |   ^~
a.cc:17:14: error: 'a' was not declared in this scope
   17 |   dp[0][0] = a[0];
      |              ^
a.cc:18:14: error: 'b' was not declared in this scope
   18 |   dp[0][1] = b[0];
      |              ^
a.cc:19:14: error: 'c' was not declared in this scope
   19 |   dp[0][2] = c[0];
      |              ^
a.cc:23:16: error: 'max2' was not declared in this scope
   23 |     dp[i][2] = max2(c[i] + dp[i-1][0], c[i] + dp[i-1][1]);
      |                ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; 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; }
const long long INF = 1LL << 60;

int main()
{
    int N; cin >> N;
  	long long a[100010][3];
	long long dp[100010][3];


    rep(i, N)
    {
        rep(j, 3) cin >> a[i][j];
    }
    long long a[100010][3];
	long long dp[100010][3];

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

    long long ans = 0;
    rep(j, 3) chmax(ans, dp[N][j]);
    cout << ans << endl;
}


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

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)

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;
}

const long long INF = 1LL << 60;
//入力
int N;
ll a[100050][3];
//DPテーブル
ll dp[100050];



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


Compiler output:
a.cc: In function 'int main()':
a.cc:43:32: error: invalid types 'll {aka long long int}[int]' for array subscript
   43 |                 chmax(dp[i + 1][k],dp[i][j] + a[i][k]);
      |                                ^
a.cc:43:41: error: invalid types 'll {aka long long int}[int]' for array subscript
   43 |                 chmax(dp[i + 1][k],dp[i][j] + a[i][k]);
      |                                         ^
a.cc:49:25: error: 'j' was not declared in this scope
   49 |         chmax(res,dp[N][j]);
      |                         ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type&)'
   20 |     cout<<max(dp[n - 1])<<endl;
      |           ~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:20:14: note:   'std::vector<long long int>' is not derived from 'std::initializer_list<_Tp>'
   20 |     cout<<max(dp[n - 1])<<endl;
      |           ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

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

int main() {
	int n;
	
	cin>>n;
  	
	int arr1[n],arr2[n],arr3[n],dp[n+1][3];
	for(int i=0;i<n;i++){
	  cin>>arr1[i];
      cin>>arr2[i];
      cin>>arr3[i];
		
	}
  dp[0][0]=arr1[0];
  dp[0][1]=arr2[0];
  dp[0][2]=arr3[0];
	for(int  i=1;i<n;i++){
    	dp[i][0]=max(dp[i-1][1],dp[i-1][2])+arr1[i];
      dp[i][1]=max(dp[i-1][0],dp[i-1][2])+arr2[i];
      dp[i][2]=max(dp[i-1][1],dp[i-1][0])+arr3[i];
      
    }
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	return 0;
}
Submission Info


Compiler output:
a.cc:33:5: error: redefinition of 'int main()'
   33 | int main() {
      |     ^~~~
a.cc:5:5: note: 'int main()' previously defined here
    5 | int main() {
      |     ^~~~
a.cc:57:1: error: 'Submission' does not name a type
   57 | Submission Info
      | ^~~~~~~~~~
Language: C++

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

int main(){
 int n; cin >> n;
 int dp[110000][5];
  dp[0][0] = 0;
  dp[0][1] = 0;
  dp[0][2] = 0;
 vector<int> A,B,C;
  for(int i=0;i<n;i+++){
  int a,b,c; cin >> a >> b >> c;
    A.push_back(a);
    B.push_back(b);
    C.push_back(c);
  }
  for(int i=0;i<n;i++){
  	dp[i+1][0] = max(dp[i][1],dp[i][2])+A[i];
  	dp[i+1][1] = max(dp[i][0],dp[i][2])+B[i];
  	dp[i+1][2] = max(dp[i][0],dp[i][1])+C[i];
  }
  cout << max({dp[n][0],dp[n][1],dp[n][2]}) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: expected primary-expression before ')' token
   13 |   for(int i=0;i<n;i+++){
      |                       ^
Language: C++

#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;
const int INF = 0x3f3f3f3f;
//static const auto _____ = []()
//{
//	ios::sync_with_stdio(false);
//	cin.tie(nullptr);
//	return nullptr;
//}();

int main(int argc, char *argv[]) {
    int N;
    cin >> N;
    int v[N + 1][3]; //  v[day][i] 表示第day天进行第i项饿的幸福值
    memset(v, 0, sizeof(v));
    for (int i = 1; i <= N; i++) {
        cin >> v[i][0] >> v[i][1] >> v[i][2];
    }
    int dp[N + 1][3];
    for (int i = 0; i < 3; i++) {
        dp[1][i] = v[1][i];
    }
    for (int day = 2; day <= N; day++) {
        for (int cur = 0; cur < 3; cur++) {
            dp[day][cur] = 0;
            for (int last = 0; last < 3; last++) {
                if (cur != last) {
                    dp[day][cur] = max(dp[day][cur], dp[day - 1][last] + v[day][cur]);
                }
            }
        }
    }
    cout << max(dp[N][0], max(dp[N][1], dp[N][2]));
    return 0;
}

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

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    int abc[100005][3];
    rep(i,N)rep(j,3) cin >> abc[i+1][j];

    }
    int dp[100005][3];
    for (int i = 1; i <= N; i++){
        for(int act = 0;act<3; act++){
            for (int prev = 0;prev<3;prev++){
                if (act == prev) continue;
                dp[i][act] = max(dp[i][act], dp[i-1][prev] + abc[i][act]);
                }
            }
        }
    int ans = 0;
    rep(i,3) ans = max(ans,dp[N][i]);
    cout << ans << endl;
}

Compiler output:
a.cc:17:5: error: expected unqualified-id before 'for'
   17 |     for (int i = 1; i <= N; i++){
      |     ^~~
a.cc:17:21: error: 'i' does not name a type
   17 |     for (int i = 1; i <= N; i++){
      |                     ^
a.cc:17:29: error: 'i' does not name a type
   17 |     for (int i = 1; i <= N; i++){
      |                             ^
a.cc:2:18: error: expected unqualified-id before 'for'
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                  ^~~
a.cc:26:5: note: in expansion of macro 'rep'
   26 |     rep(i,3) ans = max(ans,dp[N][i]);
      |     ^~~
a.cc:26:9: error: 'i' does not name a type
   26 |     rep(i,3) ans = max(ans,dp[N][i]);
      |         ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                  ^
a.cc:2:43: error: expected unqualified-id before '++' token
    2 | #define rep(i,n) for (int i = 0; i < (n); ++i)
      |                                           ^~
a.cc:26:5: note: in expansion of macro 'rep'
   26 |     rep(i,3) ans = max(ans,dp[N][i]);
      |     ^~~
a.cc:27:5: error: 'cout' does not name a type
   27 |     cout << ans << endl;
      |     ^~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
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]; // 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];
  
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
    if(k==j){continue;}
    else{ chmax( dp[i+1][k],dp[i][j]+a[i][k];)}}}}
    long long i=0;
    for (int k = 0; k < 3; ++k) i=max(dp[N][k],i);
    cout<<i<<endl;}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:23:45: error: expected ')' before ';' token
   23 |     else{ chmax( dp[i+1][k],dp[i][j]+a[i][k];)}}}}
      |                ~                            ^
      |                                             )
a.cc:23:46: error: expected primary-expression before ')' token
   23 |     else{ chmax( dp[i+1][k],dp[i][j]+a[i][k];)}}}}
      |                                              ^
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]; // 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];
  
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
    if(k==j){continue;}
    else{ chmax( dp[i+1][k],dp[i][j]+a[i][k])}}}}
    long long i=0;
    for (int k = 0; k < 3; ++k) i=max(dp[N][k],i);
    cout<<i<<endl;}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:23:46: error: expected ';' before '}' token
   23 |     else{ chmax( dp[i+1][k],dp[i][j]+a[i][k])}}}}
      |                                              ^
      |                                              ;
Language: C

#include <stdio.h>


int main(){
	int total,a,b,c,nCase;
	bool first= true,second=true,third=true;
	
	scanf("%d",&nCase);
	
	for(int i=1;i<=nCase;i++){
		scanf("%d %d %d",&a,&b,&c);
		
		if(a>=b && a>=c && first==true || second == false && a>=c || third==false &&a>=b){
			total+=a;
			first=false; 
			second=true;
			third=true;
		}else if(b>=a &&b>=c && second == true || first ==false &&b>=c || third==false &&b>=a){
			total+=b;
			first=true;second=false;third=true;
		}else if(c>=a && c>=b && third == true || first==false &&c>b || second==false &&c>a){
			total+=c;
			third = false;first=true;second=true;
		}
		
	}
	
	printf("%d",total);
	
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:9: error: unknown type name 'bool'
    6 |         bool first= true,second=true,third=true;
      |         ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:6:21: error: 'true' undeclared (first use in this function)
    6 |         bool first= true,second=true,third=true;
      |                     ^~~~
main.c:6:21: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:6:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:61: error: 'false' undeclared (first use in this function)
   13 |                 if(a>=b && a>=c && first==true || second == false && a>=c || third==false &&a>=b){
      |                                                             ^~~~~
main.c:13:61: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include <stdio.h>

//void validation(){
//	int total,a,b,c,nCase;
//	bool first= true,second=true,third=true;
//	
//		if(first = false){
//			if(b>c){
//				total+=b;
//				second=false;
//				first=true;
//			}else{
//				total+=c;
//				third=false;
//				first=true;
//				
//			}
//		}else if(second = false){
//			if(a>c){
//				total+=a;
//				second=true;
//				first=false;
//			}else{
//				total+=c;
//				third=false;
//				second = true;
//			}
//		}else if(third = false){
//			if(a>b){
//				total+=a;
//				first=false;
//				third=true;
//			}else{
//				total+=b;
//				second=false;
//				third=true;
//			}
//		}
//		
//	}


int main(){
	int total,a,b,c,nCase;
	bool first= true,second=true,third=true;
	
	scanf("%d",&nCase);
	
	for(int i=1;i<=nCase;i++){
		scanf("%d %d %d",&a,&b,&c);
		
		if(a>=b && a>=c && first==true || second == false && a>=c || third==false &&a>=b){
			total+=a;
			first=false; 
			second=true;
			third=true;
		}else if(b>=a &&b>=c && second == true || first ==false &&b>=c || third==false &&b>=a){
			total+=b;
			first=true;second=false;third=true;
		}else if(c>=a && c>=b && third == true || first==false &&c>b || second==false &&c>a){
			total+=c;
			third = false;first=true;second=true;
		}
		
	}
	
	printf("%d",total);
	
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:45:9: error: unknown type name 'bool'
   45 |         bool first= true,second=true,third=true;
      |         ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include <stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:45:21: error: 'true' undeclared (first use in this function)
   45 |         bool first= true,second=true,third=true;
      |                     ^~~~
main.c:45:21: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:45:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:52:61: error: 'false' undeclared (first use in this function)
   52 |                 if(a>=b && a>=c && first==true || second == false && a>=c || third==false &&a>=b){
      |                                                             ^~~~~
main.c:52:61: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C

#include <bits/stdc++.h>

//void validation(){
//	int total,a,b,c,nCase;
//	bool first= true,second=true,third=true;
//	
//		if(first = false){
//			if(b>c){
//				total+=b;
//				second=false;
//				first=true;
//			}else{
//				total+=c;
//				third=false;
//				first=true;
//				
//			}
//		}else if(second = false){
//			if(a>c){
//				total+=a;
//				second=true;
//				first=false;
//			}else{
//				total+=c;
//				third=false;
//				second = true;
//			}
//		}else if(third = false){
//			if(a>b){
//				total+=a;
//				first=false;
//				third=true;
//			}else{
//				total+=b;
//				second=false;
//				third=true;
//			}
//		}
//		
//	}


int main(){
	int total,a,b,c,nCase;
	bool first= true,second=true,third=true;
	
	scanf("%d",&nCase);
	
	for(int i=1;i<=nCase;i++){
		scanf("%d %d %d",&a,&b,&c);
		
		if(a>=b && a>=c && first==true || second == false && a>=c || third==false &&a>=b){
			total+=a;
			first=false; 
			second=true;
			third=true;
		}else if(b>=a &&b>=c && second == true || first ==false &&b>=c || third==false &&b>=a){
			total+=b;
			first=true;second=false;third=true;
		}else if(c>=a && c>=b && third == true || first==false &&c>b || second==false &&c>a){
			total+=c;
			third = false;first=true;second=true;
		}
		
	}
	
	printf("%d",total);
	
	
	return 0;
}

Compiler output:
main.c:1:10: 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{
  static class tutt{
  	int a,b,c;
    tutt(int a,int b,int c){
    	this.a=a;
        this.b=b;
        this.c=c;
    }
  
  }
  static long[][] aa;
  static long maxx(tutt[] tut,int flag,int ind){
  	if(ind>=tut.length){return 0;}
    
    if(aa[ind][flag]!=-1){return aa[ind][flag];}
    
   	if(flag==0){
    	return aa[ind][flag]=Math.max(maxx(tut,1,ind+1)+(long)tut[ind].a,
                                     Math.max(maxx(tut,2,ind+1)+(long)tut[ind].b ,
                                             maxx(tut,3,ind+1)+(long)tut[ind].c  ) );
    }
    else if(flag==1){
    	return aa[ind][flag]=Math.max(maxx(tut,2,ind+1)+(long)tut[ind].b,
                                      maxx(tut,3,ind+1)+(long)tut[ind].c ); 
    }
    else if(flag==2){
    	return aa[ind][flag]=Math.max(maxx(tut,1,ind+1)+(long)tut[ind].a,
                                      maxx(tut,3,ind+1)+(long)tut[ind].c); 
    }
    else{
    	return aa[ind][flag]=Math.max(maxx(tut,1,ind+1)+(long)tut[ind].a,
                                      maxx(tut,2,ind+1)+(long)tut[ind].b); 
    }
    
  }
  
  public static void main(String[] args){
  
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    tutt[] arr=new tut[n];
    for(int j=0;j<n;j++){
    	tutt temp=new tutt(s.nextInt(),s.nextInt(),s.nextInt() );
        arr[j]=temp;
    }
    aa=new long[n][4];
    for(int j=0;j<n;j++){
    	for(int i=0;i<4;i++){
         	aa[j][i]=-1;
        }
    }
    System.out.println(maxx(arr,0,0));
    
    
  }

}

Compiler output:
Main.java:42: error: cannot find symbol
    tutt[] arr=new tut[n];
                   ^
  symbol:   class tut
  location: class Main
1 error
Language: Java

import java.util.*;
public class Main{
  static class tutt{
  	int a,b,c;
    tut(int a,int b,int c){
    	this.a=a;
        this.b=b;
        this.c=c;
    }
  
  }
  static long[][] aa;
  static long maxx(tutt[] tut,int flag,int ind){
  	if(ind>=tut.length){return 0;}
    
    if(aa[ind][flag]!=-1){return aa[ind][flag];}
    
   	if(flag==0){
    	return aa[ind][flag]=Math.max(maxx(tut,1,ind+1)+(long)tut[ind].a,
                                     Math.max(maxx(tut,2,ind+1)+(long)tut[ind].b ,
                                             maxx(tut,3,ind+1)+(long)tut[ind].c  ) );
    }
    else if(flag==1){
    	return aa[ind][flag]=Math.max(maxx(tut,2,ind+1)+(long)tut[ind].b,
                                      maxx(tut,3,ind+1)+(long)tut[ind].c ); 
    }
    else if(flag==2){
    	return aa[ind][flag]=Math.max(maxx(tut,1,ind+1)+(long)tut[ind].a,
                                      maxx(tut,3,ind+1)+(long)tut[ind].c); 
    }
    else{
    	return aa[ind][flag]=Math.max(maxx(tut,1,ind+1)+(long)tut[ind].a,
                                      maxx(tut,2,ind+1)+(long)tut[ind].b); 
    }
    
  }
  
  public static void main(String[] args){
  
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    tutt[] arr=new tut[n];
    for(int j=0;j<n;j++){
    	tutt temp=new tutt(s.nextInt(),s.nextInt(),s.nextInt() );
        arr[j]=temp;
    }
    aa=new long[n][4];
    for(int j=0;j<n;j++){
    	for(int i=0;i<4;i++){
         	aa[j][i]=-1;
        }
    }
    System.out.println(maxx(arr,0,0));
    
    
  }

}

Compiler output:
Main.java:5: error: invalid method declaration; return type required
    tut(int a,int b,int c){
    ^
1 error
Language: C++

#include <bits/stdc++.h>

using namespace std;

int solve(vector<vector<int>>& arr) {
	int n = arr.size();
  	if(n<2) return 0;
  	vector<vector<int>> dp(n, vector<int>(3));
	dp[0][0] = arr[0][0];
  	dp[0][1] = arr[0][1];
  	dp[0][2] = arr[0][2];
  	
  	
  	for(int i=1;i<n;i++){
      	int a = 0;
      	if(i>=2) {
        	a = max(dp[i-2][1], dp[i-2][2]) + arr[i][0] + arr[i-1][0];
        }
      	int b = max(dp[i-1][1], dp[i-1][2]) + arr[i][0];
      
      	dp[i][0] = max(a,b);
      
      	a = 0;
      	if(i>=2) {
        	a = max(dp[i-2][2], dp[i-2][0]) + arr[i][1] + arr[i-1][1];
        }
      	b = max(dp[i-1][2], dp[i-1][0]) + arr[i][1];
      	dp[i][1] = max(a,b);
      
      
      	a = 0;
      	if(i>=2) {
        	a = max(dp[i-2][0], dp[i-2][1]) + arr[i][2] + arr[i-1][2];
        }
      	b = max(dp[i-1][0], dp[i-1][1]) + arr[i][2];
      	dp[i][2] = max(a,b);
    }
  
  
  
  	
  	return max(dp[n-1][0],mac(dp[n-1][1],dp[n-1][2]));
}


int main() {
	int n;
  	cin>>n;
  	vector<vector<int>> arr(n, vector<int>(3));
  	for(int i=0;i<n;i++) {
    	cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
    }
  	cout<<solve(arr);
	return 0;
}





Compiler output:
a.cc: In function 'int solve(std::vector<std::vector<int> >&)':
a.cc:42:31: error: 'mac' was not declared in this scope
   42 |         return max(dp[n-1][0],mac(dp[n-1][1],dp[n-1][2]));
      |                               ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 int a[1000000][4];
int dp[1000000];
int solve(int n, int i){
  if(n==0)
    return 0;
  if(dp[n]!= -1)
    return dp[n];
  
  for(int j=1;j<=3;j++){
    if(i!=j)
    dp[n]=max(dp[n], solve(n-1,j)+a[n][j]);
  }
  return dp[n]
}
int main(){
  int n;
  cin>> n;
  
   // int a[n][3];
  memset(dp,-1,sizeof(dp));
    for(int i=1;i<=n;i++){
      for(int j=1;j<=3;j++)
        cin>> a[i][j];
    }
      cout<<solve(n,0);
      
}


Compiler output:
a.cc: In function 'int solve(int, int)':
a.cc:15:15: error: expected ';' before '}' token
   15 |   return dp[n]
      |               ^
      |               ;
   16 | }
      | ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 int a[1000000][4];
int dp[1e6][4];
int solve(int n, int i){
  if(n==0)
    return 0;
  if(dp[n][i]!= -1)
    return dp[n][i];
  for(int j=1;j<=3;j++){
    if(i!=j)
    dp[n][i]=max(dp[n][i], solve(n-1,j)+a[n][j]);
  }
  return dp[n][i];
}
int main(){
  int n;
  cin>> n;
  
   // int a[n][3];
  memset(dp,-1,sizeof(dp));
    for(int i=1;i<=n;i++){
      for(int j=1;j<=3;j++)
        cin>> a[i][j];
      cout<<solve(n,0);
      
}

Compiler output:
a.cc:4:8: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 | int dp[1e6][4];
      |        ^~~
a.cc:4:8: error: could not convert '1.0e+6' from 'double' to 'long unsigned int'
    4 | int dp[1e6][4];
      |        ^~~
      |        |
      |        double
a.cc:4:8: error: size of array 'dp' has non-integral type 'double'
a.cc: In function 'int main()':
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:16:11: note: to match this '{'
   16 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int maxHappines(vector<vector<int> >& activites){
  int n = activites.size();
  
  vector<vector<int> > dp(n, vector<int>(3, 0));

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

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

int main(){

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

  cout << maxHappines(activites) << endl;
  return 0;
}


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

#include <bits/stdc++.h>

using namespace std;

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

int main() {
  int N;
  cin >> N;
  
  int a[N+1] = {0};
  int b[N+1] = {0};
  int c[N+1] = {0};
  
  for (int i = 0; i < N; i++) {
    cin >> a[i+1] >> b[i+1] >> c[i+1];
  }
  
  
  int dp[i][3] = {0}; //i日目まで過ごし，ラストが0, 1, 2(A,B,C)だったときの幸福度の最大値
  
  for (int i = 0; i < N; i++) {
    chmax(dp[i+1][0], max(dp[i][1], dp[i][2]) + a[i+1]);
    chmax(dp[i+1][1], max(dp[i][2], dp[i][0]) + b[i+1]);
    chmax(dp[i+1][2], max(dp[i][0], dp[i][1]) + c[i+1]);
  }
  
  cout << max({dp[N][0], dp[N][1], dp[N][2]}) << endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: 'i' was not declared in this scope
   22 |   int dp[i][3] = {0}; //i日目まで過ごし，ラストが0, 1, 2(A,B,C)だったときの幸福度の最大値
      |          ^
a.cc:25:11: error: 'dp' was not declared in this scope; did you mean 'dup'?
   25 |     chmax(dp[i+1][0], max(dp[i][1], dp[i][2]) + a[i+1]);
      |           ^~
      |           dup
a.cc:30:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
   30 |   cout << max({dp[N][0], dp[N][1], dp[N][2]}) << endl;
      |                ^~
      |                dup
a.cc:30:14: 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/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: Java

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


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

// #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <tuple>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repdm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)
const ll INF = 1LL << 60;
const ll ZERO = 0;

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 N;
ll dp[100010][3];
ll a[100010][3];
ll ans = 0;

int main()
{
  int N;
  cin >> N;
  rep(i, N)
  {
    rep(j, 3)
    {
      cin >> a[i][j];
    }
  }

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

  ll res = 0;
  rep(j, 3) chmax(res, dp[N][j]);
  cou << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:3: error: 'cou' was not declared in this scope; did you mean 'cos'?
   72 |   cou << res << endl;
      |   ^~~
      |   cos
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'i' was not declared in this scope
   16 |           dp[0][i]=max(dp[1][i],dp[2][i])+a[i];
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define forn(i,a,b) for (int i = a; i <= b; i++)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rc(s) return cout<<s,0
#define rcc(s) cout<<s,exit(0)
#define er erase
#define in insert
#define pi pair <int, int>
# define sz(x) (int)((x).size())
#define int long long

const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};

const ll inf = 0x3f3f3f3f3f3f3f;
const ll mod = 1999999973;
const int N = 2e5 + 11;

int dp[N][3],n,k,x;
vector<int>v;

int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0); cerr.tie(0); cout.tie(0);

//ifstream cin("flip.in");
//ofstream cout("flip.out");

    cin >> n;

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

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

                cin >> x; /

                for(int jj = 0; jj < 3; jj++){

                    if(jj!=j)dp[i][j] = max(dp[i][j] , dp[i-1][jj] + x);

                }

        }

    }

    int ans = max({dp[n][0] , dp[n][1] , dp[n][2]});
    rc(ans);

return 0;
}


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:40:27: error: expected primary-expression before '/' token
   40 |                 cin >> x; /
      |                           ^
a.cc:42:17: error: expected primary-expression before 'for'
   42 |                 for(int jj = 0; jj < 3; jj++){
      |                 ^~~
a.cc:42:33: error: 'jj' was not declared in this scope; did you mean 'j'?
   42 |                 for(int jj = 0; jj < 3; jj++){
      |                                 ^~
      |                                 j
Language: C++

#include <iostream>
#include <climits>
#include <cstring>

using namespace std;

const int cap = 1e5 + 1;
int N;
int V[3];
int dp[cap][3];

int main() {
    if (scanf("%d", &N)) {};
    fill(&dp[0][0], &dp[0][0] + (N + 1) * 3, 0);
    for (int i = 1; i <= N; ++i) {
        if (scanf(" %d %d %d", &V[0], &V[1], &V[2])) {};
        for (int j = 0; j < 3; ++j)
            for (int k = 0; k < 3; ++k)
                if (j != k)
                    dp[i][j] = max(dp[i][j], dp[i - 1][k] + V[j]);
    }
    printf("%d", *max_element(&dp[N][0], &dp[N][0] + 3));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:19: error: 'max_element' was not declared in this scope
   22 |     printf("%d", *max_element(&dp[N][0], &dp[N][0] + 3));
      |                   ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <climits>
#include <cstring>

using namespace std;

const int cap = 1e5 + 1;
int N;
int V[3];
int dp[cap][3];

int main() {
    (void)scanf("%d", &N);
    fill(&dp[0][0], &dp[0][0] + (N + 1) * 3, 0);
    for (int i = 1; i <= N; ++i) {
        (void)scanf(" %d %d %d", &V[0], &V[1], &V[2]);
        for (int j = 0; j < 3; ++j)
            for (int k = 0; k < 3; ++k)
                if (j != k)
                    dp[i][j] = max(dp[i][j], dp[i - 1][k] + V[j]);
    }
    printf("%d", *max_element(&dp[N][0], &dp[N][0] + 3));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:19: error: 'max_element' was not declared in this scope
   22 |     printf("%d", *max_element(&dp[N][0], &dp[N][0] + 3));
      |                   ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <climits>
#include <cstring>

using namespace std;

const int cap = 1e5 + 1;
int N;
int V[3];
int dp[cap][3];

int main() {
    scanf("%d", &N);
    fill(&dp[0][0], &dp[0][0] + (N + 1) * 3, 0);
    for (int i = 1; i <= N; ++i) {
        scanf(" %d %d %d", &V[0], &V[1], &V[2]);
        for (int j = 0; j < 3; ++j)
            for (int k = 0; k < 3; ++k)
                if (j != k)
                    dp[i][j] = max(dp[i][j], dp[i - 1][k] + V[j]);
    }
    printf("%d", *max_element(&dp[N][0], &dp[N][0] + 3));
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:19: error: 'max_element' was not declared in this scope
   22 |     printf("%d", *max_element(&dp[N][0], &dp[N][0] + 3));
      |                   ^~~~~~~~~~~
Language: Java

import java.util.*;
import java.lang.*;
public class force{
    public static int Main(int arr[][],int i,int j,int n,int dp[][]){
        //Base Case
        if(i==n-1)return arr[i][j];
        if(dp[i][j]!=0)return dp[i][j];
        //Recursive Approach
        int max=0;
        for(int k=0;k<3;k++){
           
            if(k!=j){
                int op=calc(arr,i+1,k,n,dp)+arr[i][j];
                max=Math.max(max,op);
            }


        }
        dp[i][j]=max;
        return max;



    }

    public static void main(String[] args){
        int n;
        Scanner sc=new Scanner(System.in);
        n=sc.nextInt();
        int arr[][]=new int[n][3];
        for(int i=0;i<n;i++){
            for(int j=0;j<3;j++){
                arr[i][j]=sc.nextInt();
            }
        }
        int dp[][]=new int[n][n];
        int res=Math.max(calc(arr,0,0,n,dp),Math.max(calc(arr,0,1,n,dp),calc(arr,0,2,n,dp)));
        System.out.println(res);
    }
    
}

Compiler output:
Main.java:3: error: class force is public, should be declared in a file named force.java
public class force{
       ^
Main.java:13: error: cannot find symbol
                int op=calc(arr,i+1,k,n,dp)+arr[i][j];
                       ^
  symbol:   method calc(int[][],int,int,int,int[][])
  location: class force
Main.java:37: error: cannot find symbol
        int res=Math.max(calc(arr,0,0,n,dp),Math.max(calc(arr,0,1,n,dp),calc(arr,0,2,n,dp)));
                         ^
  symbol:   method calc(int[][],int,int,int,int[][])
  location: class force
Main.java:37: error: cannot find symbol
        int res=Math.max(calc(arr,0,0,n,dp),Math.max(calc(arr,0,1,n,dp),calc(arr,0,2,n,dp)));
                                                     ^
  symbol:   method calc(int[][],int,int,int,int[][])
  location: class force
Main.java:37: error: cannot find symbol
        int res=Math.max(calc(arr,0,0,n,dp),Math.max(calc(arr,0,1,n,dp),calc(arr,0,2,n,dp)));
                                                                        ^
  symbol:   method calc(int[][],int,int,int,int[][])
  location: class force
5 errors
Language: C++

n = int(input())
happy = [list(map(int, input().split())) for i in range(n)]

ans = []
ans.append(happy[0])

for i in range(1, n):
    ans.append( [max(ans[i-1][(j+1)%3] + happy[i][j], ans[i-1][(j+2)%3] + happy[i][j]) for j in range(3)] )

print(max(ans[n-1]))

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

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

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

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

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

    for (int j = 0; j < 3; j++) {
        dp[0][j] = a[0][j];
    }

    for (int i = 1; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            int mx = 0;
            for (int k = 0; k < n; k++) {
                if (j != k) {
                    mx = max (dp[i-1][k], mx);

                }
            }
            dp[i][j] = mx + a[i][j];
        }
    }

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

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

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

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

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

    for (int j = 0; j < 3; j++) {
        dp[0][j] = a[0][j];
    }

    for (int i = 1; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            int mx = 0;
            for (int k = 0; k < n; k++) {
                if (j != k) {
                    mx = max (dp[i-1][k], mx);

                }
            }
            dp[i][j] = mx + a[i][j];
        }
    }

    cout << max(dp[n-1][2], dp[n-1][1], d[n-1][0]) << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:41: error: 'd' was not declared in this scope; did you mean 'dp'?
   36 |     cout << max(dp[n-1][2], dp[n-1][1], d[n-1][0]) << "\n";
      |                                         ^
      |                                         dp
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int values[3];
    
    int notNow = -1, check = -1, greast, sum = 0;
    while (n--) {
        cin >> values[0] >> values[1] >> values[2];
        sort(values, values + 3);
        greast = INT_MIN;
        for (int i = 0; i < 3; i++)
        {  
            if(greast < values[i] && check != i)
            {
                notNow = i;
                greast = values[i];
            }
        }
        sum += greast;
        check = notNow;

    }
    cout << sum << "\n";
    return 0;
    
}
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int values[3];
    
    int notNow = -1, check = -1, greast, sum = 0;
    while (n--) {
        cin >> values[0] >> values[1] >> values[2];
        sort(values, values + 3);
        greast = INT_MIN;
        for (int i = 0; i < 3; i++)
        {  
            if(greast < values[i] && check != i)
            {
                notNow = i;
                greast = values[i];
            }
        }
        sum += greast;
        check = notNow;

    }
    cout << sum << "\n";
    return 0;
    
}


Compiler output:
a.cc:33:5: error: redefinition of 'int main()'
   33 | int main(){
      |     ^~~~
a.cc:3:5: note: 'int main()' previously defined here
    3 | int main(){
      |     ^~~~