func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T, typename U>   T pow_mod(T a, U b, int mod) {     T r = 1;     for (; b > 0; b >>= 1) {       if (b & 1) r = (long long)r * a % mod;       a = (long long)a * a % mod;     }     return r;   }   namespace combinatorics {   const int mod = 1e9 + 7, N = 2e3 + 5;   int fac[N], ifac[N];   void init() {     fac[0] = ifac[0] = 1;     for (int i = 1; i < N; ++i) {       fac[i] = (long long)fac[i - 1] * i % mod;       ifac[i] = pow_mod(fac[i], mod - 2, mod);     }   }   int comb(int n, int k) {     return (long long)fac[n] * ifac[n - k] % mod * ifac[k] % mod;   }   }  // namespace combinatorics   using namespace combinatorics;   int main() {     ios_base::sync_with_stdio(0), cin.tie(0);     init();     int t = 1;     while (t--) {       int n, x, p;       cin >> n >> x >> p;       vector<int> a(n), c(2);       a[p] = 1;       auto f = [&]() {         int l = 0, r = n;         while (l < r) {           int m = (l + r) >> 1;           if (m <= p) {             c[0] += a[m] == 0;             a[m] = -1;             l = m + 1;           } else {             c[1] += a[m] == 0;             a[m] = +1;             r = m;           }         }       };       f();       int ans = 0;       if (n - x >= c[1] && x - 1 >= c[0])         ans = (long long)comb(n - x, c[1]) * comb(x - 1, c[0]) % mod *               fac[n - 1 - c[0] - c[1]] % mod * fac[c[0]] % mod * fac[c[1]] % mod;       cout << ans <<   n ;     }     return 0;   }   