Language: C++

// Name: Kanisht Agarwal Copyright Think before u copy //
//Connect with me at LinkedIn

#include <bits/stdc++.h>
#define mod 1000000007
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi 3.1415926535897932
#define nui 100
#define INF 100000000000
using namespace std;

ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res *= a;
        }
        a *= a;
        b >>= 1;
    }
    return res;
}

ll fermat_inv(ll y) {return binpow(y, mod - 2);}

clock_t time_p = clock();

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

struct point
{
    int x; int y;
};
bool segment(point p, point q, point r)
{
    if (q.x <= max(p.x, r.x) && q.y <= max(p.y, r.y) && q.x >= min(p.x, r.x) && q.y >= min(p.y, r.y))
        return true;

    return false;
}
int orientation(point p, point q, point r)
{
    int o = (r.x - q.x) * (q.y - p.y) - (r.y - q.y) * (q.x - p.x);
    if (o == 0)return 0;
    return (o > 0) ? 1 : 2;
}
bool intersection(point p, point q, point r, point s)
{
    int o1 = orientation(p, q, r);
    int o2 = orientation(p, q, s);
    int o3 = orientation(r, s, p);
    int o4 = orientation(r, s, q);
    if (o1 != o2 && o3 != o4)return true;
    if (o1 == 0 && segment(p, r, q))return true;
    if (o2 == 0 && segment(p, s, q))return true;
    if (o3 == 0 && segment(r, p, s))return true;
    if (o4 == 0 && segment(r, q, s))return true;

    return false;
}
ll binpowmod(ll a, ll b, ll m)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = ((res % m) * (a % m)) % m;
        }
        a = ((a % m) * (a % m)) % m;
        b >>= 1;
    }
    return res;
}
/*bool prime[10000001];
map<int, int>m;
vector<ll>v;
void sieve()
{
    memset(prime, 1, sizeof(prime));
    for (ll i = 2; i * i <= 10000001; i++)
    {
        if (prime[i] == 1)
        {
            for (ll j = i * i; j <= 10000001; j += i)
            {
                prime[j] = 0;
            }
        }
    }
    v.pb(2);
    m[2]++;
    for (ll i = 3; i <= 3000; i += 2)
    {
        if (prime[i])
        {
            v.pb(i);
            m[i]++;
        }
    }

}
/*
ll fact(ll n)
{
    ll res = 1;
    for (ll i = n; i >= 1; i--)
    {
        res *= i;
    }
    return res;
}
ll a[2][2], I[2][2];

void mulmat(ll A[][2], ll B[][2])
{
    ll res[2][2];
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            res[i][j] = 0;
            for (int k = 0; k < 2; k++)
            {
                res[i][j] += (A[i][k] % mod) * (B[k][j] % mod);
            }
        }
    }
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            A[i][j] = res[i][j] % mod;
        }
    }
}
void calpowmod(ll A[][2], ll n)
{
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            if (i == j)
            {
                I[i][j] = 1;
            }
            else
            {
                I[i][j] = 0;
            }
        }
    }
    while (n)
    {
        if (n & 1)
        {
            mulmat(I, A);
            n--;
        }
        else
        {
            mulmat(A, A);
            n >>= 1;
        }

    }
    for (ll i = 0; i < 2; i++)
    {
        for (ll j = 0; j < 2; j++)
        {
            A[i][j] = I[i][j] % mod;
        }
    }
    cout << A[1][0] % mod << "\n";
}*/

int h, w, k;
char a[7][7];
char b[7][7];

void cp()
{
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            b[i][j] = a[i][j];
        }
    }
}

bool check(int x, int y)
{
    int ct = 0;
    for (int i = 0; i < h; i++) //rows;
    {
        if (x & (1 << i))
        {
            for (int j = 0; j < w; j++)
            {
                b[i][j] = '&';
            }
        }
    }
    for (int i = 0; i < w; i++)
    {
        if (y & (1 << i))
        {
            for (int j = 0; j < h; j++)
            {
                b[j][i] = '&';
            }
        }
    }
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (b[i][j] == '#')
            {
                ct++;
            }
        }
    }
    if (ct == k)
    {
        return true;
    }
    else
    {
        return false;
    }

}

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //Problem A:


    int x, n;
    cin >> x >> n;
    int a[n];
    map<int, int>m;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        m[a[i]]++;
    }
    int mini = 101;
    int ans = 0;
    for (int i = 0 i <= 101; i++)
    {
        if (!m[i])
        {
            if (mini > abs(x - i))
            {
                mini = abs(x - i);
                ans = i;
            }
        }
    }
    cout << ans << "\n";

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:274:19: error: expected ';' before 'i'
  274 |     for (int i = 0 i <= 101; i++)
      |                   ^~
      |                   ;