Lang:G++
Edit1234567891011121314151617181920212223242526272829#include<iostream>using namespace std;long a[100000001]={0};int main(){int i,j,n,m;long x,y,most=0,cha=0;cin>>n>>m;for(i=0;i<n;i++){cin>>x>>y;for(j=x;j<y;j++)a[j]=1;if(y>most)most=y;}for(i=0;i<m;i++){cin>>x>>y;for(j=x;j<y;j++)a[j]=2;if(y>most)most=y;}for(i=1;i<=most;i++)if(a[i]==1)cha++;cout<<cha;}