Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define sd(t)       scanf("%d",&(t))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define hii         cout << "hii" << endl
#define okay        cout << "okay" << endl
#define hey         cout << "hey" << endl
const int INF = 1e16;
const int MOD = 998244353;
const int mod = 1e9+7;


template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.x << ' ' << v.y; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.x << "=>" << i.y << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


clock_t time_p=clock();
void starboy1299()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("jjj.txt", "w", stdout);
    #endif
} 

inline int mul(int a, int b, int m = mod) { return (a * b) % m; }
inline int add(int a, int b, int m = mod) { return (a + b) % m; }
inline int sub(int a, int b, int m = mod) { return (a - b + m) % m; }

const int N = 2e5+5;

void solve()
{   
    int x, n;
    cin >> x >> n;

    vi arr(101);

    rep(i, 0, n){
        int a; cin >> a;
        arr[a] = 1;
    }

    int i=x, j=x;

    while(i > 0 and j < 101){ 
        if(arr[i]==0){
            cout << i << endl;
            return;
        }
        else if(arr[j]==0){
            cout << j << endl;
            return;
        }
        else{
            i--;
            j++;
        }
    }

    while(i > 0){
        if(arr[i]==0){
            cout << i << endl;
            return;
        }
        i--;
    }

    while(j < 101){
        if(arr[j]==0){
            cout << j << endl;
            return;
        }
        j++;
    }

}                            

int32_t main(){
    fast();
    int t = 1;
    // cin>> t;
    for(int i=1; i<=t; i++){
        // cout << "Case #" << i << ": ";
        solve();
    }
    starboy1299();
}#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define sd(t)       scanf("%d",&(t))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define hii         cout << "hii" << endl
#define okay        cout << "okay" << endl
#define hey         cout << "hey" << endl
const int INF = 1e16;
const int MOD = 998244353;
const int mod = 1e9+7;


template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.x << ' ' << v.y; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.x << "=>" << i.y << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE


clock_t time_p=clock();
void starboy1299()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("jjj.txt", "w", stdout);
    #endif
} 

inline int mul(int a, int b, int m = mod) { return (a * b) % m; }
inline int add(int a, int b, int m = mod) { return (a + b) % m; }
inline int sub(int a, int b, int m = mod) { return (a - b + m) % m; }

const int N = 2e5+5;

void solve()
{   
    int x, n;
    cin >> x >> n;

    vi arr(101);

    rep(i, 0, n){
        int a; cin >> a;
        arr[a] = 1;
    }

    int i=x, j=x;

    while(i > 0 and j < 101){ 
        if(arr[i]==0){
            cout << i << endl;
            return;
        }
        else if(arr[j]==0){
            cout << j << endl;
            return;
        }
        else{
            i--;
            j++;
        }
    }

    while(i > 0){
        if(arr[i]==0){
            cout << i << endl;
            return;
        }
        i--;
    }

    while(j < 101){
        if(arr[j]==0){
            cout << j << endl;
            return;
        }
        j++;
    }

}                            

int32_t main(){
    fast();
    int t = 1;
    // cin>> t;
    for(int i=1; i<=t; i++){
        // cout << "Case #" << i << ": ";
        solve();
    }
    starboy1299();
}

Compiler output:
a.cc:129:2: error: stray '#' in program
  129 | }#include <bits/stdc++.h>
      |  ^
a.cc:129:3: error: 'include' does not name a type
  129 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:148:11: error: redefinition of 'const long long int INF'
  148 | const int INF = 1e16;
      |           ^~~
a.cc:20:11: note: 'const long long int INF' previously defined here
   20 | const int INF = 1e16;
      |           ^~~
a.cc:149:11: error: redefinition of 'const long long int MOD'
  149 | const int MOD = 998244353;
      |           ^~~
a.cc:21:11: note: 'const long long int MOD' previously defined here
   21 | const int MOD = 998244353;
      |           ^~~
a.cc:150:11: error: redefinition of 'const long long int mod'
  150 | const int mod = 1e9+7;
      |           ^~~
a.cc:22:11: note: 'const long long int mod' previously defined here
   22 | const int mod = 1e9+7;
      |           ^~~
a.cc:153:29: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)'
  153 | template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
      |                             ^~~~~~~~
a.cc:25:29: note: 'template<class T> std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)' previously declared here
   25 | template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
      |                             ^~~~~~~~
a.cc:154:29: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, const std::set<T>&)'
  154 | template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
      |                             ^~~~~~~~
a.cc:26:29: note: 'template<class T> std::ostream& operator<<(std::ostream&, const std::set<T>&)' previously declared here
   26 | template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
      |                             ^~~~~~~~
a.cc:155:38: error: redefinition of 'template<class T, class S> std::ostream& operator<<(std::ostream&, const std::pair<_T1, _T2>&)'
  155 | template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.x << ' ' << v.y; return os; }
      |                                      ^~~~~~~~
a.cc:27:38: note: 'template<class T, class S> std::ostream& operator<<(std::ostream&, const std::pair<_T1, _T2>&)' previously declared here
   27 | template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.x << ' ' << v.y; return os; }
      |                                      ^~~~~~~~
a.cc:156:38: error: redefinition of 'template<class T, class S> std::ostream& operator<<(std::ostream&, const std::unordered_map<T, S>&)'
  156 | template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.x << "=>" << i.y << ')' << ' '; return os; }
      |                                      ^~~~~~~~
a.cc:28:38: note: 'template<class T, class S> std::ostream& operator<<(std::ostream&, const std::unordered_map<T, S>&)' previously declared here
   28 | template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.x << "=>" << i.y << ')' << ' '; return os; }
      |                                      ^~~~~~~~
a.cc:161:32: error: redefinition of 'template<class Arg1> void __f(const char*, Arg1&&)'
  161 |     template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
      |                                ^~~
a.cc:33:32: note: 'template<class Arg1> void __f(const char*, Arg1&&)' previously declared here
   33 |     template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
      |                                ^~~
a.cc:163:10: error: redefinition of 'template<class Arg1, class ... Args> void __f(const char*, Arg1&&, Args&& ...)'
  163 |     void __f(const char* names, Arg1&& arg1, Args&&... args) {
      |          ^~~
a.cc:35:10: note: 'template<class Arg1, class ... Args> void __f(const char*, Arg1&&, Args&& ...)' previously declared here
   35 |     void __f(const char* names, Arg1&& arg1, Args&&... args) {
      |          ^~~
a.cc:177:9: error: redefinition of 'clock_t time_p'
  177 | clock_t time_p=clock();
      |         ^~~~~~
a.cc:49:9: note: 'clock_t time_p' previously declared here
   49 | clock_t time_p=clock();
      |         ^~~~~~
a.cc:178:6: error: redefinition of 'void starboy1299()'
  178 | void starboy1299()
      |      ^~~~~~~~~~~
a.cc:50:6: note: 'void starboy1299()' previously defined here
   50 | void starboy1299()
      |      ^~~~~~~~~~~
a.cc:184:6: error: redefinition of 'void fast()'
  184 | void fast()
      |      ^~~~
a.cc:56:6: note: 'void fast()' previously defined here
   56 | void fast()
      |      ^~~~
a.cc:195:12: error: redefinition of 'long long int mul(long long int, long long int, long long int)'
  195 | inline int mul(int a, int b, int m = mod) { return (a * b) % m; }
      |            ^~~
a.cc:67:12: note: 'long long int mul(long long int, long long int, long long int)' previously defined here
   67 | inline int mul(int a, int b, int m = mod) { return (a * b) % m; }
      |            ^~~
a.cc:196:12: error: redefinition of 'long long int add(long long int, long long int, long long int)'
  196 | inline int add(int a, int b, int m = mod) { return (a + b) % m; }
      |            ^~~
a.cc:68:12: note: 'long long int add(long long int, long long int, long long int)' previously defined here
   68 | inline int add(int a, int b, int m = mod) { return (a + b) % m; }
      |            ^~~
a.cc:197:12: error: redefinition of 'long long int sub(long long int, long long int, long long int)'
  197 | inline int sub(int a, int b, int m = mod) { return (a - b + m) % m; }
      |            ^~~
a.cc:69:12: note: 'long long int sub(long long int, long long int, long long int)' previously defined here
   69 | inline int sub(int a, int b, int m = mod) { return (a - b + m) % m; }
      |            ^~~
a.cc:199:11: error: redefinition of 'const long long int N'
  199 | const int N = 2e5+5;
      |           ^
a.cc:71:11: note: 'const long long int N' previously defined here
   71 | const int N = 2e5+5;
      |           ^
a.cc:201:6: error: redefinition of 'void solve()'
  201 | void solve()
      |      ^~~~~
a.cc:73:6: note: 'void solve()' previously defined here
   73 | void solve()
      |      ^~~~~
a.cc:248:9: error: redefinition of 'int32_t main()'
  248 | int32_t main(){
      |         ^~~~
a.cc:120:9: note: 'int32_t main()' previously defined here
  120 | int32_t main(){
      |         ^~~~