{"raw_statement":[{"iden":"problem statement","content":"You are given positive integers $N$, $M$, $K$, and a sequence of positive integers of length $N$, $(C_1, C_2, \\ldots, C_N)$. For each $r = 0, 1, 2, \\ldots, N-1$, print the answer to the following problem.\n\n> There is a sequence of $N$ colored balls. For $i = 1, 2, \\ldots, N$, the color of the $i$\\-th ball from the beginning of the sequence is $C_i$. Additionally, there are $M$ empty boxes numbered $1$ to $M$.\n> Determine the total number of balls in the boxes after performing the following steps.\n> \n> *   First, perform the following operation $r$ times.\n>     *   Move the frontmost ball in the sequence to the end of the sequence.\n> *   Then, repeat the following operation as long as at least one ball remains in the sequence.\n>     *   If there is a box that already contains at least one but fewer than $K$ balls of the same color as the frontmost ball in the sequence, put the frontmost ball into that box.\n>     *   If there is no such box,\n>         *   If there is an empty box, put the frontmost ball into the one with the smallest box number.\n>         *   If there are no empty boxes, eat the frontmost ball without putting it into any box."},{"iden":"constraints","content":"*   All input values are integers.\n*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq M, K \\leq N$\n*   $1 \\leq C_i \\leq N$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $M$ $K$\n$C_1$ $C_2$ $\\ldots$ $C_N$"},{"iden":"sample input 1","content":"7 2 2\n1 2 3 5 2 5 4"},{"iden":"sample output 1","content":"3\n3\n3\n4\n4\n3\n2\n\nFor example, let us explain the procedure for $r = 1$. First, perform the operation \"Move the frontmost ball in the sequence to the end of the sequence\" once, and the sequence of ball colors becomes $(2, 3, 5, 2, 5, 4, 1)$. Then, proceed with the operation of putting balls into boxes as follows:\n\n*   First operation: The color of the frontmost ball is $2$. There is no box with at least one but fewer than two balls of color $2$, so put the frontmost ball into the empty box with the smallest box number, box $1$.\n*   Second operation: The color of the frontmost ball is $3$. There is no box with at least one but fewer than two balls of color $3$, so put the frontmost ball into the empty box with the smallest box number, box $2$.\n*   Third operation: The color of the frontmost ball is $5$. There is no box with at least one but fewer than two balls of color $5$ and no empty boxes, so eat the frontmost ball.\n*   Fourth operation: The color of the frontmost ball is $2$. There is a box, box $1$, with at least one but fewer than two balls of color $2$, so put the frontmost ball into box $1$.\n*   Fifth operation: The color of the frontmost ball is $5$. There is no box with at least one but fewer than two balls of color $5$ and no empty boxes, so eat the frontmost ball.\n*   Sixth operation: The color of the frontmost ball is $4$. There is no box with at least one but fewer than two balls of color $4$ and no empty boxes, so eat the frontmost ball.\n*   Seventh operation: The color of the frontmost ball is $1$. There is no box with at least one but fewer than two balls of color $1$ and no empty boxes, so eat the frontmost ball.\n\nThe final total number of balls in the boxes is $3$, so the answer to the problem for $r = 1$ is $3$."},{"iden":"sample input 2","content":"20 5 4\n20 2 20 2 7 3 11 20 3 8 7 9 1 11 8 20 2 18 11 18"},{"iden":"sample output 2","content":"14\n14\n14\n14\n13\n13\n13\n11\n8\n9\n9\n11\n13\n14\n14\n14\n14\n14\n14\n13"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}