func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXW = 1000000;   const int INF = 0x3f3f3f3f;   const int MOD = 1000000007;   const char test[] =  test n ;   int in();   int tr[100010];   int ls[100010];   int n, m, k;   int hav[100010];   int lowbit(int x) { return (-x) & x; }   void updata(int in, int val) {     while (in <= n) {       if (val > tr[in]) {         tr[in] = val;       }       in += lowbit(in);     }   }   int ask(int to) {     int mx = 0;     while (to) {       mx = max(mx, tr[to]);       to -= lowbit(to);     }     return mx;   }   int main() {     cin >> n >> m;     hav[1]++;     hav[m + 1]--;     for (int i = 0; i < n; ++i) {       int u, v;       cin >> u >> v;       hav[u]++;       hav[v + 1]--;     }     for (int i = 1; i <= m; ++i) {       hav[i] += hav[i - 1];       int val = ask(hav[i]) + 1;       updata(hav[i], val);       ls[i] = val;     }     memset(tr, 0, sizeof tr);     int ans = 0;     for (int i = m; i > 0; --i) {       int val = ask(hav[i]) + 1;       updata(hav[i], val);       ans = max(ans, ls[i] + val - 1);     }     cout << ans;     return 0;   }   int in() {     int input;     scanf( %d , &input);     return input;   }   