func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 7, N = 3e5 + 7, M = 998244353;   vector<int> G[N], add[N], del[N];   long long f[N], fi[N], inv[N];   int cans[41], dp[1 << 20][21];   int C(int n, int k) { return f[n] * fi[k] % M * fi[n - k] % M; }   void ADD(int& a, int b) {     a += b;     if (a >= M) a -= M;   }   signed main() {     std::ios::sync_with_stdio(0);     std::cin.tie(0);     ;     f[0] = 1;     for (int i = 1; i < N; i++) f[i] = f[i - 1] * i % M;     inv[1] = 1;     for (int i = 2; i < N; i++) inv[i] = M - M / i * inv[M % i] % M;     fi[0] = 1;     for (int i = 1; i < N; i++) fi[i] = fi[i - 1] * inv[i] % M;     int n, m;     cin >> n >> m;     for (int i = 1; i <= n; i++) {       int l, r;       cin >> l >> r;       add[l].push_back(i);       del[r + 1].push_back(i);     }     for (int i = 0; i < m; i++) {       int u, v;       cin >> u >> v;       G[u].push_back(i);       G[v].push_back(i);     }     long long ans = 0, cnt = 0, cnt1 = 0;     dp[0][0] = cans[0] = 1;     for (int i = 1; i <= n; i++) {       bool change = false;       for (int j : add[i]) {         if (G[j].size()) {           int mask = 0;           for (int k : G[j]) mask |= 1 << k;           for (int k = 0; k < (1 << m); k++)             for (int l = 1; l <= 20; l++)               if ((k & mask) == mask) ADD(dp[k][l], dp[k ^ mask][l - 1]);           change = true;           cnt1++;         } else           cnt++;       }       for (int j : del[i]) {         if (G[j].size()) {           int mask = 0;           for (int k : G[j]) mask |= 1 << k;           for (int k = 0; k < (1 << m); k++)             for (int l = 1; l <= 20; l++)               if ((k & mask) == mask)                 ADD(dp[k][l],                     M - (dp[k ^ mask][l - 1] ? dp[k ^ mask][l - 1] : M));           change = true;           cnt1--;         } else           cnt--;       }       if (change) {         memset(cans, 0, sizeof cans);         for (int mask = 0; mask < (1 << m); mask++)           for (int j = 0; j <= 20; j++) ADD(cans[j], dp[mask][j]);       }       for (int j = 0; j <= cnt1; j++) {         if (i - j < 0 || i - j > cnt) continue;         ans = (ans + (long long)C(cnt, i - j) * cans[j]) % M;       }     }     cout << ans << endl;   }   