{"problem":{"name":"Periodic Number","description":{"content":"For a positive integer $n$, let $\\mathrm{str}(n)$ be the string representing $n$ in decimal. We say that a positive integer $n$ is _periodic_ when there exists a positive integer $m$ such that $\\mathr","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc141_a"},"statements":[{"statement_type":"Markdown","content":"For a positive integer $n$, let $\\mathrm{str}(n)$ be the string representing $n$ in decimal.\nWe say that a positive integer $n$ is _periodic_ when there exists a positive integer $m$ such that $\\mathrm{str}(n)$ is the concatenation of two or more copies of $\\mathrm{str}(m)$. For example, $11$, $1212$, and $123123123$ are periodic.\nYou are given a positive integer $N$ at least $11$. Find the greatest periodic number at most $N$. It can be proved that there is at least one periodic number at most $N$.\nYou will get $T$ test cases to solve.\n\n## Constraints\n\n*   $1 \\leq T \\leq 10^4$\n*   $11 \\leq N < 10^{18}$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$T$\n$\\mathrm{case}_1$\n$\\vdots$\n$\\mathrm{case}_T$\n\nEach case is given in the following format:\n\n$N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc141_a","tags":[],"sample_group":[["3\n1412\n23\n498650499498649123","1313\n22\n498650498650498650\n\nFor the first test case, the periodic numbers at most $1412$ include $11$, $222$, $1212$, $1313$, and the greatest is $1313$."]],"created_at":"2026-03-03 11:01:14"}}