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\nNtarsis has a box $B$ with side lengths $x$, $y$, and $z$. It lies in the 3D coordinate plane, extending from $(0,0,0)$ to $(x,y,z)$.\n\nNtars...
code
{ "ground_truth": [ { "input": "7\n3 3 3 8\n3 3 3 18\n5 1 1 1\n2 2 2 7\n3 4 2 12\n4 3 1 6\n1800 1800 1800 4913000000", "metadata": { "func_name": null }, "output": "8\n2\n5\n0\n4\n4\n1030301", "testtype": "stdin" } ], "style": "rule" }
{ "index": 100, "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 facing the final boss in your favorite video game. The boss enemy has $h$ health. Your character has $n$ attacks. The $i$'th attack de...
code
{ "ground_truth": [ { "input": "8\n3 2\n2 1\n2 1\n5 2\n2 1\n2 1\n50 3\n5 6 7\n5 6 7\n50 3\n2 2 2\n3 3 3\n90000 2\n200000 200000\n1 1\n100000 1\n1\n200000\n6 7\n3 2 3 2 3 1 2\n6 5 9 5 10 7 7\n21 6\n1 1 1 1 1 1\n5 5 8 10 7 6", "metadata": { "func_name": null }, "output": "1\n3\n15\n2...
{ "index": 101, "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 $D(n)$ represent the sum of digits of $n$. For how many integers $n$ where $10^{l} \\leq n < 10^{r}$ satisfy $D(k \\cdot n) = k \\cdot D(n...
code
{ "ground_truth": [ { "input": "6\n0 1 4\n0 2 7\n1 2 1\n1 2 3\n582 74663 3\n0 3 1", "metadata": { "func_name": null }, "output": "2\n3\n90\n12\n974995667\n999", "testtype": "stdin" } ], "style": "rule" }
{ "index": 102, "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\nEasy and hard versions are actually different problems, so read statements of both problems completely and carefully. The only difference betw...
code
{ "ground_truth": [ { "input": "6\n1 1\n.\n4 2\n..\n#.\n#.\n.#\n3 5\n.#.#.\n..#..\n.#.#.\n5 5\n#...#\n....#\n#...#\n.....\n...##\n6 6\n.#..#.\n#..#..\n.#...#\n#.#.#.\n.#.##.\n###..#\n6 8\n..#....#\n.####.#.\n###.#..#\n.##.#.##\n.#.##.##\n#..##.#.", "metadata": { "func_name": null }, ...
{ "index": 103, "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\nEasy and hard versions are actually different problems, so read statements of both problems completely and carefully. The only difference betw...
code
{ "ground_truth": [ { "input": "6\n1 1\n.\n4 2\n..\n#.\n#.\n.#\n3 5\n.#.#.\n..#..\n.#.#.\n5 5\n#...#\n....#\n#...#\n.....\n...##\n6 6\n.#..#.\n#..#..\n.#...#\n#.#.#.\n.#.##.\n###..#\n6 8\n..#....#\n.####.#.\n###.#..#\n.##.#.##\n.#.##.##\n#..##.#.", "metadata": { "func_name": null }, ...
{ "index": 104, "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 three points with integer coordinates $x_1$, $x_2$, and $x_3$ on the $X$ axis ($1 \\leq x_i \\leq 10$). You can choose any point...
code
{ "ground_truth": [ { "input": "8\n1 1 1\n1 5 9\n8 2 8\n10 9 3\n2 1 1\n2 4 1\n7 3 5\n1 9 4", "metadata": { "func_name": null }, "output": "0\n8\n6\n7\n1\n3\n4\n8", "testtype": "stdin" } ], "style": "rule" }
{ "index": 105, "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 matrix of size $n \\times m$, where the rows are numbered from $1$ to $n$ from top to bottom, and the columns are numbered fro...
code
{ "ground_truth": [ { "input": "6\n1 2\n3 1\n2 1\n1\n1\n2 2\n1 2\n3 4\n2 3\n7 4 5\n1 8 10\n5 4\n92 74 31 74\n74 92 17 7\n31 17 92 3\n74 7 3 92\n7 31 1 1\n3 3\n1000000000 1 1000000000\n1 1000000000 1\n1000000000 1 1000000000", "metadata": { "func_name": null }, "output": "1 1 \n1 \n...
{ "index": 106, "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 consider the following simple problem. You are given a string $s$ of length $n$, consisting of lowercase Latin letters, as well as an ar...
code
{ "ground_truth": [ { "input": "4\n1 2\na\n1 1\ncb\n4 4\nmeow\n1 2 1 4\nzcwz\n7 4\nabacaba\n1 3 5 7\ndamn\n7 10\ntraktor\n7 6 5 4 3 2 1 6 4 2\ncodeforces", "metadata": { "func_name": null }, "output": "b\ncwoz\nabdcmbn\nccdeefo", "testtype": "stdin" } ], "style": "rul...
{ "index": 107, "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$ of length $n > 1$, consisting of digits from $0$ to $9$. You must insert exactly $n - 2$ symbols $+$ (addition) or ...
code
{ "ground_truth": [ { "input": "18\n2\n10\n2\n74\n2\n00\n2\n01\n3\n901\n3\n101\n5\n23311\n6\n987009\n7\n1111111\n20\n99999999999999999999\n20\n00000000000000000000\n4\n0212\n18\n057235283621345395\n4\n1112\n20\n19811678487321784121\n4\n1121\n4\n2221\n3\n011", "metadata": { "func_name": null ...
{ "index": 108, "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 of integers $a_1, a_2, \\ldots, a_n$ and an integer $k$. You need to make it beautiful with the least amount of operati...
code
{ "ground_truth": [ { "input": "11\n1 1000000000\n1\n2 1\n624323799 708290323\n3 1\n3 2 1\n4 1\n7 1 5 3\n5 1\n11 2 15 7 10\n7 1\n1 8 2 16 8 16 31\n13 1\n2 1 1 3 3 11 12 22 45 777 777 1500 74\n10 2\n1 2 1 2 1 2 1 2 1 2\n11 2\n1 2 1 2 1 2 1 2 1 2 1\n13 3\n2 3 9 14 17 10 22 20 18 30 1 4 28\n5 1\n2 3 5 3 5", ...
{ "index": 109, "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 connected undirected graph, the vertices of which are numbered with integers from $1$ to $n$. Your task is to minimize the num...
code
{ "ground_truth": [ { "input": "6\n2 1\n1 2\n3 3\n1 2\n2 3\n1 3\n5 5\n1 2\n1 3\n3 4\n4 5\n5 3\n6 7\n1 2\n1 3\n2 3\n3 4\n4 5\n4 6\n5 6\n5 5\n1 2\n1 3\n2 3\n2 4\n3 5\n10 12\n1 2\n1 3\n2 3\n2 4\n4 5\n5 6\n6 7\n7 4\n3 8\n8 9\n9 10\n10 8", "metadata": { "func_name": null }, "output": "0...
{ "index": 110, "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 simple version of the problem. The only difference is that in this version $n \\leq 10^5$ and the sum of $n$ for all sets of input d...
code
{ "ground_truth": [ { "input": "6\n1\n1\n2\n1 2\n3\n2 3 1\n5\n2 4 1 3 5\n12\n8 9 7 12 1 10 6 3 2 4 11 5\n15\n1 2 4 6 8 10 12 14 3 9 15 5 7 11 13", "metadata": { "func_name": null }, "output": "0\n1\n1\n3\n9\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 111, "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 hard version of the problem. The only difference is that in this version $n \\leq 5 \\cdot 10^5$ and the sum of $n$ for all sets o...
code
{ "ground_truth": [ { "input": "6\n1\n1\n2\n1 2\n3\n2 3 1\n5\n2 4 1 3 5\n12\n8 9 7 12 1 10 6 3 2 4 11 5\n15\n1 2 4 6 8 10 12 14 3 9 15 5 7 11 13", "metadata": { "func_name": null }, "output": "0\n1\n1\n3\n9\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 112, "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\nOh no, the ForceCodes servers are running out of memory! Luckily, you can help them out by uploading some of your RAM!\n\nYou want to upload $...
code
{ "ground_truth": [ { "input": "6\n5 1\n2 2\n2 3\n1 7\n11 5\n100 100", "metadata": { "func_name": null }, "output": "5\n3\n4\n1\n51\n9901", "testtype": "stdin" } ], "style": "rule" }
{ "index": 113, "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 of integers $a$ of length $n$.\n\nYou can apply the following operation any number of times (maybe, zero):\n\n * First...
code
{ "ground_truth": [ { "input": "5\n3\n1 7 9\n5\n2 1 4 7 6\n4\n1 3 2 4\n1\n179\n9\n344 12 37 60 311 613 365 328 675", "metadata": { "func_name": null }, "output": "0\n3\n2\n0\n1821", "testtype": "stdin" } ], "style": "rule" }
{ "index": 114, "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$ flowers in a row, the $i$-th of them initially has a positive height of $h_i$ meters.\n\nEvery second, the wind will blow from t...
code
{ "ground_truth": [ { "input": "4\n3\n1 1 2\n2\n3 1\n1\n9\n5\n7 4 4 3 2", "metadata": { "func_name": null }, "output": "4\n3\n9\n7", "testtype": "stdin" } ], "style": "rule" }
{ "index": 115, "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. Initially, there are $n$ cakes, with the $i$-th cake having a tastiness value of $a_i$.\n\nAlice and Bob tak...
code
{ "ground_truth": [ { "input": "9\n4\n1 4 2 3\n3\n1 1 1\n5\n1 4 2 3 4\n4\n3 4 1 4\n1\n1\n8\n4 3 2 5 6 8 3 4\n7\n6 1 1 3 5 3 1\n11\n6 11 6 8 7 5 3 11 2 3 5\n17\n2 6 5 3 9 1 6 2 5 6 3 2 3 9 6 1 6", "metadata": { "func_name": null }, "output": "2\n1\n3\n2\n1\n3\n2\n4\n4", "testt...
{ "index": 116, "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\nGod's Blessing on This ArrayForces!\n\nA Random Pebble\n\nYou are given a tree with $n$ vertices, rooted at vertex $1$. The $i$-th vertex has ...
code
{ "ground_truth": [ { "input": "4\n5\n9 3 4 1 2\n1 1 3 3\n2\n5 3\n1\n2\n36 54\n1\n3\n0 0 0\n1 2", "metadata": { "func_name": null }, "output": "3\n2\n0\n0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 117, "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 easy version of the problem. The only difference between the two versions is the constraint on $n$. You can make hacks only if bot...
code
{ "ground_truth": [ { "input": "6\n5\n1 5 3 2 4\n8\n2 1 3 4 5 6 7 8\n3\n1 2 3\n4\n1 2 4 4\n5\n4 4 1 3 5\n1\n1", "metadata": { "func_name": null }, "output": "2\n3\n1\n2\n0\n0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 118, "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 hard version of the problem. The only difference between the two versions is the constraint on $n$. You can make hacks only if bot...
code
{ "ground_truth": [ { "input": "6\n5\n1 5 3 2 4\n8\n2 1 3 4 5 6 7 8\n3\n1 2 3\n4\n1 2 4 4\n5\n4 4 1 3 5\n1\n1", "metadata": { "func_name": null }, "output": "2\n3\n1\n2\n0\n0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 119, "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 easy version of the problem. The only difference between the two versions are the allowed characters in $s$. In the easy version, ...
code
{ "ground_truth": [ { "input": "8\n5\n2 1 4 3 5\n?????\n2\n1 2\n??\n3\n3 1 2\n???\n7\n5 3 1 6 4 2 7\n???????\n5\n5 2 1 3 4\n?????\n6\n6 2 3 4 5 1\n??????\n8\n1 7 5 6 2 8 4 3\n????????\n12\n6 10 7 1 8 5 12 2 11 3 4 9\n????????????", "metadata": { "func_name": null }, "output": "4\n1...
{ "index": 120, "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 hard version of the problem. The only difference between the two versions are the allowed characters in $s$. You can make hacks on...
code
{ "ground_truth": [ { "input": "8\n5\n2 1 4 3 5\nR?RL?\n2\n1 2\nLR\n3\n3 1 2\nL?R\n7\n5 3 1 6 4 2 7\n?R?R?R?\n5\n5 2 1 3 4\n?????\n6\n6 2 3 4 5 1\n?LLRLL\n8\n1 7 5 6 2 8 4 3\n?R??????\n12\n6 10 7 1 8 5 12 2 11 3 4 9\n????????????", "metadata": { "func_name": null }, "output": "3\n-...
{ "index": 121, "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 temple only magnifies the mountain's power.\n\nBadeline\n\nThis is an interactive problem.\n\nYou are given two positive integers $n$ and...
code
{ "ground_truth": [ { "input": "2\n3 4\n\n5\n\n3\n\n5\n\n1 1\n\n0", "metadata": { "func_name": null }, "output": "? 1 1\n\n? 3 3\n\n? 3 2\n\n! 1 4\n\n? 1 1\n\n! 1 1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 122, "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 multiset is a set of numbers in which there can be equal elements, and the order of the numbers does not matter. For example, $\\\\{2,2,4\\\...
code
{ "ground_truth": [ { "input": "4\n1 5\n5 2\n6 3\n16 4", "metadata": { "func_name": null }, "output": "0\n4\n3\n5", "testtype": "stdin" } ], "style": "rule" }
{ "index": 123, "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 sequence $[a_1,\\ldots,a_n]$ where each element $a_i$ is either $0$ or $1$. You can apply several (possibly zero) operations t...
code
{ "ground_truth": [ { "input": "5\n1\n0\n1\n1\n2\n01\n9\n100000001\n9\n000011000", "metadata": { "func_name": null }, "output": "No\nYes\nNo\nYes\nNo", "testtype": "stdin" } ], "style": "rule" }
{ "index": 124, "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 $n$. Find the longest sequence of positive integers $a=[a_1,a_2,\\ldots,a_k]$ that satisfies the following co...
code
{ "ground_truth": [ { "input": "4\n1\n3\n14\n23", "metadata": { "func_name": null }, "output": "1\n1\n3\n1 2 3\n4\n4 10 12 14\n5\n7 18 21 22 23", "testtype": "stdin" } ], "style": "rule" }
{ "index": 125, "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, the monster killer, want to kill a group of monsters. The monsters are on a tree with $n$ vertices. On vertex with number $i$ ($1\\le i\\...
code
{ "ground_truth": [ { "input": "3\n1\n1000000000000\n5\n47 15 32 29 23\n1 2\n1 3\n2 4\n2 5\n7\n8 10 2 3 5 7 4\n1 2\n1 4\n3 2\n5 3\n6 2\n7 5", "metadata": { "func_name": null }, "output": "1000000000000\n193\n57", "testtype": "stdin" } ], "style": "rule" }
{ "index": 126, "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 an array $[a_1,a_2,\\ldots,a_n]$ of length $n$, define $f(a)$ as the sum of the minimum element over all subsegments. That is, $$f(a)=\\su...
code
{ "ground_truth": [ { "input": "4\n1\n1\n3\n3 1 2\n5\n4 2 1 5 3\n8\n8 1 4 6 7 3 5 2", "metadata": { "func_name": null }, "output": "0 \n4 7 5 \n19 21 27 17 19 \n79 100 72 68 67 80 73 80", "testtype": "stdin" } ], "style": "rule" }
{ "index": 127, "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 an array $u_1, u_2, \\ldots, u_n$, define\n\n * a prefix maximum as an index $i$ such that $u_i>u_j$ for all $j<i$; * a suffix maximum...
code
{ "ground_truth": [ { "input": "3\n1 1 1\n1 1 1\n1 1 1", "metadata": { "func_name": null }, "output": "1 2 6", "testtype": "stdin" }, { "input": "3\n1 2 3\n2 3 1\n3 1 2", "metadata": { "func_name": null }, "output": "6 13 34", "te...
{ "index": 128, "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 visited a retro arcade club with arcade cabinets. There got curious about the \"Catch the Coin\" cabinet.\n\nThe game is pretty simpl...
code
{ "ground_truth": [ { "input": "5\n24 42\n-2 -1\n-1 -2\n0 -50\n15 0", "metadata": { "func_name": null }, "output": "YES\nYES\nNO\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 129, "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 strings $a$ and $b$, both consisting of lowercase Latin letters.\n\nA subsequence of a string is a string which can be obtai...
code
{ "ground_truth": [ { "input": "5\naba\ncb\ner\ncf\nmmm\nmmm\ncontest\ntest\ncde\nabcefg", "metadata": { "func_name": null }, "output": "4\n4\n3\n7\n7", "testtype": "stdin" } ], "style": "rule" }
{ "index": 130, "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 movie company has released $2$ movies. These $2$ movies were watched by $n$ people. For each person, we know their attitude towards the firs...
code
{ "ground_truth": [ { "input": "4\n2\n-1 1\n-1 -1\n1\n-1\n-1\n5\n0 -1 1 0 1\n-1 1 0 0 1\n4\n-1 -1 -1 1\n-1 1 1 1", "metadata": { "func_name": null }, "output": "0\n-1\n1\n1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 131, "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 playing a famous computer game (that just works) where you have various skills you can level up. Today, you focused on the \"Smithing\...
code
{ "ground_truth": [ { "input": "5 3\n9 6 7 5 5\n8 4 5 1 2\n10 4 7", "metadata": { "func_name": null }, "output": "12", "testtype": "stdin" }, { "input": "3 4\n10 20 20\n0 0 0\n9 10 19 20", "metadata": { "func_name": null }, "output": "8...
{ "index": 132, "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\nConsider an array $a$ of $n$ integers, where every element is from $1$ to $k$, and every integer from $1$ to $k$ appears at least once.\n\nLet...
code
{ "ground_truth": [ { "input": "2 2", "metadata": { "func_name": null }, "output": "1", "testtype": "stdin" }, { "input": "4 3", "metadata": { "func_name": null }, "output": "3", "testtype": "stdin" }, { "input": "6 ...
{ "index": 133, "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 matrix, consisting of $n$ rows and $m$ columns.\n\nYou can perform two types of actions on it:\n\n * paint the entire column ...
code
{ "ground_truth": [ { "input": "2 2 4\n1 1 R\n2 2 R\n1 2 B\n2 1 B", "metadata": { "func_name": null }, "output": "0\n0\n0\n16", "testtype": "stdin" }, { "input": "3 5 10\n1 1 B\n2 5 B\n2 2 B\n2 3 R\n2 1 B\n3 2 R\n3 3 B\n1 2 R\n1 3 B\n3 1 B", "metadata": { ...
{ "index": 134, "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 in an array $a$ of size $n$.\n\nThey take turns to do operations, with Alice starting first. The player who c...
code
{ "ground_truth": [ { "input": "5\n2\n2 1\n2\n1 1\n3\n3 3 3\n4\n3 3 4 4\n4\n1 2 2 2", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 135, "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 an array $b$ of size $m$, we define:\n\n * the maximum prefix position of $b$ is the smallest index $i$ that satisfies $b_1+\\ldots+b_i=\...
code
{ "ground_truth": [ { "input": "3\n2 2 1\n4 4 3\n6 5 1", "metadata": { "func_name": null }, "output": "1 1\n1 -1 1 1\n1 1 -1 1 1 -1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 136, "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\nWe define the $\\operatorname{MAD}$ (Maximum Appearing Duplicate) in an array as the largest number that appears at least twice in the array. ...
code
{ "ground_truth": [ { "input": "4\n1\n1\n3\n2 2 3\n4\n2 1 1 2\n4\n4 4 4 4", "metadata": { "func_name": null }, "output": "1\n13\n9\n40", "testtype": "stdin" } ], "style": "rule" }
{ "index": 137, "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$ of size $n$.\n\nThere is an $n \\times n$ grid. In the $i$-th row, the first $a_i$ cells are black and the other ce...
code
{ "ground_truth": [ { "input": "10\n1\n0\n4\n2 4 4 2\n4\n3 2 1 0\n3\n0 3 0\n3\n0 1 3\n3\n3 1 0\n4\n3 1 0 3\n4\n0 2 2 2\n6\n1 3 4 2 0 4\n8\n2 2 5 2 3 4 2 4", "metadata": { "func_name": null }, "output": "0\n3\n2\n1\n2\n2\n3\n2\n4\n6", "testtype": "stdin" } ], "style": ...
{ "index": 138, "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 easy version of the problem. The only difference is the limit on the number of queries.\n\nThis is an interactive problem.\n\nYou ...
code
{ "ground_truth": [ { "input": "2\n2\n1 2\n\n1\n\n6\n1 2\n1 3\n1 4\n4 5\n5 6\n\n0\n\n0\n\n1", "metadata": { "func_name": null }, "output": "? 2\n\n! 2\n\n\n\n\n\n\n? 2\n\n? 6\n\n? 4\n\n! 4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 139, "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 hard version of the problem. The only difference is the limit on the number of queries.\n\nThis is an interactive problem.\n\nYou ...
code
{ "ground_truth": [ { "input": "2\n2\n1 2\n\n1\n\n6\n1 2\n1 3\n1 4\n4 5\n5 6\n\n0\n\n0\n\n1", "metadata": { "func_name": null }, "output": "? 2\n\n! 2\n\n\n\n\n\n\n? 2\n\n? 6\n\n? 4\n\n! 4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 140, "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$ of size $n$.\n\nA segment $[l, r](1 \\le l < r \\le n)$ is called a polygonal segment only if the following conditi...
code
{ "ground_truth": [ { "input": "2\n5 6\n3 1 2 2 8\n1 1 3\n1 1 4\n1 1 5\n2 1 5\n1 1 4\n1 1 5\n4 10\n500000000000 500000000000 1000000000000 500000000000\n1 1 3\n1 2 4\n1 1 4\n2 1 499999999999\n2 3 999999999999\n1 1 3\n1 2 4\n1 1 4\n2 3 1000000000000\n1 1 3", "metadata": { "func_name": null ...
{ "index": 141, "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$ of $n$ integers, where $n$ is odd.\n\nIn one operation, you will remove two adjacent elements from the array $a$, a...
code
{ "ground_truth": [ { "input": "4\n1\n6\n3\n1 3 2\n5\n4 7 4 2 9\n7\n3 1 4 1 5 9 2", "metadata": { "func_name": null }, "output": "6\n2\n9\n5", "testtype": "stdin" } ], "style": "rule" }
{ "index": 142, "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 $b$ of $n - 1$ integers.\n\nAn array $a$ of $n$ integers is called good if $b_i = a_i \\, \\& \\, a_{i + 1}$ for $1 \\l...
code
{ "ground_truth": [ { "input": "4\n2\n1\n3\n2 0\n4\n1 2 3\n5\n3 5 4 2", "metadata": { "func_name": null }, "output": "5 3\n3 2 1\n-1\n3 7 5 6 3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 143, "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$ of $n$ integers.\n\nIn one operation, you will perform the following two-step move:\n\n 1. Choose an integer $x$ (...
code
{ "ground_truth": [ { "input": "5\n1\n5\n2\n0 0\n3\n4 6 8\n4\n80 40 20 10\n5\n1 2 3 4 5", "metadata": { "func_name": null }, "output": "1\n5\n0\n\n3\n6 1 1\n7\n60 40 20 10 30 25 5\n-1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 144, "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 undirected graph with $n$ vertices, numbered from $1$ to $n$. There is an edge between vertices $u$ and $v$ if and only if $u...
code
{ "ground_truth": [ { "input": "6\n1\n2\n3\n4\n5\n6", "metadata": { "func_name": null }, "output": "1\n1\n2\n1 2\n2\n1 2 2\n3\n1 2 2 3\n3\n1 2 2 3 3\n4\n1 2 2 3 3 4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 145, "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\nConsider an undirected connected graph consisting of $n$ vertices and $m$ edges. Each vertex can be colored...
code
{ "ground_truth": [ { "input": "2\n3 3\n1 2\n2 3\n3 1\n\n\n3 1\n\n2 2\n\n1 1\n4 4\n1 2\n2 3\n3 4\n4 1\n\n2 3\n\n1 2\n\n2 1\n\n3 1", "metadata": { "func_name": null }, "output": "Alice\n3 1\n\n1 2\n\n2 1\n\n\n\n\n\n\nBob\n\n1 2\n\n2 1\n\n4 1\n\n3 3", "testtype": "stdin" } ...
{ "index": 146, "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 $n$ sticks, numbered from $1$ to $n$. The length of the $i$-th stick is $a_i$.\n\nYou need to answer $q$ queries. In each query,...
code
{ "ground_truth": [ { "input": "10 5\n5 2 2 10 4 10 6 1 5 3\n1 6\n2 7\n2 8\n5 10\n4 10", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 147, "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 grid consisting of $n$ rows and $m$ columns, where each cell is initially white. Additionally, you are given an integer $k$, w...
code
{ "ground_truth": [ { "input": "1\n4 5 3 6\nHVVHHV", "metadata": { "func_name": null }, "output": "1 1\n2 1\n1 1\n2 3\n3 3\n2 2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 148, "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 with $n$ piles of stones, where the $i$-th pile has $a_i$ stones. Players take turns making moves, with Alice...
code
{ "ground_truth": [ { "input": "4\n2\n2 1\n3\n3 5 7\n4\n4 6 8 10\n5\n8 8 8 8 8", "metadata": { "func_name": null }, "output": "Bob\nAlice\nAlice\nBob", "testtype": "stdin" } ], "style": "rule" }
{ "index": 149, "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 a grid with $n$ rows and $m$ columns. You need to fill each cell with a unique integer from $...
code
{ "ground_truth": [ { "input": "1\n4 4\n\n\n\n\n3 4\n\n4 4\n\n4 2\n\n4 1\n\n1 4\n\n1 2\n\n2 2\n\n2 1", "metadata": { "func_name": null }, "output": "2 3 4 10\n12 6 11 15\n5 13 16 8\n9 7 1 14\n\n2 4\n\n4 3\n\n3 3\n\n3 1\n\n1 3\n\n1 1\n\n2 3\n\n3 2", "testtype": "stdin" } ...
{ "index": 150, "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\nKmes has written three integers $a$, $b$ and $c$ in order to remember that he has to give Noobish_Monk $a \\times b \\times c$ bananas.\n\nNoo...
code
{ "ground_truth": [ { "input": "2\n2 3 4\n10 1 10", "metadata": { "func_name": null }, "output": "100\n600", "testtype": "stdin" } ], "style": "rule" }
{ "index": 151, "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\nTo celebrate his recovery, k1o0n has baked an enormous $n$ metres long potato casserole.\n\nTurns out, Noobish_Monk just can't stand potatoes,...
code
{ "ground_truth": [ { "input": "4\n5 3\n3 1 1\n5 2\n3 2\n11 4\n2 3 1 5\n16 6\n1 6 1 1 1 6", "metadata": { "func_name": null }, "output": "2\n3\n9\n15", "testtype": "stdin" } ], "style": "rule" }
{ "index": 152, "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\nGorilla and Noobish_Monk found three numbers $n$, $m$, and $k$ ($m < k$). They decided to construct a permutation$^{\\dagger}$ of length $n$.\...
code
{ "ground_truth": [ { "input": "3\n5 2 5\n3 1 3\n10 3 8", "metadata": { "func_name": null }, "output": "5 3 4 1 2\n3 2 1\n10 9 8 4 7 5 6 1 2 3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 153, "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\nErnKor is ready to do anything for Julen, even to swim through crocodile- infested swamps. We decided to test this love. ErnKor will have to s...
code
{ "ground_truth": [ { "input": "6\n6 2 0\nLWLLLW\n6 1 1\nLWLLLL\n6 1 1\nLWLLWL\n6 2 15\nLWLLCC\n6 10 0\nCCCCCC\n6 6 1\nWCCCCW", "metadata": { "func_name": null }, "output": "YES\nYES\nNO\nNO\nYES\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 154, "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 of the first programming problems by K1o0n looked like this: \"Noobish_Monk has $n$ $(1 \\le n \\le 100)$ friends. Each of them gave him $...
code
{ "ground_truth": [ { "input": "3\n2\n3\n10", "metadata": { "func_name": null }, "output": "3\n20 18 \n219 216 \n2218 2214 \n1\n165 162 \n1\n1262 2519", "testtype": "stdin" } ], "style": "rule" }
{ "index": 155, "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\nIn his favorite cafe Kmes once again wanted to try the herring under a fur coat. Previously, it would not have been difficult for him to do th...
code
{ "ground_truth": [ { "input": "8\n6 4\n2 3 6 2 1 2\n9 100000\n50000 25000 12500 6250 3125 2 4 8 16\n5 2\n1 1 1 1 1\n8 6\n4 3 4 3 4 3 4 3\n7 12\n6 11 1 3 11 10 2\n10 5\n2 4 4 2 4 4 4 3 1 1\n7 8\n4 6 5 1 2 4 1\n8 27\n3 9 17 26 2 20 9 3", "metadata": { "func_name": null }, "output": ...
{ "index": 156, "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\nK1o0n gave you an array $a$ of length $n$, consisting of numbers $1, 2, \\ldots, n$. Accept it? Of course! But what to do with it? Of course, ...
code
{ "ground_truth": [ { "input": "5\n2\n3\n4999\n5\n1", "metadata": { "func_name": null }, "output": "12\n31\n354226409\n184\n4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 157, "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\nTim is doing a test consisting of $4n$ questions; each question has $4$ options: 'A', 'B', 'C', and 'D'. For each option, there are exactly $n...
code
{ "ground_truth": [ { "input": "6\n1\nABCD\n2\nAAAAAAAA\n2\nAAAABBBB\n2\n????????\n3\nABCABCABCABC\n5\nACADC??ACAC?DCAABC?C", "metadata": { "func_name": null }, "output": "4\n2\n4\n0\n9\n13", "testtype": "stdin" } ], "style": "rule" }
{ "index": 158, "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 $n$ positive integers.\n\nIn one operation, you can pick any pair of indexes $(i, j)$ such that $a_i$ and $a_j$ have dis...
code
{ "ground_truth": [ { "input": "7\n5\n1 3 5 7 9\n4\n4 4 4 4\n3\n2 3 4\n4\n3 2 2 8\n6\n4 3 6 1 2 1\n6\n3 6 1 2 1 2\n5\n999999996 999999997 999999998 999999999 1000000000", "metadata": { "func_name": null }, "output": "0\n0\n2\n4\n3\n3\n3", "testtype": "stdin" } ], "sty...
{ "index": 159, "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 an apartment consisting of $n$ rooms, each with its light initially turned off.\n\nTo control the lights in these rooms, the owner of...
code
{ "ground_truth": [ { "input": "9\n4 4\n2 3 4 5\n4 3\n2 3 4 5\n4 3\n3 4 8 9\n3 3\n6 2 1\n1 1\n1\n7 5\n14 34 6 25 46 7 17\n6 5\n40 80 99 60 90 50\n6 5\n64 40 50 68 70 10\n2 1\n1 1000000000", "metadata": { "func_name": null }, "output": "5\n-1\n10\n8\n1\n47\n100\n-1\n-1", "test...
{ "index": 160, "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 positive integers $n$ and $k$, and another array $a$ of $n$ integers.\n\nIn one operation, you can select any subarray of size $k$ o...
code
{ "ground_truth": [ { "input": "5\n4 3\n3 9 9 2\n5 3\n3 2 5 6 4\n7 1\n5 9 2 6 5 4 6\n8 2\n7 1 2 6 8 3 4 5\n4 5\n3 4 5 6", "metadata": { "func_name": null }, "output": "3\n4\n9\n6\n4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 161, "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 matrix $a$ of size $n \\times m$, each cell of which contains a non-negative integer. The integer lying at the intersection of the $i$...
code
{ "ground_truth": [ { "input": "4\n1 2\n1 3\n2 3\n0 1 0\n5 4 4\n2 3\n0 2 4\n4 5 1\n3 3\n1 2 3\n4 5 6\n7 8 9", "metadata": { "func_name": null }, "output": "1\n3\n13\n24", "testtype": "stdin" } ], "style": "rule" }
{ "index": 162, "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 easy version of the problem. The only difference is that in this version $k \\le n$. You can make hacks only if both versions of t...
code
{ "ground_truth": [ { "input": "5\n2 2 2 2\nUR\n4 2 1 1\nLLDD\n6 3 3 1\nRLRRRL\n5 5 3 3\nRUURD\n7 5 3 4\nRRDLUUU", "metadata": { "func_name": null }, "output": "0\n4\n3\n0\n1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 163, "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 hard version of the problem. The only difference is that in this version $k \\le 10^{12}$. You can make hacks only if both version...
code
{ "ground_truth": [ { "input": "6\n2 4 2 2\nUR\n4 2 1 1\nLLDD\n6 3 3 1\nRLRRRL\n5 6 3 3\nRUURD\n7 5 3 4\nRRDLUUU\n7 123456789999 3 2\nULULURD", "metadata": { "func_name": null }, "output": "1\n4\n3\n1\n1\n41152263332", "testtype": "stdin" } ], "style": "rule" }
{ "index": 164, "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\nPetr, watching Sergey's stream, came up with a matrix $a$, consisting of $n$ rows and $m$ columns (the number in the $i$-th row and $j$-th col...
code
{ "ground_truth": [ { "input": "5\n1 1\n1\n2 1\n2\n1\n1 5\n2 4 5 3 1\n2 4\n1 2 3 4\n5 6 7 8\n3 3\n4 2 1\n9 8 3\n6 7 5", "metadata": { "func_name": null }, "output": "-1\n1 \n2 \n4 5 3 1 2 \n6 7 8 5 \n2 3 4 1 \n8 3 9 \n7 5 6 \n2 1 4", "testtype": "stdin" } ], "style": ...
{ "index": 165, "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\nVova really loves the [XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) operation (denoted as $\\oplus$). Recently, when he was going...
code
{ "ground_truth": [ { "input": "6\n1\n0\n1\n7\n0110100\n0110100\n9\n100101010\n101111110\n4\n0011\n1011\n4\n0100\n0001\n8\n10110111\n01100000", "metadata": { "func_name": null }, "output": "NO\nYES\nYES\nNO\nYES\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 166, "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\nYaroslav is playing a computer game, and at one of the levels, he encountered $n$ mushrooms arranged in a row. Each mushroom has its own level...
code
{ "ground_truth": [ { "input": "5\n4 2\n1 1 1 1\n3 2\n1 2 3\n1 6\n10\n6 3\n1 2 1 4 3 8\n5 999999999\n999999999 999999998 1000000000 1000000000 500000000", "metadata": { "func_name": null }, "output": "8\n2\n0\n10\n7", "testtype": "stdin" } ], "style": "rule" }
{ "index": 167, "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\nVanya has a graph with $n$ vertices (numbered from $1$ to $n$) and an array $a$ of $n$ integers; initially, there are no edges in the graph. V...
code
{ "ground_truth": [ { "input": "8\n2\n1 4\n4\n99 7 1 13\n5\n10 2 31 44 73\n5\n87 6 81 44 32\n5\n62 35 33 79 16\n5\n6 51 31 69 42\n5\n52 63 25 21 5\n12\n33 40 3 11 31 43 37 8 50 5 12 22", "metadata": { "func_name": null }, "output": "YES\n2 1\nYES\n4 1\n2 1\n3 2\nYES\n5 1\n4 1\n3 1\...
{ "index": 168, "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 forest of $k$ rooted trees$^{\\text{βˆ—}}$. Lumberjack Timofey wants to cut down the entire forest by applying the following ope...
code
{ "ground_truth": [ { "input": "3\n1\n1\n\n\n2\n4\n1 2 2\n6\n1 1 3 1 3\n1\n10\n1 2 2 1 1 5 7 6 4", "metadata": { "func_name": null }, "output": "1\n7\n10", "testtype": "stdin" } ], "style": "rule" }
{ "index": 169, "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\nPelican Town represents $n$ houses connected by $m$ bidirectional roads. Some roads have NPCs standing on them. Farmer Buba needs to walk on e...
code
{ "ground_truth": [ { "input": "3\n3 2\n1 2 1\n2 3 1\n3 3\n1 2 1\n1 3 1\n2 3 0\n5 9\n1 2 0\n5 2 1\n5 4 1\n5 1 1\n2 3 1\n5 2 1\n4 1 0\n4 3 0\n5 2 0", "metadata": { "func_name": null }, "output": "NO\nYES\n3\n1 2 3 1 \nYES\n7\n1 2 5 4 3 2 5 1", "testtype": "stdin" } ], ...
{ "index": 170, "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\nAfter winning another Bed Wars game, Masha and Olya wanted to relax and decided to play a new game. Masha gives Olya an array $a$ of length $n...
code
{ "ground_truth": [ { "input": "4\n4 5\n01011\n01110\n00110\n01100\n01111\n2 8\n00101001\n10111111\n10011110\n5 4\n0101\n0010\n0000\n0000\n0010\n0011\n6 5\n00011\n10110\n11001\n01010\n11100\n10011\n10000", "metadata": { "func_name": null }, "output": "01110\n10011010\n0010\n-1", ...
{ "index": 171, "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\nTimofey is writing a competition called Capture the Flag (or CTF for short). He has one task left, which in...
code
{ "ground_truth": [ { "input": "1\n\n32\n\n28", "metadata": { "func_name": null }, "output": "? aa\n\n? yb\n\n! 31 59", "testtype": "stdin" } ], "style": "rule" }
{ "index": 172, "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\nVitaly503 is given a checkered board with a side of $n$ and $k$ chips. He realized that all these $k$ chips need to be placed on the cells of ...
code
{ "ground_truth": [ { "input": "7\n1 0\n2 2\n2 3\n2 4\n10 50\n100 239\n3 9", "metadata": { "func_name": null }, "output": "0\n1\n2\n3\n6\n3\n5", "testtype": "stdin" } ], "style": "rule" }
{ "index": 173, "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 easy version of the problem. The only difference is that in this version, the flowers are specified by enumeration.\n\nA girl is p...
code
{ "ground_truth": [ { "input": "5\n5 10\n1 1 2 2 3\n8 20\n4 2 7 5 6 1 1 1\n8 100000\n239 30 610 122 24 40 8 2\n11 13\n2 4 11 1 1 2 3 5 4 3 2\n8 1033\n206 206 206 207 207 207 207 1000", "metadata": { "func_name": null }, "output": "7\n13\n610\n13\n1033", "testtype": "stdin" ...
{ "index": 174, "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 hard version of the problem. The only difference is that in this version, instead of listing the number of petals for each flower,...
code
{ "ground_truth": [ { "input": "7\n3 10\n1 2 3\n2 2 1\n3 1033\n206 207 1000\n3 4 1\n6 20\n4 2 7 5 6 1\n1 2 1 3 1 7\n8 100000\n239 30 610 122 24 40 8 2\n12 13123 112 1456 124 100 123 10982\n6 13\n2 4 11 1 3 5\n2 2 1 2 2 1\n8 10330\n206 210 200 201 198 199 222 1000\n9 10 11 12 13 14 15 16\n2 10000000000\n11 1...
{ "index": 175, "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\nikrpprpp found an array $a$ consisting of integers. He likes justice, so he wants to make $a$ fair β€” that is, make it non-decreasing. To do th...
code
{ "ground_truth": [ { "input": "7\n3\n1 2 3\n2\n3 2\n3\n3 1 5\n4\n1 1 2 3\n3\n4 3 2\n9\n16 2 4 2 256 2 4 2 8\n11\n10010 10009 10008 10007 10006 10005 10004 10003 10002 10001 10000", "metadata": { "func_name": null }, "output": "0\n1\n-1\n0\n3\n15\n55", "testtype": "stdin" ...
{ "index": 176, "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're a linguist studying a mysterious ancient language. You know that\n\n 1. Its words consist only of the first $c$ letters of the Latin a...
code
{ "ground_truth": [ { "input": "7\n5 5 1\nABCDE\n3 1 2\nAAA\n3 2 2\nAAB\n10 2 2\nABABABABAB\n4 4 4\nDCBA\n1 17 1\nQ\n9 3 2\nABCABCABC", "metadata": { "func_name": null }, "output": "5\n1\n2\n1\n1\n1\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 177, "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 easy version of a problem. The only difference between an easy and a hard version is the constraints on $t$ and $n$. You can make ...
code
{ "ground_truth": [ { "input": "5\n2\n6 6 4 4\n1\n10 17\n3\n1 10 1 10 1 10\n3\n3 3 4 5 5 4\n5\n1 2 3 4 5 6 7 8 9 10", "metadata": { "func_name": null }, "output": "0\n0\n0\n2\n4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 178, "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 hard version of a problem. The only difference between an easy and a hard version is the constraints on $t$ and $n$. You can make ...
code
{ "ground_truth": [ { "input": "5\n2\n6 6 4 4\n1\n10 17\n3\n1 10 1 10 1 10\n3\n3 3 4 5 5 4\n5\n1 2 3 4 5 6 7 8 9 10", "metadata": { "func_name": null }, "output": "0\n0\n0\n2\n4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 179, "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\nIt's another beautiful day on Farmer John's farm.\n\nAfter Farmer John arrived at his farm, he counted $n$ legs. It is known only chickens and...
code
{ "ground_truth": [ { "input": "3\n2\n6\n8", "metadata": { "func_name": null }, "output": "1\n2\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 180, "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\nTina has a square grid with $n$ rows and $n$ columns. Each cell in the grid is either $0$ or $1$.\n\nTina wants to reduce the grid by a factor...
code
{ "ground_truth": [ { "input": "4\n4 4\n0000\n0000\n0000\n0000\n6 3\n000111\n000111\n000111\n111000\n111000\n111000\n6 2\n001100\n001100\n111111\n111111\n110000\n110000\n8 1\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111\n11111111", "metadata": { "func_name": null ...
{ "index": 181, "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 strings $a$ and $b$ of length $n$. Then, you are (forced against your will) to answer $q$ queries.\n\nFor each query, you ar...
code
{ "ground_truth": [ { "input": "3\n5 3\nabcde\nedcba\n1 5\n1 4\n3 3\n4 2\nzzde\nazbe\n1 3\n1 4\n6 3\nuwuwuw\nwuwuwu\n2 4\n1 3\n1 6", "metadata": { "func_name": null }, "output": "0\n1\n0\n2\n2\n1\n1\n0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 182, "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\nCounting is Fun!\n\nβ€” satyam343\n\nGiven two integers $n$ and $x$, find the number of triplets ($a,b,c$) of positive integers such that $ab + ...
code
{ "ground_truth": [ { "input": "4\n7 4\n10 5\n7 1000\n900000 400000", "metadata": { "func_name": null }, "output": "4\n10\n7\n1768016938", "testtype": "stdin" } ], "style": "rule" }
{ "index": 183, "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\nIn a desperate attempt to obtain your waifu favorite character, you have hacked into the source code of the game. After days of struggling, yo...
code
{ "ground_truth": [ { "input": "4\n0000\n01010101\n1100111001\n11000000111", "metadata": { "func_name": null }, "output": "0\n130\n147\n70", "testtype": "stdin" } ], "style": "rule" }
{ "index": 184, "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\nSparkle gives you two arrays $a$ and $b$ of length $n$. Initially, your score is $0$. In one operation, you can choose an integer $i$ and add ...
code
{ "ground_truth": [ { "input": "5\n3 4\n5 6 7\n2 3 4\n5 9\n32 52 68 64 14\n18 14 53 24 8\n5 1000\n1 2 3 4 5\n5 4 3 2 1\n1 1000000\n1000000\n1\n10 6\n3 3 5 10 6 8 6 8 7 7\n6 1 7 4 1 1 8 9 3 1", "metadata": { "func_name": null }, "output": "21\n349\n27\n500000500000\n47", "test...
{ "index": 185, "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 Penacony, The Land of the Dreams, there exists $n$ houses and $n$ roads. There exists a road between house $i$ and $i+1$ for all $1 \\leq i...
code
{ "ground_truth": [ { "input": "7\n8 3\n1 8\n2 7\n4 5\n13 4\n1 13\n2 12\n3 11\n4 10\n10 2\n2 3\n3 4\n10 4\n3 8\n5 10\n2 10\n4 10\n4 1\n1 3\n5 2\n3 5\n1 4\n5 2\n2 5\n1 3", "metadata": { "func_name": null }, "output": "4\n7\n2\n7\n2\n3\n3", "testtype": "stdin" } ], "sty...
{ "index": 186, "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's current password on Codeforces is a string $s$, consisting of lowercase Latin letters. Monocarp thinks that his current password is...
code
{ "ground_truth": [ { "input": "4\na\naaa\nabb\npassword", "metadata": { "func_name": null }, "output": "wa\naada\nabcb\npastsword", "testtype": "stdin" } ], "style": "rule" }
{ "index": 187, "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 grid, consisting of $2$ rows and $n$ columns. Each cell of the grid is either free or blocked.\n\nA free cell $y$ is reachable from...
code
{ "ground_truth": [ { "input": "4\n8\n.......x\n.x.xx...\n2\n..\n..\n3\nxxx\nxxx\n9\n..x.x.x.x\nx.......x", "metadata": { "func_name": null }, "output": "1\n0\n0\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 188, "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 had a regular bracket sequence $s$ of length $n$ ($n$ is even). He even came up with his own way to calculate its cost.\n\nHe knows t...
code
{ "ground_truth": [ { "input": "4\n6\n_(_)_)\n2\n_)\n8\n_)_)_)_)\n8\n_(_)_(_)", "metadata": { "func_name": null }, "output": "5\n1\n4\n8", "testtype": "stdin" } ], "style": "rule" }
{ "index": 189, "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. The vertices in the tree are numbered from $1$ to $n$, and the root is the vertex $1$...
code
{ "ground_truth": [ { "input": "3\n4\n0 1 0 2\n1 1 3\n2\n3 0\n1\n5\n2 5 3 9 6\n3 1 5 2", "metadata": { "func_name": null }, "output": "1\n3\n6", "testtype": "stdin" } ], "style": "rule" }
{ "index": 190, "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 playing a computer game. He starts the game being level $1$. He is about to fight $n$ monsters, in order from $1$ to $n$. The leve...
code
{ "ground_truth": [ { "input": "4 16\n2 1 2 1\n1 1\n2 1\n3 1\n4 1\n1 2\n2 2\n3 2\n4 2\n1 3\n2 3\n3 3\n4 3\n1 4\n2 4\n3 4\n4 4", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nNO\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nNO\nYES\nYES\nYES\nYES", "testtype": "stdin" }...
{ "index": 191, "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 $n$ chips, and you are going to place all of them in one of $x$ points, numbered from $1$ to $x$. There can be multiple chips in each...
code
{ "ground_truth": [ { "input": "2 3 1", "metadata": { "func_name": null }, "output": "5", "testtype": "stdin" }, { "input": "42 10 5", "metadata": { "func_name": null }, "output": "902673363", "testtype": "stdin" }, { ...
{ "index": 192, "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\nI couldn't think of a good title for this problem, so I decided to learn from LeetCode.\n\nβ€” Sun Tzu, The Art of War\n\nYou are given three in...
code
{ "ground_truth": [ { "input": "4\n10 10 1\n0 0 3\n-5 -8 8\n4 -5 3", "metadata": { "func_name": null }, "output": "10 10\n-1 -1\n5 -1\n-4 2\n-6 -7\n-5 -7\n-4 -7\n-4 -8\n-4 -9\n-5 -9\n-6 -9\n-6 -8\n1000 -1000\n-996 995\n8 -10", "testtype": "stdin" } ], "style": "rule" ...
{ "index": 193, "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\nIt is known that [Farmer John likes Permutations](https://usaco.org/index.php?page=viewproblem2&cpid=1421), but I like them too!\n\nβ€” Sun Tzu,...
code
{ "ground_truth": [ { "input": "3\n2\n1 2\n5\n1 2 3 4 5\n7\n4 7 5 1 2 6 3", "metadata": { "func_name": null }, "output": "2 1\n3 5 4 2 1\n6 2 1 4 7 3 5", "testtype": "stdin" } ], "style": "rule" }
{ "index": 194, "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\nI see satyam343. I'm shaking. Please more median problems this time. I love those. Please satyam343 we believe in you.\n\nβ€” satyam343's bigges...
code
{ "ground_truth": [ { "input": "8\n2 10\n3 3\n1 1\n3 10\n3 3 3\n0 0 0\n4 4\n2 1 5 1\n0 1 0 1\n5 4\n7 5 2 5 4\n0 0 1 0 1\n5 1\n5 15 15 2 11\n1 0 0 1 1\n5 2\n10 11 4 10 15\n1 1 0 1 0\n4 4\n1 1 2 5\n1 1 0 0\n2 1000000000\n1000000000 1000000000\n1 1", "metadata": { "func_name": null }, ...
{ "index": 195, "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\nMOOOOOOOOOOOOOOOOO\n\nβ€” Bessie the Cow, The Art of Racing on Islands\n\nTwo of Farmer John's cows, Bessie and Elsie, are planning to race on $...
code
{ "ground_truth": [ { "input": "5\n6 0\n6 1\n2 6\n6 1\n1 5\n10 4\n1 3\n1 6\n2 7\n3 8\n15 3\n2 8\n4 9\n8 15", "metadata": { "func_name": null }, "output": "11111\n11011\n10011\n100001111\n11000111000111", "testtype": "stdin" } ], "style": "rule" }
{ "index": 196, "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\nDrink water.\n\nβ€” Sun Tzu, The Art of Becoming a Healthy Programmer\n\nThis is the easy version of the problem. The only difference is that $x...
code
{ "ground_truth": [ { "input": "3\n5 5\n1 2 3 2 1\n7 7\n4 5 1 2 1 4 5\n11 11\n1 2 3 1 1 9 3 2 4 1 3", "metadata": { "func_name": null }, "output": "3\n4\n4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 197, "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\nDrink water.\n\nβ€” Sun Tzu, The Art of Becoming a Healthy Programmer\n\nThis is the hard version of the problem. The only difference is that $x...
code
{ "ground_truth": [ { "input": "3\n5 1\n1 2 3 2 1\n7 1\n4 5 1 2 1 4 5\n11 1\n1 2 3 1 1 9 3 2 4 1 3", "metadata": { "func_name": null }, "output": "1 1 2 2 3\n1 1 1 1 1 3 4\n1 1 2 2 2 1 1 1 3 3 4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 198, "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 two-digit positive integer $n$, find the sum of its digits.\n\nInput Format:\nThe first line contains an integer $t$ ($1 \\leq t \\leq...
code
{ "ground_truth": [ { "input": "8\n77\n21\n40\n34\n19\n84\n10\n99", "metadata": { "func_name": null }, "output": "14\n3\n4\n7\n10\n12\n1\n18", "testtype": "stdin" } ], "style": "rule" }
{ "index": 199, "solution": "", "split": "test" }