{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThere are $N$ light bulbs indexed from $0$ to $N-1$. Initially, all of them are off.\u003c/p\u003e\n\u003cp\u003eA FLIP operation switches the state of a contiguous subset of bulbs. $FLIP(L, R)$ means to flip all bulbs $x$ such that $L \\leq x \\leq R$. So for example, $FLIP(3, 5)$ means to flip bulbs $3$ , $4$ and $5$, and $FLIP(5, 5)$ means to flip bulb $5$.\u003c/p\u003e\n\u003cp\u003eGiven the value of $N$ and a sequence of $M$ flips, count the number of light bulbs that will be on at the end state.\u003c/p\u003e\n\u003ch3\u003eInputFile\u003c/h3\u003e\n\u003cp\u003eThe first line of the input gives the number of test cases, $T$. $T$ test cases follow. Each test case starts with a line containing two integers $N$ and $M$, the number of light bulbs and the number of operations, respectively. Then, there are $M$ more lines, the $i$-th of which contains the two integers $L_i$ and $R_i$, indicating that the $i$-th operation would like to flip all the bulbs from $L_i$ to $R_i$ , inclusive.\u003c/p\u003e\n\u003cp\u003e$1 \\leq T \\leq 1000$\u003c/p\u003e\n\u003cp\u003e$1 \\leq N \\leq 10^6$\u003c/p\u003e\n\u003cp\u003e$1 \\leq M \\leq 1000$\u003c/p\u003e\n\u003cp\u003e$0 \\leq L_i \\leq R_i \\leq N-1$\u003c/p\u003e\n\u003ch3\u003eOutputFile\u003c/h3\u003e\n\u003cp\u003eFor each test case, output one line containing Case #x: y, where $x$ is the test case number (starting from $1$) and $y$ is the number of light bulbs that will be on at the end state, as described above.\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n10 2\n2 6\n4 8\n6 3\n1 1\n2 3\n3 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 4\nCase #2: 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003cbr /\u003e"}}]}