#include #define rep(i, l, r) for (int i = (l); i < (r); i++) using namespace std; typedef long long ll; int main() { int N, Q, ans = 0; cin >> N >> Q; vector L(Q), R(Q); rep(i, 0, Q) cin >> L[i] >> R[i]; vector A(N + 1, 0); rep(i, 0, Q) { rep(j, L[i], R[i] + 1) { A[j] = 1 - A[j]; if (A[j]) ans++; else ans--; } cout << ans << endl; } }