func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 500005;   const int mod = 1e9 + 7;   int n, m, l[N], r[N], f[N], sum[N];   vector<int> g[N];   vector<int> cmp;   int main() {     scanf( %d %d , &n, &m);     for (int i = 0; i < m; ++i) {       scanf( %d %d , l + i, r + i);       cmp.push_back(r[i]);       cmp.push_back(l[i]);     }     sort(cmp.begin(), cmp.end());     cmp.erase(unique(cmp.begin(), cmp.end()), cmp.end());     if (cmp.empty() || cmp[0] != 0 || cmp.back() != n) {       cout << 0 << endl;       return 0;     }     for (int i = 0; i < m; ++i) {       l[i] = lower_bound(cmp.begin(), cmp.end(), l[i]) - cmp.begin();       r[i] = lower_bound(cmp.begin(), cmp.end(), r[i]) - cmp.begin();       g[r[i]].push_back(l[i]);     }     f[0] = sum[0] = 1;     for (int i = 1; i < (int)cmp.size(); ++i) {       for (auto& pos : g[i]) {         int add = sum[i - 1];         if (pos > 0) add = (add + (mod - sum[pos - 1])) % mod;         f[i] = (f[i] + add) % mod;       }       sum[i] = (f[i] + sum[i - 1]) % mod;     }     cout << f[cmp.size() - 1] << endl;     return 0;   }   