0%

APCS-coverline

Code

#include <bits/stdc++.h>

#define int long long
using namespace std;

signed main() {
    ios::sync_with_stdio(0);cin.tie(0);
    unsigned long long N;
    cin >> N;

    bitset<10000000> bs;
    // bs.set();
    while (N--) {
        unsigned long long a, b;
        cin >> a >> b;
        for (unsigned long long i = a; i < b; i++) {
            bs.set(i);
        }
    }

    cout << bs.count() << endl;
    return 0;
}