Language: C++

call gen.exe 10 > in.txt
call lazy.exe < in.txt
call sol.exe < in.txt

#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = /*1'000'000'007LL;*/ 998'244'353LL;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

template<typename T>
struct Random{
private:
    mt19937 mt;
public:
    Random(){
        mt19937 mt2(time(0));
        mt = mt2;
    }
    T rand(T a, T b){
        uniform_int_distribution<T> gen(a, b);
        return gen(mt);
    }
};

Random<int> rnd;

int N;

signed main(int argc, char* argv[]){
    N = atoi(argv[1]);
    cout << N << endl;
    rep(i, N){
        int l = rnd.rand(1,1000000000);
        int r = rnd.rand(1,1000000000);
        if(l > r) swap(l, r);
        cout << l << " " << r << endl;
    }
}

#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = /*1'000'000'007LL;*/ 998'244'353LL;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int N;
int L[100000], R[100000]; // [L,R)

signed main(){
    cin >> N;
    rep(i, N){
        cin >> L[i] >> R[i];
        L[i]--;
    }
    
    int ans = 0;
    rep(i, (1<<N)){
        if(i == 0 || i == (1<<N)-1) continue;
        int l1 = INT_MIN;
        int r1 = INT_MAX;
        int l2 = INT_MIN;
        int r2 = INT_MAX;
        rep(j, N){
            if((i>>j)&1){
                l1 = max(l1, L[j]);
                r1 = min(r1, R[j]);
            }
            else{
                l2 = max(l2, L[j]);
                r2 = min(r2, R[j]);
            }
        }
        ans = max(ans, max(0,r1-l1)+max(0,r2-l2));
    }
    cout << ans << endl;
}

/*
3
28 59
55 92
77 79

3
35 54
38 78
49 70
*/

Compiler output:
a.cc:1:1: error: 'call' does not name a type; did you mean 'all'?
    1 | call gen.exe 10 > in.txt
      | ^~~~
      | all
a.cc:61:10: error: redefinition of 'const ll MOD'
   61 | const ll MOD = /*1'000'000'007LL;*/ 998'244'353LL;
      |          ^~~
a.cc:14:10: note: 'const ll MOD' previously defined here
   14 | const ll MOD = /*1'000'000'007LL;*/ 998'244'353LL;
      |          ^~~
a.cc:66:11: error: redefinition of 'const int dx [4]'
   66 | const int dx[4]={ 1,0,-1,0 };
      |           ^~
a.cc:19:11: note: 'const int dx [4]' previously defined here
   19 | const int dx[4]={ 1,0,-1,0 };
      |           ^~
a.cc:67:11: error: redefinition of 'const int dy [4]'
   67 | const int dy[4]={ 0,1,0,-1 };
      |           ^~
a.cc:20:11: note: 'const int dy [4]' previously defined here
   20 | const int dy[4]={ 0,1,0,-1 };
      |           ^~
a.cc:69:5: error: redefinition of 'int N'
   69 | int N;
      |     ^
a.cc:39:5: note: 'int N' previously declared here
   39 | int N;
      |     ^
a.cc:72:8: error: conflicting declaration of C function 'int main()'
   72 | signed main(){
      |        ^~~~
a.cc:41:8: note: previous declaration 'int main(int, char**)'
   41 | signed main(int argc, char* argv[]){
      |        ^~~~