func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long long int n, i, j, k, l = 0, s, x, y, z = 0, r = 1000000001, rr = 0;       cin >> n >> s >> k;       long long int a[k];       for (i = 0; i < k; i++) cin >> a[i];       sort(a, a + k);       for (i = 0; i < k; i++) {         if (a[i] == s) z = 1;       }       if (z == 0)         cout <<  0  << endl;       else if (z == 1 && k == 1)         cout <<  1  << endl;       else {         if (a[0] != 1) {           r = std::min(r, s - (a[0] - 1));           r = std::min(r, s - 1);         }         if (a[k - 1] != n) {           r = std::min(r, (a[k - 1] + 1) - s);           r = std::min(r, n - s);         }         for (i = 0; i < k - 1; i++) {           if ((a[i + 1] - a[i]) > 1) {             rr = a[i + 1] - 1;             if (a[i] >= s) {               rr = a[i] + 1;               r = std::min(r, (rr - s));             } else if (a[i + 1] <= s) {               rr = a[i + 1] - 1;               r = std::min(r, (s - rr));             }           }         }         cout << r << endl;       }     }     return 0;   }   