func_code_string: #include <bits/stdc++.h>   using namespace std;   void fun() {}   long long mod = 1000000000 + 7;   long long powe(long long x, long long y) {     x = x % mod, y = y % (mod - 1);     long long ans = 1;     while (y > 0) {       if (y & 1) {         ans = (1ll * x * ans) % mod;       }       y >>= 1;       x = (1ll * x * x) % mod;     }     return ans;   }   map<pair<long long, long long>, long long> m;   long long ncr(long long n, long long r) { return n * (n - 1) * (n - 2) / 6; }   int32_t main() {     fun();     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long t, temp;     long long n, s, k;     cin >> t;     while (t--) {       cin >> n >> s >> k;       long long a[k];       long long i;       long long num;       for (i = 0; i < k; i++) {         cin >> num;         a[i] = num;       }       sort(a, a + k);       long long num1 = INT_MAX, num2 = INT_MAX;       for (i = s; i >= 1; i--) {         if (!binary_search(a, a + k, i)) {           num1 = i;           break;         }       }       for (i = s; i <= n; i++) {         if (!binary_search(a, a + k, i)) {           num2 = i;           break;         }       }       if (num1 == INT_MAX)         cout << num2 - s <<   n ;       else if (num2 == INT_MAX)         cout << s - num1 <<   n ;       else         cout << min(s - num1, num2 - s) <<   n ;     }   }   