func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   T nextInt() {     T x = 0, p = 1;     char ch;     do {       ch = getchar();     } while (ch <=    );     if (ch ==  - ) {       p = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + (ch -  0 );       ch = getchar();     }     return x * p;   }   const int maxN = (int)4e5 + 10;   const int INF = (int)1e9;   const int mod = (int)1e9 + 7;   const long long LLINF = (long long)1e15;   int fw[maxN];   int answer[maxN];   vector<pair<int, int> > g[maxN];   int get(int r) {     int ret = 0;     for (; r >= 0; r = (r & (r + 1)) - 1) {       ret += fw[r];     }     return ret;   }   void update(int r) {     for (; r < maxN; r |= r + 1) {       fw[r]++;     }   }   int l[maxN];   int r[maxN];   int main() {     ios_base::sync_with_stdio(0);     int n;     cin >> n;     vector<int> x;     for (int i = 0; i < n; ++i) {       cin >> l[i] >> r[i];       x.push_back(l[i]);       x.push_back(r[i]);     }     sort(x.begin(), x.end());     for (int i = 0; i < n; ++i) {       l[i] = lower_bound(x.begin(), x.end(), l[i]) - x.begin();       r[i] = lower_bound(x.begin(), x.end(), r[i]) - x.begin();       g[r[i]].push_back(make_pair(l[i], i));     }     for (int i = 0; i < maxN; ++i) {       for (auto x : g[i]) {         int l = x.first;         int idx = x.second;         answer[idx] = get(maxN - 1) - get(l);         update(l);       }     }     for (int i = 0; i < n; ++i) {       cout << answer[i] <<   n ;     }     return 0;   }   