{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eYou are given two integers $C, K$ and an array of $N$ integers $a_1, a_2, ..., a_N$. It is guaranteed that the value of $a_i$ is between $1$ to $C$.\u003cbr\u003e\u003cbr\u003eWe define that a continuous subsequence $a_l, a_{l + 1}, ..., a_r(l\\leq r)$ of array a is a good subarray if and only if the following condition is met:\u003cbr\u003e\u003cbr\u003e\\begin{equation*}\u003cbr\u003e\\forall x \\in [1, C], \\; \\sum\\limits_{i \u003d l}^r[a_i \u003d x] \u003d 0 \\; or \\; \\sum\\limits_{i \u003d l}^r[a_i \u003d x] \\geq K\u003cbr\u003e\\end{equation*}\u003cbr\u003e\u003cbr\u003eIt implies that if a number appears in the subarray, it will appear no less than $K$ times.\u003cbr\u003e\u003cbr\u003eYou should find the longest good subarray and output its length. Or you should print $0$ if you cannot find any.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There are multiple test cases.\u003cbr\u003e\u003cbr\u003eEach case starts with a line containing three positive integers $N,C,K(N,C,K \\leq 10^5)$.\u003cbr\u003e\u003cbr\u003eThe second line contains $N$ integer $a_1, a_2, ..., a_N(1 \\leq a_i \\leq C)$.\u003cbr\u003e\u003cbr\u003eWe guarantee that the sum of $N$s, the sum of $C$s and the sum of $K$s in all test cases are all no larger than $5 \\times 10^5$."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output one line containing an integer denoting the length of the longest good subarray."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e7 4 2\r\n2 1 4 1 4 3 2\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}