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

#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
int main () { 
 
  int N , K ;
  cin >> N >> K ;
  ll a[N] ;
  for(int i =0 ; i < N ;i++)
    cin >> a[i] ;
  ll dp[N] ;
  dp[0] =0 ;
  for(int i =0 ; i < N ;i++)
  {
    dp[i] = 1e10 ;
    for(int j = i - 1;j>=max(0,i-K);j--)
      dp[i] = min(dp[i] , abs(a[i]-a[j]) + dp[j]) ;
  }
  cout<<dp[N-1]<<endl;
  return 0 ;
}
   
  
  return 0 ;
}

Compiler output:
a.cc:24:3: error: expected unqualified-id before 'return'
   24 |   return 0 ;
      |   ^~~~~~
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
int main () { 
 
  int N , K ;
  cin >> N >> K ;
  ll a[N] ;
  for(int i =0 ; i < N ;i++)
    cin >> a[i] ;
  ll dp[N] ;
  dp[0] =0 ;
  for(int i =0 ; i < N ;i++)
  {
    dp[i] = 1e10 ;
    for(int j = i - 1;j>=max(0,i-K);j++)
      dp[i] = min(dp[i] , abs(a[i]-a[j]) + dp[j]) ;
  }
  cout<<dp[N-1]<<endl;
  return 0 ;
}
   
  
  return 0 ;
}

Compiler output:
a.cc:24:3: error: expected unqualified-id before 'return'
   24 |   return 0 ;
      |   ^~~~~~
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

int n,m;
int h[100005];
int dp[100005];

int main(void)
{
	cin >> n>>m;
	for(int i = 1; i <= n; i++) cin >> h[i];

	for(int i = 1; i <= n; i++) dp[i] = 1e9+5;
	dp[1] = 0;
	for(int i = 1; i < n; i++){
		dp[i+1] = min(dp[i+1], dp[i] + abs(h[i]-h[i+1]));
		for(int j=2;j<=m;j++){ 
		if(i+j <= n) dp[i+j] = min(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
		}
	}
	cout << dp[n] << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> n>>m;
      |         ^~~
a.cc:13:48: error: 'abs' was not declared in this scope
   13 |                 dp[i+1] = min(dp[i+1], dp[i] + abs(h[i]-h[i+1]));
      |                                                ^~~
a.cc:13:27: error: 'min' was not declared in this scope; did you mean 'main'?
   13 |                 dp[i+1] = min(dp[i+1], dp[i] + abs(h[i]-h[i+1]));
      |                           ^~~
      |                           main
a.cc:18:9: error: 'cout' was not declared in this scope
   18 |         cout << dp[n] << endl;
      |         ^~~~
a.cc:18:26: error: 'endl' was not declared in this scope
   18 |         cout << dp[n] << endl;
      |                          ^~~~
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
  int n,i;
  scanf("%d",&n);
  vector<int>a(n);
  vector<int>dp(n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  auto isValid = [&](int i){
    if(i<n)
      return true;
    return false;
  };
  dp[n-1] = 0;
  for(i=n-2;i>=0;i--){
    dp[i] = dp[i+1] + abs(a[i+1] - a[i]);
    for(j=i+2;j<=i+k;j++){
      if(isValid(j)){
        dp[i] = min(dp[i],dp[j] + abs(a[j] - a[i]));
      }
    }
  }
  printf("%d\n",dp[0]);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'j' was not declared in this scope
   21 |     for(j=i+2;j<=i+k;j++){
      |         ^
a.cc:21:20: error: 'k' was not declared in this scope
   21 |     for(j=i+2;j<=i+k;j++){
      |                    ^
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

int H[101010];
int dp[101010];

int main() {
  int N, K;
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    cin >> H[i];
  }
  dp[0] = 0;
  dp[1] = abs(H[1] - H[0]);
  int mi = -1, tmp = 0;
  for (int i = 2; i < N; ++i) {
    for (int j = 1; j < K; ++j) {
      tmp = abs{H[i + j] - H[i]);
      if (mi == -1 || mi > tmp) mi = tmp;
    }
    dp[i] = mi;
  }
  cout << dp[N - 1] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: cannot resolve overloaded function 'abs' based on conversion to type 'int'
   20 |       tmp = abs{H[i + j] - H[i]);
      |             ^~~
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,q) for(int i = 0; q > i; i++)
#define repp(i,o,q) for(int i = o; q > i; i++)
#define reppp(i,o,q) for(int i = o; q >= i; i++)
int main(){
  int N,K;cin >> N >> K;
  int a[N];rep(i,N)cin>>a[i];
  int dp[N+1];
  dp[0] = 0;
  dp[1] = abs(a[1] - a[0]);
  repp(i,2,N){
    dp[i] = 2000000000
    reppp(j,1,K){
      if(i-j < 0)break;
      dp[i] = min( dp[i-j] + abs(a[i-j] - a[i]),dp[i]);
    }
  }
  cout << dp[N-1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:23: error: expected ';' before 'for'
   13 |     dp[i] = 2000000000
      |                       ^
      |                       ;
a.cc:14:11: error: 'j' was not declared in this scope
   14 |     reppp(j,1,K){
      |           ^
a.cc:5:42: note: in definition of macro 'reppp'
    5 | #define reppp(i,o,q) for(int i = o; q >= i; i++)
      |                                          ^
Language: C++

n, k = map(int, raw_input().split())
arr = map(int, raw_input().split())
dp =[20000000000]* n
dp[0] = 0
dp[1] = abs(arr[1]-arr[0])

for i in xrange(2, n):
    dp[i] = dp[i-1] + abs(arr[i-1] - arr[i])
    for j in xrange(2, k+1):
        if i - j >= 0:
            dp[i] = min(dp[i], dp[i-j] + abs(arr[i]-arr[i-j]))

print dp[-1]


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n, k = map(int, raw_input().split())
      | ^
Language: C

#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> v(n,0);
    for(int i=0;i<n;i++)
	cin>>v[i];


    //There're something wrong
    //0--n-1
    //0--k
    if(k>n-1) k=n-1;
    int temp;
    vector<int> f(n,0);
    for(int i=1;i<=k;i++){
	int MIN=(2<<30)-1;
	for(int j=0;j<i;j++){
	    temp=v[i]-v[j];
	    if(temp<0) temp=-temp;
	    MIN=MIN<temp+f[j]? MIN: temp+f[j];
	}
	f[i]=MIN;
     // cout<<f[i]<<" ";
    }
    //f[0]--f[k] has been cacluate
    for(int i=k+1;i<n;i++){
	int MIN=(2<<30)-1;
	for(int j=i-k;j<i;j++){
	    temp=v[i]-v[j];
	    if(temp<0) temp=-temp;
	    MIN=MIN<temp+f[j]? MIN: temp+f[j];
	}
	f[i]=MIN;
    //cout<<f[i]<<" ";
    }
    cout<<f[n-1]<<endl;
    return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 1e5 + 5;
int n, h[N], k, dp[N];
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	fw (i, 0, n) cin >> h[i];
	memset(dp, 63, sizeof dp);
	dp[0] = 0;
	fw (i, 0, n) {
		fw (j, 1, k + 1) if (i + j < n) {
			dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + \j] - h[i]));
		}
//		cout << "dp[" << i <<"] = " << dp[i] << "\n";
	}
	cout << dp[n - 1];
	return 0;
}

Compiler output:
a.cc:28:70: error: stray '\' in program
   28 |                         dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + \j] - h[i]));
      |                                                                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define MAX 100007
#define MOD 1000000007

long long frog(long long arr[], int n, int k){
  long long output[n+1];
  for(int i=0;i<n;i++)
    output[i] = INT_MAX;
  output[0] = 0;
  for(int i = 1;i<min(k,n);i++){
   	for(int aj = i-1;j>=0;j--){
      if(output[j] + abs(arr[i]-arr[j]) <output[i])
        output[i] = output[j]+ abs(arr[i]-arr[j]);
    }
  }
  for(int i=k;i<n;i++){
    for(int j=i-1;j>=i-k;j--){
      if(output[j] + abs(arr[i]-arr[j]) < output[i])
        output[i] = output[j] + abs(arr[i]-arr[j]);
    }
  }
  return output[n-1];
}

int main(){
  int n;
  cin>>n;
  int k;
  cin>>k;
  long long arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  
  cout<<frog(arr, n, k);
  
  return 0;
}

Compiler output:
a.cc: In function 'long long int frog(long long int*, int, int)':
a.cc:12:26: error: 'j' was not declared in this scope; did you mean 'aj'?
   12 |         for(int aj = i-1;j>=0;j--){
      |                          ^
      |                          aj
Language: C++

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

int arr[100005];
int dp[100005];

int solve(int n, int k){
  dp[n] = 0; dp[n+1] = MXX;
  for(int i = (n-1); i>=1; --i){
    int curcost = MXX;
    for(int j = 1; j<=k; ++j){
    	int chk = i+j;
      	if(chk<=n){
           curcost = min(curcost, dp[chk]+abs(arr[i]-arr[chk]));
        }
      	else{
        	break;
        }
    }
    dp[i] = curcost;
  }
  return dp[1];
}

int main(){
  int n;
  scanf("%d %d",&n,&k);
  for(int i = 1; i<=n; ++i){
    scanf("%d",&arr[i]);
  }
  printf("%d\n",solve(n,k));
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:21: error: 'k' was not declared in this scope
   28 |   scanf("%d %d",&n,&k);
      |                     ^
Language: C++

#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
using namespace std;
int x[100010],y[100010];
signed main(){
	int a,b;
	cin>>a>>b>>y[0];
	x[0]=0;
	f(i,a-1){
		cin>>y[i];
		x[i+1]=mod;
		for(int j=0;j<i&&j<k;j++){
			x[i+1]=min(x[i+1],y[i]-y[i-j-1]+x[i-j]);
		}
	}
	cout<<x[a-1]<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:36: error: 'k' was not declared in this scope
   16 |                 for(int j=0;j<i&&j<k;j++){
      |                                    ^
Language: C++

#include <bits/stdc++.h>

#define ll long long
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll mod=1000000007;

using namespace std;

ll n,k,a[100100];
ll d[100100];
int main(){
    ios;
	cin>>n>>k;
	for (ll i=1;i<=n;i++){
		cin>>a[i];
	}
	d[1]=0;
	d[2]=abs(a[2]-a[1]);

	for (ll i=3;i<=n;i++){
        d[i]=d[i-1]+abs(a[i-1]-a[i]);
        for (ll j=i;j>=max(i-k,0);j--){
            d[i]=min(d[j]+abs(a[j]-a[i]),d[i]);
        }
	}
	cout<<d[n];
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:27: error: no matching function for call to 'max(long long int, int)'
   22 |         for (ll j=i;j>=max(i-k,0);j--){
      |                        ~~~^~~~~~~
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:22:27: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   22 |         for (ll j=i;j>=max(i-k,0);j--){
      |                        ~~~^~~~~~~
/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:22:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |         for (ll j=i;j>=max(i-k,0);j--){
      |                        ~~~^~~~~~~
Language: C

#include<stdio.h>
int dp[100005];
int arr[100005];
int absv(int a,int b)
{
  if(a>b)
    return a-b;
  return b-a;
}
int dps(int i,int n)
{
  if(dp[i]!=-1)
    return dp[i];
  if(i==n)
    return 0;
  if(i==n-1)
  {
    dp[i] = absv(arr[i],arr[i+1]);
    return dp[i];
  }
  int temp1 = 1000000;
  int temp;
  for(int j=0;j<k;j++)
  {
    temp = dps(i+j+1,n) + absv(arr[i],arr[i+j+1]);
    if(temp1>temp)
      temp1 = temp;
  }
  dp[i]=temp1;
  return dp[i];
}
int main()
{
  int n,i;
  scanf("%d",&n);
  scanf("%d",&k);
  for(i=0;i<n;i++){
    dp[i]=-1;
    scanf("%d",&arr[i]);
  }
  printf("%d\n",dps(0,n-1));
  return 0;
}


Compiler output:
main.c: In function 'dps':
main.c:23:17: error: 'k' undeclared (first use in this function)
   23 |   for(int j=0;j<k;j++)
      |                 ^
main.c:23:17: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:36:15: error: 'k' undeclared (first use in this function)
   36 |   scanf("%d",&k);
      |               ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll=long long;  
using pLL = std::pair<ll, ll>;

#define SORT(v) std::sort(v.begin(), v.end())
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,K;
    cin >> N>>K;
    vector<int> a(N+1);
    a[0]=0;
    for(int i=1;i<=N;++i){
        cin >> a[i];
    }
    vector<int> dp(N+1);
    dp[0]=0;
    dp[1]=0;
    for(int i=2;i<=N;++i){
        if(i==2){
            dp[i]=abs(a[i]-a[i-1]);    
        }else{
            int temp=INF;
            
            for(int j=1;j<=K;++j){
                if(i-j>0){
                    temp=min(abs(a[i]-a[i-j])+dp[i-j],temp);
                }else{
                    temp=0
                }
            }
            dp[i]=temp;
        }
        
    }
    cout << dp[N] <<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:27: error: expected ';' before '}' token
   54 |                     temp=0
      |                           ^
      |                           ;
   55 |                 }
      |                 ~
Language: C++

#include <bits/stdc++.h>

using namespace std;


long long n, dp[100002], v[100002], k;

int main()
{
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  dp[1] = 0;
  for (int i = 2; i <= n; i++)
    dp[i] = (1 << 60);
  for (int i = 2; i <= n; i++) {
    for (int j = i - 1; j >= max(i - k, 0); j--)
      dp[i] = min(dp[i], dp[j] + abs(v[i] - v[j]));
  }
  cout << dp[n];
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:16: warning: left shift count >= width of type [-Wshift-count-overflow]
   16 |     dp[i] = (1 << 60);
      |              ~~^~~~~
a.cc:18:33: error: no matching function for call to 'max(long long int, int)'
   18 |     for (int j = i - 1; j >= max(i - k, 0); j--)
      |                              ~~~^~~~~~~~~~
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:18:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   18 |     for (int j = i - 1; j >= max(i - k, 0); j--)
      |                              ~~~^~~~~~~~~~
/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:18:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   18 |     for (int j = i - 1; j >= max(i - k, 0); j--)
      |                              ~~~^~~~~~~~~~
Language: C++

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

int a[100000], dp[200001];
signed main() {
	int n, k; cin >> n >> k;
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= k; j++) {
			dp[i + j] = min(dp[i + j], dp[i] + abs(a[i + j] - a[i]));
		}
	}
	cout << dp[n - 1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'memset' was not declared in this scope
    9 |         memset(dp, 0x3f, sizeof(dp));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | //#include<bits/stdc++.h>
Language: C++

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

int a[100000], dp[100001];
signed main() {
	int n; cin >> n;
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < n; i++) {
		dp[i + 1] = min(dp[i + 1], dp[i] + abs(a[i + 1] - a[i]));
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(a[i + 2] - a[i]));
	}
	cout << dp[n - 1] << endl;
}


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

#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int dp[100001][3];

int main(){
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif

    fast_io();
    
    int n, k;
    cin>>n>>k;

    vector<vector<int > > a;

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

        a.push_back({a, b, c});
    }

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

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

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

    return 0;

}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: request for member 'push_back' in 'a', which is of non-class type 'int'
   28 |         a.push_back({a, b, c});
      |           ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<vector<int>> inp(n, vector<int>(3));
  for(auto &x: inp)
	for(auto &y: x)
		cin>>y;

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


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

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cstring>
#include <climits>
#include "debug.h"
using namespace std;
#define ll long long
#define FOR(i,n) for(int i=0;i<n;i++)
#define sz(x) (int)(x.size())
#define all(x) (x).begin(),(x).end()
template<typename tp> void read(tp &x) {cin >> x;}
template<typename tp, typename... Args> void read(tp& x, Args&... args) {read(x);read(args...);}
const int mxN = (int)1e5,INF = (int)1e9,MOD = (int)1e9+7;

void solve()
{
	int n;
	read(n);
	int a[n][3];
	FOR(i,n) read(a[i][0],a[i][1],a[i][2]);
	int dp[n][3];//dp[i][j] max happy sum if he select the jth activity in the ith day
	FOR(i,3) dp[0][i] = a[0][i];
	for(int i=1;i<n;i++)
	{
		dp[i][0] = a[i][0] + max(dp[i-1][1],dp[i-1][2]);
		dp[i][1] = a[i][1] + max(dp[i-1][0],dp[i-1][2]);
		dp[i][2] = a[i][2] + max(dp[i-1][1],dp[i-1][0]);
	}
	cout << max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int test = 1;
	//read(test);
	while(test--)
		solve();
	return 0;
}



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

#include <bits/stdc++.h>
using namespace std;
struct iofix
{
	ios_base::Init i;
	iofix() {
		cin.sync_with_stdio(0);
		cin.tie(0);
		cout.sync_with_stdio(0);
		cout.tie(0);
		cout.precision(10);
		cout << fixed;
	}
} iofix;

void solve(){ 
	int N; cin >> N;
	vector<int64_t > dp(3, 0);
	for(int i = 0; i < N; ++i){
		vector <int64_t > cost(3);
		for(int c = 0; c < 333++c)
			cin >> cost[c];
		vector <int64_t > new_dp(3, 0);
		for(int j = 0; j < 3 ; ++j){
			for(int k = 0 ; k < 3 ; ++k){
				if(j != k)
			        	new_dp[k] = max(new_dp[k], dp[j] + cost[k]);
			}
		}
		dp = new_dp;
	}
	cout << max({dp[0], dp[1], dp[2]}) << "\n";
}


int main(){

	solve();

#ifndef Time
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:21:36: error: lvalue required as increment operand
   21 |                 for(int c = 0; c < 333++c)
      |                                    ^~~
a.cc:21:41: error: expected ';' before 'c'
   21 |                 for(int c = 0; c < 333++c)
      |                                         ^
      |                                         ;
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   for(i=1;i<=n;i++){
      |       ^
Language: C++

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

int main(){
    long long int N;
    long long int ans =0;
    cin >> N;
    vector<vector<int>>vec(100010,vector<int>(3));
    for(long long int i=0; i<N;i++){
        for(long long int j=0; j<3; j++){
            cin >> vec.at(i).at(j);
        }
     }
    

    vector<vector<int>>newvec(100010,vector<int>(3,0));
    for(long long int i=0;i<N;i++){
        for(long long int j=0;j<3;j++){
            for(long long int z=0; z<3; z++){
                if(j== z)continue;
                newvec.at(i+1).at(z) = max(newvec.at(i+1).at(z),newvec.at(i).at(j) + vec.at(i).at(z));
            }
        }
    }
    
   
    for(long long int z=0; z<3;z++){
        ans = max(ans,newvec.at(N).at(z));
    }
    cout << ans << endl;
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:28:18: error: no matching function for call to 'max(long long int&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   28 |         ans = max(ans,newvec.at(N).at(z));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~
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:28:18: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
   28 |         ans = max(ans,newvec.at(N).at(z));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/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:28:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   28 |         ans = max(ans,newvec.at(N).at(z));
      |               ~~~^~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int>dp(3,0);
    for(int day=0;day<n;day++)
    {
        vector<int>cost(3);
        vector<int>fina(3,0);
        for(int i=0;i<3;i++)
            cin>>cost[i];
        for(int i=0;i<3;i++)
        {
            for(int j=0;j<3;j++)
            {
                if(i!=j)
                   {
                       fina[j]=max(fina[j],dp[i]+cost[j]);
                   }
            }
        }
        dp=fina;
    }
    cout<<max(dp[0],dp[1],dp[3])<<endl;
    return 0;
}



Compiler output:
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:26:14:   required from here
   26 |     cout<<max(dp[0],dp[1],dp[3])<<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;
typedef long long 	ll;
const ll 	MOD		=  	1e+9+7;
const ll 	N 		= 	2*1e6+5;
ll dp[N][5];
ll a[N][5];
ll n;
ll solve(ll i,ll p)
{
	if(i==n)
	{
		return 0;
	}
	if(dp[i][p]!=-1)
	{
		return dp[i][p];
	}
	ll ans=-1e9;
	for(ll j=0;j<3;j++)
	{
		if(j==p)
		{
			continue;
		}
		ans=max(ans,solve(i+1,j)+a[i][j]);
	}
	return dp[i][p]=ans;
}
 
int main() {
 
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
 
	cin>>n;
	for(ll i=0;i<n;i++)
	{
		for(ll j=0;j<3;j++)
		{
			cin>>a[i][j];
		}
	}
	memset(dp,-1,sizeof(dp));
	cout<<solve(0,3);

Compiler output:
a.cc: In function 'int main()':
a.cc:47:26: error: expected '}' at end of input
   47 |         cout<<solve(0,3);
      |                          ^
a.cc:31:12: note: to match this '{'
   31 | int main() {
      |            ^
Language: C++

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

int main(){
    long long int N;
    long long int ans =0;
    cin >> N;
    vector<vector<int>>vec(100010,vector<int>(3));
    for(long long int i=0; i<N;i++){
        for(long long int j=0; j<3; j++){
            cin >> vec.at(i).at(j);
        }
     }
    

    vector<vector<int>>newvec(100010,vector<int>(3,0));
    for(long long int i=0;i<N;i++){
        for(long long int j=0;j<3;j++){
            for(long long int z=0; z<3; z++){
                if(j== z)continue;
                newvec.at(i+1).at(z) = max(newvec.at(i+1).at(j),newvec.at(i).at(j) + vec.at(i).at(z));
            }
        }
    }
    
   
    ans = max(newvec.at(N).at(0),newvec.at(N).at(1),newvec.at(N).at(2));
    cout << ans << endl;
}   

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

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

int main(){
    long long int N;
    long long int ans =0;
    cin >> N;
    vector<vector<int>>vec(100010,vector<int>(3));
    for(long long int i=0; i<N;i++){
        for(long long int j=0; j<3; j++){
            cin >> vec.at(i).at(j);
        }
     }
    

    vector<vector<int>>newvec(100010,vector<int>(3,0));
    for(long long int i=0;i<N;i++){
        for(long long int j=0;j<3;j++){
            for(long long int z=0; z<3; z++){
                if(j== z)continue;
                newvec.at(i+1).at(j) = max(newvec.at(i+1).at(j),newvec.at(i).at(j) + vec.at(i).at(z));
        }
    }
    for(long long int i=0; i<N; i++){
        for(long long int j=0; j<3; j++){
            ans += newvec.at(i).at(j);
        }
    }
    cout << ans << endl;
}   

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

#include<iostream>
#include<algorithm>
using namespace std;
int main (void)
{
  int i,ans,n,a,b,c,aa,bb,cc,amax=0,bmax=0,cmax=0;
  cin>>n;
  
  for(i=0;i<n;i++)
  {
    cin>>a>>b>>c;
    aa=a+max(bmax,cmax);
    bb=b+max(amax,cmax);
    cc=c+max(amax,bmax);
    amax=aa;
    bmax=bb;
    cmax=cc;
  }
  ans=max({amax,bmax,cmax});
  cout<<ans<<endl;
  
  
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll p[100002][4];
ll a[100002][4];
ll max_sum(int c,int i,int n){
    if(c>n) return 0;
    if(p[c][i]!=-1) return p[c][i];
    int j;
    ll mx=0;
    for(j=0;j<3;j++){
        mx=min(mx,a[c][j]+max_sum(c+1,j,n));
    }
    return p[c][i]=mx;
}
main()
{
    int t,j=1;
    scanf("%d",&t);
    while(j<=t){
        int n;
        scanf("%d",&n);
        int i;
        for(i=1;i<=n;i++){
            scanf("%lld%lld%lld",&a[i][0],&a[i][1],&a[i][2]);
            p[i][0]=-1;
            p[i][1]=-1;
            p[i][2]=-1;
            p[i][3]=-1;
            
        }
        ll ans=max_sum(1,3,n);
        printf("%lld\n"ans);
        j++;
    }
}

Compiler output:
a.cc:16:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   16 | main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:33:16: error: unable to find string literal operator 'operator""ans' with 'const char [6]', 'long unsigned int' arguments
   33 |         printf("%lld\n"ans);
      |                ^~~~~~~~~~~
Language: C++

/*input
7
6 7 8
8 8 3
2 5 2
7 8 6
4 6 8
2 3 4
7 5 1
*/
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long 
#define vl vector<ll> 
#define pl pair<ll,ll> 
#define vpl vector<pl> 
#define vvl vector<vl> 
using namespace std;
vl A,B,C;
vl t;
ll vacation(ll a,ll b,ll c,ll n)
{
	// if(t[n] != -1)return t[n];
	ll h1 = -LONG_MAX,h2 = -LONG_MAX,h3 = -LONG_MAX;
	
	if(n < 0)return 0;
	if(a == 1)h1 = A[n] + vacation(0,1,1,n-1);
	if(b == 1)h2 = B[n] + vacation(1,0,1,n-1);
	if(c == 1)h3 = C[n] + vacation(1,1,0,n-1);
	return  = max(h1,max(h2,h3));



}
int main() {
ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    ll n;
    cin >> n;
    A.resize(n);B.resize(n);C.resize(n);t.resize(n);
    for(auto i = 0;i < n;i++){cin>>A[i] >> B[i] >>C[i];t[i] = -1;}
    ll h =vacation(1,1,1,n-1);
	cout << h;
 	return 0;
}

Compiler output:
a.cc: In function 'long long int vacation(long long int, long long int, long long int, long long int)':
a.cc:31:17: error: expected primary-expression before '=' token
   31 |         return  = max(h1,max(h2,h3));
      |                 ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:2: error: expected ',' or ';' before 'while'
    8 |  while(n--)
      |  ^~~~~
Language: C++

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

int main() {
    int numDays;
    cin >> numDays;
    vector<vector<int> > happiness(numDays, vector<int>(3));
    for(int i = 0; i < numDays; i++) {
        cin >> happiness[i][0];
        cin >> happiness[i][1];
        cin >> happiness[i][2];
    }

    vector<int> prevTotals(3, 0);
    vector<int> currentTotals(3);

    for(int i = 0; i < numDays; i++) {
        currentTotals[0] = max(prevTotals[1], prevTotals[2]) + happiness[i][0];
        currentTotals[1] = max(prevTotals[0], prevTotals[2]) + happiness[i][1];
        currentTotals[2] = max(prevTotals[0], prevTotals[1]) + happiness[i][2];
        prevTotals = currentTotals;
    }
    
    cout << *max_element(currentTotals.begin(), currentTotals.end());

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: 'max_element' was not declared in this scope
   25 |     cout << *max_element(currentTotals.begin(), currentTotals.end());
      |              ^~~~~~~~~~~
Language: Java


import java.util.*;
import java.io.*;

public class Main
	static FastReader in = new FastReader();

	public static void main(String[] args) {
		solve();
	}

	static void solve() {
		int n = in.nextInt();
		int[][] arr = new int[n][3];
		for(int i = 0; i < n; i++) arr[i] = in.readarr(3);
		
		int[][] dp = new int[n][3];
		dp[0][0] = arr[0][0];
		dp[0][1] = arr[0][1];
		dp[0][2] = arr[0][2];
		
		for(int i = 1; i < n; i++)
		{
			dp[i][0] = arr[i][0] + Math.max(dp[i - 1][1], dp[i - 1][2]);
			dp[i][1] = arr[i][1] + Math.max(dp[i - 1][0], dp[i - 1][2]);
			dp[i][2] = arr[i][2] + Math.max(dp[i - 1][0], dp[i - 1][1]);
		}
				
		System.out.println(Math.max(dp[n - 1][0], Math.max(dp[n - 1][1], dp[n - 1][2])));
		
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int[] readarr(int abc) {
			int[] temp = new int[abc];
			for (int i = 0; i < abc; i++)
				temp[i] = nextInt();
			return temp;
		}
	}
}


Compiler output:
Main.java:5: error: '{' expected
public class Main
                 ^
Main.java:8: error: unnamed classes are a preview feature and are disabled by default.
	public static void main(String[] args) {
	              ^
  (use --enable-preview to enable unnamed classes)
Main.java:81: error: class, interface, enum, or record expected
}
^
3 errors
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    int N;
    cin >> N;
    ll abc[100010][3]{};
    for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> abc[i][j];
    ll dp[100010][3]{};
    for (int a = 0; a < N; ++a) {
        for (int b = 0; b < 3; ++b) {
            for (int c = 0; c < 3; ++c) {
                if (b == c) continue;
                dp[a + 1][c] = max(dp[a + 1][c], dp[a][b] + abc[a][c]);
            }
        }
    }
    ll res = 0;
    for (int i = 0; i < 3; ++i) res = max(res, dp[N][i]);
    cout << res << endl;
    return 0;
}z

Compiler output:
a.cc:30:2: error: 'z' does not name a type
   30 | }z
      |  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int getMaxPoint(vector<int> v,int &p){
  int point=INT_MIN,act=-1;
    for(int i=0;i<3;i++){
      if(i==p)
        continue;
      point=max(point,v[i]);
      act=i;
    }
  p=act;
  return point;
}
int main(){
  int n;
  cin>>n;
  vector<vector<int> > vac(n,vector<int> (3));
  for(int i=0;i<n;i++){
    cin>>vac[i][0]>>vac[i][1]>>vac[i][2];
  }
  int point=0;
  int activity=-1;
  sum=getMaxPoint(vac[0],activity);
  for(int i=1;i<n;i++){
    sum+=getMaxPoint(vac[i],activity);
  }
 cout<<sum<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:3: error: 'sum' was not declared in this scope
   23 |   sum=getMaxPoint(vac[0],activity);
      |   ^~~
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(n,vector<int>(3,0));
  dp[n-1][0]=max(b[n-1],c[n-1]);
  dp[n-1][1]=max(a[n-1],c[n-1]);
  dp[n-1][2]=max(b[n-1],a[n-1]);
  for(int i=n-2;i>=0;i--){
    if(b[i]==c[i]) dp[i][0]=max(b[i]+dp[i+1][1],b[i]+dp[i+!][2]);
    else dp[i][0]=(b[i]>c[i])?dp[i+1][1]+b[i]:dp[i+1][2]+c[i];
    
    if(a[i]==c[i]) dp[i][1]=max(c[i]+dp[i+1][0],c[i]+dp[i+1][2]);
    else dp[i][1]=(a[i]>c[i])?dp[i+1][0]+a[i]:dp[i+1][2]+c[i];
    
    if(b[i]==a[i]) dp[i][2]=max(b[i]+dp[i+1][1],b[i]+dp[i+1][0]);
    else dp[i][2]=(b[i]>a[i])?dp[i+1][1]+b[i]:dp[i+1][0]+a[i];
    
  }
  cout<<max(dp[0][1],max(dp[0][2],dp[0][0]));
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:60: error: expected primary-expression before ']' token
   16 |     if(b[i]==c[i]) dp[i][0]=max(b[i]+dp[i+1][1],b[i]+dp[i+!][2]);
      |                                                            ^
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(n,vector<int>(m,0));
  dp[n-1][0]=max(b[n-1],c[n-1]);
  dp[n-1][1]=max(a[n-1],c[n-1]);
  dp[n-1][2]=max(b[n-1],a[n-1]);
  for(int i=n-2;i>=0;i--){
    if(b[i]==c[i]) dp[i][0]=max(b[i]+dp[i+1][1],b[i]+dp[i][2]);
    else dp[i][0]=(b[i]>c[i])?dp[i+1][1]+b[i]:dp[i+1][2]+c[i];
    
    if(a[i]==c[i]) dp[i][1]=max(c[i]+dp[i+1][0],c[i]+dp[i][2]);
    else dp[i][1]=(a[i]>c[i])?dp[i+1][0]+a[i]:dp[i+1][2]+c[i];
    
    if(b[i]==a[i]) dp[i][2]=max(b[i]+dp[i+1][1],b[i]+dp[i][0]);
    else dp[i][2]=(b[i]>a[i])?dp[i+1][1]+b[i]:dp[i+1][0]+a[i];
    
  }
  cout<<max(dp[0][1],max(dp[0][2],dp[0][0]));
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:41: error: 'm' was not declared in this scope
   11 |   vector<vector<int> > dp(n,vector<int>(m,0));
      |                                         ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, dp[n][3];

ll solve(int idx, int prev)
{
    if(idx == n)
        return 0;

    if(dp[idx][prev] != -1)
        return dp[idx][prev];

    ll ans = INT_MIN;

	if(prev == 0) {
		ans = max(ans, b[idx] + solve(idx + 1, 1));
		ans = max(ans, c[idx] + solve(idx + 1, 2));
	} 
    else if(prev == 1) {
		ans = max(ans, a[idx] + solve(idx + 1, 0));
		ans = max(ans, c[idx] + solve(idx + 1, 2));
	} 
    else if(prev == 2) {
		ans = max(ans, b[idx] + solve(idx + 1, 1));
		ans = max(ans, a[idx] + solve(idx + 1, 0));
	}
     else {
		ans = max(ans, c[idx] + solve(idx + 1, 2));
		ans = max(ans, b[idx] + solve(idx + 1, 1));
		ans = max(ans, a[idx] + solve(idx + 1, 0));
	}
 
	return dp[idx][prev] = ans;
}
}
int main() {

    cin >> n;
    memset(dp, -1, sizeof(dp));

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

    ll ans = solve(0,3);

    cout<< ans <<endl;


}

Compiler output:
a.cc:4:10: error: size of array 'dp' is not an integral constant-expression
    4 | ll n, dp[n][3];
      |          ^
a.cc: In function 'long long int solve(int, int)':
a.cc:17:32: error: 'b' was not declared in this scope
   17 |                 ans = max(ans, b[idx] + solve(idx + 1, 1));
      |                                ^
a.cc:18:32: error: 'c' was not declared in this scope
   18 |                 ans = max(ans, c[idx] + solve(idx + 1, 2));
      |                                ^
a.cc:21:32: error: 'a' was not declared in this scope
   21 |                 ans = max(ans, a[idx] + solve(idx + 1, 0));
      |                                ^
a.cc:22:32: error: 'c' was not declared in this scope
   22 |                 ans = max(ans, c[idx] + solve(idx + 1, 2));
      |                                ^
a.cc:25:32: error: 'b' was not declared in this scope
   25 |                 ans = max(ans, b[idx] + solve(idx + 1, 1));
      |                                ^
a.cc:26:32: error: 'a' was not declared in this scope
   26 |                 ans = max(ans, a[idx] + solve(idx + 1, 0));
      |                                ^
a.cc:29:32: error: 'c' was not declared in this scope
   29 |                 ans = max(ans, c[idx] + solve(idx + 1, 2));
      |                                ^
a.cc:30:32: error: 'b' was not declared in this scope
   30 |                 ans = max(ans, b[idx] + solve(idx + 1, 1));
      |                                ^
a.cc:31:32: error: 'a' was not declared in this scope
   31 |                 ans = max(ans, a[idx] + solve(idx + 1, 0));
      |                                ^
a.cc: At global scope:
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
a.cc: In function 'int main()':
a.cc:43:15: error: 'a' was not declared in this scope
   43 |         cin>> a[i] >> b[i] >> c[i];
      |               ^
a.cc:43:23: error: 'b' was not declared in this scope
   43 |         cin>> a[i] >> b[i] >> c[i];
      |                       ^
a.cc:43:31: error: 'c' was not declared in this scope
   43 |         cin>> a[i] >> b[i] >> c[i];
      |                               ^
Language: C++

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

#define int long long int
#define mod 1000000007
int a[100005][4];
int dp[100005][4];
int n;
int solve(int day, int col)
{
	if (day == n)
		return 0;

	if (dp[day][col] != -1)
		return dp[day][col];

	int mx = 0;
	if (col == 0) {
		mx = max(mx, a[day][1] + solve(day + 1, 1));
		mx = max(mx, a[day][2] + solve(day + 1, 2));
		mx = max(mx, a[day][3] + solve(day + 1, 3));
	}
	else if (col == 1) {
		mx = max(mx, a[day][2] + solve(day + 1, 2));
		mx = max(mx, a[day][3] + solve(day + 1, 3));
	}
	else if (col == 2) {
		mx = max(mx, a[day][1] + solve(day + 1, 1));
		mx = max(mx, a[day][3] + solve(day + 1, 3));
	}
	else {
		mx = max(mx, a[day][1] + solve(day + 1, 1));
		mx = max(mx, a[day][2] + solve(day + 1, 2));
	}

	dp[day][col] = mx;
	return mx;
}
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	//FUCK RATINGS
	//Once a CHARAS, always a CHARAS


	//int t; cin>>t;
	//while(t--){
	//}
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= n; j++) {
			cin >> a[i][j];
		}
	}
	mem(dp, -1);
	cout << solve(0, 0);


	return 0;
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:59:9: error: 'mem' was not declared in this scope
   59 |         mem(dp, -1);
      |         ^~~