{"problem":{"name":"C. Money Sharing","description":{"content":"It becomes more and more popular to share something instead of buying it. One of the promising sharing systems is money sharing. There are numerous approaches to it, but we will deal with the one whe","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10235C"},"statements":[{"statement_type":"Markdown","content":"It becomes more and more popular to share something instead of buying it.\n\nOne of the promising sharing systems is money sharing. There are numerous approaches to it, but we will deal with the one when there is a public entry point where money may be borrowed or returned free of charge. No need to say that the system quickly rose to be extremely popular.\n\nDue to such popularity, it is hard to keep the system stable, so one has to request borrowing some money several days in advance. You are to develop an automatic managing system for money sharing. Consider a single day: during the day, you have $n$ requests for money lending, and there are also $m$ resupplies scheduled. They both may be described by non-zero integer $x$. Initially, the entry point has no money. On event described by $x$:\n\nUnfortunately, it is not always possible to satisfy all requests, because the entry point may eventually end up not having enough money to lend, so some requests may have to be declined. Your task is, given the description of all requests and resupplies, to choose for each request whether to accept or decline it, so that the entry point always has enough money to satisfy the accepted requests. If there are multiple possible answers, you should choose the one having the minimum possible number of requests declined. If there are still multiple possible answers, find any one of them.\n\nThe first line of input contains two integers $n$ and $m$ ($1 <= n, m <= 10^5$).\n\nEach of the next $n + m$ lines contains a single integer $x$ ($1 <= | x | <= 10^9$) and describe the events.\n\nEvents are described in the order they occur, no two events occur at the same moment of time.\n\nOutput your answer in $n + m$ lines.\n\nFor each resupply event, simply output \"_resupplied_\".\n\nFor each request, output \"_approved_\" or \"_declined_\" depending on your decision.\n\n## Input\n\nThe first line of input contains two integers $n$ and $m$ ($1 <= n, m <= 10^5$).Each of the next $n + m$ lines contains a single integer $x$ ($1 <= | x | <= 10^9$) and describe the events.Events are described in the order they occur, no two events occur at the same moment of time.\n\n## Output\n\nOutput your answer in $n + m$ lines.For each resupply event, simply output \"_resupplied_\".For each request, output \"_approved_\" or \"_declined_\" depending on your decision.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n, m \\in \\mathbb{Z}^+ $ denote the number of requests and resupplies, respectively.  \nLet $ E = (e_1, e_2, \\dots, e_{n+m}) $ be a sequence of events in chronological order, where each $ e_i \\in \\mathbb{Z} \\setminus \\{0\\} $:  \n- If $ e_i > 0 $, it is a resupply of amount $ e_i $.  \n- If $ e_i < 0 $, it is a request for amount $ |e_i| $.  \n\nLet $ R \\subseteq \\{1, \\dots, n+m\\} $ be the set of indices corresponding to requests.  \nLet $ S \\subseteq R $ be the set of indices of approved requests.  \n\n**Constraints**  \n1. For all $ i \\in \\{1, \\dots, n+m\\} $, if $ e_i > 0 $, then the event is a resupply and must be accepted.  \n2. For all $ i \\in R $, if $ i \\in S $, then the cumulative balance after processing event $ i $ must be non-negative.  \n3. The balance evolves as:  \n   $$\n   B_0 = 0, \\quad B_k = B_{k-1} + e_k \\quad \\text{for } k = 1, \\dots, n+m,\n   $$  \n   where $ e_k $ is included only if the event is accepted.  \n4. For any request at index $ i \\in R $, if it is approved, then $ B_{i-1} \\geq |e_i| $.  \n\n**Objective**  \nMaximize the number of approved requests (i.e., minimize the number of declined requests).  \nAmong all such optimal solutions, output any one.  \n\nFor each event $ i \\in \\{1, \\dots, n+m\\} $:  \n- If $ e_i > 0 $: output \"resupplied\".  \n- If $ e_i < 0 $: output \"approved\" if $ i \\in S $, otherwise \"declined\".","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10235C","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}