#include #include #include using namespace atcoder; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 using P = pair ; P op(P a,P b){ a.first += b.first; a.second += b.second; return a; } P e(){ return make_pair(0,0); } P mapping(int a,P b){ rep(i,(a&1))swap(b.first,b.second); return b; } int composition(int a,int b){ return ((a+b)&1); } int id(){ return 0; } int main(){ int N,Q; cin>>N>>Q; vector

t(N,make_pair(1,0)); lazy_segtree seg(t); rep(i,Q){ int l,r; scanf("%d %d",&l,&r); l--; seg.apply(l,r,1); printf("%d\n",seg.all_prod().second); } return 0; }