prompt
listlengths 1
1
| data_source
stringclasses 1
value | ability
stringclasses 1
value | reward_model
null | extra_info
dict |
---|---|---|---|---|
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Numeric String Template\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Kristina has an array $a$, called a template, consisting of $n$ integers. She also has $m$ strings, each consisting only of lowercase Latin letters. The strings are numbered from $1$ to $m$. She wants to check which strings match the template.\n\nA string $s$ is considered to match the template if all of the following conditions are simultaneously satisfied:\n\n * The length of the string $s$ is equal to the number of elements in the array $a$. * The same numbers from $a$ correspond to the same symbols from $s$. So, if $a_i = a_j$, then $s_i = s_j$ for ($1 \\le i, j \\le n$). * The same symbols from $s$ correspond to the same numbers from $a$. So, if $s_i = s_j$, then $a_i = a_j$ for ($1 \\le i, j \\le n$).\n\nIn other words, there must be a one-to-one correspondence between the characters of the string and the elements of the array.\n\nFor example, if $a$ = [$3, 5, 2, 1, 3$], then the string \"abfda\" matches the template, while the string \"afbfa\" does not, since the character \"f\" corresponds to both numbers $1$ and $5$.\n\nInput: The first line of input contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nThe following descriptions are for the test cases.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 2 \\cdot 10^5$) — the number of elements in the array $a$.\n\nThe second line of each test case contains exactly $n$ integers $a_i$ ($-10^9 \\le a_i \\le 10^9$) — the elements of the array $a$.\n\nThe third line of each test case contains a single integer $m$ ($1 \\le m \\le 2 \\cdot 10^5$) — the number of strings to check for template matching.\n\nFollowing are $m$ strings, each containing a non-empty string $s_j$ ($1 \\le |s_j| \\le 2 \\cdot 10^5$), consisting of lowercase Latin letters.\n\nIt is guaranteed that the sum of $n$ across all test cases does not exceed $2 \\cdot 10^5$, and that the sum of the lengths of all strings does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output $m$ lines. On the $i$-th line ($1 \\le i \\le m$) output:\n\n * \"YES\", if the string with index $i$ matches the template; * \"NO\" otherwise. \n\nYou may output the answer in any case (for example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will be recognized as a positive answer).\n\nExamples:\ninput:\n3\n5\n3 5 2 1 3\n2\nabfda\nafbfa\n2\n1 2\n3\nab\nabc\naa\n4\n5 -3 5 -3\n4\naaaa\nbcbc\naba\ncbcb\noutput:\nYES\nNO\nYES\nNO\nNO\nNO\nYES\nNO\nYES\n\nNote: The first test case is explained in the problem statement.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2000C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Orangutan Approved Subarrays\ntime_limit_ms: 3000\nmemory_limit_mb: 512\nDescription: Suppose you have an array $b$. Initially, you also have a set $S$ that contains all distinct elements of $b$. The array $b$ is called orangutan-approved if it can be emptied by repeatedly performing the following operation:\n\n * In one operation, select indices $l$ and $r$ ($1 \\leq l \\leq r \\leq |b|$) such that $v = b_l = b_{l+1} = \\ldots = b_r$ and $v$ is present in $S$. Remove $v$ from $S$, and simultaneously remove all $b_i$ such that $l \\leq i \\leq r$. Then, reindex the elements $b_{r+1}, b_{r+2}, \\ldots$ as $b_l, b_{l+1}, \\ldots$ accordingly. \n\nYou are given an array $a$ of length $n$ and $q$ queries.\n\nEach query consists of two indices $l$ and $r$ ($1 \\le l \\le r \\le n$), and you need to determine whether or not the subarray $a_{l}, a_{l+1}, \\ldots, a_r$ is orangutan-approved.\n\nInput: The first line contains $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases.\n\nThe first line of each test case contains integers $n$ and $q$ ($1 \\leq n,q \\leq 2 \\cdot 10^5$) — the size of $a$ and the number of queries, respectively.\n\nThe following line contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\leq a_i \\leq n$) — the elements of the array $a$.\n\nThe following $q$ lines contain two integers $l$ and $r$ — the endpoints of the subarray for each query ($1 \\leq l \\leq r \\leq n$).\n\nIt is guaranteed that the sum of $n$ and $q$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each query, output \"YES\" (without quotes) if the subarray from $l$ to $r$ is orangutan-approved, and \"NO\" (without quotes) otherwise.\n\nYou can output \"YES\" and \"NO\" in any case (for example, strings \"yES\", \"yes\" and \"Yes\" will be recognized as a positive response).\n\nExamples:\ninput:\n3\n4 2\n1 2 2 1\n1 4\n1 3\n5 3\n1 2 1 2 1\n2 5\n3 5\n1 3\n8 4\n1 2 3 2 1 3 2 3\n1 5\n2 8\n3 5\n6 8\noutput:\nYES\nYES\nNO\nYES\nYES\nYES\nNO\nYES\nYES\n\nNote: In the first query of the first testcase, the answer is YES.\n\n * Initially, $S=\\\\{1,2\\\\}$ and $b=[1,2,2,1]$ * Select $l=2$ and $r=3$. Since $b_2=b_3=2$ is in $S$, we may erase $b_2$ and $b_3$ from the array, as well as erasing $2$ from $S$. The set $S$ becomes $\\\\{1\\\\}$ and the array becomes $[1,1]$. * Select $l=1$ and $r=2$. Since $b_1=b_2=1$ is in $S$, we may erase $b_1$ and $b_2$ from the array, as well as erasing $1$ from $S$. The set $S$ becomes $\\\\{\\\\}$ and the array becomes $[]$. * Since the array is now empty, we can say the original array is orangutan-approved. \n\nIn the first query of the second testcase, the answer is NO, because it can be shown that the subarray $[2,1,2,1]$ cannot become empty through any sequence of valid operations.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2030F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Robin Hood Archery\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: At such times archery was always the main sport of the day, for the Nottinghamshire yeomen were the best hand at the longbow in all merry England, but this year the Sheriff hesitated...\n\nSheriff of Nottingham has organized a tournament in archery. It's the final round and Robin Hood is playing against Sheriff!\n\nThere are $n$ targets in a row numbered from $1$ to $n$. When a player shoots target $i$, their score increases by $a_i$ and the target $i$ is destroyed. The game consists of turns and players alternate between whose turn it is. Robin Hood always starts the game, then Sheriff and so on. The game continues until all targets are destroyed. Both players start with score $0$.\n\nAt the end of the game, the player with most score wins and the other player loses. If both players have the same score, it's a tie and no one wins or loses. In each turn, the player can shoot any target that wasn't shot before. Both play optimally to get the most score possible.\n\nSheriff of Nottingham has a suspicion that he might lose the game! This cannot happen, you must help Sheriff. Sheriff will pose $q$ queries, each specifying $l$ and $r$. This means that the game would be played only with targets $l, l+1, \\dots, r$, as others would be removed by Sheriff before the game starts.\n\nFor each query $l$, $r$, determine whether the Sheriff can not lose the game when only considering the targets $l, l+1, \\dots, r$.\n\nInput: The first line of input contains one integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nThe first line of each test case contains two integers $n$, $q$ ($1 \\le n,q \\le 2\\cdot10^5$) — the number of targets and the queries Sheriff will pose.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10^6$) — the points for hitting each target.\n\nThen follow $q$ lines, each with two integers $l$ and $r$ ($1 \\le l \\le r \\le n$) — the range of the targets that is considered for each query.\n\nIt is guaranteed that the sum of both $n$ and $q$ across all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each query, output \"YES\", if the Sheriff does not lose the game when only considering the targets $l, l+1, \\dots, r$, and \"NO\" otherwise.\n\nYou can output the answer in any case (upper or lower). For example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will be recognized as positive responses.\n\nExamples:\ninput:\n2\n3 3\n1 2 2\n1 2\n1 3\n2 3\n5 3\n2 1 2 1 1\n1 2\n1 3\n4 5\noutput:\nNO\nNO\nYES\nNO\nNO\nYES\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2014H",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Cases\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You're a linguist studying a mysterious ancient language. You know that\n\n 1. Its words consist only of the first $c$ letters of the Latin alphabet. 2. Each word has a case which can be unambiguously determined by its last letter (different letters correspond to different cases). For example, words \"ABACABA\" and \"ABA\" (if they exist) have the same case in this language because they both have the same ending 'A', whereas \"ALICE\" and \"BOB\" have different cases. If the language does not have a case corresponding to some letter, it means that the word cannot end with this letter. 3. The length of each word is $k$ or less. \n\nYou have a single text written in this language. Unfortunately, as the language is really ancient, spaces between words are missing and all letters are uppercase. You wonder what is the minimum number of cases the language can have. Can you find this out?\n\nInput: Each test consists of several test cases. The first line contains a single integer $t$ ($1 \\le t \\le 10\\,000$) — the number of test cases. It is followed by descriptions of the test cases.\n\nThe first line of each test case contains three integers $n$, $c$, $k$ ($1 \\le k \\le n \\le 2^{18}$, $1 \\le c \\le 18$) — the length of the text, the number of letters in the language, and the maximum length of the word.\n\nThe second line contains a string of $n$ characters — the text itself. Each character is one of the first $c$ uppercase letters of the Latin alphabet.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2^{18}$ and the sum of $2^c$ over all test cases does not exceed $2^{18}$.\n\nOutput: For each test case, output a single line consisting of a single integer — the minimum number of cases in the language.\n\nExamples:\ninput:\n7\n5 5 1\nABCDE\n3 1 2\nAAA\n3 2 2\nAAB\n10 2 2\nABABABABAB\n4 4 4\nDCBA\n1 17 1\nQ\n9 3 2\nABCABCABC\noutput:\n5\n1\n2\n1\n1\n1\n2\n\nNote: In the first test case, there must be five cases in the language (for each of the letters 'A', 'B', 'C', 'D', and 'E' there must be a case that has a corresponding ending).\n\nIn the fourth test case, one case with ending 'B' is sufficient.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1995D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: GCD-sequence\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: GCD (Greatest Common Divisor) of two integers $x$ and $y$ is the maximum integer $z$ by which both $x$ and $y$ are divisible. For example, $GCD(36, 48) = 12$, $GCD(5, 10) = 5$, and $GCD(7,11) = 1$.\n\nKristina has an array $a$ consisting of exactly $n$ positive integers. She wants to count the GCD of each neighbouring pair of numbers to get a new array $b$, called GCD-sequence.\n\nSo, the elements of the GCD-sequence $b$ will be calculated using the formula $b_i = GCD(a_i, a_{i + 1})$ for $1 \\le i \\le n - 1$.\n\nDetermine whether it is possible to remove exactly one number from the array $a$ so that the GCD sequence $b$ is non-decreasing (i.e., $b_i \\le b_{i+1}$ is always true).\n\nFor example, let Khristina had an array $a$ = [$20, 6, 12, 3, 48, 36$]. If she removes $a_4 = 3$ from it and counts the GCD-sequence of $b$, she gets:\n\n * $b_1 = GCD(20, 6) = 2$ * $b_2 = GCD(6, 12) = 6$ * $b_3 = GCD(12, 48) = 12$ * $b_4 = GCD(48, 36) = 12$ \n\nThe resulting GCD sequence $b$ = [$2,6,12,12$] is non-decreasing because $b_1 \\le b_2 \\le b_3 \\le b_4$.\n\nInput: The first line of input data contains a single number $t$ ($1 \\le t \\le 10^4$) — he number of test cases in the test.\n\nThis is followed by the descriptions of the test cases.\n\nThe first line of each test case contains a single integer $n$ ($3 \\le n \\le 2 \\cdot 10^5$) — the number of elements in the array $a$.\n\nThe second line of each test case contains exactly $n$ integers $a_i$ ($1 \\le a_i \\le 10^9$) — the elements of array $a$.\n\nIt is guaranteed that the sum of $n$ over all test case does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output a single line:\n\n * \"YES\" if you can remove exactly one number from the array $a$ so that the GCD-sequence of $b$ is non-decreasing; * \"NO\" otherwise. \n\nYou can output the answer in any case (for example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will all be recognized as a positive answer).\n\nExamples:\ninput:\n12\n6\n20 6 12 3 48 36\n4\n12 6 3 4\n3\n10 12 3\n5\n32 16 8 4 2\n5\n100 50 2 10 20\n4\n2 4 8 1\n10\n7 4 6 2 4 5 1 4 2 8\n7\n5 9 6 8 5 9 2\n6\n11 14 8 12 9 3\n9\n5 7 3 10 6 3 12 6 3\n3\n4 2 4\n8\n1 6 11 12 6 12 3 6\noutput:\nYES\nNO\nYES\nNO\nYES\nYES\nNO\nYES\nYES\nYES\nYES\nYES\n\nNote: The first test case is explained in the problem statement.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1980D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Max Plus Size\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: [EnV - Dynasty](https://soundcloud.com/envyofficial/env-dynasty)\n\n⠀\n\nYou are given an array $a_1, a_2, \\ldots, a_n$ of positive integers.\n\nYou can color some elements of the array red, but there cannot be two adjacent red elements (i.e., for $1 \\leq i \\leq n-1$, at least one of $a_i$ and $a_{i+1}$ must not be red).\n\nYour score is the maximum value of a red element plus the number of red elements. Find the maximum score you can get.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 500$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 100$) — the length of the array.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 1000$) — the given array.\n\nOutput: For each test case, output a single integer: the maximum possible score you can get after coloring some elements red according to the statement.\n\nExamples:\ninput:\n4\n3\n5 4 5\n3\n4 5 4\n10\n3 3 3 3 4 1 2 3 4 5\n9\n17 89 92 42 29 92 14 70 45\noutput:\n7\n6\n10\n97\n\nNote: In the first test case, you can color the array as follows: $[\\color{red}{5}, 4, \\color{red}{5}]$. Your score is $\\max([5, 5]) + \\text{size}([5, 5]) = 5+2 = 7$. This is the maximum score you can get.\n\nIn the second test case, you can color the array as follows: $[\\color{red}{4}, 5, \\color{red}{4}]$. Your score is $\\max([4, 4]) + \\text{size}([4, 4]) = 4+2 = 6$. This is the maximum score you can get.\n\nIn the third test case, you can color the array as follows: $[\\color{red}{3}, 3, \\color{red}{3}, 3, \\color{red}{4}, 1, 2, \\color{red}{3}, 4, \\color{red}{5}]$. Your score is $\\max([3, 3, 4, 3, 5]) + \\text{size}([3, 3, 4, 3, 5]) = 5+5 = 10$. This is the maximum score you can get.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2019A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Gerrymandering\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: We all steal a little bit. But I have only one hand, while my adversaries have two.\n\nÁlvaro Obregón\n\nÁlvaro and José are the only candidates running for the presidency of Tepito, a rectangular grid of $2$ rows and $n$ columns, where each cell represents a house. It is guaranteed that $n$ is a multiple of $3$.\n\nUnder the voting system of Tepito, the grid will be split into districts, which consist of any $3$ houses that are connected$^{\\text{∗}}$. Each house will belong to exactly one district.\n\nEach district will cast a single vote. The district will vote for Álvaro or José respectively if at least $2$ houses in that district select them. Therefore, a total of $\\frac{2n}{3}$ votes will be cast.\n\nAs Álvaro is the current president, he knows exactly which candidate each house will select. If Álvaro divides the houses into districts optimally, determine the maximum number of votes he can get.\n\n$^{\\text{∗}}$A set of cells is connected if there is a path between any $2$ cells that requires moving only up, down, left and right through cells in the set.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^4$). The description of the test cases follows.\n\nThe first line of each test case contains one integer $n$ ($3 \\le n \\le 10^5$; $n$ is a multiple of $3$) — the number of columns of Tepito.\n\nThe following two lines each contain a string of length $n$. The $i$-th line contains the string $s_i$, consisting of the characters $\\texttt{A}$ and $\\texttt{J}$. If $s_{i,j}=\\texttt{A}$, the house in the $i$-th row and $j$-th column will select Álvaro. Otherwise if $s_{i,j}=\\texttt{J}$, the house will select José.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.\n\nOutput: For each test case, output a single integer — the maximum number of districts Álvaro can win by optimally dividing the houses into districts.\n\nExamples:\ninput:\n4\n3\nAAA\nAJJ\n6\nJAJAJJ\nJJAJAJ\n6\nAJJJAJ\nAJJAAA\n9\nAJJJJAJAJ\nJAAJJJJJA\noutput:\n2\n2\n3\n2\n\nNote: The image below showcases the optimal arrangement of districts Álvaro can use for each test case in the example.\n\n\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2022C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Turtle and a MEX Problem (Hard Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: The two versions are different problems. In this version of the problem, you can't choose the same integer twice or more. You can make hacks only if both versions are solved.\n\nOne day, Turtle was playing with $n$ sequences. Let the length of the $i$-th sequence be $l_i$. Then the $i$-th sequence was $a_{i, 1}, a_{i, 2}, \\ldots, a_{i, l_i}$.\n\nPiggy gave Turtle a problem to solve when Turtle was playing. The statement of the problem was:\n\n * There was a non-negative integer $x$ at first. Turtle would perform an arbitrary number (possibly zero) of operations on the integer. * In each operation, Turtle could choose an integer $i$ such that $1 \\le i \\le n$ and $i$ wasn't chosen before, and set $x$ to $\\text{mex}^{\\dagger}(x, a_{i, 1}, a_{i, 2}, \\ldots, a_{i, l_i})$. * Turtle was asked to find the answer, which was the maximum value of $x$ after performing an arbitrary number of operations. \n\nTurtle solved the above problem without difficulty. He defined $f(k)$ as the answer to the above problem when the initial value of $x$ was $k$.\n\nThen Piggy gave Turtle a non-negative integer $m$ and asked Turtle to find the value of $\\sum\\limits_{i = 0}^m f(i)$ (i.e., the value of $f(0) + f(1) + \\ldots + f(m)$). Unfortunately, he couldn't solve this problem. Please help him!\n\n$^{\\dagger}\\text{mex}(c_1, c_2, \\ldots, c_k)$ is defined as the smallest non-negative integer $x$ which does not occur in the sequence $c$. For example, $\\text{mex}(2, 2, 0, 3)$ is $1$, $\\text{mex}(1, 2)$ is $0$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^4$). The description of the test cases follows.\n\nThe first line of each test case contains two integers $n, m$ ($1 \\le n \\le 2 \\cdot 10^5, 0 \\le m \\le 10^9$).\n\nEach of the following $n$ lines contains several integers. The first integer $l_i$ ($1 \\le l_i \\le 2 \\cdot 10^5$) represents the length of the $i$-th sequence, and the following $l_i$ integers $a_{i, 1}, a_{i, 2}, \\ldots, a_{i, l_i}$ ($0 \\le a_{i, j} \\le 10^9$) represent the elements of the $i$-th sequence.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$ and the sum of $\\sum l_i$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output a single integer — the value of $\\sum\\limits_{i = 0}^m f(i)$.\n\nExamples:\ninput:\n6\n3 4\n2 0 2\n3 2 3 3\n4 7 0 1 5\n3 4\n5 0 2 0 4 11\n1 1\n5 1 3 0 3 3\n2 50\n2 1 2\n2 1 2\n1 1\n7 1 2 4 1 4 9 5\n4 114514\n2 2 2\n5 7 3 6 0 3\n3 0 1 1\n5 0 9 2 1 5\n5 1919810\n1 2\n2 324003 0\n3 1416324 2 1460728\n4 1312631 2 0 1415195\n5 1223554 192248 2 1492515 725556\noutput:\n16\n18\n1281\n4\n6556785365\n1842836177961\n\nNote: In the first test case, when $x$ is initially $2$, Turtle can choose $i = 3$ and set $x$ to $\\text{mex}(x, a_{3, 1}, a_{3, 2}, a_{3, 3}, a_{3, 4}) = \\text{mex}(2, 7, 0, 1, 5) = 3$. It can be proved that Turtle can't make the value of $x$ greater than $3$, so $f(2) = 3$.\n\nIt can be seen that $f(0) = 3$, $f(1) = 3$, $f(2) = 3$, $f(3) = 3$, and $f(4) = 4$. So $f(0) + f(1) + f(2) + f(3) + f(4) = 3 + 3 + 3 + 3 + 4 = 16$.\n\nIn the second test case, when $x$ is initially $1$, Turtle can choose $i = 1$ and set $x$ to $\\text{mex}(x, a_{1, 1}, a_{1, 2}, a_{1, 3}, a_{1, 4}, a_{1, 5}) = \\text{mex}(1, 0, 2, 0, 4, 11) = 3$. It can be proved that Turtle can't make the value of $x$ greater than $3$, so $f(1) = 3$.\n\nIt can be seen that $f(0) = 4$, $f(1) = 3$, $f(2) = 4$, $f(3) = 3$, and $f(4) = 4$. So $f(0) + f(1) + f(2) + f(3) + f(4) = 4 + 3 + 4 + 3 + 4 = 18$.\n\nIn the fourth test case, it can be seen that $f(0) = 3$ and $f(1) = 1$. So $f(0) + f(1) = 3 + 1 = 4$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2003D2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Distanced Coloring\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You received an $n\\times m$ grid from a mysterious source. The source also gave you a magic positive integer constant $k$.\n\nThe source told you to color the grid with some colors, satisfying the following condition:\n\n * If $(x_1,y_1)$, $(x_2,y_2)$ are two distinct cells with the same color, then $\\max(|x_1-x_2|,|y_1-y_2|)\\ge k$. \n\nYou don't like using too many colors. Please find the minimum number of colors needed to color the grid.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1\\le t\\le1000$). The description of the test cases follows.\n\nThe only line of each test case consists of three positive integers $n$, $m$, $k$ ($1\\le n,m,k\\le10^4$) — the dimensions of the grid and the magic constant.\n\nOutput: For each test case, print a single integer — the minimum number of colors needed to color the grid.\n\nExamples:\ninput:\n6\n3 3 2\n5 1 10000\n7 3 4\n3 2 7\n8 9 6\n2 5 4\noutput:\n4\n5\n12\n6\n36\n8\n\nNote: In the first test case, one of the optimal constructions is:\n\n\n\nIn the second test case, the color of all cells must be pairwise different, so the answer is $5$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2002A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: The Strict Teacher (Hard Version)\ntime_limit_ms: 1500\nmemory_limit_mb: 256\nDescription: This is the hard version of the problem. The only differences between the two versions are the constraints on $m$ and $q$. In this version, $m, q \\le 10^5$. You can make hacks only if both versions of the problem are solved.\n\nNarek and Tsovak were busy preparing this round, so they have not managed to do their homework and decided to steal David's homework. Their strict teacher noticed that David has no homework and now wants to punish him. She hires other teachers to help her catch David. And now $m$ teachers together are chasing him. Luckily, the classroom is big, so David has many places to hide.\n\nThe classroom can be represented as a one-dimensional line with cells from $1$ to $n$, inclusive.\n\nAt the start, all $m$ teachers and David are in distinct cells. Then they make moves. During each move\n\n * David goes to an adjacent cell or stays at the current one. * Then, each of the $m$ teachers simultaneously goes to an adjacent cell or stays at the current one. \n\nThis continues until David is caught. David is caught if any of the teachers (possibly more than one) is located in the same cell as David. Everyone sees others' moves, so they all act optimally.\n\nYour task is to find how many moves it will take for the teachers to catch David if they all act optimally.\n\nActing optimally means the student makes his moves in a way that maximizes the number of moves the teachers need to catch him; and the teachers coordinate with each other to make their moves in a way that minimizes the number of moves they need to catch the student.\n\nAlso, as Narek and Tsovak think this task is easy, they decided to give you $q$ queries on David's position.\n\nInput: In the first line of the input, you are given a single integer $t$ ($1 \\le t \\le 10^5$) — the number of test cases. The description of each test case follows.\n\nIn the first line of each test case, you are given three integers $n$, $m$, and $q$ ($3 \\le n \\le 10^9$, $1 \\le m, q \\le 10^5$) — the number of cells on the line, the number of teachers, and the number of queries.\n\nIn the second line of each test case, you are given $m$ distinct integers $b_1, b_2, \\ldots, b_m$ ($1 \\le b_i \\le n$) — the cell numbers of the teachers.\n\nIn the third line of each test case, you are given $q$ integers $a_1, a_2, \\ldots, a_q$ ($1 \\le a_i \\le n$) — David's cell number for every query.\n\nIt is guaranteed that for any $i$, $j$ such that $1 \\le i \\le m$ and $1 \\le j \\le q$, $b_i \\neq a_j$.\n\nIt is guaranteed that the sum of values of $m$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nIt is guaranteed that the sum of values of $q$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output $q$ lines, the $i$-th of them containing the answer of the $i$-th query.\n\nExamples:\ninput:\n2\n8 1 1\n6\n3\n10 3 3\n1 4 8\n2 3 10\noutput:\n5\n1\n1\n2\n\nNote: In the only query of the first example, the student can run to cell $1$. It will take the teacher five moves to reach from cell $6$ to cell $1$, so the answer is $5$.\n\nIn the second query of the second example, the student can just stay at cell $3$. The teacher, initially located in cell $4$, can reach cell $3$ in one move. Therefore, the answer is $1$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2005B2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Find Minimum Operations\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are given two integers $n$ and $k$.\n\nIn one operation, you can subtract any power of $k$ from $n$. Formally, in one operation, you can replace $n$ by $(n-k^x)$ for any non-negative integer $x$.\n\nFind the minimum number of operations required to make $n$ equal to $0$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^4$). The description of the test cases follows.\n\nThe only line of each test case contains two integers $n$ and $k$ ($1 \\le n, k \\le 10^9$).\n\nOutput: For each test case, output the minimum number of operations on a new line.\n\nExamples:\ninput:\n6\n5 2\n3 5\n16 4\n100 3\n6492 10\n10 1\noutput:\n2\n3\n1\n4\n21\n10\n\nNote: In the first test case, $n = 5$ and $k = 2$. We can perform the following sequence of operations:\n\n 1. Subtract $2^0 = 1$ from $5$. The current value of $n$ becomes $5 - 1 = 4$. 2. Subtract $2^2 = 4$ from $4$. The current value of $n$ becomes $4 - 4 = 0$. \n\nIt can be shown that there is no way to make $n$ equal to $0$ in less than $2$ operations. Thus, $2$ is the answer.\n\nIn the second test case, $n = 3$ and $k = 5$. We can perform the following sequence of operations:\n\n 1. Subtract $5^0 = 1$ from $3$. The current value of $n$ becomes $3 - 1 = 2$. 2. Subtract $5^0 = 1$ from $2$. The current value of $n$ becomes $2 - 1 = 1$. 3. Subtract $5^0 = 1$ from $1$. The current value of $n$ becomes $1 - 1 = 0$. \n\nIt can be shown that there is no way to make $n$ equal to $0$ in less than $3$ operations. Thus, $3$ is the answer.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2020A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Good Prefixes\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Alex thinks some array is good if there exists some element that can be represented as the sum of all other elements (the sum of all other elements is $0$ if there are no other elements). For example, the array $[1,6,3,2]$ is good since $1+3+2=6$. Furthermore, the array $[0]$ is also good. However, the arrays $[1,2,3,4]$ and $[1]$ are not good.\n\nAlex has an array $a_1,a_2,\\ldots,a_n$. Help him count the number of good non-empty prefixes of the array $a$. In other words, count the number of integers $i$ ($1 \\le i \\le n$) such that the length $i$ prefix (i.e. $a_1,a_2,\\ldots,a_i$) is good.\n\nInput: The first line of the input contains a single integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 2 \\cdot 10^5$) — the number of elements in the array.\n\nThe second line of each test case contains $n$ integers $a_1,a_2,\\ldots,a_n$ ($0 \\le a_i \\le 10^9$) — the elements of the array.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output a single integer — the number of good non-empty prefixes of the array $a$.\n\nExamples:\ninput:\n7\n1\n0\n1\n1\n4\n1 1 2 0\n5\n0 1 2 1 4\n7\n1 1 0 3 5 2 12\n7\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 294967296\n10\n0 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 589934592\noutput:\n1\n0\n3\n3\n4\n1\n2\n\nNote: In the fourth test case, the array has five prefixes:\n\n * prefix $[0]$ is a good array, as mentioned in the statement; * prefix $[0, 1]$ is not a good array, since $0 \\ne 1$; * prefix $[0, 1, 2]$ is not a good array, since $0 \\ne 1 + 2$, $1 \\ne 0 + 2$ and $2 \\ne 0 + 1$; * prefix $[0, 1, 2, 1]$ is a good array, since $2 = 0 + 1 + 1$; * prefix $[0, 1, 2, 1, 4]$ is a good array, since $4 = 0 + 1 + 2 + 1$. \n\nAs you can see, three of them are good, so the answer is $3$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1985C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Polygonal Segments\ntime_limit_ms: 8000\nmemory_limit_mb: 512\nDescription: You are given an array $a$ of size $n$.\n\nA segment $[l, r](1 \\le l < r \\le n)$ is called a polygonal segment only if the following conditions hold:\n\n * $(r-l+1) \\geq 3$; * Considering $a_l, a_{l+1}, \\ldots, a_r$ as side lengths, these sides can form a polygon with $(r-l+1)$ sides. \n\nProcess $q$ queries of two types:\n\n * \"1 l r\": find the length of the longest segment among all polygonal segments $[l_0,r_0]$ satisfying $l \\le l_0 \\le r_0 \\le r$. If there is no such polygonal segment, output $-1$ instead; * \"2 i x\": assign $a_i := x$.\n\nInput: The first line contains an integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases.\n\nFor each test case:\n\n * The first line of each testcase contains two integers $n$, $q$ ($4 \\le n \\le 2\\cdot 10^5$, $1 \\le q \\le 10^5$); * The second line of each testcase contains $n$ integers $a_1,a_2,\\ldots, a_n$ ($1 \\le a_i \\le 10^{12}$); * The following $q$ lines contain the description of queries. Each line is of one of two types: * \"1 l r\" ($1 \\le l < r \\le n$, $r-l+1\\ge 3$); * \"2 i x\" ($1 \\le i \\le n$, $1 \\le x \\le 10^{12}$). \n\nIt is guaranteed that the sum of $n$ over all test cases will not exceed $2 \\cdot 10^5$, and the sum of $q$ over all test cases will not exceed $10^5$.\n\nOutput: For each query, if there is no suitable segment, output $-1$ in a new line. Otherwise, output the length of the longest segment satisfying the condition above in a new line.\n\nExamples:\ninput:\n2\n5 6\n3 1 2 2 8\n1 1 3\n1 1 4\n1 1 5\n2 1 5\n1 1 4\n1 1 5\n4 10\n500000000000 500000000000 1000000000000 500000000000\n1 1 3\n1 2 4\n1 1 4\n2 1 499999999999\n2 3 999999999999\n1 1 3\n1 2 4\n1 1 4\n2 3 1000000000000\n1 1 3\noutput:\n-1\n4\n4\n3\n5\n-1\n-1\n4\n-1\n3\n4\n-1\n\nNote: In the first query of the first test case, there is no polygonal segment under the given condition. For example, considering segment $[1,3]$, you can not form a triangle with side lengths of $a_1=3$, $a_2=1$, and $a_3=2$.\n\nIn the second query of the first test case, the longest polygonal segment is $[1,4]$. You can form a quadrilateral with side lengths of $a_1=3$, $a_2=1$, $a_3=2$, and $a_4=2$.\n\n An example of a quadrilateral with side lengths of $3$, $1$, $2$, and $2$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1990F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Chips on a Line\ntime_limit_ms: 5000\nmemory_limit_mb: 512\nDescription: You have $n$ chips, and you are going to place all of them in one of $x$ points, numbered from $1$ to $x$. There can be multiple chips in each point.\n\nAfter placing the chips, you can perform the following four operations (in any order, any number of times):\n\n * choose a chip in point $i \\ge 3$, remove it and place two chips: one in $i-1$, one in $i-2$; * choose two chips in adjacent points $i$ and $i+1$, remove them and place a new chip in $i+2$; * choose a chip in point $1$ and move it to $2$; * choose a chip in point $2$ and move it to $1$. \n\nNote that the coordinates of the chips you place during the operations cannot be less than $1$, but can be greater than $x$.\n\nDenote the cost of chip placement as the minimum number of chips which can be present on the line after you perform these operations, starting from the placement you've chosen.\n\nFor example, the cost of placing two chips in points $3$ and one chip in point $5$ is $2$, because you can reduce the number of chips to $2$ as follows:\n\n * choose a chip in point $3$, remove it, place a chip in $1$ and another chip in $2$; * choose the chips in points $2$ and $3$, remove them and place a chip in $4$; * choose the chips in points $4$ and $5$, remove them and place a chip in $6$. \n\nYou are given three integers $n$, $x$ and $m$. Calculate the number of placements of exactly $n$ chips in points from $1$ to $x$ having cost equal to $m$, and print it modulo $998244353$. Two placements are considered different if the number of chips in some point differs between these placements.\n\nInput: The only line contains three integers $n$, $x$ and $m$ ($1 \\le m \\le n \\le 1000$; $2 \\le x \\le 10$).\n\nOutput: Print one integer — the number of placements with cost equal to $m$, taken modulo $998244353$.\n\nExamples:\ninput:\n2 3 1\noutput:\n5\n\ninput:\n42 10 5\noutput:\n902673363\n\ninput:\n1000 10 8\noutput:\n187821763\n\nNote: In the first example, there are five ways to place $2$ chips in points from $1$ to $3$ so that the cost is $1$:\n\n * $(1, 1)$; * $(1, 2)$; * $(1, 3)$; * $(2, 2)$; * $(2, 3)$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1997F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Grid Puzzle\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given an array $a$ of size $n$.\n\nThere is an $n \\times n$ grid. In the $i$-th row, the first $a_i$ cells are black and the other cells are white. In other words, note $(i,j)$ as the cell in the $i$-th row and $j$-th column, cells $(i,1), (i,2), \\ldots, (i,a_i)$ are black, and cells $(i,a_i+1), \\ldots, (i,n)$ are white.\n\nYou can do the following operations any number of times in any order:\n\n * Dye a $2 \\times 2$ subgrid white; * Dye a whole row white. Note you can not dye a whole column white. \n\nFind the minimum number of operations to dye all cells white.\n\nInput: The first line contains an integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases.\n\nFor each test case:\n\n * The first line contains an integer $n$ ($1 \\leq n \\leq 2 \\cdot 10^5$) — the size of the array $a$. * The second line contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($0 \\leq a_i \\leq n$). \n\nIt's guaranteed that the sum of $n$ over all test cases will not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output a single integer — the minimum number of operations to dye all cells white.\n\nExamples:\ninput:\n10\n1\n0\n4\n2 4 4 2\n4\n3 2 1 0\n3\n0 3 0\n3\n0 1 3\n3\n3 1 0\n4\n3 1 0 3\n4\n0 2 2 2\n6\n1 3 4 2 0 4\n8\n2 2 5 2 3 4 2 4\noutput:\n0\n3\n2\n1\n2\n2\n3\n2\n4\n6\n\nNote: In the first test case, you don't need to do any operation.\n\nIn the second test case, you can do:\n\n * Dye $(1,1), (1,2), (2,1)$, and $(2,2)$ white; * Dye $(2,3), (2,4), (3,3)$, and $(3,4)$ white; * Dye $(3,1), (3,2), (4,1)$, and $(4,2)$ white. \n\nIt can be proven $3$ is the minimum number of operations.\n\nIn the third test case, you can do:\n\n * Dye the first row white; * Dye $(2,1), (2,2), (3,1)$, and $(3,2)$ white. \n\nIt can be proven $2$ is the minimum number of operations.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1990D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Level Up\ntime_limit_ms: 4000\nmemory_limit_mb: 512\nDescription: Monocarp is playing a computer game. He starts the game being level $1$. He is about to fight $n$ monsters, in order from $1$ to $n$. The level of the $i$-th monster is $a_i$.\n\nFor each monster in the given order, Monocarp's encounter goes as follows:\n\n * if Monocarp's level is strictly higher than the monster's level, the monster flees (runs away); * otherwise, Monocarp fights the monster. \n\nAfter every $k$-th fight with a monster (fleeing monsters do not count), Monocarp's level increases by $1$. So, his level becomes $2$ after $k$ monsters he fights, $3$ after $2k$ monsters, $4$ after $3k$ monsters, and so on.\n\nYou need to process $q$ queries of the following form:\n\n * $i~x$: will Monocarp fight the $i$-th monster (or will this monster flee) if the parameter $k$ is equal to $x$?\n\nInput: The first line contains two integers $n$ and $q$ ($1 \\le n, q \\le 2 \\cdot 10^5$) — the number of monsters and the number of queries.\n\nThe second line contains $n$ integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 2 \\cdot 10^5$) — the levels of the monsters.\n\nIn the $j$-th of the following $q$ lines, two integers $i$ and $x$ ($1 \\le i, x \\le n$) — the index of the monster and the number of fights required for a level up in the $j$-th query.\n\nOutput: For each query, output \"YES\", if Monocarp will fight the $i$-th monster in this query, and \"NO\", if the $i$-th monster flees.\n\nExamples:\ninput:\n4 16\n2 1 2 1\n1 1\n2 1\n3 1\n4 1\n1 2\n2 2\n3 2\n4 2\n1 3\n2 3\n3 3\n4 3\n1 4\n2 4\n3 4\n4 4\noutput:\nYES\nNO\nYES\nNO\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nYES\n\ninput:\n7 15\n1 1 2 1 1 1 1\n5 3\n2 2\n2 2\n1 6\n5 1\n5 5\n7 7\n3 5\n7 4\n4 3\n2 5\n1 2\n5 6\n4 1\n6 1\noutput:\nNO\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nNO\nNO\nYES\nYES\nYES\nNO\nNO\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1997E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Dyn-scripted Robot (Hard Version)\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: This is the hard version of the problem. The only difference is that in this version $k \\le 10^{12}$. You can make hacks only if both versions of the problem are solved.\n\nGiven a $w \\times h$ rectangle on the $Oxy$ plane, with points $(0, 0)$ at the bottom-left and $(w, h)$ at the top-right of the rectangle.\n\nYou also have a robot initially at point $(0, 0)$ and a script $s$ of $n$ characters. Each character is either L, R, U, or D, which tells the robot to move left, right, up, or down respectively.\n\nThe robot can only move inside the rectangle; otherwise, it will change the script $s$ as follows:\n\n * If it tries to move outside a vertical border, it changes all L characters to R's (and vice versa, all R's to L's). * If it tries to move outside a horizontal border, it changes all U characters to D's (and vice versa, all D's to U's). \n\nThen, it will execute the changed script starting from the character which it couldn't execute.\n\n An example of the robot's movement process, $s = \\texttt{\"ULULURD\"}$\n\nThe script $s$ will be executed for $k$ times continuously. All changes to the string $s$ will be retained even when it is repeated. During this process, how many times will the robot move to the point $(0, 0)$ in total? Note that the initial position does NOT count.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nThe first line of each test case contains four integers $n$, $k$, $w$, and $h$ ($1 \\le n, w, h \\le 10^6$; $1 \\le k \\le 10^{12}$).\n\nThe second line contains a single string $s$ of size $n$ ($s_i \\in \\\\{\\texttt{L}, \\texttt{R}, \\texttt{U}, \\texttt{D}\\\\}$) — the script to be executed.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^6$.\n\nOutput: For each test case, print a single integer — the number of times the robot reaches $(0, 0)$ when executing script $s$ for $k$ times continuously.\n\nExamples:\ninput:\n6\n2 4 2 2\nUR\n4 2 1 1\nLLDD\n6 3 3 1\nRLRRRL\n5 6 3 3\nRUURD\n7 5 3 4\nRRDLUUU\n7 123456789999 3 2\nULULURD\noutput:\n1\n4\n3\n1\n1\n41152263332\n\nNote: In the first test case, the robot only moves up and right for the first two executions. After that, it occupies the position $(2, 2)$. For the next two executions, it moves down and left and finishes at $(0, 0)$. So the answer is $1$.\n\nIn the second test case, each time executing the script the robot visits the origin twice. And since $k=2$, it visits the origin $2 \\cdot 2 = 4$ times overall.\n\n\n\nIn the third test case, the visualization is shown as below:\n\n\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1993F2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Chain Queries\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given a tree of $n$ vertices numbered from $1$ to $n$. Initially, all vertices are colored white or black.\n\nYou are asked to perform $q$ queries:\n\n * \"u\" — toggle the color of vertex $u$ (if it was white, change it to black and vice versa). \n\nAfter each query, you should answer whether all the black vertices form a chain. That is, there exist two black vertices such that the simple path between them passes through all the black vertices and only the black vertices. Specifically, if there is only one black vertex, they form a chain. If there are no black vertices, they do not form a chain.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1\\leq t\\leq 10^4$). The description of the test cases follows.\n\nThe first line of each test case contains two integers $n$ and $q$ ($1\\leq n,q\\leq 2\\cdot 10^5$).\n\nThe second line of each test case contains $n$ integers $c_1,c_2,\\ldots,c_n$ ($c_i \\in \\\\{ \\mathtt{0}, \\mathtt{1} \\\\}$) — the initial color of the vertices. $c_i$ denotes the color of vertex $i$ where $\\mathtt{0}$ denotes the color white, and $\\mathtt{1}$ denotes the color black.\n\nThen $n - 1$ lines follow, each line contains two integers $x_i$ and $y_i$ ($1 \\le x_i,y_i \\le n$), indicating an edge between vertices $x_i$ and $y_i$. It is guaranteed that these edges form a tree.\n\nThe following $q$ lines each contain an integer $u_i$ ($1 \\le u_i \\le n$), indicating the color of vertex $u_i$ needs to be toggled.\n\nIt is guaranteed that the sum of $n$ and $q$ over all test cases respectively does not exceed $2\\cdot 10^5$.\n\nOutput: For each query, output \"Yes\" if the black vertices form a chain, and output \"No\" otherwise.\n\nYou can output \"Yes\" and \"No\" in any case (for example, strings \"yEs\", \"yes\", \"Yes\" and \"YES\" will be recognized as a positive response).\n\nExamples:\ninput:\n2\n2 1\n1 0\n1 2\n1\n5 4\n1 0 0 0 0\n1 2\n1 3\n1 5\n3 4\n4\n3\n2\n5\noutput:\nNo\nNo\nYes\nYes\nNo\n\ninput:\n4\n5 3\n1 1 1 1 1\n3 5\n2 5\n3 4\n1 5\n1\n1\n1\n4 4\n0 0 0 0\n1 2\n2 3\n1 4\n1\n2\n3\n2\n1 1\n1\n1\n1 1\n0\n1\noutput:\nYes\nNo\nYes\nYes\nYes\nYes\nNo\nNo\nYes\n\nNote: In the second test case, the color of the vertices are as follows:\n\nThe initial tree:\n\n\n\nThe first query toggles the color of vertex $4$:\n\n\n\nThe second query toggles the color of vertex $3$:\n\n\n\nThe third query toggles the color of vertex $2$:\n\n\n\nThe fourth query toggles the color of vertex $5$:\n\n\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1975E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Little Nikita\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: The little boy Nikita was given some cubes as a present. He decided to build a tower out of them.\n\nInitially, the tower doesn't have any cubes. In one move, Nikita either puts exactly $1$ cube on top of the tower or removes exactly $1$ cube from the top of the tower. Is it possible that after $n$ moves, the resulting tower has exactly $m$ cubes?\n\nInput: Each test contains multiple test cases. The first line of input contains a single integer $t$ ($1 \\le t \\le 100$) — the number of test cases. The description of the test cases follows.\n\nThe only line of each test case contains two integers $n$ and $m$ ($1 \\le n, m \\le 100$).\n\nOutput: For each test case, output \"Yes\" (without quotes) if Nikita can obtain a tower with $m$ cubes, and \"No\" (without quotes) otherwise.\n\nYou can output each letter in any case (lowercase or uppercase). For example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will be accepted as a positive answer.\n\nExamples:\ninput:\n3\n3 3\n2 4\n5 3\noutput:\nYes\nNo\nYes\n\nNote: In the first test case, Nikita can put $1$ cube on top of the tower $3$ times in a row, so the answer is \"Yes\".\n\nIn the second test case, Nikita can only end up with either a tower with no blocks or a tower with $2$ blocks, so the answer is \"No\".\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1977A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Complex Segments (Hard Version)\ntime_limit_ms: 13000\nmemory_limit_mb: 256\nDescription: [Ken Arai - COMPLEX](https://soundcloud.com/diatomichail2/complex)\n\n⠀\n\nThis is the hard version of the problem. In this version, the constraints on $n$ and the time limit are higher. You can make hacks only if both versions of the problem are solved.\n\nA set of (closed) segments is complex if it can be partitioned into some subsets such that\n\n * all the subsets have the same size; and * a pair of segments intersects if and only if the two segments are in the same subset. \n\nYou are given $n$ segments $[l_1, r_1], [l_2, r_2], \\ldots, [l_n, r_n]$. Find the maximum size of a complex subset of these segments.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^3$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 3 \\cdot 10^5$) — the number of segments.\n\nThe second line of each test case contains $n$ integers $l_1, l_2, \\ldots, l_n$ ($1 \\le l_i \\le 2n$) — the left endpoints of the segments.\n\nThe third line of each test case contains $n$ integers $r_1, r_2, \\ldots, r_n$ ($l_i \\leq r_i \\le 2n$) — the right endpoints of the segments.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $3 \\cdot 10^5$.\n\nOutput: For each test case, output a single integer: the maximum size of a complex subset of the given segments.\n\nExamples:\ninput:\n3\n3\n1 2 3\n5 4 6\n5\n1 2 3 6 8\n5 4 7 9 10\n5\n3 1 4 1 5\n7 2 6 5 10\noutput:\n3\n4\n4\n\nNote: In the first test case, all pairs of segments intersect, therefore it is optimal to form a single group containing all of the three segments.\n\nIn the second test case, there is no valid partition for all of the five segments. A valid partition with four segments is the following: $\\\\{\\\\{ [1, 5], [2, 4] \\\\}, \\\\{ [6, 9], [8, 10] \\\\}\\\\}$.\n\nIn the third test case, it is optimal to make a single group containing all the segments except the second.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2018E2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Penacony\ntime_limit_ms: 3000\nmemory_limit_mb: 512\nDescription: On Penacony, The Land of the Dreams, there exists $n$ houses and $n$ roads. There exists a road between house $i$ and $i+1$ for all $1 \\leq i \\leq n-1$ and a road between house $n$ and house $1$. All roads are bidirectional. However, due to the crisis on Penacony, the overseeing family has gone into debt and may not be able to maintain all roads.\n\nThere are $m$ pairs of friendships between the residents of Penacony. If the resident living in house $a$ is friends with the resident living in house $b$, there must be a path between houses $a$ and $b$ through maintained roads.\n\nWhat is the minimum number of roads that must be maintained?\n\nInput: The first line contains $t$ ($1 \\leq t \\leq 10^4$) – the number of test cases.\n\nThe first line of each test case contains two integers $n$ and $m$ ($3 \\leq n \\leq 2 \\cdot 10^5, 1 \\leq m \\leq 2 \\cdot 10^5$) – the number of houses and the number of friendships.\n\nThe next $m$ lines contain two integers $a$ and $b$ ($1 \\leq a < b \\leq n$) – the resident in house $a$ is friends with the resident in house $b$. It is guaranteed all ($a, b$) are distinct.\n\nIt is guaranteed the sum of $n$ and $m$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output an integer, the minimum number of roads that must be maintained.\n\nExamples:\ninput:\n7\n8 3\n1 8\n2 7\n4 5\n13 4\n1 13\n2 12\n3 11\n4 10\n10 2\n2 3\n3 4\n10 4\n3 8\n5 10\n2 10\n4 10\n4 1\n1 3\n5 2\n3 5\n1 4\n5 2\n2 5\n1 3\noutput:\n4\n7\n2\n7\n2\n3\n3\n\nNote: For the first test case, the following roads must be maintained:\n\n * $8 \\leftarrow \\rightarrow 1$ * $7 \\leftarrow \\rightarrow 8$ * $1 \\leftarrow \\rightarrow 2$ * $4 \\leftarrow \\rightarrow 5$\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1996G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Not a Nim Problem\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Two players, Alice and Bob, are playing a game. They have $n$ piles of stones, with the $i$-th pile initially containing $a_i$ stones.\n\nOn their turn, a player can choose any pile of stones and take any positive number of stones from it, with one condition:\n\n * let the current number of stones in the pile be $x$. It is not allowed to take from the pile a number of stones $y$ such that the greatest common divisor of $x$ and $y$ is not equal to $1$. \n\nThe player who cannot make a move loses. Both players play optimally (that is, if a player has a strategy that allows them to win, no matter how the opponent responds, they will win). Alice goes first.\n\nDetermine who will win.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nEach test case consists of two lines:\n\n * the first line contains a single integer $n$ ($1 \\le n \\le 3 \\cdot 10^5$); * the second line contains $n$ integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 10^7$). \n\nAdditional constraint on the input: the sum of $n$ across all test cases does not exceed $3 \\cdot 10^5$.\n\nOutput: For each test case, output Alice if Alice wins, or Bob if Bob wins.\n\nExamples:\ninput:\n3\n3\n3 2 9\n4\n3 3 6 1\n5\n1 2 3 4 5\noutput:\nBob\nAlice\nBob\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2004E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Billetes MX (Easy Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: This is the easy version of the problem. In this version, it is guaranteed that $q = 0$. You can make hacks only if both versions of the problem are solved.\n\nAn integer grid $A$ with $p$ rows and $q$ columns is called beautiful if:\n\n * All elements of the grid are integers between $0$ and $2^{30}-1$, and * For any subgrid, the XOR of the values at the corners is equal to $0$. Formally, for any four integers $i_1$, $i_2$, $j_1$, $j_2$ ($1 \\le i_1 < i_2 \\le p$; $1 \\le j_1 < j_2 \\le q$), $A_{i_1, j_1} \\oplus A_{i_1, j_2} \\oplus A_{i_2, j_1} \\oplus A_{i_2, j_2} = 0$, where $\\oplus$ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR). \n\nThere is a partially filled integer grid $G$ with $n$ rows and $m$ columns where only $k$ cells are filled. Polycarp wants to know how many ways he can assign integers to the unfilled cells so that the grid is beautiful.\n\nHowever, Monocarp thinks that this problem is too easy. Therefore, he will perform $q$ updates on the grid. In each update, he will choose an unfilled cell and assign an integer to it. Note that these updates are persistent. That is, changes made to the grid will apply when processing future updates.\n\nFor each of the $q + 1$ states of the grid, the initial state and after each of the $q$ queries, determine the number of ways Polycarp can assign integers to the unfilled cells so that the grid is beautiful. Since this number can be very large, you are only required to output their values modulo $10^9+7$.\n\nInput: The first line contains $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nThe first line of each test case contains four integers $n$, $m$, $k$ and $q$ ($2 \\le n, m \\le 10^5$; $0 \\le k \\le 10^5$; $q = 0$) — the number of rows, the number of columns, the number of fixed cells, and the number of updates.\n\nThe following $k$ lines contain three integers $r$, $c$ and $v$ ($1 \\le r \\le n, 1 \\le c \\le m$; $0 \\le v < 2^{30}$) — indicating that $G_{r, c}$ is assigned the integer $v$.\n\nThe following $q$ lines contain three integers $r$, $c$ and $v$ ($1 \\le r \\le n, 1 \\le c \\le m$; $0 \\le v < 2^{30}$) — indicating that $G_{r, c}$ is assigned the integer $v$.\n\nIt is guaranteed that the pairs $(r,c)$ over all assignments are distinct.\n\nIt is guaranteed that the sum of $n$, $m$, $k$ and $q$ over all test cases does not exceed $10^5$ respectively.\n\nOutput: For each test case, output $q + 1$ lines. The $i$-th line of output should contain the answer of the $i$-th state of the grid modulo $10^9 + 7$.\n\nExamples:\ninput:\n2\n3 3 8 0\n2 1 6\n3 2 12\n1 2 6\n2 2 0\n1 3 10\n1 1 0\n2 3 12\n3 1 10\n2 5 2 0\n1 1 10\n1 2 30\noutput:\n1\n489373567\n\nNote: In the first test case of the example, we have the following grid:\n\n$0$| $6$| $10$ ---|---|--- $6$| $0$| $12$ $10$| $12$| $?$ It can be proven that the only valid value for tile $(3, 3)$ is $0$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2022E1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: The Endspeaker (Easy Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the easy version of this problem. The only difference is that you only need to output the minimum total cost of operations in this version. You must solve both versions to be able to hack.\n\nYou're given an array $a$ of length $n$, and an array $b$ of length $m$ ($b_i > b_{i+1}$ for all $1 \\le i < m$). Initially, the value of $k$ is $1$. Your aim is to make the array $a$ empty by performing one of these two operations repeatedly:\n\n * Type $1$ — If the value of $k$ is less than $m$ and the array $a$ is not empty, you can increase the value of $k$ by $1$. This does not incur any cost. * Type $2$ — You remove a non-empty prefix of array $a$, such that its sum does not exceed $b_k$. This incurs a cost of $m - k$. \n\nYou need to minimize the total cost of the operations to make array $a$ empty. If it's impossible to do this through any sequence of operations, output $-1$. Otherwise, output the minimum total cost of the operations.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 1000$). The description of the test cases follows.\n\nThe first line of each test case contains two integers $n$ and $m$ ($1 \\le n, m \\le 3 \\cdot 10^5$, $\\boldsymbol{1 \\le n \\cdot m \\le 3 \\cdot 10^5}$).\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10^9$).\n\nThe third line of each test case contains $m$ integers $b_1, b_2, \\ldots, b_m$ ($1 \\le b_i \\le 10^9$).\n\nIt is also guaranteed that $b_i > b_{i+1}$ for all $1 \\le i < m$.\n\nIt is guaranteed that the sum of $\\boldsymbol{n \\cdot m}$ over all test cases does not exceed $3 \\cdot 10^5$.\n\nOutput: For each test case, if it's possible to make $a$ empty, then output the minimum total cost of the operations.\n\nIf there is no possible sequence of operations which makes $a$ empty, then output a single integer $-1$.\n\nExamples:\ninput:\n5\n4 2\n9 3 4 3\n11 7\n1 2\n20\n19 18\n10 2\n2 5 2 1 10 3 2 9 9 6\n17 9\n10 11\n2 2 2 2 2 2 2 2 2 2\n20 18 16 14 12 10 8 6 4 2 1\n1 6\n10\n32 16 8 4 2 1\noutput:\n1\n-1\n2\n10\n4\n\nNote: In the first test case, one optimal sequence of operations which yields a total cost of $1$ is as follows:\n\n * Perform an operation of type $2$. Choose the prefix to be $[9]$. This incurs a cost of $1$. * Perform an operation of type $1$. The value of $k$ is now $2$. This incurs no cost. * Perform an operation of type $2$. Choose the prefix to be $[3, 4]$. This incurs a cost of $0$. * Perform an operation of type $2$. Choose the prefix to be $[3]$. This incurs a cost of $0$. * The array $a$ is now empty, and the total cost of all operations is $1$. \n\nIn the second test case, it's impossible to remove any prefix of the array since $a_1 > b_1$, so array $a$ cannot be made empty by any sequence of operations.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2027D1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Prime Split Game\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Alice and Bob are playing a game with $n$ piles of stones, where the $i$-th pile has $a_i$ stones. Players take turns making moves, with Alice going first.\n\nOn each move, the player does the following three-step process:\n\n 1. Choose an integer $k$ ($1 \\leq k \\leq \\frac n 2$). Note that the value of $k$ can be different for different moves. 2. Remove $k$ piles of stones. 3. Choose another $k$ piles of stones and split each pile into two piles. The number of stones in each new pile must be a prime number. \n\nThe player who is unable to make a move loses.\n\nDetermine who will win if both players play optimally.\n\nInput: Each test contains multiple test cases. The first line contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases. The description of test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($2 \\le n \\le 2 \\cdot 10^5$) — the number of piles of stones.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 2 \\cdot 10^5$) — the number of stones in the piles.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output \"Alice\" (without quotes) if Alice wins and \"Bob\" (without quotes) otherwise.\n\nYou can output each letter in any case (upper or lower). For example, the strings \"alIcE\", \"Alice\", and \"alice\" will all be considered identical.\n\nExamples:\ninput:\n4\n2\n2 1\n3\n3 5 7\n4\n4 6 8 10\n5\n8 8 8 8 8\noutput:\nBob\nAlice\nAlice\nBob\n\nNote: In the first test case, there are $2$ piles of stones with $2$ and $1$ stones respectively. Since neither $1$ nor $2$ can be split into two prime numbers, Alice cannot make a move, so Bob wins.\n\nIn the second test case, there are $3$ piles of stones with $3$, $5$, and $7$ stones respectively. Alice can choose $k = 1$, remove the pile of $7$ stones, and then split the pile of $5$ stones into two piles of prime numbers of stones, $2$ and $3$. Then, the piles consist of $3$ piles of stones with $3$, $2$, and $3$ stones respectively, leaving Bob with no valid moves, so Alice wins.\n\nIn the third test case, there are $4$ piles of stones with $4$, $6$, $8$, and $10$ stones respectively. Alice can choose $k = 2$, removing two piles of $8$ and $10$ stones. She splits the pile of $4$ stones into two piles of prime numbers of stones, $2$ and $2$, and the pile of $6$ stones into two piles of $3$ and $3$ stones. Then, Bob has no valid moves, so Alice wins.\n\nIn the fourth test case, there are $5$ piles of stones, each containing $8$ stones. It can be shown that if both players play optimally, Bob will win.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1991H",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Dora and C++\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Dora has just learned the programming language C++!\n\nHowever, she has completely misunderstood the meaning of C++. She considers it as two kinds of adding operations on the array $c$ with $n$ elements. Dora has two integers $a$ and $b$. In one operation, she can choose one of the following things to do.\n\n * Choose an integer $i$ such that $1 \\leq i \\leq n$, and increase $c_i$ by $a$. * Choose an integer $i$ such that $1 \\leq i \\leq n$, and increase $c_i$ by $b$. \n\nNote that $a$ and $b$ are constants, and they can be the same.\n\nLet's define a range of array $d$ as $\\max(d_i) - \\min(d_i)$. For instance, the range of the array $[1, 2, 3, 4]$ is $4 - 1 = 3$, the range of the array $[5, 2, 8, 2, 2, 1]$ is $8 - 1 = 7$, and the range of the array $[3, 3, 3]$ is $3 - 3 = 0$.\n\nAfter any number of operations (possibly, $0$), Dora calculates the range of the new array. You need to help Dora minimize this value, but since Dora loves exploring all by herself, you only need to tell her the minimized value.\n\nInput: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases. The description of test cases follows.\n\nThe first line of each test case contains three integers $n$, $a$, and $b$ ($1 \\leq n \\leq 10^5$, $1 \\leq a, b \\leq 10^9$) — the length of the array $c$ and the constant values, respectively.\n\nThe second line of each test case contains $n$ integers $c_1, c_2, \\ldots, c_n$ ($1 \\leq c_i \\leq 10^9$) — the initial elements of the array $c$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.\n\nOutput: For each test case, output a single integer — the minimum possible range of the array after any number of operations.\n\nExamples:\ninput:\n10\n4 5 5\n1 3 4 4\n4 2 3\n1 3 4 6\n4 7 7\n1 1 2 6\n3 15 9\n1 9 5\n3 18 12\n1 4 5\n7 27 36\n33 13 23 12 35 24 41\n10 6 9\n15 5 6 9 8 2 12 15 3 8\n2 1 1000000000\n1 1000000000\n6 336718728 709848696\n552806726 474775724 15129785 371139304 178408298 13106071\n6 335734893 671469786\n138885253 70095920 456876775 9345665 214704906 375508929\noutput:\n3\n0\n3\n2\n3\n5\n1\n0\n17\n205359241\n\nNote: In the first test case, we can increase $c_1 = 1$ by $a = 5$. The array $c$ will become $[6, 3, 4, 4]$, and the range is $3$. Note that there is more than one way to reach the answer.\n\nIn the second test case, we can increase $c_1 = 1$ by $a = 2$ and then increase $c_1 = 3$ by $b = 3$. Also, we can increase $c_2 = 3$ by $b = 3$ and increase $c_3 = 4$ by $a = 2$. The array $c$ will become $[6, 6, 6, 6]$, and the range is $0$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2007C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Let Me Teach You a Lesson (Easy Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the easy version of a problem. The only difference between an easy and a hard version is the constraints on $t$ and $n$. You can make hacks only if both versions of the problem are solved.\n\nArthur is giving a lesson to his famous $2 n$ knights. Like any other students, they're sitting at the desks in pairs, but out of habit in a circle. The knight $2 i - 1$ is sitting at the desk with the knight $2 i$.\n\nEach knight has intelligence, which can be measured by an integer. Let's denote the intelligence of the $i$-th knight as $a_i$. Arthur wants the maximal difference in total intelligence over all pairs of desks to be as small as possible. More formally, he wants to minimize $\\max\\limits_{1 \\le i \\le n} (a_{2 i - 1} + a_{2 i}) - \\min\\limits_{1 \\le i \\le n} (a_{2 i - 1} + a_{2 i})$.\n\nHowever, the Code of Chivalry only allows swapping the opposite knights in the circle, i.e., Arthur can simultaneously perform $a_i := a_{i + n}$, $a_{i + n} := a_i$ for any $1 \\le i \\le n$. Arthur can make any number of such swaps. What is the best result he can achieve?\n\nInput: Each test consists of several test cases. The first line contains a single integer $t$ ($1 \\le t \\le 1000$) — the number of test cases. It is followed by descriptions of the test cases.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 2000$) — the number of desks.\n\nThe second line consists of $2n$ integers $a_1, a_2, \\ldots, a_{2 n}$ ($1 \\le a_i \\le 10^9$) — the intelligence values of the knights.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2000$.\n\nOutput: For each test case, output a single line containing one integer — the minimal difference Arthur can achieve.\n\nExamples:\ninput:\n5\n2\n6 6 4 4\n1\n10 17\n3\n1 10 1 10 1 10\n3\n3 3 4 5 5 4\n5\n1 2 3 4 5 6 7 8 9 10\noutput:\n0\n0\n0\n2\n4\n\nNote: In the first test case, Arthur can swap the second and the fourth knights. Then the total intelligence at both desks will be $10$.\n\nIn the third test case, Arthur can make $0$ operations, which will result in the total intelligence of $11$ at each of the desks.\n\nIn the fourth test case, Arthur can swap knights with indices $2$ and $5$ and achieve the difference of $2$. It can be proven that he cannot improve his result any further.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1995E1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Fun Game\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Vova really loves the [XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) operation (denoted as $\\oplus$). Recently, when he was going to sleep, he came up with a fun game.\n\nAt the beginning of the game, Vova chooses two binary sequences $s$ and $t$ of length $n$ and gives them to Vanya. A binary sequence is a sequence consisting only of the numbers $0$ and $1$. Vanya can choose integers $l, r$ such that $1 \\leq l \\leq r \\leq n$, and for all $l \\leq i \\leq r$ simultaneously replace $s_i$ with $s_i \\oplus s_{i - l + 1}$, where $s_i$ is the $i$-th element of the sequence $s$.\n\nIn order for the game to be interesting, there must be a possibility to win. Vanya wins if, with an unlimited number of actions, he can obtain the sequence $t$ from the sequence $s$. Determine if the game will be interesting for the sequences $s$ and $t$.\n\nInput: Each test consists of multiple test cases. The first line contains an integer $q$ ($1 \\le q \\le 10^{4}$) — the number of test cases. Then follows the description of the test cases.\n\nThe first line of each test case contains a single integer $n$ ($1 \\leq n \\leq 2 \\cdot 10^5$) — the length of the sequences $s$ and $t$.\n\nThe second line of each test case contains a binary sequence $s$ of length $n$.\n\nThe third line of each test case contains a binary sequence $t$ of length $n$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output \"Yes\" if the game will be interesting, otherwise output \"No\".\n\nYou can output each letter in any case (for example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will be recognized as a positive answer).\n\nExamples:\ninput:\n6\n1\n0\n1\n7\n0110100\n0110100\n9\n100101010\n101111110\n4\n0011\n1011\n4\n0100\n0001\n8\n10110111\n01100000\noutput:\nNO\nYES\nYES\nNO\nYES\nYES\n\nNote: In the first test case, Vanya will not be able to change the sequence $s$ with the only possible action of choosing $l = r = 1$.\n\nIn the second test case, the sequences $s$ and $t$ are already equal.\n\nIn the third test case, Vanya can act as follows:\n\n 1. Choose $l = 3$ and $r = 5$, then $s$ will become $\\mathtt{101101010}$. 2. Choose $l = 5$ and $r = 6$, then $s$ will become $\\mathtt{101111010}$. 3. Choose $l = 7$ and $r = 7$, then $s$ will become $\\mathtt{101111110}$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1994B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Maximize the Root\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: You are given a rooted tree, consisting of $n$ vertices. The vertices in the tree are numbered from $1$ to $n$, and the root is the vertex $1$. The value $a_i$ is written at the $i$-th vertex.\n\nYou can perform the following operation any number of times (possibly zero): choose a vertex $v$ which has at least one child; increase $a_v$ by $1$; and decrease $a_u$ by $1$ for all vertices $u$ that are in the subtree of $v$ (except $v$ itself). However, after each operation, the values on all vertices should be non-negative.\n\nYour task is to calculate the maximum possible value written at the root using the aforementioned operation.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nThe first line of each test case contains a single integer $n$ ($2 \\le n \\le 2 \\cdot 10^5$) — the number of vertices in the tree.\n\nThe second line contains $n$ integers $a_1, a_2, \\dots, a_n$ ($0 \\le a_i \\le 10^9$) — the initial values written at vertices.\n\nThe third line contains $n-1$ integers $p_2, p_3, \\dots, p_n$ ($1 \\le p_i \\le n$), where $p_i$ is the parent of the $i$-th vertex in the tree. Vertex $1$ is the root.\n\nAdditional constraint on the input: the sum of $n$ over all test cases doesn't exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, print a single integer — the maximum possible value written at the root using the aforementioned operation.\n\nExamples:\ninput:\n3\n4\n0 1 0 2\n1 1 3\n2\n3 0\n1\n5\n2 5 3 9 6\n3 1 5 2\noutput:\n1\n3\n6\n\nNote: In the first test case, the following sequence of operations is possible:\n\n * perform the operation on $v=3$, then the values on the vertices will be $[0, 1, 1, 1]$; * perform the operation on $v=1$, then the values on the vertices will be $[1, 0, 0, 0]$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1997D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: MEXimize the Score\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Suppose we partition the elements of an array $b$ into any number $k$ of non-empty multisets $S_1, S_2, \\ldots, S_k$, where $k$ is an arbitrary positive integer. Define the score of $b$ as the maximum value of $\\operatorname{MEX}(S_1)$$^{\\text{∗}}$$ + \\operatorname{MEX}(S_2) + \\ldots + \\operatorname{MEX}(S_k)$ over all possible partitions of $b$ for any integer $k$.\n\nEnvy is given an array $a$ of size $n$. Since he knows that calculating the score of $a$ is too easy for you, he instead asks you to calculate the sum of scores of all $2^n - 1$ non-empty subsequences of $a$.$^{\\text{†}}$ Since this answer may be large, please output it modulo $998\\,244\\,353$.\n\n$^{\\text{∗}}$$\\operatorname{MEX}$ of a collection of integers $c_1, c_2, \\ldots, c_k$ is defined as the smallest non-negative integer $x$ that does not occur in the collection $c$. For example, $\\operatorname{MEX}([0,1,2,2]) = 3$ and $\\operatorname{MEX}([1,2,2]) = 0$\n\n$^{\\text{†}}$A sequence $x$ is a subsequence of a sequence $y$ if $x$ can be obtained from $y$ by deleting several (possibly, zero or all) elements.\n\nInput: The first line contains an integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases.\n\nThe first line of each test case contains an integer $n$ ($1 \\leq n \\leq 2 \\cdot 10^5$) — the length of $a$.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($0 \\leq a_i < n$) — the elements of the array $a$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output the answer, modulo $998\\,244\\,353$.\n\nExamples:\ninput:\n4\n3\n0 0 1\n4\n0 0 1 1\n5\n0 0 1 2 2\n4\n1 1 1 1\noutput:\n11\n26\n53\n0\n\nNote: In the first testcase, we must consider seven subsequences:\n\n * $[0]$: The score is $1$. * $[0]$: The score is $1$. * $[1]$: The score is $0$. * $[0,0]$: The score is $2$. * $[0,1]$: The score is $2$. * $[0,1]$: The score is $2$. * $[0,0,1]$: The score is $3$. \n\nThe answer for the first testcase is $1+1+2+2+2+3=11$.\n\nIn the last testcase, all subsequences have a score of $0$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2030E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Variable Damage\ntime_limit_ms: 5000\nmemory_limit_mb: 512\nDescription: Monocarp is gathering an army to fight a dragon in a videogame.\n\nThe army consists of two parts: the heroes and the defensive artifacts. Each hero has one parameter — his health. Each defensive artifact also has one parameter — its durability.\n\nBefore the battle begins, Monocarp distributes artifacts to the heroes so that each hero receives at most one artifact.\n\nThe battle consists of rounds that proceed as follows:\n\n * first, the dragon deals damage equal to $\\frac{1}{a + b}$ (a real number without rounding) to each hero, where $a$ is the number of heroes alive and $b$ is the number of active artifacts; * after that, all heroes with health $0$ or less die; * finally, some artifacts are deactivated. An artifact with durability $x$ is deactivated when one of the following occurs: the hero holding the artifact either dies or receives $x$ total damage (from the start of the battle). If an artifact is not held by any hero, it is inactive from the beginning of the battle. \n\nThe battle ends when there are no heroes left alive.\n\nInitially, the army is empty. There are $q$ queries: add a hero with health $x$ or an artifact with durability $y$ to the army. After each query, determine the maximum number of rounds that Monocarp can survive if he distributes the artifacts optimally.\n\nInput: The first line contains one integer $q$ ($1 \\le q \\le 3 \\cdot 10^5$) — the number of queries.\n\nIn the $i$-th of the following $q$ lines, there are two integers $t_i$ and $v_i$ ($t_i \\in \\\\{1, 2\\\\}$; $1 \\le v_i \\le 10^9$) — the type of the query and the value of the query parameter. If the type is $1$, a hero with health $v_i$ is added. If the type is $2$, an artifact with durability $v_i$ is added.\n\nOutput: Print $q$ integers. After each query, output the maximum number of rounds that Monocarp can survive if he distributes the artifacts optimally.\n\nExamples:\ninput:\n3\n2 5\n1 4\n1 10\noutput:\n0\n8\n19\n\ninput:\n10\n1 9\n1 6\n2 4\n1 8\n1 3\n2 10\n1 3\n1 6\n1 10\n2 6\noutput:\n9\n15\n19\n27\n30\n39\n42\n48\n59\n65\n\nNote: Let's consider the first example.\n\n * An artifact with durability $5$ is added. Since there are no heroes yet, the battle ends immediately. * A hero with health $4$ is added. Monocarp can give him an artifact with durability $5$. First, there are rounds in which the hero takes $\\frac{1}{1 + 1} = \\frac{1}{2}$ damage. After $8$ such rounds, a total of $4$ damage will have been dealt, and the hero will die, while the artifact will deactivate. There are no more heroes alive, so the battle ends after $8$ rounds. * A hero with health $10$ is added. Now let the artifact with durability $5$ be with this hero. Then, in the first $12$ rounds, the heroes will take $12 \\cdot \\frac{1}{2 + 1} = 4$ damage, and the first hero will die. The second hero has $6$ health left, and the artifact has $1$ durability. Now the damage is $\\frac{1}{2}$, so after another $2$ rounds, the artifact will deactivate. The second hero has $5$ health left. After another $5$ rounds, the second hero will die. Therefore, the answer is $12 + 2 + 5 = 19$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2025G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Robin Hood in Town\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: In Sherwood, we judge a man not by his wealth, but by his merit.\n\nLook around, the rich are getting richer, and the poor are getting poorer. We need to take from the rich and give to the poor. We need Robin Hood!\n\nThere are $n$ people living in the town. Just now, the wealth of the $i$-th person was $a_i$ gold. But guess what? The richest person has found an extra pot of gold!\n\nMore formally, find an $a_j=max(a_1, a_2, \\dots, a_n)$, change $a_j$ to $a_j+x$, where $x$ is a non-negative integer number of gold found in the pot. If there are multiple maxima, it can be any one of them.\n\nA person is unhappy if their wealth is strictly less than half of the average wealth$^{\\text{∗}}$.\n\nIf strictly more than half of the total population $n$ are unhappy, Robin Hood will appear by popular demand.\n\nDetermine the minimum value of $x$ for Robin Hood to appear, or output $-1$ if it is impossible.\n\n$^{\\text{∗}}$The average wealth is defined as the total wealth divided by the total population $n$, that is, $\\frac{\\sum a_i}{n}$, the result is a real number.\n\nInput: The first line of input contains one integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nThe first line of each test case contains an integer $n$ ($1 \\le n \\le 2\\cdot10^5$) — the total population.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10^6$) — the wealth of each person.\n\nIt is guaranteed that the sum of $n$ across all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output one integer — the minimum number of gold that the richest person must find for Robin Hood to appear. If it is impossible, output $-1$ instead.\n\nExamples:\ninput:\n6\n1\n2\n2\n2 19\n3\n1 3 20\n4\n1 2 3 4\n5\n1 2 3 4 5\n6\n1 2 1 1 1 25\noutput:\n-1\n-1\n0\n15\n16\n0\n\nNote: In the first test case, it is impossible for a single person to be unhappy.\n\nIn the second test case, there is always $1$ happy person (the richest).\n\nIn the third test case, no additional gold are required, so the answer is $0$.\n\nIn the fourth test case, after adding $15$ gold, the average wealth becomes $\\frac{25}{4}$, and half of this average is $\\frac{25}{8}$, resulting in $3$ people being unhappy.\n\nIn the fifth test case, after adding $16$ gold, the average wealth becomes $\\frac{31}{5}$, resulting in $3$ people being unhappy.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2014C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Upload More RAM\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Oh no, the ForceCodes servers are running out of memory! Luckily, you can help them out by uploading some of your RAM!\n\nYou want to upload $n$ GBs of RAM. Every second, you will upload either $0$ or $1$ GB of RAM. However, there is a restriction on your network speed: in any $k$ consecutive seconds, you can upload only at most $1$ GB of RAM in total.\n\nFind the minimum number of seconds needed to upload $n$ GBs of RAM!\n\nInput: Each test contains multiple test cases. The first line of input contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases. The description of the test cases follows.\n\nThe first and only line of each test case contains two integers $n$ and $k$ ($1 \\le n, k \\le 100$) — the number of GBs that you want to upload and the length of the time window respectively.\n\nOutput: For each test case, output a single integer — the minimum number of seconds needed to upload $n$ GBs of RAM.\n\nExamples:\ninput:\n6\n5 1\n2 2\n2 3\n1 7\n11 5\n100 100\noutput:\n5\n3\n4\n1\n51\n9901\n\nNote: In the first test case, you can upload $1$ GB of RAM per second, so to upload $5$ GBs, you need $5$ seconds.\n\nIn the second test case, you can upload $1$ GB in the first second, $0$ GBs in the second second, and $1$ GB in the third second, which in total adds up to exactly $2$ GBs of uploaded RAM.\n\nIn the third test case, you can upload $1$ GB in the first second, $0$ GBs in the second second, $0$ GBs in the third second, and $1$ GB in the fourth second, which in total adds up to exactly $2$ GBs of uploaded RAM.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1987A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Beauty of the mountains\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Nikita loves mountains and has finally decided to visit the Berlyand mountain range! The range was so beautiful that Nikita decided to capture it on a map. The map is a table of $n$ rows and $m$ columns, with each cell containing a non-negative integer representing the height of the mountain.\n\nHe also noticed that mountains come in two types:\n\n * With snowy caps. * Without snowy caps. \n\nNikita is a very pragmatic person. He wants the sum of the heights of the mountains with snowy caps to be equal to the sum of the heights of the mountains without them. He has arranged with the mayor of Berlyand, Polikarp Polikarpovich, to allow him to transform the landscape.\n\nNikita can perform transformations on submatrices of size $k \\times k$ as follows: he can add an integer constant $c$ to the heights of the mountains within this area, but the type of the mountain remains unchanged. Nikita can choose the constant $c$ independently for each transformation. Note that $c$ can be negative.\n\nBefore making the transformations, Nikita asks you to find out if it is possible to achieve equality of the sums, or if it is impossible. It doesn't matter at what cost, even if the mountains turn into canyons and have negative heights.\n\nIf only one type of mountain is represented on the map, then the sum of the heights of the other type of mountain is considered to be zero.\n\nInput: Each test consists of several test cases. The first line contains an integer $t$ ($1 \\le t \\le 10^{4}$) — the number of test cases. This is followed by a description of test cases.\n\nThe first line of each test case contains three integers $n, m, k$ ($1 \\le n, m \\le 500, 1 \\le k \\le min(n, m)$).\n\nThe next $n$ lines of each test case contain $m$ integers $a_{i j}$ ($0 \\le a_{i j} \\le 10^{9}$) — the initial heights of the mountains.\n\nThe next $n$ binary strings of length $m$ for each test case determine the type of mountain, '$0$' — with snowy caps, '$1$' — without them.\n\nIt is guaranteed that the sum of $n \\cdot m$ for all test cases does not exceed $250\\,000$.\n\nOutput: For each test case, output \"YES\" without quotes if it is possible to equalize the sums of the mountain heights, otherwise output \"NO\" without quotes. You can output each letter in any case (for example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will be recognized as a positive answer).\n\nExamples:\ninput:\n8\n3 3 2\n7 11 3\n4 2 3\n0 1 15\n100\n010\n000\n4 4 3\n123 413 24 233\n123 42 0 216\n22 1 1 53\n427 763 22 6\n0101\n1111\n1010\n0101\n3 3 2\n2 1 1\n1 1 2\n1 5 4\n010\n101\n010\n3 3 2\n2 1 1\n1 1 2\n1 5 3\n010\n101\n010\n3 4 3\n46 49 50 1\n19 30 23 12\n30 25 1 46\n1000\n0100\n0010\n5 4 4\n39 30 0 17\n22 42 30 13\n10 44 46 35\n12 19 9 39\n21 0 45 40\n1000\n1111\n0011\n0111\n1100\n2 2 2\n3 4\n6 7\n00\n00\n2 2 2\n0 0\n2 0\n01\n00\noutput:\nYES\nNO\nYES\nNO\nYES\nNO\nYES\nYES\n\nNote: The mountain array from the first test case looks like this:\n\n\n\nInitially, the sum of the heights of the mountains with snowy caps is $11 + 3 + 4 + 3 + 0 + 1 + 15 = 37$, and without them is $7 + 2 = 9$.\n\nTo equalize these sums, we can perform two transformations:\n\nFirst transformation:\n\n\n\nNote that the constant $c$ can be negative.\n\nAfter the first transformation, the mountain array looks like this:\n\n\n\nSecond transformation:\n\n\n\nAs a result, the mountain array looks like this:\n\n\n\nThe sum of the heights of the mountains with snowy caps is $17 + 9 + 9 - 16 - 20 - 19 + 15 = -5$, and without them is $7 - 12 = -5$, thus the answer is YES.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1982D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Reverse Card (Easy Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: The two versions are different problems. You may want to read both versions. You can make hacks only if both versions are solved.\n\nYou are given two positive integers $n$, $m$.\n\nCalculate the number of ordered pairs $(a, b)$ satisfying the following conditions:\n\n * $1\\le a\\le n$, $1\\le b\\le m$; * $a+b$ is a multiple of $b \\cdot \\gcd(a,b)$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1\\le t\\le 10^4$). The description of the test cases follows.\n\nThe first line of each test case contains two integers $n$, $m$ ($1\\le n,m\\le 2 \\cdot 10^6$).\n\nIt is guaranteed that neither the sum of $n$ nor the sum of $m$ over all test cases exceeds $2 \\cdot 10^6$.\n\nOutput: For each test case, print a single integer: the number of valid pairs.\n\nExamples:\ninput:\n6\n1 1\n2 3\n3 5\n10 8\n100 1233\n1000000 1145141\noutput:\n1\n3\n4\n14\n153\n1643498\n\nNote: In the first test case, only $(1,1)$ satisfies the conditions.\n\nIn the fourth test case, $(1,1),(2,1),(2,2),(3,1),(4,1),(5,1),(6,1),(6,2),(6,3),(7,1),(8,1),(9,1),(10,1),(10,2)$ satisfy the conditions.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1972D1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Wonderful Tree!\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: God's Blessing on This ArrayForces!\n\nA Random Pebble\n\nYou are given a tree with $n$ vertices, rooted at vertex $1$. The $i$-th vertex has an integer $a_i$ written on it.\n\nLet $L$ be the set of all direct children$^{\\text{∗}}$ of $v$. A tree is called wonderful, if for all vertices $v$ where $L$ is not empty, $$a_v \\le \\sum_{u \\in L}{a_u}.$$ In one operation, you choose any vertex $v$ and increase $a_v$ by $1$.\n\nFind the minimum number of operations needed to make the given tree wonderful!\n\n$^{\\text{∗}}$ Vertex $u$ is called a direct child of vertex $v$ if:\n\n * $u$ and $v$ are connected by an edge, and * $v$ is on the (unique) path from $u$ to the root of the tree.\n\nInput: Each test contains multiple test cases. The first line of input contains a single integer $t$ ($1 \\le t \\le 1000$) — the number of test cases. The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($2 \\le n \\le 5000$) — the number of vertices in the tree.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($0 \\le a_i \\le 10^9$) — the values initially written on the vertices.\n\nThe third line of each test case contains $n - 1$ integers $p_2, p_3 , \\ldots, p_n$ ($1 \\le p_i < i$), indicating that there is an edge from vertex $p_i$ to vertex $i$. It is guaranteed that the given edges form a tree.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $5000$.\n\nOutput: For each test case, output a single integer — the minimum number of operations needed to make the tree wonderful.\n\nExamples:\ninput:\n4\n5\n9 3 4 1 2\n1 1 3 3\n2\n5 3\n1\n2\n36 54\n1\n3\n0 0 0\n1 2\noutput:\n3\n2\n0\n0\n\nNote: The tree in the first test case:\n\n\n\nYou can apply the operation once on vertex $5$ and twice on vertex $2$ to get a wonderful tree.\n\nIn the second test case, you can apply the operation twice on vertex $2$ to get a wonderful tree.\n\nIn the third and fourth test cases, the tree is already wonderful, so you don't need to apply any operations.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1987E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Expected Median\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: Arul has a binary array$^{\\text{∗}}$ $a$ of length $n$.\n\nHe will take all subsequences$^{\\text{†}}$ of length $k$ ($k$ is odd) of this array and find their median.$^{\\text{‡}}$\n\nWhat is the sum of all these values?\n\nAs this sum can be very large, output it modulo $10^9 + 7$. In other words, print the remainder of this sum when divided by $10^9 + 7$.\n\n$^{\\text{∗}}$A binary array is an array consisting only of zeros and ones.\n\n$^{\\text{†}}$An array $b$ is a subsequence of an array $a$ if $b$ can be obtained from $a$ by the deletion of several (possibly, zero or all) elements. Subsequences don't have to be contiguous.\n\n$^{\\text{‡}}$The median of an array of odd length $k$ is the $\\frac{k+1}{2}$-th element when sorted.\n\nInput: The first line contains a single integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases.\n\nThe first line of each test case contains two integers $n$ and $k$ ($1 \\leq k \\leq n \\leq 2 \\cdot 10^5$, $k$ is odd) — the length of the array and the length of the subsequence, respectively.\n\nThe second line of each test case contains $n$ integers $a_i$ ($0 \\leq a_i \\leq 1$) — the elements of the array.\n\nIt is guaranteed that sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, print the sum modulo $10^9 + 7$.\n\nExamples:\ninput:\n8\n4 3\n1 0 0 1\n5 1\n1 1 1 1 1\n5 5\n0 1 0 1 0\n6 3\n1 0 1 0 1 1\n4 3\n1 0 1 1\n5 3\n1 0 1 1 0\n2 1\n0 0\n34 17\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\noutput:\n2\n5\n0\n16\n4\n7\n0\n333606206\n\nNote: In the first test case, there are four subsequences of $[1,0,0,1]$ with length $k=3$:\n\n * $[1,0,0]$: median $= 0$. * $[1,0,1]$: median $= 1$. * $[1,0,1]$: median $= 1$. * $[0,0,1]$: median $= 0$. \n\nThe sum of the results is $0+1+1+0=2$.\n\nIn the second test case, all subsequences of length $1$ have median $1$, so the answer is $5$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1999F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Maximize the Largest Component (Easy Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Easy and hard versions are actually different problems, so read statements of both problems completely and carefully. The only difference between the two versions is the operation.\n\nAlex has a grid with $n$ rows and $m$ columns consisting of '.' and '#' characters. A set of '#' cells forms a connected component if from any cell in this set, it is possible to reach any other cell in this set by only moving to another cell in the set that shares a common side. The size of a connected component is the number of cells in the set.\n\nIn one operation, Alex selects any row $r$ ($1 \\le r \\le n$) or any column $c$ ($1 \\le c \\le m$), then sets every cell in row $r$ or column $c$ to be '#'. Help Alex find the maximum possible size of the largest connected component of '#' cells that he can achieve after performing the operation at most once.\n\nInput: The first line of the input contains a single integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases.\n\nThe first line of each test case contains two integers $n$ and $m$ ($1 \\le n \\cdot m \\le 10^6$) — the number of rows and columns of the grid.\n\nThe next $n$ lines each contain $m$ characters. Each character is either '.' or '#'.\n\nIt is guaranteed that the sum of $n \\cdot m$ over all test cases does not exceed $10^6$.\n\nOutput: For each test case, output a single integer — the maximum possible size of a connected component of '#' cells that Alex can achieve.\n\nExamples:\ninput:\n6\n1 1\n.\n4 2\n..\n#.\n#.\n.#\n3 5\n.#.#.\n..#..\n.#.#.\n5 5\n#...#\n....#\n#...#\n.....\n...##\n6 6\n.#..#.\n#..#..\n.#...#\n#.#.#.\n.#.##.\n###..#\n6 8\n..#....#\n.####.#.\n###.#..#\n.##.#.##\n.#.##.##\n#..##.#.\noutput:\n1\n6\n9\n11\n15\n30\n\nNote: In the second test case, it is optimal for Alex to set all cells in column $2$ to be '#'. Doing so will lead to the largest connected component of '#' having a size of $6$.\n\nIn the third test case, it is optimal for Alex to set all cells in row $2$ to be '#'. Doing so will lead to the largest connected component of '#' having a size of $9$.\n\nIn the fourth test case, it is optimal for Alex to set all cells in row $4$ to be '#'. Doing so will lead to the largest connected component of '#' having a size of $11$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1985H1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Decode\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: In a desperate attempt to obtain your waifu favorite character, you have hacked into the source code of the game. After days of struggling, you finally find the binary string that encodes the gacha system of the game. In order to decode it, you must first solve the following problem.\n\nYou are given a binary string $s$ of length $n$. For each pair of integers $(l, r)$ $(1 \\leq l \\leq r \\leq n)$, count the number of pairs $(x, y)$ $(l \\leq x \\leq y \\leq r)$ such that the amount of $\\mathtt{0}$ equals the amount of $\\mathtt{1}$ in the substring $s_xs_{x+1}...s_y$.\n\nOutput the sum of counts over all possible $(l, r)$ modulo $10^9+7$.\n\nInput: The first line contains $t$ ($1 \\leq t \\leq 1000$) — the number of test cases.\n\nEach test case contains a binary string $s$ ($1 \\leq |s| \\leq 2 \\cdot 10^5$). It is guaranteed $s$ only contains characters $\\mathtt{0}$ and $\\mathtt{1}$.\n\nIt is guaranteed the sum of $|s|$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output an integer, the answer modulo $10^9+7$.\n\nExamples:\ninput:\n4\n0000\n01010101\n1100111001\n11000000111\noutput:\n0\n130\n147\n70\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1996E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Make All Equal\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are given a cyclic array $a_1, a_2, \\ldots, a_n$.\n\nYou can perform the following operation on $a$ at most $n - 1$ times:\n\n * Let $m$ be the current size of $a$, you can choose any two adjacent elements where the previous one is no greater than the latter one (In particular, $a_m$ and $a_1$ are adjacent and $a_m$ is the previous one), and delete exactly one of them. In other words, choose an integer $i$ ($1 \\leq i \\leq m$) where $a_i \\leq a_{(i \\bmod m) + 1}$ holds, and delete exactly one of $a_i$ or $a_{(i \\bmod m) + 1}$ from $a$. \n\nYour goal is to find the minimum number of operations needed to make all elements in $a$ equal.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 500$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 100$) — the length of the array $a$.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le n$) — the elements of array $a$.\n\nOutput: For each test case, output a single line containing an integer: the minimum number of operations needed to make all elements in $a$ equal.\n\nExamples:\ninput:\n7\n1\n1\n3\n1 2 3\n3\n1 2 2\n5\n5 4 3 2 1\n6\n1 1 2 2 3 3\n8\n8 7 6 3 8 7 6 3\n6\n1 1 4 5 1 4\noutput:\n0\n2\n1\n4\n4\n6\n3\n\nNote: In the first test case, there is only one element in $a$, so we can't do any operation.\n\nIn the second test case, we can perform the following operations to make all elements in $a$ equal:\n\n * choose $i = 2$, delete $a_3$, then $a$ would become $[1, 2]$. * choose $i = 1$, delete $a_1$, then $a$ would become $[2]$. \n\nIt can be proven that we can't make all elements in $a$ equal using fewer than $2$ operations, so the answer is $2$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2001A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Bus to Pénjamo\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Ya vamos llegando a Péeeenjamoo ♫♫♫\n\nThere are $n$ families travelling to Pénjamo to witness Mexico's largest- ever \"walking a chicken on a leash\" marathon. The $i$-th family has $a_i$ family members. All families will travel using a single bus consisting of $r$ rows with $2$ seats each.\n\nA person is considered happy if:\n\n * Another family member is seated in the same row as them, or * They are sitting alone in their row (with an empty seat next to them). \n\nDetermine the maximum number of happy people in an optimal seating arrangement. Note that everyone must be seated in the bus.\n\nIt is guaranteed that all family members will fit on the bus. Formally, it is guaranteed that $\\displaystyle\\sum_{i=1}^{n}a_i \\le 2r$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 1000$). The description of the test cases follows.\n\nThe first line of each test case contains two integers $n$ and $r$ ($1 \\le n \\le 100$; $1 \\le r \\le 500$) — the number of families and the number of rows in the bus.\n\nThe second line contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10$) — the number of family members in each family.\n\nOutput: For each test case, output the maximum number of happy people in an optimal seating arrangement.\n\nExamples:\ninput:\n4\n3 3\n2 3 1\n3 3\n2 2 2\n4 5\n1 1 2 2\n4 5\n3 1 1 3\noutput:\n4\n6\n6\n6\n\nNote: In the first test case, the two members of the first family can sit together in the first row, while the two members of the second family can sit together in the second row. The remaining member of the second family can sit in the third row along with a member of the third family. This seating arrangement is shown below, where the $4$ happy people are colored green.\n\n$\\color{green}{1}$| $\\color{green}{1}$ ---|--- $\\color{green}{2}$| $\\color{green}{2}$ $2$| $3$ In the second test case, a possible seating arrangement with $6$ happy people is shown below.\n\n$\\color{green}{3}$| $\\color{green}{3}$ ---|--- $\\color{green}{1}$| $\\color{green}{1}$ $\\color{green}{2}$| $\\color{green}{2}$ In the third test case, a possible seating arrangement with $6$ happy people is shown below.\n\n$\\color{green}{4}$| $\\color{green}{4}$ ---|--- $\\color{green}{}$| $\\color{green}{2}$ $\\color{green}{3}$| $\\color{green}{3}$ $\\color{green}{1}$| $\\color{green}{}$ $\\color{green}{}$| $\\color{green}{}$\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2022A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Dora's Set\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Dora has a set $s$ containing integers. In the beginning, she will put all integers in $[l, r]$ into the set $s$. That is, an integer $x$ is initially contained in the set if and only if $l \\leq x \\leq r$. Then she allows you to perform the following operations:\n\n * Select three distinct integers $a$, $b$, and $c$ from the set $s$, such that $\\gcd(a, b) = \\gcd(b, c) = \\gcd(a, c) = 1^\\dagger$. * Then, remove these three integers from the set $s$. \n\nWhat is the maximum number of operations you can perform?\n\n$^\\dagger$Recall that $\\gcd(x, y)$ means the [greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor) of integers $x$ and $y$.\n\nInput: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \\leq t \\leq 500$) — the number of test cases. The description of the test cases follows.\n\nThe only line of each test case contains two integers $l$ and $r$ ($1 \\leq l \\leq r \\leq 1000$) — the range of integers in the initial set.\n\nOutput: For each test case, output a single integer — the maximum number of operations you can perform.\n\nExamples:\ninput:\n8\n1 3\n3 7\n10 21\n2 8\n51 60\n2 15\n10 26\n1 1000\noutput:\n1\n1\n3\n1\n2\n3\n4\n250\n\nNote: In the first test case, you can choose $a = 1$, $b = 2$, $c = 3$ in the only operation, since $\\gcd(1, 2) = \\gcd(2, 3) = \\gcd(1, 3) = 1$, and then there are no more integers in the set, so no more operations can be performed.\n\nIn the second test case, you can choose $a = 3$, $b = 5$, $c = 7$ in the only operation.\n\nIn the third test case, you can choose $a = 11$, $b = 19$, $c = 20$ in the first operation, $a = 13$, $b = 14$, $c = 15$ in the second operation, and $a = 10$, $b = 17$, $c = 21$ in the third operation. After the three operations, the set $s$ contains the following integers: $12$, $16$, $18$. It can be proven that it's impossible to perform more than $3$ operations.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2007A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Interesting Problem (Easy Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the easy version of the problem. The only difference between the two versions is the constraint on $n$. You can make hacks only if both versions of the problem are solved.\n\nYou are given an array of integers $a$ of length $n$.\n\nIn one operation, you will perform the following two-step process:\n\n 1. Choose an index $i$ such that $1 \\le i < |a|$ and $a_i = i$. 2. Remove $a_i$ and $a_{i+1}$ from the array and concatenate the remaining parts. \n\nFind the maximum number of times that you can perform the operation above.\n\nInput: Each test contains multiple test cases. The first line of input contains a single integer $t$ ($1 \\le t \\le 100$) — the number of test cases. The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 100$) — the length of the array $a$.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le n$) — the elements of the array $a$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $100$.\n\nOutput: For each test case, output a single integer — the maximum number of times that you can perform the operation.\n\nExamples:\ninput:\n6\n5\n1 5 3 2 4\n8\n2 1 3 4 5 6 7 8\n3\n1 2 3\n4\n1 2 4 4\n5\n4 4 1 3 5\n1\n1\noutput:\n2\n3\n1\n2\n0\n0\n\nNote: In the first test case, one possible optimal sequence of operations is $[ 1, 5, \\color{red}{3}, \\color{red}{2}, 4 ] \\rightarrow [\\color{red}{1}, \\color{red}{5}, 4] \\rightarrow [4]$.\n\nIn the third test case, one possible optimal sequence of operations is $[1, \\color{red}{2}, \\color{red}{3}] \\rightarrow [1]$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1987F1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Yasya and the Mysterious Tree\ntime_limit_ms: 2500\nmemory_limit_mb: 512\nDescription: Yasya was walking in the forest and accidentally found a tree with $n$ vertices. A tree is a connected undirected graph with no cycles.\n\nNext to the tree, the girl found an ancient manuscript with $m$ queries written on it. The queries can be of two types.\n\nThe first type of query is described by the integer $y$. The weight of each edge in the tree is replaced by the [bitwise exclusive OR](http://tiny.cc/xor_wiki_eng) of the weight of that edge and the integer $y$.\n\nThe second type is described by the vertex $v$ and the integer $x$. Yasya chooses a vertex $u$ ($1 \\le u \\le n$, $u \\neq v$) and mentally draws a bidirectional edge of weight $x$ from $v$ to $u$ in the tree.\n\nThen Yasya finds a simple cycle in the resulting graph and calculates the [bitwise exclusive OR](http://tiny.cc/xor_wiki_eng) of all the edges in it. She wants to choose a vertex $u$ such that the calculated value is maximum. This calculated value will be the answer to the query. It can be shown that such a cycle exists and is unique under the given constraints (independent of the choice of $u$). If an edge between $v$ and $u$ already existed, a simple cycle is the path $v \\to u \\to v$.\n\nNote that the second type of query is performed mentally, meaning the tree does not change in any way after it.\n\nHelp Yasya answer all the queries.\n\nInput: The first line contains an integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nThe descriptions of the test cases follow.\n\nThe first line of each test case contains two integers $n$, $m$ ($2 \\le n \\le 2 \\cdot 10^5$, $1 \\le m \\le 2 \\cdot 10^5$) — the number of vertices in the tree and the number of queries.\n\nThe next $n - 1$ lines of each test case contain three integers $v$, $u$, $w$ ($1 \\le v, u \\le n$, $1 \\le w \\le 10^9$) — the ends of some edge in the tree and its weight.\n\nIt is guaranteed that the given set of edges forms a tree.\n\nThe next $m$ lines of each test case describe the queries:\n\n * ^ $y$ ($1 \\le y \\le 10^9$) — parameter of the first type query; * ? $v$ $x$ ($1 \\le v \\le n$, $1 \\le x \\le 10^9$) — parameters of the second type query. \n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$. The same is guaranteed for $m$.\n\nOutput: For each test case, output the answers to the queries of the second type.\n\nExamples:\ninput:\n2\n3 7\n1 2 1\n3 1 8\n^ 5\n? 2 9\n^ 1\n? 1 10\n^ 6\n? 3 1\n? 2 9\n5 6\n1 2 777\n3 2 2812\n4 1 16\n5 3 1000000000\n^ 4\n? 3 123\n? 5 1000000000\n^ 1000000000\n? 1 908070\n? 2 1\noutput:\n13 15 11 10 \n1000000127 2812 999756331 999999756\n\ninput:\n3\n8 4\n8 6 3\n6 3 4\n2 5 4\n7 6 2\n7 1 10\n4 1 4\n5 1 2\n^ 4\n^ 7\n? 7 8\n? 4 10\n5 6\n3 1 4\n2 3 9\n4 3 6\n5 2 10\n? 5 7\n^ 1\n^ 8\n? 4 10\n? 1 9\n? 3 6\n4 2\n2 1 4\n4 3 5\n2 3 4\n^ 13\n? 1 10\noutput:\n14 13 \n13 8 11 11 \n10\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1980G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Set\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Define the binary encoding of a finite set of natural numbers $T \\subseteq \\\\{0,1,2,\\ldots\\\\}$ as $f(T) = \\sum\\limits_{i \\in T} 2^i$. For example, $f(\\\\{0,2\\\\}) = 2^0 + 2^2 = 5$ and $f(\\\\{\\\\}) = 0$. Notice that $f$ is a bijection from all such sets to all non-negative integers. As such, $f^{-1}$ is also defined.\n\nYou are given an integer $n$ along with $2^n-1$ sets $V_1,V_2,\\ldots,V_{2^n-1}$.\n\nFind all sets $S$ that satisfy the following constraint:\n\n * $S \\subseteq \\\\{0,1,\\ldots,n-1\\\\}$. Note that $S$ can be empty. * For all non-empty subsets $T \\subseteq \\\\{0,1,\\ldots,n-1\\\\}$, $|S \\cap T| \\in V_{f(T)}$. \n\nDue to the large input and output, both input and output will be given in terms of binary encodings of the sets.\n\nInput: The first line of input contains a single integer $n$ ($1 \\leq n \\leq 20$).\n\nThe second line of input contains $2^n-1$ integers $v_1,v_2,\\ldots,v_{2^n-1}$ ($0 \\leq v_i < 2^{n+1}$) — the sets $V_i$ given in their binary encoding where $V_i = f^{-1}(v_i)$.\n\nOutput: The first line of output should contain an integer $k$ indicating the number of possible $S$.\n\nIn the following $k$ lines, you should output $f(S)$ for all possible $S$ in increasing order.\n\nExamples:\ninput:\n3\n15 15 15 15 15 15 12\noutput:\n4\n3\n5\n6\n7\n\ninput:\n5\n63 63 63 63 6 63 63 63 63 63 63 5 63 63 63 63 63 63 8 63 63 63 63 2 63 63 63 63 63 63 63\noutput:\n1\n19\n\nNote: In the first test case, one possible $S$ is $f^{-1}(3) = \\\\{0,1\\\\}$. All the non-empty subsets $T \\subseteq \\\\{0,1,2\\\\}$ and the corresponding $|S \\cap T|$, $f(T)$ and $V_f(T)$ are as follows:\n\n$T$| $|S\\cap T|$| $f(T)$| $V_{f(T)}$ ---|---|---|--- $\\\\{0\\\\}$| $1$| $1$| $\\\\{0,1,2,3\\\\}$ $\\\\{1\\\\}$| $1$| $2$| $\\\\{0,1,2,3\\\\}$ $\\\\{2\\\\}$| $0$| $4$| $\\\\{0,1,2,3\\\\}$ $\\\\{0,1\\\\}$| $2$| $3$| $\\\\{0,1,2,3\\\\}$ $\\\\{0,2\\\\}$| $1$| $5$| $\\\\{0,1,2,3\\\\}$ $\\\\{1,2\\\\}$| $1$| $6$| $\\\\{0,1,2,3\\\\}$ $\\\\{0,1,2\\\\}$| $2$| $7$| $\\\\{2,3\\\\}$\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1975F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Symmetric Encoding\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Polycarp has a string $s$, which consists of lowercase Latin letters. He encodes this string using the following algorithm:\n\n * first, he constructs a new auxiliary string $r$, which consists of all distinct letters of the string $s$, written in alphabetical order; * then the encoding happens as follows: each character in the string $s$ is replaced by its symmetric character from the string $r$ (the first character of the string $r$ will be replaced by the last, the second by the second from the end, and so on). \n\nFor example, encoding the string $s$=\"codeforces\" happens as follows:\n\n * the string $r$ is obtained as \"cdefors\"; * the first character $s_1$='c' is replaced by 's'; * the second character $s_2$='o' is replaced by 'e'; * the third character $s_3$='d' is replaced by 'r'; * ... * the last character $s_{10}$='s' is replaced by 'c'. \n\n The string $r$ and replacements for $s$=\"codeforces\".\n\nThus, the result of encoding the string $s$=\"codeforces\" is the string \"serofedsoc\".\n\nWrite a program that performs decoding — that is, restores the original string $s$ from the encoding result.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 2 \\cdot 10^5$) — the length of the string $b$.\n\nThe second line of each test case contains a string $b$ of length $n$, consisting of lowercase Latin letters — the result of encoding the original string $s$.\n\nIt is guaranteed that the sum of the values of $n$ over all test cases in the test does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output the string $s$ from which the encoding result $b$ was obtained.\n\nExamples:\ninput:\n5\n10\nserofedsoc\n3\nttf\n9\ntlrhgmaoi\n1\nw\n15\nhnndledmnhlttin\noutput:\ncodeforces\nfft\nalgorithm\nw\nmeetinthemiddle\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1974B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: I Love 1543\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: One morning, Polycarp woke up and realized that $1543$ is the most favorite number in his life.\n\nThe first thing that Polycarp saw that day as soon as he opened his eyes was a large wall carpet of size $n$ by $m$ cells; $n$ and $m$ are even integers. Each cell contains one of the digits from $0$ to $9$.\n\nPolycarp became curious about how many times the number $1543$ would appear in all layers$^{\\text{∗}}$ of the carpet when traversed clockwise.\n\n$^{\\text{∗}}$The first layer of a carpet of size $n \\times m$ is defined as a closed strip of length $2 \\cdot (n+m-2)$ and thickness of $1$ element, surrounding its outer part. Each subsequent layer is defined as the first layer of the carpet obtained by removing all previous layers from the original carpet.\n\nInput: The first line of the input contains a single integer $t$ ($1 \\leq t \\leq 100$) — the number of test cases. The following lines describe the test cases.\n\nThe first line of each test case contains a pair of numbers $n$ and $m$ ($2 \\leq n, m \\leq 10^3$, $n, m$ — even integers).\n\nThis is followed by $n$ lines of length $m$, consisting of digits from $0$ to $9$ — the description of the carpet.\n\nIt is guaranteed that the sum of $n \\cdot m$ across all test cases does not exceed $10^6$.\n\nOutput: For each test case, output a single number — the total number of times $1543$ appears in all layers of the carpet in the order of traversal clockwise.\n\nExamples:\ninput:\n8\n2 4\n1543\n7777\n2 4\n7154\n8903\n2 4\n3451\n8888\n2 2\n54\n13\n2 2\n51\n43\n2 6\n432015\n512034\n4 4\n5431\n1435\n5518\n7634\n6 4\n5432\n1152\n4542\n2432\n2302\n5942\noutput:\n1\n1\n0\n1\n0\n2\n2\n2\n\nNote:  Occurrences of $1543$ in the seventh example. Different layers are colored in different colors.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2036D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Iris's Full Binary Tree\ntime_limit_ms: 4000\nmemory_limit_mb: 1024\nDescription: Iris likes full binary trees.\n\nLet's define the depth of a rooted tree as the maximum number of vertices on the simple paths from some vertex to the root. A full binary tree of depth $d$ is a binary tree of depth $d$ with exactly $2^d - 1$ vertices.\n\nIris calls a tree a $d$-binary tree if some vertices and edges can be added to it to make it a full binary tree of depth $d$. Note that any vertex can be chosen as the root of a full binary tree.\n\nSince performing operations on large trees is difficult, she defines the binary depth of a tree as the minimum $d$ satisfying that the tree is $d$-binary. Specifically, if there is no integer $d \\ge 1$ such that the tree is $d$-binary, the binary depth of the tree is $-1$.\n\nIris now has a tree consisting of only vertex $1$. She wants to add $n - 1$ more vertices to form a larger tree. She will add the vertices one by one. When she adds vertex $i$ ($2 \\leq i \\leq n$), she'll give you an integer $p_i$ ($1 \\leq p_i < i$), and add a new edge connecting vertices $i$ and $p_i$.\n\nIris wants to ask you the binary depth of the tree formed by the first $i$ vertices for each $1 \\le i \\le n$. Can you tell her the answer?\n\nInput: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases. The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($2 \\leq n \\leq 5 \\cdot 10^5$) — the final size of the tree.\n\nThe second line of each test case contains $n - 1$ integers $p_2, p_3, \\ldots, p_n$ ($1 \\leq p_i < i$) — descriptions of all edges of the tree.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $5 \\cdot 10^5$.\n\nOutput: For each test case output $n$ integers, $i$-th of them representing the binary depth of the tree formed by the first $i$ vertices.\n\nExamples:\ninput:\n7\n3\n1 1\n6\n1 2 3 4 5\n7\n1 1 3 2 5 1\n10\n1 1 2 1 4 2 4 5 8\n10\n1 1 3 1 3 2 2 2 6\n20\n1 1 2 2 4 4 5 5 7 6 8 6 11 14 11 8 13 13 12\n25\n1 1 3 3 1 5 4 4 6 8 11 12 8 7 11 13 7 13 15 6 19 14 10 23\noutput:\n1 2 2 \n1 2 2 3 3 4 \n1 2 2 3 3 4 4 \n1 2 2 3 3 3 4 4 5 5 \n1 2 2 3 3 4 4 4 -1 -1 \n1 2 2 3 3 4 4 4 4 5 5 5 5 6 6 6 6 6 6 7 \n1 2 2 3 3 4 4 4 4 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8\n\nNote: In the first test case, the final tree is shown below:\n\n\n\n * The tree consisting of the vertex $1$ has the binary depth $1$ (the tree itself is a full binary tree of depth $1$). * The tree consisting of the vertices $1$ and $2$ has the binary depth $2$ (we can add the vertex $3$ to make it a full binary tree of depth $2$). * The tree consisting of the vertices $1$, $2$ and $3$ has the binary depth $2$ (the tree itself is a full binary tree of depth $2$).\n\nIn the second test case, the formed full binary tree after adding some vertices to the tree consisting of $n$ vertices is shown below (bolded vertices are added):\n\n\n\nThe depth of the formed full binary tree is $4$.\n\nIn the fifth test case, the final tree is shown below:\n\n\n\nIt can be proved that Iris can't form any full binary tree by adding vertices and edges, so the binary depth is $-1$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2006E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Split the Multiset\ntime_limit_ms: 1000\nmemory_limit_mb: 512\nDescription: A multiset is a set of numbers in which there can be equal elements, and the order of the numbers does not matter. For example, $\\\\{2,2,4\\\\}$ is a multiset.\n\nYou have a multiset $S$. Initially, the multiset contains only one positive integer $n$. That is, $S=\\\\{n\\\\}$. Additionally, there is a given positive integer $k$.\n\nIn one operation, you can select any positive integer $u$ in $S$ and remove one copy of $u$ from $S$. Then, insert no more than $k$ positive integers into $S$ so that the sum of all inserted integers is equal to $u$.\n\nFind the minimum number of operations to make $S$ contain $n$ ones.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 1000$). Description of the test cases follows.\n\nThe only line of each testcase contains two integers $n,k$ ($1\\le n\\le 1000,2\\le k\\le 1000$).\n\nOutput: For each testcase, print one integer, which is the required answer.\n\nExamples:\ninput:\n4\n1 5\n5 2\n6 3\n16 4\noutput:\n0\n4\n3\n5\n\nNote: For the first test case, initially $S=\\\\{1\\\\}$, already satisfying the requirement. Therefore, we need zero operations.\n\nFor the second test case, initially $S=\\\\{5\\\\}$. We can apply the following operations:\n\n * Select $u=5$, remove $u$ from $S$, and insert $2,3$ into $S$. Now, $S=\\\\{2,3\\\\}$. * Select $u=2$, remove $u$ from $S$, and insert $1,1$ into $S$. Now, $S=\\\\{1,1,3\\\\}$. * Select $u=3$, remove $u$ from $S$, and insert $1,2$ into $S$. Now, $S=\\\\{1,1,1,2\\\\}$. * Select $u=2$, remove $u$ from $S$, and insert $1,1$ into $S$. Now, $S=\\\\{1,1,1,1,1\\\\}$. \n\nUsing $4$ operations in total, we achieve the goal.\n\nFor the third test case, initially $S=\\\\{6\\\\}$. We can apply the following operations:\n\n * Select $u=6$, remove $u$ from $S$, and insert $1,2,3$ into $S$. Now, $S=\\\\{1,2,3\\\\}$. * Select $u=2$, remove $u$ from $S$, and insert $1,1$ into $S$. Now, $S=\\\\{1,1,1,3\\\\}$. * Select $u=3$, remove $u$ from $S$, and insert $1,1,1$ into $S$. Now, $S=\\\\{1,1,1,1,1,1\\\\}$. \n\nUsing $3$ operations in total, we achieve the goal.\n\nFor the fourth test case, initially $S=\\\\{16\\\\}$. We can apply the following operations:\n\n * Select $u=16$, remove $u$ from $S$, and insert $4,4,4,4$ into $S$. Now, $S=\\\\{4,4,4,4\\\\}$. * Repeat for $4$ times: select $u=4$, remove $u$ from $S$, and insert $1,1,1,1$ into $S$. \n\nUsing $5$ operations in total, we achieve the goal.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1988A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Brightness Begins\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Imagine you have $n$ light bulbs numbered $1, 2, \\ldots, n$. Initially, all bulbs are on. To flip the state of a bulb means to turn it off if it used to be on, and to turn it on otherwise.\n\nNext, you do the following:\n\n * for each $i = 1, 2, \\ldots, n$, flip the state of all bulbs $j$ such that $j$ is divisible by $i^\\dagger$. \n\nAfter performing all operations, there will be several bulbs that are still on. Your goal is to make this number exactly $k$.\n\nFind the smallest suitable $n$ such that after performing the operations there will be exactly $k$ bulbs on. We can show that an answer always exists.\n\n$^\\dagger$ An integer $x$ is divisible by $y$ if there exists an integer $z$ such that $x = y\\cdot z$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^4$). The description of the test cases follows.\n\nThe only line of each test case contains a single integer $k$ ($1 \\le k \\le 10^{18}$).\n\nOutput: For each test case, output $n$ — the minimum number of bulbs.\n\nExamples:\ninput:\n3\n1\n3\n8\noutput:\n2\n5\n11\n\nNote: In the first test case, the minimum number of bulbs is $2$. Let's denote the state of all bulbs with an array, where $1$ corresponds to a turned on bulb, and $0$ corresponds to a turned off bulb. Initially, the array is $[1, 1]$.\n\n * After performing the operation with $i = 1$, the array becomes $[\\underline{0}, \\underline{0}]$. * After performing the operation with $i = 2$, the array becomes $[0, \\underline{1}]$. \n\nIn the end, there are $k = 1$ bulbs on. We can also show that the answer cannot be less than $2$.\n\nIn the second test case, the minimum number of bulbs is $5$. Initially, the array is $[1, 1, 1, 1, 1]$.\n\n * After performing the operation with $i = 1$, the array becomes $[\\underline{0}, \\underline{0}, \\underline{0}, \\underline{0}, \\underline{0}]$. * After performing the operation with $i = 2$, the array becomes $[0, \\underline{1}, 0, \\underline{1}, 0]$. * After performing the operation with $i = 3$, the array becomes $[0, 1, \\underline{1}, 1, 0]$. * After performing the operation with $i = 4$, the array becomes $[0, 1, 1, \\underline{0}, 0]$. * After performing the operation with $i = 5$, the array becomes $[0, 1, 1, 0, \\underline{1}]$. \n\nIn the end, there are $k = 3$ bulbs on. We can also show that the answer cannot be smaller than $5$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2020B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Ultra-Meow\ntime_limit_ms: 2500\nmemory_limit_mb: 256\nDescription: K1o0n gave you an array $a$ of length $n$, consisting of numbers $1, 2, \\ldots, n$. Accept it? Of course! But what to do with it? Of course, calculate $\\text{MEOW}(a)$.\n\nLet $\\text{MEX}(S, k)$ be the $k$-th positive (strictly greater than zero) integer in ascending order that is not present in the set $S$. Denote $\\text{MEOW}(a)$ as the sum of $\\text{MEX}(b, |b| + 1)$, over all distinct subsets $b$ of the array $a$.\n\nExamples of $\\text{MEX}(S, k)$ values for sets:\n\n * $\\text{MEX}(\\\\{3,2\\\\}, 1) = 1$, because $1$ is the first positive integer not present in the set; * $\\text{MEX}(\\\\{4,2,1\\\\}, 2) = 5$, because the first two positive integers not present in the set are $3$ and $5$; * $\\text{MEX}(\\\\{\\\\}, 4) = 4$, because there are no numbers in the empty set, so the first $4$ positive integers not present in it are $1, 2, 3, 4$.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nIn a single line of each test case, an integer $n$ ($1 \\le n \\le 5000$) is entered, the size of the array of gifted numbers.\n\nIt is guaranteed that the sum of $n^2$ over all test cases does not exceed $25 \\cdot 10^6$.\n\nOutput: For each test case, output a single number — $\\text{MEOW}(a)$. Since it may be very large, output it modulo $10^9 + 7$.\n\nExamples:\ninput:\n5\n2\n3\n4999\n5\n1\noutput:\n12\n31\n354226409\n184\n4\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1992G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Cutting Game\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: Alice and Bob were playing a game again. They have a grid of size $a \\times b$ ($1 \\le a, b \\le 10^9$), on which there are $n$ chips, with at most one chip in each cell. The cell at the intersection of the $x$-th row and the $y$-th column has coordinates $(x, y)$.\n\nAlice made the first move, and the players took turns. On each move, a player could cut several (but not all) rows or columns from the beginning or end of the remaining grid and earn a point for each chip that was on the cut part of the grid. Each move can be described by the character 'U', 'D', 'L', or 'R' and an integer $k$:\n\n * If the character is 'U', then the first $k$ remaining rows will be cut; * If the character is 'D', then the last $k$ remaining rows will be cut; * If the character is 'L', then the first $k$ remaining columns will be cut; * If the character is 'R', then the last $k$ remaining columns will be cut. \n\nBased on the initial state of the grid and the players' moves, determine the number of points earned by Alice and Bob, respectively.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nThe first line of each test case contains four integers $a$, $b$, $n$, and $m$ ($2 \\le a, b \\le 10^9$, $1 \\le n, m \\le 2 \\cdot 10^5$) — the dimensions of the grid, the number of chips, and the number of moves.\n\nEach of the next $n$ lines contain two integers $x_i$ and $y_i$ ($1 \\le x_i \\le a$, $1 \\le y_i \\le b$) — the coordinates of the chips. All pairs of coordinates are distinct.\n\nEach of the next $m$ lines contain a character $c_j$ and an integer $k_j$ — the description of the $j$-th move. It is guaranteed that $k$ is less than the number of rows/columns in the current grid. In other words, a player cannot cut the entire remaining grid on their move.\n\nIt is guaranteed that the sum of the values of $n$ across all test cases in the test does not exceed $2 \\cdot 10^5$. It is guaranteed that the sum of the values of $m$ across all test cases in the test does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output two integers — the number of points earned by Alice and Bob, respectively.\n\nExamples:\ninput:\n6\n4 4 3 2\n4 1\n3 3\n2 4\nD 2\nR 1\n4 4 3 3\n4 1\n3 2\n2 3\nD 1\nL 1\nU 2\n3 5 3 2\n1 3\n2 2\n3 3\nR 2\nR 2\n6 4 4 2\n1 4\n2 3\n5 3\n1 1\nR 1\nU 1\n9 3 2 1\n6 1\n3 3\nD 8\n10 10 2 5\n7 5\n9 1\nR 1\nL 2\nD 1\nU 4\nD 1\noutput:\n2 1\n2 0\n0 3\n1 1\n2 0\n0 1\n\nNote: Below is the game from the first example:\n\n\n\nOn her turn, Alice cut $2$ rows from the bottom and scored $2$ points, then Bob cut $1$ column from the right and scored one point. Note that if Bob had cut $1$ row from the bottom, he would have also scored $1$ point.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1974F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Battle for Survive\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Eralim, being the mafia boss, manages a group of $n$ fighters. Fighter $i$ has a rating of $a_i$.\n\nEralim arranges a tournament of $n - 1$ battles, in each of which two not yet eliminated fighters $i$ and $j$ ($1 \\le i < j \\le n$) are chosen, and as a result of the battle, fighter $i$ is eliminated from the tournament, and the rating of fighter $j$ is reduced by the rating of fighter $i$. That is, $a_j$ is decreased by $a_i$. Note that fighter $j$'s rating can become negative. The fighters indexes do not change.\n\nEralim wants to know what maximum rating the last remaining fighter can preserve if he chooses the battles optimally.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^4$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($2 \\le n \\le 2 \\cdot 10^5$) — the number of fighters.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots a_n$ ($1 \\le a_i \\le 10^9$) — the ratings of the fighters.\n\nThe sum of $n$ over all testcases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each testcase, output a single integer — the maximum rating that the last remaining fighter can preserve.\n\nExamples:\ninput:\n5\n2\n2 1\n3\n2 2 8\n4\n1 2 4 3\n5\n1 2 3 4 5\n5\n3 2 4 5 4\noutput:\n-1\n8\n2\n7\n8\n\nNote: In the first example, you can arrange a fight between fighters with indices $1$ and $2$, where the fighter with index $2$ will win. The rating of the last fighter, that is, the fighter with index $2$, will be $1 - 2 = -1$.\n\nIn the second example, you can first conduct a fight between fighters with indices $1$ and $2$, where the fighter with index $2$ will win, and then conduct a fight between fighters with indices $2$ and $3$, where the fighter with index $3$ will win.\n\nThe rating of the fighter with index $2$ after the first fight will be $2 - 2 = 0$. The rating of the fighter with index $3$ after the second fight will be $8 - 0 = 8$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2013B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: 378QAQ and Mocha's Array\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Mocha likes arrays, so before her departure, 378QAQ gave her an array $a$ consisting of $n$ positive integers as a gift.\n\nMocha thinks that $a$ is beautiful if there exist two numbers $i$ and $j$ ($1\\leq i,j\\leq n$, $i\\neq j$) such that for all $k$ ($1 \\leq k \\leq n$), $a_k$ is divisible$^\\dagger$ by either $a_i$ or $a_j$.\n\nDetermine whether $a$ is beautiful.\n\n$^\\dagger$ $x$ is divisible by $y$ if there exists an integer $z$ such that $x = y \\cdot z$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1\\leq t\\leq 500$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($3\\leq n\\leq 10^5$) — the length of the array $a$.\n\nThe second line of each test case contains $n$ integers $a_1,a_2,\\ldots,a_n$ ($1\\leq a_i \\leq 10^9$) — the elements of the array $a$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.\n\nOutput: For each test case, output \"Yes\" if array $a$ is beautiful, and output \"No\" otherwise.\n\nYou can output \"Yes\" and \"No\" in any case (for example, strings \"yEs\", \"yes\", \"Yes\" and \"YES\" will be recognized as a positive response).\n\nExamples:\ninput:\n4\n3\n7 3 8\n5\n7 1 9 3 5\n5\n4 12 2 6 3\n5\n7 49 9 3 1000000000\noutput:\nNo\nYes\nYes\nNo\n\nNote: In the first test case, any two numbers in the array are coprime, so the answer is \"No\".\n\nIn the second test case, we can pick $i=2$ and $j=1$. Since every number in the array is divisible by $a_i = 1$, the answer is \"Yes\".\n\nIn the third test case, we can pick $i=3$ and $j=5$. $2$ and $4$ is divisible by $a_i = 2$ while $3$, $6$ and $12$ is divisible by $a_j = 3$, so the answer is \"Yes\".\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1975B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Two Screens\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: There are two screens which can display sequences of uppercase Latin letters. Initially, both screens display nothing.\n\nIn one second, you can do one of the following two actions:\n\n * choose a screen and an uppercase Latin letter, and append that letter to the end of the sequence displayed on that screen; * choose a screen and copy the sequence from it to the other screen, overwriting the sequence that was displayed on the other screen. \n\nYou have to calculate the minimum number of seconds you have to spend so that the first screen displays the sequence $s$, and the second screen displays the sequence $t$.\n\nInput: The first line contains one integer $q$ ($1 \\le q \\le 500$) — the number of test cases.\n\nEach test case consists of two lines. The first line contains the string $s$, and the second line contains the string $t$ ($1 \\le |s|, |t| \\le 100$). Both strings consist of uppercase Latin letters.\n\nOutput: For each test case, print one integer — the minimum possible number of seconds you have to spend so that the first screen displays the sequence $s$, and the second screen displays the sequence $t$.\n\nExamples:\ninput:\n3\nGARAGE\nGARAGEFORSALE\nABCDE\nAABCD\nTRAINING\nDRAINING\noutput:\n14\n10\n16\n\nNote: In the first test case, the following sequence of actions is possible:\n\n * spend $6$ seconds to write the sequence GARAGE on the first screen; * copy the sequence from the first screen to the second screen; * spend $7$ seconds to complete the sequence on the second screen by writing FORSALE. \n\nIn the second test case, the following sequence of actions is possible:\n\n * spend $1$ second to write the sequence A on the second screen; * copy the sequence from the second screen to the first screen; * spend $4$ seconds to complete the sequence on the first screen by writing BCDE; * spend $4$ seconds to complete the sequence on the second screen by writing ABCD. \n\nIn the third test case, the fastest way to display the sequences is to type both of them character by character without copying, and this requires $16$ seconds.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2025A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Photoshoot for Gorillas\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You really love gorillas, so you decided to organize a photoshoot for them. Gorillas live in the jungle. The jungle is represented as a grid of $n$ rows and $m$ columns. $w$ gorillas agreed to participate in the photoshoot, and the gorilla with index $i$ ($1 \\le i \\le w$) has a height of $a_i$. You want to place all the gorillas in the cells of the grid such that there is no more than one gorilla in each cell.\n\nThe spectacle of the arrangement is equal to the sum of the spectacles of all sub-squares of the grid with a side length of $k$.\n\nThe spectacle of a sub-square is equal to the sum of the heights of the gorillas in it.\n\nFrom all suitable arrangements, choose the arrangement with the maximum spectacle.\n\nInput: The first line contains an integer $t$ ($1 \\le t \\le 10^3$) — the number of test cases.\n\nThe descriptions of the test cases follow.\n\nThe first line contains integers $n$, $m$, $k$ ($1 \\le n, m \\le 2 \\cdot 10^5$, $1 \\le n \\cdot m \\le 2 \\cdot 10^5$, $1 \\le k \\le \\min(n, m)$) — the dimensions of the grid and the side length of the square.\n\nThe second line contains an integer $w$ ($1 \\le w \\le n \\cdot m$) — the number of gorillas.\n\nThe third line contains $w$ integers $a_1, a_2, \\ldots, a_w$ ($1 \\le a_i \\le 10^9$) — the heights of the gorillas.\n\nIt is guaranteed that the sum of $n \\cdot m$ across all test cases does not exceed $2 \\cdot 10^5$. The same guarantee applies to $w$.\n\nOutput: For each test case, output a single integer — the maximum spectacle of a suitable arrangement.\n\nExamples:\ninput:\n5\n3 4 2\n9\n1 1 1 1 1 1 1 1 1\n2 1 1\n2\n5 7\n20 15 7\n9\n4 1 4 5 6 1 1000000000 898 777\n1984 1 1\n4\n5 4 1499 2004\n9 5 5\n6\n6 7 14 16 16 6\noutput:\n21\n12\n49000083104\n3512\n319\n\nNote: In the first test case of the first input set, the spectacle of the following sub-squares is summed:\n\n Yellow color corresponds to the sub-squares, green — to the rest of the grid squares.\n\nThe picture shows the optimal arrangement of the gorillas. The spectacle of the arrangement is $4 + 4 + 3 + 3 + 4 + 3 = 21$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2000E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Range Minimum Sum\ntime_limit_ms: 4000\nmemory_limit_mb: 512\nDescription: For an array $[a_1,a_2,\\ldots,a_n]$ of length $n$, define $f(a)$ as the sum of the minimum element over all subsegments. That is, $$f(a)=\\sum_{l=1}^n\\sum_{r=l}^n \\min_{l\\le i\\le r}a_i.$$\n\nA permutation is a sequence of integers from $1$ to $n$ of length $n$ containing each number exactly once. You are given a permutation $[a_1,a_2,\\ldots,a_n]$. For each $i$, solve the following problem independently:\n\n * Erase $a_i$ from $a$, concatenating the remaining parts, resulting in $b = [a_1,a_2,\\ldots,a_{i-1},\\;a_{i+1},\\ldots,a_{n}]$. * Calculate $f(b)$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^5$). Description of the test cases follows.\n\nThe first line of each test case contains an integer $n$ ($1\\le n\\le 5\\cdot 10^5$).\n\nThe second line of each test case contains $n$ distinct integers $a_1,\\ldots,a_n$ ($1\\le a_i\\le n$).\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^6$.\n\nOutput: For each test case, print one line containing $n$ integers. The $i$-th integer should be the answer when erasing $a_i$.\n\nExamples:\ninput:\n4\n1\n1\n3\n3 1 2\n5\n4 2 1 5 3\n8\n8 1 4 6 7 3 5 2\noutput:\n0 \n4 7 5 \n19 21 27 17 19 \n79 100 72 68 67 80 73 80\n\nNote: In the second test case, $a=[3,1,2]$.\n\n * When removing $a_1$, $b=[1,2]$. $f(b)=1+2+\\min\\\\{1,2\\\\}=4$. * When removing $a_2$, $b=[3,2]$. $f(b)=3+2+\\min\\\\{3,2\\\\}=7$. * When removing $a_3$, $b=[3,1]$. $f(b)=3+1+\\min\\\\{3,1\\\\}=5$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1988E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Legs\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: It's another beautiful day on Farmer John's farm.\n\nAfter Farmer John arrived at his farm, he counted $n$ legs. It is known only chickens and cows live on the farm, and a chicken has $2$ legs while a cow has $4$.\n\nWhat is the minimum number of animals Farmer John can have on his farm assuming he counted the legs of all animals?\n\nInput: The first line contains single integer $t$ ($1 \\leq t \\leq 10^3$) — the number of test cases.\n\nEach test case contains an integer $n$ ($2 \\leq n \\leq 2 \\cdot 10^3$, $n$ is even).\n\nOutput: For each test case, output an integer, the minimum number of animals Farmer John can have on his farm.\n\nExamples:\ninput:\n3\n2\n6\n8\noutput:\n1\n2\n2\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1996A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Alice's Adventures in the Rabbit Hole\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Alice is at the bottom of the rabbit hole! The rabbit hole can be modeled as a tree$^{\\text{∗}}$ which has an exit at vertex $1$, and Alice starts at some vertex $v$. She wants to get out of the hole, but unfortunately, the Queen of Hearts has ordered her execution.\n\nEach minute, a fair coin is flipped. If it lands heads, Alice gets to move to an adjacent vertex of her current location, and otherwise, the Queen of Hearts gets to pull Alice to an adjacent vertex of the Queen's choosing. If Alice ever ends up on any of the non-root leaves$^{\\text{†}}$ of the tree, Alice loses.\n\nAssuming both of them move optimally, compute the probability that Alice manages to escape for every single starting vertex $1\\le v\\le n$. Since these probabilities can be very small, output them modulo $998\\,244\\,353$.\n\nFormally, let $M = 998\\,244\\,353$. It can be shown that the exact answer can be expressed as an irreducible fraction $\\frac{p}{q}$, where $p$ and $q$ are integers and $q \\not \\equiv 0 \\pmod{M}$. Output the integer equal to $p \\cdot q^{-1} \\bmod M$. In other words, output such an integer $x$ that $0 \\le x < M$ and $x \\cdot q \\equiv p \\pmod{M}$.\n\n$^{\\text{∗}}$A tree is a connected simple graph which has $n$ vertices and $n-1$ edges.\n\n$^{\\text{†}}$A leaf is a vertex that is connected to exactly one edge.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^4$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($2\\le n\\le 2\\cdot 10^5$) — the number of vertices in the tree.\n\nThe $i$-th of the next $n - 1$ lines contains two integers $x_i$ and $y_i$ ($1 \\le x_i, y_i \\le n$ and $x_i \\neq y_i$) — the edges of the tree. It is guaranteed that the given edges form a tree.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2\\cdot 10^5$.\n\nOutput: For each test case, output $n$ integers on one line — the probabilities of Alice escaping starting from vertex $1, 2, \\ldots, n$. Since these probabilities can be very small, output them modulo $998\\,244\\,353$.\n\nExamples:\ninput:\n2\n5\n1 2\n1 3\n2 4\n3 5\n9\n1 2\n2 3\n4 5\n5 6\n7 8\n8 9\n2 4\n5 7\noutput:\n1 499122177 499122177 0 0 \n1 499122177 0 332748118 166374059 0 443664157 720954255 0\n\nNote: For the first test case:\n\n 1. Alice escapes from the root (vertex $1$) by definition with probability $1$. 2. Alice immediately loses from vertices $4$ and $5$ since they are leaves. 3. From the other two vertices, Alice escapes with probability $\\frac 12$ since the Queen will pull her to the leaves.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2028E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Triple Operations\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: On the board Ivy wrote down all integers from $l$ to $r$, inclusive.\n\nIn an operation, she does the following:\n\n * pick two numbers $x$ and $y$ on the board, erase them, and in their place write the numbers $3x$ and $\\lfloor \\frac{y}{3} \\rfloor$. (Here $\\lfloor \\bullet \\rfloor$ denotes rounding down to the nearest integer).\n\nWhat is the minimum number of operations Ivy needs to make all numbers on the board equal $0$? We have a proof that this is always possible.\n\nInput: The first line contains an integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases.\n\nThe only line of each test case contains two integers $l$ and $r$ ($1 \\leq l < r \\leq 2 \\cdot 10^5$).\n\nOutput: For each test case, output a single integer — the minimum number of operations needed to make all numbers on the board equal $0$.\n\nExamples:\ninput:\n4\n1 3\n2 4\n199999 200000\n19 84\noutput:\n5\n6\n36\n263\n\nNote: In the first test case, we can perform $5$ operations as follows: $$ 1,2,3 \\xrightarrow[x=1,\\,y=2]{} 3,0,3 \\xrightarrow[x=0,\\,y=3]{} 1,0,3 \\xrightarrow[x=0,\\,y=3]{} 1,0,1 \\xrightarrow[x=0,\\,y=1]{} 0,0,1 \\xrightarrow[x=0,\\,y=1]{} 0,0,0 .$$\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1999E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Corner Twist\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are given two grids of numbers $a$ and $b$, with $n$ rows and $m$ columns. All the values in the grid are $0$, $1$ or $2$.\n\nYou can perform the following operation on $a$ any number of times:\n\n * Pick any subrectangle in the grid with length and width $\\ge 2$. You are allowed to choose the entire grid as a subrectangle. * The subrectangle has four corners. Take any pair of diagonally opposite corners of the chosen subrectangle and add $1$ to their values modulo $3$. * For the pair of corners not picked, add $2$ to their values modulo $3$. \n\nNote that the operation only changes the values of the corners of the picked subrectangle.\n\nIs it possible to convert the grid $a$ into grid $b$ by applying the above operation any number of times (possibly zero)?\n\nInput: The first line contains an integer $t$, the number of testcases ($1 \\le t \\le 250$).\n\nFor each testcase:\n\nThe first line contains two integers $n$ and $m$, the number of rows and columns in the grid ($2 \\le n,m \\le 500$).\n\nEach of the next n lines contain m characters — the $j$-th character of the $i$-th line represents $a_{i,j}$.\n\nEach of the next n lines contain m characters — the $j$-th character of the $i$-th line represents $b_{i,j}$ ($0 \\le a_{i,j}, b_{i,j} \\le 2$).\n\nIt is guaranteed that the sum of $n$ over all test cases and the sum of $m$ over all test cases do not exceed $500$.\n\nOutput: For each test case print \"YES\" (without quotes) if it is possible to convert grid $a$ into grid $b$ and \"NO\" (without quotes) otherwise.\n\nYou can output the answer in any case (upper or lower). For example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will be recognized as positive responses.\n\nExamples:\ninput:\n7\n3 3\n000\n000\n000\n111\n111\n111\n4 4\n0000\n0000\n0000\n0000\n2100\n1200\n0012\n0021\n4 4\n1020\n1200\n1210\n0000\n0000\n1200\n2200\n0000\n3 3\n012\n012\n012\n010\n111\n011\n8 8\n00000000\n00000000\n00000000\n00000000\n00000000\n00000000\n00000000\n10000000\n00000000\n01200000\n02010000\n00102000\n00020100\n00001020\n00000210\n10000000\n2 7\n0000000\n0000000\n2220111\n0111222\n2 7\n0000000\n0100010\n2220111\n1210202\noutput:\nYES\nYES\nYES\nNO\nYES\nNO\nYES\n\nNote: In the first testcase, grid $a$ can be converted into $b$ in the following manner:\n\n$\\begin{matrix}\\fbox{0} & 0 & \\fbox{0}\\\\\\ 0 & 0 & 0\\\\\\ \\fbox{0} & 0 & \\fbox{0}\\end{matrix} \\Rightarrow \\begin{matrix}1 & 0 & 2\\\\\\ 0 & \\fbox{0} & \\fbox{0}\\\\\\ 2 & \\fbox{0} & \\fbox{1}\\end{matrix} \\Rightarrow \\begin{matrix}1 & 0 & 2\\\\\\ \\fbox{0} & \\fbox{1} & 2\\\\\\ \\fbox{2} & \\fbox{2} & 2\\end{matrix} \\Rightarrow \\begin{matrix}1 & \\fbox{0} & \\fbox{2}\\\\\\ 1 & 0 & 2\\\\\\ 1 & \\fbox{0} & \\fbox{2}\\end{matrix} \\Rightarrow \\begin{matrix}1 & 1 & 1\\\\\\ 1 & \\fbox{0} & \\fbox{2}\\\\\\ 1 & \\fbox{2} & \\fbox{0}\\end{matrix} \\Rightarrow \\begin{matrix}1 & 1 & 1\\\\\\ 1 & 1 & 1\\\\\\ 1 & 1 & 1\\end{matrix}$\n\nHere, in each operation, the top-right and bottom-left corners highlighted by a box are incremented by $2$ modulo $3$, while the top-left and bottom-right corners are incremented by $1$ modulo $3$.\n\nIn the fourth testcase, it can be proven that it is not possible to convert grid $a$ into grid $b$ using the above-mentioned operations any number of times.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1983B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Bouquet (Hard Version)\ntime_limit_ms: 1500\nmemory_limit_mb: 256\nDescription: This is the hard version of the problem. The only difference is that in this version, instead of listing the number of petals for each flower, the number of petals and the quantity of flowers in the store is set for all types of flowers.\n\nA girl is preparing for her birthday and wants to buy the most beautiful bouquet. There are a total of $n$ different types of flowers in the store, each of which is characterized by the number of petals and the quantity of this type of flower. A flower with $k$ petals costs $k$ coins. The girl has decided that the difference in the number of petals between any two flowers she will use to decorate her cake should not exceed one. At the same time, the girl wants to assemble a bouquet with the maximum possible number of petals. Unfortunately, she only has $m$ coins, and she cannot spend more. What is the maximum total number of petals she can assemble in the bouquet?\n\nInput: Each test consists of several test cases. The first line contains a single integer $t$ ($1 \\le t \\le 10\\,000$) — the number of test cases. This is followed by descriptions of the test cases.\n\nThe first line of each test case contains two integers $n$, $m$ ($1 \\le n \\le 2 \\cdot 10^5, 1 \\le m \\le 10^{18}$) — the number of types of flowers in the store and the number of coins the girl possesses, respectively. The second line of each test case contains $n$ different integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10^9$), where $a_i$ is the number of petals of the $i$-th flower type in the store (for different indexes $i \\neq j$, it must be $a_i \\neq a_j$). The third line of each test case contains $n$ integers $c_1, c_2, \\ldots, c_n$ ($1 \\le c_i \\le 10^9$), where $c_i$ is the quantity of the $i$-th flower type in the store.\n\nThe sum of $n$ over all test cases does not exceed $2 \\cdot {10}^5$.\n\nOutput: For each test case, print one integer — the maximum possible number of petals in a bouquet that a girl can collect, observing all the conditions listed above.\n\nExamples:\ninput:\n7\n3 10\n1 2 3\n2 2 1\n3 1033\n206 207 1000\n3 4 1\n6 20\n4 2 7 5 6 1\n1 2 1 3 1 7\n8 100000\n239 30 610 122 24 40 8 2\n12 13123 112 1456 124 100 123 10982\n6 13\n2 4 11 1 3 5\n2 2 1 2 2 1\n8 10330\n206 210 200 201 198 199 222 1000\n9 10 11 12 13 14 15 16\n2 10000000000\n11 12\n87312315 753297050\noutput:\n7\n1033\n19\n99990\n13\n10000\n9999999999\n\nNote: In the first test case, some valid bouquets are $(1, 1, 2, 2), (2, 2, 3), (1, 1), (2, 2)$. The maximum over all valid bouquets not greater than $10$ is $7$ for $(2, 2, 3)$. In the second test case, you can assemble a valid bouquet with $(206, 206, 207, 207, 207)$ with a sum of $1033$, which is the maximum number of petals the girl can buy. In the third test case, you can assemble a valid bouquet with $(5, 5, 5, 4)$ with a sum of $19$. It can be seen that no valid bouquet can have $20$ petals.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1995B2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Maximum Multiple Sum\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Given an integer $n$, find an integer $x$ such that:\n\n * $2 \\leq x \\leq n$. * The sum of multiples of $x$ that are less than or equal to $n$ is maximized. Formally, $x + 2x + 3x + \\dots + kx$ where $kx \\leq n$ is maximized over all possible values of $x$.\n\nInput: The first line contains $t$ ($1 \\leq t \\leq 100$) — the number of test cases.\n\nEach test case contains a single integer $n$ ($2 \\leq n \\leq 100$).\n\nOutput: For each test case, output an integer, the optimal value of $x$. It can be shown there is only one unique answer.\n\nExamples:\ninput:\n2\n3\n15\noutput:\n3\n2\n\nNote: For $n = 3$, the possible values of $x$ are $2$ and $3$. The sum of all multiples of $2$ less than or equal to $n$ is just $2$, and the sum of all multiples of $3$ less than or equal to $n$ is $3$. Therefore, $3$ is the optimal value of $x$.\n\nFor $n = 15$, the optimal value of $x$ is $2$. The sum of all multiples of $2$ less than or equal to $n$ is $2 + 4 + 6 + 8 + 10 + 12 + 14 = 56$, which can be proven to be the maximal over all other possible values of $x$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1985B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: D-Function\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Let $D(n)$ represent the sum of digits of $n$. For how many integers $n$ where $10^{l} \\leq n < 10^{r}$ satisfy $D(k \\cdot n) = k \\cdot D(n)$? Output the answer modulo $10^9+7$.\n\nInput: The first line contains an integer $t$ ($1 \\leq t \\leq 10^4$) – the number of test cases.\n\nEach test case contains three integers $l$, $r$, and $k$ ($0 \\leq l < r \\leq 10^9$, $1 \\leq k \\leq 10^9$).\n\nOutput: For each test case, output an integer, the answer, modulo $10^9 + 7$.\n\nExamples:\ninput:\n6\n0 1 4\n0 2 7\n1 2 1\n1 2 3\n582 74663 3\n0 3 1\noutput:\n2\n3\n90\n12\n974995667\n999\n\nNote: For the first test case, the only values of $n$ that satisfy the condition are $1$ and $2$.\n\nFor the second test case, the only values of $n$ that satisfy the condition are $1$, $10$, and $11$.\n\nFor the third test case, all values of $n$ between $10$ inclusive and $100$ exclusive satisfy the condition.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1985G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Minimize the Difference\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Zhan, tired after the contest, gave the only task that he did not solve during the contest to his friend, Sungat. However, he could not solve it either, so we ask you to try to solve this problem.\n\nYou are given an array $a_1, a_2, \\ldots, a_n$ of length $n$. We can perform any number (possibly, zero) of operations on the array.\n\nIn one operation, we choose a position $i$ ($1 \\leq i \\leq n - 1$) and perform the following action:\n\n * $a_i := a_i - 1$, and $a_{i+1} := a_{i+1} + 1$. \n\nFind the minimum possible value of $\\max(a_1, a_2, \\ldots, a_n) - \\min(a_1, a_2, \\ldots, a_n)$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^5$). The description of the test cases follows.\n\nThe first line of each test case contains an integer $n$ ($1 \\leq n \\leq 2 \\cdot 10^5$).\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\leq a_i \\leq 10^{12}$).\n\nThe sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output a single integer: the minimum possible value of $\\max(a_1, a_2, \\ldots, a_n) - \\min(a_1, a_2, \\ldots, a_n)$.\n\nExamples:\ninput:\n5\n1\n1\n3\n1 2 3\n4\n4 1 2 3\n4\n4 2 3 1\n5\n5 14 4 10 2\noutput:\n0\n2\n1\n1\n3\n\nNote: In the third testcase, you can perform the operation twice with $i = 1$.\n\nAfter that, the array is $a = [2, 3, 2, 3]$, and $\\max(2, 3, 2, 3) - \\min(2, 3, 2, 3) = 3 - 2 = 1$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2013D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Boss, Thirsty\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Pak Chanek has a friend who runs a drink stall in a canteen. His friend will sell drinks for $n$ days, numbered from day $1$ to day $n$. There are also $m$ types of drinks, numbered from $1$ to $m$.\n\nThe profit gained from selling a drink on a particular day can vary. On day $i$, the projected profit from selling drink of type $j$ is $A_{i, j}$. Note that $A_{i, j}$ can be negative, meaning that selling the drink would actually incur a loss.\n\nPak Chanek wants to help his friend plan the sales over the $n$ days. On day $i$, Pak Chanek must choose to sell at least one type of drink. Furthermore, the types of drinks sold on a single day must form a subarray. In other words, in each day, Pak Chanek will select $i$ and $j$ such that $1 \\leq i \\leq j \\leq m$. Then all types of drinks between $i$ and $j$ (inclusive) will be sold.\n\nHowever, to ensure that customers from the previous day keep returning, the selection of drink types sold on day $i$ ($i>1$) must meet the following conditions:\n\n * At least one drink type sold on day $i$ must also have been sold on day $i-1$. * At least one drink type sold on day $i$ must not have been sold on day $i-1$. \n\nThe daily profit is the sum of the profits from all drink types sold on that day. The total profit from the sales plan is the sum of the profits over $n$ days. What is the maximum total profit that can be achieved if Pak Chanek plans the sales optimally?\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 1000$). The description of the test cases follows.\n\nThe first line of each test case contains two integers $n$ and $m$ ($1 \\leq n \\leq 2 \\cdot 10^5$; $3 \\leq m \\leq 2 \\cdot 10^5$; $n \\cdot m \\leq 2 \\cdot 10^5$) — the number of rows and columns in a grid.\n\nThe next $n$ lines of each test case contain $m$ integers each, where the $i$-th line contains the integers $A_{i,1} A_{i,2}, \\ldots, A_{i,m}$ ($-10^9 \\leq A_{i,j} \\leq 10^9$) — project profits of each drink type on the $i$-th day.\n\nIt is guaranteed that the sum of $n \\cdot m$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output a single integer: the maximum profit that Pak Chanek can achieve.\n\nExamples:\ninput:\n1\n3 6\n79 20 49 5 -1000 500\n-105 9 109 24 -98 -499\n14 47 12 39 23 50\noutput:\n475\n\nNote: Here is Pak Chanek's optimal plan:\n\n| |  ---|---|--- * On day $1$, Pak Chanek sells drink types $1$ to $3$. Generating a profit of $79+20+49 = 148$. * On day $2$, Pak Chanek sells drink types $2$ to $4$. Generating a profit of $9+109+24 = 142$ * On day $3$, Pak Chanek sells drink types $1$ to $6$. Generating a profit of $185$. \n\nSo, the total profit of Pak Chanek's plan is $148 + 142 + 185 = 475$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2021D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Mind Bloom\ntime_limit_ms: 5000\nmemory_limit_mb: 1024\nDescription: This is the way it always was.\n\nThis is the way it always will be.\n\nAll will be forgotten again soon...\n\nJellyfish is playing a one-player card game called \"Slay the Spire\". There are $n$ cards in total numbered from $1$ to $n$. The $i$-th card has power $c_i$.\n\nThere is a binary string $s$ of length $n$. If $s_i = \\texttt{0}$, the $i$-th card is initially in the draw pile. If $s_i = \\texttt{1}$, the $i$-th card is initially in Jellyfish's hand.\n\nJellyfish will repeat the following process until either her hand or the draw pile is empty.\n\n 1. Let $x$ be the power of the card with the largest power in her hand. 2. Place a single card with power $x$ back into the draw pile. 3. Randomly draw $x$ cards from the draw pile. All subsets of $x$ cards from the draw pile have an equal chance of being drawn. If there are fewer than $x$ cards in the draw pile, Jellyfish will draw all cards. \n\nAt the end of this process, find the probability that Jellyfish can empty the draw pile, modulo $1\\,000\\,000\\,007$.\n\nFormally, let $M=1\\,000\\,000\\,007$. It can be shown that the answer can be expressed as an irreducible fraction $\\frac{p}{q}$, where $p$ and $q$ are integers and $q \\not \\equiv 0 \\pmod{M}$. Output the integer equal to $p \\cdot q^{-1} \\bmod M$. In other words, output such an integer $x$ that $0 \\le x < M$ and $x \\cdot q \\equiv p \\pmod{M}$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1\\leq t\\leq 100$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1 \\leq n \\leq 120$) — the number of cards.\n\nThe second line of each test case contains $n$ integers $c_1,c_2,\\ldots,c_n$ ($0 \\leq c_i \\leq n$) — the powers of the cards. It is guaranteed that $c_1 \\leq c_2 \\leq \\ldots \\leq c_n$.\n\nThe third line of each test case contains a binary string $s$ of length $n$. If $s_i = \\texttt{0}$, the $i$-th card is initially in the draw pile. If $s_i = \\texttt{1}$, the $i$-th card is initially in Jellyfish's hand.\n\nIt is guaranteed that the sum of $n^2$ over all test cases does not exceed $120^2$.\n\nOutput: For each test case, output the probability that Jellyfish can empty the draw pile modulo $1\\,000\\,000\\,007$.\n\nExamples:\ninput:\n4\n5\n0 1 1 1 2\n00100\n3\n2 3 3\n000\n10\n0 0 0 0 0 0 0 1 1 1\n1111011111\n20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 2 3 3 4\n00000000001000101010\noutput:\n500000004\n0\n0\n675898154\n\nNote: In the first test case, Jellyfish will keep playing cards with power $1$ until Jellyfish draws a card with power $0$ or power $2$. If Jellyfish draws a card with power $0$, she will eventually empty her hand. If Jellyfish draws a card with power $2$, she will eventually empty the draw pile. Since there is an equal chance of drawing $0$ or $2$, the answer is $\\frac{1}{2}$, and $2 \\cdot 500\\,000\\,004 \\equiv 1 \\pmod {10^9+7}$\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1975I",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Digital Village (Easy Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the easy version of the problem. In the three versions, the constraints on $n$ and $m$ are different. You can make hacks only if all the versions of the problem are solved.\n\nPak Chanek is setting up internet connections for the village of Khuntien. The village can be represented as a connected simple graph with $n$ houses and $m$ internet cables connecting house $u_i$ and house $v_i$, each with a latency of $w_i$.\n\nThere are $p$ houses that require internet. Pak Chanek can install servers in at most $k$ of the houses. The houses that need internet will then be connected to one of the servers. However, since each cable has its latency, the latency experienced by house $s_i$ requiring internet will be the maximum latency of the cables between that house and the server it is connected to.\n\nFor each $k = 1,2,\\ldots,n$, help Pak Chanek determine the minimum total latency that can be achieved for all the houses requiring internet.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 100$). The description of the test cases follows.\n\nThe first line of each test case contains three integers $n$, $m$, $p$ ($2 \\le n \\le 400$; $n-1 \\le m \\le 400$; $1 \\le p \\le n$) — the number of houses, the number of cables and the number of houses that need internet.\n\nThe second line of each test case contains $p$ integers $s_1, s_2, \\ldots, s_p$ ($1 \\le s_i \\le n$) — the houses that need internet. It is guaranteed that all elements of $s$ are distinct.\n\nThe $i$-th of the next $m$ lines of each test case contains three integers $u_i$, $v_i$, and $w_i$ ($1 \\le u_i < v_i \\le n$; $1 \\le w_i \\le 10^9$) — the internet cable connecting house $u_i$ and house $v_i$ with latency of $w_i$. It is guaranteed that the given edges form a connected simple graph.\n\nIt is guaranteed that the sum of $n^3$ and the sum of $m^3$ do not exceed $10^8$.\n\nOutput: For each test case, output $n$ integers: the minimum total latency that can be achieved for all the houses requiring internet for each $k = 1,2,\\ldots,n$.\n\nExamples:\ninput:\n2\n9 8 5\n2 5 6 8 9\n1 2 1\n1 3 2\n3 4 10\n4 5 3\n4 6 5\n1 7 10\n7 8 4\n7 9 2\n3 3 2\n3 1\n1 2 1\n2 3 3\n1 3 2\noutput:\n34 19 9 4 0 0 0 0 0\n2 0 0\n\nNote: In the first test case for $k=3$, a possible optimal solution is to install servers at vertices $2$, $6$ and $8$ and obtain the following latency:\n\n * $\\text{latency}(2) = 0$ * $\\text{latency}(5) = \\max(3, 5) = 5$ * $\\text{latency}(6) = 0$ * $\\text{latency}(8) = 0$ * $\\text{latency}(9) = \\max(2, 4) = 4$ \n\nSo the total latency is $9$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2021E1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Turtle and Inversions (Hard Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: This is a hard version of this problem. The differences between the versions are the constraint on $m$ and $r_i < l_{i + 1}$ holds for each $i$ from $1$ to $m - 1$ in the easy version. You can make hacks only if both versions of the problem are solved.\n\nTurtle gives you $m$ intervals $[l_1, r_1], [l_2, r_2], \\ldots, [l_m, r_m]$. He thinks that a permutation $p$ is interesting if there exists an integer $k_i$ for every interval ($l_i \\le k_i < r_i$), and if he lets $a_i = \\max\\limits_{j = l_i}^{k_i} p_j, b_i = \\min\\limits_{j = k_i + 1}^{r_i} p_j$ for every integer $i$ from $1$ to $m$, the following condition holds:\n\n$$\\max\\limits_{i = 1}^m a_i < \\min\\limits_{i = 1}^m b_i$$\n\nTurtle wants you to calculate the maximum number of inversions of all interesting permutations of length $n$, or tell him if there is no interesting permutation.\n\nAn inversion of a permutation $p$ is a pair of integers $(i, j)$ ($1 \\le i < j \\le n$) such that $p_i > p_j$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^3$). The description of the test cases follows.\n\nThe first line of each test case contains two integers $n, m$ ($2 \\le n \\le 5 \\cdot 10^3, 0 \\le m \\le 5 \\cdot 10^3$) — the length of the permutation and the number of intervals.\n\nThe $i$-th of the following $m$ lines contains two integers $l_i, r_i$ ($1 \\le l_i < r_i \\le n$) — the $i$-th interval. Note that there may exist identical intervals (i.e., there may exist two different indices $i, j$ such that $l_i = l_j$ and $r_i = r_j$).\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $5 \\cdot 10^3$ and the sum of $m$ over all test cases does not exceed $5 \\cdot 10^3$.\n\nOutput: For each test case, if there is no interesting permutation, output a single integer $-1$.\n\nOtherwise, output a single integer — the maximum number of inversions.\n\nExamples:\ninput:\n8\n2 0\n2 1\n1 2\n5 1\n2 4\n8 3\n1 4\n2 5\n7 8\n7 2\n1 4\n4 7\n7 3\n1 2\n1 7\n3 7\n7 4\n1 3\n4 7\n1 3\n4 7\n7 3\n1 2\n3 4\n5 6\noutput:\n1\n0\n8\n18\n-1\n-1\n15\n15\n\nNote: In the third test case, the interesting permutation with the maximum number of inversions is $[5, 2, 4, 3, 1]$.\n\nIn the fourth test case, the interesting permutation with the maximum number of inversions is $[4, 3, 8, 7, 6, 2, 1, 5]$. In this case, we can let $[k_1, k_2, k_3] = [2, 2, 7]$.\n\nIn the fifth and the sixth test case, it can be proven that there is no interesting permutation.\n\nIn the seventh test case, the interesting permutation with the maximum number of inversions is $[4, 7, 6, 3, 2, 1, 5]$. In this case, we can let $[k_1, k_2, k_3, k_4] = [1, 6, 1, 6]$.\n\nIn the eighth test case, the interesting permutation with the maximum number of inversions is $[4, 7, 3, 6, 2, 5, 1]$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2003E2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Make a Palindrome\ntime_limit_ms: 5000\nmemory_limit_mb: 512\nDescription: You are given an array $a$ consisting of $n$ integers.\n\nLet the function $f(b)$ return the minimum number of operations needed to make an array $b$ a palindrome. The operations you can make are:\n\n * choose two adjacent elements $b_i$ and $b_{i+1}$, remove them, and replace them with a single element equal to $(b_i + b_{i + 1})$; * or choose an element $b_i > 1$, remove it, and replace it with two positive integers $x$ and $y$ ($x > 0$ and $y > 0$) such that $x + y = b_i$. \n\nFor example, from an array $b=[2, 1, 3]$, you can obtain the following arrays in one operation: $[1, 1, 1, 3]$, $[2, 1, 1, 2]$, $[3, 3]$, $[2, 4]$, or $[2, 1, 2, 1]$.\n\nCalculate $\\displaystyle \\left(\\sum_{1 \\le l \\le r \\le n}{f(a[l..r])}\\right)$, where $a[l..r]$ is the subarray of $a$ from index $l$ to index $r$, inclusive. In other words, find the sum of the values of the function $f$ for all subarrays of the array $a$.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 1000$) — the number of test cases.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 2000$).\n\nThe second line contains $n$ integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 10^5$).\n\nAdditional constraint on the input: the sum of $n$ over all test cases does not exceed $2000$.\n\nOutput: For each test case, print a single integer — the sum of the values of the function $f$ for all subarrays of the array $a$.\n\nExamples:\ninput:\n4\n3\n2 1 3\n4\n1 1 1 1\n5\n4 2 3 1 5\n4\n1 2 1 2\noutput:\n3\n0\n14\n5\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2004F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Attribute Checks\ntime_limit_ms: 2500\nmemory_limit_mb: 512\nDescription: Imagine a game where you play as a character that has two attributes: \"Strength\" and \"Intelligence\", that are at zero level initially.\n\nDuring the game, you'll acquire $m$ attribute points that allow you to increase your attribute levels — one point will increase one of the attributes by one level. But sometimes, you'll encounter a so-called \"Attribute Checks\": if your corresponding attribute is high enough, you'll pass it; otherwise, you'll fail it.\n\nSpending some time, you finally prepared a list which contains records of all points you got and all checks you've met. And now you're wondering: what is the maximum number of attribute checks you can pass in a single run if you'd spend points wisely?\n\nNote that you can't change the order of records.\n\nInput: The first line contains two integers $n$ and $m$ ($1 \\le m \\le 5000$; $m < n \\le 2 \\cdot 10^6$) — the number of records in the list and the total number of points you'll get during the game.\n\nThe second line contains $n$ integers $r_1, r_2, \\dots, r_n$ ($-m \\le r_i \\le m$), where $r_i$ encodes the $i$-th record:\n\n * If $r_i = 0$, then the $i$-th record is an acquiring one attribute point. You can spend to level up either Strength or Intelligence; * If $r_i > 0$, then it's an Intelligence check: if your Intelligence level is greater than or equal to $|r_i|$, you pass. * If $r_i < 0$, then it's a Strength check: if your Strength level is greater than or equal to $|r_i|$, you pass. \n\nAdditional constraint on the input: the sequence $r_1, r_2, \\dots, r_n$ contains exactly $m$ elements equal to $0$.\n\nOutput: Print one integer — the maximum number of checks you can pass.\n\nExamples:\ninput:\n10 5\n0 1 0 2 0 -3 0 -4 0 -5\noutput:\n3\n\ninput:\n3 1\n1 -1 0\noutput:\n0\n\ninput:\n9 3\n0 0 1 0 2 -3 -2 -2 1\noutput:\n4\n\nNote: In the first test, it's optimal to spend each point in Strength, so you'll fail $2$ Intelligence checks but pass $3$ Strength checks.\n\nIn the second test, you'll fail both checks, since the first point you get comes after the checks.\n\nIn the third test, one of the optimal strategies is:\n\n 1. spend the first point on Intelligence; 2. spend the second point on Strength; 3. spend the third point on Strength; \n\nAs a result, you'll pass $2$ Intelligence checks $r_3$ and $r_9$ and $2$ Strength checks $r_7$ and $r_8$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2025D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Alice's Adventures in Permuting\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Alice mixed up the words transmutation and permutation! She has an array $a$ specified via three integers $n$, $b$, $c$: the array $a$ has length $n$ and is given via $a_i = b\\cdot (i - 1) + c$ for $1\\le i\\le n$. For example, if $n=3$, $b=2$, and $c=1$, then $a=[2 \\cdot 0 + 1, 2 \\cdot 1 + 1, 2 \\cdot 2 + 1] = [1, 3, 5]$.\n\nNow, Alice really enjoys permutations of $[0, \\ldots, n-1]$$^{\\text{∗}}$ and would like to transform $a$ into a permutation. In one operation, Alice replaces the maximum element of $a$ with the $\\operatorname{MEX}$$^{\\text{†}}$ of $a$. If there are multiple maximum elements in $a$, Alice chooses the leftmost one to replace.\n\nCan you help Alice figure out how many operations she has to do for $a$ to become a permutation for the first time? If it is impossible, you should report it.\n\n$^{\\text{∗}}$A permutation of length $n$ is an array consisting of $n$ distinct integers from $0$ to $n-1$ in arbitrary order. Please note, this is slightly different from the usual definition of a permutation. For example, $[1,2,0,4,3]$ is a permutation, but $[0,1,1]$ is not a permutation ($1$ appears twice in the array), and $[0,2,3]$ is also not a permutation ($n=3$ but there is $3$ in the array).\n\n$^{\\text{†}}$The $\\operatorname{MEX}$ of an array is the smallest non- negative integer that does not belong to the array. For example, the $\\operatorname{MEX}$ of $[0, 3, 1, 3]$ is $2$ and the $\\operatorname{MEX}$ of $[5]$ is $0$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^5$). The description of the test cases follows.\n\nThe only line of each test case contains three integers $n$, $b$, $c$ ($1\\le n\\le 10^{18}$; $0\\le b$, $c\\le 10^{18}$) — the parameters of the array.\n\nOutput: For each test case, if the array can never become a permutation, output $-1$. Otherwise, output the minimum number of operations for the array to become a permutation.\n\nExamples:\ninput:\n7\n10 1 0\n1 2 3\n100 2 1\n3 0 1\n3 0 0\n1000000000000000000 0 0\n1000000000000000000 1000000000000000000 1000000000000000000\noutput:\n0\n1\n50\n2\n-1\n-1\n1000000000000000000\n\nNote: In the first test case, the array is already $[0, 1, \\ldots, 9]$, so no operations are required.\n\nIn the third test case, the starting array is $[1, 3, 5, \\ldots, 199]$. After the first operation, the $199$ gets transformed into a $0$. In the second operation, the $197$ gets transformed into a $2$. If we continue this, it will take exactly $50$ operations to get the array $[0, 1, 2, 3, \\ldots, 99]$.\n\nIn the fourth test case, two operations are needed: $[1,1,1] \\to [0,1,1] \\to [0,2,1]$.\n\nIn the fifth test case, the process is $[0,0,0] \\to [1,0,0] \\to [2,0,0] \\to [1,0,0] \\to [2,0,0]$. This process repeats forever, so the array is never a permutation and the answer is $-1$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2028B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sums of Segments\ntime_limit_ms: 4000\nmemory_limit_mb: 512\nDescription: You are given a sequence of integers $[a_1, a_2, \\dots, a_n]$. Let $s(l,r)$ be the sum of elements from $a_l$ to $a_r$ (i. e. $s(l,r) = \\sum\\limits_{i=l}^{r} a_i$).\n\nLet's construct another sequence $b$ of size $\\frac{n(n+1)}{2}$ as follows: $b = [s(1,1), s(1,2), \\dots, s(1,n), s(2,2), s(2,3), \\dots, s(2,n), s(3,3), \\dots, s(n,n)]$.\n\nFor example, if $a = [1, 2, 5, 10]$, then $b = [1, 3, 8, 18, 2, 7, 17, 5, 15, 10]$.\n\nYou are given $q$ queries. During the $i$-th query, you are given two integers $l_i$ and $r_i$, and you have to calculate $\\sum \\limits_{j=l_i}^{r_i} b_j$.\n\nInput: The first line contains one integer $n$ ($1 \\le n \\le 3 \\cdot 10^5$).\n\nThe second line contains $n$ integers $a_1, a_2, \\dots, a_n$ ($-10 \\le a_i \\le 10$).\n\nThe third line contains one integer $q$ ($1 \\le q \\le 3 \\cdot 10^5$).\n\nThen $q$ lines follow, the $i$-th of them contains two integers $l_i$ and $r_i$ ($1 \\le l_i \\le r_i \\le \\frac{n(n+1)}{2}$).\n\nOutput: Print $q$ integers, the $i$-th of which should be equal to $\\sum \\limits_{j=l_i}^{r_i} b_j$.\n\nExamples:\ninput:\n4\n1 2 5 10\n15\n1 1\n1 2\n1 3\n1 4\n1 5\n1 10\n5 10\n6 10\n2 8\n3 4\n3 10\n3 8\n5 6\n5 5\n1 8\noutput:\n1\n4\n12\n30\n32\n86\n56\n54\n60\n26\n82\n57\n9\n2\n61\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2026D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: XORificator 3000\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Alice has been giving gifts to Bob for many years, and she knows that what he enjoys the most is performing [bitwise XOR](http://tiny.cc/xor_wiki_eng) of interesting integers. Bob considers a positive integer $x$ to be interesting if it satisfies $x \\not\\equiv k (\\bmod 2^i)$. Therefore, this year for his birthday, she gifted him a super-powerful \"XORificator 3000\", the latest model.\n\nBob was very pleased with the gift, as it allowed him to instantly compute the XOR of all interesting integers in any range from $l$ to $r$, inclusive. After all, what else does a person need for happiness? Unfortunately, the device was so powerful that at one point it performed XOR with itself and disappeared. Bob was very upset, and to cheer him up, Alice asked you to write your version of the \"XORificator\".\n\nInput: The first line of input contains a single integer $t$ $(1 \\leq t \\leq 10^4)$ — the number of XOR queries on the segment. The following $t$ lines contain the queries, each consisting of the integers $l$, $r$, $i$, $k$ $(1 \\leq l \\leq r \\leq 10^{18}$, $0 \\leq i \\leq 30$, $0 \\leq k < 2^i)$.\n\nOutput: For each query, output a single integer — the XOR of all integers $x$ in the range $[l, r]$ such that $x \\not\\equiv k \\mod 2^i$.\n\nExamples:\ninput:\n6\n1 3 1 0\n2 28 3 7\n15 43 1 0\n57 2007 1 0\n1010 1993 2 2\n1 1000000000 30 1543\noutput:\n2\n2\n13\n0\n4\n1000000519\n\nNote: In the first query, the interesting integers in the range $[1, 3]$ are $1$ and $3$, so the answer will be $1 \\oplus 3 = 2$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2036F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Zimpha Fan Club\ntime_limit_ms: 12000\nmemory_limit_mb: 512\nDescription: One day, Zimpha casually came up with a problem. As a member of \"Zimpha fan club\", you decided to solve that problem. You are given two strings $s$ and $t$ of length $n$ and $m$, respectively. Both strings only consist of lowercase English letters, - and *.\n\nYou need to replace all occurrences of * and -, observing the following rules:\n\n * For each -, you must replace it with any lowercase English letter. * For each *, you must replace it with a string of any (possibly, zero) length which only consists of lowercase English letters. \n\nNote that you can replace two different instances of - with different characters. You can also replace each two different instances of * with different strings.\n\nSuppose $s$ and $t$ have been transformed into $s'$ and $t'$. Now you're wondering if there's a replacement that makes $s'=t'$.\n\nInput: The first line of input contains two integers $n$ and $m$ ($1 \\leq n, m \\leq 2 \\cdot 10^6$) — the length of the strings $s$ and $t$, respectively.\n\nThe second line contains the string $s$ of length $n$. It is guaranteed that $s$ only consists of lowercase English letters, - and *.\n\nThe third line contains the string $t$ of length $m$. It is guaranteed that $t$ only consists of lowercase English letters, - and *.\n\nOutput: For each test case, output \"Yes\" if there is a replacement that makes $s'=t'$, and output \"No\" otherwise.\n\nYou can output \"Yes\" and \"No\" in any case (for example, strings \"yEs\", \"yes\", \"Yes\" and \"YES\" will be recognized as a positive response).\n\nExamples:\ninput:\n10 10\njustmonika\nj-stsayori\noutput:\nNo\n\ninput:\n7 8\nttk-wxx\n*tt-l-xx\noutput:\nYes\n\ninput:\n13 11\nasoulwangziji\n-soulg*z-y-\noutput:\nNo\n\ninput:\n7 3\nabc*cba\na*c\noutput:\nNo\n\ninput:\n20 18\nbulijiojio-dibuliduo\n*li*ji-*ox*i*-du*-\noutput:\nYes\n\nNote: In the second test case, we can transform both strings into ttklwxx. In $s$, - will be replaced with l. In $t$, * will be replaced by the empty string with the first and second - will be replaced with k and w respectively.\n\nIn the fifth test case, we can transform both strings into bulijiojioxdibuliduo.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1975G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Robin Hood and the Major Oak\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: In Sherwood, the trees are our shelter, and we are all children of the forest.\n\nThe Major Oak in Sherwood is known for its majestic foliage, which provided shelter to Robin Hood and his band of merry men and women.\n\nThe Major Oak grows $i^i$ new leaves in the $i$-th year. It starts with $1$ leaf in year $1$.\n\nLeaves last for $k$ years on the tree. In other words, leaves grown in year $i$ last between years $i$ and $i+k-1$ inclusive.\n\nRobin considers even numbers lucky. Help Robin determine whether the Major Oak will have an even number of leaves in year $n$.\n\nInput: The first line of the input contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nEach test case consists of two integers $n$, $k$ ($1 \\le n \\le 10^9$, $1 \\le k \\le n$) — the requested year and the number of years during which the leaves remain.\n\nOutput: For each test case, output one line, \"YES\" if in year $n$ the Major Oak will have an even number of leaves and \"NO\" otherwise.\n\nYou can output the answer in any case (upper or lower). For example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will be recognized as positive responses.\n\nExamples:\ninput:\n5\n1 1\n2 1\n2 2\n3 2\n4 4\noutput:\nNO\nYES\nNO\nNO\nYES\n\nNote: In the first test case, there is only $1$ leaf.\n\nIn the second test case, $k=1$, so in the $2$-nd year there will be $2^2=4$ leaves.\n\nIn the third test case, $k=2$, so in the $2$-nd year there will be $1+2^2=5$ leaves.\n\nIn the fourth test case, $k=2$, so in the $3$-rd year there will be $2^2 + 3^3 = 4 + 27 = 31$ leaves.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2014B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Action Figures\ntime_limit_ms: 2500\nmemory_limit_mb: 512\nDescription: There is a shop that sells action figures near Monocarp's house. A new set of action figures will be released shortly; this set contains $n$ figures, the $i$-th figure costs $i$ coins and is available for purchase from day $i$ to day $n$.\n\nFor each of the $n$ days, Monocarp knows whether he can visit the shop.\n\nEvery time Monocarp visits the shop, he can buy any number of action figures which are sold in the shop (of course, he cannot buy an action figure that is not yet available for purchase). If Monocarp buys at least two figures during the same day, he gets a discount equal to the cost of the most expensive figure he buys (in other words, he gets the most expensive of the figures he buys for free).\n\nMonocarp wants to buy exactly one $1$-st figure, one $2$-nd figure, ..., one $n$-th figure from the set. He cannot buy the same figure twice. What is the minimum amount of money he has to spend?\n\nInput: The first line contains one integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases.\n\nEach test case consists of two lines:\n\n * the first line contains one integer $n$ ($1 \\le n \\le 4 \\cdot 10^5$) — the number of figures in the set (and the number of days); * the second line contains a string $s$ ($|s| = n$, each $s_i$ is either 0 or 1). If Monocarp can visit the shop on the $i$-th day, then $s_i$ is 1; otherwise, $s_i$ is 0. \n\nAdditional constraints on the input:\n\n * in each test case, $s_n$ is 1, so Monocarp is always able to buy all figures during the $n$-th day; * the sum of $n$ over all test cases does not exceed $4 \\cdot 10^5$.\n\nOutput: For each test case, print one integer — the minimum amount of money Monocarp has to spend.\n\nExamples:\ninput:\n4\n1\n1\n6\n101101\n7\n1110001\n5\n11111\noutput:\n1\n8\n18\n6\n\nNote: In the first test case, Monocarp buys the $1$-st figure on the $1$-st day and spends $1$ coin.\n\nIn the second test case, Monocarp can buy the $1$-st and the $3$-rd figure on the $3$-rd day, the $2$-nd and the $4$-th figure on the $4$-th day, and the $5$-th and the $6$-th figure on the $6$-th day. Then, he will spend $1+2+5=8$ coins.\n\nIn the third test case, Monocarp can buy the $2$-nd and the $3$-rd figure on the $3$-rd day, and all other figures on the $7$-th day. Then, he will spend $1+2+4+5+6 = 18$ coins.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2026C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sakurako's Test\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Sakurako will soon take a test. The test can be described as an array of integers $n$ and a task on it:\n\nGiven an integer $x$, Sakurako can perform the following operation any number of times:\n\n * Choose an integer $i$ ($1\\le i\\le n$) such that $a_i\\ge x$; * Change the value of $a_i$ to $a_i-x$. \n\nUsing this operation any number of times, she must find the minimum possible median$^{\\text{∗}}$ of the array $a$.\n\nSakurako knows the array but does not know the integer $x$. Someone let it slip that one of the $q$ values of $x$ will be in the next test, so Sakurako is asking you what the answer is for each such $x$.\n\n$^{\\text{∗}}$The median of an array of length $n$ is the element that stands in the middle of the sorted array (at the $\\frac{n+2}{2}$-th position for even $n$, and at the $\\frac{n+1}{2}$-th for odd)\n\nInput: The first line contains one integer $t$ ($1\\le t\\le 10^4$) — the number of test cases.\n\nThe first line of each test case contains two integers $n$ and $q$ ($1\\le n,q\\le 10^5$) — the number of elements in the array and the number of queries.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\dots, a_n$ ($1\\le a_i\\le n$) — the elements of the array.\n\nThe following $q$ lines each contain one integer $x$ ($1\\le x\\le n$).\n\nIt is guaranteed that the sum of $n$ across all test cases does not exceed $10^5$. The same guarantee applies to the sum of $q$ across all test cases.\n\nOutput: For each test case, output $q$ integers — the answer for each query.\n\nExamples:\ninput:\n2\n5 5\n1 2 3 4 5\n1\n2\n3\n4\n5\n6 3\n1 2 6 4 1 3\n2\n1\n5\noutput:\n0 1 1 1 2 \n1 0 2\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2008H",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Make Majority\ntime_limit_ms: 1500\nmemory_limit_mb: 512\nDescription: You are given a sequence $[a_1,\\ldots,a_n]$ where each element $a_i$ is either $0$ or $1$. You can apply several (possibly zero) operations to the sequence. In each operation, you select two integers $1\\le l\\le r\\le |a|$ (where $|a|$ is the current length of $a$) and replace $[a_l,\\ldots,a_r]$ with a single element $x$, where $x$ is the majority of $[a_l,\\ldots,a_r]$.\n\nHere, the majority of a sequence consisting of $0$ and $1$ is defined as follows: suppose there are $c_0$ zeros and $c_1$ ones in the sequence, respectively.\n\n * If $c_0\\ge c_1$, the majority is $0$. * If $c_0<c_1$, the majority is $1$. \n\nFor example, suppose $a=[1,0,0,0,1,1]$. If we select $l=1,r=2$, the resulting sequence will be $[0,0,0,1,1]$. If we select $l=4,r=6$, the resulting sequence will be $[1,0,0,1]$.\n\nDetermine if you can make $a=[1]$ with a finite number of operations.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 4\\cdot 10^4$). Description of the test cases follows.\n\nThe first line of each testcase contains one integer $n$ ($1\\le n\\le 2\\cdot 10^5$).\n\nThe second line of each testcase contains a string consisting of $0$ and $1$, describing the sequence $a$.\n\nIt's guaranteed that the sum of $n$ over all testcases does not exceed $2\\cdot 10^5$.\n\nOutput: For each testcase, if it's possible to make $a=[1]$, print YES. Otherwise, print NO. You can output the answer in any case (upper or lower). For example, the strings yEs, yes, Yes, and YES will be recognized as positive responses.\n\nExamples:\ninput:\n5\n1\n0\n1\n1\n2\n01\n9\n100000001\n9\n000011000\noutput:\nNo\nYes\nNo\nYes\nNo\n\nNote: In the fourth testcase of the example, initially $a=[1,0,0,0,0,0,0,0,1]$. A valid sequence of operations is:\n\n 1. Select $l=2,r=8$ and apply the operation. $a$ becomes $[1,0,1]$. 2. Select $l=1,r=3$ and apply the operation. $a$ becomes $[1]$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1988B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Peanuts\ntime_limit_ms: 4000\nmemory_limit_mb: 256\nDescription: Having the magical beanstalk, Jack has been gathering a lot of peanuts lately. Eventually, he has obtained $n$ pockets of peanuts, conveniently numbered $1$ to $n$ from left to right. The $i$-th pocket has $a_i$ peanuts.\n\nJack and his childhood friend Alice decide to play a game around the peanuts. First, Alice divides the pockets into some boxes; each box will have a non- zero number of consecutive pockets, and each pocket will, obviously, belong to exactly one box. At the same time, Alice does not change the order of the boxes, that is, the boxes are numbered in ascending order of the indices of the pockets in them.\n\nAfter that, Alice and Jack will take turns alternately, with Alice going first.\n\nAt each turn, the current player will remove a positive number of peanuts from exactly one pocket which belongs to the leftmost non-empty box (i.e., the leftmost box containing at least one non-empty pocket). In other words, if we number the boxes from left to right, then each player can only pick peanuts from the pocket in the $j$-th box ($j \\ge 2$) only if the $(j - 1)$-th box has no peanuts left. The player who cannot make a valid move loses.\n\nAlice is sure she will win since she has the advantage of dividing the pockets into boxes herself. Thus, she wanted to know how many ways there are for her to divide the peanuts into boxes at the start of the game so that she will win, assuming both players play optimally. Can you help her with the calculation?\n\nAs the result can be very large, output it modulo $998\\,244\\,353$.\n\nInput: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases. The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1 \\leq n \\leq 10^6$) — the number of pockets.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\leq a_i \\leq 10^9$) — the number of peanuts in each pocket.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^6$.\n\nOutput: For each test case, output a single integer — the number of ways for Alice to divide the pockets into boxes at the start of the game to guarantee her win, assuming both players play optimally, modulo $998\\,244\\,353$.\n\nExamples:\ninput:\n5\n3\n1 2 3\n4\n1 2 3 1\n5\n1 1 1 1 1\n2\n1 1\n10\n1 2 3 4 5 6 7 8 9 10\noutput:\n1\n4\n16\n0\n205\n\nNote: In the first test case, the only way for Alice to win is to divide the pockets into two boxes as follows: $([1, 2], [3])$ (the first box contains the first two pockets and the second box contains the third pocket). Alice wins by taking both peanuts from the second pocket, leaving Jack with $([1], [3])$. Jack is forced to take the only peanut left in the first box, which allows Alice to take the remaining ones in the second box.\n\nIn the second test case, the winning divisions for Alice are $([1], [2, 3, 1])$, $([1, 2, 3, 1])$, $([1, 2], [3], [1])$, and $([1, 2], [3, 1])$.\n\nIn the third test case, Alice always wins no matter how she divides the pockets into boxes.\n\nIn the fourth test case, Alice always loses no matter how she divides the pockets into boxes.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2032F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Complex Segments (Easy Version)\ntime_limit_ms: 6000\nmemory_limit_mb: 256\nDescription: [Ken Arai - COMPLEX](https://soundcloud.com/diatomichail2/complex)\n\n⠀\n\nThis is the easy version of the problem. In this version, the constraints on $n$ and the time limit are lower. You can make hacks only if both versions of the problem are solved.\n\nA set of (closed) segments is complex if it can be partitioned into some subsets such that\n\n * all the subsets have the same size; and * a pair of segments intersects if and only if the two segments are in the same subset. \n\nYou are given $n$ segments $[l_1, r_1], [l_2, r_2], \\ldots, [l_n, r_n]$. Find the maximum size of a complex subset of these segments.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^3$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 2 \\cdot 10^4$) — the number of segments.\n\nThe second line of each test case contains $n$ integers $l_1, l_2, \\ldots, l_n$ ($1 \\le l_i \\le 2n$) — the left endpoints of the segments.\n\nThe third line of each test case contains $n$ integers $r_1, r_2, \\ldots, r_n$ ($l_i \\leq r_i \\le 2n$) — the right endpoints of the segments.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^4$.\n\nOutput: For each test case, output a single integer: the maximum size of a complex subset of the given segments.\n\nExamples:\ninput:\n3\n3\n1 2 3\n5 4 6\n5\n1 2 3 6 8\n5 4 7 9 10\n5\n3 1 4 1 5\n7 2 6 5 10\noutput:\n3\n4\n4\n\nNote: In the first test case, all pairs of segments intersect, therefore it is optimal to form a single group containing all of the three segments.\n\nIn the second test case, there is no valid partition for all of the five segments. A valid partition with four segments is the following: $\\\\{\\\\{ [1, 5], [2, 4] \\\\}, \\\\{ [6, 9], [8, 10] \\\\}\\\\}$.\n\nIn the third test case, it is optimal to make a single group containing all the segments except the second.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2018E1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Simultaneous Coloring\ntime_limit_ms: 6000\nmemory_limit_mb: 512\nDescription: You are given a matrix, consisting of $n$ rows and $m$ columns.\n\nYou can perform two types of actions on it:\n\n * paint the entire column in blue; * paint the entire row in red. \n\nNote that you cannot choose which color to paint the row or column.\n\nIn one second, you can perform either one action or multiple actions at the same time. If you perform one action, it will be free. If you perform $k > 1$ actions at the same time, it will cost $k^2$ coins. When multiple actions are performed at the same time, for each cell affected by actions of both types, the color can be chosen independently.\n\nYou are asked to process $q$ queries. Before each query, all cells become colorless. Initially, there are no restrictions on the color of any cells. In the $i$-th query, a restriction of the following form is added:\n\n * $x_i~y_i~c_i$ — the cell in row $x_i$ in column $y_i$ should be painted in color $c_i$. \n\nThus, after $i$ queries, there are $i$ restrictions on the required colors of the matrix cells. After each query, output the minimum cost of painting the matrix according to the restrictions.\n\nInput: The first line contains three integers $n, m$ and $q$ ($1 \\le n, m, q \\le 2 \\cdot 10^5$) — the size of the matrix and the number of queries.\n\nIn the $i$-th of the next $q$ lines, two integers $x_i, y_i$ and a character $c_i$ ($1 \\le x_i \\le n$; $1 \\le y_i \\le m$; $c_i \\in$ {'R', 'B'}, where 'R' means red, and 'B' means blue) — description of the $i$-th restriction. The cells in all queries are pairwise distinct.\n\nOutput: Print $q$ integers — after each query, output the minimum cost of painting the matrix according to the restrictions.\n\nExamples:\ninput:\n2 2 4\n1 1 R\n2 2 R\n1 2 B\n2 1 B\noutput:\n0\n0\n0\n16\n\ninput:\n3 5 10\n1 1 B\n2 5 B\n2 2 B\n2 3 R\n2 1 B\n3 2 R\n3 3 B\n1 2 R\n1 3 B\n3 1 B\noutput:\n0\n0\n0\n0\n0\n0\n16\n16\n25\n25\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1989F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Meaning Mean\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Pak Chanek has an array $a$ of $n$ positive integers. Since he is currently learning how to calculate the floored average of two numbers, he wants to practice it on his array $a$.\n\nWhile the array $a$ has at least two elements, Pak Chanek will perform the following three-step operation:\n\n 1. Pick two different indices $i$ and $j$ ($1 \\leq i, j \\leq |a|$; $i \\neq j$), note that $|a|$ denotes the current size of the array $a$. 2. Append $\\lfloor \\frac{a_i+a_j}{2} \\rfloor$$^{\\text{∗}}$ to the end of the array. 3. Remove elements $a_i$ and $a_j$ from the array and concatenate the remaining parts of the array. \n\nFor example, suppose that $a=[5,4,3,2,1,1]$. If we choose $i=1$ and $j=5$, the resulting array will be $a=[4,3,2,1,3]$. If we choose $i=4$ and $j=3$, the resulting array will be $a=[5,4,1,1,2]$.\n\nAfter all operations, the array will consist of a single element $x$. Find the maximum possible value of $x$ if Pak Chanek performs the operations optimally.\n\n$^{\\text{∗}}$$\\lfloor x \\rfloor$ denotes the floor function of $x$, which is the greatest integer that is less than or equal to $x$. For example, $\\lfloor 6 \\rfloor = 6$, $\\lfloor 2.5 \\rfloor=2$, $\\lfloor -3.6 \\rfloor=-4$ and $\\lfloor \\pi \\rfloor=3$\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 5000$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($2 \\le n \\le 50$) — the length of the array $a$.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10^9$) — the elements of the array $a$.\n\nDo note that the sum of $n$ over all test cases is not bounded.\n\nOutput: For each test case, output a single integer: the maximum possible value of $x$ after all numbers have been picked.\n\nExamples:\ninput:\n3\n5\n1 7 8 4 5\n3\n2 6 5\n5\n5 5 5 5 5\noutput:\n6\n4\n5\n\nNote: In the first test case, the array is initially $a=[1,7,8,4,5]$. Pak Chanek will perform the following operations:\n\n 1. Pick $i=1$ and $j=2$, then $a=[8,4,5,4]$. 2. Pick $i=3$ and $j=2$, then $a=[8,4,4]$. 3. Pick $i=2$ and $j=3$, then $a=[8,4]$. 4. Pick $i=1$ and $j=2$, then $a=[6]$. \n\nAfter all the operations, the array consists of a single element $x=6$. It can be proven that there is no series of operations that results in $x$ greater than $6$ in the end.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2021A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Quintomania\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Boris Notkin composes melodies. He represents them as a sequence of notes, where each note is encoded as an integer from $0$ to $127$ inclusive. The interval between two notes $a$ and $b$ is equal to $|a - b|$ semitones.\n\nBoris considers a melody perfect if the interval between each two adjacent notes is either $5$ semitones or $7$ semitones.\n\nAfter composing his latest melodies, he enthusiastically shows you his collection of works. Help Boris Notkin understand whether his melodies are perfect.\n\nInput: The first line contains an integer $t$ ($1 \\leq t \\leq 1000$) — the number of melodies.\n\nEach melody is described by two lines.\n\nThe first line contains an integer $n$ ($2 \\leq n \\leq 50$) — the number of notes in the melody.\n\nThe second line contains $n$ integers $a_{1}, a_{2}, \\dots, a_{n}$ ($0 \\leq a_{i} \\leq 127$) — the notes of the melody.\n\nOutput: For each melody, output \"YES\", if it is perfect; otherwise, output \"NO\".\n\nYou can output the answer in any case (upper or lower). For example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will be recognized as positive responses.\n\nExamples:\ninput:\n8\n2\n114 109\n2\n17 10\n3\n76 83 88\n8\n38 45 38 80 85 92 99 106\n5\n63 58 65 58 65\n8\n117 124 48 53 48 43 54 49\n5\n95 102 107 114 121\n10\n72 77 82 75 70 75 68 75 68 75\noutput:\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nYES\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2036A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: A+B Again?\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Given a two-digit positive integer $n$, find the sum of its digits.\n\nInput: The first line contains an integer $t$ ($1 \\leq t \\leq 90$) — the number of test cases.\n\nThe only line of each test case contains a single two-digit positive integer $n$ ($10 \\leq n \\leq 99$).\n\nOutput: For each test case, output a single integer — the sum of the digits of $n$.\n\nExamples:\ninput:\n8\n77\n21\n40\n34\n19\n84\n10\n99\noutput:\n14\n3\n4\n7\n10\n12\n1\n18\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1999A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Game in Tree (Easy Version)\ntime_limit_ms: 4000\nmemory_limit_mb: 256\nDescription: This is the easy version of the problem. In this version, $\\mathbf{u = v}$. You can make hacks only if both versions of the problem are solved.\n\nAlice and Bob are playing a fun game on a tree. This game is played on a tree with $n$ vertices, numbered from $1$ to $n$. Recall that a tree with $n$ vertices is an undirected connected graph with $n - 1$ edges.\n\nAlice and Bob take turns, with Alice going first. Each player starts at some vertex.\n\nOn their turn, a player must move from the current vertex to a neighboring vertex that has not yet been visited by anyone. The first player who cannot make a move loses.\n\nYou are given two vertices $u$ and $v$. Represent the simple path from vertex $u$ to $v$ as an array $p_1, p_2, p_3, \\ldots, p_m$, where $p_1 = u$, $p_m = v$, and there is an edge between $p_i$ and $p_{i + 1}$ for all $i$ ($1 \\le i < m$).\n\nYou need to determine the winner of the game if Alice starts at vertex $1$ and Bob starts at vertex $p_j$ for each $j$ (where $1 \\le j \\le m$).\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^4$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($2 \\le n \\le 2 \\cdot 10^5$) — the number of vertices in the tree.\n\nEach of the following $n - 1$ lines contains two integers $a$ and $b$ ($1 \\le a, b \\le n$), denoting an undirected edge between vertices $a$ and $b$. It is guaranteed that these edges form a tree.\n\nThe last line of each test case contains two integers $u$ and $v$ ($2 \\le u, v \\le n$, $\\mathbf{u = v}$).\n\nIt is guaranteed that the path from $u$ to $v$ does not pass through vertex $1$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output $m$ lines.\n\nIn the $i$-th line, print the winner of the game if Alice starts at vertex $1$ and Bob starts at vertex $p_i$. Print \"Alice\" (without quotes) if Alice wins, or \"Bob\" (without quotes) otherwise.\n\nExamples:\ninput:\n3\n3\n1 2\n2 3\n2 2\n3\n1 2\n2 3\n3 3\n6\n1 2\n1 3\n2 4\n2 5\n1 6\n4 4\noutput:\nBob\nAlice\nAlice\n\nNote:  Tree from the first and second examples.\n\nIn the first test case, the path will be ($2,2$). Bob starts at vertex $2$, Alice will not be able to move anywhere on her first turn and will lose.\n\nIn the second test case, the path will be ($3,3$). Bob starts at vertex $3$, Alice will move to vertex $2$, and Bob will have no remaining vertices to visit and will lose.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2013F1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Heartbeat\ntime_limit_ms: 5000\nmemory_limit_mb: 512\nDescription: For an array $u_1, u_2, \\ldots, u_n$, define\n\n * a prefix maximum as an index $i$ such that $u_i>u_j$ for all $j<i$; * a suffix maximum as an index $i$ such that $u_i>u_j$ for all $j>i$; * an ascent as an index $i$ ($i>1$) such that $u_i>u_{i-1}$. \n\nYou are given three cost arrays: $[a_1, a_2, \\ldots, a_n]$, $[b_1, b_2, \\ldots, b_n]$, and $[c_0, c_1, \\ldots, c_{n-1}]$.\n\nDefine the cost of an array that has $x$ prefix maximums, $y$ suffix maximums, and $z$ ascents as $a_x\\cdot b_y\\cdot c_z$.\n\nLet the sum of costs of all permutations of $1,2,\\ldots,n$ be $f(n)$. Find $f(1)$, $f(2)$, ..., $f(n)$ modulo $998\\,244\\,353$.\n\nInput: The first line contains an integer $n$ ($1\\le n\\le 700$).\n\nThe second line contains $n$ integers $a_1,\\ldots,a_n$ ($0\\le a_i<998\\,244\\,353$).\n\nThe third line contains $n$ integers $b_1,\\ldots,b_n$ ($0\\le b_i<998\\,244\\,353$).\n\nThe fourth line contains $n$ integers $c_0,\\ldots,c_{n-1}$ ($0\\le c_i<998\\,244\\,353$).\n\nOutput: Print $n$ integers: the $i$-th one is $f(i)$ modulo $998\\,244\\,353$.\n\nExamples:\ninput:\n3\n1 1 1\n1 1 1\n1 1 1\noutput:\n1 2 6\n\ninput:\n3\n1 2 3\n2 3 1\n3 1 2\noutput:\n6 13 34\n\ninput:\n5\n1 4 2 5 3\n2 5 1 3 4\n300000000 100000000 500000000 400000000 200000000\noutput:\n600000000 303511294 612289529 324650937 947905622\n\nNote: In the second example:\n\n * Consider permutation $[1,2,3]$. Indices $1,2,3$ are prefix maximums. Index $3$ is the only suffix maximum. Indices $2,3$ are ascents. In conclusion, it has $3$ prefix maximums, $1$ suffix maximums, and $2$ ascents. Therefore, its cost is $a_3b_1c_2=12$. * Permutation $[1,3,2]$ has $2$ prefix maximums, $2$ suffix maximums, and $1$ ascent. Its cost is $6$. * Permutation $[2,1,3]$ has $2$ prefix maximums, $1$ suffix maximum, and $1$ ascent. Its cost is $4$. * Permutation $[2,3,1]$ has $2$ prefix maximums, $2$ suffix maximums, and $1$ ascent. Its cost is $6$. * Permutation $[3,1,2]$ has $1$ prefix maximum, $2$ suffix maximums, and $1$ ascent. Its cost is $3$. * Permutation $[3,2,1]$ has $1$ prefix maximum, $3$ suffix maximums, and $0$ ascents. Its cost is $3$. \n\nThe sum of all permutations' costs is $34$, so $f(3)=34$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1988F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Lattice Optimizing\ntime_limit_ms: 7000\nmemory_limit_mb: 1024\nDescription: Consider a grid graph with $n$ rows and $n$ columns. Let the cell in row $x$ and column $y$ be $(x,y)$. There exists a directed edge from $(x,y)$ to $(x+1,y)$, with non-negative integer value $d_{x,y}$, for all $1\\le x < n, 1\\le y \\le n$, and there also exists a directed edge from $(x,y)$ to $(x,y+1)$, with non-negative integer value $r_{x,y}$, for all $1\\le x \\le n, 1\\le y < n$.\n\nInitially, you are at $(1,1)$, with an empty set $S$. You need to walk along the edges and eventually reach $(n,n)$. Whenever you pass an edge, its value will be inserted into $S$. Please maximize the MEX$^{\\text{∗}}$ of $S$ when you reach $(n,n)$.\n\n$^{\\text{∗}}$The MEX (minimum excluded) of an array is the smallest non- negative integer that does not belong to the array. For instance:\n\n * The MEX of $[2,2,1]$ is $0$, because $0$ does not belong to the array. * The MEX of $[3,1,0,1]$ is $2$, because $0$ and $1$ belong to the array, but $2$ does not. * The MEX of $[0,3,1,2]$ is $4$, because $0, 1, 2$, and $3$ belong to the array, but $4$ does not.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1\\le t\\le100$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($2\\le n\\le20$) — the number of rows and columns.\n\nEach of the next $n-1$ lines contains $n$ integers separated by single spaces — the matrix $d$ ($0\\le d_{x,y}\\le 2n-2$).\n\nEach of the next $n$ lines contains $n-1$ integers separated by single spaces — the matrix $r$ ($0\\le r_{x,y}\\le 2n-2$).\n\nIt is guaranteed that the sum of all $n^3$ does not exceed $8000$.\n\nOutput: For each test case, print a single integer — the maximum MEX of $S$ when you reach $(n,n)$.\n\nExamples:\ninput:\n2\n3\n1 0 2\n0 1 3\n2 1\n0 3\n3 0\n3\n1 2 0\n0 1 2\n2 0\n1 2\n0 1\noutput:\n3\n2\n\ninput:\n1\n10\n16 7 3 15 9 17 1 15 9 0\n4 3 1 12 13 10 10 14 6 12\n3 1 3 9 5 16 0 12 7 12\n11 4 8 7 13 7 15 13 9 2\n2 3 9 9 4 12 17 7 10 15\n10 6 15 17 13 6 15 9 4 9\n13 3 3 14 1 2 10 10 12 16\n8 2 9 13 18 7 1 6 2 6\n15 12 2 6 0 0 13 3 7 17\n7 3 17 17 10 15 12 14 15\n4 3 3 17 3 13 11 16 6\n16 17 7 7 12 5 2 4 10\n18 9 9 3 5 9 1 16 7\n1 0 4 2 10 10 12 2 1\n4 14 15 16 15 5 8 4 18\n7 18 10 11 2 0 14 8 18\n2 17 6 0 9 6 13 5 11\n5 15 7 11 6 3 17 14 5\n1 3 16 16 13 1 0 13 11\noutput:\n14\n\nNote: In the first test case, the grid graph and one of the optimal paths are as follows:\n\n\n\nIn the second test case, the grid graph and one of the optimal paths are as follows:\n\n\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2002G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Perform Operations to Maximize Score\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: I see satyam343. I'm shaking. Please more median problems this time. I love those. Please satyam343 we believe in you.\n\n— satyam343's biggest fan\n\nYou are given an array $a$ of length $n$ and an integer $k$. You are also given a binary array $b$ of length $n$.\n\nYou can perform the following operation at most $k$ times:\n\n * Select an index $i$ ($1 \\leq i \\leq n$) such that $b_i = 1$. Set $a_i = a_i + 1$ (i.e., increase $a_i$ by $1$). \n\nYour score is defined to be $\\max\\limits_{i = 1}^{n} \\left( a_i + \\operatorname{median}(c_i) \\right)$, where $c_i$ denotes the array of length $n-1$ that you get by deleting $a_i$ from $a$. In other words, your score is the maximum value of $a_i + \\operatorname{median}(c_i)$ over all $i$ from $1$ to $n$.\n\nFind the maximum score that you can achieve if you perform the operations optimally.\n\nFor an arbitrary array $p$, $\\operatorname{median}(p)$ is defined as the $\\left\\lfloor \\frac{|p|+1}{2} \\right\\rfloor$-th smallest element of $p$. For example, $\\operatorname{median} \\left( [3,2,1,3] \\right) = 2$ and $\\operatorname{median} \\left( [6,2,4,5,1] \\right) = 4$.\n\nInput: The first line contains an integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases.\n\nEach test case begins with two integers $n$ and $k$ ($2 \\leq n \\leq 2 \\cdot 10^5$, $0 \\leq k \\leq 10^9$) — the length of the $a$ and the number of operations you can perform.\n\nThe following line contains $n$ space separated integers $a_1, a_2, \\ldots, a_n$ ($1 \\leq a_i \\leq 10^9$) — denoting the array $a$.\n\nThe following line contains $n$ space separated integers $b_1, b_2, \\ldots, b_n$ ($b_i$ is $0$ or $1$) — denoting the array $b$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output the maximum value of score you can get on a new line.\n\nExamples:\ninput:\n8\n2 10\n3 3\n1 1\n3 10\n3 3 3\n0 0 0\n4 4\n2 1 5 1\n0 1 0 1\n5 4\n7 5 2 5 4\n0 0 1 0 1\n5 1\n5 15 15 2 11\n1 0 0 1 1\n5 2\n10 11 4 10 15\n1 1 0 1 0\n4 4\n1 1 2 5\n1 1 0 0\n2 1000000000\n1000000000 1000000000\n1 1\noutput:\n16\n6\n8\n13\n21\n26\n8\n3000000000\n\nNote: For the first test case, it is optimal to perform $5$ operations on both elements so $a = [8,8]$. So, the maximum score we can achieve is $\\max(8 + \\operatorname{median}[8], 8 + \\operatorname{median}[8]) = 16$, as $c_1 = [a_2] = [8]$. It can be proven that you cannot get a better score.\n\nFor the second test case, you are not able to perform operations on any elements, so $a$ remains $[3,3,3]$. So, the maximum score we can achieve is $3 + \\operatorname{median}[3, 3] = 6$, as $c_1 = [a_2, a_3] = [3, 3]$. It can be proven that you cannot get a better score.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1998C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Interesting Problem (Hard Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the hard version of the problem. The only difference between the two versions is the constraint on $n$. You can make hacks only if both versions of the problem are solved.\n\nYou are given an array of integers $a$ of length $n$.\n\nIn one operation, you will perform the following two-step process:\n\n 1. Choose an index $i$ such that $1 \\le i < |a|$ and $a_i = i$. 2. Remove $a_i$ and $a_{i+1}$ from the array and concatenate the remaining parts. \n\nFind the maximum number of times that you can perform the operation above.\n\nInput: Each test contains multiple test cases. The first line of input contains a single integer $t$ ($1 \\le t \\le 100$) — the number of test cases. The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 800$) — the length of the array $a$.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le n$) — the elements of the array $a$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $800$.\n\nOutput: For each test case, output a single integer — the maximum number of times that you can perform the operation.\n\nExamples:\ninput:\n6\n5\n1 5 3 2 4\n8\n2 1 3 4 5 6 7 8\n3\n1 2 3\n4\n1 2 4 4\n5\n4 4 1 3 5\n1\n1\noutput:\n2\n3\n1\n2\n0\n0\n\nNote: In the first test case, one possible optimal sequence of operations is $[ 1, 5, \\color{red}{3}, \\color{red}{2}, 4 ] \\rightarrow [\\color{red}{1}, \\color{red}{5}, 4] \\rightarrow [4]$.\n\nIn the third test case, one possible optimal sequence of operations is $[1, \\color{red}{2}, \\color{red}{3}] \\rightarrow [1]$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1987F2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: XOR Sequences\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are given two distinct non-negative integers $x$ and $y$. Consider two infinite sequences $a_1, a_2, a_3, \\ldots$ and $b_1, b_2, b_3, \\ldots$, where\n\n * $a_n = n \\oplus x$; * $b_n = n \\oplus y$. \n\nHere, $x \\oplus y$ denotes the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) operation of integers $x$ and $y$.\n\nFor example, with $x = 6$, the first $8$ elements of sequence $a$ will look as follows: $[7, 4, 5, 2, 3, 0, 1, 14, \\ldots]$. Note that the indices of elements start with $1$.\n\nYour task is to find the length of the longest common subsegment$^\\dagger$ of sequences $a$ and $b$. In other words, find the maximum integer $m$ such that $a_i = b_j, a_{i + 1} = b_{j + 1}, \\ldots, a_{i + m - 1} = b_{j + m - 1}$ for some $i, j \\ge 1$.\n\n$^\\dagger$A subsegment of sequence $p$ is a sequence $p_l,p_{l+1},\\ldots,p_r$, where $1 \\le l \\le r$.\n\nInput: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \\le t \\le 10^4$) — the number of test cases. The description of the test cases follows.\n\nThe only line of each test case contains two integers $x$ and $y$ ($0 \\le x, y \\le 10^9, x \\neq y$) — the parameters of the sequences.\n\nOutput: For each test case, output a single integer — the length of the longest common subsegment.\n\nExamples:\ninput:\n4\n0 1\n12 4\n57 37\n316560849 14570961\noutput:\n1\n8\n4\n33554432\n\nNote: In the first test case, the first $7$ elements of sequences $a$ and $b$ are as follows:\n\n$a = [1, 2, 3, 4, 5, 6, 7,\\ldots]$\n\n$b = [0, 3, 2, 5, 4, 7, 6,\\ldots]$\n\nIt can be shown that there isn't a positive integer $k$ such that the sequence $[k, k + 1]$ occurs in $b$ as a subsegment. So the answer is $1$.\n\nIn the third test case, the first $20$ elements of sequences $a$ and $b$ are as follows:\n\n$a = [56, 59, 58, 61, 60, 63, 62, 49, 48, 51, 50, 53, 52, 55, 54, \\textbf{41, 40, 43, 42}, 45, \\ldots]$\n\n$b = [36, 39, 38, 33, 32, 35, 34, 45, 44, 47, 46, \\textbf{41, 40, 43, 42}, 53, 52, 55, 54, 49, \\ldots]$\n\nIt can be shown that one of the longest common subsegments is the subsegment $[41, 40, 43, 42]$ with a length of $4$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1979B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Longest Max Min Subsequence\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given an integer sequence $a_1, a_2, \\ldots, a_n$. Let $S$ be the set of all possible non-empty subsequences of $a$ without duplicate elements. Your goal is to find the longest sequence in $S$. If there are multiple of them, find the one that minimizes lexicographical order after multiplying terms at odd positions by $-1$.\n\nFor example, given $a = [3, 2, 3, 1]$, $S = \\\\{[1], [2], [3], [2, 1], [2, 3], [3, 1], [3, 2], [2, 3, 1], [3, 2, 1]\\\\}$. Then $[2, 3, 1]$ and $[3, 2, 1]$ would be the longest, and $[3, 2, 1]$ would be the answer since $[-3, 2, -1]$ is lexicographically smaller than $[-2, 3, -1]$.\n\nA sequence $c$ is a subsequence of a sequence $d$ if $c$ can be obtained from $d$ by the deletion of several (possibly, zero or all) elements.\n\nA sequence $c$ is lexicographically smaller than a sequence $d$ if and only if one of the following holds:\n\n * $c$ is a prefix of $d$, but $c \\ne d$; * in the first position where $c$ and $d$ differ, the sequence $c$ has a smaller element than the corresponding element in $d$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 5 \\cdot 10^4$). The description of the test cases follows.\n\nThe first line of each test case contains an integer $n$ ($1 \\le n \\le 3 \\cdot 10^5$) — the length of $a$.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le n$) — the sequence $a$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $3 \\cdot 10^5$.\n\nOutput: For each test case, output the answer in the following format:\n\nOutput an integer $m$ in the first line — the length of $b$.\n\nThen output $m$ integers $b_1, b_2, \\ldots, b_m$ in the second line — the sequence $b$.\n\nExamples:\ninput:\n4\n4\n3 2 1 3\n4\n1 1 1 1\n9\n3 2 1 3 2 1 3 2 1\n1\n1\noutput:\n3\n3 2 1\n1\n1\n3\n3 1 2\n1\n1\n\ninput:\n10\n2\n1 2\n10\n5 2 1 7 9 7 2 5 5 2\n2\n1 2\n10\n2 2 8 7 7 9 8 1 9 6\n9\n9 1 7 5 8 5 6 4 1\n3\n3 3 3\n6\n1 6 4 4 6 5\n6\n3 4 4 5 3 3\n10\n4 1 4 5 4 5 10 1 5 1\n7\n1 2 1 3 2 4 6\noutput:\n2\n1 2\n5\n5 1 9 7 2\n2\n1 2\n6\n2 7 9 8 1 6\n7\n9 1 7 5 8 6 4\n1\n3\n4\n1 4 6 5\n3\n4 5 3\n4\n5 4 10 1\n5\n2 1 3 4 6\n\nNote: In the first example, $S = \\\\{[1], [2], [3], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2], [2, 1, 3], [3, 2, 1]\\\\}$. Among them, $[2, 1, 3]$ and $[3, 2, 1]$ are the longest and $[-3, 2, -1]$ is lexicographical smaller than $[-2, 1, -3]$, so $[3, 2, 1]$ is the answer.\n\nIn the second example, $S = \\\\{[1]\\\\}$, so $[1]$ is the answer.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2001D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Set\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are given a positive integer $k$ and a set $S$ of all integers from $l$ to $r$ (inclusive).\n\nYou can perform the following two-step operation any number of times (possibly zero):\n\n 1. First, choose a number $x$ from the set $S$, such that there are at least $k$ multiples of $x$ in $S$ (including $x$ itself); 2. Then, remove $x$ from $S$ (note that nothing else is removed).\n\nFind the maximum possible number of operations that can be performed.\n\nInput: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\\le t\\le 10^4$) — the number of test cases. The description of test cases follows.\n\nThe only line of each test case contains three integers $l$, $r$, and $k$ ($1\\le l\\le r\\leq 10^9$, $1\\leq k\\le r-l+1$) — the minimum integer in $S$, the maximum integer in $S$, and the parameter $k$.\n\nOutput: For each test case, output a single integer — the maximum possible number of operations that can be performed.\n\nExamples:\ninput:\n8\n3 9 2\n4 9 1\n7 9 2\n2 10 2\n154 220 2\n147 294 2\n998 24435 3\n1 1000000000 2\noutput:\n2\n6\n0\n4\n0\n1\n7148\n500000000\n\nNote: In the first test case, initially, $S = \\\\{3,4,5,6,7,8,9\\\\}$. One possible optimal sequence of operations is:\n\n 1. Choose $x = 4$ for the first operation, since there are two multiples of $4$ in $S$: $4$ and $8$. $S$ becomes equal to $\\\\{3,5,6,7,8,9\\\\}$; 2. Choose $x = 3$ for the second operation, since there are three multiples of $3$ in $S$: $3$, $6$, and $9$. $S$ becomes equal to $\\\\{5,6,7,8,9\\\\}$. \n\nIn the second test case, initially, $S=\\\\{4,5,6,7,8,9\\\\}$. One possible optimal sequence of operations is:\n\n 1. Choose $x = 5$, $S$ becomes equal to $\\\\{4,6,7,8,9\\\\}$; 2. Choose $x = 6$, $S$ becomes equal to $\\\\{4,7,8,9\\\\}$; 3. Choose $x = 4$, $S$ becomes equal to $\\\\{7,8,9\\\\}$; 4. Choose $x = 8$, $S$ becomes equal to $\\\\{7,9\\\\}$; 5. Choose $x = 7$, $S$ becomes equal to $\\\\{9\\\\}$; 6. Choose $x = 9$, $S$ becomes equal to $\\\\{\\\\}$. \n\nIn the third test case, initially, $S=\\\\{7,8,9\\\\}$. For each $x$ in $S$, no multiple of $x$ other than $x$ itself can be found in $S$. Since $k = 2$, you can perform no operations.\n\nIn the fourth test case, initially, $S=\\\\{2,3,4,5,6,7,8,9,10\\\\}$. One possible optimal sequence of operations is:\n\n 1. Choose $x = 2$, $S$ becomes equal to $\\\\{3,4,5,6,7,8,9,10\\\\}$; 2. Choose $x = 4$, $S$ becomes equal to $\\\\{3,5,6,7,8,9,10\\\\}$; 3. Choose $x = 3$, $S$ becomes equal to $\\\\{5,6,7,8,9,10\\\\}$; 4. Choose $x = 5$, $S$ becomes equal to $\\\\{6,7,8,9,10\\\\}$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2029A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: All Pairs Segments\ntime_limit_ms: 1500\nmemory_limit_mb: 256\nDescription: [Shirobon - FOX](https://soundcloud.com/shirobon/fox?in=mart_207/sets/fav)\n\n⠀\n\nYou are given $n$ points on the $x$ axis, at increasing positive integer coordinates $x_1 < x_2 < \\ldots < x_n$.\n\nFor each pair $(i, j)$ with $1 \\leq i < j \\leq n$, you draw the segment $[x_i, x_j]$. The segments are closed, i.e., a segment $[a, b]$ contains the points $a, a+1, \\ldots, b$.\n\nYou are given $q$ queries. In the $i$-th query, you are given a positive integer $k_i$, and you have to determine how many points with integer coordinates are contained in exactly $k_i$ segments.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^4$). The description of the test cases follows.\n\nThe first line of each test case contains two integers $n$, $q$ ($2 \\le n \\le 10^5$, $1 \\le q \\le 10^5$) — the number of points and the number of queries.\n\nThe second line of each test case contains $n$ integers $x_1, x_2, \\ldots, x_n$ ($1 \\leq x_1 < x_2 < \\ldots < x_n \\leq 10^9$) — the coordinates of the $n$ points.\n\nThe third line of each test case contains $q$ integers $k_1, k_2, \\ldots, k_q$ ($1 \\leq k_i \\leq 10^{18}$) — the parameters of the $q$ queries.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$, and the sum of $q$ over all test cases does not exceed $10^5$.\n\nOutput: For each test case, output a single line with $q$ integers: the $i$-th integer is the answer to the $i$-th query.\n\nExamples:\ninput:\n3\n2 2\n101 200\n2 1\n6 15\n1 2 3 5 6 7\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n5 8\n254618033 265675151 461318786 557391198 848083778\n6 9 15 10 6 9 4 4294967300\noutput:\n0 100 \n0 0 0 0 2 0 0 0 3 0 2 0 0 0 0 \n291716045 0 0 0 291716045 0 301749698 0\n\nNote: In the first example, you only draw the segment $[101, 200]$. No point is contained in exactly $2$ segments, and the $100$ points $101, 102, \\ldots, 200$ are contained in exactly $1$ segment.\n\nIn the second example, you draw $15$ segments: $[1, 2], [1, 3], [1, 5], [1, 6], [1, 7], [2, 3], [2, 5], [2, 6], [2, 7], [3, 5], [3, 6], [3, 7], [5, 6], [5, 7], [6, 7]$. Points $1, 7$ are contained in exactly $5$ segments; points $2, 4, 6$ are contained in exactly $9$ segments; points $3, 5$ are contained in exactly $11$ segments.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2019B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Splittable Permutations\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Initially, we had one array, which was a permutation of size $n$ (an array of size $n$ where each integer from $1$ to $n$ appears exactly once).\n\nWe performed $q$ operations. During the $i$-th operation, we did the following:\n\n * choose any array we have with at least $2$ elements; * split it into two non-empty arrays (prefix and suffix); * write two integers $l_i$ and $r_i$, where $l_i$ is the maximum element in the left part which we get after the split, and $r_i$ is the maximum element in the right part; * remove the array we've chosen from the pool of arrays we can use, and add the two resulting parts into the pool. \n\nFor example, suppose the initial array was $[6, 3, 4, 1, 2, 5]$, and we performed the following operations:\n\n 1. choose the array $[6, 3, 4, 1, 2, 5]$ and split it into $[6, 3]$ and $[4, 1, 2, 5]$. Then we write $l_1 = 6$ and $r_1 = 5$, and the arrays we have are $[6, 3]$ and $[4, 1, 2, 5]$; 2. choose the array $[4, 1, 2, 5]$ and split it into $[4, 1, 2]$ and $[5]$. Then we write $l_2 = 4$ and $r_2 = 5$, and the arrays we have are $[6, 3]$, $[4, 1, 2]$ and $[5]$; 3. choose the array $[4, 1, 2]$ and split it into $[4]$ and $[1, 2]$. Then we write $l_3 = 4$ and $r_3 = 2$, and the arrays we have are $[6, 3]$, $[4]$, $[1, 2]$ and $[5]$. \n\nYou are given two integers $n$ and $q$, and two sequences $[l_1, l_2, \\dots, l_q]$ and $[r_1, r_2, \\dots, r_q]$. A permutation of size $n$ is called valid if we can perform $q$ operations and produce the given sequences $[l_1, l_2, \\dots, l_q]$ and $[r_1, r_2, \\dots, r_q]$.\n\nCalculate the number of valid permutations.\n\nInput: The first line contains two integers $n$ and $q$ ($1 \\le q < n \\le 3 \\cdot 10^5$).\n\nThe second line contains $q$ integers $l_1, l_2, \\dots, l_q$ ($1 \\le l_i \\le n$).\n\nThe third line contains $q$ integers $r_1, r_2, \\dots, r_q$ ($1 \\le r_i \\le n$).\n\nAdditional constraint on the input: there exists at least one permutation which can produce the given sequences $[l_1, l_2, \\dots, l_q]$ and $[r_1, r_2, \\dots, r_q]$.\n\nOutput: Print one integer — the number of valid permutations, taken modulo $998244353$.\n\nExamples:\ninput:\n6 3\n6 4 4\n5 5 2\noutput:\n30\n\ninput:\n10 1\n10\n9\noutput:\n1814400\n\ninput:\n4 1\n2\n4\noutput:\n8\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1976E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Binomial Coefficients, Kind Of\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Recently, akshiM met a task that needed binomial coefficients to solve. He wrote a code he usually does that looked like this:\n\n for (int n = 0; n < N; n++) { // loop over n from 0 to N-1 (inclusive) C[n][0] = 1; C[n][n] = 1; for (int k = 1; k < n; k++) // loop over k from 1 to n-1 (inclusive) C[n][k] = C[n][k - 1] + C[n - 1][k - 1]; } \n\nUnfortunately, he made an error, since the right formula is the following:\n\n C[n][k] = C[n - 1][k] + C[n - 1][k - 1] \n\nBut his team member keblidA is interested in values that were produced using the wrong formula. Please help him to calculate these coefficients for $t$ various pairs $(n_i, k_i)$. Note that they should be calculated according to the first (wrong) formula.\n\nSince values $C[n_i][k_i]$ may be too large, print them modulo $10^9 + 7$.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 10^5$) — the number of pairs. Next, $t$ pairs are written in two lines.\n\nThe second line contains $t$ integers $n_1, n_2, \\dots, n_t$ ($2 \\le n_i \\le 10^5$).\n\nThe third line contains $t$ integers $k_1, k_2, \\dots, k_t$ ($1 \\le k_i < n_i$).\n\nOutput: Print $t$ integers $C[n_i][k_i]$ modulo $10^9 + 7$.\n\nExamples:\ninput:\n7\n2 5 5 100000 100000 100000 100000\n1 2 3 1 33333 66666 99999\noutput:\n2\n4\n8\n2\n326186014\n984426998\n303861760\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2025B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Turtle and Three Sequences\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: Piggy gives Turtle three sequences $a_1, a_2, \\ldots, a_n$, $b_1, b_2, \\ldots, b_n$, and $c_1, c_2, \\ldots, c_n$.\n\nTurtle will choose a subsequence of $1, 2, \\ldots, n$ of length $m$, let it be $p_1, p_2, \\ldots, p_m$. The subsequence should satisfy the following conditions:\n\n * $a_{p_1} \\le a_{p_2} \\le \\cdots \\le a_{p_m}$; * All $b_{p_i}$ for all indices $i$ are pairwise distinct, i.e., there don't exist two different indices $i$, $j$ such that $b_{p_i} = b_{p_j}$. \n\nHelp him find the maximum value of $\\sum\\limits_{i = 1}^m c_{p_i}$, or tell him that it is impossible to choose a subsequence of length $m$ that satisfies the conditions above.\n\nRecall that a sequence $a$ is a subsequence of a sequence $b$ if $a$ can be obtained from $b$ by the deletion of several (possibly, zero or all) elements.\n\nInput: The first line contains two integers $n$ and $m$ ($1 \\le n \\le 3000$, $1 \\le m \\le 5$) — the lengths of the three sequences and the required length of the subsequence.\n\nThe second line contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le n$) — the elements of the sequence $a$.\n\nThe third line contains $n$ integers $b_1, b_2, \\ldots, b_n$ ($1 \\le b_i \\le n$) — the elements of the sequence $b$.\n\nThe fourth line contains $n$ integers $c_1, c_2, \\ldots, c_n$ ($1 \\le c_i \\le 10^4$) — the elements of the sequence $c$.\n\nOutput: Output a single integer — the maximum value of $\\sum\\limits_{i = 1}^m c_{p_i}$. If it is impossible to choose a subsequence of length $m$ that satisfies the conditions above, output $-1$.\n\nExamples:\ninput:\n4 2\n2 3 4 2\n1 3 3 2\n1 4 2 3\noutput:\n5\n\ninput:\n7 3\n1 4 5 2 3 6 7\n1 2 2 1 1 3 2\n1 5 6 7 3 2 4\noutput:\n13\n\ninput:\n5 3\n1 2 3 4 5\n1 1 2 1 2\n5 4 3 2 1\noutput:\n-1\n\nNote: In the first example, we can choose $p = [1, 2]$, then $c_{p_1} + c_{p_2} = 1 + 4 = 5$. We can't choose $p = [2, 4]$ since $a_2 > a_4$, violating the first condition. We can't choose $p = [2, 3]$ either since $b_2 = b_3$, violating the second condition. We can choose $p = [1, 4]$, but $c_1 + c_4 = 4$, which isn't maximum.\n\nIn the second example, we can choose $p = [4, 6, 7]$.\n\nIn the third example, it is impossible to choose a subsequence of length $3$ that satisfies both of the conditions.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2003F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Swap Dilemma\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Given two arrays of distinct positive integers $a$ and $b$ of length $n$, we would like to make both the arrays the same. Two arrays $x$ and $y$ of length $k$ are said to be the same when for all $1 \\le i \\le k$, $x_i = y_i$.\n\nNow in one move, you can choose some index $l$ and $r$ in $a$ ($l \\le r$) and swap $a_l$ and $a_r$, then choose some $p$ and $q$ ($p \\le q$) in $b$ such that $r-l=q-p$ and swap $b_p$ and $b_q$.\n\nIs it possible to make both arrays the same?\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 2 \\cdot 10^4$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 10^5$) — the length of the arrays $a$ and $b$.\n\nThe second line of each test case contains $n$ distinct integers $a_1,a_2,a_3,\\ldots,a_n$ ($1 \\le a_i \\le 2 \\cdot 10^5$) — the integers in the array $a$.\n\nThe third line of each test case contains $n$ distinct integers $b_1,b_2,b_3,\\ldots,b_n$ ($1 \\le b_i \\le 2 \\cdot 10^5$) — the integers in the array $b$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.\n\nOutput: For each testcase, print \"YES\" if the arrays $a$ and $b$ can be made the same. Otherwise, print \"NO\". can output the answer in any case (upper or lower). For example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will be recognized as positive responses.\n\nExamples:\ninput:\n6\n4\n1 2 3 4\n1 2 3 4\n5\n1 3 4 2 5\n7 1 2 5 4\n4\n1 2 3 4\n4 3 2 1\n3\n1 2 3\n1 3 2\n5\n1 5 7 1000 4\n4 1 7 5 1000\n3\n1 4 2\n1 3 2\noutput:\nYES\nNO\nYES\nNO\nNO\nNO\n\nNote: In the first testcase, you don't need to perform any operations since the arrays are same.\n\nIn the second testcase, it can be proven there exists no way to make the arrays same.\n\nIn the third testcase, one of the ways to make the arrays same is to first choose $l=1$, $r=3$, $p=1$, $q=3$ then choose $l=1$, $r=2$, $p=3$, $q=4$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1983D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Diagonals\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Vitaly503 is given a checkered board with a side of $n$ and $k$ chips. He realized that all these $k$ chips need to be placed on the cells of the board (no more than one chip can be placed on a single cell).\n\nLet's denote the cell in the $i$-th row and $j$-th column as $(i ,j)$. A diagonal is the set of cells for which the value $i + j$ is the same. For example, cells $(3, 1)$, $(2, 2)$, and $(1, 3)$ lie on the same diagonal, but $(1, 2)$ and $(2, 3)$ do not. A diagonal is called occupied if it contains at least one chip.\n\nDetermine what is the minimum possible number of occupied diagonals among all placements of $k$ chips.\n\nInput: Each test consists of several sets of input data. The first line contains a single integer $t$ ($1 \\le t \\le 500$) — the number of sets of input data. Then follow the descriptions of the sets of input data.\n\nThe only line of each set of input data contains two integers $n$, $k$ ($1 \\le n \\le 100, 0 \\le k \\le n^2$) — the side of the checkered board and the number of available chips, respectively.\n\nOutput: For each set of input data, output a single integer — the minimum number of occupied diagonals with at least one chip that he can get after placing all $k$ chips.\n\nExamples:\ninput:\n7\n1 0\n2 2\n2 3\n2 4\n10 50\n100 239\n3 9\noutput:\n0\n1\n2\n3\n6\n3\n5\n\nNote: In the first test case, there are no chips, so 0 diagonals will be occupied. In the second test case, both chips can be placed on diagonal $(2, 1), (1, 2)$, so the answer is 1. In the third test case, 3 chips can't be placed on one diagonal, but placing them on $(1, 2), (2, 1), (1, 1)$ makes 2 diagonals occupied. In the 7th test case, chips will occupy all 5 diagonals in any valid placing.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1995A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Find the Car\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: Timur is in a car traveling on the number line from point $0$ to point $n$. The car starts moving from point $0$ at minute $0$.\n\nThere are $k+1$ signs on the line at points $0, a_1, a_2, \\dots, a_k$, and Timur knows that the car will arrive there at minutes $0, b_1, b_2, \\dots, b_k$, respectively. The sequences $a$ and $b$ are strictly increasing with $a_k = n$.\n\n\n\nBetween any two adjacent signs, the car travels with a constant speed. Timur has $q$ queries: each query will be an integer $d$, and Timur wants you to output how many minutes it takes the car to reach point $d$, rounded down to the nearest integer.\n\nInput: The first line contains a single integer $t$ ($1 \\leq t \\leq 10^4$) — the number of test cases.\n\nThe first line of each test case contains three integers $n$, $k$, and $q$, ($k \\leq n \\leq 10^9$; $1 \\leq k, q \\leq 10^5$) — the final destination, the number of points Timur knows the time for, and the number of queries respectively.\n\nThe second line of each test case contains $k$ integers $a_i$ ($1 \\leq a_i \\leq n$; $a_i < a_{i+1}$ for every $1 \\leq i \\leq k-1$; $a_k = n$).\n\nThe third line of each test case contains $k$ integers $b_i$ ($1 \\leq b_i \\leq 10^9$; $b_i < b_{i+1}$ for every $1 \\leq i \\leq k-1$).\n\nEach of the following $q$ lines contains a single integer $d$ ($0 \\leq d \\leq n$) — the distance that Timur asks the minutes passed for.\n\nThe sum of $k$ over all test cases doesn't exceed $10^5$, and the sum of $q$ over all test cases doesn't exceed $10^5$.\n\nOutput: For each query, output a single integer — the number of minutes passed until the car reaches the point $d$, rounded down.\n\nExamples:\ninput:\n4\n10 1 3\n10\n10\n0\n6\n7\n10 2 4\n4 10\n4 7\n6\n4\n2\n7\n1000000000 1 1\n1000000000\n1000000000\n99999999\n6 1 3\n6\n5\n2\n6\n5\noutput:\n0 6 7 \n5 4 2 5 \n99999999 \n1 5 4\n\nNote: For the first test case, the car goes from point $0$ to point $10$ in $10$ minutes, so the speed is $1$ unit per minute and:\n\n * At point $0$, the time will be $0$ minutes. * At point $6$, the time will be $6$ minutes. * At point $7$, the time will be $7$ minutes. \n\nFor the second test case, between points $0$ and $4$, the car travels at a speed of $1$ unit per minute and between $4$ and $10$ with a speed of $2$ units per minute and:\n\n * At point $6$, the time will be $5$ minutes. * At point $4$, the time will be $4$ minutes. * At point $2$, the time will be $2$ minutes. * At point $7$, the time will be $5.5$ minutes, so the answer is $5$. \n\nFor the fourth test case, the car travels with $1.2$ units per minute, so the answers to the queries are:\n\n * At point $2$, the time will be $1.66\\dots$ minutes, so the answer is $1$. * At point $6$, the time will be $5$ minutes. * At point $5$, the time will be $4.16\\dots$ minutes, so the answer is $4$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "1971E",
"task_type": "TestCase-Eval-Task1"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.