Language: C++

#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define pb push_back
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(type,arr,n)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
//=======================
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
//=======================
const int MOD = 1000000007;
const int N = 300005, M = N;
//=======================
vi g[N],adj[N];
int n, m, s, w, W, S, k, i, l, j, p, q, pr, fi, md;


void abhinay()
{
   
    #ifndef ONLINE_JUDGE   
        freopen("input.txt", "r", stdin);   
        freopen("output.txt", "w", stdout);   
    #endif   
    
}

int main(){
    abhinay();
    cin>>n;
    int dp[n+1][3];
    int A(n+1),B(n+1),C(n+1); 
    fo(i,n) 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] = A[i]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1] = B[i]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2] = C[i]+max(dp[i-1][1],dp[i-1][0]);
    }
    int ret = 0;
    ret = max(ret,dp[n-1][0]);
    ret = max(ret,dp[n-1][1]);
    ret = max(ret,dp[n-1][2]);

    cout << ret;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:19: error: invalid types 'int[int]' for array subscript
   50 |     fo(i,n) cin>>A[i]>>B[i]>>C[i];
      |                   ^
a.cc:50:25: error: invalid types 'int[int]' for array subscript
   50 |     fo(i,n) cin>>A[i]>>B[i]>>C[i];
      |                         ^
a.cc:50:31: error: invalid types 'int[int]' for array subscript
   50 |     fo(i,n) cin>>A[i]>>B[i]>>C[i];
      |                               ^
a.cc:51:15: error: invalid types 'int[int]' for array subscript
   51 |     dp[0][0]=A[0],dp[0][1]=B[0],dp[0][2]=C[0];
      |               ^
a.cc:51:29: error: invalid types 'int[int]' for array subscript
   51 |     dp[0][0]=A[0],dp[0][1]=B[0],dp[0][2]=C[0];
      |                             ^
a.cc:51:43: error: invalid types 'int[int]' for array subscript
   51 |     dp[0][0]=A[0],dp[0][1]=B[0],dp[0][2]=C[0];
      |                                           ^
a.cc:54:21: error: invalid types 'int[int]' for array subscript
   54 |         dp[i][0] = A[i]+max(dp[i-1][1],dp[i-1][2]);
      |                     ^
a.cc:55:21: error: invalid types 'int[int]' for array subscript
   55 |         dp[i][1] = B[i]+max(dp[i-1][0],dp[i-1][2]);
      |                     ^
a.cc:56:21: error: invalid types 'int[int]' for array subscript
   56 |         dp[i][2] = C[i]+max(dp[i-1][1],dp[i-1][0]);
      |                     ^