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

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <limits>

using namespace std;

int N;
vector<long long> v;
vector<vector<long long>> dp; 
long long LIM = std::numeric_limits<long long>::min();

long long deque(long long i, long long j)
{
  long long c = (N - (j + 1 - i)) % 2 == 0 ? 1 : -1; 

  if (i == j) return v[i] * c;
  if (dp[i+1][j] == LIM) dp[i+1][j] = deque(i+1, j); 
  if (dp[i][j-1] == LIM) dp[i][j-1] = deque(i, j-1);

  long long a = v[i]*c + dp[i+1][j];
  long long b = v[j]*c + dp[i][j-1];

  dp[i][j] = c < 0 ? min(a, b) : max(a, b); 
  return dp[i][j];


int main()
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  std::cin >> N;
  v.resize(N);
  dp = vector<vector<long long>>(N+1, vector<long long>(N+1, LIM));

  for (int i = 0; i < N; ++i)
  {
    long long val;
    cin >> val;
    v[i] = val;
  }

  std::cout << deque(0, N-1);

  return 0;
}

Compiler output:
a.cc: In function 'long long int deque(long long int, long long int)':
a.cc:30:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   30 | int main()
      |         ^~
a.cc:30:9: note: remove parentheses to default-initialize a variable
   30 | int main()
      |         ^~
      |         --
a.cc:30:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:31:1: error: a function-definition is not allowed here before '{' token
   31 | {
      | ^
a.cc:49:2: error: expected '}' at end of input
   49 | }
      |  ^
a.cc:16:1: note: to match this '{'
   16 | {
      | ^
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstdint>
 
using namespace std;
 
int N;
vector<long long> v;
vector<vector<vector<long long>>> dp;
 
long long deque(long long i, long long j, long long c = 1)
{
  if (i+1 == j) return v[i] * c;
 
  int k = c < 0 ? 0 : 1;
 
  if (dp[i][j][k] != LLONG_MIN)
  {
    return dp[i][j][k];
  }
 
  long long a = v[i]*c + deque(i+1, j, c*-1);
  long long b = v[j-1]*c + deque(i, j-1, c*-1);
 
  dp[i][j][k] = c < 0 ? min(a, b) : max(a, b); 
  return dp[i][j][k];
}
 
int main()
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
 
  std::cin >> N;
  v.resize(N);
  dp = vector<vector<vector<long long>>>(N+1, vector<vector<long long>>(N+1, vector<long long>(2, LLONG_MIN)));
 
  for (int i = 0; i < N; ++i)
  {
    long long val;
    cin >> val;
    v[i] = val;
  }
 
  std::cout << deque(0, N); 
 
  return 0;
}

Compiler output:
a.cc: In function 'long long int deque(long long int, long long int, long long int)':
a.cc:20:22: error: 'LLONG_MIN' was not declared in this scope
   20 |   if (dp[i][j][k] != LLONG_MIN)
      |                      ^~~~~~~~~
a.cc:7:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <cstdint>
  +++ |+#include <climits>
    7 | 
a.cc: In function 'int main()':
a.cc:39:99: error: 'LLONG_MIN' was not declared in this scope
   39 |   dp = vector<vector<vector<long long>>>(N+1, vector<vector<long long>>(N+1, vector<long long>(2, LLONG_MIN)));
      |                                                                                                   ^~~~~~~~~
a.cc:39:99: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <limits>

using namespace std;

int N;
vector<long long> v;
vector<vector<vector<long long>>> dp;

long long deque(long long i, long long j, long long c = 1)
{
  if (i+1 == j) return v[i] * c;

  int k = c < 0 ? 0 : 1;

  if (dp[i][j][k] != LLONG_MIN)
  {
    return dp[i][j][k];
  }

  long long a = v[i]*c + deque(i+1, j, c*-1);
  long long b = v[j-1]*c + deque(i, j-1, c*-1);

  dp[i][j][k] = c < 0 ? min(a, b) : max(a, b); 
  return dp[i][j][k];
}

int main()
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  std::cin >> N;
  v.resize(N);
  dp = vector<vector<vector<long long>>>(N+1, vector<vector<long long>>(N+1, vector<long long>(2, LLONG_MIN)));

  for (int i = 0; i < N; ++i)
  {
    long long val;
    cin >> val;
    v[i] = val;
  }

  std::cout << deque(0, N); 

  return 0;
}

Compiler output:
a.cc: In function 'long long int deque(long long int, long long int, long long int)':
a.cc:20:22: error: 'LLONG_MIN' was not declared in this scope
   20 |   if (dp[i][j][k] != LLONG_MIN)
      |                      ^~~~~~~~~
a.cc:7:1: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <limits>
  +++ |+#include <climits>
    7 | 
a.cc: In function 'int main()':
a.cc:39:99: error: 'LLONG_MIN' was not declared in this scope
   39 |   dp = vector<vector<vector<long long>>>(N+1, vector<vector<long long>>(N+1, vector<long long>(2, LLONG_MIN)));
      |                                                                                                   ^~~~~~~~~
a.cc:39:99: note: 'LLONG_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: Java

import javax.swing.*;
import java.io.*;
import java.sql.Struct;
import java.text.DecimalFormat;
import java.util.*;

public class Main {


    public static void main(String[] args) throws IOException {
        BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(rd.readLine());
        int[] arr = new int[n];
        StringTokenizer s = new StringTokenizer(rd.readLine());
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(s.nextToken());
        }
        long[][] dp = new long[n + 1][n + 1];

        for (int i = 0; i < n; i++) {
            dp[i][i] = arr[i];
        }

        for (int i = 2; i < n + 1; i++) {
            for (int j = 0; j <= n - i; j++) {
                int start = j;
                int end = start + i - 1;
                dp[start][end] = Math.max(-dp[start + 1][end] + arr[start], -dp[start][end -1]+arr[end]);

            }
        }

        System.out.println(dp[0][n - 1]);
    }

Compiler output:
Main.java:34: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize(“O3”)
#pragma comment(linker, “/stack:200000000")
#pragma GCC optimize(“unroll-loops”)
#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:3:22: error: extended character “ is not valid in an identifier
    3 | #pragma GCC optimize(“O3”)
      |                      ^
a.cc:3:22: error: extended character ” is not valid in an identifier
a.cc:4:25: error: extended character “ is not valid in an identifier
    4 | #pragma comment(linker, “/stack:200000000")
      |                         ^
a.cc:4:42: warning: missing terminating " character
    4 | #pragma comment(linker, “/stack:200000000")
      |                                          ^
a.cc:5:22: error: extended character “ is not valid in an identifier
    5 | #pragma GCC optimize(“unroll-loops”)
      |                      ^
a.cc:5:30: error: extended character ” is not valid in an identifier
    5 | #pragma GCC optimize(“unroll-loops”)
      |                              ^
a.cc:3:22: warning: '#pragma GCC optimize' is not a string or number [-Wpragmas]
    3 | #pragma GCC optimize(“O3”)
      |                      ^~~~
a.cc:5:22: warning: '#pragma GCC optimize' is not a string or number [-Wpragmas]
    5 | #pragma GCC optimize(“unroll-loops”)
      |                      ^~~~~~~
Language: C++

#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int n;
  int *a = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  long **dp = new long *[n + 1];
  for (int i = 0; i <= n; i++) {
    dp[i] = new long[n + 1];
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      dp[i][j]
      // if (i == j)
      //   dp[i][j] = 0;
      // else
      //   dp[i][j] = -1;
    }
  }

  for (int len = 1; len <= n; len++) {
    for (int i = 0; i + len <= n; i++) {
      int j = i + len;
      if ((n - len) % 2 == 0)
        dp[i][j] = (dp[i + 1][j] + a[i]) > (dp[i][j - 1] + a[j - 1])
                       ? (dp[i + 1][j] + a[i])
                       : (dp[i][j - 1] + a[j - 1]);
      else
        dp[i][j] = (dp[i + 1][j] + a[i]) < (dp[i][j - 1] + a[j - 1])
                       ? (dp[i + 1][j] - a[i])
                       : (dp[i][j - 1] - a[j - 1]);
    }
  }

  cout << dp[0][N] << endl;

  for (int i = 0; i < n; i++) {
    delete[] dp[i];
  }
  delete[] dp;
  delete[] a;
  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:18:15: error: expected ';' before '}' token
   18 |       dp[i][j]
      |               ^
      |               ;
......
   23 |     }
      |     ~          
a.cc:40:17: error: 'N' was not declared in this scope
   40 |   cout << dp[0][N] << endl;
      |                 ^
Language: C++

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

typedef long long ll;
typedef long double ld;
typedef pair < int , pair < int , int > > mp;

#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)

const ll N = 123456;
const ld eps = 1e-6;
const ld pi = 3.1415926535;
const int MAX = 123456;
const ll mod = 1e9 + 7;

ll a[N];

ll dp[3333][3333];

ll DP(int t , int l , int r) {
	if(l > r) return 0;
	if(dp[l][r] != -1) return dp[l][r];
	ll temp;
	if(t == 1) {
		temp = DP(1 - t , l , r - 1) + a[r];
		temp = max(temp , DP(1 - t , l + 1 , r) + A[l]);
	}
	else {
		temp = DP(1 - t , l , r - 1) - a[r];
		temp = min(temp , DP(1 - t , l + 1 , r) - a[l]);
	}

	dp[l][r] = temp;
	return temp;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    cout << fixed << setprecision(12);

    int n;
    cin >> n;

    rep(i , 1 , n) cin >> a[i];

    rep(i , 1 , n) rep(j , 1 , n) dp[i][j] = -1;

    cout << DP(1 , 1 , n) << endl;

    return 0;
}


Compiler output:
a.cc: In function 'll DP(int, int, int)':
a.cc:28:59: error: 'A' was not declared in this scope
   28 |                 temp = max(temp , DP(1 - t , l + 1 , r) + A[l]);
      |                                                           ^
Language: C++

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

typedef long long ll;
typedef long double ld;
typedef pair < int , pair < int , int > > mp;

#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)

const ll N = 123456;
const ld eps = 1e-6;
const ld pi = 3.1415926535;
const int MAX = 123456;
const ll mod = 1e9 + 7;

ll a[N];

ll dp[3333][3333];

ll DP(int t , int l , int r) {
	if(l > r) return 0;
	if(dp[l][r] != -1) return dp[l][r];
	ll temp;
	if(t == 1) {
		temp = DP(1 - t , l , r - 1) + a[r];
		temp = max(temp , DP(1 - t , l + 1 , r) + A[l]);
	}
	else {
		temp = DP(1 - t , l , r - 1) - a[r];
		temp = min(DP(1 - t , l + 1 , r) - a[l]);
	}

	dp[l][r] = temp;
	return temp;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    cout << fixed << setprecision(12);

    int n;
    cin >> n;

    rep(i , 1 , n) cin >> a[i];

    rep(i , 1 , n) rep(j , 1 , n) dp[i][j] = -1;

    cout << DP(1 , 1 , n) << endl;

    return 0;
}


Compiler output:
a.cc: In function 'll DP(int, int, int)':
a.cc:28:59: error: 'A' was not declared in this scope
   28 |                 temp = max(temp , DP(1 - t , l + 1 , r) + A[l]);
      |                                                           ^
a.cc:32:27: error: no matching function for call to 'min(ll)'
   32 |                 temp = min(DP(1 - t , l + 1 , r) - a[l]);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   template argument deduction/substitution failed:
a.cc:32:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   32 |                 temp = min(DP(1 - t , l + 1 , r) - a[l]);
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include<iostream>
#include<algorithm>

typedef long long ll;
using namespace std;
int n;
int a[3005];
ll memo[3005][3005];

ll dp(int l,int r){
  if(l==r)return a[l];
  if(memo[l][r]!=-1)return memo[l][r];

  return memo[l][r]=max(a[l]-dp(l+1,r),-dp(l,r-1)+a[r]);
}
  
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  memset(memo,-1,sizeof(memo));
  
  cout<<dp(0,n-1)<<"\n";
  
  return 0;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: 'memset' was not declared in this scope
   22 |   memset(memo,-1,sizeof(memo));
      |   ^~~~~~
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 |
Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define INF 0x3f3f3f3
#define LINF 0x3f3f3f3f3f3f3f
#define MAXN int(3005)
#define fim '\n'
#define ll long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << fim
#define debug2(x, y) cout << "DEBUG " << x << " " << y << fim
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< fim
using namespace std;
typedef pair<int, int> pii;
 
ll n, vet[MAXN], dp[2][MAXN], sum[MAXN];
 
int main() {
 
		cin >> n
      	memset(sum, 0, sizeof sum);
        for(int i = 1; i <= n; sum[i] = sum[i-1]+vet[i], i++)
            cin >> vet[i];
 
        for(int i = 0; i <= 1; i++)
            for(int j = 0; j <= n; j++)
                dp[i][j] = 0;
 
        for(int i = n; i >= 1; i--)
            for(int j = 1; j <= n; j++) {
                if(i == j) {dp[i & 1][j] = 0; continue;}
                int may = (i+j)%2;
                if(may) {dp[i & 1][j] = max(dp[~i & 1][j]+vet[i], dp[i & 1][j-1]+vet[j]); continue;}
                dp[i & 1][j] = min(dp[~i & 1][j], dp[i & 1][j-1]);
            }
        cout << sum[n]-dp[1][n] << fim;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:25: error: expected ';' before 'memset'
   21 |                 cin >> n
      |                         ^
      |                         ;
   22 |         memset(sum, 0, sizeof sum);
      |         ~~~~~~
Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define INF 0x3f3f3f3
#define LINF 0x3f3f3f3f3f3f3f
#define MAXN int(3005)
#define fim '\n'
#define ll long long
#define f first
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << fim
#define debug2(x, y) cout << "DEBUG " << x << " " << y << fim
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< fim
using namespace std;
typedef pair<int, int> pii;

ll n, vet[MAXN], dp[2][MAXN], sum[MAXN];

int main() {

		cin >> n
      	memset(sum, 0, sizeof sum)
        for(int i = 1; i <= n; sum[i] = sum[i-1]+vet[i], i++)
            cin >> vet[i];

        for(int i = 0; i <= 1; i++)
            for(int j = 0; j <= n; j++)
                dp[i][j] = 0;

        for(int i = n; i >= 1; i--)
            for(int j = 1; j <= n; j++) {
                if(i == j) {dp[i & 1][j] = 0; continue;}
                int may = (i+j)%2;
                if(may) {dp[i & 1][j] = max(dp[~i & 1][j]+vet[i], dp[i & 1][j-1]+vet[j]); continue;}
                dp[i & 1][j] = min(dp[~i & 1][j], dp[i & 1][j-1]);
            }
        cout << sum[n]-dp[1][n] << fim;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:25: error: expected ';' before 'memset'
   21 |                 cin >> n
      |                         ^
      |                         ;
   22 |         memset(sum, 0, sizeof sum)
      |         ~~~~~~           
a.cc:23:24: error: 'i' was not declared in this scope
   23 |         for(int i = 1; i <= n; sum[i] = sum[i-1]+vet[i], i++)
      |                        ^
Language: Java



import java.util.Arrays;
import java.util.Scanner;

public class AtCoderL {

	private static Scanner in;

    private static int n;
    private static int[] a;
    private static long[][] dp;

    public static void main(String[] args) {
        in = new Scanner(System.in);
        n = in.nextInt();
        a = new int[n];
        
        dp = new long[n][n];
        
        for(int i=0; i<n; i++) {
        	for(int j=0; j<n; j++) {
        		dp[i][j]=dp[i][j]=-1;
        	}
        }

        for(int i=0; i<n; i++) a[i] = in.nextInt();

        
//        for(int left=0; left<n; left++) {
//    		dp[left][left] = new long[] {a[left], -1*a[left]};
//        }
        
//        for(int length=2; length<=n; length++) {
//        	for(int left=0; left<n; left++) {
//            	for(int who=0; who<=1; who++) {
//                	int right = left+length-1;
//                	if (right>=n) continue;
//                	if (who==0) {
//                        dp[left][right][who]=Math.max(a[left]+dp[left+1][right][1-who], a[right]+dp[left][right-1][1-who]);
//                    } else {
//                        dp[left][right][who]=Math.min(-1*a[left]+dp[left+1][right][1-who], -1*a[right]+dp[left][right-1][1-who]);
//                    }
//            	}
//            }
//        }
        
//        System.out.println(dp[0][n-1][0]);
        
        System.out.println(solve(0, n-1, 0));

    }
    
    private static long solve(int left, int right, int who) {
        if (left==right) {
            if (who==0) return a[left];
            else return -1*a[left];
        } 
        
        if (dp[left][right]!=-1) return dp[left][right];

        if (who==0) {
            return dp[left][right]=Math.max(a[left]+solve(left+1, right, 1-who), a[right]+solve(left, right-1, 1-who));
        } else {
            return dp[left][right]=Math.min(-1*a[left]+solve(left+1, right, 1-who), -1*a[right]+solve(left, right-1, 1-who));
        }

    }

}


Compiler output:
Main.java:6: error: class AtCoderL is public, should be declared in a file named AtCoderL.java
public class AtCoderL {
       ^
1 error
Language: C++

    #include<bits/stdc++.h>
    using namespace std;
   #define ll long long
    int main()
    {
     ll i,j,n,x,y,z=0,p,q;
cin>>n;
ll a[n];
for(i=0;i<n;i++)
cin>>a[i];
i=0;j=n-1;
x=0;
y=0;
while(i<=j)
{
if(z%2==0)
{
   if(i!=j)
   {
   p=a[i+1]-a[i];
 q=a[j-1]-a[j];
if(p>q)
{
x+=a[i];
i++;
}
else
{
x+=a[j];
j--;
}
else
{
   if(i!=j)
   {
   p=a[i+1]-a[i];
 q=a[j-1]-a[j];
if(p>q)
{
y+=a[i];
i++;
}
else
{
y+=a[j];
j--;
}
}
}cout<<x-y;
      return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:32:1: error: expected '}' before 'else'
   32 | else
      | ^~~~
a.cc:19:4: note: to match this '{'
   19 |    {
      |    ^
a.cc:51:6: error: expected '}' at end of input
   51 |     }
      |      ^
a.cc:15:1: note: to match this '{'
   15 | {
      | ^
a.cc:51:6: error: expected '}' at end of input
   51 |     }
      |      ^
a.cc:5:5: note: to match this '{'
    5 |     {
      |     ^
Language: C++

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
const ll N = 3e4 + 1;
ll n,k;
ll arr[N][N];
bool kek[N][N];
ll a[N];
ll recurs(ll l = 0 ,ll r = n - 1){
	if(l == r){
		arr[l][r] = a[l];
		return a[l];	
	}
	if(kek[l][r])return arr[l][r];
	kek[l][r] = 1;
	arr[l][r] = max(a[l] - recurs(l + 1,r),a[r] - recurs(l,r - 1));
	return arr[l][r];
}

int main() {
	speed;
	cin >> n;
	for(int i = 0 ; i < n ; i++)
		cin >> a[i];
	recurs();
	cout << arr[0][n - 1];
}
/*
Timus : 288471KD
Atcoder : Zhabka
Codeforces : Zhabka
mail : dzhon.snoudin@mail.ru
*/



Compiler output:
/tmp/ccFp5Z2F.o: in function `recurs(long long, long long)':
a.cc:(.text+0x22): relocation truncated to fit: R_X86_64_PC32 against symbol `kek' defined in .bss section in /tmp/ccFp5Z2F.o
a.cc:(.text+0x5b): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccFp5Z2F.o
a.cc:(.text+0xca): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccFp5Z2F.o
/tmp/ccFp5Z2F.o: in function `main':
a.cc:(.text.startup+0x4c): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccFp5Z2F.o
collect2: error: ld returned 1 exit status
Language: C++

#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
const ll N = 3e4 + 1;
ll n,k;
ll arr[N][N];
bool kek[N][N];
ll a[N];
ll recurs(ll l = 0 ,ll r = n - 1){
	if(l == r){
		arr[l][r] = a[l];
		return a[l];	
	}
	if(kek[l][r])return arr[l][r];
	kek[l][r] = 1;
	arr[l][r] = max(a[l] - recurs(l + 1,r),a[r] - recurs(l,r - 1));
	return arr[l][r];
}

int main() {
	speed;
	cin >> n;
	for(int i = 0 ; i < n ; i++)
		cin >> a[i];
	recurs();
	cout << arr[0][n - 1];
}
/*
Timus : 288471KD
Atcoder : Zhabka
Codeforces : Zhabka
mail : dzhon.snoudin@mail.ru
*/



Compiler output:
/tmp/ccgcmHX7.o: in function `recurs(long long, long long)':
a.cc:(.text+0x22): relocation truncated to fit: R_X86_64_PC32 against symbol `kek' defined in .bss section in /tmp/ccgcmHX7.o
a.cc:(.text+0x5b): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgcmHX7.o
a.cc:(.text+0xca): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgcmHX7.o
/tmp/ccgcmHX7.o: in function `main':
a.cc:(.text.startup+0x4c): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgcmHX7.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int n;
VL a;
vector<VL> memo;
ll solve(int l, int r){
    if(r < l)return 0LL;
    if(memo[l][r] != -1)return memo[l][r];

    ll ret = 0;
    if((r - l) % 2 != n % 2){
        ret = max(solve(l + 1, r) + a[l], solve(l, r - 1) + a[r]);
    }
    else{
        ret = min(solve(l + 1, r) - a[l], solve(l, r - 1) - a[r]);
    }
    
    return memo(l, r) = ret;
}

int main() {
    init();

    cin >> n;
    a.resize(n); cin >> a;
    memo = defvec<ll>(-1, n, n);
    cout << solve(0, n - 1) << "\n";
}


Compiler output:
a.cc: In function 'll solve(int, int)':
a.cc:50:16: error: no match for call to '(std::vector<std::vector<long long int> >) (int&, int&)'
   50 |     return memo(l, r) = ret;
      |            ~~~~^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
typedef long long ll;
ll par[2000010],sizem[2000010],sizel[2000010],size[2000010],a,b,q1,q2,q3,x,y;


int solve()
{
	if(vis[i][j])
		return dp[i][j];
	vis[i][j]=1;
	if(i==j)
		dp[i][i]=a[i];
	return dp[i][j]=max(a[i]-solve(i+1,j),a[j]-solve(i,j-1));
}

int main()
{
	ll n;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	cout<<solve(1,n)<<endl;
}

Compiler output:
a.cc: In function 'int solve()':
a.cc:10:12: error: 'vis' was not declared in this scope
   10 |         if(vis[i][j])
      |            ^~~
a.cc:10:16: error: 'i' was not declared in this scope
   10 |         if(vis[i][j])
      |                ^
a.cc:10:19: error: 'j' was not declared in this scope
   10 |         if(vis[i][j])
      |                   ^
a.cc:11:24: error: 'dp' was not declared in this scope; did you mean 'dup'?
   11 |                 return dp[i][j];
      |                        ^~
      |                        dup
a.cc:12:9: error: 'vis' was not declared in this scope
   12 |         vis[i][j]=1;
      |         ^~~
a.cc:12:13: error: 'i' was not declared in this scope
   12 |         vis[i][j]=1;
      |             ^
a.cc:12:16: error: 'j' was not declared in this scope
   12 |         vis[i][j]=1;
      |                ^
a.cc:14:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   14 |                 dp[i][i]=a[i];
      |                 ^~
      |                 dup
a.cc:15:16: error: 'dp' was not declared in this scope; did you mean 'dup'?
   15 |         return dp[i][j]=max(a[i]-solve(i+1,j),a[j]-solve(i,j-1));
      |                ^~
      |                dup
a.cc: In function 'int main()':
a.cc:24:23: error: invalid types 'll {aka long long int}[int]' for array subscript
   24 |                 cin>>a[i];
      |                       ^
a.cc:26:20: error: too many arguments to function 'int solve()'
   26 |         cout<<solve(1,n)<<endl;
      |               ~~~~~^~~~~
a.cc:8:5: note: declared here
    8 | int solve()
      |     ^~~~~
Language: C++

#include<iostream>
#include<fstream>
using namespace std;
long long sequence[5000] = {0};
long long maxSum = 0;
long long matrix[5000][5000] = {-1};
int n;
void read()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> sequence[i];
        maxSum = maxSum + sequence[i];
    }
}
void init()
{
    for(int i = 0; i < 5000; i++)
        for(int j = 0; j < 5000; j++)
            matrix[i][j] = -1;
}
long long dei(long long l, long long r)
{
    if(l > r)
        return 0;
    if(matrix[l][r] == -1)
    {
        int a;
        int b;
        if(matrix[l + 2][r] == -1)
            matrix[l +2][r] = dei(l + 2, r);
        if(matrix[l + 1][r - 1] == -1)
            matrix[l + 1][r-1] = dei(l + 1, r - 1);
        if(matrix[l ][r - 2] == -1)
            matrix[l][r -2] = dei(l , r - 2);
        if(matrix[l + 2][r] > matrix[l + 1][r - 1])
            a = matrix[l + 1][r - 1];
        else a = matrix[l + 2][r];
        if(matrix[l + 1][r - 1] > matrix[l ][r - 2])
            b = matrix[l ][r - 2];
        else b = matrix[l + 1][r - 1];
        if(sequence[l] + a < sequence[r] + b)
            matrix[l][r] = sequence[r] + b;
        else matrix[l][r] = sequence[l] + a;

    }
    return matrix[l][r];
}
int main()
{
    read();
    init();
    long long rez = dei(1, n);
    cout << 2 * dei(1, n) - maxSum;
}

Compiler output:
/tmp/ccqYFac9.s: Assembler messages:
/tmp/ccqYFac9.s: Fatal error: can't fill 256 bytes in section .data of /tmp/ccV4aXE3.o: 'No space left on device'
/tmp/ccqYFac9.s: Fatal error: /tmp/ccV4aXE3.o: No such file or directory
Language: C++

#include<iostream>
#include<fstream>
using namespace std;
long long sequence[5000] = {0};
long long maxSum = 0;
long long matrix[5000][5000] = {-1};
int n;
void read()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> sequence[i];
        maxSum = maxSum + sequence[i];
    }
}
void init()
{
    for(int i = 0; i < 5000; i++)
        for(int j = 0; j < 5000; j++)
            matrix[i][j] = -1;
}
long long dei(long long l, long long r)
{
    if(l > r)
        return 0;
    if(matrix[l][r] == -1)
    {
        int a;
        int b;
        if(matrix[l + 2][r] == -1)
            matrix[l +2][r] = dei(l + 2, r);
        if(matrix[l + 1][r - 1] == -1)
            matrix[l + 1][r-1] = dei(l + 1, r - 1);
        if(matrix[l ][r - 2] == -1)
            matrix[l][r -2] = dei(l , r - 2);
        if(matrix[l + 2][r] > matrix[l + 1][r - 1])
            a = matrix[l + 1][r - 1];
        else a = matrix[l + 2][r];
        if(matrix[l + 1][r - 1] > matrix[l ][r - 2])
            b = matrix[l ][r - 2];
        else b = matrix[l + 1][r - 1];
        if(sequence[l] + a < sequence[r] + b)
            matrix[l][r] = sequence[r] + b;
        else matrix[l][r] = sequence[l] + a;

    }
    return matrix[l][r];
}
int main()
{
    read();
    init();
    long long rez = dei(1, n);
    cout << 2 * dei(1, n) - maxSum;
}

Compiler output:
/tmp/ccBXbrLC.s: Assembler messages:
/tmp/ccBXbrLC.s: Fatal error: can't fill 256 bytes in section .data of /tmp/ccsyeR1k.o: 'No space left on device'
/tmp/ccBXbrLC.s: Fatal error: /tmp/ccsyeR1k.o: No such file or directory
Language: C++

#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
#include <map>
#define pb push_back
#define ll long long
using namespace std;
int N,a[3010],X,Y;
int dp[3010][3010];
int main()
{
    int i;
    cin>>N;
    for(i=1;i<=N;i++)
    {
        cin>>a[i];
    }
    for(i=1;i<=N;i++)
        for(j=1;j<=N;j++)
    {
        
    }
    cout<<X<<" "<<Y<<" "<<X-Y<<"\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'j' was not declared in this scope
   19 |         for(j=1;j<=N;j++)
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FASTIO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define vi vector<ll>
#define all(a) (a).begin(), (a).end()
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define tr(it, a)   for(auto it=a.begin();it!=a.end();it++)
#define pb push_back
#define endl  "\n"
const ll MAX=4e3+3;
const ll mod=1e2+7;
vi a(MAX);
ll dp[MAX][MAX];
/*
ll fun(ll i,ll j)
{
    if(i>j)
        return 0;
        if(dp[i][j]!=-1)
            return dp[i][j];
            ll x,y;
    x=a[i]+min(fun(i+2,j),fun(i+1,j-1));
    y=a[j]+min(fun(i+1,j-1),fun(i,j-2));
    dp[i][j]=max(x,y);
    return dp[i][j];

}
*/
ll fun(ll n)
{
    memset(dp,0,sizeof(dp));
    for(ll i=0;i<n;i++)
    {
        dp[i][i]=a[i];
    }
    ll x,y,z,j;
    for(ll len=2;len<=n;len++)
    {
        for(ll i=0;i<n-len;i++)
        {
            j=i+len-1;
            x=i+2<=j?dp[i+2][j]:0;
            y=i+1<=j-1?dp[i+1][j-1]:0;
            z=i<=j-2?dp[i][j-2]:0;
            dp[i][j]=max(a[i]+min(x,y),a[j]+min(y,z));
        }
    }
    return dp[0][n-1];
}
int main()
{
   FASTIO
   int t=1;
   //cin>>t;
   while(t--)
  {
        ll n,c;cin>>n;
        ll sum=0;
        rep(i,0,n)
        {
            cin>>a[i];
            sum+=a[i];
        }
        memset(dp,-1,sizeof(dp));
        ll ans=fun(0,n-1);
        ans=2*ans-sum;
        cout<<ans;
   }
 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:19: error: too many arguments to function 'long long int fun(long long int)'
   66 |         ll ans=fun(0,n-1);
      |                ~~~^~~~~~~
a.cc:30:4: note: declared here
   30 | ll fun(ll n)
      |    ^~~
Language: C++

/*input
6
4 2 9 7 1 5
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<ld,ld>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=4e18;
const int INF=1e6+1;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll sub(ll a,ll b){
    ll x=a-b;
    while(x<0) x+=MOD;
    while(x>MOD) x-=MOD;
    return x;
}
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a);
        if(res>1e10) return 1e11;
        a=(a*a);
        b>>=1;
    }
    return res;
}
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
ll dp[maxn][maxn];
int arr[maxn];
int main(){
    int n;
    cin>>n;
    ll sum=0;
    REP(i,n){
        cin>>arr[i];
        dp[i][i]=arr[i];
        sum+=arr[i];
    }
    for(int i=n-1;i>=0;i--){
        for(int j=i+1;j<n;j++){
            dp[i][j]=max(arr[j]-dp[i][j-1],arr[i]-dp[i+1][j]);
        }
    }
    cout<<dp[0][n-1];
}

Compiler output:
/tmp/ccCw155O.o: in function `main':
a.cc:(.text+0x1ac): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccCw155O.o
a.cc:(.text+0x1d4): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccCw155O.o
a.cc:(.text+0x203): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccCw155O.o
a.cc:(.text+0x250): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccCw155O.o
a.cc:(.text+0x29c): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccCw155O.o
collect2: error: ld returned 1 exit status
Language: C++

/*input
4
10 80 90 30
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<ld,ld>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=4e18;
const int INF=1e6+1;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll sub(ll a,ll b){
    ll x=a-b;
    while(x<0) x+=MOD;
    while(x>MOD) x-=MOD;
    return x;
}
ll mult(ll a,ll b){
    return ((a%MOD)*(b%MOD))%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a);
        if(res>1e10) return 1e11;
        a=(a*a);
        b>>=1;
    }
    return res;
}
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
ll dp[maxn][maxn];
int arr[maxn];
int main(){
    int n;
    cin>>n;
    ll sum=0;
    REP(i,n){
        cin>>arr[i];
        dp[i][i]=arr[i];
        sum+=arr[i];
    }
    REP(i,n){
        for(int j=i+1;j<n;j++){
            dp[i][j]=max(arr[j]-dp[i][j-1],arr[i]-dp[i+1][j]);
        }
    }
    cout<<dp[0][n-1];
}

Compiler output:
/tmp/ccVNSpol.o: in function `main':
a.cc:(.text+0x1ac): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccVNSpol.o
a.cc:(.text+0x1d4): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccVNSpol.o
a.cc:(.text+0x203): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccVNSpol.o
a.cc:(.text+0x24f): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccVNSpol.o
a.cc:(.text+0x29a): relocation truncated to fit: R_X86_64_PC32 against symbol `arr' defined in .bss section in /tmp/ccVNSpol.o
collect2: error: ld returned 1 exit status
Language: C++

#include<stdio.h>
#include<memory.h>
#include<algorithm>
int A[3001];
long dp[3001][3001];
long solve(int l, int r)
{
    if(l == r)return A[l];
    if(dp[l][r] != -1)return dp[l][r];
    long max_score = 0x8000000000000000;
    max_score = max(max_score, A[l]-solve(l+1, r));
    max_score = max(max_score, A[r]-solve(l, r-1));
    return dp[l][r] = max_score;
}
int main()
{
    int N;
    //freopen("input.txt", "r", stdin);
    scanf("%d", &N);
    memset(dp, -1, sizeof(dp));
    for(int i=0; i<N; i++)
    {
        scanf("%d", &A[i]);
    }
    printf("%ld\n", solve(0, N-1));
    return 0;
}

Compiler output:
a.cc: In function 'long int solve(int, int)':
a.cc:11:17: error: 'max' was not declared in this scope; did you mean 'std::max'?
   11 |     max_score = max(max_score, A[l]-solve(l+1, r));
      |                 ^~~
      |                 std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include<stdio.h>
#include<memory.h>

int A[3001];
long dp[3001][3001];
long solve(int l, int r)
{
    if(l == r)return A[l];
    if(dp[l][r] != -1)return dp[l][r];
    long max_score = 0x8000000000000000;
    max_score = max(max_score, A[l]-solve(l+1, r));
    max_score = max(max_score, A[r]-solve(l, r-1));
    return dp[l][r] = max_score;
}
int main()
{
    int N;
    //freopen("input.txt", "r", stdin);
    scanf("%d", &N);
    memset(dp, -1, sizeof(dp));
    for(int i=0; i<N; i++)
    {
        scanf("%d", &A[i]);
    }
    printf("%ld\n", solve(0, N-1));
    return 0;
}

Compiler output:
a.cc: In function 'long int solve(int, int)':
a.cc:11:17: error: 'max' was not declared in this scope
   11 |     max_score = max(max_score, A[l]-solve(l+1, r));
      |                 ^~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>
#include <queue>
#include <cctype>
#include <stack>
#include <random>
#include <list>
#include <numeric>
#include <chrono>
#include <set>


#define rep(i,p,q) for(ll i = p;i < q;i++)
#define ll long long

using namespace std;


const long long MAX_N = 1 << 17;

long long dat[2 * MAX_N - 1];

ll ecd(ll a, ll b) {
	if (a < b) swap(a, b);
	if (b == 0) return a;
	else {
		return ecd(b, a % b);
	}
}

ll pow(ll a, ll b) {
	vector<ll> d = vector<ll>((ll)(log(b)) + 2);
	d[0] = a;
	rep(i, 1, d.size()) d[i] = d[i - 1] * d[i - 1];
	ll ret = 1;
	rep(i, 0, log(b) + 1) {
		if (b & 1 << i) ret *= d[i];
	}
	return ret;
}

//L
vector<ll> a;
ll N;
vector<vector<vector<ll>>> dp;

//status == 0 なら太郎君,1なら次郎くん
ll rec(ll status,ll i, ll j) {
	if (dp[i][j][status] > -1e13) return dp[i][j][status];

	if (i == j) return (status ? 0 : a[i]);

	ll ret1 = i < N - 1 && i + 1 <= j ?  rec(!status, i + 1, j) : -1e10;
	ll ret2 = j >= 1  && i <= j - 1 ? rec(!status, i, j - 1) : -1e10;

	if (!status) {
		ret1 += a[i];
		ret2 += a[j];
	}
	
	if (status) {
		if (ret1 < 0) dp[i][j][status] = ret2;
		else if (ret2 < 0) dp[i][j][status] = ret1;
		else if ( a[i] - ret1 < a[j] - ret2)dp[i][j][status] = ret2;
		else dp[i][j][status] = ret1;
	}
	else {
		dp[i][j][status] = max(ret1, ret2);
	}
	return dp[i][j][status];
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  int n;
  cin>>n;
  ll a[n];
  ll sum=0;
  for(int i=0;i<n;i++)
  {cin>>arr[i];
   sum+=arr[i];
  }
  ll table[n][n]; 
  
    // Fill table using above recursive formula. Note  
    // that the table is filled in diagonal fashion (similar 
    // to http:// goo.gl/PQqoS), from diagonal elements to 
    // table[0][n-1] which is the result. 
    for (int gap = 0; gap < n; ++gap) { 
        for (int i = 0, j = gap; j < n; ++i, ++j) { 
  
            // Here x is value of F(i+2, j), y is F(i+1, j-1) and 
            // z is F(i, j-2) in above recursive formula 
            ll x = ((i + 2) <= j) ? table[i + 2][j] : 0; 
            ll y = ((i + 1) <= (j - 1)) ? table[i + 1][j - 1] : 0; 
            ll z = (i <= (j - 2)) ? table[i][j - 2] : 0; 
  
            table[i][j] = max(arr[i] + min(x, y), arr[j] + min(y, z)); 
        } 
    } 
  
    cout<<2*table[0][n - 1]-sum; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'arr' was not declared in this scope
   11 |   {cin>>arr[i];
      |         ^~~
a.cc:29:31: error: 'arr' was not declared in this scope
   29 |             table[i][j] = max(arr[i] + min(x, y), arr[j] + min(y, z));
      |                               ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end() 
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout  
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

#ifndef ONLINE_JUDGE
#define scanf scanf_s
#endif

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ll MOD = 998244353;
const int N = (int)(3e5) + 1;

void inp()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "inp.txt", "r", stdin);
#endif
}
void out()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "out.txt", "w", stdout);
#endif
}

ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, a[3030];
ll dp[3001][3001];
bool mark[3001][3001];

ll dfs(int l, int r)
{
	if (l > r || r < l)return 0;
	bool t = (r - l) % 2 == n % 2;
	ll& dp = ::dp[l][r];
	if (mark[l][r])return dp;
	mark[l][r] = 1;
	ll x = (t ? -1 : 1) * a[l] + dfs(l + 1, r);
	ll y = (t ? -1 : 1) * a[r] + dfs(l, r - 1);

	return dp = (!t ? max(x, y) : min(x, y));
}

int main()
{
	inp();
	cin >> n;
	memset(dp, -1, sizeof(dp));
	for (int i = 0; i < n; i++)
	{
		scanf("%d", a + i);
	}

	printf("%lld", dfs(0, n - 1));
}

Compiler output:
a.cc: In function 'void inp()':
a.cc:55:9: error: 'freopen_s' was not declared in this scope; did you mean 'freopen64'?
   55 |         freopen_s(&stream, "inp.txt", "r", stdin);
      |         ^~~~~~~~~
      |         freopen64
a.cc: In function 'void out()':
a.cc:62:9: error: 'freopen_s' was not declared in this scope; did you mean 'freopen64'?
   62 |         freopen_s(&stream, "out.txt", "w", stdout);
      |         ^~~~~~~~~
      |         freopen64
a.cc: In function 'int main()':
a.cc:42:15: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   42 | #define scanf scanf_s
      |               ^~~~~~~
a.cc:104:17: note: in expansion of macro 'scanf'
  104 |                 scanf("%d", a + i);
      |                 ^~~~~