data_source
stringclasses
1 value
prompt
listlengths
2
2
ability
stringclasses
1 value
reward_model
dict
extra_info
dict
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given two integers $x$ and $y$.\n\nOutput two integers: the minimum of $x$ and $y$, followed by the maximum of $x$ and $y$.\n\nInput F...
code
{ "ground_truth": [ { "input": "10\n1 9\n8 4\n1 4\n3 4\n2 0\n2 4\n6 9\n3 3\n0 0\n9 9", "metadata": { "func_name": null }, "output": "1 9\n4 8\n1 4\n3 4\n0 2\n2 4\n6 9\n3 3\n0 0\n9 9", "testtype": "stdin" } ], "style": "rule" }
{ "index": 0, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given a string $s$ consisting of lowercase English letters.\n\nRearrange the characters of $s$ to form a new string $r$ that is not eq...
code
{ "ground_truth": [ { "input": "8\ncodeforces\naaaaa\nxxxxy\nco\nd\nnutdealer\nmwistht\nhhhhhhhhhh", "metadata": { "func_name": null }, "output": "YES\nforcodesec\nNO\nYES\nxxyxx\nYES\noc\nNO\nYES\nundertale\nYES\nthtsiwm\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 1, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThere is a clock labeled with the numbers $1$ through $12$ in clockwise order, as shown below.\n\n![](CDN_BASE_URL/d18290022594db5fbc2eb2c9422...
code
{ "ground_truth": [ { "input": "15\n2 9 10 6\n3 8 9 1\n1 2 3 4\n5 3 4 12\n1 8 2 10\n3 12 11 8\n9 10 12 1\n12 1 10 2\n3 12 6 9\n1 9 8 4\n6 7 9 12\n7 12 9 6\n10 12 11 1\n3 9 6 12\n1 4 3 5", "metadata": { "func_name": null }, "output": "YES\nNO\nNO\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO\nYES\nYES\nYES\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 2, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given a binary string$^{\\dagger}$. Please find the minimum number of pieces you need to cut it into, so that the resulting pieces can...
code
{ "ground_truth": [ { "input": "6\n11010\n00000000\n1\n10\n0001111\n0110", "metadata": { "func_name": null }, "output": "3\n1\n1\n2\n1\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 3, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nTimur is in a car traveling on the number line from point $0$ to point $n$. The car starts moving from point $0$ at minute $0$.\n\nThere are $...
code
{ "ground_truth": [ { "input": "4\n10 1 3\n10\n10\n0\n6\n7\n10 2 4\n4 10\n4 7\n6\n4\n2\n7\n1000000000 1 1\n1000000000\n1000000000\n99999999\n6 1 3\n6\n5\n2\n6\n5", "metadata": { "func_name": null }, "output": "0 6 7 \n5 4 2 5 \n99999999 \n1 5 4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 4, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nGiven an integer $r$, find the number of lattice points that have a Euclidean distance from $(0, 0)$ greater than or equal to $r$ but strictly...
code
{ "ground_truth": [ { "input": "6\n1\n2\n3\n4\n5\n1984", "metadata": { "func_name": null }, "output": "8\n16\n20\n24\n40\n12504", "testtype": "stdin" } ], "style": "rule" }
{ "index": 5, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given an array $a$ consisting of $n$ nonnegative integers.\n\nYou can swap the elements at positions $i$ and $j$ if $a_i~\\mathsf{XOR}...
code
{ "ground_truth": [ { "input": "4\n4\n1 0 3 2\n5\n2 7 1 5 6\n8\n1 2 1 2 1 2 1 2\n4\n16 4 1 64", "metadata": { "func_name": null }, "output": "0 1 2 3 \n1 5 2 6 7 \n1 1 1 1 2 2 2 2 \n16 4 1 64", "testtype": "stdin" } ], "style": "rule" }
{ "index": 6, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nBob has a grid with $3$ rows and $n$ columns, each of which contains either $a_i$ or $-a_i$ for some integer $1 \\leq i \\leq n$. For example,...
code
{ "ground_truth": [ { "input": "4\n4\n1 -2 -3 -2\n-4 4 -1 -3\n1 2 -2 4\n2\n1 2\n-1 -2\n2 -2\n5\n1 2 3 4 5\n-2 3 -4 -5 -1\n3 -5 1 2 2\n6\n1 3 -6 2 5 2\n1 3 -2 -3 -6 -5\n-2 -1 -3 2 3 1", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 7, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nA contest contains $n$ problems and the difficulty of the $i$-th problem is expected to be at most $b_i$. There are already $n$ problem propos...
code
{ "ground_truth": [ { "input": "2\n6\n1000 1400 2000 2000 2200 2700\n800 1200 1500 1800 2200 3000\n6\n4 5 6 7 8 9\n1 2 3 4 5 6", "metadata": { "func_name": null }, "output": "2\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 8, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThere are $n$ coins on the table forming a circle, and each coin is either facing up or facing down. Alice and Bob take turns to play the foll...
code
{ "ground_truth": [ { "input": "3\n5\nUUDUD\n5\nUDDUD\n2\nUU", "metadata": { "func_name": null }, "output": "YES\nNO\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 9, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou have some cards. An integer between $1$ and $n$ is written on each card: specifically, for each $i$ from $1$ to $n$, you have $a_i$ cards ...
code
{ "ground_truth": [ { "input": "8\n1 10\n1\n2 4\n8 4\n3 4\n6 1 8\n3 9\n7 6 2\n5 3\n6 6 7 4 6\n9 7\n7 6 1 7 6 2 4 3 3\n10 10\n1 3 1 2 1 9 3 5 7 5\n9 8\n5 8 7 5 1 3 2 9 8", "metadata": { "func_name": null }, "output": "11\n15\n15\n22\n28\n32\n28\n36", "testtype": "stdin" } ], "style": "rule" }
{ "index": 10, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThe two versions are different problems. You may want to read both versions. You can make hacks only if both versions are solved.\n\nYou are g...
code
{ "ground_truth": [ { "input": "6\n1 1\n2 3\n3 5\n10 8\n100 1233\n1000000 1145141", "metadata": { "func_name": null }, "output": "1\n3\n4\n14\n153\n1643498", "testtype": "stdin" } ], "style": "rule" }
{ "index": 11, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThe two versions are different problems. You may want to read both versions. You can make hacks only if both versions are solved.\n\nYou are g...
code
{ "ground_truth": [ { "input": "6\n1 1\n2 3\n3 5\n10 8\n100 1233\n1000000 1145141", "metadata": { "func_name": null }, "output": "0\n1\n1\n6\n423\n5933961", "testtype": "stdin" } ], "style": "rule" }
{ "index": 12, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nLet $\\operatorname{lowbit}(x)$ denote the value of the lowest binary bit of $x$, e.g. $\\operatorname{lowbit}(12)=4$, $\\operatorname{lowbit}...
code
{ "ground_truth": [ { "input": "2\n8 1\n1 2 1 4 1 2 1 8\n6 2\n1 4 3 17 5 16", "metadata": { "func_name": null }, "output": "1 1 1 1 1 1 1 1\n1 2 3 4 5 6", "testtype": "stdin" } ], "style": "rule" }
{ "index": 13, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nLittle R is a magician who likes non-decreasing arrays. She has an array of length $n$, initially as $a_1, \\ldots, a_n$, in which each elemen...
code
{ "ground_truth": [ { "input": "3\n5 8\n1 6 3 7 1\n2 3 5 8 7 1 5 6\n3 3\n1 3 2\n2 1 3\n10 10\n2 8 5 4 8 4 1 5 10 10\n6 7 2 6 3 4 1 1 3 5", "metadata": { "func_name": null }, "output": "3\n-1\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 14, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThree friends gathered to play a few games of chess together.\n\nIn every game, two of them play against each other. The winner gets $2$ point...
code
{ "ground_truth": [ { "input": "7\n0 0 0\n0 1 1\n1 1 1\n1 1 2\n3 3 3\n3 4 5\n1 1 10", "metadata": { "func_name": null }, "output": "0\n1\n-1\n2\n-1\n6\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 15, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nToday, Cat and Fox found an array $a$ consisting of $n$ non-negative integers.\n\nDefine the loneliness of $a$ as the smallest positive intege...
code
{ "ground_truth": [ { "input": "7\n1\n0\n3\n2 2 2\n3\n1 0 2\n5\n3 0 1 4 2\n5\n2 0 4 0 2\n7\n0 0 0 0 1 2 4\n8\n0 1 3 2 2 1 0 3", "metadata": { "func_name": null }, "output": "1\n1\n3\n4\n4\n7\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 16, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nFox loves permutations! She came up with the following problem and asked Cat to solve it:\n\nYou are given an even positive integer $n$ and a ...
code
{ "ground_truth": [ { "input": "4\n4\n1 2 3 4\n4\n4 3 1 2\n6\n6 5 1 4 2 3\n8\n1 2 4 5 7 6 8 3", "metadata": { "func_name": null }, "output": "2 4 1 3\n3 1 4 2\n2 5 1 4 3 6\n5 4 8 2 7 1 6 3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 17, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThis is an interactive problem.\n\nFox gave Cat two positive integers $n$ and $k$. She has a hidden array $a_1, \\ldots , a_n$ of length $n$, ...
code
{ "ground_truth": [ { "input": "3\n1 1\n\n1\n2 2\n\n1\n\n3\n\n1\n6 3\n\n7\n\n2\n\n3\n\n6\n\n1", "metadata": { "func_name": null }, "output": "! 1\n\n\n? 1 1\n\n? 2 1\n\n! -1\n\n\n? 1 9\n\n? 1 6\n\n? 3 6\n\n? 4 6\n\n! 6", "testtype": "stdin" } ], "style": "rule" }
{ "index": 18, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nFox has found an array $p_1, p_2, \\ldots, p_n$, that is a permutation of length $n^\\dagger$ of the numbers $1, 2, \\ldots, n$. She wants to ...
code
{ "ground_truth": [ { "input": "7\n2\n2 1\n3\n3 1 2\n4\n3 2 1 4\n5\n5 3 1 2 4\n5\n1 2 3 4 5\n6\n3 2 1 5 4 6\n6\n1 3 2 4 5 6", "metadata": { "func_name": null }, "output": "6\n11\n23\n29\n55\n46\n58", "testtype": "stdin" } ], "style": "rule" }
{ "index": 19, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nFor $k$ positive integers $x_1, x_2, \\ldots, x_k$, the value $\\gcd(x_1, x_2, \\ldots, x_k)$ is the greatest common divisor of the integers $...
code
{ "ground_truth": [ { "input": "3 4\n1 2 3\n4 5 6\n1 1 1\n0 1 2 3", "metadata": { "func_name": null }, "output": "2 3 3 3", "testtype": "stdin" }, { "input": "5 5\n3 4 6 8 4\n8 3 4 9 3\n10 20 30 40 50\n5 55 13 1000 113", "metadata": { "func_name": null }, "output": "2 7 3 7 7", "testtype": "stdin" }, { "input": "1 1\n3\n4\n5\n0", "metadata": { "func_name": null }, "output": "7", "testtype": "stdin" } ], "style": "rule" }
{ "index": 20, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nLittle Rosie has a phone with a desktop (or launcher, as it is also called). The desktop can consist of several screens. Each screen is repres...
code
{ "ground_truth": [ { "input": "11\n1 1\n7 2\n12 4\n0 3\n1 0\n8 1\n0 0\n2 0\n15 0\n8 2\n0 9", "metadata": { "func_name": null }, "output": "1\n1\n2\n2\n1\n1\n0\n1\n1\n2\n5", "testtype": "stdin" } ], "style": "rule" }
{ "index": 21, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nPolycarp has a string $s$, which consists of lowercase Latin letters. He encodes this string using the following algorithm:\n\n * first, he c...
code
{ "ground_truth": [ { "input": "5\n10\nserofedsoc\n3\nttf\n9\ntlrhgmaoi\n1\nw\n15\nhnndledmnhlttin", "metadata": { "func_name": null }, "output": "codeforces\nfft\nalgorithm\nw\nmeetinthemiddle", "testtype": "stdin" } ], "style": "rule" }
{ "index": 22, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nPolycarp was given an array $a$ of $n$ integers. He really likes triples of numbers, so for each $j$ ($1 \\le j \\le n - 2$) he wrote down a t...
code
{ "ground_truth": [ { "input": "8\n5\n3 2 2 2 3\n5\n1 2 1 2 1\n8\n1 2 3 2 2 3 4 2\n4\n2 1 1 1\n8\n2 1 1 2 1 1 1 1\n7\n2 1 1 1 1 1 1\n6\n2 1 1 1 1 1\n5\n2 1 1 1 1", "metadata": { "func_name": null }, "output": "2\n0\n3\n1\n8\n4\n3\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 23, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nLet's imagine the surface of Mars as an infinite coordinate plane. Initially, the rover Perseverance-2 and the helicopter Ingenuity-2 are loca...
code
{ "ground_truth": [ { "input": "10\n6\nNENSNE\n3\nWWW\n6\nNESSWS\n2\nSN\n2\nWE\n4\nSSNN\n4\nWESN\n2\nSS\n4\nEWNN\n4\nWEWE", "metadata": { "func_name": null }, "output": "RRHRRH\nNO\nHRRHRH\nNO\nNO\nRHRH\nRRHH\nRH\nRRRH\nRRHH", "testtype": "stdin" } ], "style": "rule" }
{ "index": 24, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nBeing a physicist, Charlie likes to plan his life in simple and precise terms.\n\nFor the next $m$ months, starting with no money, Charlie wil...
code
{ "ground_truth": [ { "input": "7\n1 10\n1 5\n2 80\n0 10\n200 100\n3 100\n70 100\n100 200\n150 150\n5 8\n3 1\n5 3\n3 4\n1 5\n5 3\n2 5\n1 5\n2 1\n5 3\n2 5\n2 4\n4 1\n5 1\n3 4\n5 2\n2 1\n1 2\n3 5\n3 2\n3 2", "metadata": { "func_name": null }, "output": "0\n10\n200\n15\n1\n9\n9", "testtype": "stdin" } ], "style": "rule" }
{ "index": 25, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nAlice and Bob were playing a game again. They have a grid of size $a \\times b$ ($1 \\le a, b \\le 10^9$), on which there are $n$ chips, with ...
code
{ "ground_truth": [ { "input": "6\n4 4 3 2\n4 1\n3 3\n2 4\nD 2\nR 1\n4 4 3 3\n4 1\n3 2\n2 3\nD 1\nL 1\nU 2\n3 5 3 2\n1 3\n2 2\n3 3\nR 2\nR 2\n6 4 4 2\n1 4\n2 3\n5 3\n1 1\nR 1\nU 1\n9 3 2 1\n6 1\n3 3\nD 8\n10 10 2 5\n7 5\n9 1\nR 1\nL 2\nD 1\nU 4\nD 1", "metadata": { "func_name": null }, "output": "2 1\n2 0\n0 3\n1 1\n2 0\n0 1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 26, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou can never buy enough happiness, so here we go again! In this version, you can only buy $h_i = 1$ unit of happiness each month, but the num...
code
{ "ground_truth": [ { "input": "6\n3 3\n2 2 2\n6 5\n2 2 8 2 6 8\n6 4\n4 10 3 8 6 10\n2 1\n1 1\n4 1\n4 1 3 1\n4 2\n1 3 4 3", "metadata": { "func_name": null }, "output": "2\n4\n3\n1\n2\n1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 27, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nMocha likes arrays, so before her departure, Bazoka gave her an array $a$ consisting of $n$ positive integers as a gift.\n\nNow Mocha wants to...
code
{ "ground_truth": [ { "input": "3\n6\n1 1 4 5 1 4\n5\n7 9 2 2 3\n3\n1 2 3", "metadata": { "func_name": null }, "output": "No\nYes\nYes", "testtype": "stdin" } ], "style": "rule" }
{ "index": 28, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nMocha likes arrays, so before her departure, 378QAQ gave her an array $a$ consisting of $n$ positive integers as a gift.\n\nMocha thinks that ...
code
{ "ground_truth": [ { "input": "4\n3\n7 3 8\n5\n7 1 9 3 5\n5\n4 12 2 6 3\n5\n7 49 9 3 1000000000", "metadata": { "func_name": null }, "output": "No\nYes\nYes\nNo", "testtype": "stdin" } ], "style": "rule" }
{ "index": 29, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nMocha likes arrays, so before her departure, Chamo gave her an array $a$ consisting of $n$ positive integers as a gift.\n\nMocha doesn't like ...
code
{ "ground_truth": [ { "input": "2\n2\n1 2\n5\n1 2 3 4 5", "metadata": { "func_name": null }, "output": "1\n4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 30, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\n378QAQ has a tree with $n$ vertices. Initially, all vertices are white.\n\nThere are two chess pieces called $P_A$ and $P_B$ on the tree. $P_A...
code
{ "ground_truth": [ { "input": "3\n2\n1 2\n1 2\n5\n1 2\n1 2\n1 3\n1 4\n1 5\n8\n5 4\n7 1\n1 5\n1 8\n8 3\n7 2\n8 6\n3 4", "metadata": { "func_name": null }, "output": "2\n8\n13", "testtype": "stdin" } ], "style": "rule" }
{ "index": 31, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given a tree of $n$ vertices numbered from $1$ to $n$. Initially, all vertices are colored white or black.\n\nYou are asked to perform...
code
{ "ground_truth": [ { "input": "2\n2 1\n1 0\n1 2\n1\n5 4\n1 0 0 0 0\n1 2\n1 3\n1 5\n3 4\n4\n3\n2\n5", "metadata": { "func_name": null }, "output": "No\nNo\nYes\nYes\nNo", "testtype": "stdin" }, { "input": "4\n5 3\n1 1 1 1 1\n3 5\n2 5\n3 4\n1 5\n1\n1\n1\n4 4\n0 0 0 0\n1 2\n2 3\n1 4\n1\n2\n3\n2\n1 1\n1\n1\n1 1\n0\n1", "metadata": { "func_name": null }, "output": "Yes\nNo\nYes\nYes\nYes\nYes\nNo\nNo\nYes", "testtype": "stdin" } ], "style": "rule" }
{ "index": 32, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nDefine the binary encoding of a finite set of natural numbers $T \\subseteq \\\\{0,1,2,\\ldots\\\\}$ as $f(T) = \\sum\\limits_{i \\in T} 2^i$....
code
{ "ground_truth": [ { "input": "3\n15 15 15 15 15 15 12", "metadata": { "func_name": null }, "output": "4\n3\n5\n6\n7", "testtype": "stdin" }, { "input": "5\n63 63 63 63 6 63 63 63 63 63 63 5 63 63 63 63 63 63 8 63 63 63 63 2 63 63 63 63 63 63 63", "metadata": { "func_name": null }, "output": "1\n19", "testtype": "stdin" } ], "style": "rule" }
{ "index": 33, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nOne day, Zimpha casually came up with a problem. As a member of \"Zimpha fan club\", you decided to solve that problem. You are given two...
code
{ "ground_truth": [ { "input": "10 10\njustmonika\nj-stsayori", "metadata": { "func_name": null }, "output": "No", "testtype": "stdin" }, { "input": "7 8\nttk-wxx\n*tt-l-xx", "metadata": { "func_name": null }, "output": "Yes", "testtype": "stdin" }, { "input": "13 11\nasoulwangziji\n-soulg*z-y-", "metadata": { "func_name": null }, "output": "No", "testtype": "stdin" }, { "input": "7 3\nabc*cba\na*c", "metadata": { "func_name": null }, "output": "No", "testtype": "stdin" }, { "input": "20 18\nbulijiojio-dibuliduo\n*li*ji-*ox*i*-du*-", "metadata": { "func_name": null }, "output": "Yes", "testtype": "stdin" } ], "style": "rule" }
{ "index": 34, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\n378QAQ has a string $s$ of length $n$. Define the core of a string as the substring$^\\dagger$ with maximum lexicographic$^\\ddagger$ order.\n...
code
{ "ground_truth": [ { "input": "6\n3\nqaq\n4\ncccc\n6\nbazoka\n6\nzazzzz\n7\nababbbb\n7\nccbabcc", "metadata": { "func_name": null }, "output": "qaq\ncccc\nz\nzzz\nbbababb\ncbcacbc", "testtype": "stdin" } ], "style": "rule" }
{ "index": 35, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThis is the way it always was.\n\nThis is the way it always will be.\n\nAll will be forgotten again soon...\n\nJellyfish is playing a one-play...
code
{ "ground_truth": [ { "input": "4\n5\n0 1 1 1 2\n00100\n3\n2 3 3\n000\n10\n0 0 0 0 0 0 0 1 1 1\n1111011111\n20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 2 3 3 4\n00000000001000101010", "metadata": { "func_name": null }, "output": "500000004\n0\n0\n675898154", "testtype": "stdin" } ], "style": "rule" }
{ "index": 36, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nMonocarp is working on his new site, and the current challenge is to make the users pick strong passwords.\n\nMonocarp decided that strong pas...
code
{ "ground_truth": [ { "input": "5\n4\n12ac\n5\n123wa\n9\nallllmost\n5\nac123\n6\n011679", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 37, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given two integer arrays: array $a$ of length $n$ and array $b$ of length $n+1$.\n\nYou can perform the following operations any numbe...
code
{ "ground_truth": [ { "input": "3\n1\n2\n1 3\n2\n3 3\n3 3 3\n4\n4 2 1 2\n2 1 5 2 3", "metadata": { "func_name": null }, "output": "3\n1\n8", "testtype": "stdin" } ], "style": "rule" }
{ "index": 38, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nMonocarp is opening his own IT company. He wants to hire $n$ programmers and $m$ testers.\n\nThere are $n+m+1$ candidates, numbered from $1$ t...
code
{ "ground_truth": [ { "input": "4\n1 0\n2 1\n1 2\n0 2\n4 5 5\n5 4 1\n1 2\n2 1 5 4\n5 2 3 1\n3 1\n4 3 3 4 1\n5 5 4 5 2", "metadata": { "func_name": null }, "output": "1 2 \n5 6 9 \n8 11 11 12 \n13 13 13 12 15", "testtype": "stdin" } ], "style": "rule" }
{ "index": 39, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nA regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters '1' and ...
code
{ "ground_truth": [ { "input": "4\n(())\n()\n()()()\n(()())(())", "metadata": { "func_name": null }, "output": "1\n0\n3\n13", "testtype": "stdin" } ], "style": "rule" }
{ "index": 40, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nInitially, we had one array, which was a permutation of size $n$ (an array of size $n$ where each integer from $1$ to $n$ appears exactly once...
code
{ "ground_truth": [ { "input": "6 3\n6 4 4\n5 5 2", "metadata": { "func_name": null }, "output": "30", "testtype": "stdin" }, { "input": "10 1\n10\n9", "metadata": { "func_name": null }, "output": "1814400", "testtype": "stdin" }, { "input": "4 1\n2\n4", "metadata": { "func_name": null }, "output": "8", "testtype": "stdin" } ], "style": "rule" }
{ "index": 41, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given a rooted tree, consisting of $n$ vertices, numbered from $1$ to $n$. Vertex $1$ is the root. Additionally, the root only has one...
code
{ "ground_truth": [ { "input": "4\n2\n1 2\n12\n4 10\n5 12\n12 11\n3 6\n9 6\n1 6\n12 7\n11 6\n2 11\n10 9\n10 8\n8\n1 2\n2 3\n2 4\n3 5\n3 6\n4 7\n4 8\n5\n1 2\n2 3\n3 4\n4 5", "metadata": { "func_name": null }, "output": "0 \n7 3 1 0 0 0 0 0 0 0 0 \n4 1 0 0 0 0 0 \n0 0 0 0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 42, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThe little boy Nikita was given some cubes as a present. He decided to build a tower out of them.\n\nInitially, the tower doesn't have any cub...
code
{ "ground_truth": [ { "input": "3\n3 3\n2 4\n5 3", "metadata": { "func_name": null }, "output": "Yes\nNo\nYes", "testtype": "stdin" } ], "style": "rule" }
{ "index": 43, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given a positive integer $x$. Find any array of integers $a_0, a_1, \\ldots, a_{n-1}$ for which the following holds:\n\n * $1 \\le n ...
code
{ "ground_truth": [ { "input": "7\n1\n14\n24\n15\n27\n11\n19", "metadata": { "func_name": null }, "output": "1\n1\n5\n0 -1 0 0 1\n6\n0 0 0 -1 0 1\n5\n-1 0 0 0 1\n6\n-1 0 -1 0 0 1\n5\n-1 0 -1 0 1\n5\n-1 0 1 0 1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 44, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nNikita is a student passionate about number theory and algorithms. He faces an interesting problem related to an array of numbers.\n\nSuppose ...
code
{ "ground_truth": [ { "input": "6\n5\n1 2 4 8 16\n6\n3 2 10 20 60 1\n7\n2 3 4 6 12 100003 1200036\n9\n2 42 7 3 6 7 7 1 6\n8\n4 99 57 179 10203 2 11 40812\n1\n1", "metadata": { "func_name": null }, "output": "0\n4\n4\n5\n8\n0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 45, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given a binary (consisting only of 0s and 1s) $n \\times m$ matrix. You are also given a XORificator, using which you can invert all t...
code
{ "ground_truth": [ { "input": "5\n3 4\n1010\n0110\n0100\n1 1\n1\n1 1\n0\n2 5\n00101\n10110\n3 3\n101\n111\n000", "metadata": { "func_name": null }, "output": "3\n010\n1\n0\n1\n1\n3\n00\n2\n010", "testtype": "stdin" } ], "style": "rule" }
{ "index": 46, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThis is an interactive problem.\n\nYou are given an integer $n$.\n\nThe jury has hidden from you a directed graph with $n$ vertices (numbered ...
code
{ "ground_truth": [ { "input": "2\n4\n\nYES\n\nYES\n\nYES\n\nNO\n\nNO\n\nNO\n\n5", "metadata": { "func_name": null }, "output": "? 1 2\n\n? 2 3\n\n? 1 3\n\n? 1 4\n\n? 2 4\n\n? 3 4\n\n! 0 0 0 1\n\n! 1 1 0 1 0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 47, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nAlice has $n$ books. The $1$-st book contains $a_1$ pages, the $2$-nd book contains $a_2$ pages, $\\ldots$, the $n$-th book contains $a_n$ pag...
code
{ "ground_truth": [ { "input": "5\n2\n1 1\n4\n2 3 3 1\n5\n2 2 3 2 2\n2\n10 3\n3\n1 2 3", "metadata": { "func_name": null }, "output": "2\n4\n5\n13\n5", "testtype": "stdin" } ], "style": "rule" }
{ "index": 48, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nBob decided to open a bakery. On the opening day, he baked $n$ buns that he can sell. The usual price of a bun is $a$ coins, but to attract cu...
code
{ "ground_truth": [ { "input": "7\n4 4 5\n5 5 9\n10 10 5\n5 5 11\n1000000000 1000000000 1000000000\n1000000000 1000000000 1\n1000 1 1000", "metadata": { "func_name": null }, "output": "17\n35\n100\n45\n1000000000000000000\n1000000000000000000\n500500", "testtype": "stdin" } ], "style": "rule" }
{ "index": 49, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nLet's call the Manhattan value of a permutation$^{\\dagger}$ $p$ the value of the expression $|p_1 - 1| + |p_2 - 2| + \\ldots + |p_n - n|$.\n\...
code
{ "ground_truth": [ { "input": "8\n3 4\n4 5\n7 0\n1 1000000000000\n8 14\n112 777\n5 12\n5 2", "metadata": { "func_name": null }, "output": "Yes\n3 1 2\nNo\nYes\n1 2 3 4 5 6 7\nNo\nYes\n8 2 3 4 5 6 1 7\nNo\nYes\n5 4 3 1 2\nYes\n2 1 3 4 5", "testtype": "stdin" } ], "style": "rule" }
{ "index": 50, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nElections are taking place in Berland. There are $n$ candidates participating in the elections, numbered from $1$ to $n$. The $i$-th candidate...
code
{ "ground_truth": [ { "input": "5\n3 1\n2 0 3\n2 3\n0 10\n5 3\n5 4 3 2 1\n4 5\n3 10 7 1\n6 0\n2 2 2 3 3 3", "metadata": { "func_name": null }, "output": "0 1 2\n1 0\n0 1 2 3 4\n1 0 2 3\n1 1 2 0 4 5", "testtype": "stdin" } ], "style": "rule" }
{ "index": 51, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nSasha has two binary strings $s$ and $t$ of the same length $n$, consisting of the characters 0 and 1.\n\nThere is also a computing machine th...
code
{ "ground_truth": [ { "input": "3\n4\n1111\n0000\n2\n1 2\n2 4\n4\n1010\n1101\n2\n1 3\n1 4\n6\n010101\n011010\n5\n2 3\n1 6\n2 5\n4 4\n3 6", "metadata": { "func_name": null }, "output": "2\n3\n2\n3\n1\n4\n3\n1\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 52, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nGiven an array $a$ of length $n$. Let's construct a square matrix $b$ of size $n \\times n$, in which the $i$-th row contains the array $a$ cy...
code
{ "ground_truth": [ { "input": "6\n3 3\n3 4 5\n3 3\n3 4 9\n3 2\n3 4 9\n2 2\n2 8\n5 3\n8 27 5 4 3\n4 10\n2 2 2 2", "metadata": { "func_name": null }, "output": "3\n2\n3\n1\n4\n1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 53, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nAlice and Bob came up with a rather strange game. They have an array of integers $a_1, a_2,\\ldots, a_n$. Alice chooses a certain integer $k$ ...
code
{ "ground_truth": [ { "input": "6\n4\n2 4 1 7\n5\n1 2 3 4 5\n2\n1 1\n3\n37 8 16\n5\n10 10 10 10 9\n10\n3 12 9 5 2 3 2 9 8 2", "metadata": { "func_name": null }, "output": "3\n1\n0\n15\n9\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 54, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given two distinct non-negative integers $x$ and $y$. Consider two infinite sequences $a_1, a_2, a_3, \\ldots$ and $b_1, b_2, b_3, \\l...
code
{ "ground_truth": [ { "input": "4\n0 1\n12 4\n57 37\n316560849 14570961", "metadata": { "func_name": null }, "output": "1\n8\n4\n33554432", "testtype": "stdin" } ], "style": "rule" }
{ "index": 55, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou have been offered to play a game. In this game, there are $n$ possible outcomes, and for each of them, you must bet a certain integer amou...
code
{ "ground_truth": [ { "input": "6\n3\n3 2 7\n2\n3 3\n5\n5 5 5 5 5\n6\n7 9 3 17 9 13\n3\n6 3 2\n5\n9 4 6 8 3", "metadata": { "func_name": null }, "output": "27 41 12 \n1 1 \n-1\n1989 1547 4641 819 1547 1071 \n-1\n8 18 12 9 24", "testtype": "stdin" } ], "style": "rule" }
{ "index": 56, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given a binary string $s$ of length $n$, consisting of zeros and ones. You can perform the following operation exactly once:\n\n 1. C...
code
{ "ground_truth": [ { "input": "7\n8 4\n11100001\n4 2\n1110\n12 3\n111000100011\n5 5\n00000\n6 1\n101001\n8 4\n01110001\n12 2\n110001100110", "metadata": { "func_name": null }, "output": "3\n-1\n7\n5\n4\n-1\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 57, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThe Manhattan distance between two points $(x_1, y_1)$ and $(x_2, y_2)$ is defined as: $$|x_1 - x_2| + |y_1 - y_2|.$$\n\nWe call a Manhattan t...
code
{ "ground_truth": [ { "input": "6\n6 4\n3 1\n0 0\n0 -2\n5 -3\n3 -5\n2 -2\n5 4\n0 0\n0 -2\n5 -3\n3 -5\n2 -2\n6 6\n3 1\n0 0\n0 -2\n5 -3\n3 -5\n2 -2\n4 4\n3 0\n0 3\n-3 0\n0 -3\n10 8\n2 1\n-5 -1\n-4 -1\n-5 -3\n0 1\n-2 5\n-4 4\n-4 2\n0 0\n-4 1\n4 400000\n100000 100000\n-100000 100000\n100000 -100000\n-100000 -100000", "metadata": { "func_name": null }, "output": "2 6 1\n4 3 5\n3 5 1\n0 0 0\n6 1 3\n0 0 0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 58, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThis is an interactive problem.\n\nKostyanych has chosen a complete undirected graph$^{\\dagger}$ with $n$ vertices, and then removed exactly ...
code
{ "ground_truth": [ { "input": "3\n4\n\n0 0\n\n1 4\n\n2 3\n\n4\n\n1 0\n\n4 2\n\n2\n\n1 0", "metadata": { "func_name": null }, "output": "? 3\n\n? 2\n\n? 1\n\n! 4 3 1 2\n\n? 3\n\n? 0\n\n! 4 1 2 3\n\n? 0\n\n! 2 1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 59, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nVlad is planning to hold $m$ rounds next month. Each round should contain one problem of difficulty levels 'A', 'B', 'C', 'D', 'E', 'F', and '...
code
{ "ground_truth": [ { "input": "3\n10 1\nBGECDCBDED\n10 2\nBGECDCBDED\n9 1\nBBCDEFFGG", "metadata": { "func_name": null }, "output": "2\n5\n1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 60, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nDmitry has $n$ cubes, numbered from left to right from $1$ to $n$. The cube with index $f$ is his favorite.\n\nDmitry threw all the cubes on t...
code
{ "ground_truth": [ { "input": "12\n5 2 2\n4 3 3 2 3\n5 5 3\n4 2 1 3 5\n5 5 2\n5 2 4 1 3\n5 5 5\n1 2 5 4 3\n5 5 4\n3 1 2 4 5\n5 5 5\n4 3 2 1 5\n6 5 3\n1 2 3 1 2 3\n10 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1\n42\n5 2 3\n2 2 1 1 2\n2 1 1\n2 1\n5 3 1\n3 3 2 3 2", "metadata": { "func_name": null }, "output": "MAYBE\nYES\nNO\nYES\nYES\nYES\nMAYBE\nMAYBE\nYES\nYES\nYES\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 61, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nSofia had an array of $n$ integers $a_1, a_2, \\ldots, a_n$. One day she got bored with it, so she decided to sequentially apply $m$ modificat...
code
{ "ground_truth": [ { "input": "7\n3\n1 2 1\n1 3 2\n4\n1 3 1 2\n4\n1 2 3 5\n2 1 3 5\n2\n2 3\n5\n7 6 1 10 10\n3 6 1 11 11\n3\n4 3 11\n4\n3 1 7 8\n2 2 7 10\n5\n10 3 2 2 1\n5\n5 7 1 7 9\n4 10 1 2 9\n8\n1 1 9 8 7 2 10 4\n4\n1000000000 203 203 203\n203 1000000000 203 1000000000\n2\n203 1000000000\n1\n1\n1\n5\n1 3 4 5 1", "metadata": { "func_name": null }, "output": "YES\nNO\nNO\nNO\nYES\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 62, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nGCD (Greatest Common Divisor) of two integers $x$ and $y$ is the maximum integer $z$ by which both $x$ and $y$ are divisible. For example, $GC...
code
{ "ground_truth": [ { "input": "12\n6\n20 6 12 3 48 36\n4\n12 6 3 4\n3\n10 12 3\n5\n32 16 8 4 2\n5\n100 50 2 10 20\n4\n2 4 8 1\n10\n7 4 6 2 4 5 1 4 2 8\n7\n5 9 6 8 5 9 2\n6\n11 14 8 12 9 3\n9\n5 7 3 10 6 3 12 6 3\n3\n4 2 4\n8\n1 6 11 12 6 12 3 6", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nNO\nYES\nYES\nNO\nYES\nYES\nYES\nYES\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 63, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou have been given a matrix $a$ of size $n$ by $m$, containing a permutation of integers from $1$ to $n \\cdot m$.\n\nA permutation of $n$ in...
code
{ "ground_truth": [ { "input": "7\n1 1\n1\n1\n2 2\n1 2\n3 4\n4 3\n2 1\n2 2\n1 2\n3 4\n4 3\n1 2\n3 4\n1 5 9 6\n12 10 4 8\n7 11 3 2\n1 5 9 6\n12 10 4 8\n7 11 3 2\n3 3\n1 5 9\n6 4 2\n3 8 7\n9 5 1\n2 4 6\n7 8 3\n2 3\n1 2 6\n5 4 3\n6 1 2\n3 4 5\n1 5\n5 1 2 3 4\n4 2 5 1 3", "metadata": { "func_name": null }, "output": "YES\nYES\nNO\nYES\nYES\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 64, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThis is an easy version of the problem; it differs from the hard version only by the question. The easy version only needs you to print whethe...
code
{ "ground_truth": [ { "input": "5\n2 2 3\n1 1\n1 2\n2 2\n5 5 4\n1 2\n2 2\n3 4\n4 3\n2 5 9\n1 2\n1 5\n1 1\n2 2\n2 4\n2 5\n1 4\n2 3\n1 3\n6 4 4\n6 2\n1 3\n1 4\n1 2\n3 4 5\n2 1\n3 2\n1 4\n1 3\n2 4", "metadata": { "func_name": null }, "output": "1\n1 0 1 \n11\n0 1 0 1 \n1\n0 0 1 1 0 0 0 0 0 \n6\n1 0 0 0 \n1\n1 1 0 0 0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 65, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThis is a hard version of the problem; it differs from the easy version only by the question. The easy version only needs you to print whether...
code
{ "ground_truth": [ { "input": "5\n2 2 3\n1 1\n1 2\n2 2\n5 5 4\n1 2\n2 2\n3 4\n4 3\n2 5 9\n1 2\n1 5\n1 1\n2 2\n2 4\n2 5\n1 4\n2 3\n1 3\n6 4 4\n6 2\n1 3\n1 4\n1 2\n3 4 5\n2 1\n3 2\n1 4\n1 3\n2 4", "metadata": { "func_name": null }, "output": "1\n1 0 1 \n11\n0 1 0 4 \n1\n0 0 1 1 0 0 0 0 0 \n6\n15 0 0 0 \n1\n2 3 0 0 0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 66, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYasya was walking in the forest and accidentally found a tree with $n$ vertices. A tree is a connected undirected graph with no cycles.\n\nNex...
code
{ "ground_truth": [ { "input": "2\n3 7\n1 2 1\n3 1 8\n^ 5\n? 2 9\n^ 1\n? 1 10\n^ 6\n? 3 1\n? 2 9\n5 6\n1 2 777\n3 2 2812\n4 1 16\n5 3 1000000000\n^ 4\n? 3 123\n? 5 1000000000\n^ 1000000000\n? 1 908070\n? 2 1", "metadata": { "func_name": null }, "output": "13 15 11 10 \n1000000127 2812 999756331 999999756", "testtype": "stdin" }, { "input": "3\n8 4\n8 6 3\n6 3 4\n2 5 4\n7 6 2\n7 1 10\n4 1 4\n5 1 2\n^ 4\n^ 7\n? 7 8\n? 4 10\n5 6\n3 1 4\n2 3 9\n4 3 6\n5 2 10\n? 5 7\n^ 1\n^ 8\n? 4 10\n? 1 9\n? 3 6\n4 2\n2 1 4\n4 3 5\n2 3 4\n^ 13\n? 1 10", "metadata": { "func_name": null }, "output": "14 13 \n13 8 11 11 \n10", "testtype": "stdin" } ], "style": "rule" }
{ "index": 67, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nTurtle and Piggy are playing a number game.\n\nFirst, Turtle will choose an integer $x$, such that $l \\le x \\le r$, where $l, r$ are given. ...
code
{ "ground_truth": [ { "input": "5\n2 4\n3 6\n2 15\n6 22\n114514 1919810", "metadata": { "func_name": null }, "output": "2\n2\n3\n4\n20", "testtype": "stdin" } ], "style": "rule" }
{ "index": 68, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThere is a sequence $a_0, a_1, a_2, \\ldots$ of infinite length. Initially $a_i = i$ for every non-negative integer $i$.\n\nAfter every second...
code
{ "ground_truth": [ { "input": "9\n0 0\n0 1\n0 2\n1 0\n5 2\n10 1\n20 3\n1145 14\n19198 10", "metadata": { "func_name": null }, "output": "0\n1\n3\n1\n7\n11\n23\n1279\n19455", "testtype": "stdin" } ], "style": "rule" }
{ "index": 69, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nTurtle was playing with a sequence $a_1, a_2, \\ldots, a_n$ consisting of positive integers. Unfortunately, some of the integers went missing ...
code
{ "ground_truth": [ { "input": "9\n8\n-1 -1 -1 2 -1 -1 1 -1\n4\n-1 -1 -1 -1\n6\n3 -1 -1 -1 9 -1\n4\n-1 5 -1 6\n4\n2 -1 -1 3\n4\n1 2 3 4\n2\n4 2\n5\n-1 3 -1 3 6\n13\n-1 -1 3 -1 -1 -1 -1 7 -1 -1 3 -1 -1", "metadata": { "func_name": null }, "output": "4 9 4 2 4 2 1 2\n7 3 6 13\n3 1 2 4 9 18\n-1\n-1\n-1\n4 2\n6 3 1 3 6\n3 1 3 1 3 7 3 7 3 1 3 1 3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 70, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nTurtle just learned how to multiply two integers in his math class, and he was very excited.\n\nThen Piggy gave him an integer $n$, and asked ...
code
{ "ground_truth": [ { "input": "3\n2\n3\n4", "metadata": { "func_name": null }, "output": "114514 114514\n1 2 2\n3 3 4 4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 71, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nTurtle just received $n$ segments and a sequence $a_1, a_2, \\ldots, a_n$. The $i$-th segment is $[l_i, r_i]$.\n\nTurtle will create an undire...
code
{ "ground_truth": [ { "input": "4\n5\n1 7 3\n2 4 6\n3 5 5\n6 7 9\n3 4 4\n5\n2 7 3\n1 3 6\n4 5 5\n6 7 9\n1 1 4\n4\n1 4 3\n1 2 1\n3 4 5\n1 4 4\n3\n1 3 1\n2 3 3\n4 5 8", "metadata": { "func_name": null }, "output": "9\n13\n4\n-1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 72, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nNote the unusual definition of $\\text{MEX}$ in this problem.\n\nPiggy gave Turtle a binary tree$^{\\dagger}$ with $n$ vertices and a sequence...
code
{ "ground_truth": [ { "input": "5\n5\n3 2 2 1 1\n1 1 2 2\n5\n3 2 1 1 1\n1 1 2 2\n6\n1 2 1 2 1 3\n1 2 3 3 4\n7\n2 1 2 3 1 2 1\n1 1 2 2 3 3\n10\n1 2 2 1 4 2 3 1 2 1\n1 1 2 2 3 3 4 5 5", "metadata": { "func_name": null }, "output": "4\n6\n6\n6\n7", "testtype": "stdin" } ], "style": "rule" }
{ "index": 73, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nDima loves watching soccer. In such a game, the score on the scoreboard is represented as $x$ : $y$, where $x$ is the number of goals of the f...
code
{ "ground_truth": [ { "input": "6\n1 0\n5 0\n1 2\n3 2\n1 2\n4 5\n1 2\n4 3\n1 2\n1 2\n998244353 0\n1000000000 999999999", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nNO\nYES\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 74, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nRecently, the first-year student Maxim learned about the Collatz conjecture, but he didn't pay much attention during the lecture, so he believ...
code
{ "ground_truth": [ { "input": "13\n1 3 1\n2 3 1\n24 5 5\n16 3 2\n2 2 1\n1337 18 1\n1 2 144133\n12345678 3 10\n998244353 2 998244353\n998244353 123456789 998244352\n998244354 998241111 998244352\n998244355 2 9982443\n1000000000 1000000000 1000000000", "metadata": { "func_name": null }, "output": "2\n1\n1\n2\n3\n1338\n1\n16936\n1\n21180097\n6486\n1\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 75, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nOn another boring day, Egor got bored and decided to do something. But since he has no friends, he came up with a game to play.\n\nEgor has a ...
code
{ "ground_truth": [ { "input": "8\n5 3 10\n2 1 11 3 7\n10 1 5\n17 8 12 11 7 11 21 13 10 8\n3 4 5\n3 4 2\n8 12 25\n10 7 5 13 8 9 12 7\n2 3 3\n5 2\n9 7 9\n2 10 5 1 3 7 6 2 3\n1 8 10\n9\n5 5 6\n1 4 2 6 4", "metadata": { "func_name": null }, "output": "3\n0\n1\n4\n0\n3\n1\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 76, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nNikita loves mountains and has finally decided to visit the Berlyand mountain range! The range was so beautiful that Nikita decided to capture...
code
{ "ground_truth": [ { "input": "8\n3 3 2\n7 11 3\n4 2 3\n0 1 15\n100\n010\n000\n4 4 3\n123 413 24 233\n123 42 0 216\n22 1 1 53\n427 763 22 6\n0101\n1111\n1010\n0101\n3 3 2\n2 1 1\n1 1 2\n1 5 4\n010\n101\n010\n3 3 2\n2 1 1\n1 1 2\n1 5 3\n010\n101\n010\n3 4 3\n46 49 50 1\n19 30 23 12\n30 25 1 46\n1000\n0100\n0010\n5 4 4\n39 30 0 17\n22 42 30 13\n10 44 46 35\n12 19 9 39\n21 0 45 40\n1000\n1111\n0011\n0111\n1100\n2 2 2\n3 4\n6 7\n00\n00\n2 2 2\n0 0\n2 0\n01\n00", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nNO\nYES\nNO\nYES\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 77, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nLet $bit(x)$ denote the number of ones in the binary representation of a non-negative integer $x$.\n\nA subarray of an array is called $k$-goo...
code
{ "ground_truth": [ { "input": "10\n6 1\n16 2\n1 1\n3 1\n31 3\n14 1\n1337 5\n100000 20\n795569939321040850 56\n576460752303423268 59", "metadata": { "func_name": null }, "output": "7\n35\n1\n6\n155\n8\n7323\n49965\n741136395\n66679884", "testtype": "stdin" } ], "style": "rule" }
{ "index": 78, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou have an array $a$ of $n$ elements. There are also $q$ modifications of the array. Before the first modification and after each modificatio...
code
{ "ground_truth": [ { "input": "2\n5\n2 2 3 4 5\n3\n2 1\n4 1\n1 1\n5\n1 2 3 4 5\n9\n1 4\n2 3\n5 2\n3 1\n1 1\n5 1\n4 1\n3 1\n2 1", "metadata": { "func_name": null }, "output": "-1 -1\n1 2\n1 4\n3 4\n-1 -1\n1 3\n1 3\n1 5\n1 5\n2 5\n2 5\n2 5\n2 5\n-1 -1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 79, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nAn array of integers $a_1,a_2,\\cdots,a_n$ is beautiful subject to an integer $k$ if it satisfies the following:\n\n * The sum of $a_{j}$ ove...
code
{ "ground_truth": [ { "input": "3\n3\n6\n7", "metadata": { "func_name": null }, "output": "4 22 18\n10 6 15 32 125 54\n23 18 27 36 5 66 7", "testtype": "stdin" } ], "style": "rule" }
{ "index": 80, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given two grids of numbers $a$ and $b$, with $n$ rows and $m$ columns. All the values in the grid are $0$, $1$ or $2$.\n\nYou can perf...
code
{ "ground_truth": [ { "input": "7\n3 3\n000\n000\n000\n111\n111\n111\n4 4\n0000\n0000\n0000\n0000\n2100\n1200\n0012\n0021\n4 4\n1020\n1200\n1210\n0000\n0000\n1200\n2200\n0000\n3 3\n012\n012\n012\n010\n111\n011\n8 8\n00000000\n00000000\n00000000\n00000000\n00000000\n00000000\n00000000\n10000000\n00000000\n01200000\n02010000\n00102000\n00020100\n00001020\n00000210\n10000000\n2 7\n0000000\n0000000\n2220111\n0111222\n2 7\n0000000\n0100010\n2220111\n1210202", "metadata": { "func_name": null }, "output": "YES\nYES\nYES\nNO\nYES\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 81, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nAlice, Bob and Charlie want to share a rectangular cake cut into $n$ pieces. Each person considers every piece to be worth a different value. ...
code
{ "ground_truth": [ { "input": "10\n5\n5 1 1 1 1\n1 1 5 1 1\n1 1 1 1 5\n6\n1 2 3 4 5 6\n5 6 1 2 3 4\n3 4 5 6 1 2\n4\n4 4 4 4\n4 4 4 4\n4 4 4 4\n5\n5 10 5 2 10\n9 6 9 7 1\n10 7 10 2 3\n3\n4 5 2\n6 1 4\n1 8 2\n3\n10 4 10\n8 7 9\n10 4 10\n7\n57113 65383 19795 53580 74452 3879 23255\n12917 16782 89147 93107 27365 15044 43095\n33518 63581 33565 34112 46774 44151 41756\n6\n6 3 1 8 7 1\n10 2 6 2 2 4\n10 9 2 1 2 2\n5\n5 5 4 5 5\n1 6 3 8 6\n2 4 1 9 8\n10\n1 1 1 1 1001 1 1 1001 1 1\n1 1 1 1 1 1 2001 1 1 1\n1 1 1 1 1 1001 1 1 1 1001", "metadata": { "func_name": null }, "output": "1 1 2 3 4 5 \n5 6 1 2 3 4 \n-1\n-1\n1 1 3 3 2 2 \n-1\n1 2 3 4 5 7 \n3 6 1 1 2 2 \n1 2 3 4 5 5 \n1 5 6 7 8 10", "testtype": "stdin" } ], "style": "rule" }
{ "index": 82, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nGiven two arrays of distinct positive integers $a$ and $b$ of length $n$, we would like to make both the arrays the same. Two arrays $x$ and $...
code
{ "ground_truth": [ { "input": "6\n4\n1 2 3 4\n1 2 3 4\n5\n1 3 4 2 5\n7 1 2 5 4\n4\n1 2 3 4\n4 3 2 1\n3\n1 2 3\n1 3 2\n5\n1 5 7 1000 4\n4 1 7 5 1000\n3\n1 4 2\n1 3 2", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nNO\nNO\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 83, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nAlice and Bob are playing a game. There are $n$ balls, out of which $k$ are special. Each ball has a value associated with it.\n\nThe players ...
code
{ "ground_truth": [ { "input": "1\n5 2\n10 20 5 15 25", "metadata": { "func_name": null }, "output": "45 30", "testtype": "stdin" }, { "input": "5\n1 1\n732507\n2 2\n5817860 5398510\n5 1\n2122894 4951549 2750585 7821535 3214167\n8 4\n1405323 5069867 6883092 6972029 328406 2478975 7628890 9973340\n4 2\n9662050 3566134 3996473 9872255", "metadata": { "func_name": null }, "output": "732507 0\n11216370 0\n810642660 210218077\n722402997 318336932\n349086489 678010430", "testtype": "stdin" }, { "input": "5\n3 3\n1095611 8219204 7773462\n2 1\n8176490 2774103\n3 1\n9178636 5138057 3367761\n12 9\n7597698 6843019 2298534 1522386 4969588 1340345 3967362 9152890 6689668 9986080 4745473 7407325\n10 5\n6986368 2397882 5804127 6980694 3740836 3215836 5195724 3179261 4136769 4544231", "metadata": { "func_name": null }, "output": "17088277 0\n6862348 4088245\n677038671 340645790\n36949997 29570371\n725118051 321063684", "testtype": "stdin" } ], "style": "rule" }
{ "index": 84, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou have an array of non-negative integers $a_1, a_2, \\ldots, a_n$.\n\nThe value of a sub-array of length $\\ge 2$, $a[l, r] = [a_l, a_{l+1},...
code
{ "ground_truth": [ { "input": "4\n5 2\n1 2 3 4 5\n2 1\n4 3\n4 6\n1 2 4 8\n5 9\n1 2 3 4 5", "metadata": { "func_name": null }, "output": "1\n7\n12\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 85, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given a tree with $n$ nodes numbered from $1$ to $n$, along with an array of size $n$. The value of $i$-th node is $a_{i}$. There are ...
code
{ "ground_truth": [ { "input": "1\n4\n1 2\n2 3\n3 4\n2 3 6 5\n3\n1 4\n3 4\n1 1", "metadata": { "func_name": null }, "output": "14\n10\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 86, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nDefine the range of a non-empty array to be the maximum value minus the minimum value. For example, the range of $[1,4,2]$ is $4-1=3$.\n\nYou ...
code
{ "ground_truth": [ { "input": "7\n4\n1 1 2 2\n5\n1 2 3 4 5\n3\n3 3 3\n4\n1 2 2 2\n3\n1 2 2\n3\n1 1 2\n3\n1 9 84", "metadata": { "func_name": null }, "output": "YES\nRBRR\nYES\nBBRBB\nNO\nYES\nRBBR\nYES\nRRB\nYES\nBRR\nYES\nBRB", "testtype": "stdin" } ], "style": "rule" }
{ "index": 87, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nA digit is large if it is between $5$ and $9$, inclusive. A positive integer is large if all of its digits are large.\n\nYou are given an inte...
code
{ "ground_truth": [ { "input": "11\n1337\n200\n1393938\n1434\n98765432123456789\n11111111111111111\n420\n1984\n10\n69\n119", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nYES\nNO\nYES\nNO\nYES\nYES\nNO\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 88, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThe two versions of the problem are different. You may want to read both versions. You can make hacks only if both versions are solved.\n\nYou...
code
{ "ground_truth": [ { "input": "5\n4\n10 -9 -3 4\n8\n1 4 3 4 1 4 3 4\n3\n-1 -2 -3\n4\n-1000000000 1000000000 1000000000 1000000000\n4\n1 9 8 4", "metadata": { "func_name": null }, "output": "6\n24\n6\n4000000000\n22", "testtype": "stdin" } ], "style": "rule" }
{ "index": 89, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThe two versions of the problem are different. You may want to read both versions. You can make hacks only if both versions are solved.\n\nYou...
code
{ "ground_truth": [ { "input": "5\n4\n2 -5 3 -3\n8\n1 4 3 4 1 4 3 4\n3\n-1 -2 -3\n4\n-1000000000 1000000000 1000000000 1000000000\n4\n1 9 8 4", "metadata": { "func_name": null }, "output": "12\n256\n1\n8\n16", "testtype": "stdin" } ], "style": "rule" }
{ "index": 90, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nYou are given a string $s$ consisting of lowercase Latin characters. Count the number of nonempty strings $t \\neq$ \"$\\texttt{a}$\" such tha...
code
{ "ground_truth": [ { "input": "8\naaaaa\nbaba\ncabacb\naaabaaa\nbitset\nab\nabbaaaabbb\nyearnineteeneightyfour", "metadata": { "func_name": null }, "output": "4\n4\n1\n16\n1\n2\n3\n1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 91, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nTwo hungry red pandas, Oscar and Lura, have a tree $T$ with $n$ nodes. They are willing to perform the following shuffle procedure on the whol...
code
{ "ground_truth": [ { "input": "4\n5\n1 2\n1 3\n2 4\n2 5\n5\n1 2\n2 3\n3 4\n4 5\n6\n1 2\n1 3\n1 4\n1 5\n1 6\n10\n9 3\n8 1\n10 6\n8 5\n7 8\n4 6\n1 3\n10 1\n2 7", "metadata": { "func_name": null }, "output": "4\n3\n5\n6", "testtype": "stdin" } ], "style": "rule" }
{ "index": 92, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThere is a hidden array $a_1, a_2, \\ldots, a_n$ of length $n$ whose elements are integers between $-m$ and $m$, inclusive.\n\nYou are given a...
code
{ "ground_truth": [ { "input": "6\n4 10\nPSPP\n1 9 8 10\n4 1000000000\n????\n1 1 1 4000000000\n8 1000000000\n?P?SSP?P\n-857095623 -1424391899 -851974476 673437144 471253851 -543483033 364945701 -178537332\n4 7\nPPSS\n4 2 1 3\n9 20\n?????????\n1 2 3 4 5 6 7 8 9\n3 1000000000\nP??\n-145463248 -974068460 -1287458396", "metadata": { "func_name": null }, "output": "1\n0\n2\n1\n14\n1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 93, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThe secret behind Oscar's first magic trick has been revealed! Because he still wants to impress Lura, he comes up with a new idea: he still w...
code
{ "ground_truth": [ { "input": "3\n5\n5 1 2 3 4\n5\n2 3 5 4 1\n6\n1 2 3 4 5 6", "metadata": { "func_name": null }, "output": "4\n1\n2 1\n3\n2\n1 3\n2 1\n6\n0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 94, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nThere are $n$ towers at $n$ distinct points $(x_1, y_1), (x_2, y_2), \\ldots, (x_n, y_n)$, such that no three are collinear and no four are co...
code
{ "ground_truth": [ { "input": "3\n5\n1 1\n2 5\n3 3\n4 2\n5 4\n6\n1 1\n3 3\n1 2\n2 1\n3 10000\n19 84\n7\n2 7\n-4 -3\n-3 6\n3 1\n-5 2\n1 -4\n-1 7", "metadata": { "func_name": null }, "output": "1\n0\n10", "testtype": "stdin" } ], "style": "rule" }
{ "index": 95, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nMatthew is given two strings $a$ and $b$, both of length $3$. He thinks it's particularly funny to create two new words by swapping the first ...
code
{ "ground_truth": [ { "input": "6\nbit set\ncat dog\nhot dog\nuwu owo\ncat cat\nzzz zzz", "metadata": { "func_name": null }, "output": "sit bet\ndat cog\ndot hog\nowu uwo\ncat cat\nzzz zzz", "testtype": "stdin" } ], "style": "rule" }
{ "index": 96, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nGiven an integer $n$, find an integer $x$ such that:\n\n * $2 \\leq x \\leq n$. * The sum of multiples of $x$ that are less than or equal ...
code
{ "ground_truth": [ { "input": "2\n3\n15", "metadata": { "func_name": null }, "output": "3\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 97, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nAlex thinks some array is good if there exists some element that can be represented as the sum of all other elements (the sum of all other ele...
code
{ "ground_truth": [ { "input": "7\n1\n0\n1\n1\n4\n1 1 2 0\n5\n0 1 2 1 4\n7\n1 1 0 3 5 2 12\n7\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 294967296\n10\n0 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 589934592", "metadata": { "func_name": null }, "output": "1\n0\n3\n3\n4\n1\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 98, "solution": "", "split": "test" }
codeforces
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Solve the following coding problem using the programming language python:\n\n\nGiven a $n$ by $m$ grid consisting of '.' and '#' characters, there exists a whole manhattan circle on the grid. The top left corner of the gr...
code
{ "ground_truth": [ { "input": "6\n5 5\n.....\n.....\n..#..\n.....\n.....\n5 5\n..#..\n.###.\n#####\n.###.\n..#..\n5 6\n......\n......\n.#....\n###...\n.#....\n1 1\n#\n5 6\n...#..\n..###.\n.#####\n..###.\n...#..\n2 10\n..........\n...#......", "metadata": { "func_name": null }, "output": "3 3\n3 3\n4 2\n1 1\n3 4\n2 4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 99, "solution": "", "split": "test" }