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

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

#define MAXN 100020

int N;
long long a[MAXN], b[MAXN], c[MAXN];
long long dp[MAXN][3];

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

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:24:15:   required from here
   24 |         cout << max(dp[N-1][0],dp[N-1][1],dp[N-1][2]) << endl;
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

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

int main(){
  int n;
  cin >> n;
  int dp0, dp1, dp2;
  
  for(int i=0; i<n; i++){
    int a, b, c, s, t, u;
    cin >> a >> b >> c;
    if(i==0){
      dp0 = a;
      dp1 = b;
      dp2 = c;
      continue;
    }
    s = dp0;
    t = dp1;
    u = dp2;
    dp0 = max(t + a, u + a);
    dp1 = max(s + b, u + b);
    dp2 = max(s + c, t + c);
  }
  
  cout << max(max(dp[n-1][0],dp[n-1][1]), dp[n-1][2]) << endl;
  return 0;
}

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

//#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	//freopen("input.txt", "rt", stdin);
	int n;

	scanf_s("%d", &n);
	
	vector<vector<int>> dp(n, vector<int>(3, 0));

	for (int i = 0; i < n; i++) {
		if (i == 0)
		{
			cin >> dp[0][0] >> dp[0][1] >> dp[0][2];
			continue;
		}
		vector<int> a(3);
		cin >> a[0] >> a[1] >> a[2];
		for (int j = 0; j < 2; j++) {
			dp[i][j] = max(dp[i - 1][(j + 1) % 3] + a[(j + 1) % 3], dp[i - 1][(j + 2) % 3] + a[(j + 1) % 3]);
		}
	}

	cout << *max_element(dp[n - 1].begin(), dp[n - 1].end());

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   12 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include "pch.h"
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

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

int main()
{
	cin >> n;

	for (int i = 1; i <= n; i++)
	{
		scanf("%d%d%d", &a[i], &b[i], &c[i]);

		a[i] += max(b[i - 1], c[i - 1]);
		b[i] += max(a[i - 1], c[i - 1]);
		c[i] += max(b[i - 1], a[i - 1]);
	}

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

	return 0;
}

Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

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

int N;
long long a[100010][3];
long long dp[100010][3];

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

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

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

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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 10000
#define MAP 100
#define Pair pair<int,int>
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int dist[MAP][MAP];
int dp[100100][3] = {0};
int main(){
    int select[n];
    ll n; cin >> n;
    ll arr[100100][3];
    for(ll i = 1; i <= n; i++){
        for(ll j = 0; j < 3; j++){
            cin >> arr[i][j];
        }
    }

    for(ll i = 1; i <= n; i++){
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + arr[i][0];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + arr[i][1];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + arr[i][2];
    }
    ll ans = max(dp[n][0], max(dp[n][1], dp[n][2]));
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:16: error: 'n' was not declared in this scope; did you mean 'yn'?
   14 |     int select[n];
      |                ^
      |                yn
Language: C++

#include <iostream>
using namespace std;
int main() {
    int n;
    cin>>n;
    int i,j,ar[n][3];
    for(i=0;i<n;i++)
    {
        cin>>ar[i][0]>>ar[i][1]>>ar[i][2];
        if(i==0)
        {
            continue;
        }
        ar[i][0]+=max(ar[i-1][1],ar[i-1][2]);
        ar[i][1]+=max(ar[i-1][0],ar[i-1][2]);
        ar[i][2]+=max(ar[i-1][0],ar[i-1][1]);
    }
    cout<<max(ar[n-1][0],ar(dp[n-1][1],ar[n-1][2]));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:29: error: 'dp' was not declared in this scope
   18 |     cout<<max(ar[n-1][0],ar(dp[n-1][1],ar[n-1][2]));
      |                             ^~
a.cc:18:28: error: 'ar' cannot be used as a function
   18 |     cout<<max(ar[n-1][0],ar(dp[n-1][1],ar[n-1][2]));
      |                          ~~^~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
using namespace std;
int max2 (int a, int b) {
  if (a < b) return b;
  else return a;
}
int max3 (int a, int b, int c) {
  int t = max2(a, b);
  int k = max2(t, c);
  return k;
}
int mind (int a, int b, int c) {
  int k = max2(a, b);
  if (k < c) return k;
  else {
    if (a + b - k > c) return a + b - k;
    else return c;
  }
}
int dore (int a, int b, int c) {
  if (max3(a, b, c) == c) return 3;
  if (max3(a, b, c) == b) return 2;
  if (max3(a, b, c) == a) return 1;
}
int dore2 (int a, int b, int c) {
  if (mind(a, b, c) == a) return 1;
  if (mind(a, b, c) == b) return 2;
  if (mind(a, b, c) == c) return 3;
}
int main () {
  int N;
  cin >> N;
  int a[100001];
  int b[100001];
  int c[100001];
  int d[100001];
  for (int i = 0; i < N; i ++) {
    cin >> a[i] >> b[i] >> c[i];
    d[i] = dore(a[i], b[i], c[i]);
  }
  d[N] = 5;
  int ans[100004];
  ans[0] = 0;
  ans[1] = max3(a[0], b[0], c[0]);
  if (N == 1) {
    cout << ans[1] << endl;
    return 0;
  }
  for (int i = 2; i <= N; i ++) {//DP部分
    int p = i - 1;
    if (d[p - 1] != d[p]) ans[i] = ans[p] + max3(a[p], b[p], c[p]);
    else {
      int k = ans[p] + mind(a[p], b[p], c[p]);
      int j = ans[p - 1] + mind(a[p - 1], b[p - 1], c[p - 1]) + max3(a[p], b[p], c[p]);
      if (k > j) {
        ans[i] = k;
        d[p] = dore2(a[p], b[p], c[p]);
      }
      else {
        ans[i] = j;
        ans[p] = ans[i] - max3(a[p], b[p], c[p]);
        if (k == j && d[p] == d[i]) {
          d[p] = dore2(a[i], b[i], c[i]);
          ans[p] = ans[i] - mind(a[p], b[p], c[p]);
        }
      }
    }
  }
  cout << ans[N] << endl;
  }
}



Compiler output:
a.cc:71:1: error: expected declaration before '}' token
   71 | }
      | ^
a.cc: In function 'int dore(int, int, int)':
a.cc:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^
a.cc: In function 'int dore2(int, int, int)':
a.cc:29:1: warning: control reaches end of non-void function [-Wreturn-type]
   29 | }
      | ^
Language: C++

// ConsoleApplication1.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include "pch.h"
#include <stdio.h>
#include <math.h>

int main()
{
	int days = 0;
	int sum = 0; /*合計値を足していく変数*/
	int maxdays = pow(10, 5); /*最大値の制限*/

	int point[100000][3];	/*配列に入力させる(a,b,c)。これにmaxdaysを入れるとダメ*/

	scanf_s("%d", &days); //日数入力(N日)

	/*printf("%d", maxdays);*/

	//int point1 = 0, point2 = 0, point3 = 0;
	//scanf_s("%d,%d,%d", &point1, &point2, &point3);

	if (days < maxdays) {

		for (int i = 0; i < days; i++) 
		{
				scanf_s("%d,\t", &point[days][1]); //aの幸福度を入力する
				scanf_s("%d,\t", &point[days][2]); //b
				scanf_s("%d,\n", &point[days][3]); //c
		}
	}


		int check = 0; //連続判定用

		if (point[days][3] < 10000) { //配列の要素制約どうやる？これでいいのか？

			for (int j = 0; j < days; j++) { //配列の縦列分まわす

				if (check == 0) { //最初の一回(全組み)check ==0;

					if (point[days][1] < point[days][2] && point[days][2] < point[days][3]) //3が最大
					{
						sum += point[days][3]; //3を足す
						check = 3;
					}
					else if (point[days][1] < point[days][2] && point[days][3] < point[days][2]) //2が最大
					{
						sum += point[days][2]; //2を足す
						check = 2;
					}
					else if (point[days][2] < point[days][1] && point[days][3] < point[days][1]) //1が最大
					{
						sum += point[days][1]; //1を足す
						check = 1;
					}
				}
				else if(check == 1) { 				//前日に1だった場合

					if (point[days][2] < point[days][3]) //2より3が大きかったら
					{
						sum += point[days][3]; //3を足す
						check = 3;
					}
					else
					{
						sum += point[days][2]; //2を足す
						check = 2;
					}
				}else if(check == 2) { //前日に2だった場合

					if (point[days][1] < point[days][3]) //1より3が大きかったら
					{
						sum += point[days][3]; //3を足す
						check = 3;
					}
					else
					{
						sum += point[days][1]; //1を足す
						check = 1;
					}
				}else if (check == 3) { //前日に3だった場合

					if (point[days][1] < point[days][2]) //1より2が大きかったら
					{
						sum += point[days][2]; //2を足す
						check = 2;
					}
					else
					{
						sum += point[days][1]; //3を足す
						check = 1;
					}
				}
			}
			//ここまででsumに一日の内の最大ポイントが加算された。
		}
		printf("%d", sum); //sum出力
}



// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Compiler output:
a.cc:4:10: fatal error: pch.h: No such file or directory
    4 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <math.h>

int main()
{
	int days = 0;
	int sum = 0; /*合計値を足していく変数*/
	int maxdays = pow(10, 5); /*最大値の制限*/

	int point[100000][3];	/*配列に入力させる(a,b,c)。これにmaxdaysを入れるとダメ*/

	scanf_s("%d", &days); //日数入力(N日)

	/*printf("%d", maxdays);*/

	//int point1 = 0, point2 = 0, point3 = 0;
	//scanf_s("%d,%d,%d", &point1, &point2, &point3);

	if (days < maxdays) {

		for (int i = 0; i < days; i++) 
		{
				scanf_s("%d,\t", &point[days][1]); //aの幸福度を入力する
				scanf_s("%d,\t", &point[days][2]); //b
				scanf_s("%d,\n", &point[days][3]); //c
		}
	}


		int check = 0; //連続判定用

		if (point[days][3] < 10000) { //配列の要素制約どうやる？これでいいのか？

			for (int j = 0; j < days; j++) { //配列の縦列分まわす

				if (check == 0) { //最初の一回(全組み)check ==0;

					if (point[days][1] < point[days][2] && point[days][2] < point[days][3]) //3が最大
					{
						sum += point[days][3]; //3を足す
						check = 3;
					}
					else if (point[days][1] < point[days][2] && point[days][3] < point[days][2]) //2が最大
					{
						sum += point[days][2]; //2を足す
						check = 2;
					}
					else if (point[days][2] < point[days][1] && point[days][3] < point[days][1]) //1が最大
					{
						sum += point[days][1]; //1を足す
						check = 1;
					}
				}
				else if(check == 1) { 				//前日に1だった場合

					if (point[days][2] < point[days][3]) //2より3が大きかったら
					{
						sum += point[days][3]; //3を足す
						check = 3;
					}
					else
					{
						sum += point[days][2]; //2を足す
						check = 2;
					}
				}else if(check == 2) { //前日に2だった場合

					if (point[days][1] < point[days][3]) //1より3が大きかったら
					{
						sum += point[days][3]; //3を足す
						check = 3;
					}
					else
					{
						sum += point[days][1]; //1を足す
						check = 1;
					}
				}else if (check == 3) { //前日に3だった場合

					if (point[days][1] < point[days][2]) //1より2が大きかったら
					{
						sum += point[days][2]; //2を足す
						check = 2;
					}
					else
					{
						sum += point[days][1]; //3を足す
						check = 1;
					}
				}
			}
			//ここまででsumに一日の内の最大ポイントが加算された。
		}
		printf("%d", sum); //sum出力
}


Compiler output:
main.c: In function 'main':
main.c:12:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   12 |         scanf_s("%d", &days); //日数入力(N日)
      |         ^~~~~~~
      |         scanf
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
int main()
{
	int N = 0;
	int *A, *B, *C;
	int sum = 0;
	char ref = 0;
	int N_limit = pow(10, 5);
 
	if (scanf("%d", &N) <= 0) {
		exit(1);
	}
	if (N <= 0 || N_limit < N)
		exit(1);
 
	A = (int *)malloc(N * sizeof(int));
	B = (int *)malloc(N * sizeof(int));
	C = (int *)malloc(N * sizeof(int));
 
 
 
	for (int i = 0; i < N; i++)
	{
 
		if (scanf("%d%d%d", &A[i], &B[i], &C[i]) < 3) {
			exit(1);
		}
		if (A[i] <= 0 || pow(10, 4) < A[i])
			exit(1);
		else if (B[i] <= 0 || pow(10, 4) < B[i])
			exit(1);
		else if (C[i] <= 0 || pow(10, 4) < C[i])
			exit(1);
	}
	int sum_ref = 100;
 
	for (int i = 0; i < N; i++)
	{
		if (A[i] >= B[i])
		{
			if (A[i] >= C[i])
			{
				ref = 1;
			}
			else
			{
				ref = 3;
			}
		}
		else if (B[i] >= A[i])
		{
			if (B[i] >= C[i])
			{
				ref = 2;
			}
			else
			{
				ref = 3;
			}
 
		}
		else if (C[i] >= B[i])
		{
			if (C[i] >= A[i])
			{
				ref = 3;
			}
			else
			{
				ref = 1;
			}
		}
 
		if (sum_ref == ref)
		{
			switch (ref)
			{
			case 1:
				if (B[i] > C[i])
					ref = 2;
				else
					ref = 3;
				break;
			case 2:
				if (A[i] > C[i])
					ref = 1;
				else
					ref = 3;
				break;
			case 3:
				if (A[i] > B[i])
					ref = 1;
				else
					ref = 2;
				break;
			default:
				break;
			}
		}
		switch (ref)
		{
		case 1:
			sum += A[i];
			break;
		case 2:
			sum += B[i];
			break;
		case 3:
			sum += C[i];
			break;
		default:
			break;
		}
		sum_ref = ref;
	}
 
	printf("%d", sum);
 
 

Compiler output:
main.c: In function 'main':
main.c:120:9: error: expected declaration or statement at end of input
  120 |         printf("%d", sum);
      |         ^~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <Math.h>

int main()
{
	int N = 0;
	int *A,*B,*C;
	int sum = 0;
	char ref = 0;
	int N_limit = pow(10, 5);

	if (scanf_s("%d", &N) <= 0) {
		exit(1);
	}
	if ( N <= 0 || N_limit <= N)
		exit(1);

	A = (int *)malloc(N * sizeof(int));
	B = (int *)malloc(N * sizeof(int));
	C = (int *)malloc(N * sizeof(int));



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

		if (scanf_s("%d%d%d", &A[i], &B[i], &C[i]) < 3) {
			exit(1);
		}
		if (A[i] <= 0 || pow(10, 4) <= A[i])
			exit(1);
		else if (B[i] <= 0 || pow(10, 4) <= B[i])
			exit(1);
		else if (C[i] <= 0 || pow(10, 4) <= C[i])
			exit(1);
	}
	int sum_ref = 100;

	for (int i = 0; i < N; i++)
	{
//		printf("%d", A[i]);
		if (A[i] >= B[i] )
		{
			if (A[i] >= C[i])
			{
				ref = 1;
			}
			else
			{
				ref = 3;
			}
		}
		else if (B[i] >= A[i])
		{
			if(B[i] >= C[i])
			{
				ref = 2;
			}
			else
			{
				ref = 3;
			}

		}
		else if (C[i] >= B[i] )
		{
			if (C[i] >= A[i])
			{
				ref = 3;
			}
			else
			{
				ref = 1;
			}
		}

		if (sum_ref == ref)
		{
			switch (ref)
			{
			case 1:
				if (B[i] > C[i])
					ref = 2;
				else
					ref = 3;
				break;
			case 2:
				if (A[i] > C[i])
					ref = 1;
				else
					ref = 3;
				break;
			case 3:
				if (A[i] > B[i])
					ref = 1;
				else
					ref = 2;
				break;
			default:
				break;
			}
		}
		switch (ref)
		{
		case 1:
			sum += A[i];
			break;
		case 2:
			sum += B[i];
			break;
		case 3:
			sum += C[i];
			break;
		default:
			break;
		}
		sum_ref = ref;
	}

	printf("%d", sum);
}

Compiler output:
main.c:3:10: fatal error: Math.h: No such file or directory
    3 | #include <Math.h>
      |          ^~~~~~~~
compilation terminated.
Language: C

#include "pch.h"
#include <stdio.h>
#include <stdlib.h>
#include <Math.h>

int main()
{
	int N = 0;
	int *A, *B, *C;
	int sum = 0;
	char ref = 0;
	int N_limit = pow(10, 5);

	if (scanf("%d", &N) <= 0) {
		exit(1);
	}
	if (N <= 0 || N_limit <= N)
		exit(1);

	A = (int *)malloc(N * sizeof(int));
	B = (int *)malloc(N * sizeof(int));
	C = (int *)malloc(N * sizeof(int));



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

		if (scanf("%d%d%d", &A[i], &B[i], &C[i]) < 3) {
			exit(1);
		}
		if (A[i] <= 0 || pow(10, 4) <= A[i])
			exit(1);
		else if (B[i] <= 0 || pow(10, 5) <= B[i])
			exit(1);
		else if (C[i] <= 0 || pow(10, 5) <= C[i])
			exit(1);
	}
	int sum_ref = 100;

	for (int i = 0; i < N; i++)
	{
		if (A[i] >= B[i])
		{
			if (A[i] >= C[i])
			{
				ref = 1;
			}
			else
			{
				ref = 3;
			}
		}
		else if (B[i] >= A[i])
		{
			if (B[i] >= C[i])
			{
				ref = 2;
			}
			else
			{
				ref = 3;
			}

		}
		else if (C[i] >= B[i])
		{
			if (C[i] >= A[i])
			{
				ref = 3;
			}
			else
			{
				ref = 1;
			}
		}

		if (sum_ref == ref)
		{
			switch (ref)
			{
			case 1:
				if (B[i] > C[i])
					ref = 2;
				else
					ref = 3;
				break;
			case 2:
				if (A[i] > C[i])
					ref = 1;
				else
					ref = 3;
				break;
			case 3:
				if (A[i] > B[i])
					ref = 1;
				else
					ref = 2;
				break;
			default:
				break;
			}
		}
		switch (ref)
		{
		case 1:
			sum += A[i];
			break;
		case 2:
			sum += B[i];
			break;
		case 3:
			sum += C[i];
			break;
		default:
			break;
		}
		sum_ref = ref;
	}

	printf("%d", sum);



	return 0;
}


Compiler output:
main.c:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <Math.h>

int main()
{
	int N = 0;
	int *A,*B,*C;
	int sum = 0;
	char ref = 0;
	int N_limit = pow(10, 5);

	if (scanf("%d", &N) <= 0) {
		exit(1);
	}
	if ( N <= 0 || N_limit <= N)
		exit(1);

	A = (int *)malloc(N * sizeof(int));
	B = (int *)malloc(N * sizeof(int));
	C = (int *)malloc(N * sizeof(int));



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

		if (scanf("%d%d%d", &A[i], &B[i], &C[i]) < 3) {
			exit(1);
		}
		if (A[i] <= 0 || pow(10, 4) <= A[i])
			exit(1);
		else if (B[i] <= 0 || pow(10, 5) <= B[i])
			exit(1);
		else if (C[i] <= 0 || pow(10, 5) <= C[i])
			exit(1);
	}
	int sum_ref = 100;

	for (int i = 0; i < N; i++)
	{
		if (A[i] >= B[i] )
		{
			if (A[i] >= C[i])
			{
				ref = 1;
			}
			else
			{
				ref = 3;
			}
		}
		else if (B[i] >= A[i])
		{
			if(B[i] >= C[i])
			{
				ref = 2;
			}
			else
			{
				ref = 3;
			}

		}
		else if (C[i] >= B[i] )
		{
			if (C[i] >= A[i])
			{
				ref = 3;
			}
			else
			{
				ref = 1;
			}
		}

		if (sum_ref == ref)
		{
			switch (ref)
			{
			case 1:
				if (B[i] > C[i])
					ref = 2;
				else
					ref = 3;
				break;
			case 2:
				if (A[i] > C[i])
					ref = 1;
				else
					ref = 3;
				break;
			case 3:
				if (A[i] > B[i])
					ref = 1;
				else
					ref = 2;
				break;
			default:
				break;
			}
		}
		switch (ref)
		{
		case 1:
			sum += A[i];
			break;
		case 2:
			sum += B[i];
			break;
		case 3:
			sum += C[i];
			break;
		default:
			break;
		}
		sum_ref = ref;
	}

	printf("%d", sum);



	return 0;
}


Compiler output:
main.c:3:10: fatal error: Math.h: No such file or directory
    3 | #include <Math.h>
      |          ^~~~~~~~
compilation terminated.
Language: C++

#include<stdio.h>
#include<math.h>
#include<stdlib.h>


int main()
{
	int a = 0;
	int	b = 0;
	int	c = 0;
	int N = 0; 
	int sum = 0;
	int Nlimit = pow(10,5);
	int abcLimit = pow(10,4);
	int mostNumber;
	int aFlag = 0;
	int bFlag = 0;
	int cFlag = 0;

	while (true)
	{
      if(scanf("%d", &N) < 1)
      {
        exit(1);
      }
      
		if(1 <= N && N <=N
           {
    
           }
           limit)
		{
			break;
		}
		else
		{
		}
	}

	for (int i = 0; i < N; i++)
	{
		 mostNumber = 0;
		 while (true)
		 {
           if( scanf("%d%d%d", &a, &b, &c) <= 3)
           {
				exit(1);
           }
			 if (1 <= a && 1 <= b && 1 <= c)
			 {
				 if (a <= abcLimit && b <= abcLimit && c <= abcLimit)
				 {
					 break;
				 }
			 }
		 }	
			
		 if (aFlag == 0)
		 {
			 mostNumber = a;
			 aFlag = 1;
		 }
		 else
		 {
			 aFlag = 0;
		 }

		if (mostNumber < b && bFlag == 0)
		{
			mostNumber = b;
			aFlag = 0;
			bFlag = 1;
		}
		else
		{
			bFlag = 0;
		}

		if (mostNumber < c && cFlag == 0)
		{
			mostNumber = c;
			aFlag = 0;
			bFlag = 0;
			cFlag = 1;
		}
		else
		{
			cFlag = 0;
		}

		sum += mostNumber;

	}

	printf("総和は%dです", sum);

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:35: error: expected ')' before '{' token
   27 |                 if(1 <= N && N <=N
      |                   ~               ^
      |                                   )
   28 |            {
      |            ~
Language: C

#include<stdio.h>
#include<math.h>


int main()
{
	int a = 0;
	int	b = 0;
	int	c = 0;
	int N = 0; 
	int sum = 0;
	int Nlimit = pow(10,5);
	int abcLimit = pow(10,4);
	int mostNumber;
	bool aFlag = false;
	bool bFlag = false;
	bool cFlag = false;

	while (true)
	{
		scanf("%d", &N);
		if (1 <= N && N <= Nlimit)
		{
			break;
		}
		else
		{
		}
	}

	for (int i = 0; i < N; i++)
	{
		 mostNumber = 0;
		 while (true)
		 {
			 scanf("%d%d%d", &a, &b, &c);
			 if (1 <= a && 1 <= b && 1 <= c)
			 {
				 if (a <= abcLimit && b <= abcLimit && c <= abcLimit)
				 {
					 break;
				 }
			 }
		 }	
			
		 if (aFlag == false)
		 {
			 mostNumber = a;
			 aFlag = true;
		 }
		 else
		 {
			 aFlag = false;
		 }

		if (mostNumber < b && bFlag == false)
		{
			mostNumber = b;
			aFlag = false;
			bFlag = true;
		}
		else
		{
			bFlag = false;
		}

		if (mostNumber < c && cFlag == false)
		{
			mostNumber = c;
			aFlag = false;
			bFlag = false;
			cFlag = true;
		}
		else
		{
			cFlag = false;
		}

		sum += mostNumber;

	}

	printf("総和は%dです", sum);

	return 0;

}

Compiler output:
main.c: In function 'main':
main.c:15:9: error: unknown type name 'bool'
   15 |         bool aFlag = false;
      |         ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    2 | #include<math.h>
  +++ |+#include <stdbool.h>
    3 | 
main.c:15:22: error: 'false' undeclared (first use in this function)
   15 |         bool aFlag = false;
      |                      ^~~~~
main.c:15:22: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:15:22: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:9: error: unknown type name 'bool'
   16 |         bool bFlag = false;
      |         ^~~~
main.c:16:9: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:17:9: error: unknown type name 'bool'
   17 |         bool cFlag = false;
      |         ^~~~
main.c:17:9: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:19:16: error: 'true' undeclared (first use in this function)
   19 |         while (true)
      |                ^~~~
main.c:19:16: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define pri 1000000000
using namespace std;
 
int main() {
	ll n;
	cin>>n;
	ll a[n][3],dp[n][3];
	for(ll i=0;i<n;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
		dp[i][0]=0;
		dp[i][1]=0;
		dp[i][2]=0;
	}
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(ll i=0;i<n-1;i++){
		for(ll j=0;j<3;j++){
			for(ll k=0;k<3;k++){
				 if(j==k)continue;
					dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i+1][k]);
				
			}
		}
		
	}
	ll maxi=-10000000000000;
	for(ll i=0;i<3;i++)maxi=max(maxi,dp[n-1][i]);
	cout<<maxi;
	return 0;
}#include <bits/stdc++.h>
#define ll long long
#define pri 1000000000
using namespace std;
 
int main() {
	ll n;
	cin>>n;
	ll a[n][3],dp[n][3];
	for(ll i=0;i<n;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
		dp[i][0]=0;
		dp[i][1]=0;
		dp[i][2]=0;
	}
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(ll i=0;i<n-1;i++){
		for(ll j=0;j<3;j++){
			for(ll k=0;k<3;k++){
				 if(j==k)continue;
					dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i+1][k]);
				
			}
		}
		
	}
	ll maxi=0;
	for(ll i=0;i<3;i++)maxi=max(maxi,dp[n-1][i]);
	cout<<maxi;
	return 0;
}

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

#include <bits/stdc++.h>
#define ll long long
#define pri 1000000000
using namespace std;
	ll a[n][3],dp[n][3];
int main() {
	ll n;
	cin>>n;
 
	for(ll i=0;i<n;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
		dp[i][0]=0;
		dp[i][1]=0;
		dp[i][2]=0;
	}
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(ll i=0;i<n-1;i++){
		for(ll j=0;j<3;j++){
			for(ll k=0;k<3;k++){
				 if(j!=k){
					dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i+1][k]);
                 }
			}
		}
		
	}
	ll maxi=-1000000000000;
	for(ll i=0;i<3;i++)maxi=max(maxi,dp[n-1][i]);
	cout<<maxi;
	return 0;
}

Compiler output:
a.cc:5:14: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |         ll a[n][3],dp[n][3];
      |              ^
      |              yn
a.cc:5:23: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |         ll a[n][3],dp[n][3];
      |                       ^
      |                       yn
a.cc: In function 'int main()':
a.cc:11:22: error: 'a' was not declared in this scope
   11 |                 cin>>a[i][0]>>a[i][1]>>a[i][2];
      |                      ^
a.cc:12:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   12 |                 dp[i][0]=0;
      |                 ^~
      |                 dup
a.cc:16:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   16 |         dp[0][0]=a[0][0];
      |         ^~
      |         dup
a.cc:16:18: error: 'a' was not declared in this scope
   16 |         dp[0][0]=a[0][0];
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define pri 1000000000
using namespace std;
	ll a[n][3],dp[n][3];
int main() {
	ll n;
	cin>>n;

	for(ll i=0;i<n;i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
		dp[i][0]=0;
		dp[i][1]=0;
		dp[i][2]=0;
	}
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(ll i=0;i<n-1;i++){
		for(ll j=0;j<3;j++){
			for(ll k=0;k<3;k++){
				 if(j==k)continue;
					dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i+1][k]);
				
			}
		}
		
	}
	ll maxi=-10000000000000;
	for(ll i=0;i<3;i++)maxi=max(maxi,dp[n-1][i]);
	cout<<maxi;
	return 0;
}

Compiler output:
a.cc:5:14: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |         ll a[n][3],dp[n][3];
      |              ^
      |              yn
a.cc:5:23: error: 'n' was not declared in this scope; did you mean 'yn'?
    5 |         ll a[n][3],dp[n][3];
      |                       ^
      |                       yn
a.cc: In function 'int main()':
a.cc:11:22: error: 'a' was not declared in this scope
   11 |                 cin>>a[i][0]>>a[i][1]>>a[i][2];
      |                      ^
a.cc:12:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   12 |                 dp[i][0]=0;
      |                 ^~
      |                 dup
a.cc:16:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   16 |         dp[0][0]=a[0][0];
      |         ^~
      |         dup
a.cc:16:18: error: 'a' was not declared in this scope
   16 |         dp[0][0]=a[0][0];
      |                  ^
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[i]>>b[i]>>c[i];
  vector<vector<int>> answer(3,vector<int>(n));
  answer[0][0]=a[0];
  answer[0][1]=b[0];
  answer[0][2]=c[0];
  for(int i=1;i<n;i++)
    {
  answer[i][0]=a[i]+max(answer[i-1][1],answer[i-1][2]);
  answer[i][1]=b[i]+max(answer[i-1][0],answer[i-1][2]);
  answer[i][2]=c[i]+max(answer[i-1][1],answer[i-1][0]);
  }
      cout<<max(answer[n-1][0],answer[n-1][1],answer[n-1][2]);
  return 0;
  }

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

import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] hap= new int[N][3];
        for(int i=0;i<N;i++){
            hap[i][0] = sc.nextInt();
            hap[i][1] = sc.nextInt();
            hap[i][2] = sc.nextInt();
        }
        System.out.println(vacation(N,hap));
    }

    static int vacation(int N, int[][] happineses){

        int[][] dp = new int[2][N+1];
        dp[0][0] =0;
        dp[1][0] =-1;

        for(int i=1 ; i<=N ; i++){
            int max = 0;
            int maxIdx = -1;

            for(int k=0;k<3;k++) {
                for (int j = 0; j < 3; j++) {
                    if (j == k ) continue;
                    int happiness;
                    if(i - 2 >=0 ){
                        if(k==dp[1][i-2]) continue;
                        happiness = happineses[i - 1][j] + happineses[i - 2][k];
                    }else{
                        happiness = happineses[i - 1][j];
                    }
                    if (max < happiness) {
                        max = happiness;
                        maxIdx = j;
                    }
                }
            }
            if(i - 2 >=0){
                dp[0][i]=dp[0][i-2] + max;
                dp[1][i]=maxIdx;
            }else{
                dp[0][i]=max;
                dp[1][i]=maxIdx;
            }

        }

        System.out.println(Arrays.toString(dp[1]));

        return dp[0][N];
    }
}

Compiler output:
Main.java:52: error: cannot find symbol
        System.out.println(Arrays.toString(dp[1]));
                           ^
  symbol:   variable Arrays
  location: class Main
1 error
Language: C++

n=int(input())
f=[0]*3
for i in range(n):
	g=list(map(int,input().split()))
	h=[0]*3
	for j in range(3):
		for k in range(3):
			if j!=k:
				h[j]=max(h[j],f[k]+g[j])
	f=h
print(max(f))

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

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
 int x[100000][3],arr[100000][3],q,n,p,r;
 cin>>n; 
 for(int i=0;i<n;i++)
 {
  cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
 }
 p=max(arr[0][1],arr[0][2]);x[0][0]=p;
 q=max(arr[0][0],arr[0][2]);x[0][1]=q;
 r=max(arr[0][1],arr[0][0]);x[0][2]=r; 
 for(int i=1;i<n;i++)
 { 
  p=max(x[i-1][1]+arr[i][1],x[i-1][2]+arr[i][2]);p=x[i][0];
  q=max(x[i-1][2]+arr[i][2],x[i-1][0]+arr[i][0]);q=x[i][1];
  r=max(x[i-1][0]+arr[i][0],x[i-1][1]+arr[i][1]);r=x[i][2];
 }
 q=max(x[n-1][0],x[n-1][1],x[n-1][2]);
 cout<<q;
 return 0;
}

Compiler output:
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:21:7:   required from here
   21 |  q=max(x[n-1][0],x[n-1][1],x[n-1][2]);
      |    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

/* Murad Eynizade */

#include <bits/stdc++.h>
#define intt long long
#define FAST_READ ios_base::sync_with_stdio(0);cin.tie(0);
#define SIZE 300001
#define INF INT_MAX
#define F first
#define S second
#define in(a) scanf("%d",&a);
#define outn(a) printf("%d\n",&a);
#define outs(a) printf("%d ",&a);


using namespace std;

int n , a[SIZE] , b[SIZE] , c[SIZE] , dp[SIZE][3];

int main()
{
    FAST_READ;
    cin>>n;
    for (int i = 1;i<=n;i++) cin>>a[i]>>b[i]>>c[i];
    for (int i = 1;i<=n;i++) {
        dp[i][0] = max(dp[i][1] , dp[i][2]) + a[i];
        dp[i][1] = max(dp[i][0] , dp[i][2]) + b[i];
        dp[i][2] = max(dp[i][1] , dp[i][0]) + c[i];
    }
    cout<<max(dp[i][0] , max(dp[i][1] , dp[i][2]))<<endl;
    return 0;
}


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

//ios::sync_with_stdio(false);
//yang@(^_^)
#include <windows.h>
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long mx=100*1000+7;
	long long dp[mx][3];
	int c[mx][3];
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<3;j++)
			cin>>c[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)
				{
					dp[i+1][k]=max(dp[i+1][k],dp[i][j]+c[i+1][k]);
				}
			}
		}
	}
	long long ans=0;
	for(int i=0;i<3;i++)
	{
		ans=max(ans,dp[n][i]);
	}		
	cout<<ans;
	return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

int n;
int a[100000],b[100000],c[100000];
long long x[100001],y[100001],z[100001];


int main(){
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i] >> b[i] >> c[i];
	}
	x[1]=a[1];
	y[1]=b[1];
	z[1]=c[1];
	for (int i = 2; i <= n; i++)
	{
		x[i] = a[i] + max(y[i-1],z[i-1]);
		y[i] = b[i] + max(x[i-1],z[i-1]);
		z[i] = c[i] + max(x[i-1],y[i-1]);
	}
	cout  << max(max(x[n],y[n]),z[n]);
	return 0;
}
#include <bits/stdc++.h>

using namespace std;

int n;
int a[100005],b[100005],c[100005];
long long x[100005],y[100005],z[100005];


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


Compiler output:
a.cc:32:5: error: redefinition of 'int n'
   32 | int n;
      |     ^
a.cc:5:5: note: 'int n' previously declared here
    5 | int n;
      |     ^
a.cc:33:5: error: conflicting declaration 'int a [100005]'
   33 | int a[100005],b[100005],c[100005];
      |     ^
a.cc:6:5: note: previous declaration as 'int a [100000]'
    6 | int a[100000],b[100000],c[100000];
      |     ^
a.cc:33:15: error: conflicting declaration 'int b [100005]'
   33 | int a[100005],b[100005],c[100005];
      |               ^
a.cc:6:15: note: previous declaration as 'int b [100000]'
    6 | int a[100000],b[100000],c[100000];
      |               ^
a.cc:33:25: error: conflicting declaration 'int c [100005]'
   33 | int a[100005],b[100005],c[100005];
      |                         ^
a.cc:6:25: note: previous declaration as 'int c [100000]'
    6 | int a[100000],b[100000],c[100000];
      |                         ^
a.cc:34:11: error: conflicting declaration 'long long int x [100005]'
   34 | long long x[100005],y[100005],z[100005];
      |           ^
a.cc:7:11: note: previous declaration as 'long long int x [100001]'
    7 | long long x[100001],y[100001],z[100001];
      |           ^
a.cc:34:21: error: conflicting declaration 'long long int y [100005]'
   34 | long long x[100005],y[100005],z[100005];
      |                     ^
a.cc:7:21: note: previous declaration as 'long long int y [100001]'
    7 | long long x[100001],y[100001],z[100001];
      |                     ^
a.cc:34:31: error: conflicting declaration 'long long int z [100005]'
   34 | long long x[100005],y[100005],z[100005];
      |                               ^
a.cc:7:31: note: previous declaration as 'long long int z [100001]'
    7 | long long x[100001],y[100001],z[100001];
      |                               ^
a.cc:37:5: error: redefinition of 'int main()'
   37 | int main(){
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main(){
      |     ^~~~
a.cc:55:1: error: 'Submission' does not name a type
   55 | Submission Info
      | ^~~~~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: 'a' was not declared in this scope
   13 |                 cin>>a>>b>>c;
      |                      ^
a.cc:13:25: error: 'b' was not declared in this scope
   13 |                 cin>>a>>b>>c;
      |                         ^
a.cc:13:28: error: 'c' was not declared in this scope
   13 |                 cin>>a>>b>>c;
      |                            ^
Language: C++

#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <ctime>
#include <set>
#include <algorithm>
#include <cstring>
#include <queue>
#include <stack>
#include <sstream>
#include <cstdio>
#include <bitset>
#include <iomanip>

using namespace std;

int dp[123456][3];
int a[123456];
int b[123456];
int c[123456];

int main()
{
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    for (int i = 0; i < n; ++i)
        cin >> a[i] >> b[i] >> c[i];

    for (int i = 0; i <= n; ++i)
        for (int j = 0; j < 3; ++j)
            dp[i][j] = INT_MIN;

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

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

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

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

#include<bits/stdc++.h>
#define ll long long int
using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  int n,m=3;
  cin>>n;
  vector<vector<int>>arr(n,vector<int>(m));
  for(int i=0;i<n;i++)
  for(int j=0;j<m;j++)
  cin>>arr[i][j];
  ll dp[n][n];
  for(int i=0;i<3;i++)
  dp[0][i] = arr[0][i];
  for(int i=1;i<n;i++){
    dp[i][0] = max(dp[i-1][1]+arr[i][0],dp[i-1][2]+arr[i][0]);
    dp[i][1] = max(dp[i-1][0]+arr[i][1],dp[i-1][2]+arr[i][1]);
    dp[i][2] = max(dp[i-1][1]+arr[i][2],dp[i-1][0]+arr[i][2]);
  }
  int temp = INT_MIN;
  for(int i=0;i<3;i++)
  temp = max(dp[n-1][i],temp);
  cout<<temp<<endl;
}


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

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

int main(){
    int n;
    cin >> n;

    int matrice[n][3];
    int dp[n][3];

    for(int i = 0; i < n; i++)
        for(int j = 0; j < 3; j++)
           cin >> matrice[i][j];
           2

    for(int i = 0; i < 3; i++)
        dp[0][i] = matrice[0][i];

    for(int i = 1; i < n; i++)
        for(int j = 0; j < 3; j++){
            if(j == 0)
                dp[i][j] = max(dp[i-1][1], dp[i-1][2]) + matrice[i][j];
            if(j == 1)
                dp[i][j] = max(dp[i-1][0], dp[i-1][2]) + matrice[i][j];
            if(j == 2)
                dp[i][j] = max(dp[i-1][0], dp[i-1][1]) + matrice[i][j];
            }
    cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: expected ';' before 'for'
   15 |            2
      |             ^
      |             ;
   16 | 
   17 |     for(int i = 0; i < 3; i++)
      |     ~~~      
a.cc:17:20: error: 'i' was not declared in this scope
   17 |     for(int i = 0; i < 3; i++)
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[100001][100001],f[100001][100001]={0};
int main()
{
	int i,k,j,m,n;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=3;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=3;j++)
		{
			for(k=1;k<=3;k++)
			{
				if(k!=j)
					f[i][j]=max(f[i][j],f[i-1][k]+a[i][j]);
			}
		}
	}
	printf("%d",max(max(f[i][1],f[i][2]),f[i][3]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:54: error: expected ')' before ';' token
   26 |         printf("%d",max(max(f[i][1],f[i][2]),f[i][3]);
      |               ~                                      ^
      |                                                      )
Language: C++

#include<bits/stdc++.h>
using namespace std;
int a[100001],f[100001]={0};
int main()
{
	int i,k=1,j,m,n;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=3;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=3;j++)
		{
			for(;k<=3;k++)
			{
				if(k!=j)
					f[i][j]=max(f[i][j],f[i-1][k]+a[i][j]);
			}
		}
	}
	printf("%d",f[i][j]);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:41: error: invalid types 'int[int]' for array subscript
   12 |                         scanf("%d",&a[i][j]);
      |                                         ^
a.cc:22:45: error: invalid types 'int[int]' for array subscript
   22 |                                         f[i][j]=max(f[i][j],f[i-1][k]+a[i][j]);
      |                                             ^
a.cc:22:57: error: invalid types 'int[int]' for array subscript
   22 |                                         f[i][j]=max(f[i][j],f[i-1][k]+a[i][j]);
      |                                                         ^
a.cc:22:67: error: invalid types 'int[int]' for array subscript
   22 |                                         f[i][j]=max(f[i][j],f[i-1][k]+a[i][j]);
      |                                                                   ^
a.cc:22:75: error: invalid types 'int[int]' for array subscript
   22 |                                         f[i][j]=max(f[i][j],f[i-1][k]+a[i][j]);
      |                                                                           ^
a.cc:26:25: error: invalid types 'int[int]' for array subscript
   26 |         printf("%d",f[i][j]);
      |                         ^
Language: Java

import java.util.Scanner;
public class Main {
  static int N;
  static int[][] A;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    N = sc.nextInt();
    A = new int[N][3];
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 3; j++) {
        A[i][j] = sc.nextInt();
      }
    }
    System.out.println(f(0,-1));
  }
  static int f(int index, int prev) {
    if (index == N) return 0;
  	int max = 0;
    for (int i = 0; i < 3; i++) {
      if (i != prev) {
      	max = Math.max(max,A[index][i] + f(index + 1, i));
      }
    }
  }
}

Compiler output:
Main.java:24: error: missing return statement
  }
  ^
1 error
Language: C++

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.cpp
 * Author: Allen
 *
 * Created on January 12, 2019, 5:08 PM
 */

#include <cstdlib>
#include <iostream>
#include <stdio.h>
using namespace std;

/*
 * 
 */
int main(int argc, char** argv) {
    int n;
    cin>>n;
    int a,b,c;
    int dp[n+1][3];
    dp[0][0]=0;
    dp[0][1]=0;
    dp[0][2]=0;
    for(int i=1;i<=n;i++){
        cin>>a>>b>>c;
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a;
        dp[i][1]=max(dp[i-1][0],dp[i-1][2])+b;
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c;
    }
    printf("%d",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:36:53: error: expected ')' before ';' token
   36 |     printf("%d",max(dp[n][0],max(dp[n][1],dp[n][2]));
      |           ~                                         ^
      |                                                     )