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

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define Endl endl
#define INF 99999999


int main(){

        int n,z,w;
        int a[2000+10];

        cin >> n >>z >>w;

        for(int i =0;i<n;i++){
                cin >> a[i];
        }

        if(n ==1)cout << abs(a[0] - w);
        else cout << max(abs(a[n-1]-w), abs(a[n-1] - a[n-2]));
        return 0;

}
~
~

Compiler output:
a.cc:28:1: error: expected class-name before '~' token
   28 | ~
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include <string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<cstdlib>

#define ok cout<<"ok"<<endl
#define MAX 1000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define pb push_back

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;

using namespace std;
int main()
{
	int n,z,w,a1;
	cin>> n >> z >> w;
	rep(i,n)
	{
		cin>>a1;
		if(z<a1)
			z=a1;
		if(w>a1)
			w=a1;
	}
	cout << fabs(z-w);

	return 0;
}

Compiler output:
a.cc:21:9: error: 'vector' does not name a type
   21 | typedef vector<int> vi;
      |         ^~~~~~
a.cc:22:9: error: 'vector' does not name a type
   22 | typedef vector<string> vs;
      |         ^~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include <string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<cstdlib>

#define ok cout<<"ok"<<endl
#define MAX 1000000
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define pb push_back

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;

using namespace std;
int main()
{
	int n,z,w,a1;
	vi a;
	cin>> n >> z >> w;
	rep(i,n)
	{
		cin>>a1;
		if(z<a1)
			z=a1;
		if(w>a1)
			w=a1;
	}
	cout << fabs(z-w);

	return 0;
}

Compiler output:
a.cc:21:9: error: 'vector' does not name a type
   21 | typedef vector<int> vi;
      |         ^~~~~~
a.cc:22:9: error: 'vector' does not name a type
   22 | typedef vector<string> vs;
      |         ^~~~~~
a.cc: In function 'int main()':
a.cc:29:9: error: 'vi' was not declared in this scope
   29 |         vi a;
      |         ^~
Language: C++

#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>

typedef long long int ll;
using namespace std;

int main(){
	ll n,x,y;
	cin >> n >> x >> y;
	vector<ll> a(n);
	for(int i=0;i<n;i++)
		cin >> a[i];
	x = max(*max_element(a.begin(),a.end()));
	y = min(y,*min_element(a.begin()+1,a.end()));
	if(llabs(x - *(a.end()-1)) < llabs(y - *(a.end()-1)))
		cout << llabs(y - *(a.end()-1)) << endl;
	else
		cout << llabs(x - *(a.end()-1)) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: no matching function for call to 'max(long long int&)'
   15 |         x = max(*max_element(a.begin(),a.end()));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:15:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   15 |         x = max(*max_element(a.begin(),a.end()));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<utility>
#include<list>
#include<array>
#include<cassert>

using namespace std;

#define SPEEDY cin.tie(0);ios::sync_with_stdio(false);

#define REP(i,n) for(int i=0;i<(n);i++)
#define ARREP(i,n,X) for(int i=0;i<(n);i++)cin>>X[i]
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)

#define DEB(X) if(mode==1)cout<< #X <<": "<<X<<" ";
#define DEB2(X) if(mode==1)cout<< #X <<": "<<" ";
#define ARDEB(i,X) if(mode==1)cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define FORDEB(n,X) if(mode==1)for(int i=0;i<(n);i++)ARDEB(i,X)
#define END if(mode==1)cout<<endl;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define ALL(X) (X).begin(),(X).end()
struct edge{int to,cost;};
struct P2{int x,y;};
//struct edge{int from,cost,to;};

const int INF=100000000;
const int MOD7=1000000007;
int mode=1;

int main(){
	int n,x,y,a[3000];
	cin>>n;
	ARREP(i,n,a);
	int some1=abs(a[n-2]-a[n-1]);
	int some2=abs(a[n-1]-w);
	cout<<max(some1,some2)<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:30: error: 'w' was not declared in this scope
   48 |         int some2=abs(a[n-1]-w);
      |                              ^
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<utility>
#include<list>
#include<array>
#include<cassert>

using namespace std;

#define SPEEDY cin.tie(0);ios::sync_with_stdio(false);

#define REP(i,n) for(int i=0;i<(n);i++)
#define ARREP(i,n,X) for(int i=0;i<(n);i++)cin>>X[i]
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)

#define DEB(X) if(mode==1)cout<< #X <<": "<<X<<" ";
#define DEB2(X) if(mode==1)cout<< #X <<": "<<" ";
#define ARDEB(i,X) if(mode==1)cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define FORDEB(n,X) if(mode==1)for(int i=0;i<(n);i++)ARDEB(i,X)
#define END if(mode==1)cout<<endl;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define ALL(X) (X).begin(),(X).end()
struct edge{int to,cost;};
struct P2{int x,y;};
//struct edge{int from,cost,to;};

const int INF=100000000;
const int MOD7=1000000007;
int mode=1;

int main(){
	int n,x,y,a[3000];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	cout<<((abs(a[n-2]-a[n-1])>abs(w-a[n-1]))? a[n-2]-a[n-1]:w-a[n-1])<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:40: error: 'w' was not declared in this scope
   49 |         cout<<((abs(a[n-2]-a[n-1])>abs(w-a[n-1]))? a[n-2]-a[n-1]:w-a[n-1])<<endl;
      |                                        ^
Language: Java

import java.util.*;

public class Abs {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(); // カードの枚数
    int z = sc.nextInt(); // Xの初期カード
    int w = sc.nextInt(); // Yの初期カード
    int[] card = new int[N]; // N枚の山札カード
    int score; // スコア
    for(int i = 0; i < N; i++) {
      card[i] = sc.nextInt();
    }

    if(N == 1) {
      score = Math.abs(card[0] - w);
      System.out.println(score);
    } else {
      score = Math.max(Math.abs(card[N - 1] - w), Math.abs(card[N - 2] - card[N - 1]));
      System.out.println(score);
    }
  }
}


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

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

const int MAXN = 2010;
int card[MAXN];

int main()
{
    int n,z,w;
    cin >> n >> z >> w;
    for(int i = 0; i < n; ++i)
        cin >> card[i];
    if(n == 1)
    {
        cout << abs(card[0] - w) << endl;
        return 0;
    }
    cout << max(abs(card[n-1]-card[n-2]),abs(card[n-1]-w)) <<endl;
    return 0;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:10:5: error: 'cin' was not declared in this scope
   10 |     cin >> n >> z >> w;
      |     ^~~
a.cc:15:9: error: 'cout' was not declared in this scope
   15 |         cout << abs(card[0] - w) << endl;
      |         ^~~~
a.cc:15:17: error: 'abs' was not declared in this scope
   15 |         cout << abs(card[0] - w) << endl;
      |                 ^~~
a.cc:15:37: error: 'endl' was not declared in this scope
   15 |         cout << abs(card[0] - w) << endl;
      |                                     ^~~~
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout << max(abs(card[n-1]-card[n-2]),abs(card[n-1]-w)) <<endl;
      |     ^~~~
a.cc:18:17: error: 'abs' was not declared in this scope
   18 |     cout << max(abs(card[n-1]-card[n-2]),abs(card[n-1]-w)) <<endl;
      |                 ^~~
a.cc:18:13: error: 'max' was not declared in this scope
   18 |     cout << max(abs(card[n-1]-card[n-2]),abs(card[n-1]-w)) <<endl;
      |             ^~~
a.cc:18:62: error: 'endl' was not declared in this scope
   18 |     cout << max(abs(card[n-1]-card[n-2]),abs(card[n-1]-w)) <<endl;
      |                                                              ^~~~
Language: C++

#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;

const int X = 1;
const int Y = 2;

int N = 0;

int A[2001];
int dp[2][2000][2001];

int F(bool chara, int i, int xi) {
	if (dp[chara][i][xi] >= 0) {
		return dp[chara][i][xi];
	}
	int score = 0;
	int fnum = 0;
	if (i == N - 1) {
		score = abs(A[xi] - A[N - 1]);
	}
	else if (!chara) {
		for (int j = i; j <= N - 2; j++) {
			fnum = F(true, j + 1, j);
			if (score <= fnum) {
				score = fnum;
			}
		}
		if (score <= abs(A[xi] - A[N - 1])) score = abs(A[xi] - A[N - 1]);
	}
	else {
		for (int j = i; j <= N - 2; j++) {
			fnum = F(false, j + 1, j);
			if (score >= fnum) {
				score = fnum;
			}
		}
		if (score >= abs(A[xi] - A[N - 1])) score = abs(A[xi] - A[N - 1]);
	}
	return dp[chara][i][xi] = score;
}

int main()
{
	memset(dp, -1, sizeof(dp));
	int z, w;
	cin >> N >> z >> w;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	A[2000] = w;
	int s = F(false, 0, 2000);
	cout << s;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:46:9: error: 'memset' was not declared in this scope
   46 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
using namespace std;
int N, Z, W, a[4000], dp[2][2000][2002];

int dfs(bool isx, int i, int xi)
{
	if (dp[isx][i][xi] >= 0) {
		return dp[isx][i][xi];
	}
	int ret;
	if (i == N - 1)
		ret = abs(a[xi] - a[N - 1]);
	else {
		if (isx) {
			ret = max(dfs(false, i + 1, xi), dfs(true, i + 1, i));
		}
		else {
			ret = min(dfs(true, i + 1, xi), dfs(false, i + 1, i));
		}
	}
	return dp[isx][i][xi] = ret;
}

int main()
{
	//
	memset(dp, -1, sizeof(dp));
	cin >> N >> Z >> W;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	a[2000] = Z;
	a[2001] = W;
	printf("%d\n", dfs(true, 0, 2001));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'memset' was not declared in this scope
   30 |         memset(dp, -1, sizeof(dp));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <iostream>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <cstdint>

inline uint64_t sub_abs(uint64_t a, uint64_t b)
{
  return (a > b) ? a - b : b - a;
}

int main(void)
{
  uint64_t N, Z, W;
  std::cin >> N >> Z >> W;
  
  if (N == 1) {
    std::cout << sub_abs(a[0], W) << std::endl;
  } else {
    std::cout << std::max(sub_abs(a[N - 1], W), sub_abs(a[N - 2], a[N - 1])) << std::endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:26: error: 'a' was not declared in this scope
   17 |     std::cout << sub_abs(a[0], W) << std::endl;
      |                          ^
a.cc:19:35: error: 'a' was not declared in this scope
   19 |     std::cout << std::max(sub_abs(a[N - 1], W), sub_abs(a[N - 2], a[N - 1])) << std::endl;
      |                                   ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, z, w, a[20000];

    scanf("%d %d %d", &n, &z, &w);

    for (int i=0; i<n; i++) scanf("%d", &a[i]);

    int res = abs(a[n-1] - w);
    res = max(res, abs(a[n-1]-a[i]));

    cout << res << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:33: error: 'i' was not declared in this scope
   13 |     res = max(res, abs(a[n-1]-a[i]));
      |                                 ^
Language: C++

#include<cmath>
using namespace std;

int main(){
    
    int n,z,w,a[3333];
    int ke[3333]={0},ke2,all=0;
    cin>>n>>z>>w;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    ke[0]==abs(z-w); 
    int x=-1;
    for(int i=1;i<=n;i++){
        x++;
        if(i==n)ke[i]=abs(a[x]-w);
        else ke[i]=abs(a[x]-a[n-1]);
    }
    sort(ke,ke+n+1);
    int k=n;
    int min=1000000009;
    int zco=0;
    for(int i=0;i<n+1;i++){
        cout<<ke[i]<<" ";
        all+=ke[i];
        if(ke[i]!=0)zco++;
    }
    for(int i=0;i<n+1;i++){
        if(min>abs(ke[i]-all/zco)){
            min=abs(ke[i]-all/zco);
            ke2=ke[i];
        }
    }
    cout<<ke2<<endl;
    //cout<<min2<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin>>n>>z>>w;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cmath>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   19 |     sort(ke,ke+n+1);
      |     ^~~~
      |     sqrt
a.cc:24:9: error: 'cout' was not declared in this scope
   24 |         cout<<ke[i]<<" ";
      |         ^~~~
a.cc:24:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:5: error: 'cout' was not declared in this scope
   34 |     cout<<ke2<<endl;
      |     ^~~~
a.cc:34:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:16: error: 'endl' was not declared in this scope
   34 |     cout<<ke2<<endl;
      |                ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<cmath>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include<iostream>
#include<vector>
#include<cstdlib>

using namespacestd;

int main(){
        int N,Z,W,i=1,b=1;
    cin >>N >>Z >>W;
    vector<int> a(N);

    for(i=b;i<N;i++){
        cin >>a[i];
    }

    while(i<n){
        for(i=b;i<n;i++){
            if(a[i-1]>a[i]){
                Z=a[i-1];
                b=i+1;
                break;
            }
        }
        for(i=b;i<n;i++){
            if(a[i-1]<a[i]){
                Z=a[i-1];
                b=i+1;
                break;
            }
        }

    }

        cout << abs(W-Z) <<endl;

}

Compiler output:
a.cc:5:7: error: expected nested-name-specifier before 'namespacestd'
    5 | using namespacestd;
      |       ^~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |     cin >>N >>Z >>W;
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:10:5: error: 'vector' was not declared in this scope
   10 |     vector<int> a(N);
      |     ^~~~~~
a.cc:10:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:10:12: error: expected primary-expression before 'int'
   10 |     vector<int> a(N);
      |            ^~~
a.cc:13:15: error: 'a' was not declared in this scope
   13 |         cin >>a[i];
      |               ^
a.cc:16:13: error: 'n' was not declared in this scope
   16 |     while(i<n){
      |             ^
a.cc:18:16: error: 'a' was not declared in this scope
   18 |             if(a[i-1]>a[i]){
      |                ^
a.cc:25:16: error: 'a' was not declared in this scope
   25 |             if(a[i-1]<a[i]){
      |                ^
a.cc:34:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   34 |         cout << abs(W-Z) <<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:34:28: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   34 |         cout << abs(W-Z) <<endl;
      |                            ^~~~
      |                            std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: Java


Submission #1761416
Source code

    import java.util.Scanner;
     
    public class Main {
     
    	public static void main(String[] args) {
    		try (Scanner sc = new Scanner(System.in)) {
    			int n = sc.nextInt();
    			int z = sc.nextInt();
    			int w = sc.nextInt();
     
    			int[] a = new int[n];
    			for (int i = 0; i < n; i++) {
    				a[i] = sc.nextInt();
    			}
     
    			int x = Math.abs(a[n - 1] - w);
    			int y = x;
    			if (1 < n) {
    				y = Math.abs(a[n - 2] - a[n - 1]);
    			}
     
    			if (x < y) {
    				System.out.println(y);
    			} else {
    				System.out.println(x);
    			}
    		}
    	}
    }

Compiler output:
Main.java:2: error: illegal character: '#'
Submission #1761416
           ^
1 error
Language: C++

#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

typedef long long int;

int main()
{
    int n, z, w, a[2000];
    cin >> n >> z >> w;

    for (int i = 0; i < n; i++)
        cin >> a[i];

    int ans = max(abs(a[n-1] - w), (n > 1 ? abs(a[n-1] - a[n-2]) : 0));

    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc:7:19: error: declaration does not declare anything [-fpermissive]
    7 | typedef long long int;
      |                   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)      //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++) //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)    //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))        //array size
#define SORTD(a) sort(a,a+ASIZE(a),greater<int>()) //sort in descending order for array
#define SORTA(a) sort(a,a+ASIZE(a))                //sort in ascending order for array
#define SORTS(a) sort(a.begin(),a.end())           //sort in ascending order for string type
typedef long long LL;
typedef unsigned int UINT;
 
void SCAN(int *a){scanf("%d",a);}                             //scan for type int
void SCAN(int *a,int n){int i;REP(i,n){scanf("%d",&a[i]);}}   //scan for type int array
void SCAN(UINT *a){scanf("%u",a);}                            //scan for type unsigned int
void SCAN(UINT *a,int n){int i;REP(i,n){scanf("%u",&a[i]);}}  //scan for type unsigned int array
void SCAN(LL *a){scanf("%lld",a);}                            //scan for type long long int
void SCAN(LL *a,int n){int i;REP(i,n){scanf("%lld",&a[i]);}}  //scan for type long long int array
void SCAN(char *c){scanf(" %c",c);}                           //scan for type char
void SCAN(char *c,int n){int i;REP(i,n){scanf(" %c",&c[i]);}} //scan for type char array
 
const int MOD = 1000000007;
const int INF = 1000000000;
 
const int DX4[4]= {-1,0,0,1};
const int DY4[4]= {0,-1,1,0};
 
//fill an N-dimensional array with val
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
	fill((T*)array,(T*)(array+N),val);
}
 
int pascalTri(int n,int r){
	int tri[n+1][n+1];
	int i,j;
	REP(i,n+1){REP(j,n+1){tri[i][j]=0;}}
	REP(i,n+1){
		REP(j,n+1){
			if(j>i){break;}
			if(j==0||j==i){tri[i][j]=1;}else{tri[i][j]=(tri[i-1][j-1]%MOD+tri[i-1][j]%MOD)%MOD;}
		}
	}
	return tri[n][r];
}
 
 
int main(){
	// cin.tie(0);
	// ios::sync_with_stdio(false);
	int n,z,w;
	int i,j;
	
	SCAN(&n);SCAN(&z);SCAN(&w);
	int a[n];
	SCAN(a,n);
	

	if(n=1){
		printf("%d\n",abs(a[0]-w));
	}else{
		printf("%d\n",max(abs(a[n-1]-w),abs(a[n-2]-a[n-1]));
	}
 	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:68: error: expected ')' before ';' token
   64 |                 printf("%d\n",max(abs(a[n-1]-w),abs(a[n-2]-a[n-1]));
      |                       ~                                            ^
      |                                                                    )
Language: C++

#include <iostream>
#include <math.h>
using namespace std;

int main(){

long long N, Z, W;
long long *a = new int[N];

cin >> N >> Z >> W;
int i;
for(i = 0; i < N; i++){
cin >> a[i];
}

int num = 0;
int turn = 0;
int ifN = 0;
while(num < N){
if(turn == 0){
	if(a[num] > Z){
		Z = a[num];
		
		if(num == N-1){
			ifN = 1;
		}else{
			if(a[num] > a[num+1])turn = 1;
		}

	}
}else{
	if(a[num] < W){
		W = a[num];
		if(num == N-1){
			ifN = 1;
		}else{
			if(a[num] < a[num+1])turn=0;
		}
	}
}

num++;
}
if(ifN != 1){
if(turn == 0){
	Z = a[N-1];
}else{
	W = a[N-1];
}
}

cout << abs(Z - W);

}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:25: error: cannot convert 'int*' to 'long long int*' in initialization
    8 | long long *a = new int[N];
      |                         ^
      |                         |
      |                         int*
Language: C++

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
int main()
{
	long long int n,z,w;
	long long int x;
	long long int sum;
	scanf("%lld",&n);
	scanf("%lld %lld",&z,&w);
	if(n>2000) break;
	while(n--){
		scanf("%lld",&x);
		if(x<1) break;
		if(x>z){z=x;break;}
		if(x>w){w=x;break;}
	}
	sum=abs(z-w);
	printf("%lld\n",sum);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: break statement not within loop or switch
   12 |         if(n>2000) break;
      |                    ^~~~~
Language: C++

#include "bits/stdc++.h"

using namespace std;

int main() {
	int n,z,w;
	cin >> n >> z >> w;
	int a[2000];
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
  
	int M = max(z, w), m = min(z, w);
	for (int i = 0;i < n;i++) {
		if (max <= a[i]) max = a[i];
		if (min > a[i]) min = a[i];
	}

	int ans = min(abs(max - min), abs(w - min));
	cout << Ans << endl;

	return 0;
	
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<='
   15 |                 if (max <= a[i]) max = a[i];
      |                     ~~~~^~~~~~~
a.cc:15:43: error: overloaded function with no contextual type information
   15 |                 if (max <= a[i]) max = a[i];
      |                                           ^
a.cc:16:25: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator>'
   16 |                 if (min > a[i]) min = a[i];
      |                     ~~~~^~~~~~
a.cc:16:42: error: overloaded function with no contextual type information
   16 |                 if (min > a[i]) min = a[i];
      |                                          ^
a.cc:19:31: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator-'
   19 |         int ans = min(abs(max - min), abs(w - min));
      |                           ~~~~^~~~~
a.cc:19:45: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator-'
   19 |         int ans = min(abs(max - min), abs(w - min));
      |                                           ~~^~~~~
a.cc:20:17: error: 'Ans' was not declared in this scope; did you mean 'ans'?
   20 |         cout << Ans << endl;
      |                 ^~~
      |                 ans
Language: C++

#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ちゃんとユニークな配列にする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
  int N, X, Y;
  cin >> N, X, Y;
  vector<int> a;
  rep(i, N) {
    int ai;
    cin >> ai;
    a.pb(ai);
  }

  int i = 0;
  bool isX = true;
  do {
    if(isX) {
      int takenCard = a[i];
      vector<int> absFromY;
      for(int j = i; j < N; j++) {
        absFromY.pb(abs(a[i] - Y));
      }
      vector<int>::iterator maxIt = *max_element(all(absFromY));
      size_t maxIndex = distance(absFromY.begin(), maxIt);
      int selectedIndex = maxIndex + i;
      X = a[selectedIndex];
      i = selectedIndex;
      isX = false;
    } else {
      int takenCard = a[i];
      vector<int> absFromX;
      for(int j = i; j < N; j++) {
        absFromX.pb(abs(a[i] - X));
      }
      vector<int>::iterator minIt = *min_element(all(absFromX));
      size_t minIndex = distance(absFromX.begin(), minIt);
      int selectedIndex = minIndex + i;
      Y = a[selectedIndex];
      i = selectedIndex;
      isX = true;
    }
  } while(i < N);

  cout << abs(X - Y) << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:37: error: conversion from 'int' to non-scalar type 'std::vector<int>::iterator' requested
   37 |       vector<int>::iterator maxIt = *max_element(all(absFromY));
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:49:37: error: conversion from 'int' to non-scalar type 'std::vector<int>::iterator' requested
   49 |       vector<int>::iterator minIt = *min_element(all(absFromX));
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <cstdio>
#include <vector>
#include <utility>
#include <math.h>
using namespace std;

int main ()
{
  int N;
  int Z, W;
  vector<int> a(2000);
  int i;
  int x, s, tmp, t;

  scanf("%d", &N);
  scanf("%d", &Z);
  scanf("%d", &Y);

  for (i = 0; i < n; i+=) {
    scanf("%d", &a[i]);
  }

  t = 0;
  x = 0;
  s = W;
  while (t < n - 1) {
    for (i = t; i < n; i++) {
      tmp = max(x, a[i]);
      if (tmp >= x) {
        x = tmp;
        t = i;
      }
    }

    for (i = t; i < n; i++) {
      tmp = min(s, a[i]);
      if (tmp <= s) {
        s = tmp;
        t = i;
      }
    }
  }

  if (x-s > 0) {
    printf("%d\n", x-s);
  } else {
    printf("%d\n", s-x);
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: 'Y' was not declared in this scope
   17 |   scanf("%d", &Y);
      |                ^
a.cc:19:19: error: 'n' was not declared in this scope
   19 |   for (i = 0; i < n; i+=) {
      |                   ^
a.cc:19:25: error: expected primary-expression before ')' token
   19 |   for (i = 0; i < n; i+=) {
      |                         ^
a.cc:26:14: error: 'n' was not declared in this scope
   26 |   while (t < n - 1) {
      |              ^
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] arg) {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int Z = scanner.nextInt();
    int W = scanner.nextInt();
    a = new int[N + 2];
    a[0] = Z;
    a[1] = W;
    for (int i = 0; i < N; i++) {
      a[2 + i] = scanner.nextInt();
    }
    System.out.println(maxPlayer(0, 1));
  }

  static int[] a;
  static Map<Integer, Integer> memo = new TreeMap<Integer, Integer>();

  static int pair(int z, int w) { return MAX_N << 11 + w; }

  /** それぞれ z 枚目, w 枚目を持っている局面での最適解 */
  static int maxPlayer(int z, int w) {
    int n = Math.max(z, w) + 1;  // 取り終わっている枚数
    if (n == a.length) return Math.abs(a[z] - a[w]);
    int pair = pair(z, w);
    if (memo.containsKey(pair)) return memo.get(pair);

    int m = 0;
    for (int i = n; i < a.length; i++) {
      m = Math.max(m, minPlayer(i, w));
    }
    memo.put(pair, m);
    return m;
  }

  static int minPlayer(int z, int w) {
    int n = Math.max(z, w) + 1;  // 取り終わっている枚数
    if (n == a.length) return Math.abs(a[z] - a[w]);
    int pair = pair(z, w);
    if (memo.containsKey(pair)) return memo.get(pair);

    int m = Integer.MAX_VALUE;
    for (int i = n; i < a.length; i++) {
      m = Math.min(m, maxPlayer(z, i));
    }
    memo.put(pair, m);
    return m;
  }
}


Compiler output:
Main.java:21: error: cannot find symbol
  static int pair(int z, int w) { return MAX_N << 11 + w; }
                                         ^
  symbol:   variable MAX_N
  location: class Main
1 error
Language: C++


#include <math.h>
#include <iostream>
#include <algorithm>

int main()
{
	int* yamahuda;
	int yamahudaCount, x1st, y1st;

	std::cin >> yamahudaCount >> x1st >> y1st;
	yamahuda = new int[yamahudaCount];
	for (int i = 0; i < yamahudaCount; i++)
	{
		std::cin >> yamahuda[i];
	}

	int xCard = x1st, yCard = y1st;

	int currentPos = 0;

	while (true)
	{
		//x
		int bestPos = -100;
		int bestScore = -100000000;
		int maxValue = -100000000;
		for (int i = yamahudaCount - 2; i >= currentPos; i = i - 1)
		{
			maxValue = std::max(maxValue, yamahuda[i + 1]);
			if (yamahuda[i] - maxValue > bestScore) 
			{
				bestPos = i;
				bestScore = yamahuda[i] - maxValue;
			}
		}
		if (yamahuda[yamahudaCount - 1] - yCard >= bestScore)
		{
			std::cout << yamahuda[yamahudaCount - 1] - yCard;
			return;
			//end
		}

		currentPos = bestPos;
		xCard = yamahuda[currentPos];

		//y
		int worstPos = -100;
		int worstScore = 100000000;
		int minValue = 100000000;
		for (int i = yamahudaCount - 2; i >= currentPos; i = i - 1)
		{
			minValue = std::min(minValue, yamahuda[i + 1]);
			if (yamahuda[i] - minValue < worstScore)
			{
				worstPos = i;
				worstScore = yamahuda[i] - minValue;
			}
		}
		if (yamahuda[yamahudaCount - 1] - xCard <= worstScore)
		{
			std::cout << yamahuda[yamahudaCount - 1] - xCard;
			return;
			//end
		}
	}

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:25: error: return-statement with no value, in function returning 'int' [-fpermissive]
   40 |                         return;
      |                         ^~~~~~
a.cc:63:25: error: return-statement with no value, in function returning 'int' [-fpermissive]
   63 |                         return;
      |                         ^~~~~~
Language: C++

#include<bits/stdc++.h>
const int inf=1e9+10;
int n,x,y;
int a[2010];
using namespace std;

inline bool cmp(int a,int b)
{
  return a>b;
}
inline int abs(int a)
{  
  return a>=0?a:-1*a;	
}
int main()
{
  int maxxx=-1,minnn=inf;	
  scanf("%d%d%d",&n,&x,&y);
  for(int i=1;i<=n;i++)
  {
  	scanf("%d",&a[i]);
  	maxxx=max(a[i],maxxx);
  	minnn=min(minnn,a[i]);
  }
//  cerr<<"    *"<<maxxx<<endl;
  if(maxxx<=y)
  {
  	printf("%d",abs(y-a[n]));
  	return 0;
  }	
  else if(minn>=y)
  {
    printf("%d",abs(y-a[n]));
    return 0;
  }
  int temp=n;
  while(temp)
  {
  	int minn=inf,maxx=-1;
  	int tx,ty,tpos;
  	for(int i=1;i<=n;i++)
  	{
  	  if(a[i]==-1) continue;
	  if(abs(a[i]-y)>=maxx)
	    maxx=abs(a[i]-y),tx=a[i],tpos=i;	
	}
    for(int i=1;i<=tpos;i++)
    {
      if(a[i]==-1) continue;
      a[i]=-1;
      temp--;
	}
	x=tx;
//	cerr<<x<<" ^ "<<y<<endl;
	if(temp==0) break;
	for(int i=1;i<=n;i++)
	{
	  if(a[i]==-1) continue;
	  if(abs(a[i]-x)<=minn) 
	     minn=abs(a[i]-x),ty=a[i],tpos=i;
	}
	for(int i=1;i<=tpos;i++)
	{
	  if(a[i]==-1) continue;
	  a[i]=-1;
	  temp--;
	}
	y=ty;
//	cout<<x<<"  * "<<y<<endl;
  }  
  printf("%d",abs(x-y));	
return 0;
}/*
3 100 1000
10 100 100
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: 'minn' was not declared in this scope; did you mean 'minnn'?
   31 |   else if(minn>=y)
      |           ^~~~
      |           minnn
Language: C++

#include <stdlib.h>
#include <iostream>
using namespace std;

int main()
{
  int n, z, w, a[2000];
  cin >> n >> z >> w;
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }

  int ans;
  int mini = 1e+9, maxi = 0;
  for(int i = 0; i < n - 1; i++){
    mini = min(mini, a[i]);
    maxi = max(maxi, a[i]);
  }

  if(n == 1) ans = abs(a[0] - w);
  else if(maxi =< a[n - 1]) ans = abs(maxi - w);
  else{
    ans = max(abs(mini - a[n - 1]), abs(maxi - a[n - 1]));
  }

  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: expected primary-expression before '<' token
   21 |   else if(maxi =< a[n - 1]) ans = abs(maxi - w);
      |                 ^
Language: C++

#include <iostream>

using namespace std;

const int N = 2002;
int n, s0, s1, a[N], f[N][2];

int get(int k, int i) {
    if (i > n) return k == 0? s0 : s1;
    else return a[i];
}

int main() {
    cin >> n >> s0 >> s1;
    for(int i = 1; i <= n; i++) cin >> a[i];
    reverse(a + 1, a + n + 1);

    for(int k = 0; k < 2; k++) f[1][k] = abs(get(1 - k, 2) - a[1]);

    for(int i = 2; i <= n; i++)
        for(int k = 0; k < 2; k++) {
            f[i][k] = abs(get(1 - k, i + 1) - a[1]);
            for(int j = 1; j < i; j++) f[i][k] = k == 0? max(f[i][k], f[j][1]) : min(f[i][k], f[j][0]);
        }

    // for(int i = 1; i <= n; i++) cout << f[i][0] << ' '; cout << endl;
    // for(int i = 1; i <= n; i++) cout << f[i][1] << ' '; cout << endl;
    cout << f[n][0];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'reverse' was not declared in this scope
   16 |     reverse(a + 1, a + n + 1);
      |     ^~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <ctime>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
#include <cmath>
#include <functional>
#include <map>
#include <set>
using namespace std;
const int INF = 1000000009;

int n, z, w;
int a[2000];

int main(){
	scanf("%d%d%d", &n, &z, &w);
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	int top = 0;
	while(top < n){
		int amax = 0;
		int tmp = -1;
		for(int i = top; i < n-1; i++){//aがiを選んだ時のスコアの最小値を考えるよ
			//printf("Apass %d\n", i);
			int amin = INF;
			for(int j = i+1; j < n; j++){//bがjを選んだらどうしよう、、、
				amin = min(amin, abs(a[i] - a[j]));
			}
			//printf("amin %d\n", amin);
			if(amin >= amax){
				//printf("A newal %d\n", i);
				amax = amin;
				tmp = i;
			}
		}
		if(abs(a[n-1] - w) >= amax){
			tmp = n-1;
		}
		top = tmp+1;
		//printf("A:%d\n", top);
		z = a[top-1];
		if(top >= n){
			break;
		}
		int bmin = INF;
		for(int i = top; i < n-1; i++){//bがiを選んだ時のスコアの最大値を考えるよ
			int bmax = 0;
			for(int j = i+1; j < n; j++){//aがjを選んだらどうなる?
				bmax = max(bmax, abs(a[i] - a[j]));
			}
			if(bmax <= bmin){
				bmin = bmax;
				tmp = i;
				//printf("B newal %d\n", i);
			}
		}
		if(abs(a[n-1] - z) =< bmin){
			tmp = n-1;
		}
		top = tmp+1;
		//printf("B:%d\n", top);
		w = a[top-1];
	}
	printf("%d\n", abs(z-w));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:37: error: expected primary-expression before '<' token
   65 |                 if(abs(a[n-1] - z) =< bmin){
      |                                     ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#define INF 1e9
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int abs(int a){
  if(a<0)
    a=-a;
  return a;
}
int main(){
  int n,z,w;
  cin>>n>>z>>w;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  int ans=0;
  int pointer=1;
  z=a[0];
  if(n==1)
    cout<<abs(a[0]-w)<<endl;
  else{
    while(pointer<n){
      int ma2=INF;
      int ma=0;
      for(int i=pointer;i<n;i++){
	if(ma<=abs(z-a[i])){
	  ma=abs(z-a[i]);;pointer=i;z=a[i];
	}
      }
      pointer++;
      for(int i=pointer;i<n;i++){
	if(ma2>=abs(w-a[i])){
	  ma2=abs(w-a[i]);pointer=i;
	  w=a[i];
	}
      }
      pointer++;
    }
    cout<<abs(ma-w)<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:15: error: 'ma' was not declared in this scope; did you mean 'a'?
   53 |     cout<<abs(ma-w)<<endl;
      |               ^~
      |               a
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n,z,w;
  cin>>n>>z>>w;
  int a[n];
  for(int i=0;i<n;i++)cin>>a[i];
  int m[n];
  for(int i=0;i<n;i++){
    int y=w;
    for(int j=i+1;j<n;j++){
      if(abs(a[i]-w)>>abs(a[i]-a[j]) && abs(a[i]-y)>>abs(a[i]-a[j])){
        y = a[j];
        m[i]=abs(a[i]-a[j]);
      }
    }
  }
  int M =0;
  for(int i=0;i<n;i++){
    if(M<m[i])M=m[i];
  }
  int f = w;
  for(int i=0;i<n;i++){
    if(abs(z-f)>abs(z-a[i]))f = a[i];
  }
  t=abs(z-f);
  if(M<t)M = t;
  cout<<M;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 't' was not declared in this scope
   26 |   t=abs(z-f);
      |   ^
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

const int Maxn=2000;
const int INF=2100000000;

int n;
int A,B;
int num[Maxn+5];
int pool[Maxn+50],tot;
int dp[Maxn+5][Maxn+5][2];

int dfs(int rv,int st,int isMax){
	if (dp[rv][st][isMax]!=-1) return dp[rv][st][isMax];

	int ret=isMax?-INF:INF;
	for (int i=st+1;i<=n;i++){
		int now=0;
		if (i==n) now=abs(pool[num[i]]-pool[rv]); else now=dfs(num[i],i,isMax^1);
		if (isMax){
			ret=max(ret,now); 
		}else ret=min(ret,now); 
	}

	//printf("%c >%d [%d] = %d\n",isMax?'A':'B',st,pool[rv],ret);
	return dp[rv][st][isMax]=ret;
}

int main(){
	//freopen("in.txt","r",stdin);
	scanf("%d%d%d",&n,&A,&B);
	for (int i=1;i<=n;i++) scanf("%d",&num[i]);
	memset(dp,-1,sizeof(dp));

	tot=0;
	for (int i=1;i<=n;i++) pool[++tot]=num[i];
	pool[++tot]=A; pool[++tot]=B;
	sort(pool+1,pool+tot+1);
	tot=unique(pool+1,pool+tot+1)-pool;

	for (int i=1;i<=n;i++) num[i]=lower_bound(pool+1,pool+tot,num[i])-pool;
	A=lower_bound(pool+1,pool+tot,A)-pool; 
	B=lower_bound(pool+1,pool+tot,B)-pool;

	printf("%d\n",dfs(B,0,true));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: 'memset' was not declared in this scope
   37 |         memset(dp,-1,sizeof(dp));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <cmath>
  +++ |+#include <cstring>
    5 |
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n,z,w;
  cin>>n>>z>>w;
  int a[n];
  for(int i=0;i<n;i++)cin>>a[i];
  int x,y,s;
  for(int i=0;i<n;i++){
    if(abs(a[i]-w) > abs(x-w)){
      x=a[i];

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: expected '}' at end of input
   11 |       x=a[i];
      |              ^
a.cc:10:31: note: to match this '{'
   10 |     if(abs(a[i]-w) > abs(x-w)){
      |                               ^
a.cc:11:14: error: expected '}' at end of input
   11 |       x=a[i];
      |              ^
a.cc:9:23: note: to match this '{'
    9 |   for(int i=0;i<n;i++){
      |                       ^
a.cc:11:14: error: expected '}' at end of input
   11 |       x=a[i];
      |              ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n,k;
  cin>>n>>k;
  ll ans=1;
  rep(i,k) ans*=2;
  ans*=(1900*k+100(n-k));
  COUT(ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:19: error: expression cannot be used as a function
   39 |   ans*=(1900*k+100(n-k));
      |                ~~~^~~~~
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n,k;
  cin>>n>>k;
  ll ans=1;
  rep(i,m) ans*=2;
  ans*=(1900*m+100(n-m));
  COUT(ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'm' was not declared in this scope
   38 |   rep(i,m) ans*=2;
      |         ^
a.cc:7:39: note: in definition of macro 'rep'
    7 | #define rep(i, n) for (ll i = 0; i < (n); i++)
      |                                       ^
a.cc:39:14: error: 'm' was not declared in this scope
   39 |   ans*=(1900*m+100(n-m));
      |              ^
a.cc:39:23: error: expression cannot be used as a function
   39 |   ans*=(1900*m+100(n-m));
      |                       ^
Language: Java

import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    N = sc.nextInt();
    M = sc.nextInt();
    int ans = 1;
    for (i = 0;i < M;i ++) {
      ans *= 2;
    }
    ans *= ((N - M) * 100 +  M * 1900);
    System.out.println(ans);
  }
}

Compiler output:
Main.java:6: error: cannot find symbol
    N = sc.nextInt();
    ^
  symbol:   variable N
  location: class Main
Main.java:7: error: cannot find symbol
    M = sc.nextInt();
    ^
  symbol:   variable M
  location: class Main
Main.java:9: error: cannot find symbol
    for (i = 0;i < M;i ++) {
         ^
  symbol:   variable i
  location: class Main
Main.java:9: error: cannot find symbol
    for (i = 0;i < M;i ++) {
               ^
  symbol:   variable i
  location: class Main
Main.java:9: error: cannot find symbol
    for (i = 0;i < M;i ++) {
                   ^
  symbol:   variable M
  location: class Main
Main.java:9: error: cannot find symbol
    for (i = 0;i < M;i ++) {
                     ^
  symbol:   variable i
  location: class Main
Main.java:12: error: cannot find symbol
    ans *= ((N - M) * 100 +  M * 1900);
             ^
  symbol:   variable N
  location: class Main
Main.java:12: error: cannot find symbol
    ans *= ((N - M) * 100 +  M * 1900);
                 ^
  symbol:   variable M
  location: class Main
Main.java:12: error: cannot find symbol
    ans *= ((N - M) * 100 +  M * 1900);
                             ^
  symbol:   variable M
  location: class Main
9 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
 int $(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }

signed main(){
  iint a,b,c=1;
  cin>>a>>b;
  for(int i=0;i<b;i++)
    c*=2;
  cout<<100*a+1800*b*c<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'iint' was not declared in this scope; did you mean 'uint'?
   12 |   iint a,b,c=1;
      |   ^~~~
      |   uint
a.cc:13:8: error: 'a' was not declared in this scope
   13 |   cin>>a>>b;
      |        ^
a.cc:13:11: error: 'b' was not declared in this scope
   13 |   cin>>a>>b;
      |           ^
a.cc:15:5: error: 'c' was not declared in this scope
   15 |     c*=2;
      |     ^
a.cc:16:22: error: 'c' was not declared in this scope
   16 |   cout<<100*a+1800*b*c<<endl;
      |                      ^