#include #include #include #include using namespace std; typedef long long ll; const int maxn=100010; ll a[maxn]; struct Interval{ ll l,r; bool operator<(const Interval& rhs)const{ return l>t; while(t--){ int n; ll L,R; cin>>n>>L>>R; for(int i=0;iRR?b[i].r:RR; }else{ if(LL>=L&&RR<=R){ ans+=RR-LL+1; }else if(LL=L&&RR<=R){ ans+=RR-L+1; }else if(LL>=L&&LL<=R&&RR>R){ ans+=R-LL+1; } LL=b[i].l; RR=b[i].r; } //cout<<"$ "<=L&&RR<=R){ ans+=RR-LL+1; }else if(LL=L&&RR<=R){ ans+=RR-L+1; }else if(LL>=L&&LL<=R&&RR>R){ ans+=R-LL+1; } cout<<(R-L+1-ans)<