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: Bonus Project\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: There is a team of $$$n$$$ software engineers numbered from $$$1$$$ to $$$n$$$. Their boss promises to give them a bonus if they complete an additional project. The project requires $$$k$$$ units of work in total. The bonus promised to the $$$i$$$-th engineer is $$$a_i$$$ burles. The boss doesn't assign specific tasks to engineers; it is expected that every engineer will voluntarily complete some integer amount of work units. The bonus will be paid to the entire team only if the project is completed; in other words, if the total amount of voluntary work units on the project is greater than or equal to $$$k$$$.\n\nThe amount of work that can be performed by each engineer is not limited. However, all engineers value their labour. The $$$i$$$-th engineer estimates one unit of their work as $$$b_i$$$ burles. If the bonus is paid, the benefit $$$s_i$$$ of the $$$i$$$-th engineer for completing $$$c$$$ units of work is defined as $$$s_i = a_i - c \\cdot b_i$$$. If the bonus is not paid, the engineer will not volunteer to do any work.\n\nEngineers work together for many years, so they know how the bonus is going to be distributed and how much their colleagues value the labour. That is, all $$$a_i$$$ and all $$$b_i$$$ are known to every engineer in the team.\n\nEngineers are eager to get the bonus, so they agreed on the following process of work distribution between them:\n\n- the first engineer says: \"I will complete $$$c_1$$$ units of work\", where $$$c_1$$$ is a non-negative integer;\n- then, the second engineer says: \"I will complete $$$c_2$$$ units of work\", where $$$c_2$$$ is a non-negative integer;\n- ... and so on;\n- finally, the $$$n$$$-th engineer says: \"I will complete $$$c_n$$$ units of work\", where $$$c_n$$$ is a non-negative integer.\n\nEvery engineer voices $$$c_i$$$ in a way to maximize their own benefit $$$s_i$$$. If the expected benefit is going to be zero, an engineer will still agree to work to get the experience and to help their colleagues obtain the bonus. However, if the benefit is expected to be negative for some reason (an engineer needs to perform an excessive amount of work or the project is not going to be completed), that engineer will not work at all (completes zero amount of work units).\n\nGiven that every engineer acts perfectly, your task is to find out the numbers $$$c_i$$$ voiced by every engineer.\n\nInput: The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\le n \\le 1000$$$; $$$1 \\le k \\le 10^6$$$) — the number of engineers in the company and the number of work units the project requires, respectively.\n\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 10^9$$$), where $$$a_i$$$ is the bonus which will be paid to the $$$i$$$-th engineer if the project is completed.\n\nThe third line contains $$$n$$$ integers $$$b_1, b_2, \\dots, b_n$$$ ($$$1 \\le b_i \\le 1000$$$), where $$$b_i$$$ is the work unit cost for the $$$i$$$-th engineer.\n\nOutput: Print $$$n$$$ integers $$$c_1, c_2, \\dots, c_n$$$ ($$$0 \\le c_i \\le k$$$) — the amount of work completed by each engineer given that every engineer behaves optimally. Note that the answer is unique.\n\nExamples:\ninput:\n3 6\n4 7 6\n1 2 3\noutput:\n1 3 2\n\ninput:\n3 12\n4 7 6\n1 2 3\noutput:\n0 0 0\n\ninput:\n3 11\n6 7 8\n1 2 3\noutput:\n6 3 2\n\nNote: In the first example, engineers distributed the work across them and got the bonus, even though the benefit for the third engineer is zero.\n\nIn the second example, the bonus project requires too many work units to complete, so it's more beneficial for engineers not to work at all.\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": "2038A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Make It Equal\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: You are given an integer array $$$a$$$ of size $$$n$$$. The elements of the array are numbered from $$$1$$$ to $$$n$$$.\n\nYou can perform the following operation any number of times (possibly, zero): choose an index $$$i$$$ from $$$1$$$ to $$$n$$$; decrease $$$a_i$$$ by $$$2$$$ and increase $$$a_{(i \\bmod n) + 1}$$$ by $$$1$$$.\n\nAfter you perform the operations, all elements of the array should be non-negative equal integers.\n\nYour task is to calculate the minimum number of operations you have to perform.\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$$$).\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$$$).\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 you have to perform. If it is impossible to make all elements of the array equal, print -1.\n\nExamples:\ninput:\n3\n2\n1 1\n3\n1 3 2\n4\n2 1 2 6\noutput:\n0\n-1\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": "2038B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: DIY\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: You are given a list of $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$. You need to pick $$$8$$$ elements from the list and use them as coordinates of four points. These four points should be corners of a rectangle which has its sides parallel to the coordinate axes. Your task is to pick coordinates in such a way that the resulting rectangle has the maximum possible area. The rectangle can be degenerate, i. e. its area can be $$$0$$$. Each integer can be used as many times as it occurs in the list (or less).\n\nInput: The first line contains one integer $$$t$$$ ($$$1 \\le t \\le 25\\,000$$$) — the number of test cases.\n\nThe first line of each test case contains one integer $$$n$$$ ($$$8 \\le n \\le 2 \\cdot 10^5$$$).\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$$$).\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 the answer as follows:\n\n- if it is impossible to construct a rectangle which meets the constraints from the statement, print a single line containing the word NO (case-insensitive);\n- otherwise, in the first line, print YES (case-insensitive). In the second line, print $$$8$$$ integers $$$x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4$$$ — the coordinates of the corners of the rectangle. You can print the corners in any order.\n\nExamples:\ninput:\n3\n16\n-5 1 1 2 2 3 3 4 4 5 5 6 6 7 7 10\n8\n0 0 -1 2 2 1 1 3\n8\n0 0 0 0 0 5 0 5\noutput:\nYES\n1 2 1 7 6 2 6 7\nNO\nYES\n0 0 0 5 0 0 0 5\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": "2038C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Divide OR Conquer\ntime_limit_ms: 3000\nmemory_limit_mb: 512\nDescription: You are given an array $$$[a_1, a_2, \\ldots a_n]$$$ consisting of integers between $$$0$$$ and $$$10^9$$$. You have to split this array into several segments (possibly one) in such a way that each element belongs to exactly one segment.\n\nLet the first segment be the array $$$[a_{l_1}, a_{l_1 + 1}, \\ldots, a_{r_1}]$$$, the second segment be $$$[a_{l_2}, a_{l_2+ 1}, \\ldots, a_{r_2}]$$$, ..., the last segment be $$$[a_{l_k}, a_{l_k+ 1}, \\ldots, a_{r_k}]$$$. Since every element should belong to exactly one array, $$$l_1 = 1$$$, $$$r_k = n$$$, and $$$r_i + 1 = l_{i+1}$$$ for each $$$i$$$ from $$$1$$$ to $$$k-1$$$. The split should meet the following condition: $$$f([a_{l_1}, a_{l_1 + 1}, \\ldots, a_{r_1}]) \\le f([a_{l_2}, a_{l_2+ 1}, \\ldots, a_{r_2}]) \\le \\dots \\le f([a_{l_k}, a_{l_k+1}, \\ldots, a_{r_k}])$$$, where $$$f(a)$$$ is the bitwise OR of all elements of the array $$$a$$$.\n\nCalculate the number of ways to split the array, and print it modulo $$$998\\,244\\,353$$$. Two ways are considered different if the sequences $$$[l_1, r_1, l_2, r_2, \\ldots, l_k, r_k]$$$ denoting the splits are different.\n\nInput: The first line contains an integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$) — the length of the array $$$a$$$.\n\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$0 \\le a_i \\le 10 ^9$$$) — the elements of the given array.\n\nOutput: Print one integer — the number of ways to split the array, taken modulo $$$998\\,244\\,353$$$.\n\nExamples:\ninput:\n3\n1 2 3\noutput:\n4\n\ninput:\n5\n1000 1000 1000 1000 1000\noutput:\n16\n\ninput:\n3\n3 4 6\noutput:\n3\n\nNote: In the first two examples, every way to split the array is valid.\n\nIn the third example, there are three valid ways to split the array:\n\n- $$$k = 3$$$; $$$l_1 = 1, r_1 = 1, l_2 = 2, r_2 = 2, l_3 = 3, r_3 = 3$$$; the resulting arrays are $$$[3]$$$, $$$[4]$$$, $$$[6]$$$, and $$$3 \\le 4 \\le 6$$$;\n- $$$k = 2$$$; $$$l_1 = 1, r_1 = 1, l_2 = 2, r_2 = 3$$$; the resulting arrays are $$$[3]$$$ and $$$[4, 6]$$$, and $$$3 \\le 6$$$;\n- $$$k = 1$$$; $$$l_1 = 1, r_1 = 3$$$; there will be only one array: $$$[3, 4, 6]$$$.\n\nIf you split the array into two arrays $$$[3, 4]$$$ and $$$[6]$$$, the bitwise OR of the first array is $$$7$$$, and the bitwise OR of the second array is $$$6$$$; $$$7 > 6$$$, so this way to split the array is invalid.\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": "2038D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Guess One Character\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: This is an interactive problem. You have to use flush operation right after printing each line. For example, in C++ you should use the function fflush(stdout) or cout.flush(), in Java or Kotlin — System.out.flush(), and in Python — sys.stdout.flush().\n\nThe jury has a string $$$s$$$ consisting of characters 0 and/or 1. The length of this string is $$$n$$$.\n\nYou can ask the following queries:\n\n- $$$1$$$ $$$t$$$ — \"how many times does $$$t$$$ appear in $$$s$$$ as a contiguous substring?\" Here, $$$t$$$ should be a string consisting of characters 0 and/or 1; its length should be at least $$$1$$$ and at most $$$n$$$. For example, if the string $$$s$$$ is 111011 and the string $$$t$$$ is 11, the response to the query is $$$3$$$.\n\nYou have to guess at least one character in the string $$$s$$$ by asking no more than $$$3$$$ queries. Note that giving the answer does not count as a query.\n\nIn every test and in every test case, the string $$$s$$$ is fixed beforehand.\n\nInput: None\n\nOutput: None\n\nExamples:\ninput:\n3 // 3 test cases\n3 // the length of the string is 3\n\n1 // 101 occurs once\n\n1 // guessed correctly\n2 // the length of the string is 2\n\n0 // 00 occurs zero times\n\n0 // 0 occurs zero times\n\n1 // guessed correctly\n2 // the length of the string is 2\n\n1 // 1 occurs once\n\n0 // 01 occurs zero times\n\n1 // guessed correctly\noutput:\n1 101 // how many times 101 occurs\n\n0 2 0 // guess: s[2] is 0\n\n\n1 00 // how many times 00 occurs\n\n1 0 // how many times 0 occurs\n\n0 1 1 // guess: s[1] is 1\n\n\n1 1 // how many times 1 occurs\n\n1 01 // how many times 01 occurs\n\n0 2 0 // guess: s[2] is 0\n\nNote: In the example, there are $$$3$$$ test cases: 101, 11 and 10. Note that everything after the // sign is a comment that explains which line means what in the interaction. The jury program won't print these comments in the actual problem, and you shouldn't print them. The empty lines are also added for your convenience, the jury program won't print them, and your solution should not print any empty lines.\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": "2038G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Waiting for...\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Monocarp is waiting for a bus at the bus stop. Unfortunately, there are many people who want to ride a bus too.\n\nYou are given a list of events of two types:\n\n- B $$$b_i$$$ — a bus with $$$b_i$$$ free seats arrives at the stop;\n- P $$$p_i$$$ — $$$p_i$$$ people arrive at the stop.\n\nThese events are listed in a chronological order.\n\nWhen a bus arrives, the following happens. All people at the bus stop (except for Monocarp) try to enter the bus. If there are enough free seats for all of them, then they all enter the bus. Otherwise, some people remain at the bus stop (the number of people who enter the bus is equal to the number of free seats).\n\nIf there is still at least one free seat after all people (except for Monocarp) enter the bus, then Monocarp can decide to enter this bus as well (but he might choose to wait for another bus). For each bus, you have to determine if it is possible for Monocarp to take that bus.\n\nInput: The first line contains one integer $$$n$$$ $$$(1 \\le n \\le 10^3)$$$ — the number of events.\n\nThen, $$$n$$$ lines follow. The $$$i$$$-th of them contains the description of the $$$i$$$-th event in one of the two following formats:\n\n- B $$$b_i$$$ ($$$1 \\le b_i \\le 10^6$$$) — a bus with $$$b_i$$$ free seats arrives at the stop;\n- P $$$p_i$$$ ($$$1 \\le p_i \\le 10^6$$$) — $$$p_i$$$ people arrive at the stop.\n\nAdditional constraint on the input: there is at least one event of type B.\n\nOutput: For each event of type B, print YES if it is possible for Monocarp to take the corresponding bus, or NO otherwise (case-insensitive).\n\nExamples:\ninput:\n10\nP 2\nP 5\nB 8\nP 14\nB 5\nB 9\nB 3\nP 2\nB 1\nB 2\noutput:\nYES\nNO\nNO\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": "2038J",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Grid Walk\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: You have an $$$n \\times n$$$ grid and two integers $$$a$$$ and $$$b$$$. Both the rows and the columns are numbered from $$$1$$$ to $$$n$$$. Let's denote the cell at the intersection of the $$$i$$$-th row and the $$$j$$$-th column as $$$(i, j)$$$.\n\nYou are standing in the cell $$$(1, 1)$$$ and want to move into the cell $$$(n, n)$$$.\n\nSuppose you are in the cell $$$(i, j)$$$; in one step, you can move either into the cell $$$(i, j + 1)$$$ or into the cell $$$(i + 1, j)$$$ if the corresponding cells exist.\n\nLet's define the cost of the cell $$$(i, j)$$$ as $$$c(i, j) = \\gcd(i, a) + \\gcd(j, b)$$$ (here, $$$\\gcd(x,y)$$$ denotes the greatest common divisor of $$$x$$$ and $$$y$$$). The cost of the route from $$$(1, 1)$$$ to $$$(n, n)$$$ is the sum of costs of the visited cells (including the starting cell and the finishing cell).\n\nFind the route with minimum possible cost and print its cost.\n\nInput: The only line contains three integers $$$n$$$, $$$a$$$, and $$$b$$$ ($$$2 \\le n \\le 10^6$$$; $$$1 \\le a, b \\le 10^6$$$).\n\nOutput: Print one integer — the cost of the cheapest route from $$$(1, 1)$$$ to $$$(n, n)$$$.\n\nExamples:\ninput:\n4 2 4\noutput:\n21\n\ninput:\n10 210 420\noutput:\n125\n\nNote: The first example is described in the picture above.\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": "2038K",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Bridge Renovation\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Recently, Monocarp started working as a director of a park located near his house. The park is quite large, so it even has a small river splitting it into several zones. Several bridges are built across this river. Three of these bridges are especially old and need to be repaired.\n\nAll three bridges have the same length but differ in width. Their widths are $$$18$$$, $$$21$$$ and $$$25$$$ units, respectively.\n\nDuring the park renovation process, Monocarp has to replace the old planks that served as the surface of the bridges with the new ones.\n\nPlanks are sold with a standard length of $$$60$$$ units. Monocarp already knows that he needs $$$n$$$ planks for each bridge. But since the bridges have different widths, he needs $$$n$$$ planks of length $$$18$$$ for the first bridge, $$$n$$$ planks of length $$$21$$$ for the second one, and $$$n$$$ planks of length $$$25$$$ for the last one.\n\nWorkers in charge of renovation have no problem with cutting planks into parts but refuse to join planks, since it creates weak spots and looks ugly.\n\nMonocarp wants to buy as few planks as possible but struggles to calculate the required number of planks. Can you help him?\n\nInput: The first and only line contains a single integer $$$n$$$ ($$$1 \\le n \\le 1000$$$) — the number of planks required for each of the three bridges.\n\nOutput: Print a single integer — the minimum number of planks of standard length ($$$60$$$ units) Monocarp needs to cover all three bridges if the planks can be cut into parts.\n\nExamples:\ninput:\n1\noutput:\n2\n\ninput:\n3\noutput:\n4\n\ninput:\n1000\noutput:\n1167\n\nNote: In the first example, it is possible to cut one plank of length $$$60$$$ into three planks with lengths $$$25$$$, $$$18$$$ and $$$17$$$, and cut another plank of length $$$60$$$ into two planks with lengths $$$39$$$ and $$$21$$$. That way, Monocarp will have all the required planks.\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": "2038L",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Greedy Monocarp\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: There are $$$n$$$ chests; the $$$i$$$-th chest initially contains $$$a_i$$$ coins. For each chest, you can choose any non-negative ($$$0$$$ or greater) number of coins to add to that chest, with one constraint: the total number of coins in all chests must become at least $$$k$$$.\n\nAfter you've finished adding coins to the chests, greedy Monocarp comes, who wants the coins. He will take the chests one by one, and since he is greedy, he will always choose the chest with the maximum number of coins. Monocarp will stop as soon as the total number of coins in chests he takes is at least $$$k$$$.\n\nYou want Monocarp to take as few coins as possible, so you have to add coins to the chests in such a way that, when Monocarp stops taking chests, he will have exactly $$$k$$$ coins. Calculate the minimum number of coins you have to add.\n\nInput: The first line contains one integer $$$t$$$ ($$$1 \\le t \\le 1000$$$) — the number of test cases.\n\nEach test case consists of two lines:\n\n- the first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\le n \\le 50$$$; $$$1 \\le k \\le 10^7$$$);\n- the second line contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le k$$$).\n\nOutput: For each test case, print one integer — the minimum number of coins you have to add so that, when Monocarp stops taking the chests, he has exactly $$$k$$$ coins. It can be shown that under the constraints of the problem, it is always possible.\n\nExamples:\ninput:\n4\n5 4\n4 1 2 3 2\n5 10\n4 1 2 3 2\n2 10\n1 1\n3 8\n3 3 3\noutput:\n0\n1\n8\n2\n\nNote: In the first test case of the example, you don't have to add any coins. When Monocarp arrives, he will take the chest with $$$4$$$ coins, so he will have exactly $$$4$$$ coins.\n\nIn the second test case of the example, you can add $$$1$$$ coin to the $$$4$$$-th chest, so, when Monocarp arrives, he will take a chest with $$$4$$$ coins, then another chest with $$$4$$$ coins, and a chest with $$$2$$$ coins.\n\nIn the third test case of the example, you can add $$$3$$$ coins to the $$$1$$$-st chest and $$$5$$$ coins to the $$$2$$$-nd chest.\n\nIn the fourth test case of the example, you can add $$$1$$$ coin to the $$$1$$$-st chest and $$$1$$$ coin to the $$$3$$$-rd chest.\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": "2042A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Game with Colored Marbles\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Alice and Bob play a game. There are $$$n$$$ marbles, the $$$i$$$-th of them has color $$$c_i$$$. The players take turns; Alice goes first, then Bob, then Alice again, then Bob again, and so on.\n\nDuring their turn, a player must take one of the remaining marbles and remove it from the game. If there are no marbles left (all $$$n$$$ marbles have been taken), the game ends.\n\nAlice's score at the end of the game is calculated as follows:\n\n- she receives $$$1$$$ point for every color $$$x$$$ such that she has taken at least one marble of that color;\n- additionally, she receives $$$1$$$ point for every color $$$x$$$ such that she has taken all marbles of that color (of course, only colors present in the game are considered).\n\nFor example, suppose there are $$$5$$$ marbles, their colors are $$$[1, 3, 1, 3, 4]$$$, and the game goes as follows: Alice takes the $$$1$$$-st marble, then Bob takes the $$$3$$$-rd marble, then Alice takes the $$$5$$$-th marble, then Bob takes the $$$2$$$-nd marble, and finally, Alice takes the $$$4$$$-th marble. Then, Alice receives $$$4$$$ points: $$$3$$$ points for having at least one marble for colors $$$1$$$, $$$3$$$ and $$$4$$$, and $$$1$$$ point for having all marbles of color $$$4$$$. Note that this strategy is not necessarily optimal for both players.\n\nAlice wants to maximize her score at the end of the game. Bob wants to minimize it. Both players play optimally (i. e. Alice chooses a strategy which allows her to get as many points as possible, and Bob chooses a strategy which minimizes the amount of points Alice can get).\n\nCalculate Alice's score at the end of the game.\n\nInput: The first line contains one integer $$$t$$$ ($$$1 \\le t \\le 1000$$$) — the number of test cases.\n\nEach test case consists of two lines:\n\n- the first line contains one integer $$$n$$$ ($$$1 \\le n \\le 1000$$$) — the number of marbles;\n- the second line contains $$$n$$$ integers $$$c_1, c_2, \\dots, c_n$$$ ($$$1 \\le c_i \\le n$$$) — the colors of the marbles.\n\nAdditional constraint on the input: the sum of $$$n$$$ over all test cases does not exceed $$$1000$$$.\n\nOutput: For each test case, print one integer — Alice's score at the end of the game, assuming that both players play optimally.\n\nExamples:\ninput:\n3\n5\n1 3 1 3 4\n3\n1 2 3\n4\n4 4 4 4\noutput:\n4\n4\n1\n\nNote: In the second test case of the example, the colors of all marbles are distinct, so, no matter how the players act, Alice receives $$$4$$$ points for having all marbles of two colors, and no marbles of the third color.\n\nIn the third test case of the example, the colors of all marbles are the same, so, no matter how the players act, Alice receives $$$1$$$ point for having at least one (but not all) marble of color $$$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": "2042B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Competitive Fishing\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Alice and Bob participate in a fishing contest! In total, they caught $$$n$$$ fishes, numbered from $$$1$$$ to $$$n$$$ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others — by Bob.\n\nTheir performance will be evaluated as follows. First, an integer $$$m$$$ will be chosen, and all fish will be split into $$$m$$$ non-empty groups. The first group should contain several (at least one) smallest fishes, the second group — several (at least one) next smallest fishes, and so on. Each fish should belong to exactly one group, and each group should be a contiguous subsegment of fishes. Note that the groups are numbered in exactly that order; for example, the fishes from the second group cannot be smaller than the fishes from the first group, since the first group contains the smallest fishes.\n\nThen, each fish will be assigned a value according to its group index: each fish in the first group gets value equal to $$$0$$$, each fish in the second group gets value equal to $$$1$$$, and so on. So, each fish in the $$$i$$$-th group gets value equal to $$$(i-1)$$$.\n\nThe score of each contestant is simply the total value of all fishes that contestant caught.\n\nYou want Bob's score to exceed Alice's score by at least $$$k$$$ points. What is the minimum number of groups ($$$m$$$) you have to split the fishes into? If it is impossible, you should report that.\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$$$ ($$$2 \\le n \\le 2 \\cdot 10^5$$$; $$$1 \\le k \\le 10^9$$$).\n\nThe second line contains a string, consisting of exactly $$$n$$$ characters. The $$$i$$$-th character is either 0 (denoting that the $$$i$$$-th fish was caught by Alice) or 1 (denoting that the $$$i$$$-th fish was caught by Bob).\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 minimum number of groups you have to split the fishes into; or -1 if it's impossible.\n\nExamples:\ninput:\n7\n4 1\n1001\n4 1\n1010\n4 1\n0110\n4 2\n0110\n6 3\n001110\n10 20\n1111111111\n5 11\n11111\noutput:\n2\n-1\n2\n-1\n3\n4\n-1\n\nNote: In the first test case of the example, you can split the fishes into groups as follows: the first three fishes form the $$$1$$$-st group, the last fish forms the $$$2$$$-nd group. Then, Bob's score will be $$$1$$$, and Alice's score will be $$$0$$$.\n\nIn the third test case of the example, you can split the fishes into groups as follows: the first fish forms the $$$1$$$-st group, the last three fishes form the $$$2$$$-nd group. Then, Bob's score will be $$$2$$$, and Alice's score will be $$$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": "2042C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Recommendations\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Suppose you are working in some audio streaming service. The service has $$$n$$$ active users and $$$10^9$$$ tracks users can listen to. Users can like tracks and, based on likes, the service should recommend them new tracks.\n\nTracks are numbered from $$$1$$$ to $$$10^9$$$. It turned out that tracks the $$$i$$$-th user likes form a segment $$$[l_i, r_i]$$$.\n\nLet's say that the user $$$j$$$ is a predictor for user $$$i$$$ ($$$j \\neq i$$$) if user $$$j$$$ likes all tracks the $$$i$$$-th user likes (and, possibly, some other tracks too).\n\nAlso, let's say that a track is strongly recommended for user $$$i$$$ if the track is not liked by the $$$i$$$-th user yet, but it is liked by every predictor for the $$$i$$$-th user.\n\nCalculate the number of strongly recommended tracks for each user $$$i$$$. If a user doesn't have any predictors, then print $$$0$$$ for that user.\n\nInput: The first line contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases. Next, $$$t$$$ cases follow.\n\nThe first line of each test case contains one integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$) — the number of users.\n\nThe next $$$n$$$ lines contain two integers $$$l_i$$$ and $$$r_i$$$ per line ($$$1 \\le l_i \\le r_i \\le 10^9$$$) — the segment of tracks the $$$i$$$-th user likes.\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 $$$n$$$ integers, where the $$$i$$$-th integer is the number of strongly recommended tracks for the $$$i$$$-th user (or $$$0$$$, if that user doesn't have any predictors).\n\nExamples:\ninput:\n4\n3\n3 8\n2 5\n4 5\n2\n42 42\n1 1000000000\n3\n42 42\n1 1000000000\n42 42\n6\n1 10\n3 10\n3 7\n5 7\n4 4\n1 2\noutput:\n0\n0\n1\n999999999\n0\n0\n0\n0\n0\n2\n3\n2\n4\n8\n\nNote: In the first test case:\n\n- the first user has no predictors;\n- the second user has no predictors;\n- the third user has two predictors: users $$$1$$$ and $$$2$$$; only track $$$3$$$ is liked by both of them and not liked by the third user.\n\nIn the second test case, the second user is a predictor for the first user. Therefore, all tracks, except $$$42$$$, are strongly recommended for the first user.\n\nIn the third test case, the first user has two predictors: users $$$2$$$ and $$$3$$$, but there is no track that is liked by them and not liked by the first user himself.\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": "2042D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Minimize!\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are given two integers $$$a$$$ and $$$b$$$ ($$$a \\leq b$$$). Over all possible integer values of $$$c$$$ ($$$a \\leq c \\leq b$$$), find the minimum value of $$$(c - a) + (b - c)$$$.\n\nInput: The first line contains $$$t$$$ ($$$1 \\leq t \\leq 55$$$) — the number of test cases.\n\nEach test case contains two integers $$$a$$$ and $$$b$$$ ($$$1 \\leq a \\leq b \\leq 10$$$).\n\nOutput: For each test case, output the minimum possible value of $$$(c - a) + (b - c)$$$ on a new line.\n\nExamples:\ninput:\n3\n1 2\n3 10\n5 5\noutput:\n1\n7\n0\n\nNote: In the first test case, you can choose $$$c = 1$$$ and obtain an answer of $$$(1 - 1) + (2 - 1) = 1$$$. It can be shown this is the minimum value possible.\n\nIn the second test case, you can choose $$$c = 6$$$ and obtain an answer of $$$(6 - 3) + (10 - 6) = 7$$$. It can be shown this is the minimum value possible.\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": "2009A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: osu!mania\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are playing your favorite rhythm game, osu!mania. The layout of your beatmap consists of $$$n$$$ rows and $$$4$$$ columns. Because notes at the bottom are closer, you will process the bottommost row first and the topmost row last. Each row will contain exactly one note, represented as a '#'.\n\nFor each note $$$1, 2, \\dots, n$$$, in the order of processing, output the column in which the note appears.\n\nInput: The first line contains $$$t$$$ ($$$1 \\leq t \\leq 100$$$) — the number of test cases.\n\nFor each test case, the first line contains $$$n$$$ ($$$1 \\leq n \\leq 500$$$) — the number of rows of the beatmap.\n\nThe following $$$n$$$ lines contain $$$4$$$ characters. The $$$i$$$-th line represents the $$$i$$$-th row of the beatmap from the top. It is guaranteed that the characters are either '.' or '#', and exactly one of the characters is '#'.\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$500$$$.\n\nOutput: For each test case, output $$$n$$$ integers on a new line, the column that the $$$i$$$-th note appears in for all $$$i$$$ from $$$1$$$ to $$$n$$$.\n\nExamples:\ninput:\n3\n4\n#...\n.#..\n..#.\n...#\n2\n.#..\n.#..\n1\n...#\noutput:\n4 3 2 1 \n2 2 \n4\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2009B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: The Legend of Freya the Frog\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Freya the Frog is traveling on the 2D coordinate plane. She is currently at point $$$(0,0)$$$ and wants to go to point $$$(x,y)$$$. In one move, she chooses an integer $$$d$$$ such that $$$0 \\leq d \\leq k$$$ and jumps $$$d$$$ spots forward in the direction she is facing.\n\nInitially, she is facing the positive $$$x$$$ direction. After every move, she will alternate between facing the positive $$$x$$$ direction and the positive $$$y$$$ direction (i.e., she will face the positive $$$y$$$ direction on her second move, the positive $$$x$$$ direction on her third move, and so on).\n\nWhat is the minimum amount of moves she must perform to land on point $$$(x,y)$$$?\n\nInput: The first line contains an integer $$$t$$$ ($$$1 \\leq t \\leq 10^4$$$) — the number of test cases.\n\nEach test case contains three integers $$$x$$$, $$$y$$$, and $$$k$$$ ($$$0 \\leq x, y \\leq 10^9, 1 \\leq k \\leq 10^9$$$).\n\nOutput: For each test case, output the number of jumps Freya needs to make on a new line.\n\nExamples:\ninput:\n3\n9 11 3\n0 10 8\n1000000 100000 10\noutput:\n8\n4\n199999\n\nNote: In the first sample, one optimal set of moves is if Freya jumps in the following way: ($$$0,0$$$) $$$\\rightarrow$$$ ($$$2,0$$$) $$$\\rightarrow$$$ ($$$2,2$$$) $$$\\rightarrow$$$ ($$$3,2$$$) $$$\\rightarrow$$$ ($$$3,5$$$) $$$\\rightarrow$$$ ($$$6,5$$$) $$$\\rightarrow$$$ ($$$6,8$$$) $$$\\rightarrow$$$ ($$$9,8$$$) $$$\\rightarrow$$$ ($$$9,11$$$). This takes 8 jumps.\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": "2009C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Satyam and Counting\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Satyam is given $$$n$$$ distinct points on the 2D coordinate plane. It is guaranteed that $$$0 \\leq y_i \\leq 1$$$ for all given points $$$(x_i, y_i)$$$. How many different nondegenerate right triangles$$$^{\\text{∗}}$$$ can be formed from choosing three different points as its vertices?\n\nTwo triangles $$$a$$$ and $$$b$$$ are different if there is a point $$$v$$$ such that $$$v$$$ is a vertex of $$$a$$$ but not a vertex of $$$b$$$.\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$$$ ($$$3 \\leq n \\leq 2 \\cdot 10^5$$$) — the number of points.\n\nThe following $$$n$$$ lines contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$0 \\leq x_i \\leq n$$$, $$$0 \\leq y_i \\leq 1$$$) — the $$$i$$$'th point that Satyam can choose from. It is guaranteed that all $$$(x_i, y_i)$$$ are pairwise distinct.\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \\cdot 10^5$$$.\n\nOutput: Output an integer for each test case, the number of distinct nondegenerate right triangles that can be formed from choosing three points.\n\nExamples:\ninput:\n3\n5\n1 0\n1 1\n3 0\n5 0\n2 1\n3\n0 0\n1 0\n3 0\n9\n1 0\n2 0\n3 0\n4 0\n5 0\n2 1\n7 1\n8 1\n9 1\noutput:\n4\n0\n8\n\nNote: The four triangles in question for the first test case:\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": "2009D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Klee's SUPER DUPER LARGE Array!!!\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Klee has an array $$$a$$$ of length $$$n$$$ containing integers $$$[k, k+1, ..., k+n-1]$$$ in that order. Klee wants to choose an index $$$i$$$ ($$$1 \\leq i \\leq n$$$) such that $$$x = |a_1 + a_2 + \\dots + a_i - a_{i+1} - \\dots - a_n|$$$ is minimized. Note that for an arbitrary integer $$$z$$$, $$$|z|$$$ represents the absolute value of $$$z$$$.\n\nOutput the minimum possible value of $$$x$$$.\n\nInput: The first line contains $$$t$$$ ($$$1 \\leq t \\leq 10^4$$$) — the number of test cases.\n\nEach test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \\leq n, k \\leq 10^9$$$) — the length of the array and the starting element of the array.\n\nOutput: For each test case, output the minimum value of $$$x$$$ on a new line.\n\nExamples:\ninput:\n4\n2 2\n7 2\n5 3\n1000000000 1000000000\noutput:\n1\n5\n1\n347369930\n\nNote: In the first sample, $$$a = [2, 3]$$$. When $$$i = 1$$$ is chosen, $$$x = |2-3| = 1$$$. It can be shown this is the minimum possible value of $$$x$$$.\n\nIn the third sample, $$$a = [3, 4, 5, 6, 7]$$$. When $$$i = 3$$$ is chosen, $$$x = |3 + 4 + 5 - 6 - 7| = 1$$$. It can be shown this is the minimum possible value of $$$x$$$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2009E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Firefly's Queries\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Firefly is given an array $$$a$$$ of length $$$n$$$. Let $$$c_i$$$ denote the $$$i$$$'th cyclic shift$$$^{\\text{∗}}$$$ of $$$a$$$. She creates a new array $$$b$$$ such that $$$b = c_1 + c_2 + \\dots + c_n$$$ where $$$+$$$ represents concatenation$$$^{\\text{†}}$$$.\n\nThen, she asks you $$$q$$$ queries. For each query, output the sum of all elements in the subarray of $$$b$$$ that starts from the $$$l$$$-th element and ends at the $$$r$$$-th element, inclusive of both ends.\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 $$$q$$$ ($$$1 \\leq n, q \\leq 2 \\cdot 10^5$$$) — the length of the array and the number of queries.\n\nThe following line contains $$$n$$$ integers $$$a_1, a_2, ..., a_n$$$ ($$$1 \\leq a_i \\leq 10^6$$$).\n\nThe following $$$q$$$ lines contain two integers $$$l$$$ and $$$r$$$ ($$$1 \\leq l \\leq r \\leq n^2$$$) — the left and right bounds of the query.\n\nNote that the large inputs may require the use of 64-bit integers.\n\nIt is guaranteed that the sum of $$$n$$$ does not exceed $$$2 \\cdot 10^5$$$ and the sum of $$$q$$$ does not exceed $$$2 \\cdot 10^5$$$.\n\nOutput: For each query, output the answer on a new line.\n\nExamples:\ninput:\n5\n3 3\n1 2 3\n1 9\n3 5\n8 8\n5 5\n4 8 3 2 4\n1 14\n3 7\n7 10\n2 11\n1 25\n1 1\n6\n1 1\n5 7\n3 1 6 10 4\n3 21\n6 17\n2 2\n1 5\n1 14\n9 15\n12 13\n5 3\n4 9 10 10 1\n20 25\n3 11\n20 22\noutput:\n18\n8\n1\n55\n20\n13\n41\n105\n6\n96\n62\n1\n24\n71\n31\n14\n44\n65\n15\n\nNote: For the first test case, $$$b = [1, 2, 3, 2, 3, 1, 3, 1, 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": "2009F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Yunli's Subarray Queries (easy version)\ntime_limit_ms: 3000\nmemory_limit_mb: 512\nDescription: This is the easy version of the problem. In this version, it is guaranteed that $$$r=l+k-1$$$ for all queries.\n\nFor an arbitrary array $$$b$$$, Yunli can perform the following operation any number of times:\n\n- Select an index $$$i$$$. Set $$$b_i = x$$$ where $$$x$$$ is any integer she desires ($$$x$$$ is not limited to the interval $$$[1,n]$$$).\n\nDenote $$$f(b)$$$ as the minimum number of operations she needs to perform until there exists a consecutive subarray$$$^{\\text{∗}}$$$ of length at least $$$k$$$ in $$$b$$$.\n\nYunli is given an array $$$a$$$ of size $$$n$$$ and asks you $$$q$$$ queries. In each query, you must output $$$\\sum_{j=l+k-1}^{r} f([a_l, a_{l+1}, \\ldots, a_j])$$$. Note that in this version, you are only required to output $$$f([a_l, a_{l+1}, \\ldots, a_{l+k-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 three integers $$$n$$$, $$$k$$$, and $$$q$$$ ($$$1 \\leq k \\leq n \\leq 2 \\cdot 10^5$$$, $$$1 \\leq q \\leq 2 \\cdot 10^5$$$) — the length of the array, the length of the consecutive subarray, and the number of queries.\n\nThe following line contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\leq a_i \\leq n$$$).\n\nThe following $$$q$$$ lines contain two integers $$$l$$$ and $$$r$$$ ($$$1 \\leq l \\leq r \\leq n$$$, $$$r=l+k-1$$$) — the bounds of the query.\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: Output $$$\\sum_{j=l+k-1}^{r} f([a_l, a_{l+1}, \\ldots, a_j])$$$ for each query on a new line.\n\nExamples:\ninput:\n3\n7 5 3\n1 2 3 2 1 2 3\n1 5\n2 6\n3 7\n8 4 2\n4 3 1 1 2 4 3 2\n3 6\n2 5\n5 4 2\n4 5 1 2 3\n1 4\n2 5\noutput:\n2\n3\n2\n2\n2\n2\n1\n\nNote: In the first query of the first testcase, $$$b=[1,2,3,2,1]$$$. Yunli can make a consecutive subarray of length $$$5$$$ in $$$2$$$ moves:\n\n- Set $$$b_4=4$$$\n- Set $$$b_5=5$$$\n\nIn the second query of the first testcase, $$$b=[2,3,2,1,2]$$$. Yunli can make a consecutive subarray of length $$$5$$$ in $$$3$$$ moves:\n\n- Set $$$b_3=0$$$\n- Set $$$b_2=-1$$$\n- Set $$$b_1=-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": "2009G1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Yunli's Subarray Queries (hard version)\ntime_limit_ms: 3000\nmemory_limit_mb: 512\nDescription: This is the hard version of the problem. In this version, it is guaranteed that $$$r \\geq l+k-1$$$ for all queries.\n\nFor an arbitrary array $$$b$$$, Yunli can perform the following operation any number of times:\n\n- Select an index $$$i$$$. Set $$$b_i = x$$$ where $$$x$$$ is any integer she desires ($$$x$$$ is not limited to the interval $$$[1,n]$$$).\n\nDenote $$$f(b)$$$ as the minimum number of operations she needs to perform until there exists a consecutive subarray$$$^{\\text{∗}}$$$ of length at least $$$k$$$ in $$$b$$$.\n\nYunli is given an array $$$a$$$ of size $$$n$$$ and asks you $$$q$$$ queries. In each query, you must output $$$\\sum_{j=l+k-1}^{r} f([a_l, a_{l+1}, \\ldots, a_j])$$$.\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 three integers $$$n$$$, $$$k$$$, and $$$q$$$ ($$$1 \\leq k \\leq n \\leq 2 \\cdot 10^5$$$, $$$1 \\leq q \\leq 2 \\cdot 10^5$$$) — the length of the array, the length of the consecutive subarray, and the number of queries.\n\nThe following line contains $$$n$$$ integers $$$a_1, a_2, ..., a_n$$$ ($$$1 \\leq a_i \\leq n$$$).\n\nThe following $$$q$$$ lines contain two integers $$$l$$$ and $$$r$$$ ($$$1 \\leq l \\leq r \\leq n$$$, $$$r \\geq l+k-1$$$) — the bounds of the query.\n\nIt is guaranteed 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: Output $$$\\sum_{j=l+k-1}^{r} f([a_l, a_{l+1}, \\ldots, a_j])$$$ for each query on a new line.\n\nExamples:\ninput:\n3\n7 5 3\n1 2 3 2 1 2 3\n1 7\n2 7\n3 7\n8 4 2\n4 3 1 1 2 4 3 2\n3 6\n1 5\n5 4 2\n4 5 1 2 3\n1 4\n1 5\noutput:\n6\n5\n2\n2\n5\n2\n3\n\nNote: In the second query of the first testcase, we calculate the following function values:\n\n- $$$f([2,3,2,1,2])=3$$$ because Yunli can set $$$b_3=4$$$, $$$b_4=5$$$, and $$$b_5=6$$$, making a consecutive subarray of size $$$5$$$ in $$$3$$$ moves.\n- $$$f([2,3,2,1,2,3])=2$$$ because we can set $$$b_3=0$$$ and $$$b_2=-1$$$, making a consecutive subarray of size $$$5$$$ in $$$2$$$ moves (starting at position $$$2$$$)\n\nThe answer to this query is $$$3+2=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": "2009G2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Swap Columns and Find a Path\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: There is a matrix consisting of $$$2$$$ rows and $$$n$$$ columns. The rows are numbered from $$$1$$$ to $$$2$$$ from top to bottom; the columns are numbered from $$$1$$$ to $$$n$$$ from left to right. Let's denote the cell on the intersection of the $$$i$$$-th row and the $$$j$$$-th column as $$$(i,j)$$$. Each cell contains an integer; initially, the integer in the cell $$$(i,j)$$$ is $$$a_{i,j}$$$.\n\nYou can perform the following operation any number of times (possibly zero):\n\n- choose two columns and swap them (i. e. choose two integers $$$x$$$ and $$$y$$$ such that $$$1 \\le x < y \\le n$$$, then swap $$$a_{1,x}$$$ with $$$a_{1,y}$$$, and then swap $$$a_{2,x}$$$ with $$$a_{2,y}$$$).\n\nAfter performing the operations, you have to choose a path from the cell $$$(1,1)$$$ to the cell $$$(2,n)$$$. For every cell $$$(i,j)$$$ in the path except for the last, the next cell should be either $$$(i+1,j)$$$ or $$$(i,j+1)$$$. Obviously, the path cannot go outside the matrix.\n\nThe cost of the path is the sum of all integers in all $$$(n+1)$$$ cells belonging to the path. You have to perform the operations and choose a path so that its cost is maximum possible.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \\le t \\le 5000$$$). The description of the test cases follows.\n\nEach test case consists of three lines:\n\n- the first line contains one integer $$$n$$$ ($$$1 \\le n \\le 5000$$$) — the number of columns in the matrix;\n- the second line contains $$$n$$$ integers $$$a_{1,1}, a_{1,2}, \\ldots, a_{1,n}$$$ ($$$-10^5 \\le a_{i,j} \\le 10^5$$$) — the first row of the matrix;\n- the third line contains $$$n$$$ integers $$$a_{2,1}, a_{2,2}, \\ldots, a_{2,n}$$$ ($$$-10^5 \\le a_{i,j} \\le 10^5$$$) — the second row of the matrix.\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$5000$$$.\n\nOutput: For each test case, print one integer — the maximum cost of a path you can obtain.\n\nExamples:\ninput:\n3\n1\n-10\n5\n3\n1 2 3\n10 -5 -3\n4\n2 8 5 3\n1 10 3 4\noutput:\n-5\n16\n29\n\nNote: Here are the explanations of the first three test cases of the example. The left matrix is the matrix given in the input, the right one is the state of the matrix after several column swaps (possibly zero). The optimal path is highlighted in green.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2046A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Move Back at a Cost\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given an array of integers $$$a$$$ of length $$$n$$$. You can perform the following operation zero or more times:\n\n- In one operation choose an index $$$i$$$ ($$$1 \\le i \\le n$$$), assign $$$a_i := a_i + 1$$$, and then move $$$a_i$$$ to the back of the array (to the rightmost position). For example, if $$$a = [3, 5, 1, 9]$$$, and you choose $$$i = 2$$$, the array becomes $$$[3, 1, 9, 6]$$$.\n\nFind the lexicographically smallest$$$^{\\text{∗}}$$$ array you can get by performing these operations.\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 contains a single integer $$$n$$$ ($$$1 \\le n \\le 10^5$$$), the length of the array.\n\nThe second line 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 $$$10^5$$$.\n\nOutput: For each test case, print the lexicographically smallest array you can get.\n\nExamples:\ninput:\n3\n3\n2 1 3\n5\n1 2 2 1 4\n6\n1 2 3 6 5 4\noutput:\n1 3 3 \n1 1 3 3 5 \n1 2 3 4 6 7\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": "2046B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Shohag Loves XOR (Easy Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the easy version of the problem. The differences between the two versions are highlighted in bold. You can only make hacks if both versions of the problem are solved.\n\nShohag has two integers $$$x$$$ and $$$m$$$. Help him count the number of integers $$$1 \\le y \\le m$$$ such that $$$\\mathbf{x \\neq y}$$$ and $$$x \\oplus y$$$ is a divisor$$$^{\\text{∗}}$$$ of either $$$x$$$, $$$y$$$, or both. Here $$$\\oplus$$$ is the bitwise XOR operator.\n\nInput: The first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nThe first and only line of each test case contains two space-separated integers $$$x$$$ and $$$m$$$ ($$$1 \\le x \\le 10^6$$$, $$$1 \\le m \\le 10^{18}$$$).\n\nIt is guaranteed that the sum of $$$x$$$ over all test cases does not exceed $$$10^7$$$.\n\nOutput: For each test case, print a single integer — the number of suitable $$$y$$$.\n\nExamples:\ninput:\n5\n6 9\n5 7\n2 3\n6 4\n4 1\noutput:\n3\n2\n1\n1\n0\n\nNote: In the first test case, for $$$x = 6$$$, there are $$$3$$$ valid values for $$$y$$$ among the integers from $$$1$$$ to $$$m = 9$$$, and they are $$$4$$$, $$$5$$$, and $$$7$$$.\n\n- $$$y = 4$$$ is valid because $$$x \\oplus y = 6 \\oplus 4 = 2$$$ and $$$2$$$ is a divisor of both $$$x = 6$$$ and $$$y = 4$$$.\n- $$$y = 5$$$ is valid because $$$x \\oplus y = 6 \\oplus 5 = 3$$$ and $$$3$$$ is a divisor of $$$x = 6$$$.\n- $$$y = 7$$$ is valid because $$$x \\oplus y = 6 \\oplus 7 = 1$$$ and $$$1$$$ is a divisor of both $$$x = 6$$$ and $$$y = 7$$$.\n\nIn the second test case, for $$$x = 5$$$, there are $$$2$$$ valid values for $$$y$$$ among the integers from $$$1$$$ to $$$m = 7$$$, and they are $$$4$$$ and $$$6$$$.\n\n- $$$y = 4$$$ is valid because $$$x \\oplus y = 5 \\oplus 4 = 1$$$ and $$$1$$$ is a divisor of both $$$x = 5$$$ and $$$y = 4$$$.\n- $$$y = 6$$$ is valid because $$$x \\oplus y = 5 \\oplus 6 = 3$$$ and $$$3$$$ is a divisor of $$$y = 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": "2039C1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Shohag Loves XOR (Hard Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the hard version of the problem. The differences between the two versions are highlighted in bold. You can only make hacks if both versions of the problem are solved.\n\nShohag has two integers $$$x$$$ and $$$m$$$. Help him count the number of integers $$$1 \\le y \\le m$$$ such that $$$x \\oplus y$$$ is divisible$$$^{\\text{∗}}$$$ by either $$$x$$$, $$$y$$$, or both. Here $$$\\oplus$$$ is the bitwise XOR operator.\n\nInput: The first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nThe first and only line of each test case contains two space-separated integers $$$x$$$ and $$$m$$$ ($$$1 \\le x \\le 10^6$$$, $$$1 \\le m \\le 10^{18}$$$).\n\nIt is guaranteed that the sum of $$$x$$$ over all test cases does not exceed $$$10^7$$$.\n\nOutput: For each test case, print a single integer — the number of suitable $$$y$$$.\n\nExamples:\ninput:\n5\n7 10\n2 3\n6 4\n1 6\n4 1\noutput:\n3\n2\n2\n6\n1\n\nNote: In the first test case, for $$$x = 7$$$, there are $$$3$$$ valid values for $$$y$$$ among the integers from $$$1$$$ to $$$m = 10$$$, and they are $$$1$$$, $$$7$$$, and $$$9$$$.\n\n- $$$y = 1$$$ is valid because $$$x \\oplus y = 7 \\oplus 1 = 6$$$ and $$$6$$$ is divisible by $$$y = 1$$$.\n- $$$y = 7$$$ is valid because $$$x \\oplus y = 7 \\oplus 7 = 0$$$ and $$$0$$$ is divisible by both $$$x = 7$$$ and $$$y = 7$$$.\n- $$$y = 9$$$ is valid because $$$x \\oplus y = 7 \\oplus 9 = 14$$$ and $$$14$$$ is divisible by $$$x = 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": "2039C2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Shohag Loves GCD\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Shohag has an integer $$$n$$$ and a set $$$S$$$ of $$$m$$$ unique integers. Help him find the lexicographically largest$$$^{\\text{∗}}$$$ integer array $$$a_1, a_2, \\ldots, a_n$$$ such that $$$a_i \\in S$$$ for each $$$1 \\le i \\le n$$$ and $$$a_{\\operatorname{gcd}(i, j)} \\neq \\operatorname{gcd}(a_i, a_j)$$$$$$^{\\text{†}}$$$ is satisfied over all pairs $$$1 \\le i \\lt j \\le n$$$, or state that no such array exists.\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 \\le m \\le n \\le 10^5$$$).\n\nThe second line contains $$$m$$$ unique integers in increasing order, representing the elements of the set $$$S$$$ ($$$1 \\le x \\le n$$$ for each $$$x \\in S$$$).\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, if there is no solution print $$$-1$$$, otherwise print $$$n$$$ integers — the lexicographically largest integer array that satisfies the conditions.\n\nExamples:\ninput:\n3\n6 3\n3 4 6\n1 1\n1\n2 1\n2\noutput:\n6 4 4 3 4 3 \n1 \n-1\n\nNote: In the first test case, every element in the array belongs to the given set $$$S = \\{3, 4, 6\\}$$$, and all pairs of indices of the array satisfy the necessary conditions. In particular, for pair $$$(2, 3)$$$, $$$a_{\\operatorname{gcd}(2, 3)} = a_1 = 6$$$ and $$$\\operatorname{gcd}(a_2, a_3) = \\operatorname{gcd}(4, 4) = 4$$$, so they are not equal. There are other arrays that satisfy the conditions as well but this one is the lexicographically largest among them.\n\nIn the third test case, there is no solution possible because we are only allowed to use $$$a = [2, 2]$$$ but for this array, for pair $$$(1, 2)$$$, $$$a_{\\operatorname{gcd}(1, 2)} = a_1 = 2$$$ and $$$\\operatorname{gcd}(a_1, a_2) = \\operatorname{gcd}(2, 2) = 2$$$, so they are equal which is not allowed!\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": "2039D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Shohag Loves Inversions\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Shohag has an array $$$a$$$ of integers. Initially $$$a = [0, 1]$$$. He can repeatedly perform the following operation any number of times:\n\n- Let $$$k$$$ be the number of inversions$$$^{\\text{∗}}$$$ in the current array $$$a$$$.\n- Insert $$$k$$$ at any position in $$$a$$$, including the beginning or the end.\n\nFor example, if $$$a = [4, 6, 2, 4]$$$, then the number of inversions is $$$k = 3$$$. So Shohag can obtain the following arrays after the operation: $$$[\\textbf{3}, 4, 6, 2, 4]$$$, $$$[4, \\textbf{3}, 6, 2, 4]$$$, $$$[4, 6, \\textbf{3}, 2, 4]$$$, $$$[4, 6, 2, \\textbf{3}, 4]$$$, and $$$[4, 6, 2, 4, \\textbf{3}]$$$.\n\nGiven an integer $$$n$$$, help Shohag count, modulo $$$998\\,244\\,353$$$, the number of distinct arrays of length $$$n$$$ that can be obtained after performing the operations.\n\nInput: The first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nThe first and only line of each test case contains an integer $$$n$$$ ($$$2 \\le n \\le 10^6$$$).\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$.\n\nOutput: For each test case, output an integer — the number of possible arrays modulo $$$998\\,244\\,353$$$.\n\nExamples:\ninput:\n4\n4\n2\n7\n69\noutput:\n5\n1\n682\n325188814\n\nNote: In the first test case, the following $$$5$$$ arrays can be obtained (the inserted inversion count is shown in bold):\n\n- $$$[0, 1] \\rightarrow [0, \\textbf{0}, 1] \\rightarrow [0, 0, 1, \\textbf{0}]$$$,\n- $$$[0, 1] \\rightarrow [0, \\textbf{0}, 1] \\rightarrow [0, 0, \\textbf{0}, 1]$$$,\n- $$$[0, 1] \\rightarrow [0, 1, \\textbf{0}] \\rightarrow [0, 1, 0, \\textbf{1}]$$$,\n- $$$[0, 1] \\rightarrow [0, 1, \\textbf{0}] \\rightarrow [0, 1, \\textbf{1}, 0]$$$,\n- $$$[0, 1] \\rightarrow [0, 1, \\textbf{0}] \\rightarrow [\\textbf{1}, 0, 1, 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": "2039E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Coin Transformation\ntime_limit_ms: 2000\nmemory_limit_mb: 512\nDescription: Initially, you have a coin with value $$$n$$$. You can perform the following operation any number of times (possibly zero):\n\n- transform one coin with value $$$x$$$, where $$$x$$$ is greater than $$$3$$$ ($$$x>3$$$), into two coins with value $$$\\lfloor \\frac{x}{4} \\rfloor$$$.\n\nWhat is the maximum number of coins you can have after performing this operation any number of times?\n\nInput: The first line contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nEach test case consists of one line containing one integer $$$n$$$ ($$$1 \\le n \\le 10^{18}$$$).\n\nOutput: For each test case, print one integer — the maximum number of coins you can have after performing the operation any number of times.\n\nExamples:\ninput:\n4\n1\n5\n16\n1000000000000000000\noutput:\n1\n2\n4\n536870912\n\nNote: In the first example, you have a coin of value $$$1$$$, and you can't do anything with it. So, the answer is $$$1$$$.\n\nIn the second example, you can transform a coin of value $$$5$$$ into two coins with value $$$1$$$.\n\nIn the third example, you can transform a coin of value $$$16$$$ into two coins with value $$$4$$$. Each of the resulting coins can be transformed into two coins with value $$$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": "2043A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Digits\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Artem wrote the digit $$$d$$$ on the board exactly $$$n!$$$ times in a row. So, he got the number $$$dddddd \\dots ddd$$$ (exactly $$$n!$$$ digits).\n\nNow he is curious about which odd digits from $$$1$$$ to $$$9$$$ divide the number written on the board.\n\nInput: The first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 100$$$) — the number of test cases. The next $$$t$$$ test cases follow.\n\nEach test case consists of a single line containing two integers $$$n$$$ and $$$d$$$ ($$$2 \\le n \\le 10^9$$$, $$$1 \\le d \\le 9$$$).\n\nOutput: For each test case, output the odd digits in ascending order that divide the number written on the board.\n\nExamples:\ninput:\n3\n2 6\n7 1\n8 5\noutput:\n1 3 \n1 3 7 9 \n1 3 5 7 9\n\nNote: The factorial of a positive integer $$$n$$$ ($$$n!$$$) is the product of all integers from $$$1$$$ to $$$n$$$. For example, the factorial of $$$5$$$ is $$$1 \\cdot 2 \\cdot 3 \\cdot 4 \\cdot 5 = 120$$$.\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": "2043B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sums on Segments\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are given an array $$$a$$$ of $$$n$$$ integers, where all elements except for at most one are equal to $$$-1$$$ or $$$1$$$. The remaining element $$$x$$$ satisfies $$$-10^9 \\le x \\le 10^9$$$.\n\nFind all possible sums of subarrays of $$$a$$$, including the empty subarray, whose sum is defined as $$$0$$$. In other words, find all integers $$$x$$$ such that the array $$$a$$$ has at least one subarray (possibly empty) with sum equal to $$$x$$$. A subarray is a contiguous subsegment of an array.\n\nOutput these sums in ascending order. Each sum should be printed only once, even if it is achieved by multiple subarrays.\n\nInput: The first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases. Then, $$$t$$$ test cases follow.\n\nEach test case consists of two lines:\n\n- The first line contains a single integer $$$n$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$) — the size of the array.\n- The second line contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$-10^9 \\le a_i \\le 10^9$$$) — the elements of the array $$$a$$$. In the array $$$a$$$, there is at most one element that is neither $$$1$$$ nor $$$-1$$$.\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, output two lines:\n\n- In the first line, print a single integer — the number of distinct subarray sums.\n- In the second line, print these sums in ascending order.\n\nEach sum should be printed only once, even if it is produced by multiple subarrays.\n\nExamples:\ninput:\n5\n5\n1 -1 10 1 1\n5\n-1 -1 -1 -1 -1\n2\n-1 2\n2\n7 1\n3\n1 4 -1\noutput:\n8\n-1 0 1 2 9 10 11 12 \n6\n-5 -4 -3 -2 -1 0 \n4\n-1 0 1 2 \n4\n0 1 7 8 \n6\n-1 0 1 3 4 5\n\nNote: Let's define $$$a[i,j]$$$ as the subarray of $$$a$$$ from position $$$i$$$ to position $$$j$$$.\n\nConsider the first test case of the example:\n\n- $$$-1$$$ is produced by $$$a[2,2]$$$;\n- $$$0$$$ is produced by the empty subarray;\n- $$$1$$$ is produced by $$$a[4,4]$$$;\n- $$$2$$$ is produced by $$$a[4,5]$$$;\n- $$$9$$$ is produced by $$$a[2,3]$$$;\n- $$$10$$$ is produced by $$$a[1,3]$$$;\n- $$$11$$$ is produced by $$$a[3,4]$$$;\n- $$$12$$$ is produced by $$$a[3,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": "2043C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Problem about GCD\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Given three integers $$$l$$$, $$$r$$$, and $$$G$$$, find two integers $$$A$$$ and $$$B$$$ ($$$l \\le A \\le B \\le r$$$) such that their greatest common divisor (GCD) equals $$$G$$$ and the distance $$$|A - B|$$$ is maximized.\n\nIf there are multiple such pairs, choose the one where $$$A$$$ is minimized. If no such pairs exist, output \"-1 -1\".\n\nInput: The first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^3$$$) — the number of test cases. Then, $$$t$$$ test cases follow.\n\nEach test case consists of a single line containing three integers $$$l, r, G$$$ ($$$1 \\le l \\le r \\le 10^{18}$$$; $$$1 \\le G \\le 10^{18}$$$) — the range boundaries and the required GCD.\n\nOutput: For each test case, output two integers $$$A$$$ and $$$B$$$ — the solution to the problem, or \"-1 -1\" if no such pair exists.\n\nExamples:\ninput:\n4\n4 8 2\n4 8 3\n4 8 4\n5 7 6\noutput:\n4 6\n-1 -1\n4 8\n6 6\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": "2043D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Matrix Transformation\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You are given two matrices $$$A$$$ and $$$B$$$ of size $$$n \\times m$$$, filled with integers between $$$0$$$ and $$$10^9$$$. You can perform the following operations on matrix $$$A$$$ in any order and any number of times:\n\n- &=: choose two integers $$$i$$$ and $$$x$$$ ($$$1 \\le i \\le n$$$, $$$x \\ge 0$$$) and replace each element in row $$$i$$$ with the result of the bitwise AND operation between $$$x$$$ and that element. Formally, for every $$$j \\in [1, m]$$$, the element $$$A_{i,j}$$$ is replaced with $$$A_{i,j} \\text{ & } x$$$;\n- |=: choose two integers $$$j$$$ and $$$x$$$ ($$$1 \\le j \\le m$$$, $$$x \\ge 0$$$) and replace each element in column $$$j$$$ with the result of the bitwise OR operation between $$$x$$$ and that element. Formally, for every $$$i \\in [1, n]$$$, the element $$$A_{i,j}$$$ is replaced with $$$A_{i,j} \\text{ | } x$$$.\n\nThe value of $$$x$$$ may be chosen differently for different operations.\n\nDetermine whether it is possible to transform matrix $$$A$$$ into matrix $$$B$$$ using the given operations any number of times (including zero).\n\nInput: The first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 100$$$) — the number of test cases. Then, $$$t$$$ test cases follow.\n\nEach test case is given as follows:\n\n- the first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \\le n, m \\le 10^3$$$; $$$n \\cdot m \\le 10^3$$$) — the dimensions of the matrices $$$A$$$ and $$$B$$$;\n- the following $$$n$$$ lines describe the matrix $$$A$$$, where the $$$i$$$-th line contains $$$m$$$ integers $$$A_{i,1}, A_{i,2}, \\dots, A_{i,m}$$$ ($$$0 \\le A_{i,j} \\le 10^9$$$);\n- the following $$$n$$$ lines describe the matrix $$$B$$$, where the $$$i$$$-th line contains $$$m$$$ integers $$$B_{i,1}, B_{i,2}, \\dots, B_{i,m}$$$ ($$$0 \\le B_{i,j} \\le 10^9$$$).\n\nOutput: For each test case, output Yes if it is possible to transform the matrix $$$A$$$ into the matrix $$$B$$$; otherwise, output No. Each letter can be output in any case, upper or lower.\n\nExamples:\ninput:\n4\n1 1\n12\n13\n2 2\n10 10\n42 42\n21 21\n21 21\n2 2\n74 10\n42 106\n21 85\n85 21\n2 4\n1 2 3 4\n5 6 7 8\n3 2 3 4\n1 0 1 0\noutput:\nYes\nYes\nNo\nYes\n\nNote: Let's consider the second set of input data and show a sequence of operations that transforms matrix $$$A$$$ into matrix $$$B$$$:\n\nInitially, the matrix looks like this:\n\n$$$\\begin{bmatrix} 10&10\\\\ 42&42\\\\ \\end{bmatrix}$$$\n\nApply an operation of the first type with parameters $$$i = 1$$$ and $$$x = 0$$$. As a result, we get the matrix:\n\n$$$\\begin{bmatrix} 0&0\\\\ 42&42\\\\ \\end{bmatrix}$$$\n\nApply an operation of the first type with parameters $$$i = 2$$$ and $$$x = 0$$$. As a result, we get the matrix:\n\n$$$\\begin{bmatrix} 0&0\\\\ 0&0\\\\ \\end{bmatrix}$$$\n\nApply an operation of the second type with parameters $$$j = 1$$$ and $$$x = 21$$$. As a result, we get the matrix:\n\n$$$\\begin{bmatrix} 21&0\\\\ 21&0\\\\ \\end{bmatrix}$$$\n\nApply an operation of the second type with parameters $$$j = 2$$$ and $$$x = 21$$$. As a result, we get the matrix:\n\n$$$\\begin{bmatrix} 21&21\\\\ 21&21\\\\ \\end{bmatrix}$$$\n\nThus, we have transformed matrix $$$A$$$ into matrix $$$B$$$.\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": "2043E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Adjust The Presentation (Easy Version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the easy version of the problem. In the two versions, the constraints on $$$q$$$ and the time limit are different. In this version, $$$q=0$$$. You can make hacks only if all the versions of the problem are solved.\n\nA team consisting of $$$n$$$ members, numbered from $$$1$$$ to $$$n$$$, is set to present a slide show at a large meeting. The slide show contains $$$m$$$ slides.\n\nThere is an array $$$a$$$ of length $$$n$$$. Initially, the members are standing in a line in the order of $$$a_1, a_2, \\ldots, a_n$$$ from front to back. The slide show will be presented in order from slide $$$1$$$ to slide $$$m$$$. Each section will be presented by the member at the front of the line. After each slide is presented, you can move the member at the front of the line to any position in the lineup (without changing the order of the rest of the members). For example, suppose the line of members is $$$[\\color{red}{3},1,2,4]$$$. After member $$$3$$$ presents the current slide, you can change the line of members into either $$$[\\color{red}{3},1,2,4]$$$, $$$[1,\\color{red}{3},2,4]$$$, $$$[1,2,\\color{red}{3},4]$$$ or $$$[1,2,4,\\color{red}{3}]$$$.\n\nThere is also an array $$$b$$$ of length $$$m$$$. The slide show is considered good if it is possible to make member $$$b_i$$$ present slide $$$i$$$ for all $$$i$$$ from $$$1$$$ to $$$m$$$ under these constraints.\n\nHowever, your annoying boss wants to make $$$q$$$ updates to the array $$$b$$$. In the $$$i$$$-th update, he will choose a slide $$$s_i$$$ and a member $$$t_i$$$ and set $$$b_{s_i} := t_i$$$. Note that these updates are persistent, that is changes made to the array $$$b$$$ will apply when processing future updates.\n\nFor each of the $$$q+1$$$ states of array $$$b$$$, the initial state and after each of the $$$q$$$ updates, determine if the slideshow is good.\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 three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \\le n, m \\le 2 \\cdot 10^5$$$; $$$q=0$$$) — the number of members, the number of sections and the number of updates.\n\nThe second line of each test case contains $$$n$$$ integers $$$a_1,a_2,\\ldots,a_n$$$ ($$$1 \\le a_i \\le n$$$) — the initial order of the members from front to back. It is guaranteed that each integer from $$$1$$$ to $$$n$$$ appears exactly once in $$$a$$$.\n\nThe third line of each test case contains $$$m$$$ integers $$$b_1, b_2, \\ldots, b_m$$$ ($$$1 \\le b_i \\le n$$$) — the members who should present each section.\n\nIt is guaranteed that the sum of $$$n$$$ and the sum of $$$m$$$ over all test cases do not exceed $$$2 \\cdot 10^5$$$ respectively.\n\nOutput: For each test case, output $$$q+1$$$ lines corresponding to the $$$q+1$$$ states of the array $$$b$$$. Output \"YA\" if the slide show is good, and \"TIDAK\" otherwise.\n\nYou can output the answer in any case (upper or lower). For example, the strings \"yA\", \"Ya\", \"ya\", and \"YA\" will be recognized as positive responses.\n\nExamples:\ninput:\n3\n4 2 0\n1 2 3 4\n1 1\n3 6 0\n1 2 3\n1 1 2 3 3 2\n4 6 0\n3 1 4 2\n3 1 1 2 3 4\noutput:\nYA\nYA\nTIDAK\n\nNote: For the first test case, you do not need to move the members as both slides are presented by member $$$1$$$, who is already at the front of the line.\n\nFor the second test case, the following is a possible way to move members so that the presentation is good:\n\n1. $$$[1,2,3]$$$, do not move member $$$1$$$.\n2. $$$[1,2,3]$$$, move member $$$1$$$ after member $$$3$$$.\n3. $$$[2,3,1]$$$, move member $$$2$$$ after member $$$3$$$.\n4. $$$[3,2,1]$$$, do not move member $$$3$$$.\n5. $$$[3,2,1]$$$, move member $$$3$$$ after member $$$1$$$.\n6. $$$[2,1,3]$$$, do not move member $$$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": "2021C1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Adjust The Presentation (Hard Version)\ntime_limit_ms: 5000\nmemory_limit_mb: 256\nDescription: This is the hard version of the problem. In the two versions, the constraints on $$$q$$$ and the time limit are different. In this version, $$$0 \\leq q \\leq 2 \\cdot 10^5$$$. You can make hacks only if all the versions of the problem are solved.\n\nA team consisting of $$$n$$$ members, numbered from $$$1$$$ to $$$n$$$, is set to present a slide show at a large meeting. The slide show contains $$$m$$$ slides.\n\nThere is an array $$$a$$$ of length $$$n$$$. Initially, the members are standing in a line in the order of $$$a_1, a_2, \\ldots, a_n$$$ from front to back. The slide show will be presented in order from slide $$$1$$$ to slide $$$m$$$. Each section will be presented by the member at the front of the line. After each slide is presented, you can move the member at the front of the line to any position in the lineup (without changing the order of the rest of the members). For example, suppose the line of members is $$$[\\color{red}{3},1,2,4]$$$. After member $$$3$$$ presents the current slide, you can change the line of members into either $$$[\\color{red}{3},1,2,4]$$$, $$$[1,\\color{red}{3},2,4]$$$, $$$[1,2,\\color{red}{3},4]$$$ or $$$[1,2,4,\\color{red}{3}]$$$.\n\nThere is also an array $$$b$$$ of length $$$m$$$. The slide show is considered good if it is possible to make member $$$b_i$$$ present slide $$$i$$$ for all $$$i$$$ from $$$1$$$ to $$$m$$$ under these constraints.\n\nHowever, your annoying boss wants to make $$$q$$$ updates to the array $$$b$$$. In the $$$i$$$-th update, he will choose a slide $$$s_i$$$ and a member $$$t_i$$$ and set $$$b_{s_i} := t_i$$$. Note that these updates are persistent, that is changes made to the array $$$b$$$ will apply when processing future updates.\n\nFor each of the $$$q+1$$$ states of array $$$b$$$, the initial state and after each of the $$$q$$$ updates, determine if the slideshow is good.\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 three integers $$$n$$$, $$$m$$$ and $$$q$$$ ($$$1 \\le n, m \\le 2 \\cdot 10^5$$$; $$$0 \\leq q \\leq 2 \\cdot 10^5$$$) — the number of members and the number of sections.\n\nThe second line of each test case contains $$$n$$$ integers $$$a_1,a_2,\\ldots,a_n$$$ ($$$1 \\le a_i \\le n$$$) — the initial order of the members from front to back. It is guaranteed that each integer from $$$1$$$ to $$$n$$$ appears exactly once in $$$a$$$.\n\nThe third line of each test case contains $$$m$$$ integers $$$b_1, b_2, \\ldots, b_m$$$ ($$$1 \\le b_i \\le n$$$) — the members who should present each section.\n\nEach of the next $$$q$$$ lines contains two integers $$$s_i$$$ and $$$t_i$$$ ($$$1 \\le s_i \\le m$$$, $$$1 \\le t_i \\le n$$$) — parameters of an update.\n\nIt is guaranteed that the sum of $$$n$$$, the sum of $$$m$$$ and the sum of $$$q$$$ over all test cases do not exceed $$$2 \\cdot 10^5$$$ respectively.\n\nOutput: For each test case, output $$$q+1$$$ lines corresponding to the $$$q+1$$$ states of the array $$$b$$$. Output \"YA\" if the slide show is good, and \"TIDAK\" otherwise.\n\nYou can output the answer in any case (upper or lower). For example, the strings \"yA\", \"Ya\", \"ya\", and \"YA\" will be recognized as positive responses.\n\nExamples:\ninput:\n3\n4 2 2\n1 2 3 4\n1 1\n1 2\n1 1\n3 6 2\n1 2 3\n1 1 2 3 3 2\n3 3\n2 2\n4 6 2\n3 1 4 2\n3 1 1 2 3 4\n3 4\n4 2\noutput:\nYA\nTIDAK\nYA\nYA\nTIDAK\nYA\nTIDAK\nYA\nYA\n\nNote: For the first test case, you do not need to move the members as both slides are presented by member $$$1$$$, who is already at the front of the line. After that, set $$$b_1 := 2$$$, now slide $$$1$$$ must be presented by member $$$2$$$ which is impossible as member $$$1$$$ will present slide $$$1$$$ first. Then, set $$$b_1 = 1$$$, the $$$b$$$ is the same as the initial $$$b$$$, making a good presentation possible.\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": "2021C2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Alternating Sum of Numbers\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given a sequence of integers. Output the alternating sum of this sequence. In other words, output $$$a_1 - a_2 + a_3 - a_4 + a_5 - \\dots$$$. That is, the signs of plus and minus alternate, starting with a plus.\n\nInput: The first line of the test contains one integer $$$t$$$ ($$$1 \\le t \\le 1000$$$) — the number of test cases. Then follow $$$t$$$ test cases.\n\nThe first line of each test case contains one integer $$$n$$$ ($$$1 \\le n \\le 50$$$) — the length of the sequence. The second line of the test case contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 100$$$).\n\nOutput: Output $$$t$$$ lines. For each test case, output the required alternating sum of the numbers.\n\nExamples:\ninput:\n4\n4\n1 2 3 17\n1\n100\n2\n100 100\n5\n3 1 4 1 5\noutput:\n-15\n100\n0\n10\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2010A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Three Brothers\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Three brothers agreed to meet. Let's number the brothers as follows: the oldest brother is number 1, the middle brother is number 2, and the youngest brother is number 3.\n\nWhen it was time for the meeting, one of the brothers was late. Given the numbers of the two brothers who arrived on time, you need to determine the number of the brother who was late.\n\nInput: The first line of input contains two different integers a and b (1 ≤ a, b ≤ 3, a ≠ b) — the numbers of the brothers who arrived on time. The numbers are given in arbitrary order.\n\nOutput: Output a single integer — the number of the brother who was late to the meeting.\n\nExamples:\ninput:\n3 1\noutput:\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": "2010B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Alyona and a Square Jigsaw Puzzle\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Alyona assembles an unusual square Jigsaw Puzzle. She does so in $$$n$$$ days in the following manner:\n\n- On the first day, she starts by placing the central piece in the center of the table.\n- On each day after the first one, she places a certain number of pieces around the central piece in clockwise order, always finishing each square layer completely before starting a new one.\n\nFor example, she places the first $$$14$$$ pieces in the following order:\n\nThe colors denote the layers. The third layer is still unfinished.\n\nAlyona is happy if at the end of the day the assembled part of the puzzle does not have any started but unfinished layers. Given the number of pieces she assembles on each day, find the number of days Alyona is happy on.\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 contains a single integer $$$n$$$ ($$$1 \\le n \\le 100$$$), the number of days.\n\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$1 \\le a_i \\le 100$$$, $$$a_1 = 1$$$), where $$$a_i$$$ is the number of pieces Alyona assembles on the $$$i$$$-th day.\n\nIt is guaranteed in each test case that at the end of the $$$n$$$ days, there are no unfinished layers.\n\nOutput: For each test case, print a single integer: the number of days when Alyona is happy.\n\nExamples:\ninput:\n5\n1\n1\n2\n1 8\n5\n1 3 2 1 2\n7\n1 2 1 10 2 7 2\n14\n1 10 10 100 1 1 10 1 10 2 10 2 10 1\noutput:\n1\n2\n2\n2\n3\n\nNote: In the first test case, in the only day Alyona finishes the only layer.\n\nIn the second test case, on the first day, Alyona finishes the first layer, and on the second day, she finishes the second layer.\n\nIn the third test case, she finishes the second layer in a few days.\n\nIn the fourth test case, she finishes the second layer and immediately starts the next one on the same day, therefore, she is not happy on that day. She is only happy on the first and last days.\n\nIn the fifth test case, Alyona is happy on the first, fourth, and last days.\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": "2047A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Tender Carpenter\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: In his dream, Cocoly would go on a long holiday with no worries around him. So he would try out for many new things, such as... being a carpenter. To learn it well, Cocoly decides to become an apprentice of Master, but in front of him lies a hard task waiting for him to solve.\n\nCocoly is given an array $$$a_1, a_2,\\ldots, a_n$$$. Master calls a set of integers $$$S$$$ stable if and only if, for any possible $$$u$$$, $$$v$$$, and $$$w$$$ from the set $$$S$$$ (note that $$$u$$$, $$$v$$$, and $$$w$$$ do not necessarily have to be pairwise distinct), sticks of length $$$u$$$, $$$v$$$, and $$$w$$$ can form a non-degenerate triangle$$$^{\\text{∗}}$$$.\n\nCocoly is asked to partition the array $$$a$$$ into several (possibly, $$$1$$$ or $$$n$$$) non-empty continuous subsegments$$$^{\\text{†}}$$$, such that: for each of the subsegments, the set containing all the elements in it is stable.\n\nMaster wants Cocoly to partition $$$a$$$ in at least two different$$$^{\\text{‡}}$$$ ways. You have to help him determine whether it is possible.\n\nInput: Each test contains multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \\leq t \\leq 200$$$) — 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 \\leq n \\leq 200$$$) — the length of the array $$$a$$$.\n\nThe second line contains $$$n$$$ integers $$$a_1,a_2,\\ldots,a_n$$$ ($$$1 \\leq a_i \\leq 10^5$$$) — the elements in the array $$$a$$$.\n\nOutput: For each test case, print $$$\\texttt{YES}$$$ if there are at least two ways to partition $$$a$$$, and $$$\\texttt{NO}$$$ otherwise.\n\nYou can output the answer in any case (upper or lower). For example, the strings $$$\\texttt{yEs}$$$, $$$\\texttt{yes}$$$, $$$\\texttt{Yes}$$$, and $$$\\texttt{YES}$$$ will be recognized as positive responses.\n\nExamples:\ninput:\n5\n4\n2 3 5 7\n4\n115 9 2 28\n5\n8 4 1 6 2\n6\n1 5 4 1 4 7\n2\n100000 100000\noutput:\nYES\nNO\nNO\nYES\nYES\n\nNote: In the first test case, here are two possible partitions:\n\n- $$$[2, 3], [5, 7]$$$, since $$$[2, 3]$$$ is stable because sticks of lengths $$$(2, 2, 2), (2, 2, 3), (2, 3, 3), (3, 3, 3)$$$ respectively can all form non-degenerate triangles. $$$[5, 7]$$$ is stable because sticks of lengths $$$(5, 5, 5), (5, 5, 7), (5, 7, 7), (7, 7, 7)$$$ respectively can all form non-degenerate triangles.\n- and $$$[2], [3, 5], [7]$$$, since $$$[2]$$$ is stable because sticks of lengths $$$(2, 2, 2)$$$ respectively can form a non-degenerate triangle. $$$[3, 5]$$$ is stable because sticks of lengths $$$(3, 3, 3), (3, 3, 5), (3, 5, 5), (5, 5, 5)$$$ respectively can all form non-degenerate triangles. $$$[7]$$$ is stable because sticks of lengths $$$(7, 7, 7)$$$ respectively can form a non-degenerate triangle.\n\nNote that some other partitions also satisfy the constraints, such as $$$[2], [3], [5], [7]$$$ and $$$[2], [3], [5, 7]$$$.\n\nIn the second test case, Cocoly can only partition each element as a single subsegment, resulting in $$$[115], [9], [2], [28]$$$. Since we only have one possible partition, the answer is $$$\\texttt{NO}$$$.\n\nIn the third test case, please note that the partition $$$[8, 4], [1], [6], [2]$$$ does not satisfy the constraints, because $$$\\{8, 4\\}$$$ is not a stable set: sticks of lengths $$$4$$$, $$$4$$$, and $$$8$$$ cannot form a non-degenerate triangle.\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": "2053A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Outstanding Impressionist\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Even after copying the paintings from famous artists for ten years, unfortunately, Eric is still unable to become a skillful impressionist painter. He wants to forget something, but the white bear phenomenon just keeps hanging over him.\n\nEric still remembers $$$n$$$ pieces of impressions in the form of an integer array. He records them as $$$w_1, w_2, \\ldots, w_n$$$. However, he has a poor memory of the impressions. For each $$$1 \\leq i \\leq n$$$, he can only remember that $$$l_i \\leq w_i \\leq r_i$$$.\n\nEric believes that impression $$$i$$$ is unique if and only if there exists a possible array $$$w_1, w_2, \\ldots, w_n$$$ such that $$$w_i \\neq w_j$$$ holds for all $$$1 \\leq j \\leq n$$$ with $$$j \\neq i$$$.\n\nPlease help Eric determine whether impression $$$i$$$ is unique for every $$$1 \\leq i \\leq n$$$, independently for each $$$i$$$. Perhaps your judgment can help rewrite the final story.\n\nInput: Each test contains multiple test cases. The first line of the input contains a single integer $$$t$$$ ($$$1 \\leq t \\leq 10^4$$$) — the number of test cases. The description of test cases follows.\n\nThe first line of each test case contains a single integer $$$n$$$ ($$$1 \\leq n \\leq 2\\cdot 10^5$$$) — the number of impressions.\n\nThen $$$n$$$ lines follow, the $$$i$$$-th containing two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \\leq l_i \\leq r_i \\leq 2\\cdot n$$$) — the minimum possible value and the maximum possible value of $$$w_i$$$.\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 binary string $$$s$$$ of length $$$n$$$: for each $$$1 \\leq i \\leq n$$$, if impression $$$i$$$ is unique, $$$s_i=\\texttt{1}$$$; otherwise, $$$s_i=\\texttt{0}$$$. Do not output spaces.\n\nExamples:\ninput:\n5\n2\n1 1\n1 1\n4\n1 3\n1 3\n1 3\n1 3\n6\n3 6\n2 2\n1 2\n1 1\n3 4\n2 2\n7\n3 4\n4 4\n4 4\n1 3\n2 5\n1 4\n2 2\n3\n4 5\n4 4\n5 5\noutput:\n00\n1111\n100110\n1001111\n011\n\nNote: In the first test case, the only possible array $$$w$$$ is $$$[1, 1]$$$, making neither impression $$$1$$$ nor $$$2$$$ unique (since $$$w_1 = w_2$$$).\n\nIn the second test case, all impressions can be made unique:\n\n- For $$$i = 1$$$, we can set $$$w$$$ to $$$[1, 3, 2, 3]$$$, in which $$$w_1 \\neq w_2$$$, $$$w_1 \\neq w_3$$$, and $$$w_1 \\neq w_4$$$;\n- For $$$i = 2$$$, we can set $$$w$$$ to $$$[2, 3, 1, 2]$$$, in which $$$w_2 \\neq w_1$$$, $$$w_2 \\neq w_3$$$, and $$$w_2 \\neq w_4$$$;\n- For $$$i = 3$$$, we can set $$$w$$$ to $$$[1, 1, 3, 1]$$$;\n- For $$$i = 4$$$, we can set $$$w$$$ to $$$[2, 3, 3, 1]$$$.\n\nIn the third test case, for $$$i = 4$$$, we can set $$$w$$$ to $$$[3, 2, 2, 1, 3, 2]$$$. Thus, impression $$$4$$$ is unique.\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": "2053B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Bewitching Stargazer\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Iris looked at the stars and a beautiful problem emerged in her mind. She is inviting you to solve it so that a meteor shower is believed to form.\n\nThere are $$$n$$$ stars in the sky, arranged in a row. Iris has a telescope, which she uses to look at the stars.\n\nInitially, Iris observes stars in the segment $$$[1, n]$$$, and she has a lucky value of $$$0$$$. Iris wants to look for the star in the middle position for each segment $$$[l, r]$$$ that she observes. So the following recursive procedure is used:\n\n- First, she will calculate $$$m = \\left\\lfloor \\frac{l+r}{2} \\right\\rfloor$$$.\n- If the length of the segment (i.e. $$$r - l + 1$$$) is even, Iris will divide it into two equally long segments $$$[l, m]$$$ and $$$[m+1, r]$$$ for further observation.\n- Otherwise, Iris will aim the telescope at star $$$m$$$, and her lucky value will increase by $$$m$$$; subsequently, if $$$l \\neq r$$$, Iris will continue to observe two segments $$$[l, m-1]$$$ and $$$[m+1, r]$$$.\n\nIris is a bit lazy. She defines her laziness by an integer $$$k$$$: as the observation progresses, she will not continue to observe any segment $$$[l, r]$$$ with a length strictly less than $$$k$$$. In this case, please predict her final lucky value.\n\nInput: Each test contains multiple test cases. The first line of input contains a single integer $$$t$$$ ($$$1 \\leq t \\leq 10^5$$$) — the number of test cases. The description of test cases follows.\n\nThe only line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\leq k \\leq n \\leq 2\\cdot 10^9$$$).\n\nOutput: For each test case, output a single integer — the final lucky value.\n\nExamples:\ninput:\n6\n7 2\n11 3\n55 13\n5801 6\n8919 64\n8765432 1\noutput:\n12\n18\n196\n1975581\n958900\n38416403456028\n\nNote: In the first test case, at the beginning, Iris observes $$$[1, 7]$$$. Since $$$[1, 7]$$$ has an odd length, she aims at star $$$4$$$ and therefore increases her lucky value by $$$4$$$. Then it is split into $$$2$$$ new segments: $$$[1, 3]$$$ and $$$[5, 7]$$$. The segment $$$[1, 3]$$$ again has an odd length, so Iris aims at star $$$2$$$ and increases her lucky value by $$$2$$$. Then it is split into $$$2$$$ new segments: $$$[1, 1]$$$ and $$$[3, 3]$$$, both having a length less than $$$2$$$, so no further observation is conducted. For range $$$[5, 7]$$$, the progress is similar and the lucky value eventually increases by $$$6$$$. Therefore, the final lucky value is $$$4 + 2 + 6 = 12$$$.\n\nIn the last test case, Iris finally observes all the stars and the final lucky value is $$$1 + 2 + \\cdots + 8\\,765\\,432 = 38\\,416\\,403\\,456\\,028$$$.\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": "2053C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Refined Product Optimality\ntime_limit_ms: 3000\nmemory_limit_mb: 512\nDescription: Although Iris occasionally sets a problem where the solution is possibly wrong, she still insists on creating problems with her imagination; after all, everyone has always been on the road with their stubbornness... And like ever before, Iris has set a problem to which she gave a wrong solution, but Chris is always supposed to save it! You are going to play the role of Chris now:\n\n- Chris is given two arrays $$$a$$$ and $$$b$$$, both consisting of $$$n$$$ integers.\n- Iris is interested in the largest possible value of $$$P = \\prod\\limits_{i=1}^n \\min(a_i, b_i)$$$ after an arbitrary rearrangement of $$$b$$$. Note that she only wants to know the maximum value of $$$P$$$, and no actual rearrangement is performed on $$$b$$$.\n- There will be $$$q$$$ modifications. Each modification can be denoted by two integers $$$o$$$ and $$$x$$$ ($$$o$$$ is either $$$1$$$ or $$$2$$$, $$$1 \\leq x \\leq n$$$). If $$$o = 1$$$, then Iris will increase $$$a_x$$$ by $$$1$$$; otherwise, she will increase $$$b_x$$$ by $$$1$$$.\n- Iris asks Chris the maximum value of $$$P$$$ for $$$q + 1$$$ times: once before any modification, then after every modification.\n- Since $$$P$$$ might be huge, Chris only needs to calculate it modulo $$$998\\,244\\,353$$$.\n\nChris soon worked out this problem, but he was so tired that he fell asleep. Besides saying thanks to Chris, now it is your turn to write a program to calculate the answers for given input data.\n\nNote: since the input and output are large, you may need to optimize them for this problem.\n\nFor example, in C++, it is enough to use the following lines at the start of the main() function:\n\nInput: Each test contains multiple test cases. The first line of input contains a single integer $$$t$$$ ($$$1 \\leq t \\leq 10^4$$$) — the number of test cases. The description of test cases follows.\n\nThe first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \\leq n \\leq 2\\cdot 10^5$$$, $$$1 \\leq q \\leq 2\\cdot 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 5\\cdot 10^8$$$) — the array $$$a$$$.\n\nThe third line of each test case contains $$$n$$$ integers $$$b_1, b_2, \\ldots, b_n$$$ ($$$1 \\leq b_i \\leq 5\\cdot 10^8$$$) — the array $$$b$$$.\n\nThen $$$q$$$ lines follow, each line contains two integers $$$o$$$ and $$$x$$$ ($$$o \\in \\{1, 2\\}$$$, $$$1 \\leq x \\leq n$$$), representing an operation.\n\nIt's guaranteed that the sum of $$$n$$$ and the sum of $$$q$$$ over all test cases does not exceed $$$4\\cdot 10^5$$$, respectively.\n\nOutput: For each test case, output $$$q + 1$$$ integers in a line, representing the answers that Chris will calculate, modulo $$$998\\,244\\,353$$$.\n\nExamples:\ninput:\n4\n3 4\n1 1 2\n3 2 1\n1 3\n2 3\n1 1\n2 1\n6 8\n1 4 2 7 3 5\n7 6 5 6 3 3\n2 5\n1 6\n1 5\n1 5\n1 5\n2 3\n2 3\n1 6\n13 8\n7 7 6 6 5 5 5 2 2 3 4 5 1\n1 4 1 9 6 6 9 1 5 1 3 8 4\n2 2\n2 11\n2 4\n2 4\n1 7\n1 1\n2 12\n1 5\n5 3\n10000000 20000000 30000000 40000000 50000000\n10000000 20000000 30000000 40000000 50000000\n1 1\n2 2\n2 1\noutput:\n2 3 3 6 6\n840 840 1008 1344 1680 2016 2016 2016 2352\n2116800 2646000 3528000 3528000 3528000 4233600 4838400 4838400 4838400\n205272023 205272023 205272023 264129429\n\nNote: In the first test case:\n\n- Before the modifications, Chris can rearrange $$$b$$$ to $$$[1, 2, 3]$$$ so that $$$P = \\prod\\limits_{i=1}^n \\min(a_i, b_i) = 1 \\cdot 1 \\cdot 2 = 2$$$. We can prove that this is the maximum possible value. For example, if Chris rearranges $$$b = [2, 3, 1]$$$, $$$P$$$ will be equal $$$1 \\cdot 1 \\cdot 1 = 1 < 2$$$, which is not optimal.\n- After the first modification, Chris can rearrange $$$b$$$ to $$$[1, 2, 3]$$$ so that $$$P = 1 \\cdot 1 \\cdot 3 = 3$$$, which is maximized.\n- After the second modification, Chris can rearrange $$$b$$$ to $$$[2, 2, 3]$$$ so that $$$P = 1 \\cdot 1 \\cdot 3 = 3$$$, which is maximized.\n- After the third modification, Chris can rearrange $$$b$$$ to $$$[2, 2, 3]$$$ so that $$$P = 6$$$, which is maximized.\n- After the fourth modification, Chris can rearrange $$$b$$$ to $$$[2, 2, 4]$$$ so that $$$P = 6$$$, which is maximized.\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": "2053D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Penchick and Modern Monument\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Amidst skyscrapers in the bustling metropolis of Metro Manila, the newest Noiph mall in the Philippines has just been completed! The construction manager, Penchick, ordered a state-of-the-art monument to be built with $$$n$$$ pillars.\n\nThe heights of the monument's pillars can be represented as an array $$$h$$$ of $$$n$$$ positive integers, where $$$h_i$$$ represents the height of the $$$i$$$-th pillar for all $$$i$$$ between $$$1$$$ and $$$n$$$.\n\nPenchick wants the heights of the pillars to be in non-decreasing order, i.e. $$$h_i \\le h_{i + 1}$$$ for all $$$i$$$ between $$$1$$$ and $$$n - 1$$$. However, due to confusion, the monument was built such that the heights of the pillars are in non-increasing order instead, i.e. $$$h_i \\ge h_{i + 1}$$$ for all $$$i$$$ between $$$1$$$ and $$$n - 1$$$.\n\nLuckily, Penchick can modify the monument and do the following operation on the pillars as many times as necessary:\n\n- Modify the height of a pillar to any positive integer. Formally, choose an index $$$1\\le i\\le n$$$ and a positive integer $$$x$$$. Then, assign $$$h_i := x$$$.\n\nHelp Penchick determine the minimum number of operations needed to make the heights of the monument's pillars non-decreasing.\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 a single integer $$$n$$$ ($$$1 \\leq n \\leq 50$$$) — the number of pillars.\n\nThe second line of each test case contains $$$n$$$ integers $$$h_1, h_2, \\ldots, h_n$$$ ($$$1 \\le h_i \\le n$$$ and $$$h_i\\ge h_{i+1}$$$) — the height of the pillars.\n\nPlease take note that the given array $$$h$$$ is non-increasing.\n\nNote that there are no constraints on the sum of $$$n$$$ over all test cases.\n\nOutput: For each test case, output a single integer representing the minimum number of operations needed to make the heights of the pillars non-decreasing.\n\nExamples:\ninput:\n3\n5\n5 4 3 2 1\n3\n2 2 1\n1\n1\noutput:\n4\n1\n0\n\nNote: In the first test case, the initial heights of pillars are $$$h = [5, 4, 3, 2, 1]$$$.\n\n- In the first operation, Penchick changes the height of pillar $$$1$$$ to $$$h_1 := 2$$$.\n- In the second operation, he changes the height of pillar $$$2$$$ to $$$h_2 := 2$$$.\n- In the third operation, he changes the height of pillar $$$4$$$ to $$$h_4 := 4$$$.\n- In the fourth operation, he changes the height of pillar $$$5$$$ to $$$h_5 := 4$$$.\n\nAfter the operation, the heights of the pillars are $$$h = [2, 2, 3, 4, 4]$$$, which is non-decreasing. It can be proven that it is not possible for Penchick to make the heights of the pillars non-decreasing in fewer than $$$4$$$ operations.\n\nIn the second test case, Penchick can make the heights of the pillars non-decreasing by modifying the height of pillar $$$3$$$ to $$$h_3 := 2$$$.\n\nIn the third test case, the heights of pillars are already non-decreasing, so no operations are required.\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": "2031A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Penchick and Satay Sticks\ntime_limit_ms: 1500\nmemory_limit_mb: 256\nDescription: Penchick and his friend Kohane are touring Indonesia, and their next stop is in Surabaya!\n\nIn the bustling food stalls of Surabaya, Kohane bought $$$n$$$ satay sticks and arranged them in a line, with the $$$i$$$-th satay stick having length $$$p_i$$$. It is given that $$$p$$$ is a permutation$$$^{\\text{∗}}$$$ of length $$$n$$$.\n\nPenchick wants to sort the satay sticks in increasing order of length, so that $$$p_i=i$$$ for each $$$1\\le i\\le n$$$. For fun, they created a rule: they can only swap neighboring satay sticks whose lengths differ by exactly $$$1$$$. Formally, they can perform the following operation any number of times (including zero):\n\n- Select an index $$$i$$$ ($$$1\\le i\\le n-1$$$) such that $$$|p_{i+1}-p_i|=1$$$;\n- Swap $$$p_i$$$ and $$$p_{i+1}$$$.\n\nDetermine whether it is possible to sort the permutation $$$p$$$, thus the satay sticks, by performing the above operation.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \\le t \\le 2\\cdot 10^5$$$). 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 number of satay sticks.\n\nThe second line of each test case contains $$$n$$$ integers $$$p_1, p_2, \\ldots, p_n$$$ ($$$1 \\le p_i \\le n$$$) — the permutation $$$p$$$ representing the length of the satay sticks.\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 it is possible to sort permutation $$$p$$$ by performing the operation. 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:\n2\n4\n2 1 3 4\n4\n4 2 3 1\noutput:\nYES\nNO\n\nNote: In the first test case, we can sort permutation $$$p = [2, 1, 3, 4]$$$ by performing an operation on index $$$1$$$ ($$$|p_2 - p_1| = |1 - 2| = 1$$$), resulting in $$$p = [1, 2, 3, 4]$$$.\n\nIn the second test case, it can be proven that it is impossible to sort permutation $$$p = [4, 2, 3, 1]$$$ by performing the operation. Here is an example of a sequence of operations that can be performed on the permutation:\n\n- Select $$$i = 2$$$ ($$$|p_3 - p_2| = |3 - 2| = 1$$$). This results in $$$p = [4, 3, 2, 1]$$$.\n- Select $$$i = 1$$$ ($$$|p_2 - p_1| = |3 - 4| = 1$$$). This results in $$$p = [3, 4, 2, 1]$$$.\n- Select $$$i = 3$$$ ($$$|p_4 - p_3| = |1 - 2| = 1$$$). This results in $$$p = [3, 4, 1, 2]$$$.\n\nUnfortunately, permutation $$$p$$$ remains unsorted after performing the operations.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2031B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Penchick and Desert Rabbit\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: Dedicated to pushing himself to his limits, Penchick challenged himself to survive the midday sun in the Arabian Desert!\n\nWhile trekking along a linear oasis, Penchick spots a desert rabbit preparing to jump along a line of palm trees. There are $$$n$$$ trees, each with a height denoted by $$$a_i$$$.\n\nThe rabbit can jump from the $$$i$$$-th tree to the $$$j$$$-th tree if exactly one of the following conditions is true:\n\n- $$$j < i$$$ and $$$a_j > a_i$$$: the rabbit can jump backward to a taller tree.\n- $$$j > i$$$ and $$$a_j < a_i$$$: the rabbit can jump forward to a shorter tree.\n\nFor each $$$i$$$ from $$$1$$$ to $$$n$$$, determine the maximum height among all trees that the rabbit can reach if it starts from the $$$i$$$-th tree.\n\nInput: The first line contains the number of test cases $$$t$$$ ($$$1 \\le t \\le 5 \\cdot 10^5$$$). The description of the test cases follows.\n\nThe first line of each test case contains a single integer $$$n$$$ ($$$1 \\leq n \\leq 5 \\cdot 10^5$$$) — the number of trees.\n\nThe second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$1 \\le a_i \\le n$$$) — the height of the trees.\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$5 \\cdot 10^5$$$.\n\nOutput: For each test case, output $$$n$$$ integers. The $$$i$$$-th integer should contain the maximum height among all trees that the rabbit can reach if it starts from the $$$i$$$-th tree.\n\nExamples:\ninput:\n5\n4\n2 3 1 4\n5\n5 4 3 2 1\n4\n2 1 1 3\n4\n1 1 3 1\n8\n2 4 1 6 3 8 5 7\noutput:\n3 3 3 4 \n5 5 5 5 5 \n2 2 2 3 \n1 1 3 3 \n8 8 8 8 8 8 8 8\n\nNote: In the first test case, the initial heights of trees are $$$a = [2, 3, 1, 4]$$$.\n\n- If the rabbit starts from the first tree, it can jump to the third tree as $$$3 > 1$$$ and $$$1 < 2$$$. Then, the rabbit can jump to the second tree as $$$2 < 3$$$ and $$$3 > 1$$$. It can be proved that the rabbit cannot reach the fourth tree; hence, the maximum height of the tree that the rabbit can reach is $$$a_2 = 3$$$.\n- If the rabbit starts from the fourth tree, it does not need to jump anywhere as it is already at the highest tree.\n\nIn the second test case, the rabbit can jump to the first tree regardless of which tree it starts from.\n\nIn the fifth test case, if the rabbit starts from the fifth tree, it can jump to the fourth tree. Then the rabbit can jump to the seventh tree and finally reach the sixth tree. Therefore, the maximum height of the tree that the rabbit can reach is $$$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": "2031D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Penchick and Chloe's Trees\ntime_limit_ms: 3500\nmemory_limit_mb: 512\nDescription: With just a few hours left until Penchick and Chloe leave for Singapore, they could hardly wait to see the towering trees at the Singapore Botanic Gardens! Attempting to contain their excitement, Penchick crafted a rooted tree to keep Chloe and himself busy.\n\nPenchick has a rooted tree$$$^{\\text{∗}}$$$ consisting of $$$n$$$ vertices, numbered from $$$1$$$ to $$$n$$$, with vertex $$$1$$$ as the root, and Chloe can select a non-negative integer $$$d$$$ to create a perfect binary tree$$$^{\\text{†}}$$$ of depth $$$d$$$.\n\nSince Penchick and Chloe are good friends, Chloe wants her tree to be isomorphic$$$^{\\text{‡}}$$$ to Penchick's tree. To meet this condition, Chloe can perform the following operation on her own tree any number of times:\n\n- Select an edge $$$(u,v)$$$, where $$$u$$$ is the parent of $$$v$$$.\n- Remove vertex $$$v$$$ and all the edges connected to $$$v$$$, then connect all of $$$v$$$'s previous children directly to $$$u$$$.\n\nIn particular, doing an operation on an edge $$$(u, v)$$$ where $$$v$$$ is a leaf will delete vertex $$$v$$$ without adding any new edges.\n\nSince constructing a perfect binary tree can be time-consuming, Chloe wants to choose the minimum $$$d$$$ such that a perfect binary tree of depth $$$d$$$ can be made isomorphic to Penchick's tree using the above operation. Note that she can't change the roots of the trees.\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 a single integer $$$n$$$ ($$$2 \\le n \\le 10^6$$$) — the number of vertices in Penchick's tree.\n\nThe second line of each test case contains $$$n-1$$$ integers $$$p_2, p_3, \\ldots, p_n$$$ ($$$1 \\leq p_i \\leq i-1$$$) — the parent of vertex $$$i$$$.\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$.\n\nOutput: For each test case, output a single integer on each line: the minimum depth of Chloe's perfect binary tree.\n\nExamples:\ninput:\n5\n6\n1 2 2 1 1\n15\n1 1 2 2 3 3 4 4 5 5 6 6 7 7\n5\n1 2 2 2\n7\n1 1 2 1 1 2\n10\n1 1 1 2 2 2 4 3 3\noutput:\n2\n3\n3\n3\n3\n\nNote: For the first test case, create a perfect binary tree with depth $$$2$$$.\n\nConsider carrying out the operation on edge $$$AC$$$. Then the edges $$$AC$$$, $$$CF$$$, and $$$CG$$$ are removed, and edges $$$AF$$$ and $$$AG$$$ are added.\n\nThe resulting tree is isomorphic to the tree given in the input. It can be proven that no sequence of operations carried out on a binary tree of depth less than $$$2$$$ can lead to a tree isomorphic to the tree given in the input.\n\nIn the second test case, the tree is already isomorphic to a perfect binary tree of depth $$$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": "2031E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Ruler (easy version)\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: This is the easy version of the problem. The only difference between the two versions is that in this version, you can make at most $$$\\mathbf{10}$$$ queries.\n\nThis is an interactive problem. If you are unsure how interactive problems work, then it is recommended to read the guide for participants.\n\nWe have a secret ruler that is missing one number $$$x$$$ ($$$2 \\leq x \\leq 999$$$). When you measure an object of length $$$y$$$, the ruler reports the following values:\n\n- If $$$y < x$$$, the ruler (correctly) measures the object as having length $$$y$$$.\n- If $$$y \\geq x$$$, the ruler incorrectly measures the object as having length $$$y+1$$$.\n\nThe ruler above is missing the number $$$4$$$, so it correctly measures the first segment as length $$$3$$$ but incorrectly measures the second segment as length $$$6$$$ even though it is actually $$$5$$$.\n\nYou need to find the value of $$$x$$$. To do that, you can make queries of the following form:\n\n- $$$\\texttt{?}~a~b$$$ — in response, we will measure the side lengths of an $$$a \\times b$$$ rectangle with our ruler and multiply the results, reporting the measured area of the rectangle back to you. For example, if $$$x=4$$$ and you query a $$$3 \\times 5$$$ rectangle, we will measure its side lengths as $$$3 \\times 6$$$ and report $$$18$$$ back to you.\n\nFind the value of $$$x$$$. You can ask at most $$$\\mathbf{10}$$$ queries.\n\nInput: Each test contains multiple test cases. The first line of input contains a single integer $$$t$$$ ($$$1 \\leq t \\leq 1000$$$) — the number of test cases.\n\nOutput: None\n\nExamples:\ninput:\n2\n\n18\n\n25\n\n\n9999\noutput:\n? 3 5\n\n? 4 4\n\n! 4\n? 99 100\n\n! 100\n\nNote: In the first test, the interaction proceeds as follows.\n\nSolutionJuryExplanation$$$\\texttt{2}$$$There are 2 test cases.$$$\\texttt{? 3 5}$$$$$$\\texttt{18}$$$Secretly, the jury picked $$$x=4$$$. The solution requests the $$$3 \\times 5$$$ rectangle, and the jury responds with $$$3 \\times 6 = 18$$$, as described in the statement.$$$\\texttt{? 4 4}$$$$$$\\texttt{25}$$$The solution requests the $$$4 \\times 4$$$ rectangle, which the jury measures as $$$5 \\times 5$$$ and responds with $$$25$$$.$$$\\texttt{! 4}$$$The solution has somehow determined that $$$x=4$$$, and outputs it. Since the output is correct, the jury continues to the next test case.$$$\\texttt{? 99 100}$$$$$$\\texttt{1}$$$Secretly, the jury picked $$$x=100$$$. The solution requests the $$$99 \\times 100$$$ rectangle, which the jury measures as $$$99 \\times 101$$$ and responds with $$$9999$$$.$$$\\texttt{! 100}$$$The solution has somehow determined that $$$x=100$$$, and outputs it. Since the output is correct and there are no more test cases, the jury and the solution exit.\n\nNote that the line breaks in the example input and output are for the sake of clarity, and do not occur in the real interaction.\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": "1999G1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Ruler (hard version)\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: This is the hard version of the problem. The only difference between the two versions is that in this version, you can make at most $$$\\mathbf{7}$$$ queries.\n\nThis is an interactive problem. If you are unsure how interactive problems work, then it is recommended to read the guide for participants.\n\nWe have a secret ruler that is missing one number $$$x$$$ ($$$2 \\leq x \\leq 999$$$). When you measure an object of length $$$y$$$, the ruler reports the following values:\n\n- If $$$y < x$$$, the ruler (correctly) measures the object as having length $$$y$$$.\n- If $$$y \\geq x$$$, the ruler incorrectly measures the object as having length $$$y+1$$$.\n\nThe ruler above is missing the number $$$4$$$, so it correctly measures the first segment as length $$$3$$$ but incorrectly measures the second segment as length $$$6$$$ even though it is actually $$$5$$$.\n\nYou need to find the value of $$$x$$$. To do that, you can make queries of the following form:\n\n- $$$\\texttt{?}~a~b$$$ — in response, we will measure the side lengths of an $$$a \\times b$$$ rectangle with our ruler and multiply the results, reporting the measured area of the rectangle back to you. For example, if $$$x=4$$$ and you query a $$$3 \\times 5$$$ rectangle, we will measure its side lengths as $$$3 \\times 6$$$ and report $$$18$$$ back to you.\n\nFind the value of $$$x$$$. You can ask at most $$$\\mathbf{7}$$$ queries.\n\nInput: Each test contains multiple test cases. The first line of input contains a single integer $$$t$$$ ($$$1 \\leq t \\leq 1000$$$) — the number of test cases.\n\nOutput: None\n\nExamples:\ninput:\n2\n\n18\n\n25\n\n\n9999\noutput:\n? 3 5\n\n? 4 4\n\n! 4\n? 99 100\n\n! 100\n\nNote: In the first test, the interaction proceeds as follows.\n\nSolutionJuryExplanation$$$\\texttt{2}$$$There are 2 test cases.$$$\\texttt{? 3 5}$$$$$$\\texttt{18}$$$Secretly, the jury picked $$$x=4$$$. The solution requests the $$$3 \\times 5$$$ rectangle, and the jury responds with $$$3 \\times 6 = 18$$$, as described in the statement.$$$\\texttt{? 4 4}$$$$$$\\texttt{25}$$$The solution requests the $$$4 \\times 4$$$ rectangle, which the jury measures as $$$5 \\times 5$$$ and responds with $$$25$$$.$$$\\texttt{! 4}$$$The solution has somehow determined that $$$x=4$$$, and outputs it. Since the output is correct, the jury continues to the next test case.$$$\\texttt{? 99 100}$$$$$$\\texttt{1}$$$Secretly, the jury picked $$$x=100$$$. The solution requests the $$$99 \\times 100$$$ rectangle, which the jury measures as $$$99 \\times 101$$$ and responds with $$$9999$$$.$$$\\texttt{! 100}$$$The solution has somehow determined that $$$x=100$$$, and outputs it. Since the output is correct and there are no more test cases, the jury and the solution exit.\n\nNote that the line breaks in the example input and output are for the sake of clarity, and do not occur in the real interaction.\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": "1999G2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: The Bento Box Adventure\ntime_limit_ms: 1000\nmemory_limit_mb: 1024\nDescription: Image generated by ChatGPT 4o.\n\nBoxed meals in Taiwan are very common, offering convenient and affordable nutrition-balanced choices for students and office workers. These meals typically include a variety of vegetables, protein, and rice, providing a well-rounded diet. With numerous options available at local self-service restaurants, they are a popular choice for those looking for a quick, healthy lunch.\n\nThere are five Taiwanese self-service restaurants numbered from 1 to 5. You plan to visit a different restaurant each day from Monday to Friday to pack a boxed meal for lunch. You've already visited one restaurant from Monday to Thursday, each time visiting a different one. Now, it's Friday, and you want to visit the last remaining restaurant that you haven't been to yet this week.\n\nWrite a program that takes as input the four restaurants you've already visited (one for each day from Monday to Thursday) and outputs the restaurant you should visit on Friday.\n\nInput: A single line of input containing four integers $$$a, b, c, d$$$, each between 1 and 5 (inclusive), representing the restaurant numbers you visited from Monday to Thursday, in order.\n\n- $$$1\\le a, b, c, d\\le 5$$$\n- All four numbers will be different.\n\nOutput: Output the restaurant number you should visit on Friday.\n\nExamples:\ninput:\n1 3 2 5\noutput:\n4\n\ninput:\n2 5 4 3\noutput:\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": "2041A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Bowling Frame\ntime_limit_ms: 1000\nmemory_limit_mb: 1024\nDescription: Bowling is a national sport in Taiwan; everyone in the country plays the sport on a daily basis since their youth. Naturally, there are a lot of bowling alleys all over the country, and the competition between them is as intense as you can imagine.\n\nMaw-Shang owns one such bowling alley. To stand out from other competitors in the industry and draw attention from customers, he decided to hold a special event every month that features various unorthodox bowling rules. For the event this month, he came up with a new version of the game called X-pin bowling. In the traditional $$$10$$$-pin bowling game, a frame is built out of ten bowling pins forming a triangular shape of side length four. The pin closest to the player forms the first row, and the two pins behind it form the second row, and so on. Unlike the standard version, the game of $$$X$$$-pin bowling Maw-Shang designed allows a much larger number of pins that form a larger frame. The following figure shows a standard $$$10$$$-pin frame on the left, and on the right it shows a $$$21$$$-pin frame that forms a triangular shape of side length six which is allowed in the game of $$$X$$$-pin bowling.\n\nBeing the national sport, the government of Taiwan strictly regulates and standardizes the manufacturing of bowling pins. There are two types of bowling pins allowed, one in black and the other in white, and the bowling alley Maw-Shang owns has $$$w$$$ white pins and $$$b$$$ black pins. To make this new game exciting for the customers, Maw-Shang wants to build the largest possible frame from these $$$w+b$$$ pins. However, even though he is okay with using both colors in building the frame, for aesthetic reasons, Maw-Shang still wants the colors of the pins on the same row to be identical. For example, the following figure shows two possible frames of side length six, but only the left one is acceptable to Maw-Shang since the other one has white and black pins mixed in the third row.\n\nThe monthly special event is happening in just a few hours. Please help Maw-Shang calculate the side length of the largest frame that he can build from his $$$w+b$$$ pins!\n\nInput: The first line of the input contains a single integer $$$t$$$, the number of test cases. Each of the following $$$t$$$ lines contains two integers $$$w$$$ and $$$b$$$, the number of white and black pins, respectively.\n\n- $$$1 \\leq t \\leq 100$$$\n- $$$0 \\leq w, b \\leq 10^9$$$\n\nOutput: For each test case, output in a single line the side length $$$k$$$ of the largest pin satisfying Maw-Shang's requirement you can build with the given pins.\n\nExamples:\ninput:\n4\n1 2\n3 2\n3 3\n12 0\noutput:\n2\n2\n3\n4\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2041B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Cube\ntime_limit_ms: 3000\nmemory_limit_mb: 1024\nDescription: You are given an $$$n\\times n\\times n$$$ big three-dimensional cube that contains $$$n^3$$$ numbers. You have to choose $$$n$$$ of those numbers so that their sum is as small as possible. It is, however, forbidden to choose two numbers that are located in the same plane. That is, if we identify the positions in the cube by three Cartesian coordinates, then choosing two numbers from positions $$$(x,y,z)$$$ and $$$(x',y',z')$$$ is forbidden if $$$x=x'$$$, $$$y=y'$$$, or $$$z=z'$$$.\n\nInput: The input consists of the number $$$n$$$ followed by $$$n^3$$$ numbers in the cube. The numbers are presented as $$$n$$$ two-dimensional matrices, one for each layer of the cube. More precisely, there will be $$$n^2$$$ lines follow, each having $$$n$$$ numbers. For each $$$x, y, z$$$ ($$$1\\le x, y, z\\le n$$$), the number at the position $$$(x, y, z)$$$ is listed as the $$$z$$$-th number in the $$$((x-1)\\times n+y)$$$-th line.\n\n- $$$2 \\leq n \\leq 12$$$\n- All numbers in the cube are integers between $$$0$$$ and $$$2\\times 10^7$$$.\n\nOutput: The output consists of a single number. It is the minimum sum of $$$n$$$ numbers chosen from the cube according to the above rules.\n\nExamples:\ninput:\n3\n1 2 3\n4 5 6\n7 8 9\n1 1 1\n2 2 2\n3 3 3\n4 3 0\n2 1 4\n9 8 9\noutput:\n5\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2041C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Drunken Maze\ntime_limit_ms: 2000\nmemory_limit_mb: 1024\nDescription: Image generated by ChatGPT 4o.\n\nYou are given a two-dimensional maze with a start and end position. Your task is to find the fastest way to get from the start to the end position. The fastest way is to make the minimum number of steps where one step is going left, right, up, or down. Of course, you cannot walk through walls.\n\nThere is, however, a catch: If you make more than three steps in the same direction, you lose balance and fall down. Therefore, it is forbidden to make more than three consecutive steps in the same direction. It is okay to walk three times to the right, then one step to the left, and then again three steps to the right. This has the same effect as taking five steps to the right, but is slower.\n\nInput: The first line contains two numbers $$$n$$$ and $$$m$$$, which are the height and width of the maze. This is followed by an ASCII-representation of the maze where $$$\\tt{\\#}$$$ is a wall, $$$\\tt{.}$$$ is an empty space, and $$$\\tt S$$$ and $$$\\tt T$$$ are the start and end positions.\n\n- $$$12 \\leq n\\times m \\leq 200000$$$.\n- $$$3\\leq n,m \\leq 10000$$$.\n- Characters are only $$$\\tt{.\\#ST}$$$ and there is exactly one $$$\\tt{S}$$$ and one $$$\\tt{T}$$$.\n- The outer borders are only $$$\\tt{\\#}$$$ (walls).\n\nOutput: The minimum number of steps to reach the end position from the start position or -1 if that is impossible.\n\nExamples:\ninput:\n7 12\n############\n#S........T#\n#.########.#\n#..........#\n#..........#\n#..#..#....#\n############\noutput:\n15\n\ninput:\n5 8\n########\n#......#\n#.####.#\n#...T#S#\n########\noutput:\n14\n\ninput:\n5 8\n########\n#.#S...#\n#.####.#\n#...T#.#\n########\noutput:\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": "2041D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Segmentation Folds\ntime_limit_ms: 1000\nmemory_limit_mb: 1024\nDescription: Peter loves folding segments. There is a segment on a number line occupying the interval $$$[\\ell, r]$$$. Since it is the prime time for folding the segments, Peter decides to fold the segment carefully. In each step, he chooses one of the two following operations whenever possible:\n\n1. Operation $$$\\tt{LTR}$$$: he folds the segment from left to right, where $$$\\ell$$$ coincides with a point $$$x$$$ ($$$\\ell < x \\le r$$$) such that $$$\\ell+x$$$ is a prime number$$$^{\\text{∗}}$$$. When Peter chooses this operation, he always chooses the largest possible value $$$x$$$. Note that the segment occupies the interval $$$[\\frac{1}{2}(\\ell+x), r]$$$ afterwards.\n2. Operation $$$\\tt{RTL}$$$: he folds the segment from right to left, where $$$r$$$ coincides with a point $$$x$$$ ($$$\\ell \\le x < r$$$) such that $$$r+x$$$ is a prime number. When Peter chooses this operation, he always chooses the smallest possible value $$$x$$$. Note that the segment occupies the interval $$$[\\ell, \\frac{1}{2}(r+x)]$$$ afterwards.\n\nA folding sequence refers to a sequence of operations specified above. Peter wants to fold the segment several times, resulting in the shortest possible interval whose length that cannot be further reduced. The length of an interval $$$[\\ell, r]$$$ is defined naturally to be $$$r-\\ell$$$. Let's consider the following example. Suppose that we are folding a segment initially occupying the interval $$$[1, 30]$$$. There are three folding sequences that lead to the shortest possible resulting interval, as shown in the following figure.\n\nPlease help Peter determine the number of folding sequences such that the resulting interval has a shortest possible length. Output the number modulo $$$998244353$$$.\n\nInput: The first line contains an integer $$$t$$$, denoting the number of test cases. In each of the following $$$t$$$ lines, there are two integers $$$\\ell$$$ and $$$r$$$.\n\n- $$$1 \\le t \\le 10$$$\n- $$$1 \\le \\ell < r \\le 10^{12}$$$\n- $$$r - \\ell \\le 10^5$$$\n\nOutput: For each test case, please output a line denoting the number of ways to fold the given segment such that the resulting segment has the shortest possible length, modulo $$$998244353$$$.\n\nExamples:\ninput:\n3\n1 30\n16 18\n142857 240135\noutput:\n3\n1\n63\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": "2041F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sheet Music\ntime_limit_ms: 1000\nmemory_limit_mb: 1024\nDescription: Image generated by ChatGPT 4o.\n\nAlice likes singing. As a singing enthusiast, Alice has listened to countless songs and has tried singing them many times. However, occasionally, some songs make Alice feel bored. After some research, Alice believes that this is because even though the songs she chose are all different, due to her instinctive preference, they all turn out to be musically similar to one another.\n\nTo thoroughly analyze this, Alice decided to study the sheet music of the songs. For convenience, Alice represented a song of length $$$n$$$ as an integer sequence $$$a_1, a_2, \\ldots, a_n$$$, where $$$a_i$$$ is the pitch of the $$$i$$$-th note. Then she defined the musical equivalence between songs. Two songs $$$a_1, a_2, \\ldots, a_n$$$ and $$$b_1, b_2, \\ldots, b_n$$$ of length $$$n$$$ are musically equivalent if for all $$$1\\leq i<n$$$, both $$$a_i, a_{i+1}$$$ and $$$b_{i}, b_{i+1}$$$ have the same pitch relationship. More specifically, $$$a_i, a_{i+1}$$$ and $$$b_i, b_{i+1}$$$ have the same pitch relationship if either\n\n- $$$a_i < a_{i + 1}$$$ and $$$b_i < b_{i + 1}$$$,\n- $$$a_i = a_{i + 1}$$$ and $$$b_i = b_{i + 1}$$$, or\n- $$$a_i > a_{i + 1}$$$ and $$$b_i > b_{i + 1}$$$.\n\nHaving practiced consistently for a long time, Alice is able to sing any note in the range of $$$[1, k]$$$. She wants to know how many different songs of length $$$n$$$ within her range there are, if we treat musically equivalent songs as the same one. Can you help her calculate the number?\n\nSince the answer might be large, print the answer modulo $$$998244353$$$.\n\nInput: The only line contains two integers $$$n, k$$$.\n\n- $$$1\\leq n\\leq 10^6$$$\n- $$$1\\leq k \\leq 10^9$$$\n\nOutput: Output the number of different songs modulo $$$998244353$$$.\n\nExamples:\ninput:\n3 2\noutput:\n7\n\ninput:\n5 3\noutput:\n67\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": "2041H",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Auto Complete\ntime_limit_ms: 4000\nmemory_limit_mb: 1024\nDescription: You are designing a snazzy new text editor, and you want to add a nifty auto-complete feature to help users save time. Here is how it will work: if a user types \"App\", your editor will magically suggest the word \"Application\"! Even better, users can personalize the words that auto-complete in your editor.\n\nYour editor will support 4 kinds of operations (Let's say the current text in your editor is $$$t$$$):\n\n1. Add an auto complete pattern $$$p_i$$$.\n2. Delete an auto complete pattern $$$p_i$$$.\n3. Append a string $$$s$$$ to the end of $$$t$$$.\n4. Delete $$$c$$$ characters from the end of $$$t$$$. Note that if $$$c$$$ is larger then the length of $$$t$$$, delete all the characters from $$$t$$$.\n\nAfter each action, your editor should suggest an auto-complete candidate $$$i$$$ that matches the following criteria:\n\n1. The string $$$p_i$$$ has a prefix equal to $$$t$$$.\n2. If there are multiple $$$p_i$$$, pick the longest one.\n3. If there are still multiple $$$p_i$$$, pick the one with the smallest lexicographic order.\n4. If there are still multiple $$$p_i$$$, pick the one with the smallest ID.\n\nFor example, let us say we have three candidates: \"alice\", \"bob\", and \"charlie\", with ID 1, 2, and 3. At first, there is nothing on the screen, so \"charlie\" (3) should be suggested because it is the longest. Then, let us say the user types \"b\". You should suggest \"bob\" (2) because it is the only one that starts with \"b\". Finally, let us say the user type \"body\". You should print -1 because there is no matched pattern.\n\nInput: The first line contains an integer $$$n$$$, followed by $$$n$$$ lines, with each line containing an action.\n\nThere are four types of actions:\n\n1. $$$i$$$ $$$p_i$$$\n2. $$$i$$$\n3. $$$s$$$\n4. $$$c$$$\n\n- $$$1 \\leq n \\leq 10^6$$$\n- The total number of characters in all $$$p_i$$$ and $$$s$$$ does not exceed $$$2\\times 10^6$$$.\n- $$$1 \\leq c \\leq 2\\times 10^6$$$\n- The strings $$$p_i$$$ and $$$s$$$ may contain any printable characters, excluding all space characters (ASCII number in the range from $$$33$$$ to $$$126$$$).\n- The ID $$$i$$$ for each add operation is unique.\n- The ID $$$i$$$ for each delete is guaranteed to be valid.\n- Each ID $$$i$$$ satisfies $$$0\\le i \\le n$$$.\n\nOutput: The program should output $$$n$$$ lines. For each action, output an integer $$$i$$$, which means that after the action, $$$p_i$$$ is the suggested auto complete candidate. If there is no $$$p_i$$$ that matches the requirement, output -1.\n\nExamples:\ninput:\n6\nadd 1 pattern1_alice\nadd 2 pattern2_bob\nadd 3 pattern3_charlie\nappend pattern\nappend 2_bobabc\nbackspace 3\noutput:\n1\n1\n3\n3\n-1\n2\n\ninput:\n6\nappend pattern\nadd 1 pattern1_alice____\nadd 2 pattern2_bob______\nadd 3 pattern3_charlie__\ndelete 1\ndelete 2\noutput:\n-1\n1\n1\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": "2041I",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Selection Sort\ntime_limit_ms: 2000\nmemory_limit_mb: 1024\nDescription: Every student enrolled in the algorithms course is required to submit an assignment this week. The task is to implement an $$$O(n^2)$$$-time algorithm to sort $$$n$$$ given integers in non-decreasing order. Alice has already completed her assignment, and her implementation is shown below.\n\nWhile you have access to Alice's code, you prefer not to simply copy it. Instead, you want to use Alice's sorting function as a building block for your own solution. There are two ways as listed below you can utilize her function, but each of them can be applied at most once. The order in which these two operations are invoked can be arbitrary.\n\n- Prefix sort: choose a length $$$i \\in \\{1, 2, \\ldots, n\\}$$$ and call $$$\\texttt{alicesort(}s, i\\texttt{)}$$$. This sorts the first $$$i$$$ elements in the array $$$s$$$.\n- Suffix sort: choose a length $$$i \\in \\{1, 2, \\ldots, n\\}$$$ and call $$$\\texttt{alicesort(}s+n-i, i\\texttt{)}$$$. This sorts the last $$$i$$$ elements in the array $$$s$$$.\n\nDue to the time complexity of the sorting algorithm, the cost of performing either a prefix or suffix sort is $$$i^2$$$, where $$$i$$$ is the length of the chosen subarray. Your goal is to determine the minimum cost to sort the input array $$$s$$$ of $$$n$$$ integers in non-decreasing order using Alice's function, following the rules mentioned above.\n\nFor example, Let $$$s=[3,2,5,5,4,1]$$$. We can first perform a suffix sort of length $$$4$$$, and the array becomes $$$[3,2,1,4,5,5]$$$. Then, we perform a prefix sort of length $$$3$$$, and the array becomes $$$[1,2,3,4,5,5]$$$, which is a sorted array. The cost is $$$4^2+3^2=25$$$. Here is another example, let $$$s=[4,3,2,1]$$$. We can complete the sorting by performing only a prefix sort of length $$$4$$$, and the cost is $$$4^2=16$$$.\n\nInput: The first line contains exactly one integer $$$n$$$ which indicates the number of integers in the array $$$s$$$. The second line contains the $$$n$$$ integers in $$$s=[s_0, s_1, \\ldots, s_{n-1}]$$$.\n\n- $$$1 \\le n \\le 10^6$$$\n- For all $$$i$$$ ($$$0\\le i < n$$$), $$$0\\le s_i < 2^{31}-1$$$.\n\nOutput: Output an integer on a line, indicating the minimum cost to sort the input array $$$s$$$ of $$$n$$$ integers in non-decreasing order using Alice's function, following the rules mentioned above.\n\nExamples:\ninput:\n6\n3 2 5 5 4 1\noutput:\n25\n\ninput:\n4\n4 3 2 1\noutput:\n16\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": "2041M",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Scrambled Scrabble\ntime_limit_ms: 1000\nmemory_limit_mb: 1024\nDescription: You are playing a word game using a standard set of $$$26$$$ uppercase English letters: A — Z. In this game, you can form vowels and consonants as follows.\n\n- The letters A, E, I, O, and U can only form a vowel.\n- The letter Y can form either a vowel or a consonant.\n- Each of the remaining letters other than A, E, I, O, U, and Y can only form a consonant.\n- The string NG can form a single consonant when concatenated together.\n\nDenote a syllable as a concatenation of a consonant, a vowel, and a consonant in that order. A word is a concatenation of one or more syllables.\n\nYou are given a string $$$S$$$ and you want to create a word from it. You are allowed to delete zero or more letters from $$$S$$$ and rearrange the remaining letters to form the word. Find the length of the longest word that can be created, or determine if no words can be created.\n\nInput: A single line consisting of a string $$$S$$$ ($$$1 \\leq |S| \\leq 5000$$$). The string $$$S$$$ consists of only uppercase English letters.\n\nOutput: If a word cannot be created, output 0. Otherwise, output a single integer representing the length of longest word that can be created.\n\nExamples:\ninput:\nICPCJAKARTA\noutput:\n9\n\ninput:\nNGENG\noutput:\n5\n\ninput:\nYYY\noutput:\n3\n\ninput:\nDANGAN\noutput:\n6\n\ninput:\nAEIOUY\noutput:\n0\n\nNote: Explanation for the sample input/output #1\n\nA possible longest word is JAKCARTAP, consisting of the syllables JAK, CAR, and TAP.\n\nExplanation for the sample input/output #2\n\nThe whole string $$$S$$$ is a word consisting of one syllable which is the concatenation of the consonant NG, the vowel E, and the consonant NG.\n\nExplanation for the sample input/output #3\n\nThe whole string $$$S$$$ is a word consisting of one syllable which is the concatenation of the consonant Y, the vowel Y, and the consonant Y.\n\nExplanation for the sample input/output #4\n\nThe whole string $$$S$$$ is a word consisting of two syllables: DAN and GAN.\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": "2045A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: ICPC Square\ntime_limit_ms: 1000\nmemory_limit_mb: 1024\nDescription: ICPC Square is a hotel provided by the ICPC Committee for the accommodation of the participants. It consists of $$$N$$$ floors (numbered from $$$1$$$ to $$$N$$$). This hotel has a very unique elevator. If a person is currently at floor $$$x$$$, by riding the elevator once, they can go to floor $$$y$$$ if and only if $$$y$$$ is a multiple of $$$x$$$ and $$$y - x \\leq D$$$.\n\nYou are currently at floor $$$S$$$. You want to go to the highest possible floor by riding the elevator zero or more times. Determine the highest floor you can reach.\n\nInput: A single line consisting of three integers $$$N$$$ $$$D$$$ $$$S$$$ ($$$2 \\leq N \\leq 10^{12}; 1 \\leq D \\leq N - 1; 1 \\leq S \\leq N$$$).\n\nOutput: Output a single integer representing the highest floor you can reach by riding the elevator zero or more times.\n\nExamples:\ninput:\n64 35 3\noutput:\n60\n\ninput:\n2024 2023 1273\noutput:\n1273\n\nNote: Explanation for the sample input/output #1\n\nFirst, ride the elevator from floor $$$3$$$ to floor $$$15$$$. This is possible because $$$15$$$ is a multiple of $$$3$$$ and $$$15 - 3 \\leq 35$$$. Then, ride the elevator from floor $$$15$$$ to floor $$$30$$$. This is possible because $$$30$$$ is a multiple of $$$15$$$ and $$$30 - 15 \\leq 35$$$. Finally, ride the elevator from floor $$$30$$$ to floor $$$60$$$. This is possible because $$$60$$$ is a multiple of $$$30$$$ and $$$60 - 30 \\leq 35$$$.\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": "2045B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: X Aura\ntime_limit_ms: 1000\nmemory_limit_mb: 1024\nDescription: Mount ICPC can be represented as a grid of $$$R$$$ rows (numbered from $$$1$$$ to $$$R$$$) and $$$C$$$ columns (numbered from $$$1$$$ to $$$C$$$). The cell located at row $$$r$$$ and column $$$c$$$ is denoted as $$$(r, c)$$$ and has a height of $$$H_{r, c}$$$. Two cells are adjacent to each other if they share a side. Formally, $$$(r, c)$$$ is adjacent to $$$(r-1, c)$$$, $$$(r+1, c)$$$, $$$(r, c-1)$$$, and $$$(r, c+1)$$$, if any exists.\n\nYou can move only between adjacent cells, and each move comes with a penalty. With an aura of an odd positive integer $$$X$$$, moving from a cell with height $$$h_1$$$ to a cell with height $$$h_2$$$ gives you a penalty of $$$(h_1 - h_2)^X$$$. Note that the penalty can be negative.\n\nYou want to answer $$$Q$$$ independent scenarios. In each scenario, you start at the starting cell $$$(R_s, C_s)$$$ and you want to go to the destination cell $$$(R_f, C_f)$$$ with minimum total penalty. In some scenarios, the total penalty might become arbitrarily small; such a scenario is called invalid. Find the minimum total penalty to move from the starting cell to the destination cell, or determine if the scenario is invalid.\n\nInput: The first line consists of three integers $$$R$$$ $$$C$$$ $$$X$$$ ($$$1 \\leq R, C \\leq 1000; 1 \\leq X \\leq 9; X$$$ is an odd integer).\n\nEach of the next $$$R$$$ lines consists of a string $$$H_r$$$ of length $$$C$$$. Each character in $$$H_r$$$ is a number from 0 to 9. The $$$c$$$-th character of $$$H_r$$$ represents the height of cell $$$(r, c)$$$, or $$$H_{r, c}$$$.\n\nThe next line consists of an integer $$$Q$$$ ($$$1 \\leq Q \\leq 100\\,000)$$$.\n\nEach of the next $$$Q$$$ lines consists of four integers $$$R_s$$$ $$$C_s$$$ $$$R_f$$$ $$$C_f$$$ ($$$1 \\leq R_s, R_f \\leq R; 1 \\leq C_s, C_f \\leq C$$$).\n\nOutput: For each scenario, output the following in a single line. If the scenario is invalid, output INVALID. Otherwise, output a single integer representing the minimum total penalty to move from the starting cell to the destination cell.\n\nExamples:\ninput:\n3 4 1\n3359\n4294\n3681\n5\n1 1 3 4\n3 3 2 1\n2 2 1 4\n1 3 3 2\n1 1 1 1\noutput:\n2\n4\n-7\n-1\n0\n\ninput:\n2 4 5\n1908\n2023\n2\n1 1 2 4\n1 1 1 1\noutput:\nINVALID\nINVALID\n\ninput:\n3 3 9\n135\n357\n579\n2\n3 3 1 1\n2 2 2 2\noutput:\n2048\n0\n\nNote: Explanation for the sample input/output #1\n\nFor the first scenario, one of the solutions is to move as follows: $$$(1, 1) \\rightarrow (2, 1) \\rightarrow (3, 1) \\rightarrow (3, 2) \\rightarrow (3, 3) \\rightarrow (3, 4)$$$. The total penalty of this solution is $$$(3 - 4)^1 + (4 - 3)^1 + (3 - 6)^1 + (6 - 8)^1 + (8 - 1)^1 = 2$$$.\n\nExplanation for the sample input/output #2\n\nFor the first scenario, the cycle $$$(1, 1) \\rightarrow (2, 1) \\rightarrow (2, 2) \\rightarrow (1, 2) \\rightarrow (1, 1)$$$ has a penalty of $$$(1 - 2)^5 + (2 - 0)^5 + (0 - 9)^5 + (9 - 1)^5 = -26250$$$. You can keep repeating this cycle to make your total penalty arbitrarily small. Similarly, for the second scenario, you can move to $$$(1, 1)$$$ first, then repeat the same cycle.\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": "2045G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Microwavable Subsequence\ntime_limit_ms: 1000\nmemory_limit_mb: 1024\nDescription: You are given an array of $$$N$$$ integers: $$$[A_1, A_2, \\dots, A_N]$$$.\n\nA subsequence can be derived from an array by removing zero or more elements without changing the order of the remaining elements. For example, $$$[2, 1, 2]$$$, $$$[3, 3]$$$, $$$[1]$$$, and $$$[3, 2, 1, 3, 2]$$$ are subsequences of array $$$[3, 2, 1, 3, 2]$$$, while $$$[1, 2, 3]$$$ is not a subsequence of array $$$[3, 2, 1, 3, 2]$$$.\n\nA subsequence is microwavable if the subsequence consists of at most two distinct values and each element differs from its adjacent elements. For example, $$$[2, 1, 2]$$$, $$$[3, 2, 3, 2]$$$, and $$$[1]$$$ are microwavable, while $$$[3, 3]$$$ and $$$[3, 2, 1, 3, 2]$$$ are not microwavable.\n\nDenote a function $$$f(x, y)$$$ as the length of the longest microwavable subsequence of array $$$A$$$ such that each element within the subsequence is either $$$x$$$ or $$$y$$$. Find the sum of $$$f(x, y)$$$ for all $$$1 \\leq x < y \\leq M$$$.\n\nInput: The first line consists of two integers $$$N$$$ $$$M$$$ ($$$1 \\leq N, M \\leq 300\\,000$$$).\n\nThe second line consists of $$$N$$$ integers $$$A_i$$$ ($$$1 \\leq A_i \\leq M$$$).\n\nOutput: Output a single integer representing the sum of $$$f(x, y)$$$ for all $$$1 \\leq x < y \\leq M$$$.\n\nExamples:\ninput:\n5 4\n3 2 1 3 2\noutput:\n13\n\ninput:\n3 3\n1 1 1\noutput:\n2\n\nNote: Explanation for the sample input/output #1\n\nThe value of $$$f(1, 2)$$$ is $$$3$$$, taken from the subsequence $$$[2, 1, 2]$$$ that can be obtained by removing $$$A_1$$$ and $$$A_4$$$. The value of $$$f(1, 3)$$$ is $$$3$$$, taken from the subsequence $$$[3, 1, 3]$$$ that can be obtained by removing $$$A_2$$$ and $$$A_5$$$. The value of $$$f(2, 3)$$$ is $$$4$$$, taken from the subsequence $$$[3, 2, 3, 2]$$$ that can be obtained by removing $$$A_3$$$. The value of $$$f(1, 4)$$$, $$$f(2, 4)$$$, and $$$f(3, 4)$$$ are all $$$1$$$.\n\nExplanation for the sample input/output #2\n\nThe value of $$$f(1, 2)$$$ and $$$f(1, 3)$$$ are both $$$1$$$, while the value of $$$f(2, 3)$$$ is $$$0$$$.\n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2045I",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Mirror Maze\ntime_limit_ms: 1000\nmemory_limit_mb: 1024\nDescription: You are given a grid of $$$R$$$ rows (numbered from $$$1$$$ to $$$R$$$ from north to south) and $$$C$$$ columns (numbered from $$$1$$$ to $$$C$$$ from west to east). Every cell in this grid is a square of the same size. The cell located at row $$$r$$$ and column $$$c$$$ is denoted as $$$(r, c)$$$. Each cell can either be empty or have a mirror in one of the cell's diagonals. Each mirror is represented by a line segment. The mirror is type $$$1$$$ if it is positioned diagonally from the southwest corner to the northeast corner of the cell, or type $$$2$$$ for the other diagonal.\n\nThese mirrors follow the law of reflection, that is, the angle of reflection equals the angle of incidence. Formally, for type $$$1$$$ mirror, if a beam of light comes from the north, south, west, or east of the cell, then it will be reflected to the west, east, north, and south of the cell, respectively. Similarly, for type $$$2$$$ mirror, if a beam of light comes from the north, south, west, or east of the cell, then it will be reflected to the east, west, south, and north of the cell, respectively.\n\nYou want to put a laser from outside the grid such that all mirrors are hit by the laser beam. There are $$$2 \\cdot (R+C)$$$ possible locations to put the laser:\n\n- from the north side of the grid at column $$$c$$$, for $$$1 \\leq c \\leq C$$$, shooting a laser beam to the south;\n- from the south side of the grid at column $$$c$$$, for $$$1 \\leq c \\leq C$$$, shooting a laser beam to the north;\n- from the east side of the grid at row $$$r$$$, for $$$1 \\leq r \\leq R$$$, shooting a laser beam to the west; and\n- from the west side of the grid at row $$$r$$$, for $$$1 \\leq r \\leq R$$$, shooting a laser beam to the east.\n\nDetermine all possible locations for the laser such that all mirrors are hit by the laser beam.\n\nInput: The first line consists of two integers $$$R$$$ $$$C$$$ ($$$1 \\leq R, C \\leq 200$$$).\n\nEach of the next $$$R$$$ lines consists of a string $$$S_r$$$ of length $$$C$$$. The $$$c$$$-th character of string $$$S_r$$$ represents cell $$$(r, c)$$$. Each character can either be . if the cell is empty, / if the cell has type $$$1$$$ mirror, or \\ if the cell has type $$$2$$$ mirror. There is at least one mirror in the grid.\n\nOutput: Output a single integer representing the number of possible locations for the laser such that all mirrors are hit by the laser beam. Denote this number as $$$k$$$.\n\nIf $$$k > 0$$$, then output $$$k$$$ space-separated strings representing the location of the laser. Each string consists of a character followed without any space by an integer. The character represents the side of the grid, which could be N, S, E, or W if you put the laser on the north, south, east, or west side of the grid, respectively. The integer represents the row/column number. You can output the strings in any order.\n\nExamples:\ninput:\n4 4\n.//.\n.\\\\.\n.\\/.\n....\noutput:\n2\nN3 W2\n\ninput:\n4 6\n./..\\.\n.\\...\\\n./../\\\n......\noutput:\n2\nE3 S2\n\ninput:\n4 4\n....\n./\\.\n.\\/.\n....\noutput:\n0\n\nNote: Explanation for the sample input/output #1\n\nThe following illustration shows one of the solutions of this sample.\n\nExplanation for the sample input/output #2\n\nThe following illustration shows one of the solutions of this sample.\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": "2045M",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Preparing for the Olympiad\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Monocarp and Stereocarp are preparing for the Olympiad. There are $$$n$$$ days left until the Olympiad. On the $$$i$$$-th day, if Monocarp plans to practice, he will solve $$$a_i$$$ problems. Similarly, if Stereocarp plans to practice on the same day, he will solve $$$b_i$$$ problems.\n\nMonocarp can train on any day he wants. However, Stereocarp watches Monocarp and follows a different schedule: if Monocarp trained on day $$$i$$$ and $$$i < n$$$, then Stereocarp will train on day $$$(i+1)$$$.\n\nMonocarp wants to organize his training process in a way that the difference between the number of problems he solves and the number of problems Stereocarp solves is as large as possible. Formally, Monocarp wants to maximize the value of $$$(m-s)$$$, where $$$m$$$ is the number of problems he solves, and $$$s$$$ is the number of problems Stereocarp solves. Help Monocarp determine the maximum possible difference in the number of solved problems between them.\n\nInput: The first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^3$$$) — the number of test cases.\n\nThe first line of each test case contains a single integer $$$n$$$ ($$$1 \\le n \\le 100$$$).\n\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 100$$$).\n\nThe third line contains $$$n$$$ integers $$$b_1, b_2, \\dots, b_n$$$ ($$$1 \\le b_i \\le 100$$$).\n\nOutput: For each test case, print a single integer — the maximum possible difference between the number of problems Monocarp solves and the number of problems Stereocarp solves.\n\nExamples:\ninput:\n4\n2\n3 2\n2 1\n1\n5\n8\n3\n1 1 1\n2 2 2\n6\n8 2 5 6 2 6\n8 2 7 4 3 4\noutput:\n4\n5\n1\n16\n\nNote: Let's analyze the example from the statement:\n\n- In the first test case, it is optimal for Monocarp to train both days; then Stereocarp will train on day $$$2$$$.\n- In the second test case, it is optimal for Monocarp to train on the only day, and Stereocarp will not train at all.\n- In the third test case, it is optimal for Monocarp to train on the last day (and only on that day).\n- In the fourth test case, it is optimal for Monocarp to train on days $$$1, 3, 4, 6$$$; then Stereocarp will train on days $$$2, 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": "2051A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Journey\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Monocarp decided to embark on a long hiking journey.\n\nHe decided that on the first day he would walk $$$a$$$ kilometers, on the second day he would walk $$$b$$$ kilometers, on the third day he would walk $$$c$$$ kilometers, on the fourth day, just like on the first, he would walk $$$a$$$ kilometers, on the fifth day, just like on the second, he would walk $$$b$$$ kilometers, on the sixth day, just like on the third, he would walk $$$c$$$ kilometers, and so on.\n\nMonocarp will complete his journey on the day when he has walked at least $$$n$$$ kilometers in total. Your task is to determine the day on which Monocarp will complete his journey.\n\nInput: The first line contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nEach test case consists of one line containing four integers $$$n$$$, $$$a$$$, $$$b$$$, $$$c$$$ ($$$1 \\le n \\le 10^9$$$; $$$1 \\le a, b, c \\le 10^6$$$).\n\nOutput: For each test case, output one integer — the day on which Monocarp will have walked at least $$$n$$$ kilometers in total and will complete his journey.\n\nExamples:\ninput:\n4\n12 1 5 3\n6 6 7 4\n16 3 4 1\n1000000000 1 1 1\noutput:\n5\n1\n6\n1000000000\n\nNote: In the first example, over the first four days, Monocarp will cover $$$1 + 5 + 3 + 1 = 10$$$ kilometers. On the fifth day, he will cover another $$$5$$$ kilometers, meaning that in total over five days he will have covered $$$10 + 5 = 15$$$ kilometers. Since $$$n = 12$$$, Monocarp will complete his journey on the fifth day.\n\nIn the second example, Monocarp will cover $$$6$$$ kilometers on the first day. Since $$$n = 6$$$, Monocarp will complete his journey on the very first day.\n\nIn the third example, Monocarp will cover $$$3 + 4 + 1 + 3 + 4 + 1 = 16$$$ kilometers over the first six days. Since $$$n = 16$$$, Monocarp will complete his journey on the sixth day.\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": "2051B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Preparing for the Exam\ntime_limit_ms: 1500\nmemory_limit_mb: 256\nDescription: Monocarp is preparing for his first exam at the university. There are $$$n$$$ different questions which can be asked during the exam, numbered from $$$1$$$ to $$$n$$$. There are $$$m$$$ different lists of questions; each list consists of exactly $$$n-1$$$ different questions. Each list $$$i$$$ is characterized by one integer $$$a_i$$$, which is the index of the only question which is not present in the $$$i$$$-th list. For example, if $$$n = 4$$$ and $$$a_i = 3$$$, the $$$i$$$-th list contains questions $$$[1, 2, 4]$$$.\n\nDuring the exam, Monocarp will receive one of these $$$m$$$ lists of questions. Then, the professor will make Monocarp answer all questions from the list. So, Monocarp will pass only if he knows all questions from the list.\n\nMonocarp knows the answers for $$$k$$$ questions $$$q_1, q_2, \\dots, q_k$$$. For each list, determine if Monocarp will pass the exam if he receives that list.\n\nInput: The first line contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nEach test case consists of three lines:\n\n- the first line contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \\le n \\le 3 \\cdot 10^5$$$; $$$1 \\le m, k \\le n$$$);\n- the second line contains $$$m$$$ distinct integers $$$a_1, a_2, \\dots, a_m$$$ ($$$1 \\le a_i \\le n$$$; $$$a_i < a_{i+1}$$$);\n- the third line contains $$$k$$$ distinct integers $$$q_1, q_2, \\dots, q_k$$$ ($$$1 \\le q_i \\le n$$$; $$$q_i < q_{i+1}$$$).\n\nAdditional constraints on the input:\n\n- the sum of $$$n$$$ over all test cases does not exceed $$$3 \\cdot 10^5$$$.\n\nOutput: For each test case, print a string of $$$m$$$ characters. The $$$i$$$-th character should be 1 if Monocarp passes the exam if he receives the $$$i$$$-th question list, 0 if Monocarp won't pass.\n\nExamples:\ninput:\n4\n4 4 3\n1 2 3 4\n1 3 4\n5 4 3\n1 2 3 4\n1 3 4\n4 4 4\n1 2 3 4\n1 2 3 4\n2 2 1\n1 2\n2\noutput:\n0100\n0000\n1111\n10\n\nNote: In the first test case, Monocarp knows the questions $$$[1, 3, 4]$$$. Let's consider all the question lists:\n\n- the first list consists of questions $$$[2, 3, 4]$$$. Monocarp doesn't know the $$$2$$$-nd question, so he won't pass;\n- the second list consists of questions $$$[1, 3, 4]$$$. Monocarp knows all these questions, so he will pass;\n- the third list consists of questions $$$[1, 2, 4]$$$. Monocarp doesn't know the $$$2$$$-nd question, so he won't pass;\n- the fourth list consists of questions $$$[1, 2, 3]$$$. Monocarp doesn't know the $$$2$$$-nd question, so he won't pass.\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": "2051C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Counting Pairs\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given a sequence $$$a$$$, consisting of $$$n$$$ integers, where the $$$i$$$-th element of the sequence is equal to $$$a_i$$$. You are also given two integers $$$x$$$ and $$$y$$$ ($$$x \\le y$$$).\n\nA pair of integers $$$(i, j)$$$ is considered interesting if the following conditions are met:\n\n- $$$1 \\le i < j \\le n$$$;\n- if you simultaneously remove the elements at positions $$$i$$$ and $$$j$$$ from the sequence $$$a$$$, the sum of the remaining elements is at least $$$x$$$ and at most $$$y$$$.\n\nYour task is to determine the number of interesting pairs of integers for the given sequence $$$a$$$.\n\nInput: The first line contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nEach test case consists of two lines:\n\n- The first line contains three integers $$$n, x, y$$$ ($$$3 \\le n \\le 2 \\cdot 10^5$$$, $$$1 \\le x \\le y \\le 2 \\cdot 10^{14}$$$);\n- The second line contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 10^{9}$$$).\n\nAdditional constraint on the input: the sum of $$$n$$$ across all test cases does not exceed $$$2 \\cdot 10^5$$$.\n\nOutput: For each test case, output one integer — the number of interesting pairs of integers for the given sequence $$$a$$$.\n\nExamples:\ninput:\n7\n4 8 10\n4 6 3 6\n6 22 27\n4 9 6 3 4 5\n3 8 10\n3 2 1\n3 1 1\n2 3 4\n3 3 6\n3 2 1\n4 4 12\n3 3 2 1\n6 8 8\n1 1 2 2 2 3\noutput:\n4\n7\n0\n0\n1\n5\n6\n\nNote: In the first example, there are $$$4$$$ interesting pairs of integers:\n\n1. $$$(1, 2)$$$;\n2. $$$(1, 4)$$$;\n3. $$$(2, 3)$$$;\n4. $$$(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": "2051D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Best Price\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: A batch of Christmas trees has arrived at the largest store in Berland. $$$n$$$ customers have already come to the store, wanting to buy them.\n\nBefore the sales begin, the store needs to determine the price for one tree (the price is the same for all customers). To do this, the store has some information about each customer.\n\nFor the $$$i$$$-th customer, two integers $$$a_i$$$ and $$$b_i$$$ are known, which define their behavior:\n\n- if the price of the product is at most $$$a_i$$$, the customer will buy a tree and leave a positive review;\n- otherwise, if the price of the product is at most $$$b_i$$$, the customer will buy a tree but leave a negative review;\n- otherwise, the customer will not buy a tree at all.\n\nYour task is to calculate the maximum possible earnings for the store, given that it can receive no more than $$$k$$$ negative reviews.\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$$$; $$$0 \\le k \\le n$$$).\n\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 2 \\cdot 10^9$$$).\n\nThe third line contains $$$n$$$ integers $$$b_1, b_2, \\dots, b_n$$$ ($$$1 \\le b_i \\le 2 \\cdot 10^9$$$; $$$a_i < b_i$$$).\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 earnings for the store, given that it can receive no more than $$$k$$$ negative reviews.\n\nExamples:\ninput:\n5\n2 0\n2 1\n3 4\n1 1\n2\n5\n3 3\n1 5 2\n3 6 4\n4 3\n2 3 2 8\n3 7 3 9\n3 1\n2 9 5\n12 14 9\noutput:\n2\n5\n9\n14\n15\n\nNote: Consider the example from the statement:\n\n- In the first test case, the price should be set to $$$1$$$. Then both customers will buy one tree each and leave no negative reviews;\n- In the second test case, the price should be set to $$$5$$$. Then the only customer will buy a tree and leave a negative review;\n- In the third test case, the price should be set to $$$3$$$. Then all customers will buy one tree each, and the store will receive two negative reviews.\n- In the fourth test case, the price should be set to $$$7$$$. Then two customers will buy one tree each, and the store will receive one negative review.\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": "2051E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Joker\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Consider a deck of $$$n$$$ cards. The positions in the deck are numbered from $$$1$$$ to $$$n$$$ from top to bottom. A joker is located at position $$$m$$$.\n\n$$$q$$$ operations are applied sequentially to the deck. During the $$$i$$$-th operation, you need to take the card at position $$$a_i$$$ and move it either to the beginning or to the end of the deck. For example, if the deck is $$$[2, 1, 3, 5, 4]$$$, and $$$a_i=2$$$, then after the operation the deck will be either $$$[1, 2, 3, 5, 4]$$$ (the card from the second position moved to the beginning) or $$$[2, 3, 5, 4, 1]$$$ (the card from the second position moved to the end).\n\nYour task is to calculate the number of distinct positions where the joker can be after each operation.\n\nInput: The first line contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nThe first line of each test case contains three integers $$$n$$$, $$$m$$$, and $$$q$$$ ($$$2 \\le n \\le 10^9$$$; $$$1 \\le m \\le n$$$; $$$1 \\le q \\le 2 \\cdot 10^5$$$).\n\nThe second line contains $$$q$$$ integers $$$a_1, a_2, \\dots, a_q$$$ ($$$1 \\le a_i \\le n$$$).\n\nAdditional constraint on the input: the sum of $$$q$$$ over all test cases does not exceed $$$2 \\cdot 10^5$$$.\n\nOutput: For each test case, print $$$q$$$ integers — the number of distinct positions where the joker can be after each operation.\n\nExamples:\ninput:\n5\n6 5 3\n1 2 3\n2 1 4\n2 1 1 2\n5 3 1\n3\n3 2 4\n2 1 1 1\n18 15 4\n13 15 1 16\noutput:\n2 3 5 \n2 2 2 2 \n2 \n2 3 3 3 \n2 4 6 8\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": "2051F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Snakes\ntime_limit_ms: 3000\nmemory_limit_mb: 512\nDescription: Suppose you play a game where the game field looks like a strip of $$$1 \\times 10^9$$$ square cells, numbered from $$$1$$$ to $$$10^9$$$.\n\nYou have $$$n$$$ snakes (numbered from $$$1$$$ to $$$n$$$) you need to place into some cells. Initially, each snake occupies exactly one cell, and you can't place more than one snake into one cell. After that, the game starts.\n\nThe game lasts for $$$q$$$ seconds. There are two types of events that may happen each second:\n\n- snake $$$s_i$$$ enlarges: if snake $$$s_i$$$ occupied cells $$$[l, r]$$$, it enlarges to a segment $$$[l, r + 1]$$$;\n- snake $$$s_i$$$ shrinks: if snake $$$s_i$$$ occupied cells $$$[l, r]$$$, it shrinks to a segment $$$[l + 1, r]$$$.\n\nEach second, exactly one of the events happens.\n\nIf at any moment of time, any snake runs into some obstacle (either another snake or the end of the strip), you lose. Otherwise, you win with the score equal to the maximum cell occupied by any snake so far.\n\nWhat is the minimum possible score you can achieve?\n\nInput: The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \\le n \\le 20$$$; $$$1 \\le q \\le 2 \\cdot 10^5$$$) — the number of snakes and the number of events. Next $$$q$$$ lines contain the description of events — one per line.\n\nThe $$$i$$$-th line contains\n\n- either \"$$$s_i$$$ +\" ($$$1 \\le s_i \\le n$$$) meaning that the $$$s_i$$$-th snake enlarges\n- or \"$$$s_i$$$ -\" ($$$1 \\le s_i \\le n$$$) meaning that the $$$s_i$$$-th snake shrinks.\n\nAdditional constraint on the input: the given sequence of events is valid, i. e. a snake of length $$$1$$$ never shrinks.\n\nOutput: Print one integer — the minimum possible score.\n\nExamples:\ninput:\n3 6\n1 +\n1 -\n3 +\n3 -\n2 +\n2 -\noutput:\n4\n\ninput:\n5 13\n5 +\n3 +\n5 -\n2 +\n4 +\n3 +\n5 +\n5 -\n2 +\n3 -\n3 +\n3 -\n2 +\noutput:\n11\n\nNote: In the first test, the optimal strategy is to place the second snake at cell $$$1$$$, the third snake — at $$$2$$$, and the first one — at $$$3$$$. The maximum occupied cell is cell $$$4$$$, and it's the minimum possible score.\n\nIn the second test, one of the optimal strategies is to place:\n\n- snake $$$2$$$ at position $$$1$$$;\n- snake $$$3$$$ at position $$$4$$$;\n- snake $$$5$$$ at position $$$6$$$;\n- snake $$$1$$$ at position $$$9$$$;\n- snake $$$4$$$ at position $$$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": "2051G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: MEX Destruction\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Evirir the dragon snuck into a wizard's castle and found a mysterious contraption, and their playful instincts caused them to play with (destroy) it...\n\nEvirir the dragon found an array $$$a_1, a_2, \\ldots, a_n$$$ of $$$n$$$ non-negative integers.\n\nIn one operation, they can choose a non-empty subarray$$$^{\\text{∗}}$$$ $$$b$$$ of $$$a$$$ and replace it with the integer $$$\\operatorname{mex}(b)$$$$$$^{\\text{†}}$$$. They want to use this operation any number of times to make $$$a$$$ only contain zeros. It can be proven that this is always possible under the problem constraints.\n\nWhat is the minimum number of operations needed?\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \\le t \\le 200$$$). 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 length of $$$a$$$.\n\nThe second line of each test case contains $$$n$$$ space-separated integers, $$$a_1, a_2, \\ldots, a_n$$$ ($$$0 \\le a_i \\le 100$$$).\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$500$$$.\n\nOutput: For each test case, output a single integer on a line, the minimum number of operations needed to make $$$a$$$ contain only zeros.\n\nExamples:\ninput:\n10\n4\n0 1 2 3\n6\n0 0 0 0 0 0\n5\n1 0 1 0 1\n5\n3 1 4 1 5\n4\n3 2 1 0\n7\n9 100 0 89 12 2 3\n4\n0 3 9 0\n7\n0 7 0 2 0 7 0\n1\n0\n2\n0 1\noutput:\n1\n0\n2\n1\n1\n2\n1\n2\n0\n1\n\nNote: In the first test case, Evirir can choose the subarray $$$b = [1, 2, 3]$$$ and replace it with $$$\\operatorname{mex}(1, 2, 3) = 0$$$, changing $$$a$$$ from $$$[0, \\underline{1, 2, 3}]$$$ to $$$[0, 0]$$$ (where the chosen subarray is underlined). Therefore, the answer is $$$1$$$.\n\nIn the second test case, $$$a$$$ already contains only $$$0$$$s, so no operation is needed.\n\nIn the third test case, Evirir can change $$$a$$$ as follows: $$$[1, \\underline{0, 1, 0, 1}] \\to [\\underline{1, 2}] \\to [0]$$$. Here, $$$\\operatorname{mex}(0, 1, 0, 1) = 2$$$ and $$$\\operatorname{mex}(1, 2) = 0$$$.\n\nIn the fourth test case, Evirir can choose $$$b$$$ to be the entire array $$$a$$$, changing $$$a$$$ from $$$[\\underline{3, 1, 4, 1, 5}]$$$ to $$$[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": "2049A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: pspspsps\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Cats are attracted to pspspsps, but Evirir, being a dignified dragon, is only attracted to pspspsps with oddly specific requirements...\n\nGiven a string $$$s = s_1s_2\\ldots s_n$$$ of length $$$n$$$ consisting of characters p, s, and . (dot), determine whether a permutation$$$^{\\text{∗}}$$$ $$$p$$$ of length $$$n$$$ exists, such that for all integers $$$i$$$ ($$$1 \\le i \\le n$$$):\n\n- If $$$s_i$$$ is p, then $$$[p_1, p_2, \\ldots, p_i]$$$ forms a permutation (of length $$$i$$$);\n- If $$$s_i$$$ is s, then $$$[p_i, p_{i+1}, \\ldots, p_{n}]$$$ forms a permutation (of length $$$n-i+1$$$);\n- If $$$s_i$$$ is ., then there is no additional restriction.\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 500$$$), the length of $$$s$$$.\n\nThe second line of each test case contains a string $$$s$$$ of length $$$n$$$ that consists of the characters p, s, and ..\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$5000$$$.\n\nOutput: For each test case, output YES or NO on a line. Output YES if there is such a permutation 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:\n9\n4\ns.sp\n6\npss..s\n5\nppppp\n2\nsp\n4\n.sp.\n8\npsss....\n1\n.\n8\npspspsps\n20\n....................\noutput:\nYES\nNO\nYES\nYES\nNO\nNO\nYES\nNO\nYES\n\nNote: For the first test case, one permutation that works is $$$p = [3, 4, 1, 2]$$$. The restrictions are as follows:\n\n- $$$s_1 =$$$ s: $$$[p_1, p_2, p_3, p_4] = [3, 4, 1, 2]$$$ forms a permutation.\n- $$$s_2 =$$$ .: No additional restriction.\n- $$$s_3 =$$$ s: $$$[p_3, p_4] = [1, 2]$$$ forms a permutation.\n- $$$s_4 =$$$ p: $$$[p_1, p_2, p_3, p_4] = [3, 4, 1, 2]$$$ forms a permutation.\n\nFor the second test case, it can be proven that there is no permutation that satisfies all restrictions.\n\nFor the third test case, one permutation that satisfies the constraints is $$$p = [1, 2, 3, 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": "2049B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Shift + Esc\ntime_limit_ms: 2500\nmemory_limit_mb: 512\nDescription: After having fun with a certain contraption and getting caught, Evirir the dragon decides to put their magical skills to good use — warping reality to escape fast!\n\nYou are given a grid with $$$n$$$ rows and $$$m$$$ columns of non-negative integers and an integer $$$k$$$. Let $$$(i, j)$$$ denote the cell in the $$$i$$$-th row from the top and $$$j$$$-th column from the left ($$$1 \\le i \\le n$$$, $$$1 \\le j \\le m$$$). For every cell $$$(i, j)$$$, the integer $$$a_{i, j}$$$ is written on the cell $$$(i, j)$$$.\n\nYou are initially at $$$(1, 1)$$$ and want to go to $$$(n, m)$$$. You may only move down or right. That is, if you are at $$$(i, j)$$$, you can only move to $$$(i+1, j)$$$ or $$$(i, j+1)$$$ (if the corresponding cell exists).\n\nBefore you begin moving, you may do the following operation any number of times:\n\n- Choose an integer $$$i$$$ between $$$1$$$ and $$$n$$$ and cyclically shift row $$$i$$$ to the left by $$$1$$$. Formally, simultaneously set $$$a_{i,j}$$$ to $$$a_{i,(j \\bmod m) + 1}$$$ for all integers $$$j$$$ ($$$1 \\le j \\le m$$$).\n\nAfter moving from $$$(1, 1)$$$ to $$$(n, m)$$$, let $$$x$$$ be the number of operations you have performed before moving, and let $$$y$$$ be the sum of the integers written on visited cells (including $$$(1, 1)$$$ and $$$(n, m)$$$). Then the cost is defined as $$$kx + y$$$.\n\nFind the minimum cost to move from $$$(1, 1)$$$ to $$$(n, 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 contains three space-separated integers $$$n$$$, $$$m$$$, and $$$k$$$ ($$$1 \\leq n, m \\leq 200$$$, $$$0 \\leq k \\leq 10^9$$$).\n\nThen, $$$n$$$ lines follow. The $$$i$$$-th line contains $$$m$$$ space-separated integers, $$$a_{i,1},\\,a_{i,2},\\,\\ldots,\\,a_{i,m}$$$ ($$$0 \\leq a_{i,j} \\leq 10^9$$$).\n\nIt is guaranteed that the sum of $$$n \\cdot m$$$ over all test cases does not exceed $$$5 \\cdot 10^4$$$.\n\nOutput: For each test case, output a single integer, the minimum cost to move from $$$(1, 1)$$$ to $$$(n, m)$$$.\n\nExamples:\ninput:\n5\n3 3 100\n3 4 9\n5 2 4\n0 101 101\n3 4 1\n10 0 0 10\n0 0 10 0\n10 10 0 10\n1 1 3\n4\n3 2 3\n1 2\n3 6\n5 4\n10 10 14\n58 49 25 12 89 69 8 49 71 23\n45 27 65 59 36 100 73 23 5 84\n82 91 54 92 53 15 43 46 11 65\n61 69 71 87 67 72 51 42 55 80\n1 64 8 54 61 70 47 100 84 50\n86 93 43 51 47 35 56 20 33 61\n100 59 5 68 15 55 69 8 8 60\n33 61 20 79 69 51 23 24 56 28\n67 76 3 69 58 79 75 10 65 63\n6 64 73 79 17 62 55 53 61 58\noutput:\n113\n6\n4\n13\n618\n\nNote: In the first test case, the minimum cost of $$$113$$$ can be achieved as follows:\n\n1. Cyclically shift row 3 once. The grid now becomes $$$$$$\\begin{bmatrix}3 & 4 & 9\\\\5 & 2 & 4\\\\101 & 101 & 0\\end{bmatrix}.$$$$$$\n2. Move as follows: $$$(1, 1) \\to (1, 2) \\to (2, 2) \\to (2, 3) \\to (3, 3)$$$.\n\n$$$x = 1$$$ operation is done before moving. The sum of integers on visited cells is $$$y = 3 + 4 + 2 + 4 + 0 = 13$$$. Therefore, the cost is $$$kx + y = 100 \\cdot 1 + 13 = 113$$$.\n\nIn the second test case, one can shift row 1 once, row 2 twice, and row 3 thrice. Then, the grid becomes $$$$$$\\begin{bmatrix}0 & 0 & 10 & 10\\\\10 & 0 & 0 & 0\\\\10 & 10 & 10 & 0\\end{bmatrix}.$$$$$$\n\n$$$x = 6$$$ operations were done before moving, and there is a path of cost $$$y = 0$$$. Therefore, the cost is $$$6 \\cdot 1 + 0 = 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": "2049D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Broken Queries\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You, a wizard whose creation was destroyed by a dragon, are determined to hunt it down with a magical AOE tracker. But it seems to be toyed with...\n\nThis is an interactive problem.\n\nThere is a hidden binary array $$$a$$$ of length $$$n$$$ ($$$\\mathbf{n}$$$ is a power of 2) and a hidden integer $$$k\\ (2 \\le k \\le n - 1)$$$. The array $$$a$$$ contains exactly one 1 (and all other elements are 0). For two integers $$$l$$$ and $$$r$$$ ($$$1 \\le l \\le r \\le n$$$), define the range sum $$$s(l, r) = a_l + a_{l+1} + \\cdots + a_r$$$.\n\nYou have a magical device that takes ranges and returns range sums, but it returns the opposite result when the range has length at least $$$k$$$. Formally, in one query, you can give it a pair of integers $$$[l, r]$$$ where $$$1 \\le l \\le r \\le n$$$, and it will return either $$$0$$$ or $$$1$$$ according to the following rules:\n\n- If $$$r - l + 1 < k$$$, it will return $$$s(l, r)$$$.\n- If $$$r - l + 1 \\ge k$$$, it will return $$$1 - s(l, r)$$$.\n\nFind $$$k$$$ using at most $$$33$$$ queries.\n\nThe device is not adaptive. It means that the hidden $$$a$$$ and $$$k$$$ are fixed before the interaction and will not change during the interaction.\n\nInput: None\n\nOutput: None\n\nExamples:\ninput:\n2\n8\n\n0\n\n0\n\n1\n\n0\n\n4\n\n1\n\n0\noutput:\n? 3 5\n\n? 1 8\n\n? 4 8\n\n? 3 8\n\n! 6\n\n? 3 3\n\n? 3 4\n\n! 2\n\nNote: In the first test case, $$$k = 6$$$ and the 1 in the hidden array is at index 6, so $$$a = [0, 0, 0, 0, 0, 1, 0, 0]$$$.\n\n- For the query 3 5, since $$$5-3+1 = 3 < k$$$, the device answers correctly. Since 6 is not contained in the range $$$[3, 5]$$$, the device answers $$$0$$$.\n- For the query 1 8, since $$$8 - 1 + 1 = 8 \\ge k$$$, the device answers $$$0$$$ incorrectly.\n- For the query 4 8, since $$$8 - 4 + 1 = 5 < k$$$, the device answers $$$1$$$ correctly.\n- For the query 3 8, since $$$8 - 3 + 1 = 6 \\ge k$$$, the device answers $$$0$$$ incorrectly.\n\nIn the second test case, $$$k = 2$$$ and the 1 in the hidden array is at index 3, so $$$a = [0, 0, 1, 0]$$$.\n\nNote that the example solution may not have enough information to determine $$$k$$$ above; this is only an example.\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": "2049E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Twice\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Kinich wakes up to the start of a new day. He turns on his phone, checks his mailbox, and finds a mysterious present. He decides to unbox the present.\n\nKinich unboxes an array $$$a$$$ with $$$n$$$ integers. Initially, Kinich's score is $$$0$$$. He will perform the following operation any number of times:\n\n- Select two indices $$$i$$$ and $$$j$$$ $$$(1 \\leq i < j \\leq n)$$$ such that neither $$$i$$$ nor $$$j$$$ has been chosen in any previous operation and $$$a_i = a_j$$$. Then, add $$$1$$$ to his score.\n\nOutput the maximum score Kinich can achieve after performing the aforementioned operation any number of times.\n\nInput: The first line contains an integer $$$t$$$ ($$$1 \\leq t \\leq 500$$$) — the number of test cases.\n\nThe first line of each test case contains an integer $$$n$$$ ($$$1 \\leq n \\leq 20$$$) — the length of $$$a$$$.\n\nThe following line of each test case contains $$$n$$$ space-separated integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$1 \\leq a_i \\leq n$$$).\n\nOutput: For each test case, output the maximum score achievable on a new line.\n\nExamples:\ninput:\n5\n1\n1\n2\n2 2\n2\n1 2\n4\n1 2 3 1\n6\n1 2 3 1 2 3\noutput:\n0\n1\n0\n1\n3\n\nNote: In the first and third testcases, Kinich cannot perform any operations.\n\nIn the second testcase, Kinich can perform one operation with $$$i=1$$$ and $$$j=2$$$.\n\nIn the fourth testcase, Kinich can perform one operation with $$$i=1$$$ and $$$j=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": "2037A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Superultra's Favorite Permutation\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Superultra, a little red panda, desperately wants primogems. In his dreams, a voice tells him that he must solve the following task to obtain a lifetime supply of primogems. Help Superultra!\n\nConstruct a permutation$$$^{\\text{∗}}$$$ $$$p$$$ of length $$$n$$$ such that $$$p_i + p_{i+1}$$$ is composite$$$^{\\text{†}}$$$ over all $$$1 \\leq i \\leq n - 1$$$. If it's not possible, output $$$-1$$$.\n\nInput: The first line contains $$$t$$$ ($$$1 \\leq t \\leq 10^4$$$) — the number of test cases.\n\nEach test case contains an integer $$$n$$$ ($$$2 \\leq n \\leq 2 \\cdot 10^5$$$) — the length of the permutation.\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, if it's not possible to construct $$$p$$$, output $$$-1$$$ on a new line. Otherwise, output $$$n$$$ integers $$$p_1, p_2, \\ldots, p_n$$$ on a new line.\n\nExamples:\ninput:\n2\n3\n8\noutput:\n-1\n1 8 7 3 6 2 4 5\n\nNote: In the first example, it can be shown that all permutation of size $$$3$$$ contain two adjacent elements whose sum is prime. For example, in the permutation $$$[2,3,1]$$$ the sum $$$2+3=5$$$ is prime.\n\nIn the second example, we can verify that the sample output is correct because $$$1+8$$$, $$$8+7$$$, $$$7+3$$$, $$$3+6$$$, $$$6+2$$$, $$$2+4$$$, and $$$4+5$$$ are all composite. There may be other constructions that are correct.\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": "2037C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Sharky Surfing\ntime_limit_ms: 3000\nmemory_limit_mb: 256\nDescription: Mualani loves surfing on her sharky surfboard!\n\nMualani's surf path can be modeled by a number line. She starts at position $$$1$$$, and the path ends at position $$$L$$$. When she is at position $$$x$$$ with a jump power of $$$k$$$, she can jump to any integer position in the interval $$$[x, x+k]$$$. Initially, her jump power is $$$1$$$.\n\nHowever, her surf path isn't completely smooth. There are $$$n$$$ hurdles on her path. Each hurdle is represented by an interval $$$[l, r]$$$, meaning she cannot jump to any position in the interval $$$[l, r]$$$.\n\nThere are also $$$m$$$ power-ups at certain positions on the path. Power-up $$$i$$$ is located at position $$$x_i$$$ and has a value of $$$v_i$$$. When Mualani is at position $$$x_i$$$, she has the option to collect the power-up to increase her jump power by $$$v_i$$$. There may be multiple power-ups at the same position. When she is at a position with some power-ups, she may choose to take or ignore each individual power-up. No power-up is in the interval of any hurdle.\n\nWhat is the minimum number of power-ups she must collect to reach position $$$L$$$ to finish the path? If it is not possible to finish the surf path, output $$$-1$$$.\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 three integers $$$n$$$, $$$m$$$, and $$$L$$$ ($$$1 \\leq n, m \\leq 2 \\cdot 10^5, 3 \\leq L \\leq 10^9$$$) — the number of hurdles, the number of power-ups, and the position of the end.\n\nThe following $$$n$$$ lines contain two integers $$$l_i$$$ and $$$r_i$$$ ($$$2 \\leq l_i \\leq r_i \\leq L-1$$$) — the bounds of the interval for the $$$i$$$'th hurdle. It is guaranteed that $$$r_i + 1 < l_{i+1}$$$ for all $$$1 \\leq i < n$$$ (i.e. all hurdles are non-overlapping, sorted by increasing positions, and the end point of a previous hurdle is not consecutive with the start point of the next hurdle).\n\nThe following $$$m$$$ lines contain two integers $$$x_i$$$ and $$$v_i$$$ ($$$1 \\leq x_i, v_i \\leq L$$$) — the position and the value for the $$$i$$$'th power-up. There may be multiple power-ups with the same $$$x$$$. It is guaranteed that $$$x_i \\leq x_{i+1}$$$ for all $$$1 \\leq i < m$$$ (i.e. the power-ups are sorted by non-decreasing position) and no power-up is in the interval of any hurdle.\n\nIt is guaranteed the sum of $$$n$$$ and the sum of $$$m$$$ over all test cases does not exceed $$$2 \\cdot 10^5$$$.\n\nOutput: For each test case, output the minimum number of power-ups she must collect to reach position $$$L$$$. If it is not possible, output $$$-1$$$.\n\nExamples:\ninput:\n4\n2 5 50\n7 14\n30 40\n2 2\n3 1\n3 5\n18 2\n22 32\n4 3 50\n4 6\n15 18\n20 26\n34 38\n1 2\n8 2\n10 2\n1 4 17\n10 14\n1 6\n1 2\n1 2\n16 9\n1 2 10\n5 9\n2 3\n2 2\noutput:\n4\n-1\n1\n2\n\nNote: In the first test case, she can collect power-ups $$$1$$$, $$$2$$$, $$$3$$$, and $$$5$$$ to clear all hurdles.\n\nIn the second test case, she cannot jump over the first hurdle.\n\nIn the fourth test case, by collecting both power-ups, she can jump over the hurdle.\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": "2037D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Kachina's Favorite Binary String\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is an interactive problem.\n\nKachina challenges you to guess her favorite binary string$$$^{\\text{∗}}$$$ $$$s$$$ of length $$$n$$$. She defines $$$f(l, r)$$$ as the number of subsequences$$$^{\\text{†}}$$$ of $$$\\texttt{01}$$$ in $$$s_l s_{l+1} \\ldots s_r$$$. Two subsequences are considered different if they are formed by deleting characters from different positions in the original string, even if the resulting subsequences consist of the same characters.\n\nTo determine $$$s$$$, you can ask her some questions. In each question, you can choose two indices $$$l$$$ and $$$r$$$ ($$$1 \\leq l < r \\leq n$$$) and ask her for the value of $$$f(l, r)$$$.\n\nDetermine and output $$$s$$$ after asking Kachina no more than $$$n$$$ questions. However, it may be the case that $$$s$$$ is impossible to be determined. In this case, you would need to report $$$\\texttt{IMPOSSIBLE}$$$ instead.\n\nFormally, $$$s$$$ is impossible to be determined if after asking $$$n$$$ questions, there are always multiple possible strings for $$$s$$$, regardless of what questions are asked. Note that if you report $$$\\texttt{IMPOSSIBLE}$$$ when there exists a sequence of at most $$$n$$$ queries that will uniquely determine the binary string, you will get the Wrong Answer verdict.\n\nInput: The first line of input 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 a single integer $$$n$$$ ($$$2 \\leq n \\leq 10^4$$$) — the length of $$$s$$$.\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^4$$$.\n\nOutput: None\n\nExamples:\ninput:\n2\n5\n\n4\n\n0\n\n1\n\n2\n\n2\n\n0\noutput:\n? 1 5\n\n? 2 4\n\n? 4 5\n\n? 3 5\n\n! 01001\n\n? 1 2\n\n! IMPOSSIBLE\n\nNote: In the first test case:\n\nIn the first query, you ask Kachina for the value of $$$f(1, 5)$$$, and she responds with $$$4$$$ in the input stream.\n\nIn the second query, you ask Kachina for the value of $$$f(2, 4)$$$. Because there are no subsequences of $$$\\texttt{01}$$$ in the string $$$\\texttt{100}$$$, she responds with $$$0$$$ in the input stream.\n\nAfter asking $$$4$$$ questions, you report $$$\\texttt{01001}$$$ as $$$s$$$, and it is correct.\n\nIn the second test case:\n\nIn the first query, you ask Kachina for the value of $$$f(1, 2)$$$, and she responds with $$$0$$$ in the input stream. Notice that this is the only distinct question you can ask.\n\nHowever, notice that the strings $$$00$$$ and $$$11$$$ both have an answer of $$$0$$$, and it is impossible to differentiate between the two. Therefore, we report IMPOSSIBLE.\n\nPlease note that this example only serves to demonstrate the interaction format. It is not guaranteed the queries provided are optimal or uniquely determine the answer. However, it can be shown there exists a sequence of at most $$$5$$$ queries that does uniquely determine sample test case $$$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": "2037E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Ardent Flames\ntime_limit_ms: 4000\nmemory_limit_mb: 256\nDescription: You have obtained the new limited event character Xilonen. You decide to use her in combat.\n\nThere are $$$n$$$ enemies in a line. The $$$i$$$'th enemy from the left has health $$$h_i$$$ and is currently at position $$$x_i$$$. Xilonen has an attack damage of $$$m$$$, and you are ready to defeat the enemies with her.\n\nXilonen has a powerful \"ground stomp\" attack. Before you perform any attacks, you select an integer $$$p$$$ and position Xilonen there ($$$p$$$ can be any integer position, including a position with an enemy currently). Afterwards, for each attack, she deals $$$m$$$ damage to an enemy at position $$$p$$$ (if there are any), $$$m-1$$$ damage to enemies at positions $$$p-1$$$ and $$$p+1$$$, $$$m-2$$$ damage to enemies at positions $$$p-2$$$ and $$$p+2$$$, and so on. Enemies that are at least a distance of $$$m$$$ away from Xilonen take no damage from attacks.\n\nFormally, if there is an enemy at position $$$x$$$, she will deal $$$\\max(0,m - |p - x|)$$$ damage to that enemy each hit. Note that you may not choose a different $$$p$$$ for different attacks.\n\nOver all possible $$$p$$$, output the minimum number of attacks Xilonen must perform to defeat at least $$$k$$$ enemies. If it is impossible to find a $$$p$$$ such that eventually at least $$$k$$$ enemies will be defeated, output $$$-1$$$ instead. Note that an enemy is considered to be defeated if its health reaches $$$0$$$ or below.\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 three integers $$$n$$$, $$$m$$$, and $$$k$$$ ($$$1 \\leq k \\leq n \\leq 10^5$$$, $$$1 \\leq m \\leq 10^9$$$).\n\nThe following line contains $$$n$$$ integers $$$h_1, h_2, ..., h_n$$$ ($$$1 \\leq h_i \\leq 10^9$$$).\n\nThe last line of each testcase contains $$$n$$$ integers $$$x_1, x_2, ..., x_n$$$ ($$$1\\leq x_i \\leq 10^9$$$, $$$x_i < x_{i+1}$$$ for all $$$1 \\leq i < n$$$)\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 an integer on a new line, the minimum number of attacks that must be performed to defeat at least $$$k$$$ enemies. If it is impossible to find a $$$p$$$ such that eventually at least $$$k$$$ enemies will be defeated, output $$$-1$$$ instead.\n\nExamples:\ninput:\n6\n5 5 3\n7 7 7 7 7\n1 2 3 4 5\n9 5 9\n2 4 6 8 10 8 6 4 2\n1 2 3 4 5 6 7 8 9\n2 10 2\n1 1\n1 20\n2 10 1\n69696969 420420420\n1 20\n2 10 2\n10 15\n1 19\n2 2 2\n1000000000 1\n1 3\noutput:\n2\n2\n-1\n6969697\n15\n1000000000\n\nNote: In the first testcase, it is optimal to select $$$p=2$$$. Each attack, the first enemy takes $$$5-|2-1|=4$$$ damage, the second enemy takes $$$5$$$ damage, the third enemy takes $$$4$$$ damage, the fourth enemy takes $$$3$$$ damage, and the fifth enemy takes $$$2$$$ damage. After $$$2$$$ attacks, the first three enemies will be defeated. It can be shown that it is impossible to defeat $$$3$$$ enemies in less than $$$2$$$ attacks, no matter which $$$p$$$ is selected.\n\nIn the second testcase, we must kill all $$$9$$$ enemies. By selecting $$$p=5$$$, all nine enemies will be defeated in $$$2$$$ attacks.\n\nIn the third testcase, we must kill both enemies. However, it can be shown that no $$$p$$$ selected will damage both enemies at the same time, so the answer is $$$-1$$$.\n\nIn the fourth testcase, selecting $$$p=1$$$ will enable us to defeat the first enemy in $$$6969697$$$ attacks.\n\nIn the fifth testcase, selecting $$$p=10$$$ will make each enemy take $$$1$$$ damage per attack. Both enemies will be defeated in $$$15$$$ attacks.\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": "2037F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Natlan Exploring\ntime_limit_ms: 4000\nmemory_limit_mb: 256\nDescription: You are exploring the stunning region of Natlan! This region consists of $$$n$$$ cities, and each city is rated with an attractiveness $$$a_i$$$. A directed edge exists from City $$$i$$$ to City $$$j$$$ if and only if $$$i < j$$$ and $$$\\gcd(a_i,a_j)\\neq 1$$$, where $$$\\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$.\n\nStarting from City $$$1$$$, your task is to determine the total number of distinct paths you can take to reach City $$$n$$$, modulo $$$998\\,244\\,353$$$. Two paths are different if and only if the set of cities visited is different.\n\nInput: The first line contains an integer $$$n$$$ ($$$2 \\leq n \\leq 2 \\cdot 10^5$$$) — the number of cities.\n\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$2 \\leq a_i \\leq 10^6$$$) — the attractiveness of each city.\n\nOutput: Output the total number of distinct paths you can take to reach City $$$n$$$, modulo $$$998\\,244\\,353$$$.\n\nExamples:\ninput:\n5\n2 6 3 4 6\noutput:\n5\n\ninput:\n5\n4 196 2662 2197 121\noutput:\n2\n\ninput:\n7\n3 6 8 9 11 12 20\noutput:\n7\n\ninput:\n2\n2 3\noutput:\n0\n\nNote: In the first example, the five paths are the following:\n\n- City $$$1\\rightarrow$$$ City $$$5$$$\n- City $$$1\\rightarrow$$$ City $$$2\\rightarrow$$$ City $$$5$$$\n- City $$$1\\rightarrow$$$ City $$$2\\rightarrow$$$ City $$$3\\rightarrow$$$ City $$$5$$$\n- City $$$1\\rightarrow$$$ City $$$2\\rightarrow$$$ City $$$4\\rightarrow$$$ City $$$5$$$\n- City $$$1\\rightarrow$$$ City $$$4\\rightarrow$$$ City $$$5$$$\n\nIn the second example, the two paths are the following:\n\n- City $$$1\\rightarrow$$$ City $$$3\\rightarrow$$$ City $$$5$$$\n- City $$$1\\rightarrow$$$ City $$$2\\rightarrow$$$ City $$$3\\rightarrow$$$ City $$$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": "2037G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Line Breaks\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Kostya has a text $$$s$$$ consisting of $$$n$$$ words made up of Latin alphabet letters. He also has two strips on which he must write the text. The first strip can hold $$$m$$$ characters, while the second can hold as many as needed.\n\nKostya must choose a number $$$x$$$ and write the first $$$x$$$ words from $$$s$$$ on the first strip, while all the remaining words are written on the second strip. To save space, the words are written without gaps, but each word must be entirely on one strip.\n\nSince space on the second strip is very valuable, Kostya asks you to choose the maximum possible number $$$x$$$ such that all words $$$s_1, s_2, \\dots, s_x$$$ fit on the first strip of length $$$m$$$.\n\nInput: The first line contains an integer $$$t$$$ ($$$1 \\le t \\le 1000$$$) — the number of test cases.\n\nThe first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \\le n \\le 50$$$; $$$1 \\le m \\le 500$$$) — the number of words in the list and the maximum number of characters that can be on the first strip.\n\nThe next $$$n$$$ lines contain one word $$$s_i$$$ of lowercase Latin letters, where the length of $$$s_i$$$ does not exceed $$$10$$$.\n\nOutput: For each test case, output the maximum number of words $$$x$$$ such that the first $$$x$$$ words have a total length of no more than $$$m$$$.\n\nExamples:\ninput:\n5\n3 1\na\nb\nc\n2 9\nalpha\nbeta\n4 12\nhello\nworld\nand\ncodeforces\n3 2\nab\nc\nd\n3 2\nabc\nab\na\noutput:\n1\n2\n2\n1\n0\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": "2050A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Transfusion\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given an array $$$a$$$ of length $$$n$$$. In one operation, you can pick an index $$$i$$$ from $$$2$$$ to $$$n-1$$$ inclusive, and do one of the following actions:\n\n- Decrease $$$a_{i-1}$$$ by $$$1$$$, then increase $$$a_{i+1}$$$ by $$$1$$$.\n- Decrease $$$a_{i+1}$$$ by $$$1$$$, then increase $$$a_{i-1}$$$ by $$$1$$$.\n\nAfter each operation, all the values must be non-negative. Can you make all the elements equal after any number of operations?\n\nInput: First line of input consists of one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nFirst line of each test case consists of one integer $$$n$$$ ($$$3 \\le n \\le 2\\cdot 10^5$$$).\n\nSecond line of each test case consists of $$$n$$$ integers $$$a_i$$$ ($$$1 \\le a_i \\le 10^9$$$).\n\nIt is guaranteed that the sum of $$$n$$$ of all test cases doesn't exceed $$$2\\cdot 10^5$$$.\n\nOutput: For each test case, print \"YES\" without quotation marks if it is possible to make all the elements equal after any number of operations; otherwise, print \"NO\" without quotation marks.\n\nYou can print answers in any register: \"yes\", \"YeS\", \"nO\" — will also be considered correct.\n\nExamples:\ninput:\n8\n3\n3 2 1\n3\n1 1 3\n4\n1 2 5 4\n4\n1 6 6 1\n5\n6 2 1 4 2\n4\n1 4 2 1\n5\n3 1 2 1 3\n3\n2 4 2\noutput:\nYES\nNO\nYES\nNO\nYES\nNO\nNO\nNO\n\nNote: \n\n\n**Instructions:**\n- Focus on edge cases or scenarios that maximize the failure probability in faulty solutions.\n- Due to the output length limit, you should generate a **small-scale** test input that is **complete and valid**.\n- Output the test input directly, not code to generate it.\n\n\n**Output format:**\n```plaintext\n{test input}\n```\n\n\nThink step by step.",
"role": "user"
}
]
| TestCase-Eval-Task1 | TestCase-Eval | null | {
"problem_id": "2050B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Uninteresting Number\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given a number $$$n$$$ with a length of no more than $$$10^5$$$.\n\nYou can perform the following operation any number of times: choose one of its digits, square it, and replace the original digit with the result. The result must be a digit (that is, if you choose the digit $$$x$$$, then the value of $$$x^2$$$ must be less than $$$10$$$).\n\nIs it possible to obtain a number that is divisible by $$$9$$$ through these operations?\n\nInput: The first line contains an integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nThe only line of each test case contains the number $$$n$$$, without leading zeros. The length of the number does not exceed $$$10^5$$$.\n\nIt is guaranteed that the sum of the lengths of the numbers across all test cases does not exceed $$$10^5$$$.\n\nOutput: For each test case, output \"YES\" if it is possible to obtain a number divisible by $$$9$$$ using the described operations, 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:\n9\n123\n322\n333333333333\n9997\n5472778912773\n1234567890\n23\n33\n52254522632\noutput:\nNO\nYES\nYES\nNO\nNO\nYES\nNO\nYES\nYES\n\nNote: In the first example, from the integer $$$123$$$, it is possible to obtain only $$$123$$$, $$$143$$$, $$$129$$$, and $$$149$$$, none of which are divisible by $$$9$$$.\n\nIn the second example, you need to replace the second digit with its square; then $$$n$$$ will equal $$$342 = 38 \\cdot 9$$$.\n\nIn the third example, the integer is already divisible by $$$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": "2050C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Digital string maximization\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given a string $$$s$$$, consisting of digits from $$$0$$$ to $$$9$$$. In one operation, you can pick any digit in this string, except for $$$0$$$ or the leftmost digit, decrease it by $$$1$$$, and then swap it with the digit left to the picked.\n\nFor example, in one operation from the string $$$1023$$$, you can get $$$1103$$$ or $$$1022$$$.\n\nFind the lexicographically maximum string you can obtain after any number of operations.\n\nInput: The first line of the input consists of an integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nEach test case consists of a single line consisting of a digital string $$$s$$$ ($$$1 \\le |s| \\le 2\\cdot 10^5$$$), where $$$|s|$$$ denotes the length of $$$s$$$. The string does not contain leading zeroes.\n\nIt is guaranteed that the sum of $$$|s|$$$ of all test cases doesn't exceed $$$2\\cdot 10^5$$$.\n\nOutput: For each test case, print the answer on a separate line.\n\nExamples:\ninput:\n6\n19\n1709\n11555\n51476\n9876543210\n5891917899\noutput:\n81\n6710\n33311\n55431\n9876543210\n7875567711\n\nNote: In the first example, the following sequence of operations is suitable: $$$19 \\rightarrow 81$$$.\n\nIn the second example, the following sequence of operations is suitable: $$$1709 \\rightarrow 1780 \\rightarrow 6180 \\rightarrow 6710$$$.\n\nIn the fourth example, the following sequence of operations is suitable: $$$51476 \\rightarrow 53176 \\rightarrow 53616 \\rightarrow 53651 \\rightarrow 55351 \\rightarrow 55431$$$.\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": "2050D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Three Strings\ntime_limit_ms: 2500\nmemory_limit_mb: 256\nDescription: You are given three strings: $$$a$$$, $$$b$$$, and $$$c$$$, consisting of lowercase Latin letters. The string $$$c$$$ was obtained in the following way:\n\n1. At each step, either string $$$a$$$ or string $$$b$$$ was randomly chosen, and the first character of the chosen string was removed from it and appended to the end of string $$$c$$$, until one of the strings ran out. After that, the remaining characters of the non-empty string were added to the end of $$$c$$$.\n2. Then, a certain number of characters in string $$$c$$$ were randomly changed.\n\nFor example, from the strings $$$a=\\color{red}{\\text{abra}}$$$ and $$$b=\\color{blue}{\\text{cada}}$$$, without character replacements, the strings $$$\\color{blue}{\\text{ca}}\\color{red}{\\text{ab}}\\color{blue}{\\text{d}}\\color{red}{\\text{ra}}\\color{blue}{\\text{a}}$$$, $$$\\color{red}{\\text{abra}}\\color{blue}{\\text{cada}}$$$, $$$\\color{red}{\\text{a}}\\color{blue}{\\text{cada}}\\color{red}{\\text{bra}}$$$ could be obtained.\n\nFind the minimum number of characters that could have been changed in string $$$c$$$.\n\nInput: The first line of the input contains a single integer $$$t$$$ ($$$1 \\le t \\le 10^3$$$) — the number of test cases.\n\nThe first line of each test case contains one string of lowercase Latin letters $$$a$$$ ($$$1 \\leq |a| \\leq 10^3$$$) — the first string, where $$$|a|$$$ denotes the length of string $$$a$$$.\n\nThe second line of each test case contains one string of lowercase Latin letters $$$b$$$ ($$$1 \\leq |b| \\leq 10^3$$$) — the second string, where $$$|b|$$$ denotes the length of string $$$b$$$.\n\nThe third line of each test case contains one string of lowercase Latin letters $$$c$$$ ($$$|c| = |a| + |b|$$$) — the third string.\n\nIt is guaranteed that the sum of $$$|a|$$$ across all test cases does not exceed $$$2 \\cdot 10^3$$$. Also, the sum of $$$|b|$$$ across all test cases does not exceed $$$2 \\cdot 10^3$$$.\n\nOutput: For each test case, output a single integer — the minimum number of characters that could have been changed in string $$$c$$$.\n\nExamples:\ninput:\n7\na\nb\ncb\nab\ncd\nacbd\nab\nba\naabb\nxxx\nyyy\nxyxyxy\na\nbcd\ndecf\ncodes\nhorse\ncodeforces\negg\nannie\negaegaeg\noutput:\n1\n0\n2\n0\n3\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": "2050E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Maximum modulo equality\ntime_limit_ms: 5000\nmemory_limit_mb: 256\nDescription: You are given an array $$$a$$$ of length $$$n$$$ and $$$q$$$ queries $$$l$$$, $$$r$$$.\n\nFor each query, find the maximum possible $$$m$$$, such that all elements $$$a_l$$$, $$$a_{l+1}$$$, ..., $$$a_r$$$ are equal modulo $$$m$$$. In other words, $$$a_l \\bmod m = a_{l+1} \\bmod m = \\dots = a_r \\bmod m$$$, where $$$a \\bmod b$$$ — is the remainder of division $$$a$$$ by $$$b$$$. In particular, when $$$m$$$ can be infinite, print $$$0$$$.\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$$$, $$$q$$$ ($$$1 \\le n, q \\le 2\\cdot 10^5$$$) — the length of the array and the number of queries.\n\nThe second line of each test case contains $$$n$$$ integers $$$a_i$$$ ($$$1 \\le a_i \\le 10^9$$$) — the elements of the array.\n\nIn the following $$$q$$$ lines of each test case, two integers $$$l$$$, $$$r$$$ are provided ($$$1 \\le l \\le r \\le n$$$) — the range of the query.\n\nIt is guaranteed that the sum of $$$n$$$ across all test cases does not exceed $$$2\\cdot 10^5$$$, and the sum of $$$q$$$ does not exceed $$$2\\cdot 10^5$$$.\n\nOutput: For each query, output the maximum value $$$m$$$ described in the statement.\n\nExamples:\ninput:\n3\n5 5\n5 14 2 6 3\n4 5\n1 4\n2 4\n3 5\n1 1\n1 1\n7\n1 1\n3 2\n1 7 8\n2 3\n1 2\noutput:\n3 1 4 1 0 \n0 \n1 6\n\nNote: In the first query of the first sample, $$$6 \\bmod 3 = 3 \\bmod 3 = 0$$$. It can be shown that for greater $$$m$$$, the required condition will not be fulfilled.\n\nIn the third query of the first sample, $$$14 \\bmod 4 = 2 \\bmod 4 = 6 \\bmod 4 = 2$$$. It can be shown that for greater $$$m$$$, the required condition will not be fulfilled.\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": "2050F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Tree Destruction\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Given a tree$$$^{\\text{∗}}$$$ with $$$n$$$ vertices. You can choose two vertices $$$a$$$ and $$$b$$$ once and remove all vertices on the path from $$$a$$$ to $$$b$$$, including the vertices themselves. If you choose $$$a=b$$$, only one vertex will be removed.\n\nYour task is to find the maximum number of connected components$$$^{\\text{†}}$$$ that can be formed after removing the path from the tree.\n\nInput: The first line of the input contains one integer $$$t$$$ ($$$1 \\le t \\le 10^4$$$) — the number of test cases.\n\nThe first line of each test case contains one integer $$$n$$$ ($$$2 \\le n \\le 2 \\cdot 10^5$$$) — the size of the tree.\n\nThe next $$$n-1$$$ lines contain two integers $$$u$$$ and $$$v$$$ ($$$1 \\le u, v \\le n$$$, $$$u \\ne v$$$) — the vertices connected by an edge. It is guaranteed that the edges form a tree.\n\nIt is guaranteed that the sum of $$$n$$$ across all test cases does not exceed $$$2 \\cdot 10^5$$$.\n\nOutput: For each test case, output one integer — the maximum number of connected components that can be achieved using the described operation.\n\nExamples:\ninput:\n6\n2\n1 2\n5\n1 2\n2 3\n3 4\n3 5\n4\n1 2\n2 3\n3 4\n5\n2 1\n3 1\n4 1\n5 4\n6\n2 1\n3 1\n4 1\n5 3\n6 3\n6\n2 1\n3 2\n4 2\n5 3\n6 4\noutput:\n1\n3\n2\n3\n4\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": "2050G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Genokraken\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is an interactive problem.\n\nUpon clearing the Waterside Area, Gretel has found a monster named Genokraken, and she's keeping it contained for her scientific studies.\n\nThe monster's nerve system can be structured as a tree$$$^{\\dagger}$$$ of $$$n$$$ nodes (really, everything should stop resembling trees all the time$$$\\ldots$$$), numbered from $$$0$$$ to $$$n-1$$$, with node $$$0$$$ as the root.\n\nGretel's objective is to learn the exact structure of the monster's nerve system — more specifically, she wants to know the values $$$p_1, p_2, \\ldots, p_{n-1}$$$ of the tree, where $$$p_i$$$ ($$$0 \\le p_i < i$$$) is the direct parent node of node $$$i$$$ ($$$1 \\le i \\le n - 1$$$).\n\nShe doesn't know exactly how the nodes are placed, but she knows a few convenient facts:\n\n- If we remove root node $$$0$$$ and all adjacent edges, this tree will turn into a forest consisting of only paths$$$^{\\ddagger}$$$. Each node that was initially adjacent to the node $$$0$$$ will be the end of some path.\n- The nodes are indexed in a way that if $$$1 \\le x \\le y \\le n - 1$$$, then $$$p_x \\le p_y$$$.\n- Node $$$1$$$ has exactly two adjacent nodes (including the node $$$0$$$).\n\nThe tree in this picture does not satisfy the condition, because if we remove node $$$0$$$, then node $$$2$$$ (which was initially adjacent to the node $$$0$$$) will not be the end of the path $$$4-2-5$$$.The tree in this picture does not satisfy the condition, because $$$p_3 \\le p_4$$$ must hold.The tree in this picture does not satisfy the condition, because node $$$1$$$ has only one adjacent node.\n\nGretel can make queries to the containment cell:\n\n- \"? a b\" ($$$1 \\le a, b < n$$$, $$$a \\ne b$$$) — the cell will check if the simple path between nodes $$$a$$$ and $$$b$$$ contains the node $$$0$$$.\n\nHowever, to avoid unexpected consequences by overstimulating the creature, Gretel wants to query at most $$$2n - 6$$$ times. Though Gretel is gifted, she can't do everything all at once, so can you give her a helping hand?\n\n$$$^{\\dagger}$$$A tree is a connected graph where every pair of distinct nodes has exactly one simple path connecting them.\n\n$$$^{\\ddagger}$$$A path is a tree whose vertices can be listed in the order $$$v_1, v_2, \\ldots, v_k$$$ such that the edges are $$$(v_i, v_{i+1})$$$ ($$$1 \\le i < k$$$).\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$$$ ($$$4 \\le n \\le 10^4$$$) — the number of nodes in Genokraken's nerve system.\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^4$$$.\n\nOutput: None\n\nExamples:\ninput:\n3\n4\n\n1\n\n5\n\n1\n\n0\n\n9\noutput:\n? 2 3\n\n! 0 0 1\n\n? 2 3\n\n? 2 4\n\n! 0 0 1 2\n\n! 0 0 0 1 3 5 6 7\n\nNote: In the first test case, Genokraken's nerve system forms the following tree:\n\n- The answer to \"? 2 3\" is $$$1$$$. This means that the simple path between nodes $$$2$$$ and $$$3$$$ contains node $$$0$$$.\n\nIn the second test case, Genokraken's nerve system forms the following tree:\n\n- The answer to \"? 2 3\" is $$$1$$$. This means that the simple path between nodes $$$2$$$ and $$$3$$$ contains node $$$0$$$.\n- The answer to \"? 2 4\" is $$$0$$$. This means that the simple path between nodes $$$2$$$ and $$$4$$$ doesn't contain node $$$0$$$.\n\nIn the third test case, Genokraken's nerve system forms the following tree:\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": "2032D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Kevin and Combination Lock\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Kevin is trapped in Lakeside Village by Grace. At the exit of the village, there is a combination lock that can only be unlocked if Kevin solves it.\n\nThe combination lock starts with an integer $$$ x $$$. Kevin can perform one of the following two operations zero or more times:\n\n1. If $$$ x \\neq 33 $$$, he can select two consecutive digits $$$ 3 $$$ from $$$ x $$$ and remove them simultaneously. For example, if $$$ x = 13\\,323 $$$, he can remove the second and third $$$ 3 $$$, changing $$$ x $$$ to $$$ 123 $$$.\n2. If $$$ x \\geq 33 $$$, he can change $$$ x $$$ to $$$ x - 33 $$$. For example, if $$$ x = 99 $$$, he can choose this operation to change $$$ x $$$ to $$$ 99 - 33 = 66 $$$.\n\nWhen the value of $$$ x $$$ on the combination lock becomes $$$ 0 $$$, Kevin can unlock the lock and escape from Lakeside Village. Please determine whether it is possible for Kevin to unlock the combination lock and escape.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \\le t \\le 10^4$$$).\n\nThe only line of each test case contains a positive integer $$$x$$$ ($$$1\\leq x\\leq 10^9$$$).\n\nOutput: For each test case, output \"YES\" or \"NO\" (without quotes) in one line, representing whether Kevin can unlock the combination lock and escape. You can output the answer in any case (upper or lower). For example, the strings \"yEs\", \"yes\", \"Yes\", and \"YES\" will be recognized as positive responses.\n\nExamples:\ninput:\n5\n165\n6369\n666\n114514\n133333332\noutput:\nYES\nYES\nNO\nNO\nYES\n\nNote: For the first test case, $$$165\\xrightarrow{-33}132\\xrightarrow{-33}99\\xrightarrow{-33}66\\xrightarrow{-33}33\\xrightarrow{-33}0$$$.\n\nFor the second test case, $$$6369\\xrightarrow{-33}6{\\color{red}{33}}6\\xrightarrow{\\text{remove \"33\"}}66\\xrightarrow{-33}33\\xrightarrow{-33}0$$$.\n\nFor the third test case, it can be proven that, regardless of the operations performed, $$$666$$$ cannot be transformed into $$$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": "2048A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Kevin and Competition Memories\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Kevin used to get into Rio's Memories, and in Rio's Memories, a series of contests was once held. Kevin remembers all the participants and all the contest problems from that time, but he has forgotten the specific rounds, the distribution of problems, and the exact rankings.\n\nThere are $$$ m $$$ problems in total, with the $$$ i $$$-th problem having a difficulty of $$$ b_i $$$. Let each contest consist of $$$ k $$$ problems, resulting in a total of $$$ \\lfloor \\frac{m}{k} \\rfloor $$$ contests. This means that you select exactly $$$ \\lfloor \\frac{m}{k} \\rfloor \\cdot k $$$ problems for the contests in any combination you want, with each problem being selected at most once, and the remaining $$$m\\bmod k$$$ problems are left unused. For example, if $$$m = 17$$$ and $$$k = 3$$$, you should create exactly $$$5$$$ contests consisting of $$$3$$$ problems each, and exactly $$$2$$$ problems will be left unused.\n\nThere are $$$ n $$$ participants in the contests, with Kevin being the $$$1$$$-st participant. The $$$ i $$$-th participant has a rating of $$$ a_i $$$. During the contests, each participant solves all problems with a difficulty not exceeding their rating, meaning the $$$ i $$$-th participant solves the $$$ j $$$-th problem if and only if $$$ a_i \\geq b_j $$$. In each contest, Kevin's rank is one plus the number of participants who solve more problems than he does.\n\nFor each $$$ k = 1, 2, \\ldots, m $$$, Kevin wants to know the minimum sum of his ranks across all $$$ \\lfloor \\frac{m}{k} \\rfloor $$$ contests. In other words, for some value of $$$k$$$, after selecting the problems for each contest, you calculate the rank of Kevin in each contest and sum up these ranks over all $$$ \\lfloor \\frac{m}{k} \\rfloor $$$ contests. Your goal is to minimize this value.\n\nNote that contests for different values of $$$k$$$ are independent. It means that for different values of $$$k$$$, you can select the distribution of problems into the contests independently.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $$$ t $$$ ($$$ 1 \\le t \\le 5\\cdot 10^4 $$$).\n\nThe first line of each test case contains two integers $$$ n $$$ and $$$ m $$$ ($$$ 1 \\le n, m \\leq 3\\cdot 10^5 $$$) — the number of participants and the number of problems.\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 rating of each participant.\n\nThe third line of each test case contains $$$ m $$$ integers $$$ b_1, b_2, \\ldots, b_m $$$ ($$$ 0 \\le b_i \\le 10^9 $$$) — the difficulty of each problem.\n\nIt is guaranteed that both the sum of $$$ n $$$ and the sum of $$$ m $$$ over all test cases do not exceed $$$ 3 \\cdot 10^5 $$$.\n\nOutput: For each test case, output $$$m$$$ integers — the minimum sum of Kevin's ranks for each $$$ k = 1, 2, \\ldots, m$$$.\n\nExamples:\ninput:\n4\n4 4\n4 3 7 5\n2 5 4 6\n5 5\n5 0 4 8 6\n1 3 9 2 7\n6 7\n1 1 4 5 1 4\n1 9 1 9 8 1 0\n7 6\n1 9 1 9 8 1 0\n1 1 4 5 1 4\noutput:\n7 4 2 3\n6 2 1 1 2\n7 3 2 1 1 1 1\n15 9 5 4 4 4\n\nNote: For the first test case:\n\nWhen $$$k=1$$$, since each contest only contains one problem, the distribution is in fact unique. For example, in the contest which only includes the third problem (which has a difficulty of $$$4$$$), all participants except the $$$2$$$-nd can solve it. Since no one solves strictly more problems than Kevin, his ranking in this contest is $$$1$$$. Similarly, in all $$$4$$$ contests, Kevin's rankings are $$$1,3,1,2$$$, and the sum is $$$7$$$.\n\nWhen $$$k=2$$$, one optimal way is to choose the $$$1$$$-st and the $$$3$$$-rd problem to form a contest, while the $$$2$$$-nd and $$$4$$$-th for another. In the former contest, $$$4$$$ participants respectively solve $$$2,1,2,2$$$ problems, so Kevin's ranking is $$$1$$$; in the latter one, they respectively solve $$$0,0,2,1$$$, since there are $$$2$$$ participants ($$$3$$$-rd and $$$4$$$-th) solve more problems than Kevin, his ranking is $$$1+2=3$$$. Thus the answer is $$$1+3=4$$$. It can be proven that there's no way to achieve a lower sum.\n\nWhen $$$k=3$$$, we can simply choose the $$$1$$$-st, the $$$3$$$-rd, and the $$$4$$$-th problem to make a contest, and Kevin has a ranking of $$$2$$$, which is optimal.\n\nWhen $$$k=4$$$, since there's only one contest, the distribution is also unique, and Kevin's ranking 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": "2048D",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Library of Magic\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is an interactive problem.\n\nThe Department of Supernatural Phenomena at the Oxenfurt Academy has opened the Library of Magic, which contains the works of the greatest sorcerers of Redania — $$$n$$$ ($$$3 \\leq n \\leq 10^{18}$$$) types of books, numbered from $$$1$$$ to $$$n$$$. Each book's type number is indicated on its spine. Moreover, each type of book is stored in the library in exactly two copies! And you have been appointed as the librarian.\n\nOne night, you wake up to a strange noise and see a creature leaving the building through a window. Three thick tomes of different colors were sticking out of the mysterious thief's backpack. Before you start searching for them, you decide to compute the numbers $$$a$$$, $$$b$$$, and $$$c$$$ written on the spines of these books. All three numbers are distinct.\n\nSo, you have an unordered set of tomes, which includes one tome with each of the pairwise distinct numbers $$$a$$$, $$$b$$$, and $$$c$$$, and two tomes for all numbers from $$$1$$$ to $$$n$$$, except for $$$a$$$, $$$b$$$, and $$$c$$$. You want to find these values $$$a$$$, $$$b$$$, and $$$c$$$.\n\nSince you are not working in a simple library, but in the Library of Magic, you can only use one spell in the form of a query to check the presence of books in their place:\n\n- \"xor l r\" — Bitwise XOR query with parameters $$$l$$$ and $$$r$$$. Let $$$k$$$ be the number of such tomes in the library whose numbers are greater than or equal to $$$l$$$ and less than or equal to $$$r$$$. You will receive the result of the computation $$$v_1 \\oplus v_2 \\oplus ... \\oplus v_k$$$, where $$$v_1 ... v_k$$$ are the numbers on the spines of these tomes, and $$$\\oplus$$$ denotes the operation of bitwise exclusive OR.\n\nSince your magical abilities as a librarian are severely limited, you can make no more than $$$150$$$ queries.\n\nInput: The first line of input contains an integer $$$t$$$ ($$$1 \\le t \\le 300$$$) — the number of test cases.\n\nThe first line of each test case contains a single integer $$$n$$$ ($$$3 \\leq n \\leq 10^{18}$$$) — the number of types of tomes.\n\nOutput: None\n\nExamples:\ninput:\n2\n6\n\n0\n\n2\n\n3\n\n5\n\n3\noutput:\nxor 1 1\n\nxor 2 2\n\nxor 3 3\n\nxor 4 6\n\nans 2 3 5\n\nans 1 2 3\n\nNote: In the first test case, the books in the library after the theft look like this:\n\nNow consider the answers to the queries:\n\n- For the query \"xor 1 1\", you receive the result $$$1 \\oplus 1 = 0$$$. Two tomes satisfy the condition specified in the query — both with the number $$$1$$$.\n- For the query \"xor 2 2\", you receive the result $$$2$$$, as only one tome satisfies the specified condition.\n- For the query \"xor 3 3\", you receive the result $$$3$$$.\n- For the query \"xor 4 6\", you receive the result $$$4 \\oplus 6 \\oplus 4 \\oplus 5 \\oplus 6 = 5$$$.\n\nIn the second test case, there are only $$$3$$$ types of books, and it is easy to guess that the missing ones have the numbers $$$1$$$, $$$2$$$, and $$$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": "2036G",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Paint a Strip\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: You have an array of zeros $$$a_1, a_2, \\ldots, a_n$$$ of length $$$n$$$.\n\nYou can perform two types of operations on it:\n\n1. Choose an index $$$i$$$ such that $$$1 \\le i \\le n$$$ and $$$a_i = 0$$$, and assign $$$1$$$ to $$$a_i$$$;\n2. Choose a pair of indices $$$l$$$ and $$$r$$$ such that $$$1 \\le l \\le r \\le n$$$, $$$a_l = 1$$$, $$$a_r = 1$$$, $$$a_l + \\ldots + a_r \\ge \\lceil\\frac{r - l + 1}{2}\\rceil$$$, and assign $$$1$$$ to $$$a_i$$$ for all $$$l \\le i \\le r$$$.\n\nWhat is the minimum number of operations of the first type needed to make all elements of the array equal to one?\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 one integer $$$n$$$ ($$$1 \\le n \\le 10^5$$$) — the length of the array.\n\nNote that there is no limit on the sum of $$$n$$$ over all test cases.\n\nOutput: For each test case, print one integer — the minimum number of needed operations of first type.\n\nExamples:\ninput:\n4\n1\n2\n4\n20\noutput:\n1\n2\n2\n4\n\nNote: In the first test case, you can perform an operation of the $$$1$$$st type with $$$i = 1$$$.\n\nIn the second test case, you can perform the following sequence of operations:\n\n1. Operation of $$$1$$$st type, $$$i = 1$$$. After performing this operation, the array will look like this: $$$[1, 0]$$$.\n2. Operation of $$$1$$$st type, $$$i = 2$$$. After performing this operation, the array will look like this: $$$[1, 1]$$$.\n\nThe sequence of operations in the second test case\n\nIn the third test case, you can perform the following sequence of operations:\n\n1. Operation of $$$1$$$st type, $$$i = 1$$$. After performing this operation, the array will look like this: $$$[1, 0, 0, 0]$$$.\n2. Operation of $$$1$$$st type, $$$i = 4$$$. After performing this operation, the array will look like this: $$$[1, 0, 0, 1]$$$.\n3. Operation of $$$2$$$nd type, $$$l = 1$$$, $$$r = 4$$$. On this segment, $$$a_l + \\ldots + a_r = a_1 + a_2 + a_3 + a_4 = 2$$$, which is not less than $$$\\lceil\\frac{r - l + 1}{2}\\rceil = 2$$$. After performing this operation, the array will look like this: $$$[1, 1, 1, 1]$$$.\n\nThe sequence of operations in the third test case\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": "2040B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Ordered Permutations\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Consider a permutation$$$^{\\text{∗}}$$$ $$$p_1, p_2, \\ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$. We can introduce the following sum for it$$$^{\\text{†}}$$$:\n\n$$$$$$S(p) = \\sum_{1 \\le l \\le r \\le n} \\min(p_l, p_{l + 1}, \\ldots, p_r)$$$$$$\n\nLet us consider all permutations of length $$$n$$$ with the maximum possible value of $$$S(p)$$$. Output the $$$k$$$-th of them in lexicographical$$$^{\\text{‡}}$$$order, or report that there are less than $$$k$$$ of them.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \\le t \\le 10^4$$$). The description of the test cases follows.\n\nThe only line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \\le n \\le 2 \\cdot 10^5$$$; $$$1 \\le k \\le 10^{12}$$$) — the length of the permutation and the index number of the desired permutation.\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, if there are less than $$$k$$$ suitable permutations, print $$$-1$$$.\n\nOtherwise, print the $$$k$$$-th suitable permutation.\n\nExamples:\ninput:\n6\n3 2\n3 3\n4 11\n4 6\n6 39\n7 34\noutput:\n1 3 2 \n2 3 1 \n-1\n2 4 3 1 \n-1\n2 3 4 5 7 6 1\n\nNote: Let us calculate the required sum for all permutations of length $$$3$$$ (ordered lexicographically):\n\nPermutationValue of $$$S(p)$$$$$$[1, 2, 3]$$$$$$10$$$$$$[1, 3, 2]$$$$$$10$$$$$$[2, 1, 3]$$$$$$9$$$$$$[2, 3, 1]$$$$$$10$$$$$$[3, 1, 2]$$$$$$9$$$$$$[3, 2, 1]$$$$$$10$$$\n\nIn the first test case, you have to print the second suitable permutation of length $$$3$$$. Looking at the table, we see that it is the permutation $$$[1, 3, 2]$$$.\n\nIn the second test case, you have to print the third suitable permutation of length $$$3$$$. Looking at the table, we see that it is the permutation $$$[2, 3, 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": "2040C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Control of Randomness\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: You are given a tree with $$$n$$$ vertices.\n\nLet's place a robot in some vertex $$$v \\ne 1$$$, and suppose we initially have $$$p$$$ coins. Consider the following process, where in the $$$i$$$-th step (starting from $$$i = 1$$$):\n\n- If $$$i$$$ is odd, the robot moves to an adjacent vertex in the direction of vertex $$$1$$$;\n- Else, $$$i$$$ is even. You can either pay one coin (if there are some left) and then the robot moves to an adjacent vertex in the direction of vertex $$$1$$$, or not pay, and then the robot moves to an adjacent vertex chosen uniformly at random.\n\nThe process stops as soon as the robot reaches vertex $$$1$$$. Let $$$f(v, p)$$$ be the minimum possible expected number of steps in the process above if we spend our coins optimally.\n\nAnswer $$$q$$$ queries, in the $$$i$$$-th of which you have to find the value of $$$f(v_i, p_i)$$$, modulo$$$^{\\text{∗}}$$$ $$$998\\,244\\,353$$$.\n\nInput: Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \\le t \\le 10^3$$$). The description of the test cases follows.\n\nThe first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$2 \\le n \\le 2 \\cdot 10^3$$$; $$$1 \\le q \\le 2 \\cdot 10^3$$$) — the number of vertices in the tree and the number of queries.\n\nThe next $$$n - 1$$$ lines contain the edges of the tree, one edge per line. The $$$i$$$-th line contains two integers $$$u_i$$$ and $$$v_i$$$ ($$$1 \\le u_i, v_i \\le n$$$; $$$u_i \\neq v_i$$$), denoting the edge between the nodes $$$u_i$$$ and $$$v_i$$$.\n\nThe next $$$q$$$ lines contain two integers $$$v_i$$$ and $$$p_i$$$ ($$$2 \\le v_i \\le n$$$; $$$0 \\le p_i \\le n$$$).\n\nIt's guaranteed that the given edges form a tree.\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \\cdot 10 ^ 3$$$.\n\nIt is guaranteed that the sum of $$$q$$$ over all test cases does not exceed $$$2 \\cdot 10 ^ 3$$$.\n\nOutput: For each test case, print $$$q$$$ integers: the values of $$$f(v_i, p_i)$$$ modulo $$$998\\,244\\,353$$$.\n\nFormally, let $$$M = 998\\,244\\,353$$$. 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\nExamples:\ninput:\n2\n4 4\n1 2\n2 3\n2 4\n2 0\n3 0\n4 0\n3 1\n12 10\n1 2\n2 3\n2 4\n1 5\n5 6\n6 7\n6 8\n6 9\n8 10\n10 11\n10 12\n6 0\n9 0\n10 0\n11 0\n3 1\n7 1\n10 1\n12 1\n12 2\n11 12\noutput:\n1\n6\n6\n2\n4\n9\n8\n15\n2\n3\n6\n9\n5\n5\n\nNote: The tree in the first test case:\n\nIn the first query, the expected value is equal to $$$1$$$, since the robot starts moving from vertex $$$2$$$ to vertex $$$1$$$ in the first step and the process stops.\n\nLet's calculate the expected value in the second query ($$$x$$$ is the number of steps):\n\n- $$$P(x < 2) = 0$$$, the distance to vertex $$$1$$$ is $$$2$$$ and the robot cannot reach it in fewer steps.\n- $$$P(x = 2) = \\frac{1}{3}$$$, since there is only one sequence of steps leading to $$$x = 2$$$. This is $$$3 \\rightarrow_{1} 2 \\rightarrow_{0.33} 1$$$ with probability $$$1 \\cdot \\frac{1}{3}$$$.\n- $$$P(x \\bmod 2 = 1) = 0$$$, since the robot can reach vertex $$$1$$$ by only taking an even number of steps.\n- $$$P(x = 4) = \\frac{2}{9}$$$: possible paths $$$3 \\rightarrow_{1} 2 \\rightarrow_{0.67} [3, 4] \\rightarrow_{1} 2 \\rightarrow_{0.33} 1$$$.\n- $$$P(x = 6) = \\frac{4}{27}$$$: possible paths $$$3 \\rightarrow_{1} 2 \\rightarrow_{0.67} [3, 4] \\rightarrow_{1} 2 \\rightarrow_{0.67} [3, 4] \\rightarrow_{1} 2 \\rightarrow_{0.33} 1$$$.\n- $$$P(x = i \\cdot 2) = \\frac{2^{i - 1}}{3^i}$$$ in the general case.\n\nAs a result, $$$f(v, p) = \\sum\\limits_{i=1}^{\\infty}{i \\cdot 2 \\cdot \\frac{2^{i - 1}}{3^i}} = 6$$$.\n\nThe tree in the second test case:\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": "2040E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Asesino (Easy Version)\ntime_limit_ms: 2500\nmemory_limit_mb: 256\nDescription: This is the easy version of the problem. In this version, you can ask at most $$$n+69$$$ questions. You can make hacks only if both versions of the problem are solved.\n\nThis is an interactive problem.\n\nIt is a tradition in Mexico's national IOI trainings to play the game \"Asesino\", which is similar to \"Among Us\" or \"Mafia\".\n\nToday, $$$n$$$ players, numbered from $$$1$$$ to $$$n$$$, will play \"Asesino\" with the following three roles:\n\n- Knight: a Knight is someone who always tells the truth.\n- Knave: a Knave is someone who always lies.\n- Impostor: an Impostor is someone everybody thinks is a Knight, but is secretly a Knave.\n\nEach player will be assigned a role in the game. There will be exactly one Impostor but there can be any (possible zero) number of Knights and Knaves.\n\nAs the game moderator, you have accidentally forgotten the roles of everyone, but you need to determine the player who is the Impostor.\n\nTo determine the Impostor, you will ask some questions. In each question, you will pick two players $$$i$$$ and $$$j$$$ ($$$1 \\leq i, j \\leq n$$$; $$$i \\neq j$$$) and ask if player $$$i$$$ thinks that player $$$j$$$ is a Knight. The results of the question is shown in the table below.\n\nKnightKnaveImpostorKnightYesNoYesKnaveNoYesNoImpostorNoYes— The response of the cell in row $$$a$$$ and column $$$b$$$ is the result of asking a question when $$$i$$$ has role $$$a$$$ and $$$j$$$ has row $$$b$$$. For example, the \"Yes\" in the top right cell belongs to row \"Knight\" and column \"Impostor\", so it is the response when $$$i$$$ is a Knight and $$$j$$$ is an Impostor.\n\nFind the Impostor in at most $$$n + 69$$$ questions.\n\nNote: the grader is adaptive: the roles of the players are not fixed in the beginning and may change depending on your questions. However, it is guaranteed that there exists an assignment of roles that is consistent with all previously asked questions under the constraints of this problem.\n\nInput: The first line of input contains a single integer $$$t$$$ ($$$1 \\leq t \\leq 10^3$$$) — 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$$$ ($$$3 \\le n \\le 10^5$$$) — the number of people playing the game.\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.\n\nOutput: None\n\nExamples:\ninput:\n2\n7\n\n1\n\n0\n\n0\n\n1\n\n1\n\n0\n\n0\n\n1\n\n4\n\n0\n\n1\n\n1\n\n1\noutput:\n? 1 3\n\n? 7 6\n\n? 2 5\n\n? 6 2\n\n? 4 5\n\n? 4 6\n\n? 1 4\n\n? 2 4\n\n! 4\n\n? 1 2\n\n? 2 3\n\n? 3 4\n\n? 4 1\n\n! 3\n\nNote: Note that the example test cases do not represent an optimal strategy for asking questions and are only shown for the sake of demonstrating the interaction format. Specifically, we cannot determine which player is the Impostor from the questions asked in the examples.\n\nIn the first test case of the example, players at indices $$$2$$$ and $$$6$$$ are Knights, players at indices $$$1$$$, $$$3$$$, $$$5$$$, and $$$7$$$ are Knaves, and the Impostor is at index $$$4$$$. The following is an explanation of the questions asked:\n\n- In the first query, player $$$i$$$ is a Knave and player $$$j$$$ is a Knave. The answer is \"yes\" since Knaves always lie.\n- In the second query, player $$$i$$$ is a Knave and player $$$j$$$ is a Knight. The answer is \"no\" since Knaves always lie.\n- In the third query, player $$$i$$$ is a Knight and player $$$j$$$ is a Knave. The answer is \"no\" since Knights always tell the truth.\n- In the fourth query, player $$$i$$$ is a Knight and player $$$j$$$ is a Knight. The answer is \"yes\" since Knights always tell the truth.\n- In the fifth query, player $$$i$$$ is a Impostor and player $$$j$$$ is a Knave. The answer is \"yes\" since the Impostor always lies.\n- In the sixth query, player $$$i$$$ is a Impostor and player $$$j$$$ is a Knight. The answer is \"no\" since the Impostor always lies.\n- In the seventh query, player $$$i$$$ is a Knave and player $$$j$$$ is a Impostor. The answer is \"no\" since Knaves always lie and Knaves thinks that the Impostor is a Knight.\n- In the eighth query, player $$$i$$$ is a Knight and player $$$j$$$ is a Impostor. The answer is \"yes\" since Knights always tell the truth and Knights think that the Impostor is a Knight.\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": "2022D1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Password Cracking\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Dimash learned that Mansur wrote something very unpleasant about him to a friend, so he decided to find out his password at all costs and discover what exactly he wrote.\n\nBelieving in the strength of his password, Mansur stated that his password — is a binary string of length $$$n$$$. He is also ready to answer Dimash's questions of the following type:\n\nDimash says a binary string $$$t$$$, and Mansur replies whether it is true that $$$t$$$ is a substring of his password.\n\nHelp Dimash find out the password in no more than $$$2n$$$ operations; otherwise, Mansur will understand the trick and stop communicating with him.\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\nOutput: None\n\nExamples:\ninput:\n4\n3\n\n0\n\n0\n\n1\n\n4\n\n4\n\n2\noutput:\n? 00\n\n? 000\n\n? 010\n\n! 010\n\n! 1100\n\n! 0110\n\n! 10\n\nNote: In the first example, the string $$$010$$$ is given. Therefore, the answers to the queries are as follows:\n\n\"? 00\" $$$00$$$ is not a substring of $$$010$$$, so the answer is $$$0$$$.\n\n\"? 000\" $$$000$$$ is not a substring, so the answer is $$$0$$$.\n\n\"? 010\" $$$010$$$ is a substring, so the answer is $$$1$$$.\n\nIn the second example, the string is $$$1100$$$, in the third $$$0110$$$, and in the fourth $$$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": "2013C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Easy Problem\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Cube is given an integer $$$n$$$. She wants to know how many ordered pairs of positive integers $$$(a,b)$$$ there are such that $$$a=n-b$$$. Since Cube is not very good at math, please help her!\n\nInput: The first line contains an integer $$$t$$$ ($$$1 \\leq t \\leq 99$$$) — the number of test cases.\n\nThe only line of each test case contains an integer $$$n$$$ ($$$2 \\leq n \\leq 100$$$).\n\nOutput: For each test case, output the number of ordered pairs $$$(a, b)$$$ on a new line.\n\nExamples:\ninput:\n3\n2\n4\n6\noutput:\n1\n3\n5\n\nNote: In the first test case, the only ordered pair that works is $$$(a,b)=(1,1)$$$.\n\nIn the second test case, the three ordered pairs of $$$(a,b)$$$ that work are $$$(3,1), (2,2), (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": "2044A",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Normal Problem\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: A string consisting of only characters 'p', 'q', and 'w' is painted on a glass window of a store. Ship walks past the store, standing directly in front of the glass window, and observes string $$$a$$$. Ship then heads inside the store, looks directly at the same glass window, and observes string $$$b$$$.\n\nShip gives you string $$$a$$$. Your job is to find and output $$$b$$$.\n\nInput: The first line contains an integer $$$t$$$ ($$$1 \\leq t \\leq 100$$$) — the number of test cases.\n\nThe only line of each test case contains a string $$$a$$$ ($$$1 \\leq |a| \\leq 100$$$) — the string Ship observes from outside the store. It is guaranteed that $$$a$$$ only contains characters 'p', 'q', and 'w'.\n\nOutput: For each test case, output string $$$b$$$, the string Ship observes from inside the store, on a new line.\n\nExamples:\ninput:\n5\nqwq\nppppp\npppwwwqqq\nwqpqwpqwwqp\npqpqpqpq\noutput:\npwp\nqqqqq\npppwwwqqq\nqpwwpqwpqpw\npqpqpqpq\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": "2044B",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Hard Problem\ntime_limit_ms: 1000\nmemory_limit_mb: 256\nDescription: Ball is the teacher in Paperfold University. The seats of his classroom are arranged in $$$2$$$ rows with $$$m$$$ seats each.\n\nBall is teaching $$$a + b + c$$$ monkeys, and he wants to assign as many monkeys to a seat as possible. Ball knows that $$$a$$$ of them only want to sit in row $$$1$$$, $$$b$$$ of them only want to sit in row $$$2$$$, and $$$c$$$ of them have no preference. Only one monkey may sit in each seat, and each monkey's preference must be followed if it is seated.\n\nWhat is the maximum number of monkeys that Ball can seat?\n\nInput: The first line contains an integer $$$t$$$ ($$$1 \\leq t \\leq 10^4$$$) — the number of test cases.\n\nEach test case contains four integers $$$m$$$, $$$a$$$, $$$b$$$, and $$$c$$$ ($$$1 \\leq m, a, b, c \\leq 10^8$$$).\n\nOutput: For each test case, output the maximum number of monkeys you can seat.\n\nExamples:\ninput:\n5\n10 5 5 10\n3 6 1 1\n15 14 12 4\n1 1 1 1\n420 6 9 69\noutput:\n20\n5\n30\n2\n84\n\nNote: In the second test case, $$$6$$$ monkeys want to sit in the front row, but only $$$3$$$ seats are available. The monkeys that have no preference and the monkeys who prefer sitting in the second row can sit in the second row together. Thus, the answer is $$$3+2=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": "2044C",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Insane Problem\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: Wave is given five integers $$$k$$$, $$$l_1$$$, $$$r_1$$$, $$$l_2$$$, and $$$r_2$$$. Wave wants you to help her count the number of ordered pairs $$$(x, y)$$$ such that all of the following are satisfied:\n\n- $$$l_1 \\leq x \\leq r_1$$$.\n- $$$l_2 \\leq y \\leq r_2$$$.\n- There exists a non-negative integer $$$n$$$ such that $$$\\frac{y}{x} = k^n$$$.\n\nInput: The first line contains an integer $$$t$$$ ($$$1 \\leq t \\leq 10^4$$$) — the number of test cases.\n\nThe only line of each test case contains five integers $$$k$$$, $$$l_1$$$, $$$r_1$$$, $$$l_2$$$, and $$$r_2$$$ ($$$2 \\leq k \\leq 10^9, 1 \\leq l_1 \\leq r_1 \\leq 10^9, 1 \\leq l_2 \\leq r_2 \\leq 10^9$$$).\n\nOutput: For each test case, output the number of matching ordered pairs $$$(x, y)$$$ on a new line.\n\nExamples:\ninput:\n5\n2 2 6 2 12\n2 1 1000000000 1 1000000000\n3 5 7 15 63\n1000000000 1 5 6 1000000000\n15 17 78 2596 20914861\noutput:\n12\n1999999987\n6\n1\n197\n\nNote: In the third test case, the matching ordered pairs are the following:\n\n- $$$(5,15)$$$\n- $$$(5,45)$$$\n- $$$(6,18)$$$\n- $$$(6,54)$$$\n- $$$(7,21)$$$\n- $$$(7,63)$$$\n\nIn the fourth test case, the only valid ordered pair is $$$(1,1\\,000\\,000\\,000)$$$\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": "2044E",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Easy Demon Problem\ntime_limit_ms: 4000\nmemory_limit_mb: 256\nDescription: For an arbitrary grid, Robot defines its beauty to be the sum of elements in the grid.\n\nRobot gives you an array $$$a$$$ of length $$$n$$$ and an array $$$b$$$ of length $$$m$$$. You construct a $$$n$$$ by $$$m$$$ grid $$$M$$$ such that $$$M_{i,j}=a_i\\cdot b_j$$$ for all $$$1 \\leq i \\leq n$$$ and $$$1 \\leq j \\leq m$$$.\n\nThen, Robot gives you $$$q$$$ queries, each consisting of a single integer $$$x$$$. For each query, determine whether or not it is possible to perform the following operation exactly once so that $$$M$$$ has a beauty of $$$x$$$:\n\n1. Choose integers $$$r$$$ and $$$c$$$ such that $$$1 \\leq r \\leq n$$$ and $$$1 \\leq c \\leq m$$$\n2. Set $$$M_{i,j}$$$ to be $$$0$$$ for all ordered pairs $$$(i,j)$$$ such that $$$i=r$$$, $$$j=c$$$, or both.\n\nNote that queries are not persistent, meaning that you do not actually set any elements to $$$0$$$ in the process — you are only required to output if it is possible to find $$$r$$$ and $$$c$$$ such that if the above operation is performed, the beauty of the grid will be $$$x$$$. Also, note that you must perform the operation for each query, even if the beauty of the original grid is already $$$x$$$.\n\nInput: The first line contains three integers $$$n$$$, $$$m$$$, and $$$q$$$ ($$$1 \\leq n,m \\leq 2\\cdot 10^5, 1 \\leq q \\leq 5\\cdot 10^4$$$) — the length of $$$a$$$, the length of $$$b$$$, and the number of queries respectively.\n\nThe second line contains $$$n$$$ integers $$$a_1, a_2, \\ldots, a_n$$$ ($$$0 \\leq |a_i| \\leq n$$$).\n\nThe third line contains $$$m$$$ integers $$$b_1, b_2, \\ldots, b_m$$$ ($$$0 \\leq |b_i| \\leq m$$$).\n\nThe following $$$q$$$ lines each contain a single integer $$$x$$$ ($$$1 \\leq |x| \\leq 2\\cdot 10^5$$$), the beauty of the grid you wish to achieve by setting all elements in a row and a column to $$$0$$$.\n\nOutput: For each testcase, output \"YES\" (without quotes) if there is a way to perform the aforementioned operation such that the beauty is $$$x$$$, and \"NO\" (without quotes) otherwise.\n\nYou can output \"YES\" and \"NO\" in any case (for example, strings \"yES\", \"yes\" and \"Yes\" will be recognized as a positive response).\n\nExamples:\ninput:\n3 3 6\n-2 3 -3\n-2 2 -1\n-1\n1\n-2\n2\n-3\n3\noutput:\nNO\nYES\nNO\nNO\nYES\nNO\n\ninput:\n5 5 6\n1 -2 3 0 0\n0 -2 5 0 -3\n4\n-3\n5\n2\n-1\n2\noutput:\nYES\nYES\nYES\nYES\nNO\nYES\n\nNote: In the second example, the grid is\n\n0 -2 5 0 -3\n\n0 4 -10 0 6\n\n0 -6 15 0 -9\n\n0 0 0 0 0\n\n0 0 0 0 0\n\nBy performing the operation with $$$r=4$$$ and $$$c=2$$$, we create the following grid:\n\n0 0 5 0 -3\n\n0 0 -10 0 6\n\n0 0 15 0 -9\n\n0 0 0 0 0\n\n0 0 0 0 0\n\nwhich has beauty $$$4$$$. Thus, we output YES.\n\nIn the second query, selecting $$$r=3$$$ and $$$c=5$$$ creates a grid with beauty $$$-3$$$.\n\nIn the third query, selecting $$$r=3$$$ and $$$c=3$$$ creates a grid with beauty $$$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": "2044F",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Medium Demon Problem (easy version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the easy version of the problem. The key difference between the two versions is highlighted in bold.\n\nA group of $$$n$$$ spiders has come together to exchange plushies. Initially, each spider has $$$1$$$ plushie. Every year, if spider $$$i$$$ has at least one plushie, he will give exactly one plushie to spider $$$r_i$$$. Otherwise, he will do nothing. Note that all plushie transfers happen at the same time. In this version, if any spider has more than $$$1$$$ plushie at any point in time, they will throw all but $$$1$$$ away.\n\nThe process is stable in the current year if each spider has the same number of plushies (before the current year's exchange) as he did the previous year (before the previous year's exchange). Note that year $$$1$$$ can never be stable.\n\nFind the first year in which the process becomes stable.\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$$$ ($$$2 \\leq n \\leq 2 \\cdot 10^5$$$) — the number of spiders.\n\nThe following line contains $$$n$$$ integers $$$r_1, r_2, \\ldots, r_n$$$ ($$$1 \\leq r_i \\leq n, r_i \\neq i$$$) — the recipient of the plushie of each spider.\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 an integer on a new line, the first year in which the process becomes stable.\n\nExamples:\ninput:\n5\n2\n2 1\n5\n2 3 4 5 1\n5\n2 1 4 2 3\n5\n4 1 1 5 4\n10\n4 3 9 1 6 7 9 10 10 3\noutput:\n2\n2\n5\n4\n5\n\nNote: For the second test case:\n\n- At year $$$1$$$, the following array shows the number of plushies each spider has: $$$[1, 1, 1, 1, 1]$$$. Then, year $$$1$$$'s exchange happens.\n- At year $$$2$$$, the following array shows the number of plushies each spider has: $$$[1, 1, 1, 1, 1]$$$. Since this array is the same as the previous year, this year is stable.\n\nFor the third test case:\n\n- At year $$$1$$$, the following array shows the number of plushies each spider has: $$$[1, 1, 1, 1, 1]$$$. Then, year $$$1$$$'s exchange happens.\n- At year $$$2$$$, the following array shows the number of plushies each spider has: $$$[1, 1, 1, 1, 0]$$$. Then, year $$$2$$$'s exchange happens. Note that even though two spiders gave spider $$$2$$$ plushies, spider $$$2$$$ may only keep one plushie.\n- At year $$$3$$$, the following array shows the number of plushies each spider has: $$$[1, 1, 0, 1, 0]$$$. Then, year $$$3$$$'s exchange happens.\n- At year $$$4$$$, the following array shows the number of plushies each spider has: $$$[1, 1, 0, 0, 0]$$$. Then, year $$$4$$$'s exchange happens.\n- At year $$$5$$$, the following array shows the number of plushies each spider has: $$$[1, 1, 0, 0, 0]$$$. Since this array is the same as the previous year, this year is stable.\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": "2044G1",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Medium Demon Problem (hard version)\ntime_limit_ms: 2000\nmemory_limit_mb: 256\nDescription: This is the hard version of the problem. The key difference between the two versions is highlighted in bold.\n\nA group of $$$n$$$ spiders has come together to exchange plushies. Initially, each spider has $$$1$$$ plushie. Every year, if spider $$$i$$$ has at least one plushie, he will give exactly one plushie to spider $$$r_i$$$. Otherwise, he will do nothing. Note that all plushie transfers happen at the same time. In this version, each spider is allowed to have more than 1 plushie at any point in time.\n\nThe process is stable in the current year if each spider has the same number of plushies (before the current year's exchange) as he did the previous year (before the previous year's exchange). Note that year $$$1$$$ can never be stable.\n\nFind the first year in which the process becomes stable.\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$$$ ($$$2 \\leq n \\leq 2 \\cdot 10^5$$$) — the number of spiders.\n\nThe following line contains $$$n$$$ integers $$$r_1, r_2, \\ldots, r_n$$$ ($$$1 \\leq r_i \\leq n, r_i \\neq i$$$) — the recipient of the plushie of each spider.\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 an integer on a new line, the first year in which the process becomes stable.\n\nExamples:\ninput:\n5\n2\n2 1\n5\n2 3 4 5 1\n5\n2 1 4 2 3\n5\n4 1 1 5 4\n10\n4 3 9 1 6 7 9 10 10 3\noutput:\n2\n2\n5\n5\n5\n\nNote: For the second test case:\n\n- At year $$$1$$$, the following array shows the number of plushies each spider has: $$$[1, 1, 1, 1, 1]$$$. Then, year $$$1$$$'s exchange happens.\n- At year $$$2$$$, the following array shows the number of plushies each spider has: $$$[1, 1, 1, 1, 1]$$$. Since this array is the same as the previous year, this year is stable.\n\nFor the third test case:\n\n- At year $$$1$$$, the following array shows the number of plushies each spider has: $$$[1, 1, 1, 1, 1]$$$. Then, year $$$1$$$'s exchange happens.\n- At year $$$2$$$, the following array shows the number of plushies each spider has: $$$[1, 2, 1, 1, 0]$$$. Then, year $$$2$$$'s exchange happens.\n- At year $$$3$$$, the following array shows the number of plushies each spider has: $$$[1, 3, 0, 1, 0]$$$. Then, year $$$3$$$'s exchange happens.\n- At year $$$4$$$, the following array shows the number of plushies each spider has: $$$[1, 4, 0, 0, 0]$$$. Then, year $$$4$$$'s exchange happens.\n- At year $$$5$$$, the following array shows the number of plushies each spider has: $$$[1, 4, 0, 0, 0]$$$. Since this array is the same as the previous year, this year is stable.\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": "2044G2",
"task_type": "TestCase-Eval-Task1"
} |
[
{
"content": "**Task:**\nGenerate a challenging test input for the algorithm problem:\nTitle: Hard Demon Problem\ntime_limit_ms: 3500\nmemory_limit_mb: 512\nDescription: Swing is opening a pancake factory! A good pancake factory must be good at flattening things, so Swing is going to test his new equipment on 2D matrices.\n\nSwing is given an $$$n \\times n$$$ matrix $$$M$$$ containing positive integers. He has $$$q$$$ queries to ask you.\n\nFor each query, he gives you four integers $$$x_1$$$, $$$y_1$$$, $$$x_2$$$, $$$y_2$$$ and asks you to flatten the submatrix bounded by $$$(x_1, y_1)$$$ and $$$(x_2, y_2)$$$ into an array $$$A$$$. Formally, $$$A = [M_{(x1,y1)}, M_{(x1,y1+1)}, \\ldots, M_{(x1,y2)}, M_{(x1+1,y1)}, M_{(x1+1,y1+1)}, \\ldots, M_{(x2,y2)}]$$$.\n\nThe following image depicts the flattening of a submatrix bounded by the red dotted lines. The orange arrows denote the direction that the elements of the submatrix are appended to the back of $$$A$$$, and $$$A$$$ is shown at the bottom of the image.\n\nAfterwards, he asks you for the value of $$$\\sum_{i=1}^{|A|} A_i \\cdot i$$$ (sum of $$$A_i \\cdot i$$$ over all $$$i$$$).\n\nInput: The first line contains an integer $$$t$$$ ($$$1 \\leq t \\leq 10^3$$$) — the number of test cases.\n\nThe first line of each test contains two integers $$$n$$$ and $$$q$$$ ($$$1 \\leq n \\leq 2000, 1 \\leq q \\leq 10^6$$$) — the length of $$$M$$$ and the number of queries.\n\nThe following $$$n$$$ lines contain $$$n$$$ integers each, the $$$i$$$'th of which contains $$$M_{(i,1)}, M_{(i,2)}, \\ldots, M_{(i,n)}$$$ ($$$1 \\leq M_{(i, j)} \\leq 10^6$$$).\n\nThe following $$$q$$$ lines contain four integers $$$x_1$$$, $$$y_1$$$, $$$x_2$$$, and $$$y_2$$$ ($$$1 \\leq x_1 \\leq x_2 \\leq n, 1 \\leq y_1 \\leq y_2 \\leq n$$$) — the bounds of the query.\n\nIt is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2000$$$ and the sum of $$$q$$$ over all test cases does not exceed $$$10^6$$$.\n\nOutput: For each test case, output the results of the $$$q$$$ queries on a new line.\n\nExamples:\ninput:\n2\n4 3\n1 5 2 4\n4 9 5 3\n4 5 2 3\n1 5 5 2\n1 1 4 4\n2 2 3 3\n1 2 4 3\n3 3\n1 2 3\n4 5 6\n7 8 9\n1 1 1 3\n1 3 3 3\n2 2 2 2\noutput:\n500 42 168 \n14 42 5\n\nNote: In the second query of the first test case, $$$A = [9, 5, 5, 2]$$$. Therefore, the sum is $$$1 \\cdot 9 + 2 \\cdot 5 + 3 \\cdot 5 + 4 \\cdot 2 = 42$$$.\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": "2044H",
"task_type": "TestCase-Eval-Task1"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.