func_code_string: #include <bits/stdc++.h>   const long long N = 1000006;   using namespace std;   const long long MOD = 1000000007LL;   template <typename T>   T gcd(T a, T b) {     if (a == 0) return b;     return gcd(b % a, a);   }   template <typename T>   T power(T x, T y, long long m = MOD) {     T ans = 1;     while (y > 0) {       if (y & 1LL) ans = (ans * x) % m;       y >>= 1LL;       x = (x * x) % m;     }     return ans % m;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     if (n == 1) {       cout <<  0 ;       return 0;     }     multiset<long long> l, r;     vector<pair<long long, long long> > v;     for (long long(i) = (0); i < (n); i++) {       long long x, y;       cin >> x >> y;       l.insert(x);       r.insert(y);       v.emplace_back(make_pair(x, y));     }     long long ans = 0;     for (long long(i) = (0); i < (n); i++) {       l.erase(l.find(v[i].first));       r.erase(r.find(v[i].second));       long long dist = max(0LL, *r.begin() - *l.rbegin());       ans = max(ans, dist);       l.insert(v[i].first);       r.insert(v[i].second);     }     cout << ans;   }   