{"problem":{"name":"Village of M People","description":{"content":"The Republic of ARC has $N$ citizens, all of whom play competitive programming. Each citizen is given a dan _(grade)_ which is $1$, $2$, $\\ldots$, or $K$, according to their skill. A national census h","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc118_b"},"statements":[{"statement_type":"Markdown","content":"The Republic of ARC has $N$ citizens, all of whom play competitive programming. Each citizen is given a dan _(grade)_ which is $1$, $2$, $\\ldots$, or $K$, according to their skill.\nA national census has revealed that there are exactly $A_i$ citizens with dan $i$. To make this data easier to understand, the king has decided to describe the country as if it were a village of $M$ people.\nSet the number of people with dan $i$ in the village, $B_i$, so that $\\max_i\\left|\\frac{B_i}{M} - \\frac{A_i}{N}\\right|$ is minimized, while satisfying the following:\n\n*   each $B_i$ is a non-negative integer, satisfying $\\sum_{i=1}^K B_i = M$.\n\nPrint one such way to set $B = (B_1, B_2, \\ldots, B_K)$.\n\n## Constraints\n\n*   $1\\leq K\\leq 10^5$\n*   $1\\leq N, M\\leq 10^9$\n*   Each $A_i$ is a non-negative integer satisfying $\\sum_{i=1}^K A_i = N$.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$K$ $N$ $M$\n$A_1$ $A_2$ $\\ldots$ $A_K$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc118_b","tags":[],"sample_group":[["3 7 20\n1 2 4","3 6 11\n\nIn this output, we have $\\max_i\\left|\\frac{B_i}{M} - \\frac{A_i}{N}\\right| = \\max\\left(\\left|\\frac{3}{20}-\\frac{1}{7}\\right|, \\left|\\frac{6}{20}-\\frac{2}{7}\\right|, \\left|\\frac{11}{20}-\\frac{4}{7}\\right|\\right) = \\max\\left(\\frac{1}{140}, \\frac{1}{70}, \\frac{3}{140}\\right) = \\frac{3}{140}$."],["3 3 100\n1 1 1","34 33 33\n\nNote that $B_1 = B_2 = B_3 = 33$ does not satisfy the requirement, since the sum must be $M = 100$.\nIn this sample, other than `34 33 33`, printing `33 34 33` or `33 33 34` will also be accepted."],["6 10006 10\n10000 3 2 1 0 0","10 0 0 0 0 0"],["7 78314 1000\n53515 10620 7271 3817 1910 956 225","683 136 93 49 24 12 3"]],"created_at":"2026-03-03 11:01:14"}}