func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr << name <<   :   << arg1 << std::endl;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   int n;   vector<int> nailed;   struct evn {     int pos, type, num;   };   vector<evn> events;   bool comp(const evn& a, const evn& b) {     if (a.pos == b.pos && a.type == b.type) return a.num < b.num;     if (a.pos == b.pos) return a.type == 0;     return a.pos < b.pos;   }   int main() {     srand(chrono::steady_clock::now().time_since_epoch().count());     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     nailed.resize(n, 0);     int l, r;     for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));          i += 1 - 2 * ((0) > (n))) {       cin >> l >> r;       if (r < l) swap(l, r);       evn a, b;       a.pos = l;       a.num = i;       a.type = 0;       events.push_back(a);       b.pos = r;       b.num = i;       b.type = 1;       events.push_back(b);     }     sort(events.begin(), events.end(), comp);     queue<int> pinned;     vector<int> ans;     for (auto it : events) {       if (it.type) {         if (nailed[it.num] == 0) {           while (!pinned.empty()) {             int ind = pinned.front();             nailed[ind] = 1;             pinned.pop();           }           nailed[it.num] = 1;           ans.push_back(it.pos);         }       } else {         pinned.push(it.num);       }     }     cout << (int)(ans.size()) <<   n ;     if ((int)(ans.size()) > 0) {       for (auto it : ans) cout << it <<    ;     }     return 0;   }   