{"problem":{"name":"Cutting Woods","description":{"content":"We have a long piece of timber with a length of $L$ meters.   For each $x = 1, 2, \\dots, L - 1$, there is a mark called Mark $x$ at $x$ meters from the left end of the piece. You are given $Q$ queries","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc217_d"},"statements":[{"statement_type":"Markdown","content":"We have a long piece of timber with a length of $L$ meters.  \nFor each $x = 1, 2, \\dots, L - 1$, there is a mark called Mark $x$ at $x$ meters from the left end of the piece.\nYou are given $Q$ queries, the $i$\\-th of which is represented as a pair of numbers $(c_i, x_i)$.  \nProcess the queries in ascending order of $i$ as described below.\n\n*   If $c_i = 1$: cut the piece at Mark $x_i$ into two.\n*   If $c_i = 2$: choose the piece with Mark $x_i$ on it and print its length.\n\nHere, for both kinds of queries $c_i = 1, 2$, it is guaranteed that there will have been no cut at Mark $x_i$ when the query is to be processed.\n\n## Constraints\n\n*   $1 \\leq L \\leq 10^9$\n*   $1 \\leq Q \\leq 2 \\times 10^5$\n*   $c_i = 1, 2$ $(1 \\leq i \\leq Q)$\n*   $1 \\leq x_i \\leq L - 1$ $(1 \\leq i \\leq Q)$\n*   For every $i$ $(1 \\leq i \\leq Q)$, the following holds: there is no $j$ such that $1 \\leq j \\lt i$ and $(c_j,x_j) = (1, x_i)$.\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$L$ $Q$\n$c_1$ $x_1$\n$c_2$ $x_2$\n$\\vdots$\n$c_Q$ $x_Q$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc217_d","tags":[],"sample_group":[["5 3\n2 2\n1 3\n2 2","5\n3\n\nAt the time of the first query, no cut has been made, so the piece with Mark $2$ has a length of $5$ meters. Thus, you should print $5$.  \nIn the second query, the piece is cut into two pieces with lengths of $3$ and $2$ meters.  \nAt the time of the third query, the piece with Mark $2$ has a length of $3$ meters, so you should print $3$."],["5 3\n1 2\n1 4\n2 3","2"],["100 10\n1 31\n2 41\n1 59\n2 26\n1 53\n2 58\n1 97\n2 93\n1 23\n2 84","69\n31\n6\n38\n38"]],"created_at":"2026-03-03 11:01:14"}}