func_code_string: #include <bits/stdc++.h>   const int INF_INT = 0x3f3f3f3f;   const long long INF_LL = 0x7f7f7f7f;   const int MOD = 1e9 + 7;   const double eps = 1e-10;   const double pi = acos(-1);   using namespace std;   const int N = 200010;   long long n, k;   long long fac[N], inv[N];   long long ksm(long long a, long long x, long long mod) {     if (x == 0) return 1;     long long ret = ksm(a, x / 2, mod);     ret = ret * ret % mod;     if (x & 1) ret = ret * a % mod;     return ret;   }   void init() {     fac[0] = 1;     inv[0] = 1;     for (long long i = 1; i < N; i++) {       fac[i] = fac[i - 1] * i % MOD;       inv[i] = ksm(fac[i], MOD - 2, MOD);     }   }   map<int, int> mp;   long long C(long long n, long long k) {     long long ret = fac[n] * inv[k] % MOD;     ret = ret * inv[n - k] % MOD;     return ret;   }   int main(int argc, char const *argv[]) {     init();     while (cin >> n >> k) {       mp.clear();       for (int i = 1; i <= n; i++) {         int l, r;         scanf( %d%d , &l, &r);         mp[l]++;         mp[r + 1]--;       }       int last = mp.begin()->first;       int tmp = 0;       long long ans = 0;       for (auto it = mp.begin(); it != mp.end(); it++) {         long long num = it->first - last;         if (tmp >= k) ans += C(tmp, k) * num % MOD;         ans %= MOD;         tmp += it->second;         last = it->first;       }       cout << ans << endl;     }     return 0;   }   