func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = 998244353;   const int maxn = 2e5 + 10;   const int inf = 0x3f3f3f3f;   const double eps = 1e-6;   mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());   int n;   int l[maxn], r[maxn], t[maxn];   struct node {     int id;     bool operator<(const node &s) const {       if (r[id] != r[s.id])         return r[id] < r[s.id];       else if (l[id] != l[s.id])         return l[id] < l[s.id];       else         return id < s.id;     }   };   bool vis[maxn];   struct e {     int x, op, id;     bool operator<(const e &s) const {       if (x != s.x)         return x < s.x;       else if (op != s.op)         return op > s.op;       else         return id < s.id;     }   };   multiset<node> s[2];   set<e> ss;   int main() {     std::ios::sync_with_stdio(false), cin.tie(0);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> l[i] >> r[i] >> t[i];       t[i]--;       ss.insert((e){l[i], 1, i});       ss.insert((e){r[i], -1, i});     }     int ans = n;     for (auto u : ss) {       int op = u.op;       int id = u.id;       if (op == 1) {         s[t[id]].insert((node){id});         continue;       }       if (vis[id]) continue;       vis[id] = 1;       s[t[id]].erase((node){id});       auto it = s[1 - t[id]].begin();       if (it == s[1 - t[id]].end()) continue;       int l1 = l[id];       int r1 = r[id];       int l2 = l[(*it).id];       int r2 = r[(*it).id];       if (max(l1, l2) <= min(r1, r2)) {         vis[(*it).id] = 1;         ans--;         s[1 - t[id]].erase((node){(*it).id});       }     }     cout << ans <<   n ;     return 0;   }   