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\nSuneet and Slavic play a card game. The rules of the game are as follows:\n\n * Each card has an integer value between $1$ and $10$. * Eac...
code
{ "ground_truth": [ { "input": "5\n3 8 2 6\n1 1 1 1\n10 10 2 2\n1 1 10 10\n3 8 7 2", "metadata": { "func_name": null }, "output": "2\n0\n4\n0\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 200, "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\nAs a computer science student, Alex faces a hard challenge β€” showering. He tries to shower daily, but despite his best efforts there are alway...
code
{ "ground_truth": [ { "input": "4\n3 3 10\n3 5\n6 8\n9 10\n3 3 10\n1 2\n3 5\n6 7\n3 3 10\n1 2\n3 5\n6 8\n3 4 10\n1 2\n6 7\n8 9", "metadata": { "func_name": null }, "output": "YES\nYES\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 201, "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\nSlavic has a very tough exam and needs your help in order to pass it. Here is the question he is struggling with:\n\nThere exists a string $s$...
code
{ "ground_truth": [ { "input": "5\n?????\nxbx\nab??e\nabcde\nayy?x\na\nab??e\ndac\npaiu\nmom", "metadata": { "func_name": null }, "output": "YES\nxabax\nYES\nabcde\nYES\nayyyx\nNO\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 202, "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 the board Ivy wrote down all integers from $l$ to $r$, inclusive.\n\nIn an operation, she does the following:\n\n * pick two numbers $x$ a...
code
{ "ground_truth": [ { "input": "4\n1 3\n2 4\n199999 200000\n19 84", "metadata": { "func_name": null }, "output": "5\n6\n36\n263", "testtype": "stdin" } ], "style": "rule" }
{ "index": 203, "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\nArul has a binary array$^{\\text{βˆ—}}$ $a$ of length $n$.\n\nHe will take all subsequences$^{\\text{†}}$ of length $k$ ($k$ is odd) of this arr...
code
{ "ground_truth": [ { "input": "8\n4 3\n1 0 0 1\n5 1\n1 1 1 1 1\n5 5\n0 1 0 1 0\n6 3\n1 0 1 0 1 1\n4 3\n1 0 1 1\n5 3\n1 0 1 1 0\n2 1\n0 0\n34 17\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1", "metadata": { "func_name": null }, "output": "2\n5\n0\n16\n4\n7\n0...
{ "index": 204, "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 that in this version, you can make at most $\\mathbf{...
code
{ "ground_truth": [ { "input": "2\n\n18\n\n25\n\n\n9999", "metadata": { "func_name": null }, "output": "? 3 5\n\n? 4 4\n\n! 4\n? 99 100\n\n! 100", "testtype": "stdin" } ], "style": "rule" }
{ "index": 205, "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 that in this version, you can make at most $\\mathbf{...
code
{ "ground_truth": [ { "input": "2\n\n18\n\n25\n\n\n9999", "metadata": { "func_name": null }, "output": "? 3 5\n\n? 4 4\n\n! 4\n? 99 100\n\n! 100", "testtype": "stdin" } ], "style": "rule" }
{ "index": 206, "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 wrote down $t$ integers on the board, and that is good. He is sure that he lost an important integer $n$ among them, and that is bad.\n...
code
{ "ground_truth": [ { "input": "7\n100\n1010\n101\n105\n2033\n1019\n1002", "metadata": { "func_name": null }, "output": "NO\nYES\nNO\nYES\nNO\nYES\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 207, "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 Berland, a bus consists of a row of $n$ seats numbered from $1$ to $n$. Passengers are advised to always board the bus following these rule...
code
{ "ground_truth": [ { "input": "4\n5\n5 4 2 1 3\n3\n2 3 1\n4\n2 3 1 4\n5\n1 2 3 5 4", "metadata": { "func_name": null }, "output": "NO\nYES\nYES\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 208, "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\nKristina has an array $a$, called a template, consisting of $n$ integers. She also has $m$ strings, each consisting only of lowercase Latin le...
code
{ "ground_truth": [ { "input": "3\n5\n3 5 2 1 3\n2\nabfda\nafbfa\n2\n1 2\n3\nab\nabc\naa\n4\n5 -3 5 -3\n4\naaaa\nbcbc\naba\ncbcb", "metadata": { "func_name": null }, "output": "YES\nNO\nYES\nNO\nNO\nNO\nYES\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 209, "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 found a strip of $n$ cells, numbered from left to right from $1$ to $n$. In the $i$-th cell, there is a positive integer $a_i$ and a lett...
code
{ "ground_truth": [ { "input": "4\n6\n3 5 1 4 3 2\nLRLLLR\n2\n2 8\nLR\n2\n3 9\nRL\n5\n1 2 3 4 5\nLRLRR", "metadata": { "func_name": null }, "output": "18\n10\n0\n22", "testtype": "stdin" } ], "style": "rule" }
{ "index": 210, "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 really love gorillas, so you decided to organize a photoshoot for them. Gorillas live in the jungle. The jungle is represented as a grid o...
code
{ "ground_truth": [ { "input": "5\n3 4 2\n9\n1 1 1 1 1 1 1 1 1\n2 1 1\n2\n5 7\n20 15 7\n9\n4 1 4 5 6 1 1000000000 898 777\n1984 1 1\n4\n5 4 1499 2004\n9 5 5\n6\n6 7 14 16 16 6", "metadata": { "func_name": null }, "output": "21\n12\n49000083104\n3512\n319", "testtype": "stdin"...
{ "index": 211, "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$ rectangles, the $i$-th of which has a width of $a_i$ and a height of $b_i$.\n\nYou can perform the following operation an unlimit...
code
{ "ground_truth": [ { "input": "7\n1 4\n6 3\n1 5\n4 4\n5 10\n1 1\n1 1\n1 1\n1 1\n1 1\n2 100\n1 2\n5 6\n3 11\n2 2\n3 3\n4 4\n3 25\n9 2\n4 3\n8 10\n4 18\n5 4\n8 5\n8 3\n6 2", "metadata": { "func_name": null }, "output": "12\n14\n5\n-1\n17\n80\n35", "testtype": "stdin" } ]...
{ "index": 212, "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 live in a city consisting of $n$ intersections and $m$ streets connecting some pairs of intersections. You can travel in either direction ...
code
{ "ground_truth": [ { "input": "7\n5 5\n100 20 80\n1 5 30 100\n1 2 20 50\n2 3 20 50\n3 4 20 50\n4 5 20 50\n2 1\n100 50 60\n1 2 55 110\n4 4\n100 40 60\n1 2 30 100\n2 4 30 100\n1 3 20 50\n3 4 20 50\n3 3\n100 80 90\n1 2 1 10\n2 3 10 50\n1 3 20 21\n3 2\n58 55 57\n2 1 1 3\n2 3 3 4\n2 1\n12 9 10\n2 1 6 10\n5 5\n8...
{ "index": 213, "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\nKsyusha decided to start a game development company. To stand out among competitors and achieve success, she decided to write her own game eng...
code
{ "ground_truth": [ { "input": "3\n5\n1 2 5 905 2000000\n15\n- 2\n? 2\n? 1\n- 1\n? 1\n+ 4\n+ 2\n? 2\n+ 6\n- 4\n+ 7\n? 2\n? 3\n? 4\n? 2000000\n5\n3 4 5 6 8\n9\n? 5\n- 5\n? 5\n+ 1\n? 2\n- 6\n- 8\n+ 6\n? 5\n5\n6 7 8 9 10\n10\n? 5\n- 6\n? 4\n- 10\n+ 5\n- 8\n+ 3\n+ 2\n- 3\n+ 10", "metadata": { "fun...
{ "index": 214, "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 cyclic array $a_1, a_2, \\ldots, a_n$.\n\nYou can perform the following operation on $a$ at most $n - 1$ times:\n\n * Let $m$...
code
{ "ground_truth": [ { "input": "7\n1\n1\n3\n1 2 3\n3\n1 2 2\n5\n5 4 3 2 1\n6\n1 1 2 2 3 3\n8\n8 7 6 3 8 7 6 3\n6\n1 1 4 5 1 4", "metadata": { "func_name": null }, "output": "0\n2\n1\n4\n4\n6\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 215, "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 integer sequence $a$ of length $n$, where each element is initially $-1$.\n\nMisuki has two typewriters where the first one writes...
code
{ "ground_truth": [ { "input": "3\n1\n2\n3", "metadata": { "func_name": null }, "output": "1\n-1\n3 1 2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 216, "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\nMisuki has chosen a secret tree with $n$ nodes, indexed from $1$ to $n$, and asked you to guess it by using...
code
{ "ground_truth": [ { "input": "1\n4\n1\n1\n3", "metadata": { "func_name": null }, "output": "? 1 2\n\n? 1 3\n\n? 1 4\n\n! 1 2 1 3 3 4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 217, "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 integer sequence $a_1, a_2, \\ldots, a_n$. Let $S$ be the set of all possible non-empty subsequences of $a$ without duplicate...
code
{ "ground_truth": [ { "input": "4\n4\n3 2 1 3\n4\n1 1 1 1\n9\n3 2 1 3 2 1 3 2 1\n1\n1", "metadata": { "func_name": null }, "output": "3\n3 2 1\n1\n1\n3\n3 1 2\n1\n1", "testtype": "stdin" }, { "input": "10\n2\n1 2\n10\n5 2 1 7 9 7 2 5 5 2\n2\n1 2\n10\n2 2 8 7 7 9...
{ "index": 218, "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 difference between the two versions is the definition of deterministic max-heap, time limit, and ...
code
{ "ground_truth": [ { "input": "7\n1 13 998244353\n2 1 998244353\n3 2 998244853\n3 3 998244353\n3 4 100000037\n4 2 100000039\n4 3 100000037", "metadata": { "func_name": null }, "output": "1\n2\n12\n52\n124\n32\n304", "testtype": "stdin" }, { "input": "1\n500 500...
{ "index": 219, "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 difference between the two versions is the definition of deterministic max-heap, time limit, and ...
code
{ "ground_truth": [ { "input": "6\n2 1 998244353\n3 2 998244853\n3 3 998244353\n3 4 100000037\n4 2 100000039\n4 3 100000037", "metadata": { "func_name": null }, "output": "2\n12\n40\n100\n32\n224", "testtype": "stdin" }, { "input": "1\n100 500 100000037", ...
{ "index": 220, "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 received an $n\\times m$ grid from a mysterious source. The source also gave you a magic positive integer constant $k$.\n\nThe source told...
code
{ "ground_truth": [ { "input": "6\n3 3 2\n5 1 10000\n7 3 4\n3 2 7\n8 9 6\n2 5 4", "metadata": { "func_name": null }, "output": "4\n5\n12\n6\n36\n8", "testtype": "stdin" } ], "style": "rule" }
{ "index": 221, "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 got a permutation $a_1, a_2, \\ldots, a_n$ of $[1,2,\\ldots,n]$, and Bob got another permutation $b_1, b_2, \\ldots, b_n$ of $[1,2,\\ldo...
code
{ "ground_truth": [ { "input": "2\n2\n1 2\n1 2\n3\n1 2 3\n2 3 1", "metadata": { "func_name": null }, "output": "Bob\nAlice", "testtype": "stdin" } ], "style": "rule" }
{ "index": 222, "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$ circles on a two-dimensional plane. The $i$-th circle is centered at $(x_i,y_i)$. Initially, all circles have a radius of $0$.\n...
code
{ "ground_truth": [ { "input": "7\n3\n2 5\n2 14\n10 13\n4 9 9 7\n3\n10 11\n6 9\n12 12\n14 13 4 8\n1\n5 7\n12 6 11 13\n2\n1000000000 2\n2 1000000000\n1 1 2 2\n1\n999999998 1000000000\n999999999 999999999 1 1\n1\n1000000000 1\n1 1000000000 1 1\n10\n989237121 2397081\n206669655 527238537\n522705783 380636165\n...
{ "index": 223, "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. In this version, the given tree is a perfect binary tree and the constraints on $n$ and $q$ are lower...
code
{ "ground_truth": [ { "input": "2\n3 3\n1 1\n1 2 3\n2 3\n3 2\n1 3\n7 4\n1 1 2 2 3 3\n1 2 3 4 5 6 7\n3 5\n2 5\n3 7\n4 6", "metadata": { "func_name": null }, "output": "YES\nYES\nNO\nYES\nNO\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 224, "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. In this version, you are given a generic tree and the constraints on $n$ and $q$ are higher. You can ...
code
{ "ground_truth": [ { "input": "3\n3 3\n1 1\n1 2 3\n2 3\n3 2\n1 3\n7 4\n1 1 2 2 3 3\n1 2 3 4 5 6 7\n3 5\n2 5\n3 7\n4 6\n5 4\n1 1 3 4\n2 3 4 5 1\n5 1\n4 5\n3 4\n2 3", "metadata": { "func_name": null }, "output": "YES\nYES\nNO\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES", "testtype": "...
{ "index": 225, "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 of integers $s_1, s_2, \\ldots, s_l$, every second, cosmic rays will cause all $s_i$ such that $i=1$ or $s_i\\neq s_{i-1}$ to b...
code
{ "ground_truth": [ { "input": "4\n4\n2 0\n1 1\n3 0\n5 1\n6\n4 6\n1 3\n4 6\n4 0\n7 6\n6 3\n7\n9 0\n7 1\n5 0\n7 1\n9 0\n1 1\n2 0\n10\n10 7\n4 9\n2 2\n7 9\n2 8\n8 5\n11 7\n15 5\n12 7\n4 0", "metadata": { "func_name": null }, "output": "2 2 4 5 \n4 4 7 7 10 10 \n9 9 9 9 9 9 10 \n10 10...
{ "index": 226, "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. In this version, $n=m$ and the time limit is lower. You can make hacks only if both versions of the p...
code
{ "ground_truth": [ { "input": "8\n3 3 2 5\n4 4 1 4\n6 6 2 2\n7 7 2 3\n9 9 9 1\n2 2 1 4\n5 5 1 4\n8 8 6 7", "metadata": { "func_name": null }, "output": "19\n17\n18\n33\n86\n9\n24\n86", "testtype": "stdin" }, { "input": "1\n20000000 20000000 1341 331", "me...
{ "index": 227, "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. In this version, it is not guaranteed that $n=m$, and the time limit is higher. You can make hacks on...
code
{ "ground_truth": [ { "input": "8\n3 4 2 5\n4 4 1 4\n6 6 2 2\n7 9 2 3\n8 9 9 1\n2 7 1 4\n5 9 1 4\n5 6 6 7", "metadata": { "func_name": null }, "output": "22\n17\n18\n37\n77\n30\n41\n59", "testtype": "stdin" }, { "input": "2\n3082823 20000000 1341 331\n20000000 2...
{ "index": 228, "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 a grid graph with $n$ rows and $n$ columns. Let the cell in row $x$ and column $y$ be $(x,y)$. There exists a directed edge from $(x,...
code
{ "ground_truth": [ { "input": "2\n3\n1 0 2\n0 1 3\n2 1\n0 3\n3 0\n3\n1 2 0\n0 1 2\n2 0\n1 2\n0 1", "metadata": { "func_name": null }, "output": "3\n2", "testtype": "stdin" }, { "input": "1\n10\n16 7 3 15 9 17 1 15 9 0\n4 3 1 12 13 10 10 14 6 12\n3 1 3 9 5 16 0 ...
{ "index": 229, "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 been a long summer's day, with the constant chirping of cicadas and the heat which never seemed to end. Finally, it has drawn to a close....
code
{ "ground_truth": [ { "input": "2\n3 2\n10 10", "metadata": { "func_name": null }, "output": "6 2 \n1590121 23399118 382293180 213020758 379696760", "testtype": "stdin" } ], "style": "rule" }
{ "index": 230, "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 thinks a string $s$ is a good string if there exists a sequence of strings $t_1, t_2, \\ldots, t_k$ ($k$ is an arbitrary integer) such ...
code
{ "ground_truth": [ { "input": "4\n2\naa\n3\naba\n4\nabcb\n12\nabcabcabcabc", "metadata": { "func_name": null }, "output": "No\nnO\nYes\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 231, "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 game on a sequence. They are given a sequence $a_1, a_2, \\ldots, a_n$, and Turtle goes first. Turtle and Piggy...
code
{ "ground_truth": [ { "input": "5\n2\n1 2\n3\n1 1 2\n3\n1 2 3\n5\n3 1 2 2 3\n10\n10 2 5 2 7 9 2 5 10 7", "metadata": { "func_name": null }, "output": "2\n1\n2\n2\n7", "testtype": "stdin" } ], "style": "rule" }
{ "index": 232, "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 gives you a string $s$, consisting of lowercase Latin letters.\n\nTurtle considers a pair of integers $(i, j)$ ($1 \\le i < j \\le n$) ...
code
{ "ground_truth": [ { "input": "5\n3\nabc\n5\nedddf\n6\nturtle\n8\npppppppp\n10\ncodeforces", "metadata": { "func_name": null }, "output": "acb\nddedf\nurtlet\npppppppp\ncodeforces", "testtype": "stdin" } ], "style": "rule" }
{ "index": 233, "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. In this version of the problem, you can choose the same integer twice or more. You can make hacks onl...
code
{ "ground_truth": [ { "input": "6\n3 4\n2 0 2\n3 2 3 3\n4 7 0 1 5\n3 4\n5 0 2 0 4 11\n1 1\n5 1 3 0 3 3\n2 50\n2 1 2\n2 1 2\n1 1\n7 1 2 4 1 4 9 5\n4 114514\n2 2 2\n5 7 3 6 0 3\n3 0 1 1\n5 0 9 2 1 5\n5 1919810\n1 2\n2 324003 0\n3 1416324 2 1460728\n4 1312631 2 0 1415195\n5 1223554 192248 2 1492515 725556", ...
{ "index": 234, "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. In this version of the problem, you can't choose the same integer twice or more. You can make hacks o...
code
{ "ground_truth": [ { "input": "6\n3 4\n2 0 2\n3 2 3 3\n4 7 0 1 5\n3 4\n5 0 2 0 4 11\n1 1\n5 1 3 0 3 3\n2 50\n2 1 2\n2 1 2\n1 1\n7 1 2 4 1 4 9 5\n4 114514\n2 2 2\n5 7 3 6 0 3\n3 0 1 1\n5 0 9 2 1 5\n5 1919810\n1 2\n2 324003 0\n3 1416324 2 1460728\n4 1312631 2 0 1415195\n5 1223554 192248 2 1492515 725556", ...
{ "index": 235, "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 this problem. The differences between the versions are the constraint on $m$ and $r_i < l_{i + 1}$ holds for each $...
code
{ "ground_truth": [ { "input": "6\n2 0\n2 1\n1 2\n5 1\n2 4\n8 2\n1 4\n6 8\n7 2\n1 3\n4 7\n7 3\n1 2\n3 4\n5 6", "metadata": { "func_name": null }, "output": "1\n0\n8\n21\n15\n15", "testtype": "stdin" } ], "style": "rule" }
{ "index": 236, "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 this problem. The differences between the versions are the constraint on $m$ and $r_i < l_{i + 1}$ holds for each $i...
code
{ "ground_truth": [ { "input": "8\n2 0\n2 1\n1 2\n5 1\n2 4\n8 3\n1 4\n2 5\n7 8\n7 2\n1 4\n4 7\n7 3\n1 2\n1 7\n3 7\n7 4\n1 3\n4 7\n1 3\n4 7\n7 3\n1 2\n3 4\n5 6", "metadata": { "func_name": null }, "output": "1\n0\n8\n18\n-1\n-1\n15\n15", "testtype": "stdin" } ], "style...
{ "index": 237, "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\nPiggy gives Turtle three sequences $a_1, a_2, \\ldots, a_n$, $b_1, b_2, \\ldots, b_n$, and $c_1, c_2, \\ldots, c_n$.\n\nTurtle will choose a s...
code
{ "ground_truth": [ { "input": "4 2\n2 3 4 2\n1 3 3 2\n1 4 2 3", "metadata": { "func_name": null }, "output": "5", "testtype": "stdin" }, { "input": "7 3\n1 4 5 2 3 6 7\n1 2 2 1 1 3 2\n1 5 6 7 3 2 4", "metadata": { "func_name": null }, ...
{ "index": 238, "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 a set of points on a line. The distance between two points $i$ and $j$ is $|i - j|$.\n\nThe point $i$ from the set is the closest to ...
code
{ "ground_truth": [ { "input": "3\n2\n3 8\n2\n5 6\n6\n1 2 3 4 5 10", "metadata": { "func_name": null }, "output": "YES\nNO\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 239, "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 $100$ rooms arranged in a row and $99$ doors between them; the $i$-th door connects rooms $i$ and $i+1$. Each door can be either loc...
code
{ "ground_truth": [ { "input": "4\n1 2\n3 4\n2 5\n2 5\n3 7\n6 7\n4 5\n2 8", "metadata": { "func_name": null }, "output": "1\n3\n2\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 240, "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 have $n$ items they'd like to split between them, so they decided to play a game. All items have a cost, and the $i$-th item cos...
code
{ "ground_truth": [ { "input": "4\n2 5\n1 10\n3 0\n10 15 12\n4 6\n3 1 2 4\n2 4\n6 9", "metadata": { "func_name": null }, "output": "4\n13\n0\n0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 241, "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$ cities located on a straight line. The cities are numbered from $1$ to $n$.\n\nPortals are used to move between cities. There ar...
code
{ "ground_truth": [ { "input": "2\n4 5\nBR BR GY GR\n1 2\n3 1\n4 4\n1 4\n4 2\n2 1\nBG RY\n1 2", "metadata": { "func_name": null }, "output": "1\n4\n0\n3\n2\n-1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 242, "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 players, Alice and Bob, are playing a game. They have $n$ piles of stones, with the $i$-th pile initially containing $a_i$ stones.\n\nOn t...
code
{ "ground_truth": [ { "input": "3\n3\n3 2 9\n4\n3 3 6 1\n5\n1 2 3 4 5", "metadata": { "func_name": null }, "output": "Bob\nAlice\nBob", "testtype": "stdin" } ], "style": "rule" }
{ "index": 243, "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$ integers.\n\nLet the function $f(b)$ return the minimum number of operations needed to make an ar...
code
{ "ground_truth": [ { "input": "4\n3\n2 1 3\n4\n1 1 1 1\n5\n4 2 3 1 5\n4\n1 2 1 2", "metadata": { "func_name": null }, "output": "3\n0\n14\n5", "testtype": "stdin" } ], "style": "rule" }
{ "index": 244, "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 define the operation of compressing a string $t$, consisting of at least $2$ digits from $1$ to $9$, as follows:\n\n * split it into an...
code
{ "ground_truth": [ { "input": "4 4\n5999", "metadata": { "func_name": null }, "output": "14", "testtype": "stdin" }, { "input": "10 3\n1111111111", "metadata": { "func_name": null }, "output": "2 2 2 2 2 2 2 2", "testtype": "stdi...
{ "index": 245, "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\nNarek has to spend 2 hours with some 2-year-old kids at the kindergarten. He wants to teach them competitive programming, and their first less...
code
{ "ground_truth": [ { "input": "3\n2\n3\n6", "metadata": { "func_name": null }, "output": "uo\niae\noeiiua", "testtype": "stdin" } ], "style": "rule" }
{ "index": 246, "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 differences between the two versions are the constraints on $m$ and $q$. In this version, $m...
code
{ "ground_truth": [ { "input": "3\n10 2 1\n1 4\n2\n8 2 1\n3 6\n1\n8 2 1\n3 6\n8", "metadata": { "func_name": null }, "output": "1\n2\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 247, "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 differences between the two versions are the constraints on $m$ and $q$. In this version, $m...
code
{ "ground_truth": [ { "input": "2\n8 1 1\n6\n3\n10 3 3\n1 4 8\n2 3 10", "metadata": { "func_name": null }, "output": "5\n1\n1\n2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 248, "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\nNarek is too lazy to create the third problem of this contest. His friend Artur suggests that he should use ChatGPT. ChatGPT creates $n$ probl...
code
{ "ground_truth": [ { "input": "4\n5 2\nnn\naa\nrr\nee\nkk\n1 5\nnarek\n1 4\nnare\n5 7\nnrrarek\nnrnekan\nuuuuuuu\nppppppp\nnkarekz", "metadata": { "func_name": null }, "output": "0\n5\n0\n7", "testtype": "stdin" } ], "style": "rule" }
{ "index": 249, "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 arrays $a_1, a_2, \\ldots, a_n$ and $b_1, b_2, \\ldots, b_n$.\n\nYou must perform the following operation exactly once:\n\n ...
code
{ "ground_truth": [ { "input": "5\n8\n11 4 16 17 3 24 25 8\n8 10 4 21 17 18 25 21\n4\n6 4 24 13\n15 3 1 14\n2\n13 14\n5 8\n8\n20 17 15 11 21 10 3 7\n9 9 4 20 14 9 13 1\n2\n18 13\n15 20", "metadata": { "func_name": null }, "output": "2 36\n3 2\n2 3\n2 36\n6 1", "testtype": "st...
{ "index": 250, "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 differences between the two versions are the constraints on all the variables. You can make hacks...
code
{ "ground_truth": [ { "input": "3\n2 2 3\n1 2\n1 3 5\n4 5 2\n2 2 4\n1 2\n1 1 3 2\n4 2 5 1\n2 4 2\n1 2\n3 4\n5 5\n5 5\n5 5", "metadata": { "func_name": null }, "output": "N\nT\nN", "testtype": "stdin" } ], "style": "rule" }
{ "index": 251, "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 differences between the two versions are the constraints on all the variables. You can make hacks...
code
{ "ground_truth": [ { "input": "3\n2 2 3\n1 2\n1 3 6\n4 6 2\n2 2 4\n1 2\n1 1 3 2\n4 2 5 1\n2 4 2\n1 2\n3 4\n5 6\n7 8\n8 8", "metadata": { "func_name": null }, "output": "N\nT\nN", "testtype": "stdin" } ], "style": "rule" }
{ "index": 252, "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\nIris has a tree rooted at vertex $1$. Each vertex has a value of $\\mathtt 0$ or $\\mathtt 1$.\n\nLet's consider a leaf of the tree (the verte...
code
{ "ground_truth": [ { "input": "6\n4\n1 2\n1 3\n4 1\n0101\n4\n1 2\n3 2\n2 4\n???0\n5\n1 2\n1 3\n2 4\n2 5\n?1?01\n6\n1 2\n2 3\n3 4\n5 3\n3 6\n?0????\n5\n1 2\n1 3\n1 4\n1 5\n11?1?\n2\n2 1\n??", "metadata": { "func_name": null }, "output": "2\n1\n1\n2\n1\n0", "testtype": "stdin"...
{ "index": 253, "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 rooted tree with the root at vertex $1$. For any vertex $i$ ($1 < i \\leq n$) in the tree, there is an edge connecting vertices $i$ an...
code
{ "ground_truth": [ { "input": "4\n2 1000000000000\n1\n2 1000000000000\n4 9\n1 1 1\n2 2\n4 4\n3 3\n6 100\n1 2 3 2 1\n6 17\n3 32\n2 4\n4 26\n5 21\n10 511\n1 2 2 4 2 1 1 8 8\n3 2\n6 16\n10 256\n9 128\n2 1\n5 8\n8 64\n4 4\n7 32", "metadata": { "func_name": null }, "output": "200000000...
{ "index": 254, "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 there be a set that contains distinct positive integers. To expand the set to contain as many integers as possible, Eri can choose two int...
code
{ "ground_truth": [ { "input": "6\n2\n2 2\n6\n1 3 6 10 15 21\n5\n6 30 18 36 9\n1\n1000000000\n6\n1 1 4 5 1 4\n12\n70 130 90 90 90 108 612 500 451 171 193 193", "metadata": { "func_name": null }, "output": "3\n18\n5\n1\n18\n53", "testtype": "stdin" } ], "style": "rule"...
{ "index": 255, "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\nIris has just learned multiplication in her Maths lessons. However, since her brain is unable to withstand too complex calculations, she could...
code
{ "ground_truth": [ { "input": "5\n3 1 1\n1 1 1\n1 3\n3 2 10\n1 10 9\n1 3\n2 3\n5 4 2\n2 2 2 2 2\n1 2\n2 4\n2 5\n1 5\n6 5 10\n3 2 5 10 10 1\n1 4\n3 6\n1 6\n2 5\n5 6\n10 10 10\n10 9 8 7 6 5 4 3 2 1\n1 10\n1 9\n1 8\n1 7\n2 10\n3 10\n4 10\n5 10\n3 9\n6 8", "metadata": { "func_name": null },...
{ "index": 256, "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\nIris likes full binary trees.\n\nLet's define the depth of a rooted tree as the maximum number of vertices on the simple paths from some verte...
code
{ "ground_truth": [ { "input": "7\n3\n1 1\n6\n1 2 3 4 5\n7\n1 1 3 2 5 1\n10\n1 1 2 1 4 2 4 5 8\n10\n1 1 3 1 3 2 2 2 6\n20\n1 1 2 2 4 4 5 5 7 6 8 6 11 14 11 8 13 13 12\n25\n1 1 3 3 1 5 4 4 6 8 11 12 8 7 11 13 7 13 15 6 19 14 10 23", "metadata": { "func_name": null }, "output": "1 2 ...
{ "index": 257, "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\nSadly, Dora poured the paint when painting the class mural. Dora considers the mural as the matrix $b$ of size $n \\times n$. Initially, $b_{i...
code
{ "ground_truth": [ { "input": "7\n2 2\n1 1\n1 2\n2 1\n1 1\n3 2\n1 1\n3 3\n6 0\n5 10\n1 1\n1 2\n1 3\n2 1\n2 3\n5 1\n5 2\n5 3\n5 4\n5 5\n3 5\n1 1\n1 3\n2 2\n3 1\n3 3\n4 3\n1 1\n2 3\n2 4", "metadata": { "func_name": null }, "output": "1\n499122178\n665496236\n120\n79859554\n776412275...
{ "index": 258, "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\nDora has a set $s$ containing integers. In the beginning, she will put all integers in $[l, r]$ into the set $s$. That is, an integer $x$ is i...
code
{ "ground_truth": [ { "input": "8\n1 3\n3 7\n10 21\n2 8\n51 60\n2 15\n10 26\n1 1000", "metadata": { "func_name": null }, "output": "1\n1\n3\n1\n2\n3\n4\n250", "testtype": "stdin" } ], "style": "rule" }
{ "index": 259, "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 receiving yet another integer array $a_1, a_2, \\ldots, a_n$ at her birthday party, Index decides to perform some operations on it.\n\nF...
code
{ "ground_truth": [ { "input": "5\n5 5\n1 2 3 2 1\n+ 1 3\n- 2 3\n+ 1 2\n+ 2 4\n- 6 8\n5 5\n1 3 3 4 5\n+ 1 4\n+ 2 3\n- 4 5\n- 3 3\n- 2 6\n5 5\n1 1 1 1 1\n+ 2 3\n- 4 5\n+ 1 6\n- 2 5\n+ 1 8\n1 1\n1\n- 1 1\n1 1\n1000000000\n+ 1000000000 1000000000", "metadata": { "func_name": null }, "...
{ "index": 260, "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\nDora has just learned the programming language C++!\n\nHowever, she has completely misunderstood the meaning of C++. She considers it as two k...
code
{ "ground_truth": [ { "input": "10\n4 5 5\n1 3 4 4\n4 2 3\n1 3 4 6\n4 7 7\n1 1 2 6\n3 15 9\n1 9 5\n3 18 12\n1 4 5\n7 27 36\n33 13 23 12 35 24 41\n10 6 9\n15 5 6 9 8 2 12 15 3 8\n2 1 1000000000\n1 1000000000\n6 336718728 709848696\n552806726 474775724 15129785 371139304 178408298 13106071\n6 335734893 671469...
{ "index": 261, "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\nIris has a tree rooted at vertex $1$. Each vertex has a value of $\\mathtt 0$ or $\\mathtt 1$.\n\nLet's consider a leaf of the tree (the verte...
code
{ "ground_truth": [ { "input": "6\n4\n1 2\n1 3\n4 1\n0101\n4\n1 2\n3 2\n2 4\n???0\n5\n1 2\n1 3\n2 4\n2 5\n?1?01\n6\n1 2\n2 3\n3 4\n5 3\n3 6\n?0????\n5\n1 2\n1 3\n1 4\n1 5\n11?1?\n2\n2 1\n??", "metadata": { "func_name": null }, "output": "2\n1\n1\n2\n1\n0", "testtype": "stdin"...
{ "index": 262, "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 rooted tree with the root at vertex $1$. For any vertex $i$ ($1 < i \\leq n$) in the tree, there is an edge connecting vertices $i$ an...
code
{ "ground_truth": [ { "input": "4\n2 1000000000000\n1\n2 1000000000000\n4 9\n1 1 1\n2 2\n4 4\n3 3\n6 100\n1 2 3 2 1\n6 17\n3 32\n2 4\n4 26\n5 21\n10 511\n1 2 2 4 2 1 1 8 8\n3 2\n6 16\n10 256\n9 128\n2 1\n5 8\n8 64\n4 4\n7 32", "metadata": { "func_name": null }, "output": "200000000...
{ "index": 263, "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 there be a set that contains distinct positive integers. To expand the set to contain as many integers as possible, Eri can choose two int...
code
{ "ground_truth": [ { "input": "6\n2\n2 2\n6\n1 3 6 10 15 21\n5\n6 30 18 36 9\n1\n1000000000\n6\n1 1 4 5 1 4\n12\n70 130 90 90 90 108 612 500 451 171 193 193", "metadata": { "func_name": null }, "output": "3\n18\n5\n1\n18\n53", "testtype": "stdin" } ], "style": "rule"...
{ "index": 264, "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, Sakurako has a math exam. The teacher gave the array, consisting of $a$ ones and $b$ twos.\n\nIn an array, Sakurako must place either a...
code
{ "ground_truth": [ { "input": "5\n0 1\n0 3\n2 0\n2 3\n3 1", "metadata": { "func_name": null }, "output": "NO\nNO\nYES\nYES\nNO", "testtype": "stdin" } ], "style": "rule" }
{ "index": 265, "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 beautiful binary matrix is a matrix that has ones on its edges and zeros inside.\n\n![](CDN_BASE_URL/5df31946486165887b31c82158ed558d) Examp...
code
{ "ground_truth": [ { "input": "5\n2\n11\n4\n1111\n9\n111101111\n9\n111111111\n12\n111110011111", "metadata": { "func_name": null }, "output": "No\nYes\nYes\nNo\nNo", "testtype": "stdin" } ], "style": "rule" }
{ "index": 266, "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, Sakurako was studying arrays. An array $a$ of length $n$ is considered good if and only if:\n\n * the array $a$ is increasing, meaning...
code
{ "ground_truth": [ { "input": "5\n1 2\n1 5\n2 2\n10 20\n1 1000000000", "metadata": { "func_name": null }, "output": "2\n3\n1\n5\n44721", "testtype": "stdin" } ], "style": "rule" }
{ "index": 267, "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 a certain permutation $p$$^{\\text{βˆ—}}$ Sakurako calls an integer $j$ reachable from an integer $i$ if it is possible to make $i$ equal to...
code
{ "ground_truth": [ { "input": "5\n1\n1\n0\n5\n1 2 4 5 3\n10101\n5\n5 4 1 3 2\n10011\n6\n3 5 6 1 2 4\n010000\n6\n1 2 3 4 5 6\n100110", "metadata": { "func_name": null }, "output": "1 \n0 1 1 1 1 \n2 2 2 2 2 \n4 1 4 4 1 4 \n0 1 1 0 0 1", "testtype": "stdin" } ], "style...
{ "index": 268, "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\nSakurako really loves alternating strings. She calls a string $s$ of lowercase Latin letters an alternating string if characters in the even p...
code
{ "ground_truth": [ { "input": "10\n1\na\n2\nca\n3\naab\n5\nababa\n6\nacdada\n9\nejibmyyju\n6\nbbccbc\n6\nabacba\n5\nbcbca\n5\ndcbdb", "metadata": { "func_name": null }, "output": "1\n0\n1\n1\n2\n6\n2\n3\n1\n1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 269, "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\nSakurako has a box with $n$ balls. Each ball has it's value. She wants to bet with her friend that if the friend randomly picks two balls from...
code
{ "ground_truth": [ { "input": "3\n3\n3 2 3\n4\n2 2 2 4\n5\n1 2 3 4 5", "metadata": { "func_name": null }, "output": "7\n6\n500000012", "testtype": "stdin" } ], "style": "rule" }
{ "index": 270, "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\nSakurako has prepared a task for you:\n\nShe gives you an array of $n$ integers and allows you to choose $i$ and $j$ such that $i \\neq j$ and...
code
{ "ground_truth": [ { "input": "6\n1 3\n3\n2 10\n1 1\n3 1\n1 2 3\n3 2\n1 2 4\n4 5\n2 2 2 16\n4 5\n2 2 2 3", "metadata": { "func_name": null }, "output": "2\n11\n3\n4\n8\n8", "testtype": "stdin" } ], "style": "rule" }
{ "index": 271, "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\nSakurako will soon take a test. The test can be described as an array of integers $n$ and a task on it:\n\nGiven an integer $x$, Sakurako can ...
code
{ "ground_truth": [ { "input": "2\n5 5\n1 2 3 4 5\n1\n2\n3\n4\n5\n6 3\n1 2 6 4 1 3\n2\n1\n5", "metadata": { "func_name": null }, "output": "0 1 1 1 2 \n1 0 2", "testtype": "stdin" } ], "style": "rule" }
{ "index": 272, "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, a club fair was held at \"NSPhM\". In order to advertise his pastry club, Zhan decided to demonstrate the power of his blender.\n\nTo d...
code
{ "ground_truth": [ { "input": "5\n5\n3 4\n3\n1 2\n6\n4 3\n100\n4 3\n9\n3 3", "metadata": { "func_name": null }, "output": "2\n3\n2\n34\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 273, "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\nEralim, being the mafia boss, manages a group of $n$ fighters. Fighter $i$ has a rating of $a_i$.\n\nEralim arranges a tournament of $n - 1$ b...
code
{ "ground_truth": [ { "input": "5\n2\n2 1\n3\n2 2 8\n4\n1 2 4 3\n5\n1 2 3 4 5\n5\n3 2 4 5 4", "metadata": { "func_name": null }, "output": "-1\n8\n2\n7\n8", "testtype": "stdin" } ], "style": "rule" }
{ "index": 274, "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\nDimash learned that Mansur wrote something very unpleasant about him to a friend, so he decided to find out his password at all costs and disc...
code
{ "ground_truth": [ { "input": "4\n3\n\n0\n\n0\n\n1\n\n4\n\n4\n\n2", "metadata": { "func_name": null }, "output": "? 00\n\n? 000\n\n? 010\n\n! 010\n\n! 1100\n\n! 0110\n\n! 10", "testtype": "stdin" } ], "style": "rule" }
{ "index": 275, "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\nZhan, tired after the contest, gave the only task that he did not solve during the contest to his friend, Sungat. However, he could not solve ...
code
{ "ground_truth": [ { "input": "5\n1\n1\n3\n1 2 3\n4\n4 1 2 3\n4\n4 2 3 1\n5\n5 14 4 10 2", "metadata": { "func_name": null }, "output": "0\n2\n1\n1\n3", "testtype": "stdin" } ], "style": "rule" }
{ "index": 276, "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\nSince Mansur is tired of making legends, there will be no legends for this task.\n\nYou are given an array of positive integer numbers $a_1, a...
code
{ "ground_truth": [ { "input": "5\n3\n4 2 2\n2\n6 3\n3\n10 15 6\n5\n6 42 12 52 20\n4\n42 154 231 66", "metadata": { "func_name": null }, "output": "6\n6\n9\n14\n51", "testtype": "stdin" } ], "style": "rule" }
{ "index": 277, "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. In this version, $\\mathbf{u = v}$. You can make hacks only if both versions of the problem are solve...
code
{ "ground_truth": [ { "input": "3\n3\n1 2\n2 3\n2 2\n3\n1 2\n2 3\n3 3\n6\n1 2\n1 3\n2 4\n2 5\n1 6\n4 4", "metadata": { "func_name": null }, "output": "Bob\nAlice\nAlice", "testtype": "stdin" } ], "style": "rule" }
{ "index": 278, "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. In this version, it is not guaranteed that $u = v$. You can make hacks only if both versions of the p...
code
{ "ground_truth": [ { "input": "3\n3\n1 2\n2 3\n2 3\n6\n1 2\n1 3\n2 4\n2 5\n1 6\n4 5\n4\n1 2\n1 3\n2 4\n2 4", "metadata": { "func_name": null }, "output": "Bob\nAlice\nAlice\nBob\nAlice\nBob\nAlice", "testtype": "stdin" } ], "style": "rule" }
{ "index": 279, "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 little bit of the outlaw in everyone, and a little bit of the hero too.\n\nThe heroic outlaw Robin Hood is famous for taking from t...
code
{ "ground_truth": [ { "input": "4\n2 2\n2 0\n3 2\n3 0 0\n6 2\n0 3 0 0 0 0\n2 5\n5 4", "metadata": { "func_name": null }, "output": "1\n2\n3\n0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 280, "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 Sherwood, the trees are our shelter, and we are all children of the forest.\n\nThe Major Oak in Sherwood is known for its majestic foliage,...
code
{ "ground_truth": [ { "input": "5\n1 1\n2 1\n2 2\n3 2\n4 4", "metadata": { "func_name": null }, "output": "NO\nYES\nNO\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 281, "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 Sherwood, we judge a man not by his wealth, but by his merit.\n\nLook around, the rich are getting richer, and the poor are getting poorer....
code
{ "ground_truth": [ { "input": "6\n1\n2\n2\n2 19\n3\n1 3 20\n4\n1 2 3 4\n5\n1 2 3 4 5\n6\n1 2 1 1 1 25", "metadata": { "func_name": null }, "output": "-1\n-1\n0\n15\n16\n0", "testtype": "stdin" } ], "style": "rule" }
{ "index": 282, "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\nImpress thy brother, yet fret not thy mother.\n\nRobin's brother and mother are visiting, and Robin gets to choose the start day for each visi...
code
{ "ground_truth": [ { "input": "6\n2 1 1\n1 2\n4 1 2\n1 2\n2 4\n7 2 3\n1 2\n1 3\n6 7\n5 1 2\n1 2\n3 5\n9 2 1\n2 8\n9 2 4\n7 9\n4 8\n1 3\n2 3", "metadata": { "func_name": null }, "output": "1 1\n2 1\n1 4\n1 1\n1 1\n3 4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 283, "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 the humble act of meeting, joy doth unfold like a flower in bloom.\n\nAbsence makes the heart grow fonder. Marian sold her last ware at the...
code
{ "ground_truth": [ { "input": "6\n2 1 1\n1\n1 2 10\n3 1 2\n2 3\n1 2 10\n3 3 1\n2\n1 2 4\n1 3 10\n2 3 6\n4 3 2\n2 3\n1 2 10\n2 3 18\n3 4 16\n3 2 1\n2\n1 2 4\n1 3 16\n7 7 1\n3\n1 5 2\n2 6 12\n1 2 12\n6 4 8\n7 3 4\n6 3 4\n7 6 4", "metadata": { "func_name": null }, "output": "5\n-1\n6...
{ "index": 284, "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\n\"Why, master,\" quoth Little John, taking the bags and weighing them in his hand, \"here is the chink of gold.\"\n\nThe folk hero Robin Hood ...
code
{ "ground_truth": [ { "input": "5\n3 1\n2 3 1\n1 2\n2 3\n3 1\n3 6 3\n1 2\n2 3\n3 1\n-2 -3 -1\n1 2\n2 3\n6 1\n5 -4 3 6 7 3\n4 1\n5 1\n3 5\n3 6\n1 2\n8 1\n3 5 2 7 8 5 -3 -4\n7 3\n1 8\n4 3\n3 5\n7 6\n8 7\n2 1", "metadata": { "func_name": null }, "output": "3\n8\n0\n17\n26", "tes...
{ "index": 285, "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\nWhat is done is done, and the spoilt milk cannot be helped.\n\nLittle John is as little as night is day β€” he was known to be a giant, at possi...
code
{ "ground_truth": [ { "input": "6\n1 1 3\n1 5\n2 3 3\n1 5\n2 7\n4 5 2\n1 9\n2 6\n4 9\n5 6\n5 2 4\n4 7\n5 3\n7 1\n11 2\n12 1\n4 1 3\n5 10\n9 4\n14 8\n15 3\n5 5 5\n8 9\n10 7\n16 10\n21 5\n28 9", "metadata": { "func_name": null }, "output": "3\n3\n4\n5\n10\n6", "testtype": "stdi...
{ "index": 286, "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\nAt such times archery was always the main sport of the day, for the Nottinghamshire yeomen were the best hand at the longbow in all merry Engl...
code
{ "ground_truth": [ { "input": "2\n3 3\n1 2 2\n1 2\n1 3\n2 3\n5 3\n2 1 2 1 1\n1 2\n1 3\n4 5", "metadata": { "func_name": null }, "output": "NO\nNO\nYES\nNO\nNO\nYES", "testtype": "stdin" } ], "style": "rule" }
{ "index": 287, "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\n[DJ Genki vs Gram - Einherjar Joker](https://soundcloud.com/leon- hwang-368077289/einherjar-joker-dj-genki-vs-gram)\n\nβ €\n\nYou have some card...
code
{ "ground_truth": [ { "input": "9\n3 1\n3 2 2\n5 4\n2 6 1 2 4\n2 100\n1410065408 10000000000\n10 8\n7 4 6 6 9 3 10 2 8 7\n2 12\n2 2\n2 70\n0 1\n1 0\n1\n3 0\n2 1 2\n3 1\n0 3 3", "metadata": { "func_name": null }, "output": "2\n3\n1\n7\n2\n2\n1\n1\n2", "testtype": "stdin" }...
{ "index": 288, "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\n[Djjaner - Speedbreaker](https://soundcloud.com/luciano- ferrari-151560131/speedbreaker)\n\nβ €\n\nThere are $n$ cities in a row, numbered $1, 2...
code
{ "ground_truth": [ { "input": "3\n6\n6 3 3 3 5 5\n6\n5 6 4 1 4 5\n9\n8 6 4 2 1 3 5 7 9", "metadata": { "func_name": null }, "output": "3\n0\n1", "testtype": "stdin" } ], "style": "rule" }
{ "index": 289, "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\n[t+pazolite, ginkiha, Hommarju - Paved Garden](https://soundcloud.com/fractalex-gd/ginkiha-paved-garden-little)\n\nβ €\n\nYou are given a tree w...
code
{ "ground_truth": [ { "input": "3\n7\n1 2\n1 3\n2 4\n2 5\n4 6\n4 7\n7\n1 2\n1 3\n1 4\n2 5\n3 6\n5 7\n15\n12 9\n1 6\n6 14\n9 11\n8 7\n3 5\n13 5\n6 10\n13 15\n13 6\n14 12\n7 2\n8 1\n1 4", "metadata": { "func_name": null }, "output": "2\n2\n5", "testtype": "stdin" } ], "...
{ "index": 290, "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\n[EnV - The Dusty Dragon Tavern](https://soundcloud.com/envyofficial/env-the- dusty-dragon-tavern)\n\nβ €\n\nYou are given an array $a_1, a_2, \\...
code
{ "ground_truth": [ { "input": "4\n3\n5 4 5\n3\n4 5 4\n10\n3 3 3 3 4 1 2 3 5 4\n10\n17 89 92 42 29 41 92 14 70 45", "metadata": { "func_name": null }, "output": "12\n11\n12\n186", "testtype": "stdin" } ], "style": "rule" }
{ "index": 291, "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\n[Ken Arai - COMPLEX](https://soundcloud.com/diatomichail2/complex)\n\nβ €\n\nThis is the easy version of the problem. In this version, the const...
code
{ "ground_truth": [ { "input": "3\n3\n1 2 3\n5 4 6\n5\n1 2 3 6 8\n5 4 7 9 10\n5\n3 1 4 1 5\n7 2 6 5 10", "metadata": { "func_name": null }, "output": "3\n4\n4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 292, "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\n[Ken Arai - COMPLEX](https://soundcloud.com/diatomichail2/complex)\n\nβ €\n\nThis is the hard version of the problem. In this version, the const...
code
{ "ground_truth": [ { "input": "3\n3\n1 2 3\n5 4 6\n5\n1 2 3 6 8\n5 4 7 9 10\n5\n3 1 4 1 5\n7 2 6 5 10", "metadata": { "func_name": null }, "output": "3\n4\n4", "testtype": "stdin" } ], "style": "rule" }
{ "index": 293, "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\n[NightHawk22 - Isolation](https://soundcloud.com/vepium/nighthawk22-isolation- official-limbo-remix)\n\nβ €\n\nThis is the easy version of the p...
code
{ "ground_truth": [ { "input": "11\n1 998244353\n2 998244353\n3 998244353\n4 998244353\n5 998244353\n6 998244353\n7 998244353\n8 998244353\n9 998244353\n10 102275857\n10 999662017", "metadata": { "func_name": null }, "output": "0 1 \n1 2 1 \n14 7 4 2 \n183 34 19 16 4 \n2624 209 112...
{ "index": 294, "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\n[NightHawk22 - Isolation](https://soundcloud.com/vepium/nighthawk22-isolation- official-limbo-remix)\n\nβ €\n\nThis is the medium version of the...
code
{ "ground_truth": [ { "input": "11\n1 998244353\n2 998244353\n3 998244353\n4 998244353\n5 998244353\n6 998244353\n7 998244353\n8 998244353\n9 998244353\n10 102275857\n10 999662017", "metadata": { "func_name": null }, "output": "0 1 \n1 2 1 \n14 7 4 2 \n183 34 19 16 4 \n2624 209 112...
{ "index": 295, "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\n[NightHawk22 - Isolation](https://soundcloud.com/vepium/nighthawk22-isolation- official-limbo-remix)\n\nβ €\n\nThis is the hard version of the p...
code
{ "ground_truth": [ { "input": "11\n1 998244353\n2 998244353\n3 998244353\n4 998244353\n5 998244353\n6 998244353\n7 998244353\n8 998244353\n9 998244353\n10 102275857\n10 999662017", "metadata": { "func_name": null }, "output": "0 1 \n1 2 1 \n14 7 4 2 \n183 34 19 16 4 \n2624 209 112...
{ "index": 296, "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\n[EnV - Dynasty](https://soundcloud.com/envyofficial/env-dynasty)\n\nβ €\n\nYou are given an array $a_1, a_2, \\ldots, a_n$ of positive integers....
code
{ "ground_truth": [ { "input": "4\n3\n5 4 5\n3\n4 5 4\n10\n3 3 3 3 4 1 2 3 4 5\n9\n17 89 92 42 29 92 14 70 45", "metadata": { "func_name": null }, "output": "7\n6\n10\n97", "testtype": "stdin" } ], "style": "rule" }
{ "index": 297, "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\n[Shirobon - FOX](https://soundcloud.com/shirobon/fox?in=mart_207/sets/fav)\n\nβ €\n\nYou are given $n$ points on the $x$ axis, at increasing pos...
code
{ "ground_truth": [ { "input": "3\n2 2\n101 200\n2 1\n6 15\n1 2 3 5 6 7\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n5 8\n254618033 265675151 461318786 557391198 848083778\n6 9 15 10 6 9 4 4294967300", "metadata": { "func_name": null }, "output": "0 100 \n0 0 0 0 2 0 0 0 3 0 2 0 0 0 0 \n2...
{ "index": 298, "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\n[DJ Genki vs Gram - Einherjar Joker](https://soundcloud.com/leon- hwang-368077289/einherjar-joker-dj-genki-vs-gram)\n\nβ €\n\nYou have some card...
code
{ "ground_truth": [ { "input": "9\n3 1\n3 2 2\n5 4\n2 6 1 2 4\n2 100\n1410065408 10000000000\n10 8\n7 4 6 6 9 3 10 2 8 7\n2 12\n2 2\n2 70\n0 1\n1 0\n1\n3 0\n2 1 2\n3 1\n0 3 3", "metadata": { "func_name": null }, "output": "2\n3\n1\n7\n2\n2\n1\n1\n2", "testtype": "stdin" }...
{ "index": 299, "solution": "", "split": "test" }