{"problem":{"name":"Ignore Operations","description":{"content":"Takahashi has an integer $x$. Initially, $x = 0$. There are $N$ operations. The $i$\\-th operation $(1 \\leq i \\leq N)$ is represented by two integers $t_i$ and $y_i$ as follows: *   If $t_i = 1$, repl","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc249_f"},"statements":[{"statement_type":"Markdown","content":"Takahashi has an integer $x$. Initially, $x = 0$.\nThere are $N$ operations. The $i$\\-th operation $(1 \\leq i \\leq N)$ is represented by two integers $t_i$ and $y_i$ as follows:\n\n*   If $t_i = 1$, replace $x$ with $y_i$.\n*   If $t_i = 2$, replace $x$ with $x + y_i$.\n\nTakahashi may skip any number between $0$ and $K$ (inclusive) of the operations. When he performs the remaining operations once each without changing the order, find the maximum possible final value of $x$.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $0 \\leq K \\leq N$\n*   $t_i \\in {1,2} \\, (1 \\leq i \\leq N)$\n*   $|y_i| \\leq 10^9 \\, (1 \\leq i \\leq N)$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $K$\n$t_1$ $y_1$\n$\\vdots$\n$t_N$ $y_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc249_f","tags":[],"sample_group":[["5 1\n2 4\n2 -3\n1 2\n2 1\n2 -3","3\n\nIf he skips the $5$\\-th operation, $x$ changes as $0 \\rightarrow 4 \\rightarrow 1 \\rightarrow 2 \\rightarrow 3$, so $x$ results in $3$. This is the maximum."],["1 0\n2 -1000000000","\\-1000000000"],["10 3\n2 3\n2 -1\n1 4\n2 -1\n2 5\n2 -9\n2 2\n1 -6\n2 5\n2 -3","15"]],"created_at":"2026-03-03 11:01:13"}}