func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename... T>   inline void inp(T &...args) {     ((cin >> args), ...);   }   template <typename T>   inline istream &operator>>(istream &in, vector<T> &a) {     for (auto &x : a) in >> x;     return in;   }   template <typename T, typename U>   inline istream &operator>>(istream &in, pair<T, U> &a) {     in >> a.first >> a.second;     return in;   }   const long long int MX = 1e6 + 10;   const long long int Mod = 998244353;   inline long long int md(long long int x, long long int M = Mod) {     x %= M;     return ((x < 0) ? (x + M) : x);   }   vector<long long int> fact(MX), invfact(MX), inv(MX);   void init_fact(long long int m = Mod) {     inv[0] = 0;     inv[1] = fact[0] = fact[1] = invfact[0] = invfact[1] = 1;     for (long long int i = 2; i < MX; i++) {       fact[i] = md(fact[i - 1] * i, m);       inv[i] = m - (m / i) * inv[m % i] % m;       invfact[i] = md(inv[i] * invfact[i - 1], m);     }   }   long long int NPR(long long int n, long long int r) {     if (0 <= r and r <= n) {       return md(fact[n] * invfact[n - r]);     }     return 0;   }   long long int NCR(long long int n, long long int r) {     if (0 <= r and r <= n) {       return md(fact[n] * md(invfact[r] * invfact[n - r]));     }     return 0;   }   void solve(int &T) {     long long int n, k;     cin >> n >> k;     vector<pair<long long int, long long int>> a;     for (long long int i = (0); ((1) > 0 ? i < (n) : i > (n)); i += (1)) {       long long int x, y;       cin >> x >> y;       a.push_back({x, 1});       a.push_back({y + 1, -1});     }     sort((a).begin(), (a).end());     long long int cnt = 0, ans = 0;     for (long long int i = (0); ((1) > 0 ? i < (2 * n) : i > (2 * n)); i += (1)) {       if (a[i].second == 1) {         if (cnt >= k - 1) {           ans = md(ans + NCR(cnt, k - 1));         }         cnt++;       } else {         cnt--;       }     }     cout << ans <<   n ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     init_fact();     int t = 1;     for (int i = 1; i <= t; i++) {       if (0) cerr <<  Case #  << i <<   n ;       solve(i);     }     return 0;   }   