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

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

int main() {
  ll x,n;
  cin >> x >> n;
  vector<ll> p;
  ll y=101;
  ll ans=101;
  
  if(n==0) {
    y=x;
  } else {
    for (ll i=0;i<n;i++) cin >> p[i];
    for (ll i=-1;i<102;i++) {
      auto itr = std::find(p.begin(), p.end(), i);
      if( itr != p.end() ) {
        break;
      } else {
        if( llabs(x-i)<ans ) {
          ans = llabs(x-i);
          y=i;
        }
      }
  }
  cout << y;
  
  return 0;
}


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

#include <stdio.h>
#include <stdlib.h>
int main(){
  int a[200];
  int b,c,i,j,tmp,tmp2;
  scanf("%d %d",&b,&c);
  for(i=0;i<c;i++){
    scanf("%d",a[i]);
  }
   for (i=0; i<c; ++i) {
    for (j=i+1; j<c; ++j) {
      if (a[i] > a[j]) {
        tmp =  a[i];
        a[i] = a[j];
        a[j] = tmp;
      }
    }
  }
  for (i=0; i<c; ++i) {
    for (j=i+1; j<c; ++j) {
      if(abs(b-a[i]) > abs(b-a[j])){
       tmp2 =  a[i];
        a[i] = a[j];
        a[j] = tmp2;
      }
    }
  } 
  for(i=0;i<c;i++){
    if(abs(b-a[i] != 0){
      printf("%d",a[i]);
      break;
    }
  }
  return 0;
  }

Compiler output:
main.c: In function 'main':
main.c:29:24: error: expected ')' before '{' token
   29 |     if(abs(b-a[i] != 0){
      |       ~                ^
      |                        )
main.c:33:3: error: expected expression before '}' token
   33 |   }
      |   ^
Language: C++

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

int main() {
  ll x,n;
  cin >> x >> n;
  vector<ll> p;
  ll y=101;
  ll ans=101;
  
  if(n==0) {
    y=x;
  } else {
    for (ll i=0;i<n;i++) cin >> p[i];
    for (ll i=-1;i<102;i++) {
      auto itr = std::find(p.begin(), p.end(), i);
      if( itr != ar.end() ) {
        break;
      } else {
        if( llabs(x-i)<ans ) {
          ans = llabs(x-i);
          y=i;
        }
  }
  cout << y;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: 'ar' was not declared in this scope
   18 |       if( itr != ar.end() ) {
      |                  ^~
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:14:10: note: to match this '{'
   14 |   } else {
      |          ^
a.cc:29:2: error: expected '}' at end of input
   29 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  int X, N, A, B, x, y;
  vector<int> p(N);
  for(int i=0;i<N;i++) {
    cin >> p.at(i);
  }
  sort(p.begin(),p.end());
  for(int i=0;i<N;i++) {
    if(p.at(i)<=X) {
      x++;
    }
    if(p.at(j)>X) {
      y++;
    }
  }
  vector<int> s(x),t(y);
  for(int i=0;i<x;i++) {
    s.at(i)=p.at(i);
  }
  reverse(p.begin(),p.end());
  for(int i=0;i<y;i++) {
    t.at(i)=p.at(i);
  }
  reverse(s.begin(),s.end());
  reverse(t.begin(),t.end());
  for(int i=0;i<x+1;i++) {
    A=X-i;
    if(A!=s.at(i)){
      break;
    }
  }
  for(int i=1;i<y+1;i++) {
    B=X+i;
    if(B!=t.at(i-1)){
      break;
    }
  }
  if(X-A>B-X) {
    cout << B << endl;
  }
  else {
    cout << A << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'j' was not declared in this scope
   14 |     if(p.at(j)>X) {
      |             ^
Language: C++

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
vector<int> divisor;
using namespace std;
using ll = long long;

int main(){
cin.tie(0);
int x,n;
vector<int> tempResult;
cin >>x >>n;
int p[100];
if(n==0){cout <<x;return 0;}
for(int i=1;i<=n;i++){
  cin >>p[i-1];
}
for(int i=0;i<=n+1;i++){
  int k=0;
  if(i==0)k=x;
  else if(i%2==0)k=x+(i/2);
  else k=x-((i+1)/2);
  int c=0;
  for(int m=0;m<n&&c==0;m++){
   if(p[m]==k)c=1; 
  }
  if(c==0)cout <<k;
}

  
  
return 0;
}

int divisorCheck(int a){

for(int i=2;i*i<=a;i++){
if(a%i==0){
divisor.push_back(i);
divisor.push_back(a/i);
}
}

}

Compiler output:
a.cc:5:1: error: 'vector' does not name a type
    5 | vector<int> divisor;
      | ^~~~~~
a.cc: In function 'int divisorCheck(int)':
a.cc:40:1: error: 'divisor' was not declared in this scope
   40 | divisor.push_back(i);
      | ^~~~~~~
a.cc:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
   45 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  int X, N, A, B;
  vector<int> p(N);
  for(int i=0;i<N;i++) {
    cin >> p.at(i);
  }
  sort(p.begin(),p.end());
  int A, B;
  for(int i=0;i<N;i++) {
    if(p.at(i)<=X) {
      x++;
    }
    if(p.at(j)>X) {
      y++;
    }
  }
  vector<int> s(x),t(y);
  for(int i=0;i<x;i++) {
    s.at(i)=p.at(i);
  }
  reverse(p.begin(),p.end());
  for(int i=0;i<y;i++) {
    t.at(i)=p.at(i);
  }
  reverse(s.begin(),s.end());
  reverse(t.begin(),t.end());
  for(int i=0;i<x+1;i++) {
    A=X-i;
    if(A!=s.at(i)){
      break;
    }
  }
  for(int i=1;i<y+1;i++) {
    B=X+i;
    if(B!=t.at(i-1)){
      break;
    }
  }
  if(X-A>B-X) {
    cout << B << endl;
  }
  else {
    cout << A << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: redeclaration of 'int A'
   10 |   int A, B;
      |       ^
a.cc:4:13: note: 'int A' previously declared here
    4 |   int X, N, A, B;
      |             ^
a.cc:10:10: error: redeclaration of 'int B'
   10 |   int A, B;
      |          ^
a.cc:4:16: note: 'int B' previously declared here
    4 |   int X, N, A, B;
      |                ^
a.cc:13:7: error: 'x' was not declared in this scope
   13 |       x++;
      |       ^
a.cc:15:13: error: 'j' was not declared in this scope
   15 |     if(p.at(j)>X) {
      |             ^
a.cc:16:7: error: 'y' was not declared in this scope
   16 |       y++;
      |       ^
a.cc:19:17: error: 'x' was not declared in this scope
   19 |   vector<int> s(x),t(y);
      |                 ^
a.cc:19:22: error: 'y' was not declared in this scope
   19 |   vector<int> s(x),t(y);
      |                      ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int x , n;
  for (int i =0; i < n; i+=){
    cin >> a;}
   cout >> abs(a-x) >> endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:5:28: error: expected primary-expression before ')' token
    5 |   for (int i =0; i < n; i+=){
      |                            ^
a.cc:6:12: error: 'a' was not declared in this scope
    6 |     cin >> a;}
      |            ^
a.cc:7:16: error: 'a' was not declared in this scope
    7 |    cout >> abs(a-x) >> endl;
      |                ^
Language: C++

#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
ll mo=1000000007;
int main() 
{ 
	ll t1=1;
	//cin>>t1;
	while(t1)
	{
		ll x,n;
		cin>>x>>n;
		ll arr2[101];
		for(ll i=0;i<101;i++)arr2[i]=0;
		ll arr1[n];
		for(ll i=0;i<n;i++)
		{
			cin>>arr1[i];
			arr2[arr1[i]]=1;
		}
		ll ans1=-1;
		for(ll i=x;i>0;i--)
		{
			if(arr2[i]==0)
			{
              ans1=i;
              break;
			}
		}

		ll ans2=-1;
		for(ll i=x+1;i<2*x;i++)
		{
			if(i>100 || arr2[i]==0)
			{
              ans2=i;
              break;
			}
		}
        
        if(ans1=-1 && ans=-1)cout<<"0"<<endl;
		else
		{
			ll ans=min(abs(x-ans1),abs(x-ans2));
		    if(x-ans1==x-ans2)cout<<ans1<<endl;
		else
		{
			if(ans==x-ans1)cout<<ans1<<endl;
			else cout<<ans2<<endl;
		}
	    }
		t1--;
    }
    return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:23: error: 'ans' was not declared in this scope; did you mean 'ans2'?
   41 |         if(ans1=-1 && ans=-1)cout<<"0"<<endl;
      |                       ^~~
      |                       ans2
a.cc:44:28: error: redeclaration of 'll ans'
   44 |                         ll ans=min(abs(x-ans1),abs(x-ans2));
      |                            ^~~
a.cc:41:23: note: '<typeprefixerror>ans' previously declared here
   41 |         if(ans1=-1 && ans=-1)cout<<"0"<<endl;
      |                       ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
bool vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}
 
int main() {
  vector<int> p;
  int X, N;
  cin >> X >> N;
  for (int i = 0; i < N; i++) {
    int pi;
    cin >> pi;
    p.push_back(pi);
  }
  for (int a = 0; a < 101; a++) {
    if (vector_finder(p, N-a)) {
      count << N-a << endl;
      return 0;
    } else if (vector_finder(p, N+a)) {
      count << N+a << endl;
      return 0;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   28 |       count << N-a << endl;
      |       ~~~~~~^~~~~~
a.cc:31:13: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   31 |       count << N+a << endl;
      |       ~~~~~~^~~~~~
Language: C++

    #include <bits/stdc++.h>
    using namespace std;
#include "prettyprint.hpp"
typedef long long ll;
typedef double db;

#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll LINF = LLONG_MAX, MOD = 1e9 + 7, N = 1e5 + 5, LG = 20;
const int INF = INT_MAX;
const db PI = acos(-1), EPS = 1 / db(1e6);

void test() {
    int x, n; cin >> x >> n;
    set<int> st;
    if (n == 0) {
        cout << x << "\n";
        return;
    }
    while (n--) {
        int k; cin >> k;
        st.insert(k);
    }
    int l, r, k = x, m =x;
    while (1) {
        if (st.find(k) == st.end()) {
            l = k;
            break;
        }
        --k;
    }
    while (1) {
        if (st.find(m) == st.end()) {
            r = m;
            break;
        }
        ++m;
    }
    debug(l, r);
    if (x - l <= r - x) {
        cout << l << "\n";
    } else {
        cout << r << "\n";
    }
}

int main() {
      fast_io();
      #ifdef HOME
            freopen("input.txt", "r", stdin);
            freopen("output.txt", "w", stdout);
      #endif
      cout << fixed << setprecision(15);
      int t = 1;
      // cin >> t;
      for (int i = 1; i <= t; ++i) {
          test();
      }
      #ifdef HOME
          cout << "Time: " << (int)(clock() * 1000. / CLOCKS_PER_SEC) << "ms";
      #endif
      return 0;
}


Compiler output:
a.cc:3:10: fatal error: prettyprint.hpp: No such file or directory
    3 | #include "prettyprint.hpp"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
int a;
int b;
int c;
int d;
int e;
cin >> a >> b;
int data[b];
 for(c=0;c<b;c++){
  cin >> data[c];
 }
  for(e=0;a-e<100;e++){
　　for(d = 0;d<data[c];d++){
  　　if(d==a&&d!=data[c]){
  　　　printf("%d",&d);
  　　}
    if (a-e<a-(e-1)){
    printf("%d",&e);
    }
　　}
  }
}


Compiler output:
a.cc:16:1: error: extended character 　 is not valid in an identifier
   16 | 　　for(d = 0;d<data[c];d++){
      | ^
a.cc:16:1: error: extended character 　 is not valid in an identifier
a.cc:17:3: error: extended character 　 is not valid in an identifier
   17 |   　　if(d==a&&d!=data[c]){
      |   ^
a.cc:17:3: error: extended character 　 is not valid in an identifier
a.cc:18:3: error: extended character 　 is not valid in an identifier
   18 |   　　　printf("%d",&d);
      |   ^
a.cc:18:3: error: extended character 　 is not valid in an identifier
a.cc:18:3: error: extended character 　 is not valid in an identifier
a.cc:19:3: error: extended character 　 is not valid in an identifier
   19 |   　　}
      |   ^
a.cc:19:3: error: extended character 　 is not valid in an identifier
a.cc:23:1: error: extended character 　 is not valid in an identifier
   23 | 　　}
      | ^
a.cc:23:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:16:14: error: expected ')' before ';' token
   16 | 　　for(d = 0;d<data[c];d++){
      |        ~     ^
      |              )
a.cc:16:28: error: expected ';' before ')' token
   16 | 　　for(d = 0;d<data[c];d++){
      |                            ^
      |                            ;
Language: C++

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

int solve(long long X, long long N, std::vector<long long> p)
{
    long long index = 0;
    long long q_index = 0;
    long long absx;
    long long mina = 9999999999;
    long long ans;
    vector<long long> q;
    sort(p.begin(), p.end());

    if (N == 0)
    {
        cout << X << endl;
    }

    for (int i = 1; i <= 100; i++)
    {
        if (p[index] != i)
        {

            q.push_back(i);
            q_index++;
        }
        else
        {
            index++;
        }
    }

    for (int i = 0; i < q_index; i++)
    {
        absx = abs(X - q[i]);
        if (mina > absx)
        {
            mina = min(mina, absx);
            ans = q[i];
        }
    }
    cout << q[i] << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long X;
    scanf("%lld", &X);
    long long N;
    scanf("%lld", &N);
    std::vector<long long> p(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &p[i]);
    }
    solve(X, N, std::move(p));
    return 0;
}


Compiler output:
a.cc: In function 'int solve(long long int, long long int, std::vector<long long int>)':
a.cc:42:15: error: 'i' was not declared in this scope
   42 |     cout << q[i] << endl;
      |               ^
a.cc:43:1: warning: no return statement in function returning non-void [-Wreturn-type]
   43 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int X,N;
  cin >> X >> N;
  if(N!=0){
  std::vector<int> v(N);
  for(int i=0;i<N;i++){
    cin >> v.at(i);
  }
  std::vector<int> w;
  w.push_back(0);

  for(int i=1;i<101;i++){
    bool check = false;
    for(int j=0;j<N;j++){
      if(v.at(j)==i){
        check = true;
        break;
      }
    }
    if(!check){
      w.push_back(i);
    }
  }
    w.push_back(101);

  int left=0;
  int right=w.size()-1;
  int mid;
  bool kak =false;

  for(int k=0;k<9;k++){
    mid=(left+right)/2;
    if(X==w.at(mid)){break; kak = true;}
    if(X>w.at(mid))left=mid;
    else if(X<w.at(mid))right=mid;
  }

  if(kak){
    cout << x << endl;
  }else if(abs(w.at(left)-X)<=abs(w.at(right)-X)){
    cout << w.at(left) << endl;
  }else{
    cout << e.at(right) << endl;
  }
  
  }else{
    cout << X << endl;
  }



}




Compiler output:
a.cc: In function 'int main()':
a.cc:42:13: error: 'x' was not declared in this scope
   42 |     cout << x << endl;
      |             ^
a.cc:46:13: error: 'e' was not declared in this scope
   46 |     cout << e.at(right) << endl;
      |             ^
Language: C++

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

int solve(long long X, long long N, std::vector<long long> p)
{
    long long index = 0;
    long long q_index = 0;
    long long absx;
    long long mina = 9999999999;
    vector<long long> q;
    sort(p.begin(), p.end());

    if (N == 0)
    {
        cout << X << endl;
    }

    for (int i = 1; i <= 100; i++)
    {
        if (p[index] != i)
        {

            q.push_back(i);
            q_index++;
        }
        else
        {
            index++;
        }
    }

    for (int i = 0; i < q_index; i++)
    {
        absx = abs(X - q[i]);
        if (mina > absx)
        {
            mina = min(mina, absx);
            ans = q[i];
        }
    }
    cout << q[i] << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long X;
    scanf("%lld", &X);
    long long N;
    scanf("%lld", &N);
    std::vector<long long> p(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &p[i]);
    }
    solve(X, N, std::move(p));
    return 0;
}


Compiler output:
a.cc: In function 'int solve(long long int, long long int, std::vector<long long int>)':
a.cc:38:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   38 |             ans = q[i];
      |             ^~~
      |             abs
a.cc:41:15: error: 'i' was not declared in this scope
   41 |     cout << q[i] << endl;
      |               ^
a.cc:42:1: warning: no return statement in function returning non-void [-Wreturn-type]
   42 | }
      | ^
Language: C++

#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
int a;
int b;
int c;
int d;
int e;
cin >> a >> b;
int data[b];
 for(c=0;c<b;c++){
  cin >> data[c];
 }
  for(e=0;a-e<100;e++)
　　for(d = 0;d<data[c];d++){
  　　if(d==a&&d!=data[c]){
  　　　printf("%d",d);
  　　}
    if (a-e<a-(e-1)){
    printf("%d",&e);
    }
　　}
}


Compiler output:
a.cc:16:1: error: extended character 　 is not valid in an identifier
   16 | 　　for(d = 0;d<data[c];d++){
      | ^
a.cc:16:1: error: extended character 　 is not valid in an identifier
a.cc:17:3: error: extended character 　 is not valid in an identifier
   17 |   　　if(d==a&&d!=data[c]){
      |   ^
a.cc:17:3: error: extended character 　 is not valid in an identifier
a.cc:18:3: error: extended character 　 is not valid in an identifier
   18 |   　　　printf("%d",d);
      |   ^
a.cc:18:3: error: extended character 　 is not valid in an identifier
a.cc:18:3: error: extended character 　 is not valid in an identifier
a.cc:19:3: error: extended character 　 is not valid in an identifier
   19 |   　　}
      |   ^
a.cc:19:3: error: extended character 　 is not valid in an identifier
a.cc:23:1: error: extended character 　 is not valid in an identifier
   23 | 　　}
      | ^
a.cc:23:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:16:14: error: expected ')' before ';' token
   16 | 　　for(d = 0;d<data[c];d++){
      |        ~     ^
      |              )
a.cc:16:28: error: expected ';' before ')' token
   16 | 　　for(d = 0;d<data[c];d++){
      |                            ^
      |                            ;
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
bool vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}

int main() {
  vector<int> p;
  int X, N;
  cin >> X >> N;
  for (int i = 0; i < N; i++) {
    int pi;
    cin >> pi;
    p.push_back(pi);
  }
  for (int a = 0; a < 101; a++) {
    if (vector_finder(p, N-a)) {
      count << N-a << endl;
      return 0;
    } else if (vector_finder(p, N+a)) {
      count << N+a << endl;
      return 0;
    }
  }
}

Compiler output:
a.cc: In function 'bool vector_finder(std::vector<int>, int)':
a.cc:6:18: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
    6 |   auto itr = find(vec.begin(), vec.end(), number);
      |              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:6:18: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
    6 |   auto itr = find(vec.begin(), vec.end(), number);
      |              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:27:7: error: 'count' was not declared in this scope
   27 |       count << N-a << endl;
      |       ^~~~~
a.cc:30:7: error: 'count' was not declared in this scope
   30 |       count << N+a << endl;
      |       ^~~~~
Language: C++

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

int main() {
  int X, N, r, s;
  cin >> X >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
    cin >> p.at(i);
  }
  if (N==0) {
    cout << X << endl;
  }
  else {
    for (int i = 0; i < N; i++) {
      q.at(i)=X-p.at(i);
    }
    for (int j = 0; j < 101; j++) {
      for (int i = 0; i < N; i++) {
        if (j!=X-p.at(i)) {
          r=j;
          break;
        }
      }
    }
    for (int j = 0; j < 101; j++) {
      for (int i = 0; i < N; i++) {
        if ((-1)*j!=X-p.at(i)) {
          s=j;
          break;
        }
      }
    }
    if (r >= s) {
      cout << X-r << endl;
    }
    else {
      cout << X+s << endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:7: error: 'q' was not declared in this scope
   16 |       q.at(i)=X-p.at(i);
      |       ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
 
int main() {
  vector<int> p;
  int X, N;
  cin >> X >> N;
  for (int i = 0; i < N; i++) {
    int pi;
    cin >> pi;
    p.push_back(pi);
  }
  for (int a = 0; a < 101; a++) {
    if (vector_finder(p, N-a)) {
      count << N-a << endl;
      return 0;
    } else if (vector_finder(p, N+a)) {
      count << N+a << endl;
      return 0;
    }
  }
}
 
bool vector_finder(vector<int> vec, int number) {
  auto itr = find(vec.begin(), vec.end(), number);
  size_t index = distance( vec.begin(), itr );
  if (index != vec.size()) {
    return true;
  }
  else {
    return false;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'vector_finder' was not declared in this scope
   15 |     if (vector_finder(p, N-a)) {
      |         ^~~~~~~~~~~~~
a.cc:16:7: error: 'count' was not declared in this scope
   16 |       count << N-a << endl;
      |       ^~~~~
a.cc:19:7: error: 'count' was not declared in this scope
   19 |       count << N+a << endl;
      |       ^~~~~
a.cc: In function 'bool vector_finder(std::vector<int>, int)':
a.cc:26:18: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   26 |   auto itr = find(vec.begin(), vec.end(), number);
      |              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:26:18: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   26 |   auto itr = find(vec.begin(), vec.end(), number);
      |              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main(){
  int X,N;
  cin >> X >> N;
  
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  
  vector<int> B(N);
  for(int i=0;i<N;i++){
    B.push_back(abs(X-A.at(i)));
  }
  
  int min=min_element(B.begin(), B.end());
  int index=distance(B.begin(),min);
  
  cout << A.at(index) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:22: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   18 |   int min=min_element(B.begin(), B.end());
      |           ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      |                      |
      |                      __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:19:21: error: no matching function for call to 'distance(std::vector<int>::iterator, int&)'
   19 |   int index=distance(B.begin(),min);
      |             ~~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 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_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note:   template argument deduction/substitution failed:
a.cc:19:21: note:   deduced conflicting types for parameter '_InputIterator' ('__gnu_cxx::__normal_iterator<int*, std::vector<int> >' and 'int')
   19 |   int index=distance(B.begin(),min);
      |             ~~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/filesystem:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_path.h:1431:1: note: candidate: 'std::ptrdiff_t std::distance(filesystem::__cxx11::path::iterator, filesystem::__cxx11::path::iterator)'
 1431 | distance(filesystem::path::iterator __first, filesystem::path::iterator __last)
      | ^~~~~~~~
/usr/include/c++/14/bits/fs_path.h:1431:37: note:   no known conversion for argument 1 from 'std::vector<int>::iterator' to 'std::filesystem::__cxx11::path::iterator'
 1431 | distance(filesystem::path::iterator __first, filesystem::path::iterator __last)
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
int a;
int b;
int c;
int d;
int e;
cin >> a >> b;
int data[b];
 for(c=0;c<b;c++){
  cin >> data[c];
 }
  for(e=0;a-e<100;e++)
　　for(d = 0;d<data[c];d++){
  　　if(d==x&&d!=data[c]){
  　　　printf("%d",d);
  　　}
    if (a-e<a-(e-1)){
    printf("%d",&e);
    }
　　}
}


Compiler output:
a.cc:16:1: error: extended character 　 is not valid in an identifier
   16 | 　　for(d = 0;d<data[c];d++){
      | ^
a.cc:16:1: error: extended character 　 is not valid in an identifier
a.cc:17:3: error: extended character 　 is not valid in an identifier
   17 |   　　if(d==x&&d!=data[c]){
      |   ^
a.cc:17:3: error: extended character 　 is not valid in an identifier
a.cc:18:3: error: extended character 　 is not valid in an identifier
   18 |   　　　printf("%d",d);
      |   ^
a.cc:18:3: error: extended character 　 is not valid in an identifier
a.cc:18:3: error: extended character 　 is not valid in an identifier
a.cc:19:3: error: extended character 　 is not valid in an identifier
   19 |   　　}
      |   ^
a.cc:19:3: error: extended character 　 is not valid in an identifier
a.cc:23:1: error: extended character 　 is not valid in an identifier
   23 | 　　}
      | ^
a.cc:23:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:16:14: error: expected ')' before ';' token
   16 | 　　for(d = 0;d<data[c];d++){
      |        ~     ^
      |              )
a.cc:16:28: error: expected ';' before ')' token
   16 | 　　for(d = 0;d<data[c];d++){
      |                            ^
      |                            ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X,N,z;
  cin >> X >> N;
  vector<int> p(N);
  for(int i=0;i<N;i++){
    cin >> p.at(i);
  }
  z = p.size();
  int ans1;
  for(int j=0;X-j>0;j++){
    ans1 = X - j;
    int a = 0;
    for(int k=0;k < z);k++){
      if(ans1==p.at(k)){
        a++;
      }
    }
    if(a==0){
      break;
    }
  }
  int ans2;
  for(int l=0;X+l>0;l++){
    ans2 = X + l;
    int b = 0;
    for(int m=0;m < z;m++){
      if(ans2==p.at(m)){
        b++;
      }
    }
    if(b==0){
      break;
    }
  }
  int c,d;
  c = abs(ans1-X);
  d = abs(ans2-X);
  if(c<=d){
    cout << ans1 << endl;
  }
  else{
    cout << ans2<< endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: expected ';' before ')' token
   16 |     for(int k=0;k < z);k++){
      |                      ^
      |                      ;
a.cc:16:24: error: 'k' was not declared in this scope
   16 |     for(int k=0;k < z);k++){
      |                        ^
Language: C++

#include<bits/stdc++.h>
#nclude<iostream>
using namespace std;
int main(){
int a;
int b;
int c;
int d;
int e;
cin >> a >> b;
int data[b];
 for(c=0;c<b;c++){
  cin >> data[c];
 }
  for(e=0;a-e<100;e++)
　　for(d = 0;d<data[c];d++){
  　　if(d==x&&d!=data[c]){
  　　　printf("%d",d);
  　　}
    if (a-e<a-(e-1)){
    printf("%d",&e);
    }
　　}
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #nclude; did you mean #include?
    2 | #nclude<iostream>
      |  ^~~~~~
      |  include
a.cc:16:1: error: extended character 　 is not valid in an identifier
   16 | 　　for(d = 0;d<data[c];d++){
      | ^
a.cc:16:1: error: extended character 　 is not valid in an identifier
a.cc:17:3: error: extended character 　 is not valid in an identifier
   17 |   　　if(d==x&&d!=data[c]){
      |   ^
a.cc:17:3: error: extended character 　 is not valid in an identifier
a.cc:18:3: error: extended character 　 is not valid in an identifier
   18 |   　　　printf("%d",d);
      |   ^
a.cc:18:3: error: extended character 　 is not valid in an identifier
a.cc:18:3: error: extended character 　 is not valid in an identifier
a.cc:19:3: error: extended character 　 is not valid in an identifier
   19 |   　　}
      |   ^
a.cc:19:3: error: extended character 　 is not valid in an identifier
a.cc:23:1: error: extended character 　 is not valid in an identifier
   23 | 　　}
      | ^
a.cc:23:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:16:14: error: expected ')' before ';' token
   16 | 　　for(d = 0;d<data[c];d++){
      |        ~     ^
      |              )
a.cc:16:28: error: expected ';' before ')' token
   16 | 　　for(d = 0;d<data[c];d++){
      |                            ^
      |                            ;
Language: C++

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

int main(){
  int X,N;
  cin >> X >> N;
  
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  
  vector<int> B(N);
  for(int i=0;i<N;i++){
    B.push_back(abs(X-A.at(i)));
  }
  
  int min=min_element(B.begin(), B.end());
  int index=distance(x.begin(),min);
  
  cout << A.at(index) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:22: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   18 |   int min=min_element(B.begin(), B.end());
      |           ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      |                      |
      |                      __gnu_cxx::__normal_iterator<int*, std::vector<int> >
a.cc:19:22: error: 'x' was not declared in this scope
   19 |   int index=distance(x.begin(),min);
      |                      ^
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int X =sc.nextInt();
    int N =sc.nextInt();
    int P[] =new int[N];
    int x =1000;
    int q;int r;
    for(int i=0;i<N;i++){
      P[i]=-X+sc.nextInt();}
    Arrays.sort(P);
    for(int j=0;j<N;j++){
      if(P[i]<0){q =-P[i];}
      else{q=P[i];}
      if(q<x){x =q;r=i;}}
    if(P[r]<0){System.out.println(X-q);}
    else{System.out.println(X+q);}
  }
}

Compiler output:
Main.java:14: error: cannot find symbol
      if(P[i]<0){q =-P[i];}
           ^
  symbol:   variable i
  location: class Main
Main.java:14: error: cannot find symbol
      if(P[i]<0){q =-P[i];}
                       ^
  symbol:   variable i
  location: class Main
Main.java:15: error: cannot find symbol
      else{q=P[i];}
               ^
  symbol:   variable i
  location: class Main
Main.java:16: error: cannot find symbol
      if(q<x){x =q;r=i;}}
                     ^
  symbol:   variable i
  location: class Main
4 errors
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<limits>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0;i < (n); ++i)

int main() {
	int x, n;
	cin >> x >> n;
	vector<int> p(n);
	rep(i, n)cin >> p[i];
	sort(p.begin(), p.end());

	if (n == 0) {
		cout << x << endl;
		return 0;
	}
	int cc = 0;
	rep(i, n) {
		if(p[i] == 1)
	}
	

	int count =0;
	rep(i, n) {
		if (p[i] != x)count++;
	}
	if (count == n) {
		cout << x << endl;
		return 0;
	}

	vector<int>countp(n, 0);
	vector<int>countm(n, 0);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (x - i != p[j])countm[i]++;
			if (x + i != p[j])countp[i]++;
			
		}
	}
	rep(i, n) {
		if (countm[i] == n) {
			cout << x - i << endl;
			return 0;
		}
		if (countp[i] == n) {
			cout << x + i << endl;
			return 0;
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: expected primary-expression before '}' token
   26 |         }
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int X, N;
  cin >> X >> N;
  vector<int> p (N);
  for(int i =0; i < N; i++){
    cin >> p[i];
  }
  bool judge = true;
  vector<int> hantei(2);
  for(int i = X; i < X + 101; i++){
    for(int j = 0; j < N; j++){
      if(p[j]== i){
        judge = false;
        break;
      }
    }
    if(judge == true){
      hantei[0] = i;
      break;
    }else{
      judge = true;
    }
  }
  bool sinpan = true;
  for(int i = X-1; i > X - 101; i--){
    for(int j = 0; j < N; j++){
      if(p[j]== i){
        shinpan = false;
        break;
      }
    }
    if(shinpan == true){
      hantei[1] = i;
      break;
    }else{
      shinpan = true;
    }
  }
  cout << min(hantei[0], hantei[1]) << endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'shinpan' was not declared in this scope; did you mean 'sinpan'?
   30 |         shinpan = false;
      |         ^~~~~~~
      |         sinpan
a.cc:34:8: error: 'shinpan' was not declared in this scope; did you mean 'sinpan'?
   34 |     if(shinpan == true){
      |        ^~~~~~~
      |        sinpan
Language: C++

int main() {
    int x, n, temp;
	//input init condition
    cin >> x >> n;
    int p[102] = {};

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

    int i = 0;

    for (; x - i >= 0 || x + i <= 101; i++) {
        if (x - i >= 0 && p[x - i] == 0) {
			//remove the end
            cout << x - i;
            return 0;
        } else if (x + i <= 101 && p[x + i] == 0) {
            cout << x + i;
            return 0;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> x >> n;
      |     ^~~
a.cc:17:13: error: 'cout' was not declared in this scope
   17 |             cout << x - i;
      |             ^~~~
a.cc:20:13: error: 'cout' was not declared in this scope
   20 |             cout << x + i;
      |             ^~~~
Language: C++

#include<vector>
#include <iostream>
#include<string>
#include <complex>
#include <algorithm>
#include<string>


using namespace std;

int main(){

    int x, n;
    cin >> x;
    cin >> n;
    if(n == 0){
        cout << x << endl;
        return 0;
    }
    vector<int> p(n);
    for(int i = 0; i< n; i++){
        cin >> p[i];
    }


    int z = 1;
    int res = 0;
    vector<int>::iterator itr;
    while(true){
        itr = find(p.begin(), p.end(), x-z);
        if( itr == p.end() ){
            flag = 2;
            res = x-z;
            break;
        }
        itr = find(p.begin(), p.end(), x+z);
        if( itr == p.end() ){
            flag = 1;
            res = x+z;
            break;
        }
        z++;
    }

    cout << res << endl;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:13: error: 'flag' was not declared in this scope
   32 |             flag = 2;
      |             ^~~~
a.cc:38:13: error: 'flag' was not declared in this scope
   38 |             flag = 1;
      |             ^~~~
Language: C++

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

int main(){
  int x,n;
  cin >> x >> n;

  if(n==0){
    cout << x << endl;
  }
  else{
  int N[110];
  int minn = 100;
  int minm = 100;
  
  for (int i = 0;i < n;i++) {
    cin >> N[i];
  }

  for (int i = 1;i < 101;i++){
    for (int j = 0;j < n;i++) {
      if(i <= x && i != N[j]){

        int c = x - i;
        if(c < minn){
          minn = c;
        }
      }

      for (int j = 0;j < n;i++) {
      if(i > x && i != N[j]){

        int d = i - x;
        if(d < minm){
          minm = d;
        }
      }
      }       
    }
  }
 if(minn <= mimm){

   cout << x - minn << endl;
 }

 if(minn > mimm){
   cout << x + mimm << endl;
 }
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:13: error: 'mimm' was not declared in this scope; did you mean 'minm'?
   41 |  if(minn <= mimm){
      |             ^~~~
      |             minm
a.cc:46:12: error: 'mimm' was not declared in this scope; did you mean 'minm'?
   46 |  if(minn > mimm){
      |            ^~~~
      |            minm
Language: C++

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

int main() {
int X,N;
int ans=0;
cin >> X >> N;
vector<int> p(N);
for(int i=0;i<N;i++){
    cin >> p.at(i);
}
for(int i=0;i<N;i++){
    p.at(i) =abs(X-p.at(i));
}
sort(p.begin(), p.end());
for(int i=0;i<N;i++){
    if(i==p.at(0)){;}
    for(int j=1;j<N;j++){
        else if(i==p.at(j)){;}
    }
    else {ans=i;}
}
ans += X;
cout << ans <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'else' without a previous 'if'
   20 |         else if(i==p.at(j)){;}
      |         ^~~~
a.cc:22:5: error: 'else' without a previous 'if'
   22 |     else {ans=i;}
      |     ^~~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,x,l,i,r,f=0,lf,rf;
  cin>>x>>n;
  int ar[n];
  for(i=0; i<n; i++)
  {
    cin>>ar[i];
  }
l=x;
r=x;
  while(f==0)
 { 
     l--;
     r++;
     lf=0;
     rf=0;
     for(i=0; i<n; i++)
     {
         if(ar[i]!=l)
         lf++;
         if(ar[i]!=r)
         rf++;
     }
     
     if(lf==n)
     f=1;
     else
     if(rf==n)
     f=2;
     
 }
  
 if(f==1)
 cout<<l;
 else
   if(f==2)
 cout<<r;
  else
    if(n==0)
      cout<<k;
    
}


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

#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
int main(){
  int A,n,i,j;
  int a[101];
  scanf("%d %d",&A,&n);
  if(n==0){
    printf("%d",A);
    return 0;
  }
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  sort(a,a+n);
  for(i=0;i<n;i++){
    for(j=1;j<n;j++){
    	if((a[j]-A-i)==0){
          if(a[j]-i > a[j-1]){
            printf("%d",a[j]-i);
            return 0;
          }else if((a[j]+i) < a[j+1]){
            printf("%d",a[j]+i);
            return 0;
          }
        }
     }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   15 |   sort(a,a+n);
      |   ^~~~
      |   std::sort
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
Language: C++

#include<vector>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
  int x,n,temp;
  vector<int> list;
  for(int i=0;i<n;i++)
  {
    cin>>temp
    list.push_back(temp);
  }
  temp=1;
  while(1)
  {
   if(find(list.begin(),list.end(),x-temp)!=list.end())
   {
     cout<<x-temp;
     exit(0);
   }
   else if(list.begin(),list.end(),x+temp)!=list.end())
   {
     cout<<x+temp;
     exit(0);
   }
   else
     temp++;
  }
  return 0;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: expected ';' before 'list'
   11 |     cin>>temp
      |              ^
      |              ;
   12 |     list.push_back(temp);
      |     ~~~~      
a.cc:22:22: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::begin() [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator]', declared with attribute 'nodiscard' [-Wunused-result]
   22 |    else if(list.begin(),list.end(),x+temp)!=list.end())
      |            ~~~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:873:7: note: declared here
  873 |       begin() _GLIBCXX_NOEXCEPT
      |       ^~~~~
a.cc:22:43: error: expected primary-expression before '!=' token
   22 |    else if(list.begin(),list.end(),x+temp)!=list.end())
      |                                           ^~
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
int main(){
  int A,n,i,j;
  int a[101];
  scanf("%d %d",&A,&n);
  if(n==0){
    printf("%d",A);
    return 0;
  }
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  sort(a,a+n);
  for(i=0;i<n;i++){
    for(j=1;j<n;j++){
    	if((a[j]-A-i)==0){
          if(a[j]-i > a[j-1]){
            printf("%d",a[j]-i);
            return 0;
          }else if((a[j]+i) < a[j+1]){
            printf("%d",a[j]+i);
            return 0;
          }
        }
    }
  }
}

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

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

int main(){
  int x,n;
  cin >> x >> n;

  if(n==0){
    cout << x << endl;
  }
  else{
  int N[110];
  int minn = 100;
  int minm = 100;
  for (int i = 0;i < n;i++) {
    cin >> N[i];
  }

  for (int i = 1;i < 101;i++){
    for (int j = 0;j < n;i++) {
      if(i <= x && i != N[j]){

        int c = x - i;
        if(c < minn){
          minn = c;
        }
      }

      for (int j = 0;j < n;i++) {
      if(i > x && i != N[j]){

        int d = i - x;
        if(d < minm){
          minm = m;
        }
      }
      }



        

    }
  }
 if(c <= d){

   cout << x - c << endl;
 }

 if(c > d){
   cout << x + d << endl;
 }
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:18: error: 'm' was not declared in this scope
   34 |           minm = m;
      |                  ^
a.cc:45:5: error: 'c' was not declared in this scope
   45 |  if(c <= d){
      |     ^
a.cc:45:10: error: 'd' was not declared in this scope
   45 |  if(c <= d){
      |          ^
a.cc:50:5: error: 'c' was not declared in this scope
   50 |  if(c > d){
      |     ^
a.cc:50:9: error: 'd' was not declared in this scope
   50 |  if(c > d){
      |         ^
Language: Java


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define pi 3.1415926535898
#define ll long long
#define int long long
typedef std::pair<long long,long long> pll;
typedef std::pair<int,int> pii;
typedef std::vector<int> vi;
typedef std::vector<long long> vll;
typedef double db;
const ll mod=1e9+7;
ll powmod(ll a,ll b,ll p){ll res=1;a%=p;while(b){if(b&1) res=res*a%p;a=a*a%p;b>>=1;}return res;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
signed main()
{
    int t=1;
    //cin>>t;
    while (t--){
        int x,n;
        cin>>x>>n;
        set<int> set;
        for (int i = 0; i < n ; ++i) {
            int ni;
            cin>>ni;
            set.insert(ni);
        }
        if(n==0) {
            cout<<x<<endl;
            break;
        }
        int i=0;
        while (1){
            if(!set.count(x-i)) {
                cout<<x-i<<endl;
                break;
            }
            if(!set.count(x+i)){
                cout<<x+i<<endl;
                break;
            }
            i++;
        }

    }
}

Compiler output:
Main.java:2: error: illegal character: '#'
#include<iostream>
^
Main.java:3: error: illegal character: '#'
#include<bits/stdc++.h>
^
Main.java:5: error: illegal character: '#'
#define pi 3.1415926535898
^
Main.java:5: error: class, interface, enum, or record expected
#define pi 3.1415926535898
        ^
Main.java:6: error: illegal character: '#'
#define ll long long
^
Main.java:7: error: illegal character: '#'
#define int long long
^
Main.java:9: error: class, interface, enum, or record expected
typedef std::pair<int,int> pii;
^
Main.java:10: error: class, interface, enum, or record expected
typedef std::vector<int> vi;
^
Main.java:11: error: class, interface, enum, or record expected
typedef std::vector<long long> vll;
^
Main.java:12: error: class, interface, enum, or record expected
typedef double db;
^
Main.java:13: error: class, interface, enum, or record expected
const ll mod=1e9+7;
^
Main.java:14: error: unnamed classes are a preview feature and are disabled by default.
ll powmod(ll a,ll b,ll p){ll res=1;a%=p;while(b){if(b&1) res=res*a%p;a=a*a%p;b>>=1;}return res;}
^
  (use --enable-preview to enable unnamed classes)
Main.java:22: error: not a statement
        cin>>x>>n;
              ^
Main.java:26: error: not a statement
            cin>>ni;
               ^
Main.java:30: error: not a statement
            cout<<x<<endl;
                   ^
Main.java:36: error: not a statement
                cout<<x-i<<endl;
                         ^
Main.java:40: error: not a statement
                cout<<x+i<<endl;
                         ^
17 errors
Language: C++

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

int main() {
  int X, N;
  cin >> X >> N;
  vector<int> vecP(N);
  vector<int> vecD(N);
  vector<int> vecAns(N, 101);
  
  for (int i = 0; i < N; i++) {
    int p, q;
    cin >> p;
    vecP.at(i) = p; //入力値の配列
    q = vecP.at(i);
    vecD.at(i) = abs(q-X); //差の絶対値のベクトル
  }
  
  int counter = 0;
  for (int j = 0; j < 101; j++) {
    for (int i = 0; i < N; i++) {
      if (vecD.at(i) == j) {
      vecAns.at(i) = vecP.at(i);
      counter++;
    }
      if (counter == 0)
        continue;
      else if (counter != 0)
        break;
  }
    sort(vecAns.begin(), vecAns.end());
    cout << vecAns.at(0) << endl;
}  


Compiler output:
a.cc: In function 'int main()':
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
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> p(n);
  bool flag = 0;
  rep(i, n) {
    cin >> p.at(i);
    if(p.at(i) == x)
      flag = 1;
  }
  if(flag == 0){
    cout << x << endl;
    return 0;
  }
  
  sort(p.begin(), p.end());
  bool flag2 = 0;
  int a = x;
  int b = x;
  while(flag2 == 0){
    if(find(p.begin(), p.end(), a) != p.end()){
      a--;
    }
    else{
      ans1 = a;
      flag2 = 1;
    }
    if(find(p.begin(), p.end(), b) != p.end()){
      b++;
    }
    else{
      ans2 = b;
      flag2 = 1;
    }
  }
  if(abs(x-a) <= abs(b-x))
    cout << a << endl;
  else 
    cout << b << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:31:7: error: 'ans1' was not declared in this scope
   31 |       ans1 = a;
      |       ^~~~
a.cc:38:7: error: 'ans2' was not declared in this scope
   38 |       ans2 = b;
      |       ^~~~