Language: C++

#pragma GCC optimize(“O3”)
#pragma comment(linker, “/stack:200000000")
#pragma GCC optimize(“unroll-loops”)

#include<bits/stdc++.h>
#define forn(i,n) for(int i=0;i<n;i++)

#define ALL(x) x.begin(),x.end()
#define LL long long int

int mod = pow(10,9) +7;
const int inf = 2e9;
const LL linf = 2e18;
const double eps = 1e-9;

/////////////////////////////////////////////

const int N = 3e3+100;
LL arr[N];
LL dp[N][N];

LL total(LL x,LL y , bool c ){
    // trace(x,y,c);
    if(dp[x][y] != -1LL) return dp[x][y] ;
    if(x > y ) return 0;
    if(c == 0) return  dp[x][y ]=  max( arr[x] + total(x+1,y,!c) , arr[y] + total(x,y-1,!c) );
    else return dp[x][y] =  min(total(x+1,y,!c) -arr[x],total(x,y-1,!c) -arr[y]);
} 


int solve(int x, int y,int c){
    if(x == y){
        return arr[x];
    }
    int mini = min(arr[x] + solve(x+1,y,c^1),arr[y] + solve(x,y-1,c^1));
    int maxi = min(arr[x] + solve(x+1,y,c^1),arr[y] + solve(x,y-1,c^1));

    int play1 = min( arr[x] + solve(x+1,y,1) - solve(x+1,y,0) ,arr[y] +  solve(x,y-1,1) - solve(x,y-1,0) );
    int play2 = min( arr[x] + solve(x+1,y,1) - solve(x+1,y,0) ,arr[y] +  solve(x,y-1,1) - solve(x,y-1,0) );
    if(c == 0){
        return play1;
    }else{
        return play2;
    }
}


int main()
{
    
    LL n;
    cin >> n;
    forn(i,n) forn(j,n) dp[i][j] = -1LL;
    forn(i,n) cin >> arr[i];
    cout << total(0,n-1,0) << endl;
}

Compiler output:
a.cc:1:22: error: extended character “ is not valid in an identifier
    1 | #pragma GCC optimize(“O3”)
      |                      ^
a.cc:1:22: error: extended character ” is not valid in an identifier
a.cc:2:25: error: extended character “ is not valid in an identifier
    2 | #pragma comment(linker, “/stack:200000000")
      |                         ^
a.cc:2:42: warning: missing terminating " character
    2 | #pragma comment(linker, “/stack:200000000")
      |                                          ^
a.cc:3:22: error: extended character “ is not valid in an identifier
    3 | #pragma GCC optimize(“unroll-loops”)
      |                      ^
a.cc:3:30: error: extended character ” is not valid in an identifier
    3 | #pragma GCC optimize(“unroll-loops”)
      |                              ^
a.cc:1:22: warning: '#pragma GCC optimize' is not a string or number [-Wpragmas]
    1 | #pragma GCC optimize(“O3”)
      |                      ^~~~
a.cc:3:22: warning: '#pragma GCC optimize' is not a string or number [-Wpragmas]
    3 | #pragma GCC optimize(“unroll-loops”)
      |                      ^~~~~~~
a.cc: In function 'long long int total(long long int, long long int, bool)':
a.cc:26:36: error: 'max' was not declared in this scope; did you mean 'std::max'?
   26 |     if(c == 0) return  dp[x][y ]=  max( arr[x] + total(x+1,y,!c) , arr[y] + total(x,y-1,!c) );
      |                                    ^~~
      |                                    std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:27:29: error: 'min' was not declared in this scope; did you mean 'std::min'?
   27 |     else return dp[x][y] =  min(total(x+1,y,!c) -arr[x],total(x,y-1,!c) -arr[y]);
      |                             ^~~
      |                             std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc: In function 'int solve(int, int, int)':
a.cc:35:16: error: 'min' was not declared in this scope; did you mean 'std::min'?
   35 |     int mini = min(arr[x] + solve(x+1,y,c^1),arr[y] + solve(x,y-1,c^1));
      |                ^~~
      |                std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc: In function 'int main()':
a.cc:52:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   52 |     cin >> n;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:55:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   55 |     cout << total(0,n-1,0) << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:55:31: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   55 |     cout << total(0,n-1,0) << endl;
      |                               ^~~~
      |                               std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~