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: Deterministic Heap (Easy Version)\ntime_limit_ms: 3000\nmemory_limit_mb: 512\nDescription: This is the easy version of the problem. The difference between the two versions is the definition of deterministic max-heap, time limit, and constraints on $n$ and $t$. You can make hacks only if both versions of the problem are solved.\n\nConsider a perfect binary tree with size $2^n - 1$, with nodes numbered from $1$ to $2^n-1$ and rooted at $1$. For each vertex $v$ ($1 \\le v \\le 2^{n - 1} - 1$), vertex $2v$ is its left child and vertex $2v + 1$ is its right child. Each node $v$ also has a value $a_v$ assigned to it.\n\nDefine the operation $\\mathrm{pop}$ as follows:\n\n 1. initialize variable $v$ as $1$; 2. repeat the following process until vertex $v$ is a leaf (i.e. until $2^{n - 1} \\le v \\le 2^n - 1$); 1. among the children of $v$, choose the one with the larger value on it and denote such vertex as $x$; if the values on them are equal (i.e. $a_{2v} = a_{2v + 1}$), you can choose any of them; 2. assign $a_x$ to $a_v$ (i.e. $a_v := a_x$); 3. assign $x$ to $v$ (i.e. $v := x$); 3. assign $-1$ to $a_v$ (i.e. $a_v := -1$). \n\nThen we say the $\\mathrm{pop}$ operation is deterministic if there is a unique way to do such operation. In other words, $a_{2v} \\neq a_{2v + 1}$ would hold whenever choosing between them.\n\nA binary tree is called a max-heap if for every vertex $v$ ($1 \\le v \\le 2^{n - 1} - 1$), both $a_v \\ge a_{2v}$ and $a_v \\ge a_{2v + 1}$ hold.\n\nA max-heap is deterministic if the $\\mathrm{pop}$ operation is deterministic to the heap when we do it for the first time.\n\nInitially, $a_v := 0$ for every vertex $v$ ($1 \\le v \\le 2^n - 1$), and your goal is to count the number of different deterministic max- heaps produced by applying the following operation $\\mathrm{add}$ exactly $k$ times:\n\n * Choose an integer $v$ ($1 \\le v \\le 2^n - 1$) and, for every vertex $x$ on the path between $1$ and $v$, add $1$ to $a_x$. \n\nTwo heaps are considered different if there is a node which has different values in the heaps.\n\nSince the answer might be large, print it modulo $p$.\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 three integers $n, k, p$ ($1 \\le n, k \\le 500$, $10^8 \\le p \\le 10^9$, $p$ is a prime).\n\nIt is guaranteed that the sum of $n$ and the sum of $k$ over all test cases does not exceed $500$.\n\nOutput: For each test case, output a single line containing an integer: the number of different deterministic max-heaps produced by applying the aforementioned operation $\\mathrm{add}$ exactly $k$ times, modulo $p$.\n\nExamples:\ninput:\n7\n1 13 998244353\n2 1 998244353\n3 2 998244853\n3 3 998244353\n3 4 100000037\n4 2 100000039\n4 3 100000037\noutput:\n1\n2\n12\n52\n124\n32\n304\n\ninput:\n1\n500 500 100000007\noutput:\n76297230\n\ninput:\n6\n87 63 100000037\n77 77 100000039\n100 200 998244353\n200 100 998244353\n32 59 998244853\n1 1 998244353\noutput:\n26831232\n94573603\n37147649\n847564946\n727060898\n1\n\nNote: For the first testcase, there is only one way to generate $a$, and such sequence is a deterministic max-heap, so the answer is $1$.\n\nFor the second testcase, if we choose $v = 1$ and do the operation, we would have $a = [1, 0, 0]$, and since $a_2 = a_3$, we can choose either of them when doing the first $\\mathrm{pop}$ operation, so such heap is not a deterministic max-heap.\n\nAnd if we choose $v = 2$, we would have $a = [1, 1, 0]$, during the first $\\mathrm{pop}$, the following would happen:\n\n * initialize $v$ as $1$ * since $a_{2v} > a_{2v + 1}$, choose $2v$ as $x$, then $x = 2$ * assign $a_x$ to $a_v$, then $a = [1, 1, 0]$ * assign $x$ to $v$, then $v = 2$ * since $v$ is a leaf, assign $-1$ to $a_v$, then $a = [1, -1, 0]$ \n\nSince the first $\\mathrm{pop}$ operation is deterministic, this is a deterministic max-heap. Also, if we choose $v = 3$, $a$ would be a deterministic max-heap, 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": "2001E1", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Coin Games\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: There are $n$ coins on the table forming a circle, and each coin is either facing up or facing down. Alice and Bob take turns to play the following game, and Alice goes first.\n\nIn each operation, the player chooses a facing-up coin, removes the coin, and flips the two coins that are adjacent to it. If (before the operation) there are only two coins left, then one will be removed and the other won't be flipped (as it would be flipped twice). If (before the operation) there is only one coin left, no coins will be flipped. If (before the operation) there are no facing-up coins, the player loses.\n\nDecide who will win the game if they both play optimally. It can be proved that the game will end in a finite number of operations, and one of them will win.\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 only one positive integer $n$ ($1 \\leq n \\leq 100$), representing the number of the coins.\n\nA string $s$ of length $n$ follows on the second line of each test case, containing only \"U\" and \"D\", representing that each coin is facing up or facing down.\n\nOutput: For each test case, print \"YES\" if Alice will win the game, 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:\n3\n5\nUUDUD\n5\nUDDUD\n2\nUU\noutput:\nYES\nNO\nNO\n\nNote: In the first test case, the game may go as follows.\n\n * Alice chooses the first coin and $s$ becomes \"DDUU\". * Bob chooses the last coin and $s$ becomes \"UDD\". * Alice chooses the first coin and $s$ becomes \"UU\". * Bob chooses the first coin and $s$ becomes \"U\". * Alice chooses the only coin and $s$ becomes empty. * Bob can't choose any coin now, and he loses the game. \n\nIt can be proved that Bob will always lose if they both play optimally.\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": "1972B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Permutation Problem (Simple Version)\ntime_limit_ms: 3000\nmemory_limit_mb: 128\nDescription: This is a simple version of the problem. The only difference is that in this version $n \\leq 10^5$ and the sum of $n$ for all sets of input data does not exceed $10^5$.\n\nYou are given a permutation $p$ of length $n$. Calculate the number of index pairs $1 \\leq i < j \\leq n$ such that $p_i \\cdot p_j$ is divisible by $i \\cdot j$ without remainder.\n\nA permutation is a sequence of $n$ integers, where each integer from $1$ to $n$ occurs exactly once. For example, $[1]$, $[3,5,2,1,4]$, $[1,3,2]$ are permutations, while $[2,3,2]$, $[4,3,1]$, $[0]$ are not.\n\nInput: Each test consists of multiple sets of input data. The first line contains a single integer $t$ ($1 \\leq t \\leq 10^4$) β€” the number of sets of input data. Then follows their description.\n\nThe first line of each set of input data contains a single integer $n$ ($1 \\leq n \\leq 10^5$) β€” the length of the permutation $p$.\n\nThe second line of each set of input data contains $n$ distinct integers $p_1, p_2, \\ldots, p_n$ ($1 \\leq p_i \\leq n$) β€” the permutation $p$.\n\nIt is guaranteed that the sum of $n$ for all sets of input data does not exceed $10^5$.\n\nOutput: For each set of input data, output the number of index pairs $1 \\leq i < j \\leq n$ such that $p_i \\cdot p_j$ is divisible by $i \\cdot j$ without remainder.\n\nExamples:\ninput:\n6\n1\n1\n2\n1 2\n3\n2 3 1\n5\n2 4 1 3 5\n12\n8 9 7 12 1 10 6 3 2 4 11 5\n15\n1 2 4 6 8 10 12 14 3 9 15 5 7 11 13\noutput:\n0\n1\n1\n3\n9\n3\n\nNote: In the first set of input data, there are no index pairs, as the size of the permutation is $1$.\n\nIn the second set of input data, there is one index pair $(1, 2)$ and it is valid.\n\nIn the third set of input data, the index pair $(1, 2)$ is valid.\n\nIn the fourth set of input data, the index pairs $(1, 2)$, $(1, 5)$, and $(2, 5)$ are valid.\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": "1986G1", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: The Destruction of the Universe (Hard Version)\ntime_limit_ms: 4000\nmemory_limit_mb: 512\nDescription: This is the hard version of the problem. In this version, $n \\leq 10^6$. You can only make hacks if both versions of the problem are solved.\n\nOrangutans are powerful beingsβ€”so powerful that they only need $1$ unit of time to destroy every vulnerable planet in the universe!\n\nThere are $n$ planets in the universe. Each planet has an interval of vulnerability $[l, r]$, during which it will be exposed to destruction by orangutans. Orangutans can also expand the interval of vulnerability of any planet by $1$ unit.\n\nSpecifically, suppose the expansion is performed on planet $p$ with interval of vulnerability $[l_p, r_p]$. Then, the resulting interval of vulnerability may be either $[l_p - 1, r_p]$ or $[l_p, r_p + 1]$.\n\nGiven a set of planets, orangutans can destroy all planets if the intervals of vulnerability of all planets in the set intersect at least one common point. Let the score of such a set denote the minimum number of expansions that must be performed.\n\nOrangutans are interested in the sum of scores of all non-empty subsets of the planets in the universe. As the answer can be large, output it modulo $998\\,244\\,353$.\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 10^6$) β€” the number of planets in the universe.\n\nThe following $n$ lines contain two integers $l_i$ and $r_i$ ($1 \\leq l_i \\leq r_i \\leq n$) β€” the initial interval of vulnerability of the $i$-th planet.\n\nIt is guaranteed that the sum of $n$ does not exceed $10^6$ over all test cases.\n\nOutput: For each test case, output an integer β€” the sum of scores to destroy all non- empty subsets of the planets in the universe, modulo $998\\,244\\,353$.\n\nExamples:\ninput:\n3\n3\n1 1\n2 3\n3 3\n4\n1 4\n2 3\n2 4\n1 1\n5\n1 2\n2 3\n3 4\n4 5\n1 5\noutput:\n5\n6\n24\n\nNote: In the first testcase, there are seven non-empty subsets of planets we must consider:\n\n * For each of the subsets $\\\\{[1,1]\\\\}, \\\\{[2,3]\\\\}, \\\\{[3,3]\\\\}$, the score is $0$. * For the subset $\\\\{[2,3], [3,3]\\\\}$, the score is $0$, because the point $3$ is already contained in both planets' interval of vulnerability. * For the subset $\\\\{[1,1], [2,3]\\\\}$, the score is $1$. By using one operation on changing the interval of vulnerability of the second planet to be $[1,3]$, the two planets now both have the point $1$ in their interval. * For the subset $\\\\{[1,1], [3,3]\\\\}$, the score is $2$. By using two operations on changing the interval of vulnerability of the first planet to be $[1,3]$, the two planets now both have the point $3$ in their interval. * For the subset $\\\\{[1,1], [2,3], [3,3]\\\\}$, the score is $2$. By using one operation on changing the interval of vulnerability of the first planet to be $[1,2]$ and one operation on changing the interval of vulnerability of the third planet to $[2,3]$, all three planets will have the point $2$ in their interval. \n\nThe sum of scores of all non-empty subsets of the first testcase is $0 \\cdot 4 + 1 \\cdot 1 + 2\\cdot2 = 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": "2030G2", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Splitting Items\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Alice and Bob have $n$ items they'd like to split between them, so they decided to play a game. All items have a cost, and the $i$-th item costs $a_i$. Players move in turns starting from Alice.\n\nIn each turn, the player chooses one of the remaining items and takes it. The game goes on until no items are left.\n\nLet's say that $A$ is the total cost of items taken by Alice and $B$ is the total cost of Bob's items. The resulting score of the game then will be equal to $A - B$.\n\nAlice wants to maximize the score, while Bob wants to minimize it. Both Alice and Bob will play optimally.\n\nBut the game will take place tomorrow, so today Bob can modify the costs a little. He can increase the costs $a_i$ of several (possibly none or all) items by an integer value (possibly, by the same value or by different values for each item). However, the total increase must be less than or equal to $k$. Otherwise, Alice may suspect something. Note that Bob can't decrease costs, only increase.\n\nWhat is the minimum possible score Bob can achieve?\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 5000$) β€” the number of test cases. Then $t$ cases follow.\n\nThe first line of each test case contains two integers $n$ and $k$ ($2 \\le n \\le 2 \\cdot 10^5$; $0 \\le k \\le 10^9$) β€” the number of items and the maximum total increase Bob can make.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 10^9$) β€” the initial costs of the items.\n\nIt's guaranteed that 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 minimum possible score $A - B$ after Bob increases the costs of several (possibly none or all) items.\n\nExamples:\ninput:\n4\n2 5\n1 10\n3 0\n10 15 12\n4 6\n3 1 2 4\n2 4\n6 9\noutput:\n4\n13\n0\n0\n\nNote: In the first test case, Bob can increase $a_1$ by $5$, making costs equal to $[6, 10]$. Tomorrow, Alice will take $10$ and Bob will take $6$. The total score will be equal to $10 - 6 = 4$, and it's the minimum possible.\n\nIn the second test case, Bob can't change costs. So the score will be equal to $(15 + 10) - 12 = 13$, since Alice will take $15$, Bob will take $12$, and Alice β€” $10$.\n\nIn the third test case, Bob, for example, can increase $a_1$ by $1$, $a_2$ by $3$, and $a_3$ by $2$. The total change is equal to $1 + 3 + 2 \\le 6$ and costs will be equal to $[4, 4, 4, 4]$. Obviously, the score will be equal to $(4 + 4) - (4 + 4) = 0$.\n\nIn the fourth test case, Bob can increase $a_1$ by $3$, making costs equal to $[9, 9]$. The score will be equal to $9 - 9 = 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": "2004C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: X Axis\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given three points with integer coordinates $x_1$, $x_2$, and $x_3$ on the $X$ axis ($1 \\leq x_i \\leq 10$). You can choose any point with an integer coordinate $a$ on the $X$ axis. Note that the point $a$ may coincide with $x_1$, $x_2$, or $x_3$. Let $f(a)$ be the total distance from the given points to the point $a$. Find the smallest value of $f(a)$.\n\nThe distance between points $a$ and $b$ is equal to $|a - b|$. For example, the distance between points $a = 5$ and $b = 2$ is $3$.\n\nInput: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \\leq t \\leq 10^3$) β€” the number of test cases. Then follows their descriptions.\n\nThe single line of each test case contains three integers $x_1$, $x_2$, and $x_3$ ($1 \\leq x_i \\leq 10$) β€” the coordinates of the points.\n\nOutput: For each test case, output the smallest value of $f(a)$.\n\nExamples:\ninput:\n8\n1 1 1\n1 5 9\n8 2 8\n10 9 3\n2 1 1\n2 4 1\n7 3 5\n1 9 4\noutput:\n0\n8\n6\n7\n1\n3\n4\n8\n\nNote: In the first test case, the smallest value of $f(a)$ is achieved when $a = 1$: $f(1) = |1 - 1| + |1 - 1| + |1 - 1| = 0$.\n\nIn the second test case, the smallest value of $f(a)$ is achieved when $a = 5$: $f(5) = |1 - 5| + |5 - 5| + |9 - 5| = 8$.\n\nIn the third test case, the smallest value of $f(a)$ is achieved when $a = 8$: $f(8) = |8 - 8| + |2 - 8| + |8 - 8| = 6$.\n\nIn the fourth test case, the smallest value of $f(a)$ is achieved when $a = 9$: $f(10) = |10 - 9| + |9 - 9| + |3 - 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": "1986A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Let Me Teach You a Lesson (Hard Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the hard 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 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 a single integer $n$ ($1 \\le n \\le 100\\,000$) β€” 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 $100\\,000$.\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": "1995E2", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: The Strict Teacher (Easy Version)\ntime_limit_ms: 1500\nmemory_limit_mb: 256\nDescription: This is the easy version of the problem. The only differences between the two versions are the constraints on $m$ and $q$. In this version, $m=2$ and $q=1$. 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. Note: this is the easy version, and you are given only one query.\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$, $m=2$, $q=1$) β€” 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\nOutput: For each test case, output $q$ lines, the $i$-th of them containing the answer of the $i$-th query.\n\nExamples:\ninput:\n3\n10 2 1\n1 4\n2\n8 2 1\n3 6\n1\n8 2 1\n3 6\n8\noutput:\n1\n2\n2\n\nNote: In the first example, the student can just stay at cell $2$. The teacher, initially located in cell $1$, can reach cell $2$ in one move. Therefore, the answer is $1$.\n\nIn the second example, the student should just stay at cell $1$. The teacher, initially located in cell $3$, can reach cell $1$ in two moves. Therefore, 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": "2005B1", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Kousuke's Assignment\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: After a trip with Sakurako, Kousuke was very scared because he forgot about his programming assignment. In this assignment, the teacher gave him an array $a$ of $n$ integers and asked him to calculate the number of non- overlapping segments of the array $a$, such that each segment is considered beautiful.\n\nA segment $[l,r]$ is considered beautiful if $a_l + a_{l+1} + \\dots + a_{r-1} + a_r=0$.\n\nFor a fixed array $a$, your task is to compute the maximum number of non- overlapping beautiful segments.\n\nInput: The first line of input contains the number $t$ ($1 \\le t \\le 10^4$) β€” the number of test cases. Each test case consists of $2$ lines.\n\n * The first line contains one integer $n$ ($1 \\le n \\le 10^5$) β€” the length of the array. * The second line contains $n$ integers $a_i$ ($-10^5 \\le a_i \\le 10^5$) β€” the elements of the array $a$. \n\nIt is guaranteed that the sum of $n$ across all test cases does not exceed $3\\cdot 10^5$.\n\nOutput: For each test case, output a single integer: the maximum number of non- overlapping beautiful segments.\n\nExamples:\ninput:\n3\n5\n2 1 -3 2 1\n7\n12 -4 4 43 -3 -5 8\n6\n0 -4 0 3 0 1\noutput:\n1\n2\n3\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": "2033D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Billetes MX (Hard Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: This is the hard version of the problem. In this version, it is guaranteed that $q \\leq 10^5$. 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, q \\leq 10^5$) β€” 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:\n3\n3 3 8 1\n2 1 6\n3 2 12\n1 2 6\n2 2 0\n1 3 10\n1 1 0\n2 3 12\n3 1 10\n3 3 1\n2 5 2 0\n1 1 10\n1 2 30\n2 5 0 2\n1 1 10\n1 2 30\noutput:\n1\n0\n489373567\n651321892\n769740174\n489373567\n\nNote: In the first test case of the example, we initially 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$, so the first answer is $1$. For the second query, the grid does not satisfy the condition, and thus the answer 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": "2022E2", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Connect the Dots\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: One fine evening, Alice sat down to play the classic game \"Connect the Dots\", but with a twist.\n\nTo play the game, Alice draws a straight line and marks $n$ points on it, indexed from $1$ to $n$. Initially, there are no arcs between the points, so they are all disjoint. After that, Alice performs $m$ operations of the following type:\n\n * She picks three integers $a_i$, $d_i$ ($1 \\le d_i \\le 10$), and $k_i$. * She selects points $a_i, a_i+d_i, a_i+2d_i, a_i+3d_i, \\ldots, a_i+k_i\\cdot d_i$ and connects each pair of these points with arcs. \n\nAfter performing all $m$ operations, she wants to know the number of connected components$^\\dagger$ these points form. Please help her find this number.\n\n$^\\dagger$ Two points are said to be in one connected component if there is a path between them via several (possibly zero) arcs and other points.\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 two integers $n$ and $m$ ($1 \\le n \\le 2 \\cdot 10^5$, $1 \\le m \\le 2 \\cdot 10^5$).\n\nThe $i$-th of the following $m$ lines contains three integers $a_i$, $d_i$, and $k_i$ ($1 \\le a_i \\le a_i + k_i\\cdot d_i \\le n$, $1 \\le d_i \\le 10$, $0 \\le k_i \\le n$).\n\nIt is guaranteed that both the sum of $n$ and the sum of $m$ over all test cases do not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output the number of connected components.\n\nExamples:\ninput:\n3\n10 2\n1 2 4\n2 2 4\n100 1\n19 2 4\n100 3\n1 2 5\n7 2 6\n17 2 31\noutput:\n2\n96\n61\n\nNote: In the first test case, there are $n = 10$ points. The first operation joins the points $1$, $3$, $5$, $7$, and $9$. The second operation joins the points $2$, $4$, $6$, $8$, and $10$. There are thus two connected components: $\\\\{1, 3, 5, 7, 9\\\\}$ and $\\\\{2, 4, 6, 8, 10\\\\}$.\n\nIn the second test case, there are $n = 100$ points. The only operation joins the points $19$, $21$, $23$, $25$, and $27$. Now all of them form a single connected component of size $5$. The other $95$ points form single-point connected components. Thus, the answer is $1 + 95 = 96$.\n\nIn the third test case, there are $n = 100$ points. After the operations, all odd points from $1$ to $79$ will be in one connected component of size $40$. The other $60$ points form single-point connected components. Thus, the answer is $1 + 60 = 61$.\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": "2020D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Turtle and Good Strings\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Turtle thinks a string $s$ is a good string if there exists a sequence of strings $t_1, t_2, \\ldots, t_k$ ($k$ is an arbitrary integer) such that:\n\n * $k \\ge 2$. * $s = t_1 + t_2 + \\ldots + t_k$, where $+$ represents the concatenation operation. For example, $\\texttt{abc} = \\texttt{a} + \\texttt{bc}$. * For all $1 \\le i < j \\le k$, the first character of $t_i$ isn't equal to the last character of $t_j$. \n\nTurtle is given a string $s$ consisting of lowercase Latin letters. Please tell him whether the string $s$ is a good string!\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$ ($2 \\le n \\le 100$) β€” the length of the string.\n\nThe second line of each test case contains a string $s$ of length $n$, consisting of lowercase Latin letters.\n\nOutput: For each test case, output \"YES\" if the string $s$ is a good string, 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:\n4\n2\naa\n3\naba\n4\nabcb\n12\nabcabcabcabc\noutput:\nNo\nnO\nYes\nYES\n\nNote: In the first test case, the sequence of strings $\\texttt{a}, \\texttt{a}$ satisfies the condition $s = t_1 + t_2 + \\ldots + t_k$, but the first character of $t_1$ is equal to the last character of $t_2$. It can be seen that there doesn't exist any sequence of strings which satisfies all of the conditions, so the answer is \"NO\".\n\nIn the third test case, the sequence of strings $\\texttt{ab}, \\texttt{cb}$ satisfies all of the conditions.\n\nIn the fourth test case, the sequence of strings $\\texttt{abca}, \\texttt{bcab}, \\texttt{cabc}$ satisfies all 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": "2003A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Light Switches\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: There is an apartment consisting of $n$ rooms, each with its light initially turned off.\n\nTo control the lights in these rooms, the owner of the apartment decided to install chips in the rooms so that each room has exactly one chip, and the chips are installed at different times. Specifically, these times are represented by the array $a_1, a_2, \\ldots, a_n$, where $a_i$ is the time (in minutes) at which a chip is installed in the $i$-th room.\n\nAs soon as a chip is installed, it changes the room's light status every $k$ minutes β€” it turns on the light for $k$ minutes, then turns it off for the next $k$ minutes, then turns it back on for the next $k$ minutes, and so on. In other words, the light status is changed by the chip at minute $a_i$, $a_i + k$, $a_i + 2k$, $a_i + 3k$, $\\ldots$ for the $i$-th room.\n\nWhat is the earliest moment when all rooms in the apartment have their lights turned on?\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 two integers $n$ and $k$ ($1 \\le k \\le n \\le 2 \\cdot 10^5$) β€” the number of rooms in the apartment and the period of the chips.\n\nThe second line contains $n$ distinct integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10^9$) β€” the moments when the chips are installed.\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, print a single integer β€” the answer to the question (in minutes). If there is no such moment that the lights are turned on in all the rooms, print $-1$ instead.\n\nExamples:\ninput:\n9\n4 4\n2 3 4 5\n4 3\n2 3 4 5\n4 3\n3 4 8 9\n3 3\n6 2 1\n1 1\n1\n7 5\n14 34 6 25 46 7 17\n6 5\n40 80 99 60 90 50\n6 5\n64 40 50 68 70 10\n2 1\n1 1000000000\noutput:\n5\n-1\n10\n8\n1\n47\n100\n-1\n-1\n\nNote: In the first test case, all lights will be on by the minute $5$ without any of them being turned off by the chips. The answer is $5$.\n\nIn the second test case, due to $k=3$, the $1$-st light will be on at minutes $2, 3, 4, 8, 9, 10, 14, \\ldots$; meanwhile, the $4$-th light will be on at minutes $5, 6, 7, 11, 12, 13, 17, \\ldots$. These two sequences don't have any number in common, so they will never be on at the same time.\n\nIn the third test case, it can be seen that the $1$-st and $2$-nd lights will be turned off at minutes $6$ and $7$, but the chips will turn them back on at minutes $9$ and $10$. The $3$-rd and $4$-th lights will also be on at minute $10$, so the answer is $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": "1993C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Β±1\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Bob has a grid with $3$ rows and $n$ columns, each of which contains either $a_i$ or $-a_i$ for some integer $1 \\leq i \\leq n$. For example, one possible grid for $n=4$ is shown below:\n\n$$\\begin{bmatrix} a_1 & -a_2 & -a_3 & -a_2 \\\\\\ -a_4 & a_4 & -a_1 & -a_3 \\\\\\ a_1 & a_2 & -a_2 & a_4 \\end{bmatrix}$$\n\nAlice and Bob play a game as follows:\n\n * Bob shows Alice his grid. * Alice gives Bob an array $a_1, a_2, \\dots, a_n$ of her choosing, whose elements are all $\\mathbf{-1}$ or $\\mathbf{1}$. * Bob substitutes these values into his grid to make a grid of $-1$s and $1$s. * Bob sorts the elements of each column in non-decreasing order. * Alice wins if all the elements in the middle row are $1$; otherwise, Bob wins. \n\nFor example, suppose Alice gives Bob the array $[1, -1, -1, 1]$ for the grid above. Then the following will happen (colors are added for clarity):\n\n$$\\begin{bmatrix} \\color{red}{a_1} & \\color{green}{-a_2} & \\color{blue}{-a_3} & \\color{green}{-a_2} \\\\\\ -a_4 & a_4 & \\color{red}{-a_1} & \\color{blue}{-a_3} \\\\\\ \\color{red}{a_1} & \\color{green}{a_2} & \\color{green}{-a_2} & a_4 \\end{bmatrix} \\xrightarrow{[\\color{red}{1},\\color{green}{-1},\\color{blue}{-1},1]} \\begin{bmatrix} \\color{red}{1} & \\color{green}{1} & \\color{blue}{1} & \\color{green}{1} \\\\\\ -1 & 1 & \\color{red}{-1} & \\color{blue}{1} \\\\\\ \\color{red}{1} & \\color{green}{-1} & \\color{green}{1} & 1 \\end{bmatrix} \\xrightarrow{\\text{sort each column}} \\begin{bmatrix} -1 & -1 & -1 & 1 \\\\\\ \\mathbf{1} & \\mathbf{1} & \\mathbf{1} & \\mathbf{1} \\\\\\ 1 & 1 & 1 & 1 \\\\\\ \\end{bmatrix}\\,. $$ Since the middle row is all $1$, Alice wins.\n\nGiven Bob's grid, determine whether or not Alice can choose the array $a$ to win the game.\n\nInput: The first line contains a single integer $t$ ($1 \\leq t \\leq 1000$) β€” the number of test cases.\n\nThe first line of each test case contains a single integer $n$ ($2 \\leq n \\leq 500$) β€” the number of columns of Bob's grid.\n\nThe next three lines each contain $n$ integers, the $i$-th of which contains $g_{i,1}, g_{i,2}, \\dots, g_{i,n}$ ($-n \\leq g_{i,j} \\leq n$, $g_{i,j} \\neq 0$), representing Bob's grid.\n\nIf cell $x > 0$ is in the input, that cell in Bob's grid should contain $a_x$; if $x < 0$ is in the input, that cell in Bob's grid should contain $-a_{-x}$. See the sample input and notes for a better understanding.\n\nOutput: For each test case, output \"YES\" (without quotes) if Alice can win, 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:\n4\n4\n1 -2 -3 -2\n-4 4 -1 -3\n1 2 -2 4\n2\n1 2\n-1 -2\n2 -2\n5\n1 2 3 4 5\n-2 3 -4 -5 -1\n3 -5 1 2 2\n6\n1 3 -6 2 5 2\n1 3 -2 -3 -6 -5\n-2 -1 -3 2 3 1\noutput:\nYES\nNO\nYES\nNO\n\nNote: The first test case is described in the statement.\n\nIn the second test case, Bob's grid is as follows:\n\n$$\\begin{bmatrix} a_1 & a_2 \\\\\\ -a_1 & -a_2 \\\\\\ a_2 & -a_2 \\end{bmatrix}$$\n\nFor the last column to have $1$ in the middle row when sorted, Alice must pick $a_2 = -1$. However, it is then impossible to choose $a_1$ such that the first column has $1$ in the middle when sorted. Thus, Alice cannot win.\n\nIn the third test case, Alice can pick $a = [1,1,1,1,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": "1971H", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Permutation of Rows and Columns\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: You have been given a matrix $a$ of size $n$ by $m$, containing a permutation of integers from $1$ to $n \\cdot m$.\n\nA permutation of $n$ integers is an array containing all numbers from $1$ to $n$ exactly once. For example, the arrays $[1]$, $[2, 1, 3]$, $[5, 4, 3, 2, 1]$ are permutations, while the arrays $[1, 1]$, $[100]$, $[1, 2, 4, 5]$ are not.\n\nA matrix contains a permutation if, when all its elements are written out, the resulting array is a permutation. Matrices $[[1, 2], [3, 4]]$, $[[1]]$, $[[1, 5, 3], [2, 6, 4]]$ contain permutations, while matrices $[[2]]$, $[[1, 1], [2, 2]]$, $[[1, 2], [100, 200]]$ do not.\n\nYou can perform one of the following two actions in one operation:\n\n * choose columns $c$ and $d$ ($1 \\le c, d \\le m$, $c \\ne d$) and swap these columns; * choose rows $c$ and $d$ ($1 \\le c, d \\le n$, $c \\ne d$) and swap these rows. \n\nYou can perform any number of operations.\n\nYou are given the original matrix $a$ and the matrix $b$. Your task is to determine whether it is possible to transform matrix $a$ into matrix $b$ using the given operations.\n\nInput: The first line contains an integer $t$ ($1 \\le t \\le 10^4$) β€” the number of test cases. The descriptions of the test cases follow.\n\nThe first line of each test case description contains $2$ integers $n$ and $m$ ($1 \\le n, m \\le n \\cdot m \\le 2 \\cdot 10^5$) β€” the sizes of the matrix.\n\nThe next $n$ lines contain $m$ integers $a_{ij}$ each ($1 \\le a_{ij} \\le n \\cdot m$). It is guaranteed that matrix $a$ is a permutation.\n\nThe next $n$ lines contain $m$ integers $b_{ij}$ each ($1 \\le b_{ij} \\le n \\cdot m$). It is guaranteed that matrix $b$ is a permutation.\n\nIt is guaranteed that the sum of the values $n \\cdot m$ for all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output \"YES\" if the second matrix can be obtained from the first, and \"NO\" 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:\n7\n1 1\n1\n1\n2 2\n1 2\n3 4\n4 3\n2 1\n2 2\n1 2\n3 4\n4 3\n1 2\n3 4\n1 5 9 6\n12 10 4 8\n7 11 3 2\n1 5 9 6\n12 10 4 8\n7 11 3 2\n3 3\n1 5 9\n6 4 2\n3 8 7\n9 5 1\n2 4 6\n7 8 3\n2 3\n1 2 6\n5 4 3\n6 1 2\n3 4 5\n1 5\n5 1 2 3 4\n4 2 5 1 3\noutput:\nYES\nYES\nNO\nYES\nYES\nNO\nYES\n\nNote: In the second example, the original matrix looks like this:\n\n$ \\begin{pmatrix} 1 & 2 \\\\\\ 3 & 4 \\end{pmatrix} $\n\nBy swapping rows $1$ and $2$, it becomes:\n\n$ \\begin{pmatrix} 3 & 4 \\\\\\ 1 & 2 \\end{pmatrix} $\n\nBy swapping columns $1$ and $2$, it becomes equal to matrix $b$:\n\n$ \\begin{pmatrix} 4 & 3 \\\\\\ 2 & 1 \\end{pmatrix} $\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": "1980E", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sheriff's Defense\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: \"Why, master,\" quoth Little John, taking the bags and weighing them in his hand, \"here is the chink of gold.\"\n\nThe folk hero Robin Hood has been troubling Sheriff of Nottingham greatly. Sheriff knows that Robin Hood is about to attack his camps and he wants to be prepared.\n\nSheriff of Nottingham built the camps with strategy in mind and thus there are exactly $n$ camps numbered from $1$ to $n$ and $n-1$ trails, each connecting two camps. Any camp can be reached from any other camp. Each camp $i$ has initially $a_i$ gold.\n\nAs it is now, all camps would be destroyed by Robin. Sheriff can strengthen a camp by subtracting exactly $c$ gold from each of its neighboring camps and use it to build better defenses for that camp. Strengthening a camp doesn't change its gold, only its neighbors' gold. A camp can have negative gold.\n\nAfter Robin Hood's attack, all camps that have been strengthened survive the attack, all others are destroyed.\n\nWhat's the maximum gold Sheriff can keep in his surviving camps after Robin Hood's attack if he strengthens his camps optimally?\n\nCamp $a$ is neighboring camp $b$ if and only if there exists a trail connecting $a$ and $b$. Only strengthened camps count towards the answer, as others are destroyed.\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 begins with two integers $n$, $c$ ($1 \\le n \\le 2\\cdot10^5, 1 \\le c \\le 10^9$) β€” the number of camps and the gold taken from each neighboring camp for strengthening.\n\nThe second line of each test case contains $n$ integers $a_1,a_2,\\dots,a_n$ ($-10^9 \\le a_i \\le 10^9$) β€” the initial gold of each camp.\n\nThen follow $n-1$ lines, each with integers $u$, $v$ ($1 \\le u, v \\le n$, $u \\ne v$) β€” meaning that there is a trail between $u$ and $v$.\n\nThe sum of $n$ over all test cases doesn't exceed $2\\cdot10^5$.\n\nIt is guaranteed that any camp is reachable from any other camp.\n\nOutput: Output a single integer, the maximum gold Sheriff of Nottingham can keep in his surviving camps after Robin Hood's attack.\n\nExamples:\ninput:\n5\n3 1\n2 3 1\n1 2\n2 3\n3 1\n3 6 3\n1 2\n2 3\n3 1\n-2 -3 -1\n1 2\n2 3\n6 1\n5 -4 3 6 7 3\n4 1\n5 1\n3 5\n3 6\n1 2\n8 1\n3 5 2 7 8 5 -3 -4\n7 3\n1 8\n4 3\n3 5\n7 6\n8 7\n2 1\noutput:\n3\n8\n0\n17\n26\n\nNote: In the first test case, it is optimal to strengthen the second base. The final gold at each base is $[1,3,0]$.\n\nIn the second test case, it is optimal to strengthen all bases. The final gold at each base is $[2,4,2]$.\n\nIn the third test case, it is optimal to not strengthen any base.\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": "2014F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: XOUR\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given an array $a$ consisting of $n$ nonnegative integers.\n\nYou can swap the elements at positions $i$ and $j$ if $a_i~\\mathsf{XOR}~a_j < 4$, where $\\mathsf{XOR}$ is the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).\n\nFind the lexicographically smallest array that can be made with any number of swaps.\n\nAn array $x$ is lexicographically smaller than an array $y$ if in the first position where $x$ and $y$ differ, $x_i < y_i$.\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 a single integer $n$ ($1 \\leq n \\leq 2\\cdot10^5$) β€” the length of the array.\n\nThe second line of each test case contains $n$ integers $a_i$ ($0 \\leq a_i \\leq 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 $n$ integers β€” the lexicographically smallest array that can be made with any number of swaps.\n\nExamples:\ninput:\n4\n4\n1 0 3 2\n5\n2 7 1 5 6\n8\n1 2 1 2 1 2 1 2\n4\n16 4 1 64\noutput:\n0 1 2 3 \n1 5 2 6 7 \n1 1 1 1 2 2 2 2 \n16 4 1 64\n\nNote: For the first test case, you can swap any two elements, so we can produce the sorted array.\n\nFor the second test case, you can swap $2$ and $1$ (their $\\mathsf{XOR}$ is $3$), $7$ and $5$ (their $\\mathsf{XOR}$ is $2$), and $7$ and $6$ (their $\\mathsf{XOR}$ is $1$) to get the lexicographically smallest array.\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": "1971G", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Remove Bridges\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given a rooted tree, consisting of $n$ vertices, numbered from $1$ to $n$. Vertex $1$ is the root. Additionally, the root only has one child.\n\nYou are asked to add exactly $k$ edges to the tree (possibly, multiple edges and/or edges already existing in the tree).\n\nRecall that a bridge is such an edge that, after you remove it, the number of connected components in the graph increases. So, initially, all edges of the tree are bridges.\n\nAfter $k$ edges are added, some original edges of the tree are still bridges and some are not anymore. You want to satisfy two conditions:\n\n * for every bridge, all tree edges in the subtree of the lower vertex of that bridge should also be bridges; * the number of bridges is as small as possible. \n\nSolve the task for all values of $k$ from $1$ to $n - 1$ and output the smallest number of bridges.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 10^4$) β€” the number of testcases.\n\nThe first line of each testcase contains a single integer $n$ ($2 \\le n \\le 3 \\cdot 10^5$) β€” the number of vertices of the tree.\n\nEach of the next $n - 1$ lines contain two integers $v$ and $u$ ($1 \\le v, u \\le n$) β€” the description of the edges of the tree. It's guaranteed that the given edges form a valid tree.\n\nAdditional constraint on the input: the root (vertex $1$) has exactly one child.\n\nThe sum of $n$ over all testcases doesn't exceed $3 \\cdot 10^5$.\n\nOutput: For each testcase, print $n - 1$ integers. For each $k$ from $1$ to $n - 1$ print the smallest number of bridges that can be left after you add $k$ edges to the tree.\n\nExamples:\ninput:\n4\n2\n1 2\n12\n4 10\n5 12\n12 11\n3 6\n9 6\n1 6\n12 7\n11 6\n2 11\n10 9\n10 8\n8\n1 2\n2 3\n2 4\n3 5\n3 6\n4 7\n4 8\n5\n1 2\n2 3\n3 4\n4 5\noutput:\n0 \n7 3 1 0 0 0 0 0 0 0 0 \n4 1 0 0 0 0 0 \n0 0 0 0\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": "1976F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Bit Game (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 need to output the winner of the game in this version, and the number of stones in each pile are fixed. You must solve both versions to be able to hack.\n\nAlice and Bob are playing a familiar game where they take turns removing stones from $n$ piles. Initially, there are $x_i$ stones in the $i$-th pile, and it has an associated value $a_i$. A player can take $d$ stones away from the $i$-th pile if and only if both of the following conditions are met:\n\n * $1 \\le d \\le a_i$, and * $x \\, \\& \\, d = d$, where $x$ is the current number of stones in the $i$-th pile and $\\&$ denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND). \n\nThe player who cannot make a move loses, and Alice goes first.\n\nYou're given the $a_i$ and $x_i$ values for each pile, please determine who will win the game if both players play 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 $n$ ($1 \\le n \\le 10^4$) β€” the number of piles.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i < 2^{30}$).\n\nThe third line of each test case contains $n$ integers $x_1, x_2, \\ldots, x_n$ ($1 \\le x_i < 2^{30}$).\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^4$.\n\nOutput: Print a single line with the winner's name. If Alice wins, print \"Alice\", otherwise print \"Bob\" (without quotes).\n\nExamples:\ninput:\n7\n2\n1 6\n10 7\n3\n10 8 15\n25 4 14\n4\n8 32 65 64\n7 45 126 94\n3\n20 40 1\n23 55 1\n5\n12345 9876 86419 8641 1\n6789 54321 7532 97532 1\n2\n20 64\n44 61\n3\n57 109 55\n69 90 85\noutput:\nBob\nBob\nBob\nBob\nBob\nAlice\nAlice\n\nNote: In the first test case, neither player can take any stones from the first pile since there is no value of $d$ satisfying the conditions. For the second pile, to begin with, Alice can remove between $1$ and $6$ stones. No matter which move Alice performs, Bob can remove the rest of the stones on his turn. After Bob's move, there are no more moves that Alice can perform, so Bob wins.\n\nIn the second test case, here is one example of how the game might go. Alice moves first, and she decides to remove from the first pile. She cannot take $17$ stones, because $17 > 10$, which fails the first condition. She cannot take $10$ stones, because $25 \\, \\& \\, 10 = 8$ which fails the second condition. One option is to take $9$ stones; now the pile has $16$ stones left. On Bob's turn he decides to take stones from the second pile; the only option here is to take all $4$. Now, no more stones can be taken from either of the first two piles, so Alice must take some stones from the last pile. She decides to take $12$ stones, and Bob then follows by taking the last $2$ stones on that pile. Since Alice now has no legal moves left, Bob wins. It can be shown that no matter which strategy Alice follows, Bob will always be able to win if he plays optimally.\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": "2027E1", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: New Rating\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Hello, Codeforces Forcescode!\n\n\n\nKevin used to be a participant of Codeforces. Recently, the KDOI Team has developed a new Online Judge called Forcescode.\n\nKevin has participated in $n$ contests on Forcescode. In the $i$-th contest, his performance rating is $a_i$.\n\nNow he has hacked into the backend of Forcescode and will select an interval $[l,r]$ ($1\\le l\\le r\\le n$), then skip all of the contests in this interval. After that, his rating will be recalculated in the following way:\n\n * Initially, his rating is $x=0$; * For each $1\\le i\\le n$, after the $i$-th contest, * If $l\\le i\\le r$, this contest will be skipped, and the rating will remain unchanged; * Otherwise, his rating will be updated according to the following rules: * If $a_i>x$, his rating $x$ will increase by $1$; * If $a_i=x$, his rating $x$ will remain unchanged; * If $a_i<x$, his rating $x$ will decrease by $1$. \n\nYou have to help Kevin to find his maximum possible rating after the recalculation if he chooses the interval $[l,r]$ optimally. Note that Kevin has to skip at least one contest.\n\nInput: Each test contains multiple test cases. The first line of the input contains a single integer $t$ ($1\\le t\\le 5\\cdot 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$ ($1\\le n\\le 3\\cdot 10^5$) β€” the number of contests.\n\nThe second line contains $n$ integers $a_1,a_2,\\ldots,a_n$ ($1\\le a_i\\le n$) β€” the performance ratings in the contests.\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 possible rating after the recalculation if Kevin chooses the interval optimally.\n\nExamples:\ninput:\n5\n6\n1 2 3 4 5 6\n7\n1 2 1 1 1 3 4\n1\n1\n9\n9 9 8 2 4 4 3 5 3\n10\n1 2 3 4 1 3 2 1 1 10\noutput:\n5\n4\n0\n4\n5\n\nNote: In the first test case, Kevin must skip at least one contest. If he chooses any interval of length $1$, his rating after the recalculation will be equal to $5$.\n\nIn the second test case, Kevin's optimal choice is to select the interval $[3,5]$. During the recalculation, his rating changes as follows:\n\n$$ 0 \\xrightarrow{a_1=1} 1 \\xrightarrow{a_2=2} 2 \\xrightarrow{\\mathtt{skip}} 2 \\xrightarrow{\\mathtt{skip}} 2 \\xrightarrow{\\mathtt{skip}} 2 \\xrightarrow{a_6=3} 3 \\xrightarrow{a_7=4} 4 $$\n\nIn the third test case, Kevin must skip the only contest, so his rating will remain at the initial value of $0$.\n\nIn the fourth test case, Kevin's optimal choice is to select the interval $[7,9]$. During the recalculation, his rating changes as follows:\n\n$$ 0 \\xrightarrow{a_1=9} 1 \\xrightarrow{a_2=9} 2 \\xrightarrow{a_3=8} 3 \\xrightarrow{a_4=2} 2 \\xrightarrow{a_5=4} 3 \\xrightarrow{a_6=4} 4 \\xrightarrow{\\mathtt{skip}} 4 \\xrightarrow{\\mathtt{skip}} 4 \\xrightarrow{\\mathtt{skip}} 4 $$\n\nIn the fifth test case, Kevin's optimal choice is to select the interval $[5,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": "2029C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Triangle Formation\ntime_limit_ms: 5000\nmemory_limit_mb: 256\nDescription: You are given $n$ sticks, numbered from $1$ to $n$. The length of the $i$-th stick is $a_i$.\n\nYou need to answer $q$ queries. In each query, you are given two integers $l$ and $r$ ($1 \\le l < r \\le n$, $r - l + 1 \\ge 6$). Determine whether it is possible to choose $6$ distinct sticks from the sticks numbered $l$ to $r$, to form $2$ non-degenerate triangles$^{\\text{βˆ—}}$.\n\n$^{\\text{βˆ—}}$A triangle with side lengths $a$, $b$, and $c$ is called non-degenerate if:\n\n * $a < b + c$, * $b < a + c$, and * $c < a + b$.\n\nInput: The first line contains two integers $n$ and $q$ ($6 \\le n \\le 10^5$, $1 \\le q \\le 10^5$) β€” the number of sticks and the number of queries respectively.\n\nThe second line contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10^9$) β€” $a_i$ denotes the length of the $i$-th stick.\n\nEach of the following $q$ lines contains two integers $l$ and $r$ ($1 \\le l < r \\le n$, $r - l + 1 \\ge 6$) β€” the parameters of each query.\n\nOutput: For each query, output \"YES\" (without quotes) if it is possible to form $2$ triangles, 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:\n10 5\n5 2 2 10 4 10 6 1 5 3\n1 6\n2 7\n2 8\n5 10\n4 10\noutput:\nYES\nNO\nYES\nNO\nYES\n\nNote: In the first query, the lengths of the sticks are $[5, 2, 2, 10, 4, 10]$. Two sets of sticks $[2, 4, 5]$ and $[2, 10, 10]$ can be selected to form $2$ non-degenerate triangles.\n\nIn the second query, the lengths of the sticks are $[2, 2, 10, 4, 10, 6]$. It can be shown that it is impossible to form $2$ non-degenerate triangles.\n\nIn the third query, the lengths of the sticks are $[2, 2, 10, 4, 10, 6, 1]$. Two sets of sticks $[1, 2, 2]$ and $[4, 10, 10]$ can be selected to form $2$ non-degenerate triangles.\n\nIn the fourth query, the lengths of the sticks are $[4, 10, 6, 1, 5, 3]$. It can be shown that it is impossible to form $2$ non-degenerate triangles.\n\nIn the fifth query, the lengths of the sticks are $[10, 4, 10, 6, 1, 5, 3]$. Two sets of sticks $[1, 10, 10]$ and $[3, 4, 5]$ can be selected to form $2$ non-degenerate triangles.\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": "1991F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Large Addition\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: A digit is large if it is between $5$ and $9$, inclusive. A positive integer is large if all of its digits are large.\n\nYou are given an integer $x$. Can it be the sum of two large positive integers with the same number of digits?\n\nInput: The first line contains a single integer $t$ ($1 \\leq t \\leq 10^4$) β€” the number of test cases.\n\nThe only line of each test case contains a single integer $x$ ($10 \\leq x \\leq 10^{18}$).\n\nOutput: For each test case, output $\\texttt{YES}$ if $x$ satisfies the condition, and $\\texttt{NO}$ otherwise.\n\nYou can output $\\texttt{YES}$ and $\\texttt{NO}$ in any case (for example, strings $\\texttt{yES}$, $\\texttt{yes}$, and $\\texttt{Yes}$ will be recognized as a positive response).\n\nExamples:\ninput:\n11\n1337\n200\n1393938\n1434\n98765432123456789\n11111111111111111\n420\n1984\n10\n69\n119\noutput:\nYES\nNO\nYES\nYES\nNO\nYES\nNO\nYES\nYES\nNO\nNO\n\nNote: In the first test case, we can have $658 + 679 = 1337$.\n\nIn the second test case, it can be shown that no numbers of equal length and only consisting of large digits can add to $200$.\n\nIn the third test case, we can have $696\\,969 + 696\\,969 = 1\\,393\\,938$.\n\nIn the fourth test case, we can have $777 + 657 = 1434$.\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": "1984B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Make Three Regions\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: There is a grid, consisting of $2$ rows and $n$ columns. Each cell of the grid is either free or blocked.\n\nA free cell $y$ is reachable from a free cell $x$ if at least one of these conditions holds:\n\n * $x$ and $y$ share a side; * there exists a free cell $z$ such that $z$ is reachable from $x$ and $y$ is reachable from $z$. \n\nA connected region is a set of free cells of the grid such that all cells in it are reachable from one another, but adding any other free cell to the set violates this rule.\n\nFor example, consider the following layout, where white cells are free, and dark grey cells are blocked:\n\n![](CDN_BASE_URL/35b42e4e3c64eee3071df3d7b48861e8)\n\nThere are $3$ regions in it, denoted with red, green and blue color respectively:\n\n![](CDN_BASE_URL/b2528153b76de41b1afcd49c1578a191)\n\nThe given grid contains at most $1$ connected region. Your task is to calculate the number of free cells meeting the following constraint:\n\n * if this cell is blocked, the number of connected regions becomes exactly $3$.\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 number of columns.\n\nThe $i$-th of the next two lines contains a description of the $i$-th row of the grid β€” the string $s_i$, consisting of $n$ characters. Each character is either . (denoting a free cell) or x (denoting a blocked cell).\n\nAdditional constraint on the input:\n\n * the given grid contains at most $1$ connected region; * 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 number of cells such that the number of connected regions becomes $3$ if this cell is blocked.\n\nExamples:\ninput:\n4\n8\n.......x\n.x.xx...\n2\n..\n..\n3\nxxx\nxxx\n9\n..x.x.x.x\nx.......x\noutput:\n1\n0\n0\n2\n\nNote: In the first test case, if the cell $(1, 3)$ is blocked, the number of connected regions becomes $3$ (as shown in the picture from the 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": "1997B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Parity and Sum\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Given an array $a$ of $n$ positive integers.\n\nIn one operation, you can pick any pair of indexes $(i, j)$ such that $a_i$ and $a_j$ have distinct parity, then replace the smaller one with the sum of them. More formally:\n\n * If $a_i < a_j$, replace $a_i$ with $a_i + a_j$; * Otherwise, replace $a_j$ with $a_i + a_j$. \n\nFind the minimum number of operations needed to make all elements of the array have the same parity.\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$).\n\nThe second line contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10^9$) β€” the elements of 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 a single integer β€” the minimum number of operations required.\n\nExamples:\ninput:\n7\n5\n1 3 5 7 9\n4\n4 4 4 4\n3\n2 3 4\n4\n3 2 2 8\n6\n4 3 6 1 2 1\n6\n3 6 1 2 1 2\n5\n999999996 999999997 999999998 999999999 1000000000\noutput:\n0\n0\n2\n4\n3\n3\n3\n\nNote: In the first test case, all integers already have the same parity. Therefore, no operation is needed.\n\nIn the third test case, we can perform two operations $(1, 2)$ and $(1, 3)$. The array $a$ transforms as follows: $a = [\\color{red}2, \\color{red}3, 4] \\longrightarrow [\\color{red}5, 3, \\color{red}4] \\longrightarrow [5, 3, 9]$.\n\nIn the fourth test case, an example of an optimal sequence of operations is $(1, 2)$, $(1, 3)$, $(1, 4)$, and $(1, 4)$. The array $a$ transforms as follows: $a = [\\color{red}3, \\color{red}2, 2, 8] \\longrightarrow [\\color{red}3, 5, \\color{red}2, 8] \\longrightarrow [\\color{red}3, 5, 5, \\color{red}8] \\longrightarrow [\\color{red}{11}, 5, 5, \\color{red}8] \\longrightarrow [11, 5, 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": "1993B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Robert Hood and Mrs Hood\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Impress thy brother, yet fret not thy mother.\n\nRobin's brother and mother are visiting, and Robin gets to choose the start day for each visitor.\n\nAll days are numbered from $1$ to $n$. Visitors stay for $d$ continuous days, all of those $d$ days must be between day $1$ and $n$ inclusive.\n\nRobin has a total of $k$ risky 'jobs' planned. The $i$-th job takes place between days $l_i$ and $r_i$ inclusive, for $1 \\le i \\le k$. If a job takes place on any of the $d$ days, the visit overlaps with this job (the length of overlap is unimportant).\n\nRobin wants his brother's visit to overlap with the maximum number of distinct jobs, and his mother's the minimum.\n\nFind suitable start days for the visits of Robin's brother and mother. If there are multiple suitable days, choose the earliest one.\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 consists of three integers $n$, $d$, $k$ ($1 \\le n \\le 10^5, 1 \\le d, k \\le n$) β€” the number of total days, duration of the visits, and the number of jobs.\n\nThen follow $k$ lines of each test case, each with two integers $l_i$ and $r_i$ ($1 \\le l_i \\le r_i \\le n$) β€” the start and end day of each job.\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 two integers, the best starting days of Robin's brother and mother respectively. Both visits must fit between day $1$ and $n$ inclusive.\n\nExamples:\ninput:\n6\n2 1 1\n1 2\n4 1 2\n1 2\n2 4\n7 2 3\n1 2\n1 3\n6 7\n5 1 2\n1 2\n3 5\n9 2 1\n2 8\n9 2 4\n7 9\n4 8\n1 3\n2 3\noutput:\n1 1\n2 1\n1 4\n1 1\n1 1\n3 4\n\nNote: In the first test case, the only job fills all $2$ days, both should visit on day $1$.\n\nIn the second test case, day $2$ overlaps with $2$ jobs and day $1$ overlaps with only $1$.\n\nIn the third test case, Robert visits for days $[1,2]$, Mrs. Hood visits for days $[4,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": "2014D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Guess the Maximum\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Alice and Bob came up with a rather strange game. They have an array of integers $a_1, a_2,\\ldots, a_n$. Alice chooses a certain integer $k$ and tells it to Bob, then the following happens:\n\n * Bob chooses two integers $i$ and $j$ ($1 \\le i < j \\le n$), and then finds the maximum among the integers $a_i, a_{i + 1},\\ldots, a_j$; * If the obtained maximum is strictly greater than $k$, Alice wins, otherwise Bob wins. \n\nHelp Alice find the maximum $k$ at which she is guaranteed to win.\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$ ($2 \\le n \\le 5 \\cdot 10^4$) β€” 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$ ($1 \\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 $5 \\cdot 10^4$.\n\nOutput: For each test case, output one integer β€” the maximum integer $k$ at which Alice is guaranteed to win.\n\nExamples:\ninput:\n6\n4\n2 4 1 7\n5\n1 2 3 4 5\n2\n1 1\n3\n37 8 16\n5\n10 10 10 10 9\n10\n3 12 9 5 2 3 2 9 8 2\noutput:\n3\n1\n0\n15\n9\n2\n\nNote: In the first test case, all possible subsegments that Bob can choose look as follows: $[2, 4], [2, 4, 1], [2, 4, 1, 7], [4, 1], [4, 1, 7], [1, 7]$. The maximums on the subsegments are respectively equal to $4, 4, 7, 4, 7, 7$. It can be shown that $3$ is the largest integer such that any of the maximums will be strictly greater than it.\n\nIn the third test case, the only segment that Bob can choose is $[1, 1]$. So the answer 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": "1979A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Increase/Decrease/Copy\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given two integer arrays: array $a$ of length $n$ and array $b$ of length $n+1$.\n\nYou can perform the following operations any number of times in any order:\n\n * choose any element of the array $a$ and increase it by $1$; * choose any element of the array $a$ and decrease it by $1$; * choose any element of the array $a$, copy it and append the copy to the end of the array $a$. \n\nYour task is to calculate the minimum number of aforementioned operations (possibly zero) required to transform the array $a$ into the array $b$. It can be shown that under the constraints of the problem, it is always possible.\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 three lines:\n\n * the first line contains a single integer $n$ ($1 \\le n \\le 2 \\cdot 10^5$); * the second line contains $n$ integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 10^9$); * the third line contains $n + 1$ integers $b_1, b_2, \\dots, b_{n + 1}$ ($1 \\le b_i \\le 10^9$). \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 minimum number of operations (possibly zero) required to transform the array $a$ into the array $b$.\n\nExamples:\ninput:\n3\n1\n2\n1 3\n2\n3 3\n3 3 3\n4\n4 2 1 2\n2 1 5 2 3\noutput:\n3\n1\n8\n\nNote: In the first example, you can transform $a$ into $b$ as follows: $[2] \\rightarrow [2, 2] \\rightarrow [1, 2] \\rightarrow [1, 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": "1976B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Rectangle Arrangement\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are coloring an infinite square grid, in which all cells are initially white. To do this, you are given $n$ stamps. Each stamp is a rectangle of width $w_i$ and height $h_i$.\n\nYou will use each stamp exactly once to color a rectangle of the same size as the stamp on the grid in black. You cannot rotate the stamp, and for each cell, the stamp must either cover it fully or not cover it at all. You can use the stamp at any position on the grid, even if some or all of the cells covered by the stamping area are already black.\n\nWhat is the minimum sum of the perimeters of the connected regions of black squares you can obtain after all the stamps have been used?\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$).\n\nThe $i$-th of the next $n$ lines contains two integers $w_i$ and $h_i$ ($1 \\le w_i, h_i \\le 100$).\n\nOutput: For each test case, output a single integer β€” the minimum sum of the perimeters of the connected regions of black squares you can obtain after all the stamps have been used.\n\nExamples:\ninput:\n5\n5\n1 5\n2 4\n3 3\n4 2\n5 1\n3\n2 2\n1 1\n1 2\n1\n3 2\n3\n100 100\n100 100\n100 100\n4\n1 4\n2 3\n1 5\n3 2\noutput:\n20\n8\n10\n400\n16\n\nNote: In the first test case, the stamps can be used as shown on the left. Each stamp is highlighted in its own color for clarity.\n\n![](CDN_BASE_URL/877686333ced56f689851506a90eefb8)\n\nAfter all these stamps are used, there is one black region (as shown on the right), and its perimeter is $20$. It can be shown that there is no way of using the stamps that yields a lower total perimeter.\n\nIn the second test case, the second and third stamps can be used entirely inside the first one, so the minimum perimeter is equal to $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": "2027A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Count Leaves\ntime_limit_ms: 4000\nmemory_limit_mb: 256\nDescription: Let $n$ and $d$ be positive integers. We build the the divisor tree $T_{n,d}$ as follows:\n\n * The root of the tree is a node marked with number $n$. This is the $0$-th layer of the tree. * For each $i$ from $0$ to $d - 1$, for each vertex of the $i$-th layer, do the following. If the current vertex is marked with $x$, create its children and mark them with all possible distinct divisors$^\\dagger$ of $x$. These children will be in the $(i+1)$-st layer. * The vertices on the $d$-th layer are the leaves of the tree. \n\nFor example, $T_{6,2}$ (the divisor tree for $n = 6$ and $d = 2$) looks like this:\n\n![](CDN_BASE_URL/782ea6d6fe622ee5ec986b0d8cae274d)\n\nDefine $f(n,d)$ as the number of leaves in $T_{n,d}$.\n\nGiven integers $n$, $k$, and $d$, please compute $\\sum\\limits_{i=1}^{n} f(i^k,d)$, modulo $10^9+7$.\n\n$^\\dagger$ In this problem, we say that an integer $y$ is a divisor of $x$ if $y \\ge 1$ and 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 three integers $n$, $k$, and $d$ ($1 \\le n \\le 10^9$, $1 \\le k,d \\le 10^5$).\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^9$.\n\nOutput: For each test case, output $\\sum\\limits_{i=1}^{n} f(i^k,d)$, modulo $10^9+7$.\n\nExamples:\ninput:\n3\n6 1 1\n1 3 3\n10 1 2\noutput:\n14\n1\n53\n\nNote: In the first test case, $n = 6$, $k = 1$, and $d = 1$. Thus, we need to find the total number of leaves in the divisor trees $T_{1,1}$, $T_{2,1}$, $T_{3,1}$, $T_{4,1}$, $T_{5,1}$, $T_{6,1}$.\n\n * $T_{1,1}$ has only one leaf, which is marked with $1$. * $T_{2,1}$ has two leaves, marked with $1$ and $2$. * $T_{3,1}$ has two leaves, marked with $1$ and $3$. * $T_{4,1}$ has three leaves, marked with $1$, $2$, and $4$. * $T_{5,1}$ has two leaves, marked with $1$ and $5$. * $T_{6,1}$ has four leaves, marked with $1$, $2$, $3$, and $6$. \n\nThe total number of leaves is $1 + 2 + 2 + 3 + 2 + 4 = 14$.\n\nIn the second test case, $n = 1$, $k = 3$, $d = 3$. Thus, we need to find the number of leaves in $T_{1,3}$, because $1^3 = 1$. This tree has only one leaf, so 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": "2020F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Kar Salesman\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Karel is a salesman in a car dealership. The dealership has $n$ different models of cars. There are $a_i$ cars of the $i$-th model. Karel is an excellent salesperson and can convince customers to buy up to $x$ cars (of Karel's choice), as long as the cars are from different models. Determine the minimum number of customers Karel has to bring in to sell all the cars.\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$ and $x$ ($1 \\le n \\le 5 \\cdot 10^5$; $1 \\le x \\le 10$) β€” the number of different models of cars and the maximum number of cars Karel can convince a customer to buy.\n\nThe second line contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10^9$) β€” the number of cars of each model.\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 the minimum possible number of customers needed to sell all the cars.\n\nExamples:\ninput:\n4\n3 2\n3 1 2\n3 3\n2 1 3\n5 3\n2 2 1 9 2\n7 4\n2 5 3 3 5 2 5\noutput:\n3\n3\n9\n7\n\nNote: For the first case, Karel only needs to lure in $3$ customers. He will convince the customers to buy the following models of cars:\n\n * Customer $1$ buys $2$ cars with model $1$ and $3$. * Customer $2$ buys $2$ cars with model $1$ and $2$. * Customer $3$ buys $2$ cars with model $1$ and $3$. \n\nFor the second case, Karel only needs to lure in $3$ customers. He will convince the customers to buy the following models of cars:\n\n * Customer $1$ buys $2$ cars with model $1$ and $3$. * Customer $2$ buys $3$ cars with model $1$, $2$ and $3$. * Customer $3$ buys $1$ car with model $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": "2022B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Even Positions\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Monocarp had a regular bracket sequence $s$ of length $n$ ($n$ is even). He even came up with his own way to calculate its cost.\n\nHe knows that in a regular bracket sequence (RBS), each opening bracket is paired up with the corresponding closing bracket. So he decided to calculate the cost of RBS as the sum of distances between pairs of corresponding bracket pairs.\n\nFor example, let's look at RBS (())(). It has three pairs of brackets:\n\n * (__)__: the distance between brackets at position $1$ and at $4$ is $4 - 1 = 3$; * _()___: the distance is $3 - 2 = 1$; * ____(): the distance is $6 - 5 = 1$. \n\nSo the cost of (())() is $3 + 1 + 1 = 5$.\n\nUnfortunately, due to data corruption, Monocarp lost all characters on odd positions $s_1, s_3, \\dots, s_{n-1}$. Only characters on even positions ($s_2, s_4, \\dots, s_{n}$) remain. For example, (())() turned to _(_)_).\n\nMonocarp wants to restore his RBS by placing brackets on the odd positions. But since the restored RBS may not be unique, he wants to choose one with minimum cost. It's too hard to do for Monocarp alone, so can you help him?\n\nReminder: A regular bracket sequence is a string consisting of only brackets, such that this sequence, when inserted 1-s and +-s, gives a valid mathematical expression. For example, (), (()) or (()())() are RBS, while ), ()( or ())(() are not.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 5000$) β€” the number of test cases. Next $t$ cases follow.\n\nThe first line of each test case contains a single integer $n$ ($2 \\le n \\le 2 \\cdot 10^5$; $n$ is even) β€” the length of string $s$.\n\nThe second line of each test case contains a string $s$ of length $n$, where all characters on the odd positions are '_' and all characters on the even positions are either '(' or ')'.\n\nAdditional constraints:\n\n * $s$ can be restored to at least one regular bracket sequence; * the total sum of $n$ over all test cases doesn't exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, print one integer β€” the minimum cost of the regular bracket sequence that can be obtained from $s$ by replacing '_'-s with brackets.\n\nExamples:\ninput:\n4\n6\n_(_)_)\n2\n_)\n8\n_)_)_)_)\n8\n_(_)_(_)\noutput:\n5\n1\n4\n8\n\nNote: In the first test case, it's optimal to make $s$ equal to (())(). The cost of $s$ will be equal to $3 + 1 + 1 = 5$.\n\nIn the second test case, the only option is to make $s$ equal to () with cost $1$.\n\nIn the third test case, the only possible RBS is ()()()() with cost $1 + 1 + 1 + 1 = 4$.\n\nIn the fourth test case, it's optimal to make $s$ equal to (())(()) with cost $3 + 1 + 3 + 1 = 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": "1997C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: DFS Checker (Hard Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: This is the hard version of the problem. In this version, you are given a generic tree and the constraints on $n$ and $q$ are higher. You can make hacks only if both versions of the problem are solved.\n\nYou are given a rooted tree consisting of $n$ vertices. The vertices are numbered from $1$ to $n$, and the root is the vertex $1$. You are also given a permutation $p_1, p_2, \\ldots, p_n$ of $[1,2,\\ldots,n]$.\n\nYou need to answer $q$ queries. For each query, you are given two integers $x$, $y$; you need to swap $p_x$ and $p_y$ and determine if $p_1, p_2, \\ldots, p_n$ is a valid DFS order$^\\dagger$ of the given tree.\n\nPlease note that the swaps are persistent through queries.\n\n$^\\dagger$ A DFS order is found by calling the following $\\texttt{dfs}$ function on the given tree.\n\n dfs_order = [] function dfs(v): append v to the back of dfs_order pick an arbitrary permutation s of children of v for child in s: dfs(child) dfs(1) \n\nNote that the DFS order is not unique.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1\\le t\\le10^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 3\\cdot 10^5$, $2\\le q\\le 10^5$) β€” the number of vertices in the tree and the number of queries.\n\nThe next line contains $n-1$ integers $a_2,a_3,\\ldots,a_n$ ($1\\le a_i<i$) β€” the parent of each vertex in the given tree.\n\nThe next line contains $n$ integers $p_1,p_2,\\ldots,p_n$ ($1\\le p_i\\le n$, all $p_i$ are distinct) β€” the initial permutation $p$.\n\nThe next $q$ lines each contain two integers $x$, $y$ ($1\\le x,y\\le n,x\\neq y$) β€” the positions of the elements to swap in the permutation.\n\nIt is guaranteed that the sum of all $n$ does not exceed $3\\cdot 10^5$, and the sum of all $q$ does not exceed $10^5$.\n\nOutput: For each test case, print $q$ lines corresponding to the $q$ queries. For each query, output $\\texttt{YES}$ if there is a DFS order that exactly equals the current permutation, and output $\\texttt{NO}$ otherwise.\n\nYou can output $\\texttt{Yes}$ and $\\texttt{No}$ in any case (for example, strings $\\texttt{yEs}$, $\\texttt{yes}$, $\\texttt{Yes}$, and $\\texttt{YES}$ will be recognized as a positive response).\n\nExamples:\ninput:\n3\n3 3\n1 1\n1 2 3\n2 3\n3 2\n1 3\n7 4\n1 1 2 2 3 3\n1 2 3 4 5 6 7\n3 5\n2 5\n3 7\n4 6\n5 4\n1 1 3 4\n2 3 4 5 1\n5 1\n4 5\n3 4\n2 3\noutput:\nYES\nYES\nNO\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\n\nNote: In the first test case, the permutation $p_1, p_2, \\ldots, p_n$ after each modification is $[1,3,2],[1,2,3],[3,2,1]$, respectively. The first two permutations are valid DFS orders; the third is not a DFS order.\n\nIn the second test case, the permutation $p_1, p_2, \\ldots, p_n$ after each modification is $[1,2,5,4,3,6,7],[1,3,5,4,2,6,7],[1,3,7,4,2,6,5],[1,3,7,6,2,4,5]$, respectively.\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": "2002D2", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Call During the Journey\ntime_limit_ms: 4000\nmemory_limit_mb: 256\nDescription: You live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, possibly passing through some other intersections.\n\nEvery minute, you can board a bus at intersection $u_i$ and travel for $l_{i1}$ minutes to intersection $v_i$. Conversely, you can travel from intersection $v_i$ to intersection $u_i$ in $l_{i1}$ minutes. You can only board and exit the bus at intersections. You can only board the bus at an intersection if you are currently there.\n\nYou can also walk along each street, which takes $l_{i2} > l_{i1}$ minutes.\n\nYou can make stops at intersections.\n\nYou live at intersection number $1$. Today you woke up at time $0$, and you have an important event scheduled at intersection number $n$, which you must reach no later than time $t_0$. You also have a phone call planned that will last from $t_1$ to $t_2$ minutes ($t_1 < t_2 < t_0$).\n\nDuring the phone call, you cannot ride the bus, but you can walk along any streets, make stops, or stay at home. You can exit the bus at minute $t_1$ and board the bus again at minute $t_2$.\n\nSince you want to get enough sleep, you became curious β€” how late can you leave home to have time to talk on the phone and still not be late for the event?\n\nInput: The first line contains an integer $t$ ($1 \\le t \\le 10^4$) β€” the number of test cases. The following are the descriptions of the test cases.\n\nThe first line of each test case contains two integers $n$, $m$ ($2 \\le n \\le 10^5, 1 \\le m \\le 10^5$) β€” the number of intersections and streets in the city.\n\nThe second line of each test case contains three integers $t_0$, $t_1$, $t_2$ ($1 \\le t_1 < t_2 < t_0 \\le 10^9$) β€” the start time of the event, the start time of the phone call, and its end time, respectively.\n\nThe next $m$ lines of each test case contain descriptions of the streets.\n\nThe $i$-th line contains four integers $u_i$, $v_i$, $l_{i1}$, $l_{i2}$ ($1 \\le u_i, v_i \\le n$, $u_i \\neq v_i$, $1 \\le l_{i1} < l_{i2} \\le 10^9$) β€” the numbers of the intersections connected by the $i$-th street, as well as the travel time along the street by bus and on foot. It is guaranteed that no two streets connect the same pair of intersections and that it is possible to reach any intersection from any other.\n\nIt is guaranteed that the sum of the values of $n$ across all test cases does not exceed $10^5$. It is also guaranteed that the sum of the values of $m$ across all test cases does not exceed $10^5$.\n\nOutput: For each test case, output a single integer β€” the latest time you can leave home to have time to talk on the phone and not be late for the event. If you cannot reach the event on time, output -1.\n\nExamples:\ninput:\n7\n5 5\n100 20 80\n1 5 30 100\n1 2 20 50\n2 3 20 50\n3 4 20 50\n4 5 20 50\n2 1\n100 50 60\n1 2 55 110\n4 4\n100 40 60\n1 2 30 100\n2 4 30 100\n1 3 20 50\n3 4 20 50\n3 3\n100 80 90\n1 2 1 10\n2 3 10 50\n1 3 20 21\n3 2\n58 55 57\n2 1 1 3\n2 3 3 4\n2 1\n12 9 10\n2 1 6 10\n5 5\n8 5 6\n2 1 1 8\n2 3 4 8\n4 2 2 4\n5 3 3 4\n4 5 2 6\noutput:\n0\n-1\n60\n80\n53\n3\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": "2000G", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Test of Love\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: ErnKor is ready to do anything for Julen, even to swim through crocodile- infested swamps. We decided to test this love. ErnKor will have to swim across a river with a width of $1$ meter and a length of $n$ meters.\n\nThe river is very cold. Therefore, in total (that is, throughout the entire swim from $0$ to $n+1$) ErnKor can swim in the water for no more than $k$ meters. For the sake of humanity, we have added not only crocodiles to the river, but also logs on which he can jump. Our test is as follows:\n\nInitially, ErnKor is on the left bank and needs to reach the right bank. They are located at the $0$ and $n+1$ meters respectively. The river can be represented as $n$ segments, each with a length of $1$ meter. Each segment contains either a log 'L', a crocodile 'C', or just water 'W'. ErnKor can move as follows:\n\n * If he is on the surface (i.e., on the bank or on a log), he can jump forward for no more than $m$ ($1 \\le m \\le 10$) meters (he can jump on the bank, on a log, or in the water). * If he is in the water, he can only swim to the next river segment (or to the bank if he is at the $n$-th meter). * ErnKor cannot land in a segment with a crocodile in any way. \n\nDetermine if ErnKor can reach the right bank.\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 three numbers $n, m, k$ ($0 \\le k \\le 2 \\cdot 10^5$, $1 \\le n \\le 2 \\cdot 10^5$, $1 \\le m \\le 10$) β€” the length of the river, the distance ErnKor can jump, and the number of meters ErnKor can swim without freezing.\n\nThe second line of each test case contains a string $a$ of length $n$. $a_i$ denotes the object located at the $i$-th meter. ($a_i \\in \\\\{$'W','C','L'$\\\\}$)\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 ErnKor can pass the test, and output \"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:\n6\n6 2 0\nLWLLLW\n6 1 1\nLWLLLL\n6 1 1\nLWLLWL\n6 2 15\nLWLLCC\n6 10 0\nCCCCCC\n6 6 1\nWCCCCW\noutput:\nYES\nYES\nNO\nNO\nYES\nYES\n\nNote: Let's consider examples:\n\n * First example: We jump from the shore to the first log ($0 \\rightarrow 1$), from the first log to the second ($1 \\rightarrow 3$), from the second to the fourth ($3 \\rightarrow 5$), and from the last log to the shore ($5 \\rightarrow 7$). So, we have $0 \\rightarrow 1 \\rightarrow 3 \\rightarrow 5 \\rightarrow 7$. Since we did not encounter a crocodile and swam no more than k meters, the answer is Β«YESΒ». * Second example: $0 \\rightarrow 1$, we jump into the water from the first log ($1 \\rightarrow 2$), swim a cell to the log ($2 \\leadsto 3$), $3 \\rightarrow 4 \\rightarrow 5 \\rightarrow 6 \\rightarrow 7$. Since we did not encounter a crocodile and swam no more than k meters, the answer is Β«YESΒ». * In the third example, ErnKor needs to swim two cells 'W', but can only swim one. Therefore, the answer is Β«NOΒ». * Sixth example: We jump from the shore into the water ($0 \\rightarrow 6$) and swim one cell in the water ($6 \\leadsto 7$). Since we did not encounter a crocodile and swam no more than k meters, 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": "1992D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Creating Words\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Matthew is given two strings $a$ and $b$, both of length $3$. He thinks it's particularly funny to create two new words by swapping the first character of $a$ with the first character of $b$. He wants you to output $a$ and $b$ after the swap.\n\nNote that the new words may not necessarily be different.\n\nInput: The first line contains $t$ ($1 \\leq t \\leq 100$) β€” the number of test cases.\n\nThe first and only line of each test case contains two space-separated strings, $a$ and $b$, both of length $3$. The strings only contain lowercase Latin letters.\n\nOutput: For each test case, after the swap, output $a$ and $b$, separated by a space.\n\nExamples:\ninput:\n6\nbit set\ncat dog\nhot dog\nuwu owo\ncat cat\nzzz zzz\noutput:\nsit bet\ndat cog\ndot hog\nowu uwo\ncat cat\nzzz zzz\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": "1985A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Maximize the Last Element\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are given an array $a$ of $n$ integers, where $n$ is odd.\n\nIn one operation, you will remove two adjacent elements from the array $a$, and then concatenate the remaining parts of the array. For example, given the array $[4,7,4,2,9]$, we can obtain the arrays $[4,2,9]$ and $[4,7,9]$ by the operations $[\\underline{4,7}, 4,2,9] \\to [4,2,9]$ and $[4,7,\\underline{4,2},9] \\to [4,7,9]$ respectively. However, we cannot obtain the array $[7,2,9]$ as it requires deleting non-adjacent elements $[\\underline{4},7,\\underline{4},2,9]$.\n\nYou will repeatedly perform this operation until exactly one element remains in $a$.\n\nFind the maximum possible value of the remaining element in $a$.\n\nInput: Each test contains multiple test cases. The first line contains a single integer $t$ ($1 \\le t \\le 1000$) β€” the number of test cases. The description of test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1 \\le n \\le 99$; $n$ is odd) β€” 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 100$) β€” the elements of the array $a$.\n\nNote that there is no bound on the sum of $n$ over all test cases.\n\nOutput: For each test case, output a single integer β€” the maximum possible value of the remaining element in $a$.\n\nExamples:\ninput:\n4\n1\n6\n3\n1 3 2\n5\n4 7 4 2 9\n7\n3 1 4 1 5 9 2\noutput:\n6\n2\n9\n5\n\nNote: In the first test case, the array $a$ is $[6]$. Since there is only one element, no operations are needed. The maximum possible value of the remaining element is $6$.\n\nIn the second test case, the array $a$ is $[1, 3, 2]$. We can remove the first two elements $[\\underline{1, 3}, 2] \\to [2]$, or remove the last two elements $[1, \\underline{3, 2}] \\to [1]$. Therefore, the maximum possible value of the remaining element is $2$.\n\nIn the third test case, the array $a$ is $[4, 7, 4, 2, 9]$. One way to maximize the remaining element is $[4, \\underline{7, 4}, 2, 9] \\to [\\underline{4, 2}, 9] \\to [9]$. Therefore, the maximum possible value of the remaining element is $9$.\n\nIn the fourth test case, the array $a$ is $[3, 1, 4, 1, 5, 9, 2]$. It can be shown that the maximum possible value of the remaining element 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": "1991A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Tree Operations\ntime_limit_ms: 4000\nmemory_limit_mb: 256\nDescription: This really says a lot about our society.\n\nOne day, a turtle gives you a tree with $n$ nodes rooted at node $x$. Each node has an initial nonnegative value; the $i$-th node has starting value $a_i$.\n\nYou want to make the values of all nodes equal to $0$. To do so, you will perform a series of operations on the tree, where each operation will be performed on a certain node. Define an operation on node $u$ as choosing a single node in $u$'s subtree$^{\\text{βˆ—}}$ and incrementing or decrementing its value by $1$. The order in which operations are performed on nodes is as follows:\n\n * For $1 \\le i \\le n$, the $i$-th operation will be performed on node $i$. * For $i > n$, the $i$-th operation will be performed on the same node as operation $i - n$. \n\nMore formally, the $i$-th operation will be performed on the $(((i - 1) \\bmod n) + 1)$-th node.$^{\\text{†}}$\n\nNote that you cannot skip over operations; that is, you cannot perform the $i$-th operation without first performing operations $1, 2, \\ldots, i - 1$.\n\nFind the minimum number of operations you must perform before you can make the values of all nodes equal to $0$, assuming you pick operations optimally. If it's impossible to make the values of all nodes equal to $0$ after finite operations, output $-1$.\n\n$^{\\text{βˆ—}}$The subtree of a node $u$ is the set of nodes for which $u$ lies on the shortest path from this node to the root, including $u$ itself.\n\n$^{\\text{†}}$Here, $a \\bmod b$ denotes the remainder from dividing $a$ by $b$.\n\nInput: The first line contains a single integer $t$ ($1\\le t\\le 100$) β€” the number of test cases.\n\nThe first line of each test case contains two integers $n$ and $x$ ($1 \\le n \\le 2000$, $1 \\le x \\le n$) β€” the number of nodes and the root of 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 starting value of each node.\n\nEach of the next $n - 1$ lines of each test case contains two integers $u$ and $v$ ($1 \\le u, v \\le n$, $u \\neq v$) representing an undirected edge from $u$ to $v$. 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 $2000$.\n\nOutput: For each test case, output a single integer denoting the minimum amount of operations needed to make all nodes $0$. If it's impossible to make all nodes $0$, output $-1$.\n\nExamples:\ninput:\n5\n2 1\n1 2\n1 2\n3 2\n2 1 3\n2 1\n3 2\n4 1\n1 1 0 1\n1 2\n2 3\n1 4\n12 6\n14 4 5 6 12 9 5 11 6 2 1 12\n3 9\n10 6\n6 12\n4 3\n3 1\n5 11\n9 7\n5 6\n1 8\n2 8\n5 1\n1 1\n0\noutput:\n3\n6\n5\n145\n0\n\nNote: In the first test case, you can make the following valid sequence of operations:\n\n * For operation $1$, decrease the value of node $1$. This is valid because $(((1 - 1) \\bmod n) + 1) = 1$, and node $1$ is in the subtree of node $1$. * For operation $2$, decrease the value of node $2$. This is valid because $(((2 - 1) \\bmod n) + 1) = 2$, and node $2$ is in the subtree of node $2$. * For operation $3$, decrease the value of node $2$. This is valid because $(((3 - 1) \\bmod n) + 1) = 1$, and node $2$ is in the subtree of node $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": "2035F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Colored Portals\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: There are $n$ cities located on a straight line. The cities are numbered from $1$ to $n$.\n\nPortals are used to move between cities. There are $4$ colors of portals: blue, green, red, and yellow. Each city has portals of two different colors. You can move from city $i$ to city $j$ if they have portals of the same color (for example, you can move between a \"blue-red\" city and a \"blue- green\" city). This movement costs $|i-j|$ coins.\n\nYour task is to answer $q$ independent queries: calculate the minimum cost to move from city $x$ to city $y$.\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 two integers $n$ and $q$ ($1 \\le n, q \\le 2 \\cdot 10^5$) β€” the number of cities and the number of queries, respectively.\n\nThe second line contains $n$ strings of the following types: BG, BR, BY, GR, GY, or RY; the $i$-th of them describes the portals located in the $i$-th city; the symbol B indicates that there is a blue portal in the city, G β€” green, R β€” red, and Y β€” yellow.\n\nThe $j$-th of the next $q$ lines contains two integers $x_j$ and $y_j$ ($1 \\le x_j, y_j \\le n$) β€” the description of the $j$-th query.\n\nAdditional constraints on the input:\n\n * the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$; * the sum of $q$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each query, print a single integer β€” the minimum cost to move from city $x$ to city $y$ (or $-1$ if it is impossible).\n\nExamples:\ninput:\n2\n4 5\nBR BR GY GR\n1 2\n3 1\n4 4\n1 4\n4 2\n2 1\nBG RY\n1 2\noutput:\n1\n4\n0\n3\n2\n-1\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": "2004D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Add Zeros\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: You're given an array $a$ initially containing $n$ integers. In one operation, you must do the following:\n\n * Choose a position $i$ such that $1 < i \\le |a|$ and $a_i = |a| + 1 - i$, where $|a|$ is the current size of the array. * Append $i - 1$ zeros onto the end of $a$. \n\nAfter performing this operation as many times as you want, what is the maximum possible length of the array $a$?\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 $n$ ($1 \\le n \\le 3 \\cdot 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 \\le a_i \\le 10^{12}$).\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 possible length of $a$ after performing some sequence of operations.\n\nExamples:\ninput:\n4\n5\n2 4 6 2 5\n5\n5 4 4 5 1\n4\n6 8 2 3\n1\n1\noutput:\n10\n11\n10\n1\n\nNote: In the first test case, we can first choose $i = 4$, since $a_4 = 5 + 1 - 4 = 2$. After this, the array becomes $[2, 4, 6, 2, 5, 0, 0, 0]$. We can then choose $i = 3$ since $a_3 = 8 + 1 - 3 = 6$. After this, the array becomes $[2, 4, 6, 2, 5, 0, 0, 0, 0, 0]$, which has a length of $10$. It can be shown that no sequence of operations will make the final array longer.\n\nIn the second test case, we can choose $i=2$, then $i=3$, then $i=4$. The final array will be $[5, 4, 4, 5, 1, 0, 0, 0, 0, 0, 0]$, with a length 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": "2027C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Expected Power\ntime_limit_ms: 4000\nmemory_limit_mb: 256\nDescription: You are given an array of $n$ integers $a_1,a_2,\\ldots,a_n$. You are also given an array $p_1, p_2, \\ldots, p_n$.\n\nLet $S$ denote the random multiset (i. e., it may contain equal elements) constructed as follows:\n\n * Initially, $S$ is empty. * For each $i$ from $1$ to $n$, insert $a_i$ into $S$ with probability $\\frac{p_i}{10^4}$. Note that each element is inserted independently. \n\nDenote $f(S)$ as the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of all elements of $S$. Please calculate the expected value of $(f(S))^2$. Output the answer modulo $10^9 + 7$.\n\nFormally, let $M = 10^9 + 7$. 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 \\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$ ($1 \\le n \\le 2 \\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 1023$).\n\nThe third line of each test case contains $n$ integers $p_1,p_2,\\ldots,p_n$ ($1 \\le p_i \\le 10^4$).\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 expected value of $(f(S))^2$, modulo $10^9 + 7$.\n\nExamples:\ninput:\n4\n2\n1 2\n5000 5000\n2\n1 1\n1000 2000\n6\n343 624 675 451 902 820\n6536 5326 7648 2165 9430 5428\n1\n1\n10000\noutput:\n500000007\n820000006\n280120536\n1\n\nNote: In the first test case, $a = [1, 2]$ and each element is inserted into $S$ with probability $\\frac{1}{2}$, since $p_1 = p_2 = 5000$ and $\\frac{p_i}{10^4} = \\frac{1}{2}$. Thus, there are $4$ outcomes for $S$, each happening with the same probability of $\\frac{1}{4}$:\n\n * $S = \\varnothing$. In this case, $f(S) = 0$, $(f(S))^2 = 0$. * $S = \\\\{1\\\\}$. In this case, $f(S) = 1$, $(f(S))^2 = 1$. * $S = \\\\{2\\\\}$. In this case, $f(S) = 2$, $(f(S))^2 = 4$. * $S = \\\\{1,2\\\\}$. In this case, $f(S) = 1 \\oplus 2 = 3$, $(f(S))^2 = 9$. \n\nHence, the answer is $0 \\cdot \\frac{1}{4} + 1 \\cdot \\frac{1}{4} + 4\\cdot \\frac{1}{4} + 9 \\cdot \\frac{1}{4} = \\frac{14}{4} = \\frac{7}{2} \\equiv 500\\,000\\,007 \\pmod{10^9 + 7}$.\n\nIn the second test case, $a = [1, 1]$, $a_1$ is inserted into $S$ with probability $0.1$, while $a_2$ is inserted into $S$ with probability $0.2$. There are $3$ outcomes for $S$:\n\n * $S = \\varnothing$. In this case, $f(S) = 0$, $(f(S))^2 = 0$. This happens with probability $(1-0.1) \\cdot (1-0.2) = 0.72$. * $S = \\\\{1\\\\}$. In this case, $f(S) = 1$, $(f(S))^2 = 1$. This happens with probability $(1-0.1) \\cdot 0.2 + 0.1 \\cdot (1-0.2) = 0.26$. * $S = \\\\{1, 1\\\\}$. In this case, $f(S) = 0$, $(f(S))^2 = 0$. This happens with probability $0.1 \\cdot 0.2 = 0.02$. \n\nHence, the answer is $0 \\cdot 0.72 + 1 \\cdot 0.26 + 0 \\cdot 0.02 = 0.26 = \\frac{26}{100} \\equiv 820\\,000\\,006 \\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": "2020E", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: The Destruction of the Universe (Easy Version)\ntime_limit_ms: 4000\nmemory_limit_mb: 512\nDescription: This is the easy version of the problem. In this version, $n \\leq 5000$. You can only make hacks if both versions of the problem are solved.\n\nOrangutans are powerful beingsβ€”so powerful that they only need $1$ unit of time to destroy every vulnerable planet in the universe!\n\nThere are $n$ planets in the universe. Each planet has an interval of vulnerability $[l, r]$, during which it will be exposed to destruction by orangutans. Orangutans can also expand the interval of vulnerability of any planet by $1$ unit.\n\nSpecifically, suppose the expansion is performed on planet $p$ with interval of vulnerability $[l_p, r_p]$. Then, the resulting interval of vulnerability may be either $[l_p - 1, r_p]$ or $[l_p, r_p + 1]$.\n\nGiven a set of planets, orangutans can destroy all planets if the intervals of vulnerability of all planets in the set intersect at least one common point. Let the score of such a set denote the minimum number of expansions that must be performed.\n\nOrangutans are interested in the sum of scores of all non-empty subsets of the planets in the universe. As the answer can be large, output it modulo $998\\,244\\,353$.\n\nInput: The first line contains an integer $t$ ($1 \\leq t \\leq 1000$) β€” the number of test cases.\n\nThe first line of each test case contains an integer $n$ ($1 \\leq n \\leq 5000$) β€” the number of planets in the universe.\n\nThe following $n$ lines contain two integers $l_i$ and $r_i$ ($1 \\leq l_i \\leq r_i \\leq n$) β€” the initial interval of vulnerability of the $i$-th planet.\n\nIt is guaranteed that the sum of $n$ does not exceed $5000$ over all test cases.\n\nOutput: For each test case, output an integer β€” the sum of scores to destroy all non- empty subsets of the planets in the universe, modulo $998\\,244\\,353$.\n\nExamples:\ninput:\n3\n3\n1 1\n2 3\n3 3\n4\n1 4\n2 3\n2 4\n1 1\n5\n1 2\n2 3\n3 4\n4 5\n1 5\noutput:\n5\n6\n24\n\nNote: In the first testcase, there are seven non-empty subsets of planets we must consider:\n\n * For each of the subsets $\\\\{[1,1]\\\\}, \\\\{[2,3]\\\\}, \\\\{[3,3]\\\\}$, the score is $0$. * For the subset $\\\\{[2,3], [3,3]\\\\}$, the score is $0$, because the point $3$ is already contained in both planets' interval of vulnerability. * For the subset $\\\\{[1,1], [2,3]\\\\}$, the score is $1$. By using one operation on changing the interval of vulnerability of the second planet to be $[1,3]$, the two planets now both have the point $1$ in their interval. * For the subset $\\\\{[1,1], [3,3]\\\\}$, the score is $2$. By using two operations on changing the interval of vulnerability of the first planet to be $[1,3]$, the two planets now both have the point $3$ in their interval. * For the subset $\\\\{[1,1], [2,3], [3,3]\\\\}$, the score is $2$. By using one operation on changing the interval of vulnerability of the first planet to be $[1,2]$ and one operation on changing the interval of vulnerability of the third planet to $[2,3]$, all three planets will have the point $2$ in their interval. \n\nThe sum of scores of all non-empty subsets of the first testcase is $0 \\cdot 4 + 1 \\cdot 1 + 2\\cdot2 = 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": "2030G1", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sakurako's Task\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Sakurako has prepared a task for you:\n\nShe gives you an array of $n$ integers and allows you to choose $i$ and $j$ such that $i \\neq j$ and $a_i \\ge a_j$, and then assign $a_i = a_i - a_j$ or $a_i = a_i + a_j$. You can perform this operation any number of times for any $i$ and $j$, as long as they satisfy the conditions.\n\nSakurako asks you what is the maximum possible value of $mex_k$$^{\\text{βˆ—}}$ of the array after any number of operations.\n\n$^{\\text{βˆ—}}$$mex_k$ is the $k$-th non-negative integer that is absent in the array. For example, $mex_1(\\\\{1,2,3 \\\\})=0$, since $0$ is the first element that is not in the array, and $mex_2(\\\\{0,2,4 \\\\})=3$, since $3$ is the second element that is not in the array.\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 two integers $n$ and $k$ ($1\\le n\\le 2\\cdot 10^5,1\\le k\\le 10^9$) β€” the number of elements in the array and the value $k$ for $mex_k$.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\dots,a_n$ ($1\\le a_i\\le 10^9$) β€” the elements of the array.\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 the maximum $mex_k$ that can be achieved through the operations.\n\nExamples:\ninput:\n6\n1 3\n3\n2 10\n1 1\n3 1\n1 2 3\n3 2\n1 2 4\n4 5\n2 2 2 16\n4 5\n2 2 2 3\noutput:\n2\n11\n3\n4\n8\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": "2008G", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Showering\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: As a computer science student, Alex faces a hard challenge β€” showering. He tries to shower daily, but despite his best efforts there are always challenges. He takes $s$ minutes to shower and a day only has $m$ minutes!\n\nHe already has $n$ tasks planned for the day. Task $i$ is represented as an interval $(l_i$, $r_i)$, which means that Alex is busy and can not take a shower in that time interval (at any point in time strictly between $l_i$ and $r_i$). No two tasks overlap.\n\nGiven all $n$ time intervals, will Alex be able to shower that day? In other words, will Alex have a free time interval of length at least $s$?\n\n![](CDN_BASE_URL/5d5195053b99e5c6936ccefadc239679)\n\nIn the first test case, Alex can shower for the first $3$ minutes of the day and not miss any of the tasks.\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$, $s$, and $m$ ($1 \\leq n \\leq 2 \\cdot 10^5$; $1 \\leq s, m \\leq 10^9$) β€” the number of time intervals Alex already has planned, the amount of time Alex takes to take a shower, and the amount of minutes a day has.\n\nThen $n$ lines follow, the $i$-th of which contains two integers $l_i$ and $r_i$ ($0 \\leq l_i < r_i \\leq m$) β€” the time interval of the $i$-th task. No two tasks overlap.\n\nAdditional constraint on the input: $l_i > r_{i-1}$ for every $i > 1$.\n\nThe sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case output \"YES\" (without quotes) if Alex can take a shower for that given test case, and \"NO\" (also 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:\n4\n3 3 10\n3 5\n6 8\n9 10\n3 3 10\n1 2\n3 5\n6 7\n3 3 10\n1 2\n3 5\n6 8\n3 4 10\n1 2\n6 7\n8 9\noutput:\nYES\nYES\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": "1999C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Maximize the Largest Component (Hard 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$) and any column $c$ ($1 \\le c \\le m$), then sets every cell in row $r$ and 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\n7\n11\n16\n22\n36\n\nNote: In the fourth test case, it is optimal for Alex to set all cells in row $4$ and column $2$ to be '#'. Doing so will lead to the largest connected component of '#' having a size of $16$.\n\nIn the fifth test case, it is optimal for Alex to set all cells in row $2$ and column $4$ to be '#'. Doing so will lead to the largest connected component of '#' having a size of $22$.\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": "1985H2", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Circuit\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Alice has just crafted a circuit with $n$ lights and $2n$ switches. Each component (a light or a switch) has two states: on or off. The lights and switches are arranged in a way that:\n\n * Each light is connected to exactly two switches. * Each switch is connected to exactly one light. It's unknown which light each switch is connected to. * When all switches are off, all lights are also off. * If a switch is toggled (from on to off, or vice versa), the state of the light connected to it will also toggle. \n\nAlice brings the circuit, which shows only the states of the $2n$ switches, to her sister Iris and gives her a riddle: what is the minimum and maximum number of lights that can be turned on?\n\nKnowing her little sister's antics too well, Iris takes no more than a second to give Alice a correct answer. Can you do the same?\n\nInput: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \\le t \\le 500$) β€” 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 50$) β€” the number of lights in the circuit.\n\nThe second line of each test case contains $2n$ integers $a_1, a_2, \\ldots, a_{2n}$ ($0 \\le a_i \\le 1$) β€” the states of the switches in the circuit. $a_i = 0$ means the $i$-th switch is off, and $a_i = 1$ means the $i$-th switch is on.\n\nOutput: For each test case, output two integers β€” the minimum and maximum number of lights, respectively, that can be turned on.\n\nExamples:\ninput:\n5\n1\n0 0\n1\n0 1\n1\n1 1\n3\n0 0 1 0 1 0\n3\n0 1 1 1 0 0\noutput:\n0 0\n1 1\n0 0\n0 2\n1 3\n\nNote: In the first test case, there is only one light in the circuit, and no switch is on, so the light is certainly off.\n\nIn the second test case, there is only one light in the circuit, but one switch connected to it is on, so the light is on.\n\nIn the third test case, there is only one light in the circuit, and both switches are on, so the light is off as it was toggled twice.\n\nIn the fourth test case, to have no lights on, the switches can be arranged in this way:\n\n * Switch $1$ and switch $4$ are connected to light $1$. Since both switches are off, light $1$ is also off. * Switch $2$ and switch $6$ are connected to light $2$. Since both switches are off, light $2$ is also off. * Switch $3$ and switch $5$ are connected to light $3$. Both switches are on, so light $3$ is toggled twice from its initial off state, and thus also stays off. \n\nAnd to have $2$ lights on, the switches can be arranged in this way:\n\n * Switch $1$ and switch $2$ are connected to light $1$. Since both switches are off, light $1$ is also off. * Switch $3$ and switch $4$ are connected to light $2$. Since switch $3$ is on and switch $4$ is off, light $2$ is toggled once from its initial off state, so it is on. * Switch $5$ and switch $6$ are connected to light $3$. Since switch $5$ is on and switch $6$ is off, light $3$ is toggled once from its initial off state, so it is on.\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": "2032A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Catch the Coin\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Monocarp visited a retro arcade club with arcade cabinets. There got curious about the \"Catch the Coin\" cabinet.\n\nThe game is pretty simple. The screen represents a coordinate grid such that:\n\n * the X-axis is directed from left to right; * the Y-axis is directed from bottom to top; * the center of the screen has coordinates $(0, 0)$. \n\nAt the beginning of the game, the character is located in the center, and $n$ coins appear on the screen β€” the $i$-th coin is at coordinates $(x_i, y_i)$. The coordinates of all coins are different and not equal to $(0, 0)$.\n\nIn one second, Monocarp can move the character in one of eight directions. If the character is at coordinates $(x, y)$, then it can end up at any of the coordinates $(x, y + 1)$, $(x + 1, y + 1)$, $(x + 1, y)$, $(x + 1, y - 1)$, $(x, y - 1)$, $(x - 1, y - 1)$, $(x - 1, y)$, $(x - 1, y + 1)$.\n\nIf the character ends up at the coordinates with a coin, then Monocarp collects that coin.\n\nAfter Monocarp makes a move, all coins fall down by $1$, that is, they move from $(x, y)$ to $(x, y - 1)$. You can assume that the game field is infinite in all directions.\n\nMonocarp wants to collect at least one coin, but cannot decide which coin to go for. Help him determine, for each coin, whether he can collect it.\n\nInput: The first line contains a single integer $n$ ($1 \\le n \\le 500$) β€” the number of coins.\n\nIn the $i$-th of the next $n$ lines, two integers $x_i$ and $y_i$ ($-50 \\le x_i, y_i \\le 50$) are written β€” the coordinates of the $i$-th coin. The coordinates of all coins are different. No coin is located at $(0, 0)$.\n\nOutput: For each coin, print \"YES\" if Monocarp can collect it. Otherwise, print \"NO\".\n\nExamples:\ninput:\n5\n24 42\n-2 -1\n-1 -2\n0 -50\n15 0\noutput:\nYES\nYES\nNO\nNO\nYES\n\nNote: Pay attention to the second coin in the example. Monocarp can first move from $(0, 0)$ to $(-1, -1)$. Then the coin falls $1$ down and ends up at $(-2, -2)$. Finally, Monocarp moves to $(-2, -2)$ and collects the coin.\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": "1989A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sakurako's Box\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Sakurako has a box with $n$ balls. Each ball has it's value. She wants to bet with her friend that if the friend randomly picks two balls from the box (it could be two distinct balls, but they may have the same value), the product of their values will be the same as the number that Sakurako guessed.\n\nSince Sakurako has a PhD in probability, she knows that the best number to pick is [the expected value](http://tiny.cc/matozh_en), but she forgot how to calculate it. Help Sakurako and find the expected value of the product of two elements from the array.\n\nIt can be shown that the expected value has the form $\\frac{P}{Q}$, where $P$ and $Q$ are non-negative integers, and $Q \\ne 0$. Report the value of $P \\cdot Q^{-1}(\\bmod 10^9+7)$.\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 elements in the array.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\dots, a_n$ ($0\\le a_i\\le 10^9$) β€” the elements of the array.\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 the value of $P \\cdot Q^{-1}(\\bmod 10^9+7)$.\n\nExamples:\ninput:\n3\n3\n3 2 3\n4\n2 2 2 4\n5\n1 2 3 4 5\noutput:\n7\n6\n500000012\n\nNote: For the first test, Sakurako's friend can pick these pairs of balls: $(a_1,a_2)$, $(a_1,a_3)$, $(a_2,a_3)$. Their products equal to $3\\cdot 2=6$ , $3\\cdot 3=9$ , $3\\cdot 2=6$ respectively, so the expected value is $\\frac{6+9+6}{3}=7$.\n\nFor the second test, Sakurako's friend can pick these pairs of balls: $(a_1,a_2)$, $(a_1,a_3)$, $(a_1,a_4)$, $(a_2,a_3)$, $(a_2,a_4)$, $(a_3,a_4)$. Their products equal to $2\\cdot 2=4$ , $2\\cdot 2=4$ , $2\\cdot 4=8$, $2\\cdot 2=4$, $2\\cdot 4=8$, $2\\cdot 4=8$ respectively, so the expected value is $\\frac{4+4+8+4+8+8}{6}=\\frac{36}{6}=6$.\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": "2008F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Primary Task\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Dmitry wrote down $t$ integers on the board, and that is good. He is sure that he lost an important integer $n$ among them, and that is bad.\n\nThe integer $n$ had the form $\\text{10^x}$ ($x \\ge 2$), where the symbol '$\\text{^}$' denotes exponentiation.. Something went wrong, and Dmitry missed the symbol '$\\text{^}$' when writing the important integer. For example, instead of the integer $10^5$, he would have written $105$, and instead of $10^{19}$, he would have written $1019$.\n\nDmitry wants to understand which of the integers on the board could have been the important integer and which could not.\n\nInput: The first line of the input contains one integer $t$ ($1 \\le t \\le 10^4$) β€” the number of integers on the board.\n\nThe next $t$ lines each contain an integer $a$ ($1 \\le a \\le 10000$) β€” the next integer from the board.\n\nOutput: For each integer on the board, output \"YES\" if it could have been the important integer and \"NO\" otherwise.\n\nYou may 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:\n7\n100\n1010\n101\n105\n2033\n1019\n1002\noutput:\nNO\nYES\nNO\nYES\nNO\nYES\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": "2000A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Only Pluses\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Kmes has written three integers $a$, $b$ and $c$ in order to remember that he has to give Noobish_Monk $a \\times b \\times c$ bananas.\n\nNoobish_Monk has found these integers and decided to do the following at most $5$ times:\n\n * pick one of these integers; * increase it by $1$. \n\nFor example, if $a = 2$, $b = 3$ and $c = 4$, then one can increase $a$ three times by one and increase $b$ two times. After that $a = 5$, $b = 5$, $c = 4$. Then the total number of bananas will be $5 \\times 5 \\times 4 = 100$.\n\nWhat is the maximum value of $a \\times b \\times c$ Noobish_Monk can achieve with these operations?\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 and only line of each test case contains three integers $a$, $b$ and $c$ ($1 \\le a, b, c \\le 10$) β€” Kmes's integers.\n\nOutput: For each test case, output a single integer β€” the maximum amount of bananas Noobish_Monk can get.\n\nExamples:\ninput:\n2\n2 3 4\n10 1 10\noutput:\n100\n600\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": "1992A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Squaring\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: ikrpprpp found an array $a$ consisting of integers. He likes justice, so he wants to make $a$ fair β€” that is, make it non-decreasing. To do that, he can perform an act of justice on an index $1 \\le i \\le n$ of the array, which will replace $a_i$ with $a_i ^ 2$ (the element at position $i$ with its square). For example, if $a = [2,4,3,3,5,3]$ and ikrpprpp chooses to perform an act of justice on $i = 4$, $a$ becomes $[2,4,3,9,5,3]$.\n\nWhat is the minimum number of acts of justice needed to make the array non- decreasing?\n\nInput: First line contains an integer $t$ ($1 \\le t \\le 1000$) β€” the number of test cases. It is followed by the description of test cases.\n\nFor each test case, the first line contains an integer $n$ β€” size of the array $a$. The second line contains $n$ ($1 \\le n \\le 2 \\cdot 10 ^5$) integers $a_1, a_2,\\ldots, a_n$ ($1 \\le a_i \\le 10 ^ 6$).\n\nThe sum of $n$ over all test cases does not exceed $2 \\cdot {10}^5$.\n\nOutput: For each testcase, print an integer β€” minimum number of acts of justice required to make the array $a$ non-decreasing. If it is impossible to do that, print $-1$.\n\nExamples:\ninput:\n7\n3\n1 2 3\n2\n3 2\n3\n3 1 5\n4\n1 1 2 3\n3\n4 3 2\n9\n16 2 4 2 256 2 4 2 8\n11\n10010 10009 10008 10007 10006 10005 10004 10003 10002 10001 10000\noutput:\n0\n1\n-1\n0\n3\n15\n55\n\nNote: In the first test case, there's no need to perform acts of justice. The array is fair on its own!\n\nIn the third test case, it can be proven that the array cannot become non- decreasing.\n\nIn the fifth test case, ikrpprppp can perform an act of justice on index 3, then an act of justice on index 2, and finally yet another act of justice on index 3. After that, $a$ will become $[4, 9, 16]$.\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": "1995C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Black Circles\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: There are $n$ circles on a two-dimensional plane. The $i$-th circle is centered at $(x_i,y_i)$. Initially, all circles have a radius of $0$.\n\nThe circles' radii increase at a rate of $1$ unit per second.\n\nYou are currently at $(x_s,y_s)$; your goal is to reach $(x_t,y_t)$ without touching the circumference of any circle (including the moment you reach $(x_t,y_t)$). You can move in any direction you want. However, your speed is limited to $1$ unit per second.\n\nPlease determine whether this is possible.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1\\le t\\le10^4$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $n$ ($1\\le n\\le10^5$) β€” the number of circles.\n\nThe next $n$ lines each contain two integers $x_i$, $y_i$ ($1\\le x_i,y_i\\le10^9$) β€” the center of each circle.\n\nThe final line contains four integers $x_s$, $y_s$, $x_t$, $y_t$ ($1\\le x_s,y_s,x_t,y_t\\le10^9$) β€” the coordinates of the starting point and the goal, respectively.\n\nIt is guaranteed that these $n+2$ points are distinct.\n\nIt is guaranteed that the sum of $n$ over all testcases does not exceed $10^5$.\n\nOutput: For each test case, output $\\texttt{YES}$ if it is possible to reach the goal without touching the circle boundaries, and output $\\texttt{NO}$ otherwise.\n\nYou can output $\\texttt{Yes}$ and $\\texttt{No}$ in any case (for example, strings $\\texttt{yEs}$, $\\texttt{yes}$, $\\texttt{Yes}$, and $\\texttt{YES}$ will be recognized as a positive response).\n\nExamples:\ninput:\n7\n3\n2 5\n2 14\n10 13\n4 9 9 7\n3\n10 11\n6 9\n12 12\n14 13 4 8\n1\n5 7\n12 6 11 13\n2\n1000000000 2\n2 1000000000\n1 1 2 2\n1\n999999998 1000000000\n999999999 999999999 1 1\n1\n1000000000 1\n1 1000000000 1 1\n10\n989237121 2397081\n206669655 527238537\n522705783 380636165\n532545346 320061691\n207818728 199485303\n884520552 315781807\n992311437 802563521\n205138355 324818663\n223575704 395073023\n281560523 236279118\n216941610 572010615 323956540 794523071\noutput:\nYES\nNO\nYES\nYES\nYES\nNO\nYES\n\nNote: In the first test case, a feasible way of movement is as follows.\n\n![](CDN_BASE_URL/235d765e20897c623b3ac974eceac134)\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": "2002C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: A Gift From Orangutan\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: While exploring the jungle, you have bumped into a rare orangutan with a bow tie! You shake hands with the orangutan and offer him some food and water. In return...\n\nThe orangutan has gifted you an array $a$ of length $n$. Using $a$, you will construct two arrays $b$ and $c$, both containing $n$ elements, in the following manner:\n\n * $b_i = \\min(a_1, a_2, \\ldots, a_i)$ for each $1 \\leq i \\leq n$. * $c_i = \\max(a_1, a_2, \\ldots, a_i)$ for each $1 \\leq i \\leq n$. \n\nDefine the score of $a$ as $\\sum_{i=1}^n c_i - b_i$ (i.e. the sum of $c_i - b_i$ over all $1 \\leq i \\leq n$). Before you calculate the score, you can shuffle the elements of $a$ however you want.\n\nFind the maximum score that you can get if you shuffle the elements of $a$ optimally.\n\nInput: The first line contains $t$ ($1 \\leq t \\leq 100$) β€” the number of test cases.\n\nThe first line of each test case contains an integer $n$ ($1 \\leq n \\leq 1000$) β€” the number of elements in $a$.\n\nThe following line contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\leq a_i \\leq 1000$) β€” the elements of the array $a$.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $1000$.\n\nOutput: For each test case, output the maximum score that you can get.\n\nExamples:\ninput:\n3\n1\n69\n3\n7 6 5\n5\n1 1 1 2 2\noutput:\n0\n4\n4\n\nNote: In the first test case, there is no other way to rearrange $a$. So, $b = [69]$ and $c = [69]$. The only possible score is $69 - 69 = 0$.\n\nIn the second test case, you can rearrange $a$ as $[7, 5, 6]$. Here, $b = [7, 5, 5]$ and $c = [7, 7, 7]$. The score in this case is $(7 - 7) + (7 - 5) + (7 - 5) = 4$. It can be shown this is the maximum possible 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": "2030A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Scale\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Tina has a square grid with $n$ rows and $n$ columns. Each cell in the grid is either $0$ or $1$.\n\nTina wants to reduce the grid by a factor of $k$ ($k$ is a divisor of $n$). To do this, Tina splits the grid into $k \\times k$ nonoverlapping blocks of cells such that every cell belongs to exactly one block.\n\nTina then replaces each block of cells with a single cell equal to the value of the cells in the block. It is guaranteed that every cell in the same block has the same value.\n\nFor example, the following demonstration shows a grid being reduced by factor of $3$.\n\nOriginal grid $0$| $0$| $0$| $1$| $1$| $1$ ---|---|---|---|---|--- $0$| $0$| $0$| $1$| $1$| $1$ $0$| $0$| $0$| $1$| $1$| $1$ $1$| $1$| $1$| $0$| $0$| $0$ $1$| $1$| $1$| $0$| $0$| $0$ $1$| $1$| $1$| $0$| $0$| $0$ Reduced grid $0$| $1$ ---|--- $1$| $0$ Help Tina reduce the grid by a factor of $k$.\n\nInput: The first line contains $t$ ($1 \\leq t \\leq 100$) – the number of test cases.\n\nThe first line of each test case contains two integers $n$ and $k$ ($1 \\leq n \\leq 1000$, $1 \\le k \\le n$, $k$ is a divisor of $n$) β€” the number of rows and columns of the grid, and the factor that Tina wants to reduce the grid by.\n\nEach of the following $n$ lines contain $n$ characters describing the cells of the grid. Each character is either $0$ or $1$. It is guaranteed every $k$ by $k$ block has the same value.\n\nIt is guaranteed the sum of $n$ over all test cases does not exceed $1000$.\n\nOutput: For each test case, output the grid reduced by a factor of $k$ on a new line.\n\nExamples:\ninput:\n4\n4 4\n0000\n0000\n0000\n0000\n6 3\n000111\n000111\n000111\n111000\n111000\n111000\n6 2\n001100\n001100\n111111\n111111\n110000\n110000\n8 1\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\noutput:\n0\n01\n10\n010\n111\n100\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\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": "1996B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Iris and Adjacent Products\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: Iris has just learned multiplication in her Maths lessons. However, since her brain is unable to withstand too complex calculations, she could not multiply two integers with the product greater than $k$ together. Otherwise, her brain may explode!\n\nHer teacher sets a difficult task every day as her daily summer holiday homework. Now she is given an array $a$ consisting of $n$ elements, and she needs to calculate the product of each two adjacent elements (that is, $a_1 \\cdot a_2$, $a_2 \\cdot a_3$, and so on). Iris wants her brain to work safely, and in order to do that, she would like to modify the array $a$ in such a way that $a_i \\cdot a_{i + 1} \\leq k$ holds for every $1 \\leq i < n$. There are two types of operations she can perform:\n\n 1. She can rearrange the elements of the array $a$ in an arbitrary way. 2. She can select an arbitrary element of the array $a$ and change its value to an arbitrary integer from $1$ to $k$. \n\nIris wants to minimize the number of operations of type $2$ that she uses.\n\nHowever, that's completely not the end of the summer holiday! Summer holiday lasts for $q$ days, and on the $i$-th day, Iris is asked to solve the Math homework for the subarray $b_{l_i}, b_{l_i + 1}, \\ldots, b_{r_i}$. Help Iris and tell her the minimum number of type $2$ operations she needs to perform for each day. Note that the operations are independent for each day, i.e. the array $b$ is not changed.\n\nInput: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \\leq t \\leq 5\\cdot 10^4$) β€” the number of test cases. The description of the test cases follows.\n\nThe first line of each test case contains three integers $n$, $q$ and $k$ ($2 \\leq n \\leq 10^5$, $1 \\leq q \\leq 10^5$, $1 \\leq k \\leq 10^6$) β€” the length of array $b$, the number of days, and the upper bound for the multiplication calculation.\n\nThe second line of each test case contains $n$ integers $b_1, b_2, \\ldots, b_n$ ($1 \\leq b_i \\leq k$) β€” the elements of the array $b$.\n\nThen $q$ lines follow, the $i$-th of them contains two integers $l_i$ and $r_i$ ($1 \\leq l_i < r_i \\leq n$) β€” the boundaries of the subarray on the $i$-th day.\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, output a single line containing $q$ integers β€” the minimum number of operations of type $2$ needed for each day.\n\nExamples:\ninput:\n5\n3 1 1\n1 1 1\n1 3\n3 2 10\n1 10 9\n1 3\n2 3\n5 4 2\n2 2 2 2 2\n1 2\n2 4\n2 5\n1 5\n6 5 10\n3 2 5 10 10 1\n1 4\n3 6\n1 6\n2 5\n5 6\n10 10 10\n10 9 8 7 6 5 4 3 2 1\n1 10\n1 9\n1 8\n1 7\n2 10\n3 10\n4 10\n5 10\n3 9\n6 8\noutput:\n0 \n0 1 \n1 1 2 2 \n1 1 1 1 0 \n3 3 4 3 2 2 1 1 2 1\n\nNote: In the first test case, as Iris can always multiply $1$ and $1$ together, no operations are needed, so the answer is $0$.\n\nIn the second test case, the first day's homework is $[1, 10, 9]$. Iris can rearrange its elements to get $[9, 1, 10]$, so no operations of type $2$ are needed. The second day's homework is $[10, 9]$, and she can change one element to get the array $[1, 9]$, so one operation of type $2$ is needed.\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": "2006D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sakurako and Water\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: During her journey with Kosuke, Sakurako and Kosuke found a valley that can be represented as a matrix of size $n \\times n$, where at the intersection of the $i$-th row and the $j$-th column is a mountain with a height of $a_{i,j}$. If $a_{i,j} < 0$, then there is a lake there.\n\nKosuke is very afraid of water, so Sakurako needs to help him:\n\n * With her magic, she can select a square area of mountains and increase the height of each mountain on the main diagonal of that area by exactly one. \n\nMore formally, she can choose a submatrix with the upper left corner located at $(i, j)$ and the lower right corner at $(p, q)$, such that $p-i=q-j$. She can then add one to each element at the intersection of the $(i + k)$-th row and the $(j + k)$-th column, for all $k$ such that $0 \\le k \\le p-i$.\n\nDetermine the minimum number of times Sakurako must use her magic so that there are no lakes.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 200$) β€” the number of test cases.\n\nEach test case is described as follows:\n\n * The first line of each test case consists of a single number $n$ ($1 \\le n \\le 500$). * Each of the following $n$ lines consists of $n$ integers separated by spaces, which correspond to the heights of the mountains in the valley $a$ ($-10^5 \\le a_{i,j} \\le 10^5$). \n\nIt is guaranteed that the sum of $n$ across all test cases does not exceed $1000$.\n\nOutput: For each test case, output the minimum number of times Sakurako will have to use her magic so that all lakes disappear.\n\nExamples:\ninput:\n4\n1\n1\n2\n-1 2\n3 0\n3\n1 2 3\n-2 1 -1\n0 0 -1\n5\n1 1 -1 -1 3\n-3 1 4 4 -4\n-1 -1 3 0 -5\n4 5 3 -3 -1\n3 1 -3 -1 5\noutput:\n0\n1\n4\n19\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": "2033B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Startup\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Arseniy came up with another business plan β€” to sell soda from a vending machine! For this, he purchased a machine with $n$ shelves, as well as $k$ bottles, where the $i$-th bottle is characterized by the brand index $b_i$ and the cost $c_i$.\n\nYou can place any number of bottles on each shelf, but all bottles on the same shelf must be of the same brand.\n\nArseniy knows that all the bottles he puts on the shelves of the machine will be sold. Therefore, he asked you to calculate the maximum amount he can earn.\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 $k$ ($1 \\le n, k \\le 2 \\cdot 10^5$), where $n$ is the number of shelves in the machine, and $k$ is the number of bottles available to Arseniy.\n\nThe next $k$ lines contain two integers $b_i$ and $c_i$ ($1 \\le b_i \\le k, 1 \\le c_i \\le 1000$) β€” the brand and cost of the $i$-th bottle.\n\nIt is also guaranteed that the sum of $n$ across all test cases does not exceed $2 \\cdot 10^5$ and that the sum of $k$ across all test cases also does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output one integer β€” the maximum amount that Arseniy can earn.\n\nExamples:\ninput:\n4\n3 3\n2 6\n2 7\n1 15\n1 3\n2 6\n2 7\n1 15\n6 2\n1 7\n2 5\n190000 1\n1 1000\noutput:\n28\n15\n12\n1000\n\nNote: In the first test case, Arseniy has $3$ shelves in the vending machine. He can place, for example, two bottles of the brand $2$ on the first shelf and a bottle of the brand $1$ on the second shelf. Then the total cost of the bottles would be $6 + 7 + 15 = 28$.\n\nIn the second test case, he has only one shelf. It is not difficult to show that the optimal option is to place a bottle of the brand $1$ on it. Then the total cost will be $15$.\n\nIn the third test case, he has as many as $6$ shelves, so he can place all available bottles with a total cost of $7 + 5 = 12$.\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": "2036B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Eliminating Balls With Merging (Easy Version)\ntime_limit_ms: 4000\nmemory_limit_mb: 512\nDescription: Drink water.\n\nβ€” Sun Tzu, The Art of Becoming a Healthy Programmer\n\nThis is the easy version of the problem. The only difference is that $x=n$ in this version. You must solve both versions to be able to hack.\n\nYou are given two integers $n$ and $x$ ($x=n$). There are $n$ balls lined up in a row, numbered from $1$ to $n$ from left to right. Initially, there is a value $a_i$ written on the $i$-th ball.\n\nFor each integer $i$ from $1$ to $n$, we define a function $f(i)$ as follows:\n\n * Suppose you have a set $S = \\\\{1, 2, \\ldots, i\\\\}$.\n\n * In each operation, you have to select an integer $l$ ($1 \\leq l < i$) from $S$ such that $l$ is not the largest element of $S$. Suppose $r$ is the smallest element in $S$ which is greater than $l$.\n\n * If $a_l > a_r$, you set $a_l = a_l + a_r$ and remove $r$ from $S$. * If $a_l < a_r$, you set $a_r = a_l + a_r$ and remove $l$ from $S$. * If $a_l = a_r$, you choose either the integer $l$ or $r$ to remove from $S$: * If you choose to remove $l$ from $S$, you set $a_r = a_l + a_r$ and remove $l$ from $S$. * If you choose to remove $r$ from $S$, you set $a_l = a_l + a_r$ and remove $r$ from $S$. \n\n * $f(i)$ denotes the number of integers $j$ ($1 \\le j \\le i$) such that it is possible to obtain $S = \\\\{j\\\\}$ after performing the above operations exactly $i - 1$ times. \n\nFor each integer $i$ from $x$ to $n$, you need to find $f(i)$.\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 $x$ ($1 \\leq n \\leq 2 \\cdot 10^5; x = n$) β€” the number of balls and the smallest index $i$ for which you need to find $f(i)$.\n\nThe second line of each test case contains $a_1, a_2, \\ldots, a_n$ ($1 \\leq a_i \\leq 10^9$) β€” the initial number written on each ball.\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-x+1$ space separated integers on a new line, where the $j$-th integer should represent $f(x+j-1)$.\n\nExamples:\ninput:\n3\n5 5\n1 2 3 2 1\n7 7\n4 5 1 2 1 4 5\n11 11\n1 2 3 1 1 9 3 2 4 1 3\noutput:\n3\n4\n4\n\nNote: In the first test case, you are required to calculate $f(5)$. It can be shown that after $4$ operations, $S$ can contain $2$, $3$, or $4$. The following shows the operations required to make $S = \\\\{4\\\\}$.\n\n * Initially, $S = \\\\{1, 2, 3, 4, 5\\\\}$ and $a = [1, 2, 3, 2, 1]$. * Choose $l = 1$. Naturally, $r = 2$. Since $a_1 < a_2$, we set $a_2 = 1 + 2$ and remove $1$ from $S$. Now, $S = \\\\{2, 3, 4, 5\\\\}$ and $a = [1, 3, 3, 2, 1]$. * Choose $l = 4$. Naturally, $r = 5$. Since $a_4 > a_5$, we set $a_4 = 2 + 1$ and remove $5$ from $S$. Now, $S = \\\\{2, 3, 4\\\\}$ and $a = [1, 3, 3, 3, 1]$. * Choose $l = 3$. Naturally, $r = 4$. Since $a_3 = a_4$, we have a choice whether to remove $3$ or $4$. Since we want to preserve $4$, let's remove $3$. So, set $a_4 = 3 + 3$ and remove $3$ from $S$. Now, $S = \\\\{2, 4\\\\}$ and $a = [1, 3, 3, 6, 1]$. * Choose $l = 2$. Naturally, $r = 4$. Since $a_2 < a_4$, we set $a_4 = 3 + 6$ and remove $2$ from $S$. Finally, $S = \\\\{4\\\\}$ and $a = [1, 3, 3, 9, 1]$. \n\nIn the second test case, you are required to calculate $f(7)$. It can be shown that after $6$ operations, $S$ can contain $2$, $4$, $6$, or $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": "1998E1", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: I Love Balls\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Alice and Bob are playing a game. There are $n$ balls, out of which $k$ are special. Each ball has a value associated with it.\n\nThe players play turn by turn. In each turn, the player randomly picks a ball and adds the value of the ball to their score, which is $0$ at the beginning of the game. The selected ball is removed from the game. If the ball was special, the same player takes the next turn if at least one ball is remaining. If the ball picked was not special, the next player plays their turn.\n\nThey play this game until no balls are remaining in the game. Alice plays first.\n\nFind the expected score that both the players have at the end of the game modulo $10^9+7$.\n\nFormally, let $M = 10^9+7$. 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: There are multiple test cases. The first line of the input contains an integer $t$, the number of test cases ($1 \\le t \\le 2 \\cdot 10^5$).\n\nEach test case description is on a new line. The first line of the test case contains two integers $n$ and $k$ in the respective order separated by a space ($1 \\le k \\le n \\le 4 \\cdot 10^5$).\n\nThe second line of the test case contains $n$ integers: $v_1, v_2, \\ldots, v_n$, the value for each ball separated by spaces. The first $k$ balls are special ($1 \\le v_i \\le 10^7$).\n\nThe sum of $n$ over all test cases does not exceed $5 \\cdot 10^5$.\n\nOutput: Output two integers per test case in a new line, the expected score of Alice and the expected score of Bob modulo $10^9+7$.\n\nExamples:\ninput:\n1\n5 2\n10 20 5 15 25\noutput:\n45 30\n\ninput:\n5\n1 1\n732507\n2 2\n5817860 5398510\n5 1\n2122894 4951549 2750585 7821535 3214167\n8 4\n1405323 5069867 6883092 6972029 328406 2478975 7628890 9973340\n4 2\n9662050 3566134 3996473 9872255\noutput:\n732507 0\n11216370 0\n810642660 210218077\n722402997 318336932\n349086489 678010430\n\ninput:\n5\n3 3\n1095611 8219204 7773462\n2 1\n8176490 2774103\n3 1\n9178636 5138057 3367761\n12 9\n7597698 6843019 2298534 1522386 4969588 1340345 3967362 9152890 6689668 9986080 4745473 7407325\n10 5\n6986368 2397882 5804127 6980694 3740836 3215836 5195724 3179261 4136769 4544231\noutput:\n17088277 0\n6862348 4088245\n677038671 340645790\n36949997 29570371\n725118051 321063684\n\nNote: In the first test case, Alice's expected score is $45$, and Bob's is $30$ at the end of the game.\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": "1983E", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Elections\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Elections are taking place in Berland. There are $n$ candidates participating in the elections, numbered from $1$ to $n$. The $i$-th candidate has $a_i$ fans who will vote for him. Additionally, there are $c$ people who are undecided about their favorite candidate, let's call them undecided. Undecided people will vote for the candidate with the lowest number.\n\nThe candidate who receives the maximum number of votes wins the elections, and if multiple candidates receive the same maximum number of votes, the candidate with the lowest number among them wins.\n\nYou found these elections too boring and predictable, so you decided to exclude some candidates from them. If you do not allow candidate number $i$ to participate in the elections, all $a_i$ of his fans will become undecided, and will vote for the candidate with the lowest number.\n\nYou are curious to find, for each $i$ from $1$ to $n$, the minimum number of candidates that need to be excluded from the elections for candidate number $i$ to win the elections.\n\nInput: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \\leq t \\leq 2 \\cdot 10^4$) β€” the number of test cases. The description of the test cases follows.\n\nThe first line of each test case contains two integers $n$ and $c$ ($1 \\le n \\le 2 \\cdot 10^5$, $0 \\le c \\le 10^9$) β€” the number of candidates in the elections and the number of undecided people.\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 number of fans for each candidate.\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, the $i$-th of which should be equal to the minimum number of candidates that need to be excluded from the elections for candidate number $i$ to win.\n\nExamples:\ninput:\n5\n3 1\n2 0 3\n2 3\n0 10\n5 3\n5 4 3 2 1\n4 5\n3 10 7 1\n6 0\n2 2 2 3 3 3\noutput:\n0 1 2\n1 0\n0 1 2 3 4\n1 0 2 3\n1 1 2 0 4 5\n\nNote: In the first test case:\n\n * If all candidates are allowed, candidate number $1$ will receive $3$ votes ($1$ undecided person will vote for him), candidate number $2$ will receive $0$ votes, and candidate number $3$ will receive $3$ votes. Therefore, candidate number $1$ wins (he received the same number of votes as candidate $3$, but his number is lower), so the answer for him is $0$. * If candidate number $1$ is not allowed, his $2$ fans will become undecided. Then candidate number $2$ will receive $3$ votes ($3$ undecided people will vote for him) and candidate number $3$ will receive $3$ votes. Therefore, candidate number $2$ wins (he received the same number of votes as candidate $3$, but his number is lower), so the answer for him is $1$. * If candidates with numbers $1$ and $2$ are not allowed, candidate number $3$ wins, so the answer for him is $2$.\n\nIn the second test case, candidate number $1$ will win if candidate number $2$ is not allowed to participate.\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": "1978D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Paint the Tree\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: 378QAQ has a tree with $n$ vertices. Initially, all vertices are white.\n\nThere are two chess pieces called $P_A$ and $P_B$ on the tree. $P_A$ and $P_B$ are initially located on vertices $a$ and $b$ respectively. In one step, 378QAQ will do the following in order:\n\n 1. Move $P_A$ to a neighboring vertex. If the target vertex is white, this vertex will be painted red. 2. Move $P_B$ to a neighboring vertex. If the target vertex is colored in red, this vertex will be painted blue. \n\nInitially, the vertex $a$ is painted red. If $a=b$, the vertex $a$ is painted blue instead. Note that both the chess pieces must be moved in each step. Two pieces can be on the same vertex at any given time.\n\n378QAQ wants to know the minimum number of steps to paint all vertices blue.\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 one integer $n$ ($1\\leq n\\leq 2\\cdot 10^5$).\n\nThe second line of each test case contains two integers $a$ and $b$ ($1\\leq a,b\\leq n$).\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\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 minimum number of steps to paint all vertices blue.\n\nExamples:\ninput:\n3\n2\n1 2\n1 2\n5\n1 2\n1 2\n1 3\n1 4\n1 5\n8\n5 4\n7 1\n1 5\n1 8\n8 3\n7 2\n8 6\n3 4\noutput:\n2\n8\n13\n\nNote: In the first test case, 378QAQ can paint all vertices blue in the following order:\n\n * Initially, $P_A$ is located on the vertex $1$, and $P_B$ is located on the vertex $2$. The vertex $1$ is painted red and the vertex $2$ is white. * 378QAQ moves $P_A$ to the vertex $2$ and paints it red. Then 378QAQ moves $P_B$ to the vertex $1$ and paints it blue. * 378QAQ moves $P_A$ to the vertex $1$. Then 378QAQ moves $P_B$ to the vertex $2$ and paints it blue.\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": "1975D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Two Movies\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: A movie company has released $2$ movies. These $2$ movies were watched by $n$ people. For each person, we know their attitude towards the first movie (liked it, neutral, or disliked it) and towards the second movie.\n\nIf a person is asked to leave a review for the movie, then:\n\n * if that person liked the movie, they will leave a positive review, and the movie's rating will increase by $1$; * if that person disliked the movie, they will leave a negative review, and the movie's rating will decrease by $1$; * otherwise, they will leave a neutral review, and the movie's rating will not change. \n\nEvery person will review exactly one movie β€” and for every person, you can choose which movie they will review.\n\nThe company's rating is the minimum of the ratings of the two movies. Your task is to calculate the maximum possible rating of the company.\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$).\n\nThe second line contains $n$ integers $a_1, a_2, \\dots, a_n$ ($-1 \\le a_i \\le 1$), where $a_i$ is equal to $-1$ if the first movie was disliked by the $i$-th viewer; equal to $1$ if the first movie was liked; and $0$ if the attitude is neutral.\n\nThe third line contains $n$ integers $b_1, b_2, \\dots, b_n$ ($-1 \\le b_i \\le 1$), where $b_i$ is equal to $-1$ if the second movie was disliked by the $i$-th viewer; equal to $1$ if the second movie was liked; and $0$ if the attitude is neutral.\n\nAdditional constraint on the input: the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, print a single integer β€” the maximum possible rating of the company, if for each person, choose which movie to leave a review on.\n\nExamples:\ninput:\n4\n2\n-1 1\n-1 -1\n1\n-1\n-1\n5\n0 -1 1 0 1\n-1 1 0 0 1\n4\n-1 -1 -1 1\n-1 1 1 1\noutput:\n0\n-1\n1\n1\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": "1989C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Palindrome Everywhere\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: You are given a cycle with $n$ vertices numbered from $0$ to $n-1$. For each $0\\le i\\le n-1$, there is an undirected edge between vertex $i$ and vertex $((i+1)\\bmod n)$ with the color $c_i$ ($c_i=\\texttt{R}$ or $\\texttt{B}$).\n\nDetermine whether the following condition holds for every pair of vertices $(i,j)$ ($0\\le i<j\\le n-1$):\n\n * There exists a palindrome route between vertex $i$ and vertex $j$. Note that the route may not be simple. Formally, there must exist a sequence $p=[p_0,p_1,p_2,\\ldots,p_m]$ such that: * $p_0=i$, $p_m=j$; * For each $0\\leq x\\le m-1$, either $p_{x+1}=(p_x+1)\\bmod n$ or $p_{x+1}=(p_{x}-1)\\bmod n$; * For each $0\\le x\\le y\\le m-1$ satisfying $x+y=m-1$, the edge between $p_x$ and $p_{x+1}$ has the same color as the edge between $p_y$ and $p_{y+1}$.\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 number of test cases. The description of the test cases follows.\n\nThe first line of each test case contains an integer $n$ ($3\\leq n\\leq10^6$) β€” the number of vertices in the cycle.\n\nThe second line contains a string $c$ of length $n$ ($c_i=\\texttt{R}$ or $\\texttt{B}$) β€” the color of each edge.\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 \"YES\" (without quotes) if there is a palindrome route between any pair of nodes, 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\n5\nRRRRR\n5\nRRRRB\n5\nRBBRB\n6\nRBRBRB\n6\nRRBBRB\n5\nRBRBR\n12\nRRBRRBRRBRRB\noutput:\nYES\nYES\nYES\nNO\nNO\nYES\nNO\n\nNote: In the first test case, it is easy to show that there is a palindrome route between any two vertices.\n\nIn the second test case, for any two vertices, there exists a palindrome route with only red edges.\n\nIn the third test case, the cycle is as follows: $0\\color{red}{\\overset{\\texttt{R}}{\\longleftrightarrow}}1\\color{blue}{\\overset{\\texttt{B}}{\\longleftrightarrow}}2\\color{blue}{\\overset{\\texttt{B}}{\\longleftrightarrow}}3\\color{red}{\\overset{\\texttt{R}}{\\longleftrightarrow}}4\\color{blue}{\\overset{\\texttt{B}}{\\longleftrightarrow}}0$. Take $(i,j)=(0,3)$ as an example, then $0\\color{red}{\\overset{\\texttt{R}}{\\longrightarrow}}1\\color{blue}{\\overset{\\texttt{B}}{\\longrightarrow}}2\\color{blue}{\\overset{\\texttt{B}}{\\longrightarrow}}3\\color{red}{\\overset{\\texttt{R}}{\\longrightarrow}}4\\color{blue}{\\overset{\\texttt{B}}{\\longrightarrow}}0\\color{blue}{\\overset{\\texttt{B}}{\\longrightarrow}}4\\color{red}{\\overset{\\texttt{R}}{\\longrightarrow}}3$ is a palindrome route. Thus, the condition holds for $(i,j)=(0,3)$.\n\nIn the fourth test case, when $(i,j)=(0,2)$, there does not exist a palindrome route.\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": "2029F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Profitable Interest Rate\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Alice has $a$ coins. She can open a bank deposit called \"Profitable\", but the minimum amount required to open this deposit is $b$ coins.\n\nThere is also a deposit called \"Unprofitable\", which can be opened with any amount of coins. Alice noticed that if she opens the \"Unprofitable\" deposit with $x$ coins, the minimum amount required to open the \"Profitable\" deposit decreases by $2x$ coins. However, these coins cannot later be deposited into the \"Profitable\" deposit.\n\nHelp Alice determine the maximum number of coins she can deposit into the \"Profitable\" deposit if she first deposits some amount of coins (possibly $0$) into the \"Unprofitable\" deposit. If Alice can never open the \"Profitable\" deposit, output $0$.\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\nA single line of each test case contains two integers $a$ and $b$ ($1 \\le a, b \\le 10^9$) β€” the number of coins Alice has and the initial minimum amount required to open the \"Profitable\" deposit.\n\nOutput: For each test case, output a single integer β€” the maximum number of coins that Alice can deposit into the \"Profitable\" deposit. If Alice can never open the \"Profitable\" deposit, output $0$.\n\nExamples:\ninput:\n5\n10 5\n7 9\n5 100\n1 1\n1 2\noutput:\n10\n5\n0\n1\n0\n\nNote: In the first test case, $a \\ge b$, so Alice can immediately open the \"Profitable\" deposit with all $10$ coins.\n\nIn the second test case, Alice can open the \"Unprofitable\" deposit with $2$ coins. Then she will have $5$ coins left, but the minimum amount required to open the \"Profitable\" deposit will decrease by $4$ coins, making it equal to $5$ coins. Thus, Alice will be able to open the \"Profitable\" deposit with $5$ coins.\n\nIn the third test case, Alice will not be able to open the \"Profitable\" deposit.\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": "2024A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Submission Bait\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Alice and Bob are playing a game in an array $a$ of size $n$.\n\nThey take turns to do operations, with Alice starting first. The player who can not operate will lose. At first, a variable $mx$ is set to $0$.\n\nIn one operation, a player can do:\n\n * Choose an index $i$ ($1 \\le i \\le n$) such that $a_{i} \\geq mx$ and set $mx$ to $a_{i}$. Then, set $a_{i}$ to $0$.\n\nDetermine whether Alice has a winning strategy.\n\nInput: The first line contains an integer $t$ ($1 \\leq t \\leq 10^3$) β€” the number of test cases.\n\nFor each test case:\n\n * The first line contains an integer $n$ ($2 \\leq n \\leq 50$) β€” the size of the array. * The second line contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\leq a_i \\leq n$) β€” the elements of the array.\n\nOutput: For each test case, if Alice has a winning strategy, output \"YES\". 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:\n5\n2\n2 1\n2\n1 1\n3\n3 3 3\n4\n3 3 4 4\n4\n1 2 2 2\noutput:\nYES\nNO\nYES\nNO\nYES\n\nNote: In the first test case, Alice can choose $i=1$ since $a_1=2 \\ge mx=0$.\n\nAfter Alice's operation, $a=[0,1]$ and $mx=2$. Bob can not do any operation. Alice wins.\n\nIn the second test case, Alice doesn't have a winning strategy.\n\nFor example, if Alice chooses $i=1$, after Alice's operation: $a=[0,1]$ and $mx=1$. Then, Bob can choose $i=2$ since $a_2=1 \\ge mx=1$. After Bob's operation: $a=[0,0]$ and $mx=1$. Alice can not do any operation. Bob wins.\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": "1990A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Chess For Three\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Three friends gathered to play a few games of chess together.\n\nIn every game, two of them play against each other. The winner gets $2$ points while the loser gets $0$, and in case of a draw, both players get $1$ point each. Note that the same pair of players could have played any non-negative number of times (possibly zero). It is also possible that no games were played at all.\n\nYou've been told that their scores after all the games were played were $p_1$, $p_2$ and $p_3$. Additionally, it is guaranteed that $p_1 \\leq p_2 \\leq p_3$ holds.\n\nFind the maximum number of draws that could have happened and print it. If there isn't any way to obtain $p_1$, $p_2$ and $p_3$ as a result of a non-negative number of games between the three players, print $-1$ instead.\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 three integers $p_1$, $p_2$ and $p_3$ ($0 \\leq p_1 \\leq p_2 \\leq p_3 \\leq 30$) β€” the scores of the three players, sorted non-decreasingly.\n\nOutput: For each testcase, print one number β€” the maximum possible number of draws that could've happened, or $-1$ if the scores aren't consistent with any valid set of games and results.\n\nExamples:\ninput:\n7\n0 0 0\n0 1 1\n1 1 1\n1 1 2\n3 3 3\n3 4 5\n1 1 10\noutput:\n0\n1\n-1\n2\n-1\n6\n2\n\nNote: In the first example, no games were played at all, so no draws could occur either.\n\nFor the second example, exactly one game occurred between the second and the third player and it ended in draw, so the answer is $1$.\n\nIt's easy to see that there's no set of games achieving the scores in third example, so the answer for it 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": "1973A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Contest Proposal\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: A contest contains $n$ problems and the difficulty of the $i$-th problem is expected to be at most $b_i$. There are already $n$ problem proposals and the difficulty of the $i$-th problem is $a_i$. Initially, both $a_1, a_2, \\ldots, a_n$ and $b_1, b_2, \\ldots, b_n$ are sorted in non-decreasing order.\n\nSome of the problems may be more difficult than expected, so the writers must propose more problems. When a new problem with difficulty $w$ is proposed, the most difficult problem will be deleted from the contest, and the problems will be sorted in a way that the difficulties are non-decreasing.\n\nIn other words, in each operation, you choose an integer $w$, insert it into the array $a$, sort array $a$ in non-decreasing order, and remove the last element from it.\n\nFind the minimum number of new problems to make $a_i\\le b_i$ for all $i$.\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 only one positive integer $n$ ($1 \\leq n \\leq 100$), representing the number of problems.\n\nThe second line of each test case contains an array $a$ of length $n$ ($1\\le a_1\\le a_2\\le\\cdots\\le a_n\\le 10^9$).\n\nThe third line of each test case contains an array $b$ of length $n$ ($1\\le b_1\\le b_2\\le\\cdots\\le b_n\\le 10^9$).\n\nOutput: For each test case, print an integer as your answer in a new line.\n\nExamples:\ninput:\n2\n6\n1000 1400 2000 2000 2200 2700\n800 1200 1500 1800 2200 3000\n6\n4 5 6 7 8 9\n1 2 3 4 5 6\noutput:\n2\n3\n\nNote: In the first test case:\n\n * Propose a problem with difficulty $w=800$ and $a$ becomes $[800,1000,1400,2000,2000,2200]$. * Propose a problem with difficulty $w=1800$ and $a$ becomes $[800,1000,1400,1800,2000,2000]$. \n\nIt can be proved that it's impossible to reach the goal by proposing fewer new problems.\n\nIn the second test case:\n\n * Propose a problem with difficulty $w=1$ and $a$ becomes $[1,4,5,6,7,8]$. * Propose a problem with difficulty $w=2$ and $a$ becomes $[1,2,4,5,6,7]$. * Propose a problem with difficulty $w=3$ and $a$ becomes $[1,2,3,4,5,6]$. \n\nIt can be proved that it's impossible to reach the goal by proposing fewer new problems.\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": "1972A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Index and Maximum Value\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: After receiving yet another integer array $a_1, a_2, \\ldots, a_n$ at her birthday party, Index decides to perform some operations on it.\n\nFormally, there are $m$ operations that she is going to perform in order. Each of them belongs to one of the two types:\n\n * $\\texttt{+ l r}$. Given two integers $l$ and $r$, for all $1 \\leq i \\leq n$ such that $l \\leq a_i \\leq r$, set $a_i := a_i + 1$. * $\\texttt{- l r}$. Given two integers $l$ and $r$, for all $1 \\leq i \\leq n$ such that $l \\leq a_i \\leq r$, set $a_i := a_i - 1$. \n\nFor example, if the initial array $a = [7, 1, 3, 4, 3]$, after performing the operation $\\texttt{+} \\space 2 \\space 4$, the array $a = [7, 1, 4, 5, 4]$. Then, after performing the operation $\\texttt{-} \\space 1 \\space 10$, the array $a = [6, 0, 3, 4, 3]$.\n\nIndex is curious about the maximum value in the array $a$. Please help her find it after each of the $m$ operations.\n\nInput: Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \\leq t \\leq 2 \\cdot 10^4$) β€” the number of test cases. 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 10^5$, $1 \\leq m \\leq 10^5$) β€” the length of the array and the number of operations.\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 initial array $a$.\n\nThen $m$ lines follow, each line corresponds to the operation, in the following format: $\\texttt{c l r}$ ($c \\in \\\\{\\texttt +, \\texttt -\\\\}$, $l$ and $r$ are integers, $1 \\leq l \\leq r \\leq 10^9$) β€” the description of the operation.\n\nNote that the elements $a_i$ may not satisfy $1\\le a_i\\le 10^9$ after some operations, as it is shown in the example.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$, and the sum of $m$ over all test cases does not exceed $10^5$.\n\nOutput: For each test case, output one single line containing $m$ integers, with the $i$-th of them describing the maximum value of the array after the $i$-th operation.\n\nExamples:\ninput:\n5\n5 5\n1 2 3 2 1\n+ 1 3\n- 2 3\n+ 1 2\n+ 2 4\n- 6 8\n5 5\n1 3 3 4 5\n+ 1 4\n+ 2 3\n- 4 5\n- 3 3\n- 2 6\n5 5\n1 1 1 1 1\n+ 2 3\n- 4 5\n+ 1 6\n- 2 5\n+ 1 8\n1 1\n1\n- 1 1\n1 1\n1000000000\n+ 1000000000 1000000000\noutput:\n4 4 4 5 5\n5 5 4 4 3\n1 1 2 1 2\n0\n1000000001\n\nNote: In the first test case, the process of the operations is listed below:\n\n * After the first operation, the array becomes equal $[2,3,4,3,2]$. The maximum value is $4$. * After the second operation, the array becomes equal $[1,2,4,2,1]$. The maximum value is $4$. * After the third operation, the array becomes equal $[2,3,4,3,2]$. The maximum value is $4$. * After the fourth operation, the array becomes equal $[3,4,5,4,3]$. The maximum value is $5$. * After the fifth operation, the array becomes equal $[3,4,5,4,3]$. The maximum value is $5$.\n\nIn the second test case, the process of the operations is listed below:\n\n * After the first operation, the array becomes equal $[2,4,4,5,5]$. The maximum value is $5$. * After the second operation, the array becomes equal $[3,4,4,5,5]$. The maximum value is $5$. * After the third operation, the array becomes equal $[3,3,3,4,4]$. The maximum value is $4$. * After the fourth operation, the array becomes equal $[2,2,2,4,4]$. The maximum value is $4$. * After the fifth operation, the array becomes equal $[1,1,1,3,3]$. The maximum value 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": "2007B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Game in Tree (Hard Version)\ntime_limit_ms: 4000\nmemory_limit_mb: 256\nDescription: This is the hard version of the problem. In this version, it is not guaranteed that $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$).\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 3\n6\n1 2\n1 3\n2 4\n2 5\n1 6\n4 5\n4\n1 2\n1 3\n2 4\n2 4\noutput:\nBob\nAlice\nAlice\nBob\nAlice\nBob\nAlice\n\nNote: ![](CDN_BASE_URL/45f5cd537988c3a64939e74c3b13efab) Tree from the first example.\n\nIn the first test case, the path will be ($2,3$). If Bob starts at vertex $2$, Alice will not be able to move anywhere on her first turn and will lose.\n\nHowever, if 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": "2013F2", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Game with Doors\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: There are $100$ rooms arranged in a row and $99$ doors between them; the $i$-th door connects rooms $i$ and $i+1$. Each door can be either locked or unlocked. Initially, all doors are unlocked.\n\nWe say that room $x$ is reachable from room $y$ if all doors between them are unlocked.\n\nYou know that:\n\n * Alice is in some room from the segment $[l, r]$; * Bob is in some room from the segment $[L, R]$; * Alice and Bob are in different rooms. \n\nHowever, you don't know the exact rooms they are in.\n\nYou don't want Alice and Bob to be able to reach each other, so you are going to lock some doors to prevent that. What's the smallest number of doors you have to lock so that Alice and Bob cannot meet, regardless of their starting positions inside the given segments?\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 two integers $l$ and $r$ ($1 \\le l < r \\le 100$) β€” the bounds of the segment of rooms where Alice is located.\n\nThe second line of each test case contains two integers $L$ and $R$ ($1 \\le L < R \\le 100$) β€” the bounds of the segment of rooms where Bob is located.\n\nOutput: For each test case, print a single integer β€” the smallest number of doors you have to lock so that Alice and Bob cannot meet, regardless of their starting positions inside the given segments.\n\nExamples:\ninput:\n4\n1 2\n3 4\n2 5\n2 5\n3 7\n6 7\n4 5\n2 8\noutput:\n1\n3\n2\n3\n\nNote: In the first test case, it is sufficient to lock the door between rooms $2$ and $3$.\n\nIn the second test case, the following doors have to be locked: $(2,3)$, $(3,4)$, $(4,5)$.\n\nIn the third test case, the following doors have to be locked: $(5, 6)$ and $(6,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": "2004B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Long Way to be Non-decreasing\ntime_limit_ms: 4000\nmemory_limit_mb: 512\nDescription: Little R is a magician who likes non-decreasing arrays. She has an array of length $n$, initially as $a_1, \\ldots, a_n$, in which each element is an integer between $[1, m]$. She wants it to be non-decreasing, i.e., $a_1 \\leq a_2 \\leq \\ldots \\leq a_n$.\n\nTo do this, she can perform several magic tricks. Little R has a fixed array $b_1\\ldots b_m$ of length $m$. Formally, let's define a trick as a procedure that does the following things in order:\n\n * Choose a set $S \\subseteq \\\\{1, 2, \\ldots, n\\\\}$. * For each $u \\in S$, assign $a_u$ with $b_{a_u}$. \n\nLittle R wonders how many tricks are needed at least to make the initial array non-decreasing. If it is not possible with any amount of tricks, print $-1$ instead.\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$ and $m$ ($1\\leq n \\leq 10^6$, $1 \\leq m \\leq 10^6$) β€” the length of the initial array and the range of the elements in the array.\n\nThe second line of each test case contains $n$ integers $a_1, \\ldots, a_n$ ($1 \\leq a_i \\leq m$) β€” the initial array.\n\nThe third line of each test case contains $m$ integers $b_1, \\ldots, b_m$ ($1 \\leq b_i \\leq m$) β€” the fixed magic array.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^6$ and the sum of $m$ over all test cases does not exceed $10^6$.\n\nOutput: For each test case, output a single integer: the minimum number of tricks needed, or $-1$ if it is impossible to make $a_1, \\ldots, a_n$ non- decreasing.\n\nExamples:\ninput:\n3\n5 8\n1 6 3 7 1\n2 3 5 8 7 1 5 6\n3 3\n1 3 2\n2 1 3\n10 10\n2 8 5 4 8 4 1 5 10 10\n6 7 2 6 3 4 1 1 3 5\noutput:\n3\n-1\n3\n\nNote: In the first case, the initial array $a_1, \\ldots, a_n$ is $[1, 6, 3, 7, 1]$. You can choose $S$ as follows:\n\n * first trick: $S = [2, 4, 5]$, $a = [1, 1, 3, 5, 2]$; * second trick: $S = [5]$, $a = [1, 1, 3, 5, 3]$; * third trick: $S = [5]$, $a = [1, 1, 3, 5, 5]$. \n\nSo it is possible to make $a_1, \\ldots, a_n$ non-decreasing using $3$ tricks. It can be shown that this is the minimum possible amount of tricks.\n\nIn the second case, it is impossible to make $a_1, \\ldots, a_n$ non- decreasing.\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": "1972F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Monster\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Man, this Genshin boss is so hard. Good thing they have a top-up of $6$ coins for only $ \\$4.99$. I should be careful and spend no more than I need to, lest my mom catches me...\n\nYou are fighting a monster with $z$ health using a weapon with $d$ damage. Initially, $d=0$. You can perform the following operations.\n\n * Increase $d$ β€” the damage of your weapon by $1$, costing $x$ coins. * Attack the monster, dealing $d$ damage and costing $y$ coins. \n\nYou cannot perform the first operation for more than $k$ times in a row.\n\nFind the minimum number of coins needed to defeat the monster by dealing at least $z$ damage.\n\nInput: The first line contains a single integer $t$ ($1\\le t\\le 100$) β€” the number of test cases.\n\nThe only line of each test case contains 4 integers $x$, $y$, $z$, and $k$ ($1\\leq x, y, z, k\\leq 10^8$) β€” the first operation's cost, the second operation's cost, the monster's health, and the limitation on the first operation.\n\nOutput: For each test case, output the minimum number of coins needed to defeat the monster.\n\nExamples:\ninput:\n4\n2 3 5 5\n10 20 40 5\n1 60 100 10\n60 1 100 10\noutput:\n12\n190\n280\n160\n\nNote: In the first test case, $x = 2$, $y = 3$, $z = 5$, and $k = 5$. Here's a strategy that achieves the lowest possible cost of $12$ coins:\n\n * Increase damage by $1$, costing $2$ coins. * Increase damage by $1$, costing $2$ coins. * Increase damage by $1$, costing $2$ coins. * Attack the monster, dealing $3$ damage, costing $3$ coins. * Attack the monster, dealing $3$ damage, costing $3$ coins. \n\nYou deal a total of $3 + 3 = 6$ damage, defeating the monster who has $5$ health. The total number of coins you use is $2 + 2 + 2 + 3 + 3 = 12$ coins.\n\nIn the second test case, $x = 10$, $y = 20$, $z = 40$, and $k = 5$. Here's a strategy that achieves the lowest possible cost of $190$ coins:\n\n * Increase damage by $5$, costing $5\\cdot x$ = $50$ coins. * Attack the monster once, dealing $5$ damage, costing $20$ coins. * Increase damage by $2$, costing $2\\cdot x$ = $20$ coins. * Attack the monster $5$ times, dealing $5\\cdot 7 = 35$ damage, costing $5\\cdot y$ = $100$ coins. \n\nYou deal a total of $5 + 35 = 40$ damage, defeating the monster who has exactly $40$ health. The total number of coins you use is $50 + 20 + 20 + 100 = 190$ 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": "2035E", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Number of k-good subarrays\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Let $bit(x)$ denote the number of ones in the binary representation of a non-negative integer $x$.\n\nA subarray of an array is called $k$-good if it consists only of numbers with no more than $k$ ones in their binary representation, i.e., a subarray $(l, r)$ of array $a$ is good if for any $i$ such that $l \\le i \\le r$ condition $bit(a_{i}) \\le k$ is satisfied.\n\nYou are given an array $a$ of length $n$, consisting of consecutive non-negative integers starting from $0$, i.e., $a_{i} = i$ for $0 \\le i \\le n - 1$ (in $0$-based indexing). You need to count the number of $k$-good subarrays in this array.\n\nAs the answer can be very large, output it modulo $10^{9} + 7$.\n\nInput: Each test consists of multiple test cases. The first line contains an integer $t$ ($1 \\le t \\le 10^{4}$) β€” the number of test cases. The following lines describe the test cases.\n\nThe single line of each test case contains two integers $n$, $k$ ($1 \\le n \\le 10^{18}, 1 \\le k \\le 60$).\n\nOutput: For each test case, output a single integer β€” the number of $k$-good subarrays modulo $10^{9} + 7$.\n\nExamples:\ninput:\n10\n6 1\n16 2\n1 1\n3 1\n31 3\n14 1\n1337 5\n100000 20\n795569939321040850 56\n576460752303423268 59\noutput:\n7\n35\n1\n6\n155\n8\n7323\n49965\n741136395\n66679884\n\nNote: For the first test case $a = [0, 1, 2, 3, 4, 5]$, $k = 1$.\n\nTo find the answer, let's write all the numbers in binary representation:\n\n$$a = [\\color{green}{000}, \\color{green}{001}, \\color{green}{010}, \\color{red}{011}, \\color{green}{100}, \\color{red}{101}]$$\n\nFrom this, it can be seen that the numbers $3$ and $5$ have $2 \\ge (k = 1)$ ones in their binary representation, so the answer should include all subarrays that do not contain either $3$ or $5$, which are the subarrays (in $0$-based indexing): ($0$, $0$), ($0$, $1$), ($0$, $2$), ($1$, $1$), ($1$, $2$), ($2$, $2$), ($4$, $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": "1982E", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Reverse Card (Hard 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$; * $b \\cdot \\gcd(a,b)$ is a multiple of $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:\n0\n1\n1\n6\n423\n5933961\n\nNote: In the first test case, no pair satisfies the conditions.\n\nIn the fourth test case, $(2,2),(3,6),(4,4),(6,3),(6,6),(8,8)$ 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": "1972D2", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Turtle and Piggy Are Playing a Game\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Turtle and Piggy are playing a number game.\n\nFirst, Turtle will choose an integer $x$, such that $l \\le x \\le r$, where $l, r$ are given. It's also guaranteed that $2l \\le r$.\n\nThen, Piggy will keep doing the following operation until $x$ becomes $1$:\n\n * Choose an integer $p$ such that $p \\ge 2$ and $p \\mid x$ (i.e. $x$ is a multiple of $p$). * Set $x$ to $\\frac{x}{p}$, and the score will increase by $1$. \n\nThe score is initially $0$. Both Turtle and Piggy want to maximize the score. Please help them to calculate the maximum score.\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 $l, r$ ($1 \\le l \\le r \\le 10^9, 2l \\le r$) β€” The range where Turtle can choose the integer from.\n\nOutput: For each test case, output a single integer β€” the maximum score.\n\nExamples:\ninput:\n5\n2 4\n3 6\n2 15\n6 22\n114514 1919810\noutput:\n2\n2\n3\n4\n20\n\nNote: In the first test case, Turtle can choose an integer $x$, such that $2 \\le x \\le 4$. He can choose $x = 4$. Then Piggy can choose $p = 2$ for $2$ times. After that, $x$ will become $1$, and the score will be $2$, which is maximized.\n\nIn the second test case, Turtle can choose an integer $3 \\le x \\le 6$. He can choose $x = 6$. Then Piggy can choose $p = 2$, then choose $p = 3$. After that, $x$ will become $1$, and the score will be $2$, which is maximum.\n\nIn the third test case, Turtle can choose $x = 12$.\n\nIn the fourth test case, Turtle can choose $x = 16$.\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": "1981A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Fun\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Counting is Fun!\n\nβ€” satyam343\n\nGiven two integers $n$ and $x$, find the number of triplets ($a,b,c$) of positive integers such that $ab + ac + bc \\le n$ and $a + b + c \\le x$.\n\nNote that order matters (e.g. ($1, 1, 2$) and ($1, 2, 1$) are treated as different) and $a$, $b$, $c$ must be strictly greater than $0$.\n\nInput: The first line contains a single integer $t$ ($1 \\leq t \\leq 10^4$) β€” the number of test cases.\n\nEach test case contains two integers $n$ and $x$ ($1 \\leq n,x \\leq 10^6$).\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^6$ and that the sum of $x$ over all test cases does not exceed $10^6$.\n\nOutput: Output a single integer β€” the number of triplets ($a,b,c$) of positive integers such that $ab + ac + bc \\le n$ and $a + b + c \\le x$.\n\nExamples:\ninput:\n4\n7 4\n10 5\n7 1000\n900000 400000\noutput:\n4\n10\n7\n1768016938\n\nNote: In the first test case, the triplets are ($1, 1, 1$), ($1, 1, 2$), ($1, 2, 1$), and ($2, 1, 1$).\n\nIn the second test case, the triplets are ($1, 1, 1$), ($1, 1, 2$), ($1, 1, 3$), ($1, 2, 1$), ($1, 2, 2$), ($1, 3, 1$), ($2, 1, 1$), ($2, 1, 2$), ($2, 2, 1$), and ($3, 1, 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": "1996D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Zhan's Blender\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Today, a club fair was held at \"NSPhM\". In order to advertise his pastry club, Zhan decided to demonstrate the power of his blender.\n\nTo demonstrate the power of his blender, Zhan has $n$ fruits.\n\nThe blender can mix up to $x$ fruits per second.\n\nIn each second, Zhan can put up to $y$ fruits into the blender. After that, the blender will blend $\\min(x, c)$ fruits, where $c$ is the number of fruits inside the blender. After blending, blended fruits are removed from the blender.\n\nHelp Zhan determine the minimum amount of time required for Zhan to blend all fruits.\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 one integer $n$ ($0 \\le n \\le 10^9$) β€” the number of fruits Zhan has.\n\nThe second line of each test case contains two integers $x$ and $y$ ($1 \\le x, y \\le 10^9$) β€” the number of fruits the blender can blend per second and the number of fruits Zhan can put into the blender per second.\n\nOutput: For each testcase, output a single integer β€” the minimum number of seconds to blend all fruits.\n\nExamples:\ninput:\n5\n5\n3 4\n3\n1 2\n6\n4 3\n100\n4 3\n9\n3 3\noutput:\n2\n3\n2\n34\n3\n\nNote: In the first example, you can first put $2$ fruits in the blender. After that, the blender will mix these $2$ fruits, and in the end, there will be $0$ fruits left in the blender. Then you can put $3$ fruits into the blender, after which the blender will mix these $3$ fruits.\n\nIn the second example, you can put $1$ fruit into the blender $3$ times.\n\nIn the third example, you can first put $3$ fruits into the blender, then add another $3$ fruits.\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": "2013A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sort\ntime_limit_ms: 5000\nmemory_limit_mb: 256\nDescription: You are given two strings $a$ and $b$ of length $n$. Then, you are (forced against your will) to answer $q$ queries.\n\nFor each query, you are given a range bounded by $l$ and $r$. In one operation, you can choose an integer $i$ ($l \\leq i \\leq r$) and set $a_i = x$ where $x$ is any character you desire. Output the minimum number of operations you must perform such that $\\texttt{sorted(a[l..r])} = \\texttt{sorted(b[l..r])}$. The operations you perform on one query does not affect other queries.\n\nFor an arbitrary string $c$, $\\texttt{sorted(c[l..r])}$ denotes the substring consisting of characters $c_l, c_{l+1}, ... , c_r$ sorted in lexicographical order.\n\nInput: The first line contains $t$ ($1 \\leq t \\leq 1000$) – the number of test cases.\n\nThe first line of each test case contains two integers $n$ and $q$ ($1 \\leq n, q \\leq 2 \\cdot 10^5$) – the length of both strings and the number of queries.\n\nThe following line contains $a$ of length $n$. It is guaranteed $a$ only contains lowercase latin letters.\n\nThe following line contains $b$ of length $n$. It is guaranteed $b$ only contains lowercase latin letters.\n\nThe following $q$ lines contain two integers $l$ and $r$ ($1 \\leq l \\leq r \\leq n$) – the range of the query.\n\nIt is guaranteed the sum of $n$ and $q$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each query, output an integer, the minimum number of operations you need to perform in a new line.\n\nExamples:\ninput:\n3\n5 3\nabcde\nedcba\n1 5\n1 4\n3 3\n4 2\nzzde\nazbe\n1 3\n1 4\n6 3\nuwuwuw\nwuwuwu\n2 4\n1 3\n1 6\noutput:\n0\n1\n0\n2\n2\n1\n1\n0\n\nNote: For the first query, $\\texttt{sorted(a[1..5])} =$ abcde and $\\texttt{sorted(b[1..5])} =$ abcde, so no operations are necessary.\n\nFor the second query, you need to set $a_1 = $ e. Then, $\\texttt{sorted(a[1..4])} = \\texttt{sorted(b[1..4])} = $ bcde.\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": "1996C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: ''a'' String Problem\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given a string $s$ consisting of lowercase Latin characters. Count the number of nonempty strings $t \\neq$ \"$\\texttt{a}$\" such that it is possible to partition$^{\\dagger}$ $s$ into some substrings satisfying the following conditions:\n\n * each substring either equals $t$ or \"$\\texttt{a}$\", and * at least one substring equals $t$. \n\n$^{\\dagger}$ A partition of a string $s$ is an ordered sequence of some $k$ strings $t_1, t_2, \\ldots, t_k$ (called substrings) such that $t_1 + t_2 + \\ldots + t_k = s$, where $+$ represents the concatenation operation.\n\nInput: The first line contains a single integer $t$ ($1 \\leq t \\leq 10^4$) β€” the number of test cases.\n\nThe only line of each test case contains a string $s$ consisting of lowercase Latin characters ($2 \\leq |s| \\leq 2 \\cdot 10^5$).\n\nThe sum of $|s|$ over all test cases does not exceed $3 \\cdot 10^5$.\n\nOutput: For each test case, output a single integer β€” the number of nonempty strings $t \\neq$ \"$\\texttt{a}$\" that satisfy all constraints.\n\nExamples:\ninput:\n8\naaaaa\nbaba\ncabacb\naaabaaa\nbitset\nab\nabbaaaabbb\nyearnineteeneightyfour\noutput:\n4\n4\n1\n16\n1\n2\n3\n1\n\nNote: In the first test case, $t$ can be \"$\\texttt{aa}$\", \"$\\texttt{aaa}$\", \"$\\texttt{aaaa}$\", or the full string.\n\nIn the second test case, $t$ can be \"$\\texttt{b}$\", \"$\\texttt{bab}$\", \"$\\texttt{ba}$\", or the full string.\n\nIn the third test case, the only such $t$ is the full string.\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": "1984D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: The Omnipotent Monster Killer\ntime_limit_ms: 3000\nmemory_limit_mb: 512\nDescription: You, the monster killer, want to kill a group of monsters. The monsters are on a tree with $n$ vertices. On vertex with number $i$ ($1\\le i\\le n$), there is a monster with $a_i$ attack points. You want to battle with monsters for $10^{100}$ rounds.\n\nIn each round, the following happens in order:\n\n 1. All living monsters attack you. Your health decreases by the sum of attack points of all living monsters. 2. You select some (possibly all or none) monsters and kill them. After being killed, the monster will not be able to do any attacks in the future. \n\nThere is a restriction: in one round, you cannot kill two monsters that are directly connected by an edge.\n\nIf you choose what monsters to attack optimally, what is the smallest health decrement you can have after all rounds?\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \\le t \\le 10^4$). 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$).\n\nThe second line of each test case contains $n$ integers $a_1,\\ldots,a_n$ ($1\\le a_i\\le 10^{12}$).\n\nThe following $n-1$ lines each contain two integers $x,y$ ($1\\le x,y\\le n$), denoting an edge on the tree connecting vertex $x$ and $y$.\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, print one integer: the minimum possible health decrement.\n\nExamples:\ninput:\n3\n1\n1000000000000\n5\n47 15 32 29 23\n1 2\n1 3\n2 4\n2 5\n7\n8 10 2 3 5 7 4\n1 2\n1 4\n3 2\n5 3\n6 2\n7 5\noutput:\n1000000000000\n193\n57\n\nNote: In the first test case, an optimal sequence of operations would be:\n\n * In the first round: first, receive the attack from the monster on vertex $1$, so your health decreases by $10^{12}$. Then kill the monster on vertex $1$. * In the second round to the $10^{100}$-th round: all monsters have been killed, so nothing happens. \n\nThe total health decrement is $10^{12}$.\n\nIn the second test case, an optimal sequence of operations would be:\n\n * In the first round: first, receive the attack from the monster on vertex $1,2,3,4,5$, so your health decreases by $47+15+32+29+23=146$. Then kill the monsters on vertex $1,4,5$. * In the second round: first, receive the attack from the monster on vertex $2,3$, so your health decreases by $15+32=47$. Then kill the monsters on vertex $2,3$. * In the third round to the $10^{100}$-th round: all monsters have been killed, so nothing happens. \n\nThe total health decrement is $193$.\n\nIn the third test case, an optimal sequence of operations would be:\n\n * In the first round: first, receive the attack from the monster on vertex $1,2,3,4,5,6,7$, so your health decreases by $8+10+2+3+5+7+4=39$. Then kill the monsters on vertex $1,3,6,7$. * In the second round: first, receive the attack from the monster on vertex $2,4,5$, so your health decreases by $10+3+5=18$. Then kill the monsters on vertex $2,4,5$. * In the third round to the $10^{100}$-th round: all monsters have been killed, so nothing happens. \n\nThe total health decrement is $57$.\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": "1988D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Smithing Skill\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: You are playing a famous computer game (that just works) where you have various skills you can level up. Today, you focused on the \"Smithing\" skill. Your tactic is obvious: forging weapons from ingots and then melting them back to return the materials partially. For simplicity, every time you create an item, you get $1$ experience point, and every time you melt an item, you also get $1$ experience point.\n\nThere are $n$ classes of weapons you can forge and $m$ types of metal ingots.\n\nYou can create one weapon of the $i$-th class, spending $a_i$ ingots of metal of the same type. Melting a weapon of the $i$-th class (which you crafted earlier) returns you $b_i$ ingots of the type of metal it was made of.\n\nYou have $c_j$ metal ingots of the $j$-th type, and you know that you can craft a weapon of any class from any metal type. Each combination of a weapon class and a metal type can be used any number of times.\n\nWhat is the maximum total amount of experience you can earn by crafting and melting weapons?\n\nInput: The first line contains two integers $n$ and $m$ ($1 \\le n, m \\le 10^6$) β€” the number of weapon classes and metal types.\n\nThe second line contains $n$ integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 10^6$), where $a_i$ is the number of ingots you need to forge one weapon of the $i$-th class.\n\nThe third line contains $n$ integers $b_1, b_2, \\dots, b_n$ ($0 \\le b_i < a_i$), where $b_i$ is the number of ingots you return by melting one weapon of the $i$-th class you forged earlier.\n\nThe fourth line contains $m$ integers $c_1, c_2, \\dots, c_m$ ($1 \\le c_j \\le 10^9$) β€” the number of ingots you have of the corresponding metal type.\n\nOutput: Print one integer β€” the maximum total experience points you can gain by repeatedly forging and melting weapons.\n\nExamples:\ninput:\n5 3\n9 6 7 5 5\n8 4 5 1 2\n10 4 7\noutput:\n12\n\ninput:\n3 4\n10 20 20\n0 0 0\n9 10 19 20\noutput:\n8\n\ninput:\n1 5\n3\n1\n1000000000 1000000000 1000000000 1000000000 1000000000\noutput:\n4999999990\n\nNote: In the first example, you can do the following:\n\n 1. craft one weapon of the $1$-st class from the $1$-st type of metal, spending $9$ ingots; 2. melt that weapon, returning $8$ ingots of the $1$-st metal type; 3. again, craft and melt one weapon of the $1$-st class from the $1$-st metal type; 4. craft and melt one weapon of the $3$-rd class from the $1$-st metal type; 5. craft and melt one weapon of the $3$-rd class from the $3$-rd metal type; 6. craft and melt one weapon of the $4$-th class from the $1$-st metal type; 7. craft and melt one weapon of the $5$-th class from the $3$-rd metal type; \n\nIn the end you'll have $c = [2, 4, 2]$ ingots left. In total, you've crafted $6$ weapons and melted $6$ weapons, gaining $12$ experience points in total.\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": "1989D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sliding\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Red was ejected. They were not the imposter.\n\nThere are $n$ rows of $m$ people. Let the position in the $r$-th row and the $c$-th column be denoted by $(r, c)$. Number each person starting from $1$ in row-major order, i.e., the person numbered $(r-1)\\cdot m+c$ is initially at $(r,c)$.\n\nThe person at $(r, c)$ decides to leave. To fill the gap, let the person who left be numbered $i$. Each person numbered $j>i$ will move to the position where the person numbered $j-1$ is initially at. The following diagram illustrates the case where $n=2$, $m=3$, $r=1$, and $c=2$.\n\n![](CDN_BASE_URL/9b0b8e601446e3410296d7c9b1ff8763)\n\nCalculate the sum of the Manhattan distances of each person's movement. If a person was initially at $(r_0, c_0)$ and then moved to $(r_1, c_1)$, the Manhattan distance is $|r_0-r_1|+|c_0-c_1|$.\n\nInput: The first line contains a single integer $t$ ($1\\le t\\le 10^4$) β€” the number of test cases.\n\nThe only line of each testcase contains $4$ integers $n$, $m$, $r$, and $c$ ($1\\le r\\le n\\le 10^6$, $1 \\le c \\le m \\le 10^6$), where $n$ is the number of rows, $m$ is the number of columns, and $(r,c)$ is the position where the person who left is initially at.\n\nOutput: For each test case, output a single integer denoting the sum of the Manhattan distances.\n\nExamples:\ninput:\n4\n2 3 1 2\n2 2 2 1\n1 1 1 1\n1000000 1000000 1 1\noutput:\n6\n1\n0\n1999998000000\n\nNote: For the first test case, the person numbered $2$ leaves, and the distances of the movements of the person numbered $3$, $4$, $5$, and $6$ are $1$, $3$, $1$, and $1$, respectively. So the answer is $1+3+1+1=6$.\n\nFor the second test case, the person numbered $3$ leaves, and the person numbered $4$ moves. 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": "2035A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Xor-Grid Problem\ntime_limit_ms: 5000\nmemory_limit_mb: 256\nDescription: Given a matrix $a$ of size $n \\times m$, each cell of which contains a non-negative integer. The integer lying at the intersection of the $i$-th row and the $j$-th column of the matrix is called $a_{i,j}$.\n\nLet's define $f(i)$ and $g(j)$ as the [XOR](https://en.wikipedia.org/wiki/Exclusive_or) of all integers in the $i$-th row and the $j$-th column, respectively. In one operation, you can either:\n\n * Select any row $i$, then assign $a_{i,j} := g(j)$ for each $1 \\le j \\le m$; or * Select any column $j$, then assign $a_{i,j} := f(i)$ for each $1 \\le i \\le n$. \n\n![](CDN_BASE_URL/3bba110245afb461968dbb618fc60828) An example of applying an operation on column $2$ of the matrix.\n\nIn this example, as we apply an operation on column $2$, all elements in this column are changed:\n\n * $a_{1,2} := f(1) = a_{1,1} \\oplus a_{1,2} \\oplus a_{1,3} \\oplus a_{1,4} = 1 \\oplus 1 \\oplus 1 \\oplus 1 = 0$ * $a_{2,2} := f(2) = a_{2,1} \\oplus a_{2,2} \\oplus a_{2,3} \\oplus a_{2,4} = 2 \\oplus 3 \\oplus 5 \\oplus 7 = 3$ * $a_{3,2} := f(3) = a_{3,1} \\oplus a_{3,2} \\oplus a_{3,3} \\oplus a_{3,4} = 2 \\oplus 0 \\oplus 3 \\oplus 0 = 1$ * $a_{4,2} := f(4) = a_{4,1} \\oplus a_{4,2} \\oplus a_{4,3} \\oplus a_{4,4} = 10 \\oplus 11 \\oplus 12 \\oplus 16 = 29$ \n\nYou can apply the operations any number of times. Then, we calculate the $\\textit{beauty}$ of the final matrix by summing the absolute differences between all pairs of its adjacent cells.\n\nMore formally, $\\textit{beauty}(a) = \\sum|a_{x,y} - a_{r,c}|$ for all cells $(x, y)$ and $(r, c)$ if they are adjacent. Two cells are considered adjacent if they share a side.\n\nFind the minimum $\\textit{beauty}$ among all obtainable matrices.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 250$) β€” the number of test cases.\n\nThe first line of each test case contains two integers $n$ and $m$ ($1 \\le n, m \\le 15$) β€” the number of rows and columns of $a$, respectively.\n\nThe next $n$ lines, each containing $m$ integers $a_{i,1}, a_{i,2}, \\ldots, a_{i,m}$ ($0 \\le a_{i,j} < 2^{20}$) β€” description of the matrix $a$.\n\nIt is guaranteed that the sum of $(n^2 + m^2)$ over all test cases does not exceed $500$.\n\nOutput: For each test case, print a single integer $b$ β€” the smallest possible $\\textit{beauty}$ of the matrix.\n\nExamples:\ninput:\n4\n1 2\n1 3\n2 3\n0 1 0\n5 4 4\n2 3\n0 2 4\n4 5 1\n3 3\n1 2 3\n4 5 6\n7 8 9\noutput:\n1\n3\n13\n24\n\nNote: Let's denote $r(i)$ as the first type operation applied on the $i$-th row, and $c(j)$ as the second type operation applied on the $j$-th column.\n\nIn the first test case, you can apply an operation $c(1)$, which assigns $a_{1,1} := 1 \\oplus 3 = 2$. Then, we'll receive this matrix:\n\n2| 3 ---|--- In the second test case, you can apply an operation $r(1)$, which assigns:\n\n * $a_{1,1} := g(1) = 0 \\oplus 5 = 5$ * $a_{1,2} := g(2) = 1 \\oplus 4 = 5$ * $a_{1,3} := g(3) = 0 \\oplus 4 = 4$ \n\nThe resulting matrix after performing the operation is:\n\n5| 5| 4 ---|---|--- 5| 4| 4 In the third test case, the best way to achieve minimum $\\textit{beauty}$ is applying three operations: $c(3)$, $r(2)$, and $c(2)$. The resulting matrix is:\n\n0| 4| 6 ---|---|--- 4| 5| 6\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": "1993E", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Reconstruction\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: There is a hidden array $a_1, a_2, \\ldots, a_n$ of length $n$ whose elements are integers between $-m$ and $m$, inclusive.\n\nYou are given an array $b_1, b_2, \\ldots, b_n$ of length $n$ and a string $s$ of length $n$ consisting of the characters $\\texttt{P}$, $\\texttt{S}$, and $\\texttt{?}$.\n\nFor each $i$ from $1$ to $n$ inclusive, we must have:\n\n * If $s_i = \\texttt{P}$, $b_i$ is the sum of $a_1$ through $a_i$. * If $s_i = \\texttt{S}$, $b_i$ is the sum of $a_i$ through $a_n$. \n\nOutput the number of ways to replace all $\\texttt{?}$ in $s$ with either $\\texttt{P}$ or $\\texttt{S}$ such that there exists an array $a_1, a_2, \\ldots, a_n$ with elements not exceeding $m$ by absolute value satisfying the constraints given by the array $b_1, b_2, \\ldots, b_n$ and the string $s$.\n\nSince the answer may be large, output it modulo $998\\,244\\,353$.\n\nInput: The first line contains a single integer $t$ ($1 \\leq t \\leq 10^3$) β€” the number of test cases.\n\nThe first line of each test case contains two integers $n$ and $m$ ($2 \\leq n \\leq 2 \\cdot 10^3$, $2 \\leq m \\leq 10^{9}$) β€” the length of the hidden array $a_1, a_2, \\ldots, a_n$ and the maximum absolute value of an element $a_i$.\n\nThe second line of each test case contains a string $s$ of length $n$ consisting of characters $\\texttt{P}$, $\\texttt{S}$, and $\\texttt{?}$.\n\nThe third line of each test case contains $n$ integers $b_1, b_2, \\ldots, b_n$ ($|b_i| \\leq m \\cdot n$).\n\nThe sum of $n$ over all test cases does not exceed $5 \\cdot 10^3$.\n\nOutput: For each test case, output a single integer β€” the number of ways to replace all $\\texttt{?}$ in $s$ with either $\\texttt{P}$ or $\\texttt{S}$ that result in the existence of a valid array $a_1, a_2, \\ldots, a_n$, modulo $998\\,244\\,353$.\n\nExamples:\ninput:\n6\n4 10\nPSPP\n1 9 8 10\n4 1000000000\n????\n1 1 1 4000000000\n8 1000000000\n?P?SSP?P\n-857095623 -1424391899 -851974476 673437144 471253851 -543483033 364945701 -178537332\n4 7\nPPSS\n4 2 1 3\n9 20\n?????????\n1 2 3 4 5 6 7 8 9\n3 1000000000\nP??\n-145463248 -974068460 -1287458396\noutput:\n1\n0\n2\n1\n14\n1\n\nNote: In the first test case, we can see that the following array satisfies all constraints, thus the answer is $1$:\n\n 1. $\\texttt{P}$ β€” ${[\\color{red}{\\textbf{1}},3,4,2]}$: sum of $1$. 2. $\\texttt{S}$ β€” ${[1,\\color{red}{\\textbf{3},4,2}]}$: sum of $9$. 3. $\\texttt{P}$ β€” ${[\\color{red}{1,3,\\textbf{4}},2]}$: sum of $8$. 4. $\\texttt{P}$ β€” ${[\\color{red}{1,3,4,\\textbf{2}}]}$: sum of $10$. \n\nIn the second test case, it can be shown that no array $a$ with all $|a_i| \\leq m = 10^9$ satisfies all constraints.\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": "1984F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Turtle and Piggy Are Playing a Game 2\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Turtle and Piggy are playing a game on a sequence. They are given a sequence $a_1, a_2, \\ldots, a_n$, and Turtle goes first. Turtle and Piggy alternate in turns (so, Turtle does the first turn, Piggy does the second, Turtle does the third, etc.).\n\nThe game goes as follows:\n\n * Let the current length of the sequence be $m$. If $m = 1$, the game ends. * If the game does not end and it's Turtle's turn, then Turtle must choose an integer $i$ such that $1 \\le i \\le m - 1$, set $a_i$ to $\\max(a_i, a_{i + 1})$, and remove $a_{i + 1}$. * If the game does not end and it's Piggy's turn, then Piggy must choose an integer $i$ such that $1 \\le i \\le m - 1$, set $a_i$ to $\\min(a_i, a_{i + 1})$, and remove $a_{i + 1}$. \n\nTurtle wants to maximize the value of $a_1$ in the end, while Piggy wants to minimize the value of $a_1$ in the end. Find the value of $a_1$ in the end if both players play optimally.\n\nYou can refer to notes for further clarification.\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 10^5$) β€” the length of the sequence.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\ldots, a_n$ ($1 \\le a_i \\le 10^5$) β€” the elements of the sequence $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 a single integer β€” the value of $a_1$ in the end if both players play optimally.\n\nExamples:\ninput:\n5\n2\n1 2\n3\n1 1 2\n3\n1 2 3\n5\n3 1 2 2 3\n10\n10 2 5 2 7 9 2 5 10 7\noutput:\n2\n1\n2\n2\n7\n\nNote: In the first test case, initially $a = [1, 2]$. Turtle can only choose $i = 1$. Then he will set $a_1$ to $\\max(a_1, a_2) = 2$ and remove $a_2$. The sequence $a$ becomes $[2]$. Then the length of the sequence becomes $1$, and the game will end. The value of $a_1$ is $2$, so you should output $2$.\n\nIn the second test case, one of the possible game processes is as follows:\n\n * Initially $a = [1, 1, 2]$. * Turtle can choose $i = 2$. Then he will set $a_2$ to $\\max(a_2, a_3) = 2$ and remove $a_3$. The sequence $a$ will become $[1, 2]$. * Piggy can choose $i = 1$. Then he will set $a_1$ to $\\min(a_1, a_2) = 1$ and remove $a_2$. The sequence $a$ will become $[1]$. * The length of the sequence becomes $1$, so the game will end. The value of $a_1$ will be $1$ in the end. \n\nIn the fourth test case, one of the possible game processes is as follows:\n\n * Initially $a = [3, 1, 2, 2, 3]$. * Turtle can choose $i = 4$. Then he will set $a_4$ to $\\max(a_4, a_5) = 3$ and remove $a_5$. The sequence $a$ will become $[3, 1, 2, 3]$. * Piggy can choose $i = 3$. Then he will set $a_3$ to $\\min(a_3, a_4) = 2$ and remove $a_4$. The sequence $a$ will become $[3, 1, 2]$. * Turtle can choose $i = 2$. Then he will set $a_2$ to $\\max(a_2, a_3) = 2$ and remove $a_3$. The sequence $a$ will become $[3, 2]$. * Piggy can choose $i = 1$. Then he will set $a_1$ to $\\min(a_1, a_2) = 2$ and remove $a_2$. The sequence $a$ will become $[2]$. * The length of the sequence becomes $1$, so the game will end. The value of $a_1$ will be $2$ 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": "2003B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Bomb\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Sparkle gives you two arrays $a$ and $b$ of length $n$. Initially, your score is $0$. In one operation, you can choose an integer $i$ and add $a_i$ to your score. Then, you must set $a_i$ = $\\max(0, a_i - b_i)$.\n\nYou only have time to perform $k$ operations before Sparkle sets off a nuclear bomb! What is the maximum score you can acquire after $k$ operations?\n\nInput: The first line contains $t$ ($1 \\leq t \\leq 1000$) β€” the number of test cases.\n\nThe first line of each test case contains $n$ and $k$ ($1 \\leq n \\leq 2 \\cdot 10^5, 1 \\leq k \\leq 10^9$) β€” the length of the arrays and the number of operations you can perform.\n\nThe following line contains $n$ integers $a_1, a_2, ... a_n$ ($1 \\leq a_i \\leq 10^9$).\n\nThe following line contains $n$ integers $b_1, b_2, ... b_n$ ($1 \\leq b_i \\leq 10^9$).\n\nIt is guaranteed that the sum of $n$ for all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output an integer, the maximum score you can acquire after $k$ operations.\n\nExamples:\ninput:\n5\n3 4\n5 6 7\n2 3 4\n5 9\n32 52 68 64 14\n18 14 53 24 8\n5 1000\n1 2 3 4 5\n5 4 3 2 1\n1 1000000\n1000000\n1\n10 6\n3 3 5 10 6 8 6 8 7 7\n6 1 7 4 1 1 8 9 3 1\noutput:\n21\n349\n27\n500000500000\n47\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": "1996F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: New Game\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: There's a new game Monocarp wants to play. The game uses a deck of $n$ cards, where the $i$-th card has exactly one integer $a_i$ written on it.\n\nAt the beginning of the game, on the first turn, Monocarp can take any card from the deck. During each subsequent turn, Monocarp can take exactly one card that has either the same number as on the card taken on the previous turn or a number that is one greater than the number on the card taken on the previous turn.\n\nIn other words, if on the previous turn Monocarp took a card with the number $x$, then on the current turn he can take either a card with the number $x$ or a card with the number $x + 1$. Monocarp can take any card which meets that condition, regardless of its position in the deck.\n\nAfter Monocarp takes a card on the current turn, it is removed from the deck.\n\nAccording to the rules of the game, the number of distinct numbers written on the cards that Monocarp has taken must not exceed $k$.\n\nIf, after a turn, Monocarp cannot take a card without violating the described rules, the game ends.\n\nYour task is to determine the maximum number of cards that Monocarp can take from the deck during the game, given that on the first turn he can take any card from the deck.\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 two integers $n$ and $k$ ($1 \\le k \\le n \\le 200\\,000$) β€” the number of cards in the deck and the maximum number of distinct numbers that can be written on the cards that Monocarp takes.\n\nThe second line contains a sequence of integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 10^{9}$), where $a_i$ is the number written on the $i$-th card.\n\nAdditional constraint of the input: the sum of $n$ over all test cases doesn't exceed $200\\,000$.\n\nOutput: For each test case, print the maximum number of cards that Monocarp can take from the deck during the game, given that on the first turn he can take any card from the deck.\n\nExamples:\ninput:\n4\n10 2\n5 2 4 3 4 3 4 5 3 2\n5 1\n10 11 10 11 10\n9 3\n4 5 4 4 6 5 4 4 6\n3 2\n1 3 1\noutput:\n6\n3\n9\n2\n\nNote: In the first example, Monocarp needs to take any of the cards with the number $3$. On the next two turns, he needs to take the two remaining cards with the number $3$. On the next three turns, he needs to take three cards with the number $4$. After that, Monocarp will not be able to take any more cards from the deck, and he will have $6$ cards.\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": "2025C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Message Spread\ntime_limit_ms: 12000\nmemory_limit_mb: 1024\nDescription: Given is an undirected graph with $n$ vertices and $m$ edges. Each edge connects two vertices $(u, v)$ and has a probability of $\\frac{p}{q}$ of appearing each day.\n\nInitially, vertex $1$ has a message. At the end of the day, a vertex has a message if and only if itself or at least one of the vertices adjacent to it had the message the day before. Note that each day, each edge chooses its appearance independently.\n\nCalculate the expected number of days before all the vertices have the message, modulo $998\\,244\\,353$.\n\nInput: The first line contains two integers $n$ and $m$ ($1\\leq n\\leq 21$, $n-1\\leq m\\leq\\frac{n(n-1)}{2}$).\n\nThen $m$ lines follow, each containing four integers $u$, $v$, $p$, and $q$ ($1\\leq u\\neq v\\leq n$, $1\\leq p<q<998\\,244\\,353$, $\\gcd(p,q)=1$) β€” there is an undirected edge between $u$ and $v$, and it has a probability of appearance of $\\frac{p}{q}$ each day.\n\nIt is guaranteed that there are no self-loops or multiple-edges in the graph and that the graph is connected if all of the edges appear.\n\nAdditional constraint in the input: Let $g_{i,j}$ be the probability of appearance of the edge between $i$ and $j$ ($g_{i,j}=0$ if there is no edge between $i$ and $j$). It is guaranteed that for any $S\\subseteq\\\\{1,2,\\ldots,n\\\\}$ ($|S|\\ge 1$), $$ \\prod_{i\\in S}\\left(\\prod_{j\\in\\\\{1,2,\\ldots,n\\\\}\\setminus S}(1-g_{i,j})\\right)\\not\\equiv1\\pmod{998\\,244\\,353}. $$\n\nOutput: Print a single integer in the only line of the output β€” the expected number of days, 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\nExamples:\ninput:\n2 1\n1 2 1 10\noutput:\n10\n\ninput:\n3 3\n1 2 1 2\n1 3 1 2\n2 3 1 2\noutput:\n887328316\n\ninput:\n1 0\noutput:\n0\n\ninput:\n5 8\n1 2 1 11\n1 3 2 11\n1 4 3 11\n1 5 4 11\n2 4 5 11\n2 5 6 11\n3 4 7 11\n4 5 8 11\noutput:\n469993557\n\ninput:\n21 22\n1 2 3 4\n2 3 4 5\n3 4 5 6\n5 6 7 8\n6 7 8 9\n7 8 9 10\n8 9 2 3\n9 10 3 4\n10 11 4 5\n11 12 5 6\n12 13 6 7\n13 14 7 8\n14 15 8 9\n15 16 9 10\n16 17 2 3\n17 18 3 4\n18 19 4 5\n19 20 5 6\n20 21 6 7\n1 10 100 1001\n15 4 147 220\n4 11 1 998244352\noutput:\n299529765\n\nNote: In the first test, the answer is equal to the expected number of days before the only edge in the graph first appears, and that is $\\frac{1}{0.1}=10$.\n\nIn the second test, the answer is equal to $\\frac{20}{9}$ before it is taken modulo $998\\,244\\,353$.\n\nIn the third test, the only vertex already has the message, so the answer 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": "2029H", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Money Buys Less Happiness Now\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You can never buy enough happiness, so here we go again! In this version, you can only buy $h_i = 1$ unit of happiness each month, but the number of months is hugely increased. We are in the realm of quantum happiness and time dilation.\n\nBeing a physicist, Charlie likes to plan his life in simple and precise terms.\n\nFor the next $m$ months, starting with no money, Charlie will work hard and earn $x$ pounds per month. For the $i$-th month $(1 \\le i \\le m)$, there'll be a single opportunity of paying cost $c_i$ pounds to obtain one unit of happiness. You cannot buy more than one unit each month.\n\nBorrowing is not allowed. Money earned in the $i$-th month can only be spent in a later $j$-th month ($j>i$).\n\nSince physicists don't code, help Charlie find the maximum reachable units of happiness.\n\nInput: The first line of the input contains $t$ ($1 \\leq t \\leq 10^4$) β€” the number of test cases.\n\nThe first line of each test case contains two integers, $m$ and $x$ ($1 \\le m \\le 2 \\cdot 10^5$, $1 \\le x \\le 10^3$) β€” the total number of months and the monthly salary.\n\nThe second line of each test case contains $m$ integers $c_1, c_2, \\dots, c_m$ ($1 \\leq c_i \\leq 10^3$) β€” the cost of one unit of happiness for each month.\n\nIt is guaranteed that sum of $m$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output one integer β€” the maximal amount of happiness Charlie can get.\n\nExamples:\ninput:\n6\n3 3\n2 2 2\n6 5\n2 2 8 2 6 8\n6 4\n4 10 3 8 6 10\n2 1\n1 1\n4 1\n4 1 3 1\n4 2\n1 3 4 3\noutput:\n2\n4\n3\n1\n2\n1\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": "1974G", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Right Left Wrong\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Vlad found a strip of $n$ cells, numbered from left to right from $1$ to $n$. In the $i$-th cell, there is a positive integer $a_i$ and a letter $s_i$, where all $s_i$ are either 'L' or 'R'.\n\nVlad invites you to try to score the maximum possible points by performing any (possibly zero) number of operations.\n\nIn one operation, you can choose two indices $l$ and $r$ ($1 \\le l < r \\le n$) such that $s_l$ = 'L' and $s_r$ = 'R' and do the following:\n\n * add $a_l + a_{l + 1} + \\dots + a_{r - 1} + a_r$ points to the current score; * replace $s_i$ with '.' for all $l \\le i \\le r$, meaning you can no longer choose these indices. \n\nFor example, consider the following strip:\n\n$3$| $5$| $1$| $4$| $3$| $2$ ---|---|---|---|---|--- L| R| L| L| L| R You can first choose $l = 1$, $r = 2$ and add $3 + 5 = 8$ to your score.\n\n$3$| $5$| $1$| $4$| $3$| $2$ ---|---|---|---|---|--- .| .| L| L| L| R Then choose $l = 3$, $r = 6$ and add $1 + 4 + 3 + 2 = 10$ to your score.\n\n$3$| $5$| $1$| $4$| $3$| $2$ ---|---|---|---|---|--- .| .| .| .| .| . As a result, it is impossible to perform another operation, and the final score is $18$.\n\nWhat is the maximum score that can be achieved?\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 one integer $n$ ($2 \\le n \\le 2 \\cdot 10^5$) β€” the length of the strip.\n\nThe second line of each test case contains $n$ integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le 10^5$) β€” the numbers written on the strip.\n\nThe third line of each test case contains a string $s$ of $n$ characters 'L' and 'R'.\n\nIt is guaranteed that the sum of the values of $n$ across all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output one integer β€” the maximum possible number of points that can be scored.\n\nExamples:\ninput:\n4\n6\n3 5 1 4 3 2\nLRLLLR\n2\n2 8\nLR\n2\n3 9\nRL\n5\n1 2 3 4 5\nLRLRR\noutput:\n18\n10\n0\n22\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": "2000D", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Boring Day\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: On another boring day, Egor got bored and decided to do something. But since he has no friends, he came up with a game to play.\n\nEgor has a deck of $n$ cards, the $i$-th card from the top has a number $a_i$ written on it. Egor wants to play a certain number of rounds until the cards run out. In each round, he takes a non-zero number of cards from the top of the deck and finishes the round. If the sum of the numbers on the cards collected during the round is between $l$ and $r$, inclusive, the round is won; otherwise, it is lost.\n\nEgor knows by heart the order of the cards. Help Egor determine the maximum number of rounds he can win in such a game. Note that Egor is not required to win rounds consecutively.\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 the test cases.\n\nThe first line of each test case contains three integers $n$, $l$, and $r$ ($1 \\le n \\le 10^{5}$, $1 \\le l \\le r \\le 10^9$).\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 numbers on the cards from top to bottom.\n\nIt is guaranteed that the sum of $n$ for all test cases does not exceed $2 \\cdot 10^{5}$.\n\nOutput: For each test case, output a single number β€” the maximum number of rounds Egor can win.\n\nExamples:\ninput:\n8\n5 3 10\n2 1 11 3 7\n10 1 5\n17 8 12 11 7 11 21 13 10 8\n3 4 5\n3 4 2\n8 12 25\n10 7 5 13 8 9 12 7\n2 3 3\n5 2\n9 7 9\n2 10 5 1 3 7 6 2 3\n1 8 10\n9\n5 5 6\n1 4 2 6 4\noutput:\n3\n0\n1\n4\n0\n3\n1\n2\n\nNote: In the first test case, Egor can win $3$ rounds:\n\n * In the first round, take the top $2$ cards with values $2$ and $1$ and win, as their sum is $3$. After this, the deck will look like this: $[11, 3, 7]$. * In the second round, take the top card and lose, as its value $11$ is greater than $r = 10$. After this, the deck will look like this: $[3, 7]$. * In the third round, take the top card with value $3$ and win. After this, the deck will look like this: $[7]$. * After this, in the fourth round, Egor only has to take the last card in the deck with value $7$ and win again. \n\nIn the second test case, Egor cannot win any rounds, no matter how hard he tries.\n\nIn the third test case, you can take one card in each round, then the first and third rounds will be losing, and the second round will be winning.\n\nIn the fourth test case, you can take two cards in each round and always 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": "1982C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Bouquet (Easy Version)\ntime_limit_ms: 1500\nmemory_limit_mb: 512\nDescription: This is the easy version of the problem. The only difference is that in this version, the flowers are specified by enumeration.\n\nA girl is preparing for her birthday and wants to buy the most beautiful bouquet. There are a total of $n$ flowers in the store, each of which is characterized by the number of petals, and 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 in her bouquet 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 flowers in the store and the number of coins the girl possesses, respectively. The second line of each test case contains $n$ 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 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, output a single integer β€” the maximum possible number of petals in the bouquet that the girl can assemble while meeting all the conditions listed above.\n\nExamples:\ninput:\n5\n5 10\n1 1 2 2 3\n8 20\n4 2 7 5 6 1 1 1\n8 100000\n239 30 610 122 24 40 8 2\n11 13\n2 4 11 1 1 2 3 5 4 3 2\n8 1033\n206 206 206 207 207 207 207 1000\noutput:\n7\n13\n610\n13\n1033\n\nNote: In the first test case, you can assemble a bouquet with $(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 third test case, you can assemble a bouquet with only one flower of any type, so the answer is $610$. In the fourth test case, you can assemble a bouquet with $(4, 4, 5)$, which gives you $13$ petals, and it is the maximum amount of petals that the girl can buy.\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": "1995B1", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: A TRUE Battle\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Alice and Bob are playing a game. There is a list of $n$ booleans, each of which is either true or false, given as a binary string $^{\\text{βˆ—}}$ of length $n$ (where $\\texttt{1}$ represents true, and $\\texttt{0}$ represents false). Initially, there are no operators between the booleans.\n\nAlice and Bob will take alternate turns placing and or or between the booleans, with Alice going first. Thus, the game will consist of $n-1$ turns since there are $n$ booleans. Alice aims for the final statement to evaluate to true, while Bob aims for it to evaluate to false. Given the list of boolean values, determine whether Alice will win if both players play optimally.\n\nTo evaluate the final expression, repeatedly perform the following steps until the statement consists of a single true or false:\n\n * If the statement contains an and operator, choose any one and replace the subexpression surrounding it with its evaluation. * Otherwise, the statement contains an or operator. Choose any one and replace the subexpression surrounding the or with its evaluation. \n\nFor example, the expression true or false and false is evaluated as true or (false and false) $=$ true or false $=$ true. It can be shown that the result of any compound statement is unique.\n\n$^{\\text{βˆ—}}$A binary string is a string that only consists of characters $\\texttt{0}$ and $\\texttt{1}$\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 an integer $n$ ($2 \\leq n \\leq 2 \\cdot 10^5$) β€” the length of the string.\n\nThe second line contains a binary string of length $n$, consisting of characters $\\texttt{0}$ and $\\texttt{1}$ β€” the list of boolean values.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each testcase, output \"YES\" (without quotes) if Alice wins, 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:\n5\n2\n11\n3\n010\n12\n101111111100\n10\n0111111011\n8\n01000010\noutput:\nYES\nNO\nYES\nYES\nNO\n\nNote: In the first testcase, Alice can place and between the two booleans. The game ends as there are no other places to place operators, and Alice wins because true and true is true.\n\nIn the second testcase, Alice can place or between the middle true and the left false. Bob can place and between the middle true and the right false. The statement false or true and false is false.\n\nNote that these examples may not be the best strategies for either Alice or Bob.\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": "2030C", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Computing Machine\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Sasha has two binary strings $s$ and $t$ of the same length $n$, consisting of the characters 0 and 1.\n\nThere is also a computing machine that can perform two types of operations on binary strings $a$ and $b$ of the same length $k$:\n\n 1. If $a_{i} = a_{i + 2} =$ 0, then you can assign $b_{i + 1} :=$ 1 ($1 \\le i \\le k - 2$). 2. If $b_{i} = b_{i + 2} =$ 1, then you can assign $a_{i + 1} :=$ 1 ($1 \\le i \\le k - 2$). \n\nSasha became interested in the following: if we consider the string $a=s_ls_{l+1}\\ldots s_r$ and the string $b=t_lt_{l+1}\\ldots t_r$, what is the maximum number of 1 characters in the string $a$ that can be obtained using the computing machine. Since Sasha is very curious but lazy, it is up to you to answer this question for several pairs $(l_i, r_i)$ that interest him.\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 \\le n \\le 2 \\cdot 10^5$) β€” the length of the strings $s$ and $t$.\n\nThe second line of each test case contains a binary string $s$ of length $n$, consisting of the characters 0 and 1.\n\nThe third line of each test case contains a binary string $t$ of length $n$, consisting of the characters 0 and 1.\n\nThe fourth line of each test case contains a single integer $q$ ($1 \\le q \\le 2 \\cdot 10^5$) β€” the number of queries.\n\nThe $i$-th of the following lines contains two integers $l_{i}$ and $r_{i}$ ($1 \\le l_{i} \\le r_{i} \\le n$) β€” the boundaries of the $i$-th pair of substrings that interest Sasha.\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $2 \\cdot 10^5$ and the sum of $q$ over all test cases does not exceed $2 \\cdot 10^5$.\n\nOutput: For each test case, output $q$ integers β€” the answers to all queries.\n\nExamples:\ninput:\n3\n4\n1111\n0000\n2\n1 2\n2 4\n4\n1010\n1101\n2\n1 3\n1 4\n6\n010101\n011010\n5\n2 3\n1 6\n2 5\n4 4\n3 6\noutput:\n2\n3\n2\n3\n1\n4\n3\n1\n2\n\nNote: In the first test case:\n\n * In the first query, $a =$ 11, so the maximum number of 1 characters is $2$. * In the second query, $a =$ 111, so the maximum number of 1 characters is $3$. \n\nIn the second test case:\n\n * In the first query, $a =$ 101 and $b =$ 110. No operations can be performed, so the maximum number of 1 characters is $2$. * In the second query, $a =$ 1010 and $b =$ 1101. Since $a_2 = a_4 =$ 0, we can assign $b_3 :=$ 1. Now $b_1 = b_3 =$ 1, so we can assign $a_2 :=$ 1. The string $a$ becomes 1110, so the maximum number of 1 characters 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": "1978E", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Circle Perimeter\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Given an integer $r$, find the number of lattice points that have a Euclidean distance from $(0, 0)$ greater than or equal to $r$ but strictly less than $r+1$.\n\nA lattice point is a point with integer coordinates. The Euclidean distance from $(0, 0)$ to the point $(x,y)$ is $\\sqrt{x^2 + y^2}$.\n\nInput: The first line contains a single integer $t$ ($1 \\leq t \\leq 1000$) β€” the number of test cases.\n\nThe only line of each test case contains a single integer $r$ ($1 \\leq r \\leq 10^5$).\n\nThe sum of $r$ over all test cases does not exceed $10^5$.\n\nOutput: For each test case, output a single integer β€” the number of lattice points that have an Euclidean distance $d$ from $(0, 0)$ such that $r \\leq d < r+1$.\n\nExamples:\ninput:\n6\n1\n2\n3\n4\n5\n1984\noutput:\n8\n16\n20\n24\n40\n12504\n\nNote: The points for the first three test cases are shown below.\n\n![](CDN_BASE_URL/798fdc9e24a49612fd77928f7fc973f8)\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": "1971F", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Alice's Adventures in ''Chess''\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Alice is trying to meet up with the Red Queen in the countryside! Right now, Alice is at position $(0, 0)$, and the Red Queen is at position $(a, b)$. Alice can only move in the four cardinal directions (north, east, south, west).\n\nMore formally, if Alice is at the point $(x, y)$, she will do one of the following:\n\n * go north (represented by N), moving to $(x, y+1)$; * go east (represented by E), moving to $(x+1, y)$; * go south (represented by S), moving to $(x, y-1)$; or * go west (represented by W), moving to $(x-1, y)$. \n\nAlice's movements are predetermined. She has a string $s$ representing a sequence of moves that she performs from left to right. Once she reaches the end of the sequence, she repeats the same pattern of moves forever.\n\nCan you help Alice figure out if she will ever meet the Red Queen?\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 three integers $n$, $a$, $b$ ($1 \\le n$, $a$, $b \\le 10$) β€” the length of the string and the initial coordinates of the Red Queen.\n\nThe second line contains a string $s$ of length $n$ consisting only of the characters N, E, S, or W.\n\nOutput: For each test case, output a single string \"YES\" or \"NO\" (without the quotes) denoting whether Alice will eventually meet the Red Queen.\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:\n6\n2 2 2\nNE\n3 2 2\nNNE\n6 2 1\nNNEESW\n6 10 10\nNNEESW\n3 4 2\nNEE\n4 5 5\nNEWS\noutput:\nYES\nNO\nYES\nYES\nYES\nNO\n\nNote: In the first test case, Alice follows the path $(0,0) \\xrightarrow[\\texttt{N}]{} (0,1) \\xrightarrow[\\texttt{E}]{} (1,1) \\xrightarrow[\\texttt{N}]{} (1,2) \\xrightarrow[\\texttt{E}]{} (2,2)$.\n\nIn the second test case, Alice can never reach the Red Queen.\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": "2028A", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Black Cells\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given a strip divided into cells, numbered from left to right from $0$ to $10^{18}$. Initially, all cells are white.\n\nYou can perform the following operation: choose two white cells $i$ and $j$, such that $i \\ne j$ and $|i - j| \\le k$, and paint them black.\n\nA list $a$ is given. All cells from this list must be painted black. Additionally, at most one cell that is not in this list can also be painted black. Your task is to determine the minimum value of $k$ for which this is possible.\n\nInput: The first line contains a single integer $t$ ($1 \\le t \\le 500$) β€” 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$ ($0 < a_i < 10^{18}$; $a_i < a_{i + 1}$).\n\nAdditional constraint on the input: the sum of $n$ across all test cases does not exceed $2000$.\n\nOutput: For each test case, print a single integer β€” the minimum value of $k$ for which it is possible to paint all the given cells black.\n\nExamples:\ninput:\n4\n2\n1 2\n1\n7\n3\n2 4 9\n5\n1 5 8 10 13\noutput:\n1\n1\n2\n3\n\nNote: In the first example, with $k=1$, it is possible to paint the cells $(1, 2)$.\n\nIn the second example, with $k=1$, it is possible to paint the cells $(7, 8)$.\n\nIn the third example, with $k=2$, it is possible to paint the cells $(2, 4)$ and $(8, 9)$.\n\nIn the fourth example, with $k=3$, it is possible to paint the cells $(0, 1)$, $(5, 8)$ and $(10, 13)$.\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": "2026B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Replacement\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You have a binary string$^{\\text{βˆ—}}$ $s$ of length $n$, and Iris gives you another binary string $r$ of length $n-1$.\n\nIris is going to play a game with you. During the game, you will perform $n-1$ operations on $s$. In the $i$-th operation ($1 \\le i \\le n-1$):\n\n * First, you choose an index $k$ such that $1\\le k\\le |s| - 1$ and $s_{k} \\neq s_{k+1}$. If it is impossible to choose such an index, you lose; * Then, you replace $s_ks_{k+1}$ with $r_i$. Note that this decreases the length of $s$ by $1$. \n\nIf all the $n-1$ operations are performed successfully, you win.\n\nDetermine whether it is possible for you to win this game.\n\n$^{\\text{βˆ—}}$A binary string is a string where each character is either $\\mathtt{0}$ or $\\mathtt{1}$.\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 first line of each test case contains a single integer $n$ ($2\\le n\\le 10^5$) β€” the length of $s$.\n\nThe second line contains the binary string $s$ of length $n$ ($s_i=\\mathtt{0}$ or $\\mathtt{1}$).\n\nThe third line contains the binary string $r$ of length $n-1$ ($r_i=\\mathtt{0}$ or $\\mathtt{1}$).\n\nIt is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.\n\nOutput: For each test case, print \"YES\" (without quotes) if you can win the game, 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:\n6\n2\n11\n0\n2\n01\n1\n4\n1101\n001\n6\n111110\n10000\n6\n010010\n11010\n8\n10010010\n0010010\noutput:\nNO\nYES\nYES\nNO\nYES\nNO\n\nNote: In the first test case, you cannot perform the first operation. Thus, you lose the game.\n\nIn the second test case, you can choose $k=1$ in the only operation, and after that, $s$ becomes equal to $\\mathtt{1}$. Thus, you win the game.\n\nIn the third test case, you can perform the following operations: $\\mathtt{1}\\underline{\\mathtt{10}}\\mathtt{1}\\xrightarrow{r_1=\\mathtt{0}} \\mathtt{1}\\underline{\\mathtt{01}} \\xrightarrow{r_2=\\mathtt{0}} \\underline{\\mathtt{10}} \\xrightarrow{r_3=\\mathtt{1}} \\mathtt{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": "2029B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Turtle and a MEX Problem (Easy Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: The two versions are different problems. In this version of the problem, you can 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 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\n20\n1281\n6\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 = 3$ and set $x$ to $\\text{mex}(x, a_{3, 1}, a_{3, 2}, a_{3, 3}, a_{3, 4}, a_{3, 5}) = \\text{mex}(1, 1, 3, 0, 3, 3) = 2$, and choose $i = 3$ and set $x$ to $\\text{mex}(x, a_{3, 1}, a_{3, 2}, a_{3, 3}, a_{3, 4}, a_{3, 5}) = \\text{mex}(2, 1, 3, 0, 3, 3) = 4$. It can be proved that Turtle can't make the value of $x$ greater than $4$, so $f(1) = 4$.\n\nIt can be seen that $f(0) = 4$, $f(1) = 4$, $f(2) = 4$, $f(3) = 4$, and $f(4) = 4$. So $f(0) + f(1) + f(2) + f(3) + f(4) = 4 + 4 + 4 + 4 + 4 = 20$.\n\nIn the fourth test case, it can be seen that $f(0) = 3$ and $f(1) = 3$. So $f(0) + f(1) = 3 + 3 = 6$.\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": "2003D1", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: K-Sort\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are given an array of integers $a$ of length $n$.\n\nYou can apply the following operation any number of times (maybe, zero):\n\n * First, choose an integer $k$ such that $1 \\le k \\le n$ and pay $k + 1$ coins. * Then, choose exactly $k$ indices such that $1 \\le i_1 < i_2 < \\ldots < i_k \\le n$. * Then, for each $x$ from $1$ to $k$, increase $a_{i_x}$ by $1$. \n\nFind the minimum number of coins needed to make $a$ non-decreasing. That is, $a_1 \\le a_2 \\le \\ldots \\le a_n$.\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 line of each test case contains a single integer $n$ ($1 \\le n \\le 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 \\le a_i \\le 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 a single integer β€” the minimum number of coins needed to make $a$ non-decreasing.\n\nExamples:\ninput:\n5\n3\n1 7 9\n5\n2 1 4 7 6\n4\n1 3 2 4\n1\n179\n9\n344 12 37 60 311 613 365 328 675\noutput:\n0\n3\n2\n0\n1821\n\nNote: In the first test case, $a$ is already sorted, so you don't have to spend any coins.\n\nIn the second test case, the optimal sequence of operations is:\n\n * Choose $k = 2$ and the indices $2$ and $5$: $[ 2, \\color{red}{1}, 4, 7, \\color{red}{6} ] \\rightarrow [2, 2, 4, 7, 7]$. This costs $3$ coins. \n\nIt can be proven that it is not possible to make $a$ non-decreasing by spending less than $3$ 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": "1987B", "task_type": "TestCase-Eval-Task1" }
[ { "content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Go Learn! (Easy Version)\ntime_limit_ms: 5000\nmemory_limit_mb: 256\nDescription: The differences between the easy and hard versions are the constraints on $n$ and the sum of $n$. In this version, $n \\leq 3000$ and the sum of $n$ does not exceed $10^4$. You can only make hacks if both versions are solved.\n\nWell, well, well, let's see how Bessie is managing her finances. She seems to be in the trenches! Fortunately, she is applying for a job at Moogle to resolve this issue. Moogle interviews require intensive knowledge of obscure algorithms and complex data structures, but Bessie received a tip-off from an LGM on exactly what she has to go learn.\n\nBessie wrote the following code to binary search for a certain element $k$ in a possibly unsorted array $[a_1, a_2,\\ldots,a_n]$ with $n$ elements.\n\n let l = 1 let h = n while l < h: let m = floor((l + h) / 2) if a[m] < k: l = m + 1 else: h = m return l \n\nBessie submitted her code to Farmer John's problem with $m$ ($1 \\leq m \\leq n$) tests. The $i$-th test is of the form $(x_i, k_i)$ ($1 \\leq x, k \\leq n$). It is guaranteed all the $x_i$ are distinct and all the $k_i$ are distinct.\n\nTest $i$ is correct if the following hold:\n\n 1. The $x_i$-th element in the array is $k_i$. 2. If Bessie calls the binary search as shown in the above code for $k_i$, it will return $x_i$. \n\nIt might not be possible for all $m$ tests to be correct on the same array, so Farmer John will remove some of them so Bessie can AC. Let $r$ be the minimum of tests removed so that there exists an array $[a_1, a_2,\\ldots,a_n]$ with $1 \\leq a_i \\leq n$ so that all remaining tests are correct.\n\nIn addition to finding $r$, Farmer John wants you to count the number of arrays $[a_1, a_2,\\ldots,a_n]$ with $1 \\leq a_i \\leq n$ such that there exists a way to remove exactly $r$ tests so that all the remaining tests are correct. Since this number may be very large, please find it modulo $998\\,244\\,353$.\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 two integers $n$ and $m$ ($1 \\leq m \\leq n \\leq 3000$) denoting the number of the array and the number of tests.\n\nThe following $m$ lines each contain two integers, describing the tests. The $i$-th line contains two integers $x_i$ and $k_i$ ($1 \\leq x_i, k_i \\leq n$) denoting the index and value of the test. It is guaranteed all $x_i$ are distinct and all $k_i$ are distinct.\n\nIt is guaranteed the sum of $n$ across all test cases does not exceed $10^4$.\n\nOutput: For each test case, output two integers, $r$ β€” the minimum of tests removed so that there exists an array so that all remaining tests are correct, and the number of arrays such that it is possible to remove $r$ tests to make all remaining tests correct modulo $998\\,244\\,353$.\n\nExamples:\ninput:\n2\n5 4\n1 1\n2 2\n4 3\n5 4\n5 4\n5 4\n2 5\n1 2\n3 3\noutput:\n0 1\n1 3\n\ninput:\n2\n6 6\n1 3\n2 5\n3 1\n4 2\n5 4\n6 6\n30 8\n19 22\n6 12\n12 1\n28 27\n3 4\n14 25\n29 14\n11 15\noutput:\n3 78\n3 839271911\n\nNote: Consider the first example.\n\nIn the first test case, the array $[1,2,2,3,4]$ satisfies all $m$ tests, so the minimum number of tests Bessie has to remove is $0$. Note that this is also the only array that satisfies all $m$ tests.\n\nIn the second test case, the minimum number of tests Bessie has to remove is $1$. The only test Bessie can remove is $(2,5)$. If Bessie removes test $(2,5)$, then the arrays satisfying the remaining $m-1$ tests are $[2,2,3,1,4]$, $[2,2,3,2,4]$, $[2,2,3,3,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": "2035G1", "task_type": "TestCase-Eval-Task1" }