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

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

int main(){
  int X, N;
  std::cin >> X >> N;
  std::vector<int> p(N);
  std::map<int, int> list;
  for(int i = 0 ; i < N ; i++){
    std::cin >> p[i];
    list[p[i]] = 1;
  }
  if(N == 0){
    std::cout << X <<std::endl;
    return 0;
  }

  std::sort(p.begin(), p.end());
  
  int n = 0;
  std::vector<int> flist;
  for(int i = 0 ; i <= 101 ; i++){
    if(list[i] != 1){
      flist.push_back(i);
    }
  }
  auto it = std::upper_bound(flist.begin(), flist.end(), X);
  if( std::fabs(*it - X) >= std::fabs(*(it - 1) - X)){
    std::cout << *(it - 1) << std::endl;
  }else{
    std::cout << *it << std::endl;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:12: error: 'fabs' is not a member of 'std'; did you mean 'labs'?
   30 |   if( std::fabs(*it - X) >= std::fabs(*(it - 1) - X)){
      |            ^~~~
      |            labs
a.cc:30:34: error: 'fabs' is not a member of 'std'; did you mean 'labs'?
   30 |   if( std::fabs(*it - X) >= std::fabs(*(it - 1) - X)){
      |                                  ^~~~
      |                                  labs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x,n;
  cin>>x>>n;
  int arr[n];
  int hash[101]=0;
  for(int i=0;i<n;i++)
  {
    cin>>arr[i];
    hash[arr[i]]=1;
    
    
  }
  int l=x;
  int r=x;
  while(1)
    
  {
    if(hash[l]==0)
    {
     cout<<l<<endl;
      break;
    }
    if(hash[r]==0)
    {
      cout<<r<<endl;
      break;
      
    }
    l--
    r++;


    
    
  }
    
    
    



}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: array must be initialized with a brace-enclosed initializer
    8 |   int hash[101]=0;
      |                 ^
a.cc:32:8: error: expected ';' before 'r'
   32 |     l--
      |        ^
      |        ;
   33 |     r++;
      |     ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
bool binary(int arr[],int n ,int start,int end,int x)
{
  
  int mid=(start+end)/2;
  while(start<=end)
    
  {
    if(arr[mid]==x)
      return true;
    if(arr[mid]>x)
      end=mid-1;
    if(arr[mid]<x)
      start=mid+1;
    
    
    
    
    
  }
  return false;
  
  
  
  
  
}
int main()
{
  int x,n;
  cin>>x>>n;
  int arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  sort(arr,arr+n);
  int z=-1;
  int start=0;
  int end=n-1;
  
  
  
  for(int i=0;i<=100;i++)
    
    
  {
    if(!(binary(arr,n,start,end,x-i))
       {
         if((x-i)>0)
         {
         z=x-i;
         break;
         }
         else
           continue;
         
         
         
       }
       if(!(binary(arr,n,start,end,x+i))
          {
            if(x+i<=100)
            {
              z=x+i;
              break;
              
              
              
            }
            else
              continue;
            
            
          }



    
    
    
  }
          if(z==-1)
          cout<<-1<<endl;
          else
          cout<<z<<endl;
  
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:38: error: expected ')' before '{' token
   47 |     if(!(binary(arr,n,start,end,x-i))
      |       ~                              ^
      |                                      )
   48 |        {
      |        ~                              
a.cc:81:3: error: expected primary-expression before '}' token
   81 |   }
      |   ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main()
{
	vector<bool> ls(101,true);
	int x, n;
    cin>>x>>n;
	while(n--)
    {
      	int a;cin>>a;ls[a]=false;
    }
	int a=x,b=x;
	while(!ls[x])
    {
		a++;b--;
		if(ls[a]) x=a;
		if(ls[b]) x=b;
    }
	cout<<x;
}#include <iostream>
#include <vector>
using namespace std;
int main()
{
	vector<bool> ls(101,true);
	int x, n;
    cin>>x>>n;
	while(n--)
    {
      	int a;cin>>a;ls[a]=false;
    }
	int a=x,b=x;
	while(!ls[x])
    {
		a++;b--;
		if(ls[a]) x=a;
		if(ls[b]) x=b;
    }
	cout<<x;
}

Compiler output:
a.cc:21:2: error: stray '#' in program
   21 | }#include <iostream>
      |  ^
a.cc:21:3: error: 'include' does not name a type
   21 | }#include <iostream>
      |   ^~~~~~~
a.cc:24:5: error: redefinition of 'int main()'
   24 | int main()
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
Language: Java

 java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int number = sc.nextInt();
		int numlength = sc.nextInt();
		int[] numbers = new int[numlength];
		int n = 0;
		int m = 0;
		
		for(int i=0;i<numlength;i++) {
			numbers[i] = sc.nextInt();
		}
		
		for(int i=0;i<numlength;i++) {
			boolean flag1 = true;
			boolean flag2 = true;
			for(int j=0;j<numlength;j++) {
				if(number - i == numbers[j]) {
					flag1 = false;
				}
				if(number + i == numbers[j]) {
					flag2 = false;
				}
			}
			if(flag1 == true && flag2 == true) {
				System.out.println(number - i);
				return;
			}else if(flag1 == true) {
				System.out.println(number - i);
				return;
			}else if(flag2 == true) {
				System.out.println(number + i);
				return;
			}
		}

	}

}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
 java.util.Scanner;
 ^
1 error
Language: C++

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

int main (){
  int X,N;
  cin >> X >> N;
  vector<int> vec(N);
  for(int i=0;i<N,i++){
    cin >> vec[i];
  }
  
  int a=1000000,b=1000000;
  for(int i=0;i<N,i++){
    a=min(a,(X-vec[i])*(X-vec[i]));
    if(a<=(X-vec[i])*(X-vec[i])){
    b=min(b,X-vec[i]);
    }
  }
  cout << b <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: expected ';' before ')' token
    8 |   for(int i=0;i<N,i++){
      |                      ^
      |                      ;
a.cc:13:22: error: expected ';' before ')' token
   13 |   for(int i=0;i<N,i++){
      |                      ^
      |                      ;
Language: C++

#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 100009 /// leave to tomorrow anything that can be done today
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x,n;
    cin>>x>>n;
    if(n==0){
        cout<<x<<'\n';
        return 0;
    }
    ll vet[n+2];
    rep(i,0,n){
        cin>>vet[i];
    }
    sort(vet,vet+n);
    ll ans=0;
    ll sumi=x;
    rep(i,1,vet[0]){
        if(abs(i-x)<sumi){
            ans=i;
            sumi=abs(i-x);
        }
    }
    rep(i,0,n-1){
        rep(j,vet[i]+1,vet[i+1]){
            if(abs(j-x)<sumi){
                ans=j;
                sumi=abs(j-x);
            }
        }
    }
    rep(i,vet[n-1]+1,x+1){
        if(abs(i-x)<sumi){
            ans=i;
            sumi=abs(i-x);
        }
    }
    if(abs(vet[n-1]-x)<sumi){
        ans=i;
    }
    cout<<ans<<"\n";
    return 0;   
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:55:13: error: 'i' was not declared in this scope
   55 |         ans=i;
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,n;cin>>x>>n;
	multiset<int> st;
	while(n--){
		int xa;cin>>xa;st.insert(xa);}
	cout<<*lower_bound(x);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:27: error: no matching function for call to 'lower_bound(int&)'
    8 |         cout<<*lower_bound(x);
      |                ~~~~~~~~~~~^~~
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:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530: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:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 1 provided
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    int x, n,p[n+5] ,i ,j ,k;
    
    cin>>n>>x;

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

    j=abs( x-( p[0]-1 ));
    for(i=0;i<=x;i++){
        if( abs( x-( p[i]-1 ) )<j){
           j=abs( x-( p[i]-1 ));
           k=abs p[i]-1 ;
        }

        if( abs( x-( p[i]+1 ))<j){
            j=abs( x-( p[i]-1 ));
            k=abs p[i] +1 ;
        }
    }
    cout<<k;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: cannot resolve overloaded function 'abs' based on conversion to type 'int'
   18 |            k=abs p[i]-1 ;
      |              ^~~
a.cc:23:15: error: cannot resolve overloaded function 'abs' based on conversion to type 'int'
   23 |             k=abs p[i] +1 ;
      |               ^~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
    int x, n,p[n+5]  , k ;
    cin>>n>>x;
    
    for(i=0;i<n;i++){
        cin>>c[i];
    }
    
    j=abs( x-( p[0]-1 );
    for(i=0;i<=x;i++){
        if( abs( x-( p[i]-1 )<j){
           j=abs( x-( p[i]-1 );
           k=abs p[i]-1 ;
        }
            
        if( abs( x-( p[i]+1 )<j){
            j=abs( x-( p[i]-1 );
            k=abs p[i] +1 ;
        }
    }
    cout<<k;
    

}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'i' was not declared in this scope
    8 |     for(i=0;i<n;i++){
      |         ^
a.cc:9:14: error: 'c' was not declared in this scope
    9 |         cin>>c[i];
      |              ^
a.cc:12:5: error: 'j' was not declared in this scope
   12 |     j=abs( x-( p[0]-1 );
      |     ^
a.cc:12:24: error: expected ')' before ';' token
   12 |     j=abs( x-( p[0]-1 );
      |          ~             ^
      |                        )
a.cc:13:9: error: 'i' was not declared in this scope
   13 |     for(i=0;i<=x;i++){
      |         ^
a.cc:14:33: error: expected ')' before '{' token
   14 |         if( abs( x-( p[i]-1 )<j){
      |           ~                     ^
      |                                 )
a.cc:23:5: error: expected primary-expression before '}' token
   23 |     }
      |     ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#define rep(i,j,k) for(int i = j; i <= k; i++)
#define dow(i,j,k) for(int i = j; i >= k; i--)
#define fi first
#define se second
using namespace std;


typedef long long ll;
typedef pair<int,int> pi;


const int N = 105;
int x, n, p[105];
int main() {
	cin >> x >> n;
	rep(i,1,n) cin >> p[i];
	sort(p + 1, p + n + 1);
	int ans = 105;
	dow(i,105, 0) {
		int j = x + i;
		int a = 1;
		rep(k,1,n) if (p[k] == j) a = 0;
		if (a) ans = j;
		a = 1, j = x - i;
		rep(k,1,n) if (p[k] == j) a = 0;
		if (a) ans = j;
	}
	cout << j << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:17: error: 'j' was not declared in this scope
   36 |         cout << j << endl;
      |                 ^
Language: C++

/*twitter:@chigaphys
  atcoder:chiga
  所属:久留米大学附設中学校
  color:gray*/
#include <bits/stdc++.h>
using namespace std;

int aaaaa(int x,vector<int> vec){
int n=vec.size()/2;n*=2;
vector<int> nya(0);
for(int i=0;i<n;i++)nya.push_back(x-n+i+(n+1)/2;
for(int i=0;i<n;i++){
for(int j=0;j<vec.size();j++;){
if(nya.at(i)==vec.at(j))nya.at(i)=0;
}nya.push_back(101);
}int d=nya.at(0);
for(int i=1;i<n+1;i++){
int c=max(d-x,x-d);
int ca=nya.at(i);
if(max(c-x,x-c)>max(ca-x,x-ca))d=ca;
}return d;
}

int main() {
int x,n;
cin>>x>>n;
vector<int> saa(n);
for(int i=0;i<n;i++)cin>>saa.at(i);
cout<<aaaaa(x,saa);<<endl;
}


Compiler output:
a.cc: In function 'int aaaaa(int, std::vector<int>)':
a.cc:11:48: error: expected ')' before ';' token
   11 | for(int i=0;i<n;i++)nya.push_back(x-n+i+(n+1)/2;
      |                                  ~             ^
      |                                                )
a.cc:13:29: error: expected ')' before ';' token
   13 | for(int j=0;j<vec.size();j++;){
      |    ~                        ^
      |                             )
a.cc:13:30: error: expected primary-expression before ')' token
   13 | for(int j=0;j<vec.size();j++;){
      |                              ^
a.cc: In function 'int main()':
a.cc:29:20: error: expected primary-expression before '<<' token
   29 | cout<<aaaaa(x,saa);<<endl;
      |                    ^~
Language: C++

#include <iostream>
#include <fstream>
#include <math.h>
#include <string>
#include <cstring>
using namespace  std;
 
int main()
{
   // freopen("in.txt","r",stdin);
		
	int x,n,arr[120],big=-1;;
	cin>>x>>n;
	memset(arr,0,sizeof(arr));
 
	for(int i=1;i<=n;i++)
	{
		int temp;
		cin>>temp; big=max(big,temp);
		
		arr[temp]=1;
	}
 
    big=max(x,big);
	bool chk=false;
    int ans=4555,intdif=1233;


	for(int i=1;i<=big;i++)
	{
		if(arr[i]==0){
             int  newintdif = abs(i-x);
             if(intdif>newintdif)
             {
             	intdif=newintdif;
             	ans=i;
             	chk=true;
             }
		}	 
	}
	  
	else if(chk==false)
	   {
	   	  if(n==0)
	   	  	cout<<0;
	   	  else
	   	  	cout<<big+1;
	   }
	   else 
        cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:9: error: 'else' without a previous 'if'
   42 |         else if(chk==false)
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int x,n;
  cin >> x >> n;
  int p[n];
  for(int i=0; i<n; i++){
    cin >> p[i];
  }
  bool sum[101]
  int min=100;
  int sa=0;
  int a,b;
  for(int i=0; i<101; i++){
    sum[i] = false:
  }
  for(int i=0; i<n; i++){
    sum[p[i]] = true;
  }
  for(int i=x; i<101-x; i++){
    if(sum[i] == false){
      a = i;
      break;
    }
  }

  for(int j=x; j>=0; j--){
    if(sum[j] == false){
      b = j;
      break;
    }
  }
  int pp,mm;
  pp = a-x;
  mm = x-b;
  if(pp<mm){
    cout << a << endl;
    return 0;
  }
  if(pp>=mm){
    cout << b << endl;
    return 0;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: expected initializer before 'int'
   11 |   int min=100;
      |   ^~~
a.cc:15:5: error: 'sum' was not declared in this scope
   15 |     sum[i] = false:
      |     ^~~
a.cc:18:5: error: 'sum' was not declared in this scope
   18 |     sum[p[i]] = true;
      |     ^~~
a.cc:21:8: error: 'sum' was not declared in this scope
   21 |     if(sum[i] == false){
      |        ^~~
a.cc:28:8: error: 'sum' was not declared in this scope
   28 |     if(sum[j] == false){
      |        ^~~
Language: C++

#include <bits/stdc++.h>
#define lol long long
#define inf 1000000000000000000
using namespace std;
int main(){
  int a,b,c,x[110]={},ans=10000,seisu=10000;
  cin>>a>>b;
  if(b==0) cout<<a<<"\n";
  else{
    for(int i=0;i<b;i++){
      cin>>c;
      x[c]++;
    } 
    for(int i=0;i<=100;i++){
      if(abs(a-i)<ans && x[i]!=1){
        ans=abs(a-i);
        seisu=i;
    }
    cout<<seisu<<"\n";
  }
  return(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;

int main(){

    int X, N;
    cin >> X >> N;
    if(N == 0){
        cout << X << endl;
        return 0;
    }

    int P[N];
    int pi;
    int i;
    for(i=0; i<N; i++){
        cin >> pi;
        P[i] = pi;
    }

    bool flag;
    flag = false;
    for (i=0; i<N; i++){
        if(P[i] == X){
            flag_p = true;
        }
    }
    if(flag == false){
        cout << X << endl;
        return 0;
    }


    int abs_num_p, abs_num_n;
    abs_num_p = X + 1;
    abs_num_n = X - 1;

    //int iter;
    bool flag_p;
    bool flag_n;
    //iter = 0;
    
    while(true){
        flag_p = false;
        flag_n = false;
        for (i=0; i<N; i++){
            if(P[i] == abs_num_p){
                flag_p = true;
            }
            if(P[i] == abs_num_n){
                flag_n = true;
            }

        }
        if(     flag_p ==  true and flag_n ==  true){
            abs_num_p += 1;
            abs_num_n += 1;
            continue;
        }
        else if(flag_p ==  true and flag_n == false){
            cout << abs_num_n << endl;
            return 0;
        }
        else if(flag_p == false and flag_n ==  true){
            cout << abs_num_p << endl;
            return 0;
        }
        else if(flag_p == false and flag_n == false){
            cout << abs_num_n << endl;
            return 0;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:13: error: 'flag_p' was not declared in this scope; did you mean 'flag'?
   25 |             flag_p = true;
      |             ^~~~~~
      |             flag
Language: C++

#include<iostream>
using namespace std;

int main(){

    int X, N;
    cin >> X >> N;
    if(N == 0){
        cout << X << endl;
        return 0;
    }

    int P[N];
    int pi;
    int i;
    for(i=0; i<N; i++){
        cin >> pi;
        P[i] = pi;
    }

    bool flag;
    flag = false;
    for (i=0; i<N; i++){
        if(P[i] == abs_num_p){
            flag_p = true;
        }
    }
    if(flag == false){
        cout << X << endl;
        return 0;
    }


    int abs_num_p, abs_num_n;
    abs_num_p = X + 1;
    abs_num_n = X - 1;

    //int iter;
    bool flag_p;
    bool flag_n;
    //iter = 0;
    
    while(true){
        flag_p = false;
        flag_n = false;
        for (i=0; i<N; i++){
            if(P[i] == abs_num_p){
                flag_p = true;
            }
            if(P[i] == abs_num_n){
                flag_n = true;
            }

        }
        if(     flag_p ==  true and flag_n ==  true){
            abs_num_p += 1;
            abs_num_n += 1;
            continue;
        }
        else if(flag_p ==  true and flag_n == false){
            cout << abs_num_n << endl;
            return 0;
        }
        else if(flag_p == false and flag_n ==  true){
            cout << abs_num_p << endl;
            return 0;
        }
        else if(flag_p == false and flag_n == false){
            cout << abs_num_n << endl;
            return 0;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:20: error: 'abs_num_p' was not declared in this scope
   24 |         if(P[i] == abs_num_p){
      |                    ^~~~~~~~~
a.cc:25:13: error: 'flag_p' was not declared in this scope; did you mean 'flag'?
   25 |             flag_p = true;
      |             ^~~~~~
      |             flag
Language: C++

#include<iostream>
using namespace std;

int main(){

    int X, N;
    cin >> X >> N;
    if(N == 0){
        cout << X << endl;
        return 0;
    }

    int P[N];
    int pi;
    int i;
    for(i=0; i<N; i++){
        cin >> pi;
        P[i] = pi;
    }

    int abs_num_p, abs_num_n;
    abs_num_p = X + 1;
    abs_num_n = X - 1;

    //int iter;
    bool flag_p;
    bool flag_n;
    iter = 0;
    
    while(true){
        flag_p = false;
        flag_n = false;
        for (i=0; i<N; i++){
            if(P[i] == abs_num_p){
                flag_p = true;
            }
            if(P[i] == abs_num_n){
                flag_n = true;
            }

        }
        if(     flag_p ==  true and flag_n ==  true){
            abs_num_p += 1;
            abs_num_n += 1;
            continue;
        }
        else if(flag_p ==  true and flag_n == false){
            cout << abs_num_n << endl;
            return 0;
        }
        else if(flag_p == false and flag_n ==  true){
            cout << abs_num_p << endl;
            return 0;
        }
        else if(flag_p == false and flag_n == false){
            cout << abs_num_n << endl;
            return 0;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'iter' was not declared in this scope
   28 |     iter = 0;
      |     ^~~~
Language: C

#include<iostream>
using namespace std;

int main(){

    int X, N;
    cin >> X >> N;
    if(N == 0){
        cout << X << endl;
        return 0;
    }

    int P[N];
    int pi;
    int i;
    for(i=0; i<N; i++){
        cin >> pi;
        P[i] = pi;
    }

    int abs_num_p, abs_num_n;
    abs_num_p = X + 1;
    abs_num_n = X - 1;

    int iter;
    bool flag_p;
    bool flag_n;
    iter = 0;
    
    while(iter <= (N / 2)){
        flag_p = false;
        flag_n = false;
        for (i=0; i<N; i++){
            if(P[i] == abs_num_p){
                flag_p = true;
            }
            if(P[i] == abs_num_n){
                flag_n = true;
            }

        }
        if(     flag_p ==  true and flag_n ==  true){
            abs_num_p += 1;
            abs_num_n += 1;
            continue;
        }
        else if(flag_p ==  true and flag_n == false){
            cout << abs_num_n << endl;
            return 0;
        }
        else if(flag_p == false and flag_n ==  true){
            cout << abs_num_p << endl;
            return 0;
        }
        else if(flag_p == false and flag_n == false){
            cout << abs_num_n << endl;
            return 0;
        }
        iter += 1;
    }
    return 0;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma,tune=native")
 
#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;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  
#define pb push_back
#define in insert
#define f first
#define s second
#define ll long long
#define dd double
  
const int mod = 1e9 + 7;
const int N = 2e5 + 7;
const int inf = 2e9;
const ll INF = 1e18;

map<int, int> m;

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	// freopen("*.in", "r", stdin);freopen("*.out", "w", stdout);
	int x, n, ans, mmin = inf;
	cin >> x >> n;
	for (int i = 0; i < n; i++) {
		int p;
		cin >> p;
		m[p] = 1;
	}

	for (int i = -200; i <= 200; i++) {
		if (m[i]) continue;
		if (abs(i - x) == mmin) {
			ans = min(ans, i);
		}
		if (abs(i - x) < mmin) {
			mmin = abs(i - x);
			ans = i;
		}
	} 
	cout << ans;
}

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::_Rb_tree_impl<std::less<int>, true>::~_Rb_tree_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::_Rb_tree_node<std::pair<const int, int> >]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/map:62,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152:
/usr/include/c++/14/bits/stl_tree.h:658:16: note: called from here
  658 |         struct _Rb_tree_impl
      |                ^~~~~~~~~~~~~
Language: C++

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

int main()
{
	//freopen("in.txt","r",stdin);
		
	int x,n,arr[120],big=-1;;
	cin>>x>>n;
	memset(arr,0,sizeof(arr));

	for(int i=1;i<=n;i++)
	{
		int temp;
		cin>>temp; big=max(big,temp);
		if(temp<0) temp*=-1;
		arr[temp]=1;
	}

	//cout<<big<<endl;
    
    int ans=4555,intdif=1233;
	for(int i=1;i<=big;i++)
	{
		if(arr[i]==0){
             int  newintdif = abs(i-x);
             if(intdif>newintdif)
             {
             	intdif=newintdif;
             	ans=i;
             }
		}	 
	}
	if(n==0){
		cout<<x<<endl;
		return 0;
	}    
    cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'memset' was not declared in this scope
   13 |         memset(arr,0,sizeof(arr));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <math.h>
  +++ |+#include <cstring>
    4 | #include <string>
Language: C++

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

int main()
{
	//freopen("in.txt","r",stdin);
		
	int x,n,arr[120],big=-1;;
	cin>>x>>n;
	memset(arr,0,sizeof(arr));

	for(int i=1;i<=n;i++)
	{
		int temp;
		cin>>temp; big=max(big,temp);
		if(temp<0) temp*=-1;
		arr[temp]=1;
	}

	//cout<<big<<endl;
    
    int ans=4555,intdif=1233;
	for(int i=1;i<=big;i++)
	{
		if(arr[i]==0){
             int  newintdif = abs(i-x);
             if(intdif>newintdif)
             {
             	intdif=newintdif;
             	ans=i;
             }
		}	 
	}
	if(n==0){
		cout<<x<<endl;
		return 0;
	}    
    cout<<ans<<endl;
	return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
int main()
{long long int x,n,u,v;
 cin>>x>>n;
 if(n==0)
 {cout<<x;
  return 0;}
 vector<long long int>vec;
 for(long long int i=0;i<n;i++)
 {long long int k;
  cin>>k;
  vec.push_back(k);}
 u=v=k;
 while(find(vec.begin(),vec.end(),u)!=vec.end())
 {u=u-1;
 }
 while(find(vec.begin(),vec.end(),v)!=vec.end())
 {v=v+1;}
 cout<<min((abs(u-x)),(abs(v-x));
           }
 
 

Compiler output:
a.cc: In function 'int main()':
a.cc:14:6: error: 'k' was not declared in this scope
   14 |  u=v=k;
      |      ^
a.cc:20:33: error: expected ')' before ';' token
   20 |  cout<<min((abs(u-x)),(abs(v-x));
      |           ~                     ^
      |                                 )
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  int x, n;
  cin >> x >> n;
  vector<int> vec(102);
  
  rep(i,n) {
    int a;
    cin >> a;
    vec.at(a) = 1;
  }
  
  P ans(99999,0);
  for (int i = 0; i < N; i++) {
    if (vec.at(i) == 1) continue;
    int dif = abs(x - i);
    ans = min(ans, P(dif,i));
  }
  cout << ans.second;

Compiler output:
a.cc: In function 'int main()':
a.cc:19:23: error: 'N' was not declared in this scope
   19 |   for (int i = 0; i < N; i++) {
      |                       ^
a.cc:24:22: error: expected '}' at end of input
   24 |   cout << ans.second;
      |                      ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#include <map>
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

int main() {
    fastIO
    int a[101],b[101]={0};
    int x,n;
    cin>>x>>n;
    map<int,int>b;
    for (int i=0;i<n;i++) {
            cin>>a[i];
            b[a[i]]++;
    }

    for (int i=0;i<=100;i++) {
        if (b[x-i]==0) {
            cout<<x-i<<endl;
            break;
        }
        if (b[x+i]==0) {
            cout<<x+i<<endl;
            break;
        }
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: conflicting declaration 'std::map<int, int> b'
   12 |     map<int,int>b;
      |                 ^
a.cc:9:16: note: previous declaration as 'int b [101]'
    9 |     int a[101],b[101]={0};
      |                ^
Language: C

// Author: pankaj_m05

#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define f_in(file) freopen(file, "r", stdin)
#define f_out(file) freopen(file, "w", stdout)
#define sz(a) int((a).size())
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(c) c.begin(), c.end()
#define tr(c,i) for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) (c.find(x) != c.end())  // Set and Maps
#define cpresent(c,x) (find(allc,x) != c.end()) // Vectors
using namespace std;

typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
typedef long long ll;

const int mod = 1e9 + 7;
const int mxN = 100;
int n, x;
bool a[mxN + 2];

void testcase() {
	cin >> x >> n;
	if (n == 0) {
		cout << x << '\n';
		return;
	}
	for (int i=0;i<n;i++) {
		int t;
		cin >> t;
		a[t] = 1;
	}
	int l=0, r=100;
	for (int i=x; i>=0; --i) {
		if(a[i])
			continue;
		l = i;
		break;	
	}
	for (int i=x; i<102; ++i) {
		if(a[i])
			continue;
		r = i;
		break;	
	}
	cout << (x-l<=r-x?l:r) << '\n';
}

int main(void) { 
	fast
	testcase();
	return 0;
}                                          

Compiler output:
main.c:3:9: fatal error: bits/stdc++.h: No such file or directory
    3 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
using namespace std;
#define N_MAX 100

int x,n;
int p[N_MAX]

int main(void){
	cin >> x >> n;
    for(int i=0;i<n;i++) cin >> p[i];
}

Compiler output:
a.cc:8:1: error: expected initializer before 'int'
    8 | int main(void){
      | ^~~
Language: C++

#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define N 200005
 

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	int x,n;
	cin>>x>>n;

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

	sort(a,a+n);

	ans=1e9,val=-1;
	for(i=0;i<n;i++){
		if(abs(x-a[i])<ans){
			ans=abs(x-a[i]);
			val=a[i];
		}
	}

	cout<<val<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   24 |         ans=1e9,val=-1;
      |         ^~~
      |         abs
a.cc:24:17: error: 'val' was not declared in this scope
   24 |         ans=1e9,val=-1;
      |                 ^~~
Language: C++

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define all(c) begin(c),end(c)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//最大公約数
ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}
//最小公倍数
ll lcm(ll x, ll y) {
  return x/gcd(x, y)*y;
}
//素因数分解
vector<pair<ll,int>> factorize(ll n) {
  vector<pair<ll,int>> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i) continue;
    res.emplace_back(i,0);
    while (n%i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n,1);
  return res;
}
 
 
 ll mod=998244353;
 
int main() {

  int x,n;
  int p[n];
  int ans=10000;
  int diff;

  cin>>x>>n;

  /*
  for(int i=0;i<n;i++){
    cin>>p[i];
    diff=abs(x-p[i]);
    cout<<diff;

    if(ans>diff){
      ans=diff;
    }
  }
  cout<<ans;




*/



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

  sort(p,p+n);
  
  for(int i=0;i<n;i++){
    for(int j=0;j<=50;j++){
      diff=x-j;
      if(ans>diff){
        ans=diff;
      }

    }
  }
  
  for()


  


  cout<<ans;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:110:7: error: expected primary-expression before ')' token
  110 |   for()
      |       ^
a.cc:117:1: error: expected primary-expression before '}' token
  117 | }
      | ^
a.cc:116:13: error: expected ';' before '}' token
  116 |   cout<<ans;
      |             ^
      |             ;
  117 | }
      | ~            
a.cc:117:1: error: expected primary-expression before '}' token
  117 | }
      | ^
a.cc:116:13: error: expected ')' before '}' token
  116 |   cout<<ans;
      |             ^
      |             )
  117 | }
      | ~            
a.cc:110:6: note: to match this '('
  110 |   for()
      |      ^
a.cc:117:1: error: expected primary-expression before '}' token
  117 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int main(){
  int a,num;
  int x[num];
 
  cin >>a >> num;
  for(int i=0; i<num; i++){
    cin >> x[i];
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:10:4: error: expected '}' at end of input
   10 |   }
      |    ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL)
    int x,n;cin>>x>>n;
    int a[102],b,l=x,r=x;
    for(int i=0;i<=100;i++)a[i]=0;
    for(int i=0;i<n;i++)
    {
        cin>>b;
        a[b]=1;
    }
    while(true)
    {
       if(a[l]==0 && l>0)
       {
           cout<<l;
           break;
       }
       if(a[r]==0 && r<101)
       {
           cout<<r;
           break;
       }
       l--;
       r++;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:51: error: expected ';' before 'int'
    5 |     ios_base::sync_with_stdio(false);cin.tie(NULL)
      |                                                   ^
      |                                                   ;
    6 |     int x,n;cin>>x>>n;
      |     ~~~                                            
a.cc:6:18: error: 'x' was not declared in this scope
    6 |     int x,n;cin>>x>>n;
      |                  ^
a.cc:6:21: error: 'n' was not declared in this scope; did you mean 'yn'?
    6 |     int x,n;cin>>x>>n;
      |                     ^
      |                     yn
Language: C

#include<stdio.h>
#include <stdlib.h>
int main() {
    int x,n;
    scanf("%d %d",&x,&n);
    int p[102];
    for(int i = 0; i <= 101; i++) {
        p[i] = 0;
    }
    for(int i = 0;i < n; i++) {
        int a;
        scanf("%d", %a);
        p[a] = 1;
    }
    int ans = 0;
    int min = 1000;
    for (int i = 0; i <= 101; i++) {
        if (p[i] == 0) {
            if (min < abs(x-i)) {
                min = abs(x-i);
                ans = i;
            }
        }
    }
    printf("%d\n",ans);
}

Compiler output:
main.c: In function 'main':
main.c:12:21: error: expected expression before '%' token
   12 |         scanf("%d", %a);
      |                     ^
Language: C

#include<stdio.h>
#include <stdlib.h>
int main() {
    int x,n;
    int p[102];
    for(int i = 0; i <= 101; i++) {
        p[i] = 0;
    }
    for(int i = 0;i < n; i++) {
        int a;
        scanf("%d", %a);
        p[a] = 1;
    }
    int ans = 0;
    int min = 1000;
    for (int i = 0; i <= 101; i++) {
        if (p[i] == 0) {
            if (min < abs(x-i)) {
                min = abs(x-i);
                ans = i;
            }
        }
    }
    printf("%d\n",ans);
}

Compiler output:
main.c: In function 'main':
main.c:11:21: error: expected expression before '%' token
   11 |         scanf("%d", %a);
      |                     ^
Language: C

#include <iostream>
#include <string.h>
#include <vector>
#define rep(i, n) for (int i = 0; i < n; ++i)
//using namespace std; 魔界への入り口

int main()
{
    // スペース区切りの整数の入力
    int x, n;
    std::cin >> x >> n;
    std::vector<bool> v(102, 0);
    rep(i,n){
        int p;
        std::cin >> p;
        v[p] = 1;
    }
    std::pair<int, int> ans(0, x);
    if(v[x] == 0)
    {
        ans = std::make_pair(0, x);
    }
    else
    {
        ans = std::make_pair(9999, -1);
        for (int i = 0; i <= 101; ++i)
        {
            if (v[i] == 1)
                continue;
            else
            {
                int dif = abs(x-i);
                ans = std::min(ans, std::pair<int, int>(dif, i));
            }
        }
    }
    // 出力
    std::cout << ans.second << std::endl;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000001
#define r(i,a,b)    for(i=a;i<b;i++)
#define ra(i,a,b)   for(i=a;i<=b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ss          set<ll int>
using namespace std;
 
#define N 1000000
#define M 100000000

struct unit {
  ll int a[N];  
};

ll fact (ll int x)
{if(x==1 || x==0)return 1;
else return x*fact(x-1);}

ll power(ll int x,ll int n)
{if(n==0)return 1;
else if(n%2 == 0)return power(x*x,n/2);
else return x*power(x*x,(n-1)/2);}

bool cmp (const pii&a,const pii&b)
{ return((a.F-a.S) > (b.F-b.S));
/*if(a.S<=b.S){if(a.S==b.S)return a.F<b.F;else return a.S<b.S;}
else return a.S<b.S;*/}

void solve()
{
    ll i,j,k,l,m,n,a=0,b=0;
    cin>>k>>n;
    if(n==0)
      cout<<k;
    else
    {
      vi v;
      map<ll int,ll int> p;
      r(i,0,n)
      {
        cin>>l;
        v.pb(l);
        p[l]=1;
      }
      a=1;
      while(1)
      {
        if(p[x-a]!=1)
        {
          cout<<x-a;
          return;
        }
        else
          if(p[x+a]!=1)
          {
            cout<<x+a;
            return;
          }
        else
          a++;
      }
    }
    
}


int main()
{
    cin.tie(0), cin.sync_with_stdio(0), cout.tie(0), cout.sync_with_stdio(0);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    
}
//pr12

Compiler output:
a.cc: In function 'void solve()':
a.cc:61:14: error: 'x' was not declared in this scope
   61 |         if(p[x-a]!=1)
      |              ^
Language: Java

import java.util.*;
public class Main{
	public static void main(Strin[] args){
    	Scanner sc=new Scanner(System.in);
      	LinkedList<Integer> l=new LinkedList<>();
    	int x=sc.nextInt();
    	int n=sc.nextInt();
    	for(int i=0;i<n;i++) {
    		l.add(sc.nextInt());
    	}
    	for(int i=0;true;i++) {
    		if(!l.contains(x-i)) {
    			System.out.println(x-i);
    			break;
    		}
    		else if(!l.contains(x+i)) {
    			System.out.println(x+i);
    			break;
    		}
    	}
    }
}

Compiler output:
Main.java:3: error: cannot find symbol
	public static void main(Strin[] args){
	                        ^
  symbol:   class Strin
  location: class Main
1 error
Language: C++

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

int main() {
  int X;
  cin >> X;
  int N;
  cin >> N;
  int D = 0;
  vector<int> A(N);
  int K = 0;
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    if(A.at(i) == X){
      D = 1;
    }
  }
  if(D == 0){
    cout << X;
  }
  else{
    D = 0;
    while(K == 0){
      D = D + 1;
      K = 0;
      for(int j = 0; j < N; j++){
        if(A.at(j) == X - D){
          K = 1;
        }
      }
      if(K == 0){
        cout << X - D;
        K = 1;
      }
      else{
        K = 0;
        for(int k = 0; k < N; k++){
          if(A.at(k) == X + D){
            K = 1
          }
        }
        if(K == 0){
          cout << X + D;
          K = 1;
        }
        else{
          K = 0;
        }
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:18: error: expected ';' before '}' token
   39 |             K = 1
      |                  ^
      |                  ;
   40 |           }
      |           ~
Language: C++

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

int main() {
  int X;
  cin >> X;
  int N;
  cin >> N;
  int D = 0;
  vector<int> A(N);
  int K;
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    if(A.at(i) == X){
      D = 1;
    }
  }
  if(D = 0){
    cout << X;
  }
  else{
    D = 0
    while(K = 0){
      D = D + 1;
      K = 0;
      for(int j = 0; j < N; j++){
        if(A.at(j) == X - D){
          K = 1;
        }
      }
      if(K == 0){
        cout << X - D;
        K = 1;
      }
      else{
        K = 0;
        for(int k = 0; k < N; k++){
          if(A.at(k) == X + D){
            K = 1
          }
        }
        if(K == 0){
          cout << X + D;
          K = 1;
        }
        else{
          K = 0;
        }
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: expected ';' before 'while'
   22 |     D = 0
      |          ^
      |          ;
   23 |     while(K = 0){
      |     ~~~~~
Language: Java

import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);

		int x=sc.nextInt();
		int n=sc.nextInt();		//数字列の長さ

		ArrayList<String>array=new ArrayList<>();
		for(int i=0;i<n;i++) {
			array.add(sc.next());

		}
		//System.out.println(array);
		int mincount = 0;
		int min = 0;
		for(int i=1;i<101;i++) {

			var b = Integer.toString(i);


			if(!array.contains(b)) {
				//System.out.println(b);
				int aaa = x-i;
				aaa = Math.abs(aaa);
				if(mincount==0) {
					min = i;
					mincount = aaa;
				}else if(mincount>aaa) {
					mincount = aaa;
					min = i;
				}else if(mincount==aaa) {
					if(min>i) {
						mincount = aaa;
						min = i;

					}
				}



			}


		}

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int x,n;
  cin>>x>>n;
  vector<int>d(102);
  rep(i,n){
    int p;
    cin>>p;
    d[p]++;
  }
  P ans(99999,-1);
  for(int i=0;i<=101;i++){
    if(d[i]) continue;
    ans=min(ans,(abs(x-i),i));
  }
  cout<<ans.sc<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:12: error: no matching function for call to 'min(P&, int&)'
   30 |     ans=min(ans,(abs(x-i),i));
      |         ~~~^~~~~~~~~~~~~~~~~~
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:   template argument deduction/substitution failed:
a.cc:30:12: note:   deduced conflicting types for parameter 'const _Tp' ('std::pair<int, int>' and 'int')
   30 |     ans=min(ans,(abs(x-i),i));
      |         ~~~^~~~~~~~~~~~~~~~~~
/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, 2 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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:30:12: note:   'std::pair<int, int>' is not derived from 'std::initializer_list<_Tp>'
   30 |     ans=min(ans,(abs(x-i),i));
      |         ~~~^~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int x,n;
  cin>>x>>n;
  vector<int>d(102);
  rep(i,n){
    int p;
    cin>>p;
    d[p]++;
  }
  P ans(99999,-1)
  for(int i=0;i<=101;i++){
    if(d[i]) continue;
    ans=min(ans,(abs(x-i),i));
  }
  cout<<ans.sc<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:3: error: expected ',' or ';' before 'for'
   28 |   for(int i=0;i<=101;i++){
      |   ^~~
a.cc:28:15: error: 'i' was not declared in this scope
   28 |   for(int i=0;i<=101;i++){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int x,n;
  cin>>x>>n;
  vector<int>d(102);
  rep(i,n){
    int p;
    cin>>p;
    d[p]++;
  }
  P ans=(99999,-1)
  for(int i=0;i<=101;i++){
    if(d[i]) continue;
    ans=min(ans,(abs(x-i),i));
  }
  cout<<ans.sc<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:16: error: conversion from 'int' to non-scalar type 'P' {aka 'std::pair<int, int>'} requested
   27 |   P ans=(99999,-1)
      |                ^~
a.cc:28:3: error: expected ',' or ';' before 'for'
   28 |   for(int i=0;i<=101;i++){
      |   ^~~
a.cc:28:15: error: 'i' was not declared in this scope
   28 |   for(int i=0;i<=101;i++){
      |               ^