Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N;
  cin>>N;
  
  vector<ll>A(N);
  ll dp[N][2];
  
  rep(i,N){
rep(j,2){
  rep(k,2){

dp[i][j][k]=0;
  }
}
}

  


  rep(i,N){
    cin>>A[i];
  }

  
 
  
  for(ll i=0;i<N;i++){
   if(i==0){
dp[i][0][0]+=A[i];
    dp[i][1][1]+=-A[i];
     dp[i][1][0]=INF;
   }
       else{
dp[i][0]+=max(A[i]+dp[i-1][0][0],A[i]+dp[i-1][1][0]);
    dp[i][1]+=max(-A[i]+dp[i-1][0][0].-A[i]+dp[i-1][1][1]);
   }
    
  }

  
    cout<<max(max(dp[N-1][0][0],dp[N-1][1][0]),dp[N-1][1][1]);
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:58:9: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   58 | dp[i][j][k]=0;
      |         ^
a.cc:75:9: error: invalid types 'll {aka long long int}[int]' for array subscript
   75 | dp[i][0][0]+=A[i];
      |         ^
a.cc:76:13: error: invalid types 'll {aka long long int}[int]' for array subscript
   76 |     dp[i][1][1]+=-A[i];
      |             ^
a.cc:77:14: error: invalid types 'll {aka long long int}[int]' for array subscript
   77 |      dp[i][1][0]=INF;
      |              ^
a.cc:80:30: error: invalid types 'll {aka long long int}[int]' for array subscript
   80 | dp[i][0]+=max(A[i]+dp[i-1][0][0],A[i]+dp[i-1][1][0]);
      |                              ^
a.cc:80:49: error: invalid types 'll {aka long long int}[int]' for array subscript
   80 | dp[i][0]+=max(A[i]+dp[i-1][0][0],A[i]+dp[i-1][1][0]);
      |                                                 ^
a.cc:81:35: error: invalid types 'll {aka long long int}[int]' for array subscript
   81 |     dp[i][1]+=max(-A[i]+dp[i-1][0][0].-A[i]+dp[i-1][1][1]);
      |                                   ^
a.cc:81:39: error: expected unqualified-id before '-' token
   81 |     dp[i][1]+=max(-A[i]+dp[i-1][0][0].-A[i]+dp[i-1][1][1]);
      |                                       ^
a.cc:81:55: error: invalid types 'll {aka long long int}[int]' for array subscript
   81 |     dp[i][1]+=max(-A[i]+dp[i-1][0][0].-A[i]+dp[i-1][1][1]);
      |                                                       ^
a.cc:87:29: error: invalid types 'll {aka long long int}[int]' for array subscript
   87 |     cout<<max(max(dp[N-1][0][0],dp[N-1][1][0]),dp[N-1][1][1]);
      |                             ^
a.cc:87:43: error: invalid types 'll {aka long long int}[int]' for array subscript
   87 |     cout<<max(max(dp[N-1][0][0],dp[N-1][1][0]),dp[N-1][1][1]);
      |                                           ^
a.cc:87:58: error: invalid types 'll {aka long long int}[int]' for array subscript
   87 |     cout<<max(max(dp[N-1][0][0],dp[N-1][1][0]),dp[N-1][1][1]);
      |                                                          ^