#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main() { int n, q, cnt = 0; vector a(n+1); cin >> n >> q; for(int i = 0; i < q; i++){ int l , r; cin >> l >> r; for (int j = l; j <= r; j++){ if (a[j]){ a[j] = 0; cnt--; } else { a[j]++; cnt++; } } cout << cnt << endl; } }