Language: C++

#include <bits/stdc++.h>

using namespace std;

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


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





Compiler output:
a.cc: In function 'int solve(std::vector<std::vector<int> >&)':
a.cc:42:31: error: 'mac' was not declared in this scope
   42 |         return max(dp[n-1][0],mac(dp[n-1][1],dp[n-1][2]));
      |                               ^~~
a.cc: In function 'int main()':
a.cc:49:23: error: 'in' was not declared in this scope; did you mean 'n'?
   49 |         vector<vector<in>t> arr(n, vector<int>(3));
      |                       ^~
      |                       n
a.cc:49:25: error: template argument 1 is invalid
   49 |         vector<vector<in>t> arr(n, vector<int>(3));
      |                         ^
a.cc:49:25: error: template argument 2 is invalid
a.cc:49:27: error: template argument 1 is invalid
   49 |         vector<vector<in>t> arr(n, vector<int>(3));
      |                           ^
a.cc:49:27: error: template argument 2 is invalid
a.cc:49:50: error: expression list treated as compound expression in initializer [-fpermissive]
   49 |         vector<vector<in>t> arr(n, vector<int>(3));
      |                                                  ^
a.cc:49:36: error: cannot convert 'std::vector<int>' to 'int' in initialization
   49 |         vector<vector<in>t> arr(n, vector<int>(3));
      |                                    ^~~~~~~~~~~~~~
      |                                    |
      |                                    std::vector<int>
a.cc:51:17: error: invalid types 'int[int]' for array subscript
   51 |         cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
      |                 ^
a.cc:51:28: error: invalid types 'int[int]' for array subscript
   51 |         cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
      |                            ^
a.cc:51:39: error: invalid types 'int[int]' for array subscript
   51 |         cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
      |                                       ^
a.cc:53:21: error: invalid initialization of reference of type 'std::vector<std::vector<int> >&' from expression of type 'int'
   53 |         cout<<solve(arr);
      |                     ^~~
a.cc:5:32: note: in passing argument 1 of 'int solve(std::vector<std::vector<int> >&)'
    5 | int solve(vector<vector<int>>& arr) {
      |           ~~~~~~~~~~~~~~~~~~~~~^~~