func_code_string: #include <bits/stdc++.h>   using namespace std;   using LL = long long;   using pii = pair<int, int>;   const int mod = 998244353;   const int inf = 0x3f3f3f3f;   const int N = 2e5 + 10;   int n, m, a[N];   LL sum[N], fac[N], rev[N];   LL pow_mod(LL x, int p) {     LL s = 1;     while (p) {       if (p & 1) s = s * x % mod;       x = x * x % mod;       p >>= 1;     }     return s;   }   LL C(int n, int m) { return fac[n] * rev[m] % mod * rev[n - m] % mod; }   LL solve(int A, int d) {     int p = lower_bound(a, a + n, d) - a;     int q = n - p;     if (q < A) return 0;     LL ret1, ret2;     if (q > A) {       ret1 = C(n, q) * C(q - 1, A) % mod * (q - A) % mod *              ((sum[n] - sum[p] + mod) % mod) % mod * fac[p] % mod * fac[A] % mod *              fac[q - 1 - A] % mod;     } else {       ret1 = 0;     }     if (p) {       ret2 = C(n, q + 1) * C(q, A) % mod * (q + 1 - A) % mod * sum[p] % mod *              fac[p - 1] % mod * fac[A] % mod * fac[q - A] % mod;     } else {       ret2 = 0;     }     LL ret = (ret1 + ret2) % mod;     return ret * rev[n] % mod;   }   int main() {     int x, y;     scanf( %d %d , &n, &m);     for (int i = (0); i < (n); ++i) scanf( %d , a + i);     sort(a, a + n);     fac[0] = 1;     for (int i = (1); i < (n + 1); ++i) {       fac[i] = fac[i - 1] * i % mod;     }     rev[n] = pow_mod(fac[n], mod - 2);     for (int i = (n); i > (0); --i) rev[i - 1] = rev[i] * i % mod;     sum[0] = 0;     for (int i = (0); i < (n); ++i) {       sum[i + 1] = (sum[i] + a[i]) % mod;     }     while (m--) {       scanf( %d %d , &x, &y);       printf( %lld n , solve(x, y));     }     return 0;   }   