messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
2 values
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n\"Point reflection\" or \"point symmetry\" is a basic concept in geometry where a given point, P, at a given ...
[{"input": "[1000, 15]\n[-7, -214]", "output": "[[-1014, -443]]", "fn_name": "symmetric_point"}, {"input": "[10, -10]\n[-10, 10]", "output": "[[-30, 30]]", "fn_name": "symmetric_point"}, {"input": "[1, -35]\n[-12, 1]", "output": "[[-25, 37]]", "fn_name": "symmetric_point"}, {"input": "[2, 6]\n[-2, -6]", "output": "[[-6...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nParmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner...
[{"input": "24\n1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4\n", "output": "114\n"}, {"input": "24\n1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4\n", "output": "114\n"}, {"input": "24\n1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 1 4\n", "output": "114\n"}, {"input": "24\n1 2 3 4 1 2 3 2 1 2 3 4 1 2 3 4 1 2 3 4 1 2...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a tree (a connected acyclic undirected graph) of n vertices. Vertices are numbered from 1 to n ...
[{"input": "20\n10 9\n15 14\n11 12\n2 3\n15 16\n2 1\n18 19\n20 19\n8 9\n7 6\n8 7\n12 13\n5 6\n4 3\n13 14\n18 17\n11 10\n16 17\n5 4\naabbccddeeffgghhiijj\n", "output": "20 29 45 52 64 69 77 80 84 85 85 84 80 77 69 64 52 45 29 20\n"}, {"input": "20\n10 9\n15 14\n11 12\n2 3\n15 16\n2 1\n18 19\n20 19\n8 9\n7 6\n8 7\n12 13\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVasya is studying number theory. He has denoted a function f(a, b) such that: f(a, 0) = 0; f(a, b) = 1 + f(...
[{"input": "999999999989 999999999988\n", "output": "999999999988\n"}, {"input": "414654652183 366894205623\n", "output": "366894205623\n"}, {"input": "999999999958 999999999957\n", "output": "499999999979\n"}, {"input": "999999999989 999999999988\n", "output": "999999999988\n"}, {"input": "999999999958 999999999957\n"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA competitive eater, Alice is scheduling some practices for an eating contest on a magical calendar. The cale...
[{"input": "5\n5 4\n2 4\n5 1\n13 9\n1010000 14106652\n", "output": "10\n2\n1\n45\n510049495001\n"}, {"input": "5\n6 4\n3 2\n3 1\n13 7\n1010000 14106652\n", "output": "10\n3\n1\n28\n510049495001\n"}, {"input": "5\n5 4\n2 4\n5 1\n13 9\n1010000 12964098\n", "output": "10\n2\n1\n45\n510049495001\n"}, {"input": "5\n3 4\n3 2...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA string is called bracket sequence if it does not contain any characters other than \"(\" and \")\". A brack...
[{"input": "1000000000\n1000000000\n1000000000\n1000000000\n", "output": "1\n"}, {"input": "1000000000\n1000000000\n1000000000\n1000000000\n", "output": "1\n"}, {"input": "1000000000\n1000000000\n1000000000\n999999999\n", "output": "0\n"}, {"input": "1000000000\n999999999\n1000000000\n1000000000\n", "output": "1\n"}, {...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiven an array of 4 integers \n```[a,b,c,d]``` representing two points ```(a, b)``` and ```(c, d)```, return...
[{"input": "[15, -3, 15, -3]", "output": "[\"undefined\"]", "fn_name": "find_slope"}, {"input": "[-6, 57, -6, 84]", "output": "[\"undefined\"]", "fn_name": "find_slope"}, {"input": "[17, -3, 17, 8]", "output": "[\"undefined\"]", "fn_name": "find_slope"}, {"input": "[90, 54, 90, 2]", "output": "[\"undefined\"]", "fn_nam...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMasha has three sticks of length $a$, $b$ and $c$ centimeters respectively. In one minute Masha can pick one ...
[{"input": "100 100 100\n", "output": "0\n"}, {"input": "100 100 100\n", "output": "0\n"}, {"input": "100 10 10\n", "output": "81\n"}, {"input": "100 100 99\n", "output": "0\n"}, {"input": "100 100 99\n", "output": "0\n"}, {"input": "100 10 10\n", "output": "81\n"}, {"input": "12 34 56\n", "output": "11\n"}, {"input": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nHQ9+ is a joke programming language which has only four one-character instructions:\n\n * \"H\" prints \"Hel...
[{"input": "mzbmweyydiadtlcouegmdbyfwurpwbpuvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnkH\n", "output": "YES\n"}, {"input": "Qzbmweyydiadtlcouegmdbyfwurpwbpuvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnky\n", "output": "YES\n"}, {"input": "mzbmweyydiadtlcouegmdbyfwurpwb9uvhif...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given n distinct points on a plane with integral coordinates. For each point you can either draw a ve...
[{"input": "10\n504155727 -77293021\n-155983273 -43296260\n-548837441 -43296260\n87058696 -80040028\n1006418476 -43296260\n-155983273 850521645\n-852404258 -125749655\n518823261 -77293021\n-89661323 -21885159\n-155983273 -406914114\n", "output": "11907\n"}, {"input": "10\n504155727 -77293021\n-155983273 -43296260\n-548...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPolycarp has $n$ coins, the value of the $i$-th coin is $a_i$. It is guaranteed that all the values are integ...
[{"input": "1 10\n8\n1\n2\n3\n4\n5\n6\n7\n13\n17\n16\n", "output": "-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n"}, {"input": "1 10\n8\n1\n2\n3\n4\n5\n6\n7\n13\n9\n16\n", "output": "-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n"}, {"input": "1 10\n8\n1\n2\n3\n4\n5\n6\n7\n13\n9\n30\n", "output": "-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n cells, numbered 1,2,..., n from left to right. You have to place a robot at any cell initially. T...
[{"input": "4 40 6\n92 17 150 12\n2 60\n1 109\n4 39\n1 10\n3 49\n4 88\n", "output": "650858966\n287799503\n711175657\n825463104\n568011727\n521546223\n"}, {"input": "4 40 6\n100 17 82 40\n2 56\n1 72\n4 149\n1 97\n3 49\n2 88\n", "output": "668794504\n266774789\n938922959\n405011984\n182280345\n610383754\n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an array a consisting of n positive integers, numbered from 1 to n. You can perform the followi...
[{"input": "1\n12\n1 1 1 1 1 6 6 6 6 6 6 7\n", "output": "32\n1 2 1\n2 1 1\n1 3 2\n3 1 1\n1 4 3\n4 1 1\n1 5 4\n5 1 1\n6 1 1\n1 7 1\n7 1 1\n1 8 2\n8 1 1\n1 9 3\n9 1 1\n1 10 4\n10 1 1\n1 11 5\n11 1 1\n1 12 5\n12 1 1\n1 2 4\n1 3 4\n1 4 4\n1 5 4\n1 6 4\n1 7 4\n1 8 4\n1 9 4\n1 10 4\n1 11 4\n1 12 4\n"}, {"input": "1\n10\n7 7...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTraining is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to p...
[{"input": "2\n1 3\n1 1\nRRRR\nRRGR\nRBRR\nRRRR", "output": "10\n"}, {"input": "2\n2 0\n1 1\nRRRR\nRRGR\nRBRR\nRRRR", "output": "16\n"}, {"input": "2\n2 0\n2 1\nRRRR\nRRGR\nRBRR\nRRRR", "output": "10\n"}, {"input": "2\n2 -1\n3 2\nRRRR\nRRGR\nRBRR\nRRRR", "output": "6\n"}, {"input": "2\n3 -1\n3 2\nRRRR\nRRGR\nRBRR\nRRRR...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nComplete the solution so that it returns the number of times the search_text is found within the full_text.\n...
[{"input": "\"aa_bb_cc_dd_bb_e\"\n\"bb\"", "output": "[2]", "fn_name": "search_substr"}, {"input": "\"aaabbbaaa\"\n\"bb\"\nfalse", "output": "[1]", "fn_name": "search_substr"}, {"input": "\"aaacccbbbcccc\"\n\"cc\"", "output": "[5]", "fn_name": "search_substr"}, {"input": "\"aaabbbcccc\"\n\"bbb\"", "output": "[1]", "fn_...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn the official contest this problem has a different statement, for which jury's solution was working incorre...
[{"input": "20\n1306340891 192811911 592111899 609607891 585084800 601258511 223103775 164258550 858003275 230837577 971499807 312977833 344314550 397998873 558637732 216574673 913028292 1360238301 464376621 61315042\n", "output": "384683838\n"}, {"input": "20\n713900269 192811911 592111899 609607891 585084800 60125851...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.\n\nMehrdad wants...
[{"input": "1000000000\n", "output": "6\n"}, {"input": "1902349577\n", "output": "8\n"}, {"input": "0000000000\n", "output": "1\n"}, {"input": "1065810635\n", "output": "2\n"}, {"input": "1760197508\n", "output": "6\n"}, {"input": "1603265602\n", "output": "4\n"}, {"input": "0001000000\n", "output": "6\n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive int...
[{"input": "10000\n", "output": "10000 10001 100010000 "}, {"input": "17554\n", "output": "17554 17555 308160470\n"}, {"input": "10023\n", "output": "10023 10024 100470552\n"}, {"input": "19176\n", "output": "19176 19177 367738152\n"}, {"input": "14118\n", "output": "14118 14119 199332042\n"}, {"input": "12693\n", "out...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn a factory, there are N robots placed on a number line. Robot i is placed at coordinate X_i and can extend ...
[{"input": "5\n10 1\n2 2\n1 1\n10 1\n8 2", "output": "2\n"}, {"input": "5\n10 1\n2 2\n4 1\n6 1\n8 1", "output": "4\n"}, {"input": "5\n18 1\n2 1\n4 1\n6 1\n8 1", "output": "5\n"}, {"input": "5\n10 1\n2 2\n4 1\n6 1\n8 2", "output": "3\n"}, {"input": "5\n10 1\n2 2\n0 1\n6 1\n8 2", "output": "3\n"}, {"input": "4\n4 16\n4 3...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nNow that Kuroni has reached 10 years old, he is a big boy and doesn't like arrays of integers as presents any...
[{"input": "((()((()()))))(\n", "output": "1\n12\n1 2 3 5 6 7 8 10 11 12 13 14\n"}, {"input": "(((((())()))()(\n", "output": "1\n12\n1 2 3 4 5 6 7 8 10 11 12 14\n"}, {"input": "((()(())()))()(\n", "output": "1\n10\n1 2 3 5 6 8 10 11 12 14\n"}, {"input": "((()((()()))()(\n", "output": "1\n10\n1 2 3 5 6 8 10 11 12 14\n"}...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nConstruct a dice from a given sequence of integers in the same way as Dice I.\n\nYou are given integers on th...
[{"input": "1 2 3 4 14 -1\n3\n1 3\n1 4\n3 2", "output": "14\n2\n-1\n"}, {"input": "1 2 3 4 5 12\n3\n3 2\n1 3\n3 2", "output": "12\n5\n12\n"}, {"input": "1 2 3 4 5 16\n3\n3 2\n1 3\n3 2", "output": "16\n5\n16\n"}, {"input": "1 2 3 4 5 12\n3\n4 2\n1 3\n3 2", "output": "1\n5\n12\n"}, {"input": "1 2 3 4 5 10\n3\n4 2\n1 5\n3...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe on-board computer on Polycarp's car measured that the car speed at the beginning of some section of the p...
[{"input": "100 100\n100 10\n", "output": "34500\n"}, {"input": "100 100\n100 10\n", "output": "34500"}, {"input": "100 100\n100 0\n", "output": "10000\n"}, {"input": "100 100\n100 1\n", "output": "12450\n"}, {"input": "100 101\n100 1\n", "output": "12500\n"}, {"input": "100 111\n100 1\n", "output": "12970\n"}, {"input...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nzscoder wants to generate an input file for some programming competition problem.\n\nHis input is a string co...
[{"input": "4528217 187553422 956731625\n", "output": "21178755627\n"}, {"input": "9999999 987654321 123456789\n", "output": "11728395036\n"}, {"input": "7186329 608148870 290497442\n", "output": "12762929866\n"}, {"input": "7789084 807239576 813643932\n", "output": "25165322688\n"}, {"input": "9999999 1516835495 20283...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a sequence of positive integers of length N, A=a_1,a_2,…,a_{N}, and an integer K.\nHow many con...
[{"input": "36 320641\n1039 4886 56224 3736 39132 60247 35771 31922 18818 92028 9791 31159 86363 16541 65981 53487 95561 6303 46808 55427 22512 73795 55807 31335 65754 84343 69866 69648 66544 89829 16458 3890 91183 52351 91315 40851\n", "output": "465\n"}, {"input": "29 888655\n98896 43712 73112 68378 65614 15800 83921...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a string $t$ and a set $S$ of $N$ different strings. You need to separate $t$ such that each pa...
[{"input": "10\na\naa\naaa\naaaa\naaaaa\naaaaaa\naaaaaaa\na`aaaaaa\naaaaaaaaa\naaaaaabaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "output": "633900632\n"}, {"input": "10\na\naa\naaa\naaaa\naaa`a\naaaaaa\naaaaaaa\na`aaaaaa\naaaaaaaaa\naaaaaabaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "output": "630934097\n"}, {...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe Duck song\n\nFor simplicity, we'll assume that there are only three types of grapes: green grapes, purple...
[{"input": "100000 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"input": "100000 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"input": "99999 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"input": "100000 99999 100000\n100000 100000 100000\n", "output": "YES\n"}, {"input":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are playing a game of Jongmah. You don't need to know the rules to solve this problem. You have n tiles i...
[{"input": "100 10\n7 4 5 5 10 10 5 8 5 7 4 5 4 6 8 8 2 6 3 3 10 7 10 8 6 2 7 3 9 7 7 2 4 5 2 4 9 5 10 1 10 5 10 4 1 3 4 2 6 9 9 9 10 6 2 5 6 1 8 10 4 10 3 4 10 5 5 4 10 4 5 3 7 10 2 7 3 6 9 6 1 6 5 5 4 6 6 4 4 1 5 1 6 6 6 8 8 6 2 6\n", "output": "33\n"}, {"input": "100 10\n7 4 5 5 10 10 5 8 5 7 4 5 4 6 8 8 2 6 3 3 10 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which sec...
[{"input": "108\n", "output": " 2"}, {"input": "243\n", "output": " 1"}, {"input": "81\n", "output": " 1"}, {"input": "10\n", "output"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRecently Johnny have learned bogosort sorting algorithm. He thought that it is too ineffective. So he decided...
[{"input": "3\n3\n6\n42", "output": "10/3\n1826/189\n3861289540035137932590423886961807813592751894315116939644306/8913121775113966157962800372668924735854723781840323828125\n"}, {"input": "3\n3\n5\n42", "output": "10/3\n149/21\n3861289540035137932590423886961807813592751894315116939644306/89131217751139661579628003726...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Task\n You are given three integers `l, d and x`. Your task is:\n```\n• determine the minimal integer n \n ...
[{"input": "2000\n7000\n3", "output": "[[2001, 3000]]", "fn_name": "min_and_max"}, {"input": "99\n5001\n28", "output": "[[1999, 4996]]", "fn_name": "min_and_max"}, {"input": "99\n5001\n27", "output": "[[999, 4995]]", "fn_name": "min_and_max"}, {"input": "100\n200\n10", "output": "[[109, 190]]", "fn_name": "min_and_max"...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSwitch/Case - Bug Fixing #6\n\nOh no! Timmy's evalObject function doesn't work. He uses Switch/Cases to evalu...
[{"input": "{\"a\": 1, \"b\": 1, \"operation\": \"**\"}", "output": "[1]", "fn_name": "eval_object"}, {"input": "{\"a\": 1, \"b\": 1, \"operation\": \"+\"}", "output": "[2]", "fn_name": "eval_object"}, {"input": "{\"a\": 1, \"b\": 1, \"operation\": \"-\"}", "output": "[0]", "fn_name": "eval_object"}, {"input": "{\"a\":...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nInnokenty works at a flea market and sells some random stuff rare items. Recently he found an old rectangular...
[{"input": "10 10\naaaaarpppp\nbbbbsssssu\ncciiiiiiqq\nddmmgggggg\neeebbbbbbb\nfffffqoooo\ngxxxxrrrrr\nhhfuuuuuuu\niiillqqqqq\njjjjjppwww\n", "output": "138\n"}, {"input": "10 10\naaaaaaaaaa\nbbbbbbbbbb\ncccccccccc\ndddddddddd\neeeeeeeeee\nffffffffff\ngggggggggg\nhhhhhhhhhh\niiiiiiiiii\njjjjjjjjjj\n", "output": "440\n"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given $4n$ sticks, the length of the $i$-th stick is $a_i$.\n\nYou have to create $n$ rectangles, eac...
[{"input": "5\n1\n1 1 10 10\n2\n10 5 2 10 1 1 2 5\n2\n10 5 1 10 5 1 1 1\n2\n1 1 1 1 1 1 1 1\n1\n10000 10000 10000 10000\n", "output": "YES\nYES\nNO\nYES\nYES\n"}, {"input": "5\n1\n1 1 10 10\n2\n10 5 2 10 1 1 2 5\n2\n10 5 1 10 5 1 1 1\n2\n1 1 1 1 1 1 1 1\n1\n10000 10000 10000 10000\n", "output": "YES\nYES\nNO\nYES\nYES\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTaro is planning a long trip by train during the summer vacation. However, in order for Taro, who is a high s...
[{"input": "6 5\n1 2 200 12\n1 4 400 15\n1 5 250 25\n2 4 100 10\n4 5 150 20\n3 5 300 21\n2\n1 5 0\n1 5 0\n0 0", "output": "250\n250\n"}, {"input": "6 14\n1 2 200 10\n2 4 103 22\n2 3 250 13\n2 3 100 10\n4 5 178 10\n3 3 300 30\n2\n2 5 0\n1 5 1\n0 0", "output": "281\n42\n"}, {"input": "6 5\n1 2 200 10\n1 4 400 15\n1 3 250...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA carpet shop sells carpets in different varieties. Each carpet can come in a different roll width and can ha...
[{"input": "0\n0\n4\n10", "output": "[\"error\"]", "fn_name": "cost_of_carpet"}, {"input": "5\n6\n4\n10", "output": "[\"error\"]", "fn_name": "cost_of_carpet"}, {"input": "3.9\n2\n4\n10", "output": "[80]", "fn_name": "cost_of_carpet"}, {"input": "3\n5\n4\n10", "output": "[200]", "fn_name": "cost_of_carpet"}, {"input": ...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDZY loves chessboard, and he enjoys playing with it.\n\nHe has a chessboard of n rows and m columns. Some cel...
[{"input": "8 35\n......................-............\n...-..........-........-...........\n...........-.......................\n-..................................\n...................................\n...........-............-.........-\n.........-.........-.--............\n.........................-.........\n", "ou...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn poker, you have 5 cards. There are 10 kinds of poker hands (from highest to lowest):\n\n- royal flush - a...
[{"input": "3\nAH KH QH TH JH\nJH 6S 3C 5C 7D\nQH QD 4S QC 2C", "output": "royal flush\nhigh card\nthree of a kind\n"}, {"input": "3\nAH KH QH TH JH\nKH 6S 2D 5C 7D\nQH QD 4S QC 2C", "output": "royal flush\nhigh card\nthree of a kind\n"}, {"input": "3\nAH KH QH TH JH\nKH 5S 3D 4C 8D\nQH QD 3S QC 2C", "output": "royal f...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDescription\n\nKMC sells CDs every year at a coterie spot sale called Comic Market. F was supposed to sell CD...
[{"input": "500 1000\n100 10000\n400 1006\n1029 5000\n10000 10000\n0 0", "output": "0 1 0\n4 1 9\n1 1 0\n4 1 3\n0 0 0\n"}, {"input": "500 1001\n001 10100\n400 1047\n429 5000\n10000 10000\n0 0", "output": "0 1 0\n0 0 10\n1 1 0\n0 1 4\n0 0 0\n"}, {"input": "500 1001\n001 11100\n400 1047\n429 5000\n10000 10000\n0 0", "out...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou've got a string s = s1s2... s|s| of length |s|, consisting of lowercase English letters. There also are q...
[{"input": "ccca\n100\n2 4\n1 2\n1 1\n2 3\n3 4\n3 4\n2 2\n3 3\n1 2\n1 4\n2 2\n1 3\n1 4\n4 4\n1 2\n2 3\n3 4\n1 3\n3 4\n2 3\n1 1\n2 4\n1 4\n1 2\n2 2\n2 2\n1 1\n3 3\n1 2\n2 3\n2 3\n1 2\n1 4\n4 4\n2 2\n2 2\n4 4\n1 4\n1 1\n1 2\n4 4\n2 3\n2 4\n3 3\n1 4\n2 4\n2 3\n4 4\n4 4\n3 4\n2 2\n1 2\n1 1\n1 2\n3 3\n2 4\n1 3\n2 4\n1 1\n3 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn this Kata, you will be given a mathematical string and your task will be to remove all braces as follows:\...
[{"input": "\"v-(l+s)-(t+y)-(c+f)+(b-(n-p))\"", "output": "[\"v-l-s-t-y-c-f+b-n+p\"]", "fn_name": "solve"}, {"input": "\"x-(-((-((((-((-(-(-y)))))))))))\"", "output": "[\"x-y\"]", "fn_name": "solve"}, {"input": "\"q+(s-(x-o))-(t-(w-a))\"", "output": "[\"q+s-x+o-t+w-a\"]", "fn_name": "solve"}, {"input": "\"(((((((m-(-((...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPolycarp has a cat and his cat is a real gourmet! Dependent on a day of the week he eats certain type of food...
[{"input": "700000000 700000000 700000000\n", "output": "1633333336\n"}, {"input": "600025643 600010745 600014575\n", "output": "1400059835\n"}, {"input": "600019415 600004367 600015718\n", "output": "1400045303\n"}, {"input": "650439292 352470919 347331093\n", "output": "1215658828\n"}, {"input": "690005222 690012314 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPetya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of bei...
[{"input": "100\nqn\nBE\nyN\nep\nPq\nXz\nLM\nEZ\ndb\nMn\nbn\nFe\nqA\nzc\nyq\npC\nyA\nWk\nYq\nrs\noD\nvD\nzW\nxZ\nbl\nur\nkf\ndf\nLS\nUW\nMy\nhR\nsh\nNh\nog\nCW\nor\nzo\nrO\nao\nXH\nDq\nKa\nlL\nYQ\nOh\nRZ\nAx\nta\nko\nDn\nNg\nNy\nDB\nYD\njO\nAp\nFT\noB\nNc\nwB\nHO\neW\nAc\nDr\nMt\nDf\nbF\nFP\nRa\nnF\nhF\nXC\nnG\nan\nZY\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nZS the Coder has recently found an interesting concept called the Birthday Paradox. It states that given a ra...
[{"input": "1000000000000000010 1000000000000000000\n", "output": "954414 954414\n"}, {"input": "1000000000000000000 1000000000000000000\n", "output": "906300 906300"}, {"input": "1000000000000000000 1000000000000000000\n", "output": "906300 906300"}, {"input": "1002926547994558173 397746475431992189\n", "output": "145...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDZY has a sequence a, consisting of n integers.\n\nWe'll call a sequence a_{i}, a_{i} + 1, ..., a_{j} (1 ≤ i ...
[{"input": "50\n804289384 846930887 681692778 714636916 957747794 424238336 719885387 649760493 596516650 189641422 25202363 350490028 783368691 102520060 44897764 967513927 365180541 540383427 304089173 303455737 35005212 521595369 294702568 726956430 336465783 861021531 59961394 89018457 101513930 125898168 131176230...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet's denote as L(x, p) an infinite sequence of integers y such that gcd(p, y) = 1 and y > x (where gcd is th...
[{"input": "5\n42 42 42\n43 43 43\n44 44 44\n45 45 45\n46 46 46\n", "output": "187\n87\n139\n128\n141\n"}, {"input": "5\n42 42 42\n43 43 43\n44 44 44\n45 45 45\n46 46 68\n", "output": "187\n87\n139\n128\n187\n"}, {"input": "5\n42 42 42\n43 43 43\n44 44 44\n45 45 45\n84 46 68\n", "output": "187\n87\n139\n128\n225\n"}, {...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLeonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He al...
[{"input": "10 19 10\nV 6\nH 8\nV 4\nV 8\nH 2\nH 5\nV 9\nH 7\nH 3\nV 7\n", "output": "114\n66\n44\n44\n44\n44\n44\n44\n44\n44\n"}, {"input": "15 5 10\nV 13\nV 6\nV 3\nH 4\nV 12\nV 7\nV 2\nH 1\nV 4\nH 3\n", "output": "65\n35\n35\n28\n24\n20\n20\n15\n15\n10\n"}, {"input": "5 25 10\nH 8\nH 9\nV 1\nH 2\nH 6\nH 4\nH 1\nV 2\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiga Tower is the tallest and deepest building in Cyberland. There are 17 777 777 777 floors, numbered from ...
[{"input": "-1000000000\n", "output": "2\n"}, {"input": "-1000000000\n", "output": "2\n"}, {"input": "-1325769607\n", "output": "9\n"}, {"input": "-1737641826\n", "output": "1\n"}, {"input": "-410058385\n", "output": "1\n"}, {"input": "-586825624\n", "output": "1\n"}, {"input": "-408490162\n", "output": "1\n"}, {"input...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou received a notebook which is called Death Note. This notebook has infinite number of pages. A rule is wri...
[{"input": "16 2\n999999999 999999999 999999999 856501885 1080831631 999999999 768581442 1196229362 999999999 999999999 1341911334 1890212075 1581621479 999999999 999999999 999999999\n", "output": "499999999 500000000 499999999 428250943 540415815 500000000 384290721 598114681 499999999 500000000 670955667 945106037 79...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nEdward Leven loves multiples of eleven very much. When he sees a number, he always tries to find consecutive ...
[{"input": "17819\n1011\n11011\n1234567891011121314151617181920\n0", "output": "1\n1\n4\n38\n"}, {"input": "17819\n1010\n11011\n1234567891011121314151617181920\n0", "output": "1\n0\n4\n38\n"}, {"input": "17819\n1011\n11011\n1300831114838731654212402340246\n0", "output": "1\n1\n4\n32\n"}, {"input": "17819\n1010\n01011\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Back-Story\n\nEvery day I travel on the freeway.\n\nWhen I am more bored than usual I sometimes like to pla...
[{"input": "50.0\n120.0\n[[-1.0, 115.0], [-1.5, 110.0], [1.0, 130.0], [1.5, 130.0]]", "output": "[0]", "fn_name": "freeway_game"}, {"input": "50.0\n110.0\n[[-1.0, 110.0], [0.5, 110.0], [1.0, 110.0], [1.5, 110.0]]", "output": "[0]", "fn_name": "freeway_game"}, {"input": "30.0\n100.0\n[[-1.0, 110.0], [-0.7, 102.0], [-1.5...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn programming, hexadecimal notation is often used.\nIn hexadecimal notation, besides the ten digits 0, 1, .....
[{"input": "A B\n", "output": "<\n"}, {"input": "E C\n", "output": ">\n"}, {"input": "F F\n", "output": "=\n"}, {"input": "E F", "output": "<\n"}, {"input": "A A", "output": "=\n"}, {"input": "E B", "output": ">\n"}, {"input": "D F", "output": "<\n"}, {"input": "A C", "output": "<\n"}, {"input": "E A", "output": ">\n"}...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSaMer has written the greatest test case of all time for one of his problems. For a given array of integers, ...
[{"input": "80\n8861 -8846 -3257 8263 -8045 4549 9626 -6582 5755 -3559 5813 -7411 9151 -1847 2441 4201 2381 4651 -6571 199 -6737 -6333 -9433 -4967 9041 -9319 6801 5813 -2731 -8599 7681 -1303 -7333 6067 -1847 -6333 6047 -7907 -7333 8677 -937 829 2441 -5702 -8045 -3037 -4882 -7703 9001 -5702 -2039 -7493 9173 -6047 6046 5...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA new e-mail service \"Berlandesk\" is going to be opened in Berland in the near future. The site administrat...
[{"input": "10\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzz...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYour job is to find out the secret number hidden in a matrix, each of whose element is a digit ('0'-'9') or a...
[{"input": "7 4\n399A2R9\n0A413E0\n8A800DE\n820R037\n6 7\nJI03HE\nI277D2\n0DA1AH\n30C9G5\n99178A\nCA7EAI\nAHLBEM\n20 2\nA1234567891234CBDEHH\nBDEDF908034265091499\n0 0", "output": "3994800037\n2771978\n12345908034265091499\n"}, {"input": "7 4\n9R2A993\n0E314A0\n8A900DE\n820R037\n6 7\nJI03HD\n2277DI\n0DA1AH\n30C9G5\n991...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nJamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates wakin...
[{"input": "42\n15 44\n", "output": "12\n"}, {"input": "26\n04 58\n", "output": "26\n"}, {"input": "35\n15 25\n", "output": "13\n"}, {"input": "50\n01 59\n", "output": "10\n"}, {"input": "46\n06 16\n", "output": "17\n"}, {"input": "14\n03 30\n", "output": "41\n"}, {"input": "20\n15 52\n", "output": "24\n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In ...
[{"input": "24\n17:30\n", "output": "17:30\n"}, {"input": "12\n17:30\n", "output": "07:30\n"}, {"input": "24\n99:99\n", "output": "09:09\n"}, {"input": "12\n05:54\n", "output": "05:54\n"}, {"input": "12\n00:05\n", "output": "01:05\n"}, {"input": "24\n23:80\n", "output": "23:00\n"}, {"input": "24\n73:16\n", "output": "0...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou're given an undirected graph with $n$ nodes and $m$ edges. Nodes are numbered from $1$ to $n$.\n\nThe gra...
[{"input": "1460 5\n100 300\n200 735\n420 117\n559 450\n435 900\n", "output": "795\n"}, {"input": "1460 5\n101 300\n200 735\n420 117\n559 450\n435 900\n", "output": "794\n"}, {"input": "1460 5\n100 300\n200 735\n420 117\n559 450\n435 460\n", "output": "630\n"}, {"input": "1460 5\n100 300\n200 735\n420 117\n234 450\n435...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a set of n points on the plane. A line containing the origin is called good, if projection of t...
[{"input": "50\n-38 -107\n-34 -75\n-200 -143\n-222 -139\n-34 55\n-102 -79\n48 -99\n2 -237\n-118 -167\n-56 -41\n10 17\n68 -89\n-32 41\n-100 -93\n84 -1\n86 -15\n46 -145\n-101 -117\n8 31\n-36 -61\n-12 21\n-116 79\n88 -205\n70 -103\n-78 -37\n106 -5\n-96 -201\n-60 -103\n-54 45\n-138 -177\n-178 -47\n-154 -5\n-138 83\n44 -131...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTak performed the following action N times: rolling two dice.\nThe result of the i-th roll is D_{i,1} and D_{...
[{"input": "100\n3 3\n1 1\n5 5\n4 4\n1 1\n3 3\n3 3\n5 5\n2 2\n3 3\n2 2\n2 2\n3 3\n3 3\n5 5\n3 3\n1 1\n3 3\n4 4\n1 1\n4 4\n3 3\n3 3\n4 4\n6 6\n5 5\n2 2\n6 6\n3 3\n1 1\n6 6\n4 4\n3 3\n3 3\n6 6\n2 2\n5 5\n5 5\n1 1\n1 1\n5 5\n6 6\n6 6\n4 4\n6 6\n6 6\n5 5\n3 3\n2 2\n1 1\n1 1\n4 4\n6 6\n5 5\n3 3\n2 2\n3 3\n6 6\n2 2\n1 1\n4 4...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nConsider a sequence of n numbers using integers from 0 to 9 k1, k2, ..., kn. Read the positive integers n and...
[{"input": "3 14\n10 3", "output": "14\n0\n"}, {"input": "3 22\n10 3", "output": "24\n0\n"}, {"input": "5 33\n3 1", "output": "119\n0\n"}, {"input": "4 53\n0 0", "output": "131\n0\n"}, {"input": "4 34\n3 2", "output": "100\n0\n"}, {"input": "2 25\n10 0", "output": "2\n0\n"}, {"input": "3 20\n3 1", "output": "22\n0\n"},...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; i...
[{"input": "B\n", "output": "A\n"}, {"input": "a\n", "output": "a\n"}, {"input": "A\n", "output": "A\n"}, {"input": "G\n", "output": "A\n"}, {"input": "Y\n", "output": "A\n"}, {"input": "Z\n", "output": "A\n"}, {"input": "b\n", "output": "a\n"}, {"input": "r\n", "output": "a\n"}, {"input": "x\n", "output": "a\n"}, {"in...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is the faculty of Computer Science in Berland. In the social net \"TheContact!\" for each course of thi...
[{"input": "5\n2043 2042 2041 2044 2040\n", "output": "2042\n"}, {"input": "5\n2012 2013 2014 2015 2016\n", "output": "2014\n"}, {"input": "5\n2011 2014 2012 2013 2010\n", "output": "2012\n"}, {"input": "5\n2014 2013 2011 2012 2015\n", "output": "2013\n"}, {"input": "5\n2021 2023 2024 2020 2022\n", "output": "2022\n"},...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThis is the easy version of the problem. The difference between the versions is the constraint on n and the r...
[{"input": "5\n2\n01\n10\n5\n01011\n11000\n2\n01\n01\n10\n0111011011\n1000110100\n1\n0\n0\n", "output": "3 1 2 1 \n5 1 5 1 3 1 \n0 \n11 1 10 8 7 6 1 5 4 1 3 1 \n0 \n"}, {"input": "5\n2\n01\n10\n5\n01101\n11100\n2\n01\n01\n10\n0111011011\n1000110100\n1\n0\n0\n", "output": "3 1 2 1 \n5 1 5 3 1 2 \n0 \n11 1 10 8 7 6 1 5 4...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nC: Short-circuit evaluation\n\nproblem\n\nNaodai-kun and Hokkaido University-kun are playing games. Hokkaido ...
[{"input": "?&?&?|?|?&?", "output": "3 2\n"}, {"input": "?|?&?|?&?&?", "output": "3 1\n"}, {"input": "?&?&?|?&?|?", "output": "3 3\n"}, {"input": "?&?|?|?&?&?", "output": "3 2\n"}, {"input": "?|?|?&?&?&?", "output": "3 1\n"}, {"input": "?&?&?&?|?|?", "output": "3 2\n"}, {"input": "?|?&?&?|?&?", "output": "3 1\n"}, {"in...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nJATC loves Banh-mi (a Vietnamese food). His affection for Banh-mi is so much that he always has it for breakf...
[{"input": "10 8\n0110000110\n3 3\n1 10\n4 4\n1 8\n1 2\n9 10\n2 10\n3 9\n", "output": "1\n960\n0\n224\n2\n2\n480\n112\n"}, {"input": "10 8\n0110000110\n3 3\n1 10\n4 4\n1 8\n1 2\n9 10\n2 10\n3 9\n", "output": "1\n960\n0\n224\n2\n2\n480\n112\n"}, {"input": "10 8\n0110000110\n3 3\n2 10\n4 4\n1 8\n1 2\n9 10\n2 10\n3 9\n", ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOne of the simple ciphers is the affine cipher. First, replace the letters a to z with the numbers a = 0, b =...
[{"input": "1\nx eazqyp pnop pngtg ye obmpngt xmybp mr lygw", "output": "p submit that there is another point of view\n"}, {"input": "1\nx pyqzae pnop pngtg ye obmpngt xmybp mr lygw", "output": "p timbus that there is another point of view\n"}, {"input": "1\nx pyqzae pnop pngtg ye onmpbgt xmybp mr lygw", "output": "p t...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given sequence a_1, a_2, ..., a_{n} and m queries l_{j}, r_{j} (1 ≤ l_{j} ≤ r_{j} ≤ n). For each quer...
[{"input": "10 6\n4 2 1 5 12 7 9 8 10 4\n1 3\n1 10\n2 10\n2 9\n5 5\n2 8\n", "output": "-1\n9\n-1\n-1\n-1\n-1\n"}, {"input": "10 6\n4 2 1 5 6 7 9 8 10 4\n1 3\n1 10\n2 10\n2 9\n5 5\n2 8\n", "output": "-1\n9\n-1\n-1\n-1\n-1\n"}, {"input": "10 6\n4 2 1 5 6 4 12 8 10 4\n1 2\n1 10\n2 10\n2 9\n5 5\n2 8\n", "output": "-1\n4\n4...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\nIf we use only 1000-yen bills to pay the ...
[{"input": "1900\n", "output": "100\n"}, {"input": "1001\n", "output": "999\n"}, {"input": "4575\n", "output": "425\n"}, {"input": "6426\n", "output": "574\n"}, {"input": "9445\n", "output": "555\n"}, {"input": "8772\n", "output": "228\n"}, {"input": "3447\n", "output": "553\n"}, {"input": "3497\n", "output": "503\n"},...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nI: Ravage\n\nSanta Claus was caught in the illuminations of the city and broke it.\n\nThere are N light bulbs...
[{"input": "4\n-1 2\n3 2\n-1 4\n-1 15", "output": "3\n"}, {"input": "4\n-4 2\n0 10\n3 7\n-2 2", "output": "3\n"}, {"input": "4\n-4 2\n0 10\n3 2\n-2 2", "output": "3\n"}, {"input": "4\n-4 2\n0 10\n3 2\n-4 2", "output": "3\n"}, {"input": "4\n-1 0\n3 6\n3 7\n-2 10", "output": "3\n"}, {"input": "4\n-1 2\n3 2\n-1 4\n-1 8", ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFind a cycle in a directed graph G(V, E).\n\nConstraints\n\n* 1 ≤ |V| ≤ 100\n* 0 ≤ |E| ≤ 1,000\n* si ≠ ti\n\n...
[{"input": "10 0\n0 6\n-1 2\n4 0", "output": "0\n"}, {"input": "10 0\n0 5\n-1 2\n4 0", "output": "0\n"}, {"input": "10 1\n0 5\n-1 2\n4 0", "output": "0\n"}, {"input": "10 1\n0 5\n-1 2\n2 0", "output": "0\n"}, {"input": "10 1\n0 5\n-1 2\n1 0", "output": "0\n"}, {"input": "11 3\n0 1\n0 2\n1 2", "output": "0\n"}, {"input"...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOn a number axis directed from the left rightwards, n marbles with coordinates x1, x2, ..., xn are situated. ...
[{"input": "15\n-241250505 -2\n-241250503 0\n-241250502 -5\n-241250501 -1\n-241250500 -3\n-241250499 2\n-241250498 -2\n-241250497 6\n-241250496 0\n-241250495 0\n-241250494 8\n-241250493 -5\n-241250492 7\n-241250491 -7\n-241250490 2\n", "output": "-20\n"}, {"input": "15\n-241250505 -2\n-241250503 0\n-241250502 -5\n-2412...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWrite a program which reads a word W and a text T, and prints the number of word W which appears in text T\n\...
[{"input": "computer\nNurtures computer scientists and highly-skilled computer engineers\nwho will create and exploit \"knowledge\" for the enw era.\nProvides an outstanding computer environment.\nEND_OF_TEXT", "output": "3\n"}, {"input": "comquter\nNurtures computer scientists and highly-skilled computer engineers\nwh...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nKarlsson has visited Lillebror again. They found a box of chocolates and a big whipped cream cake at Lillebro...
[{"input": "O O .\n O O . .\n. . . . .\n . . . .\n . O .\n", "output": "Lillebror\n"}, {"input": ". . O\n . O O .\nO . O . O\n O O O O\n . . O\n", "output": "Lillebror\n"}, {"input": "O O O\n O . O .\nO . . O O\n O . O O\n O O O\n", "output": "Lillebror\n"}, {"input": "O O O\n O O O O\nO . O O .\n . O O O\n O O O\n...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe solution of $ x ^ 3 = q $ is to calculate the recurrence formula $ x_ {n + 1} = x_n-\\ frac {x_ {n} ^ 3 -...
[{"input": "15\n153\n-1", "output": "2.466212\n5.348481\n"}, {"input": "15\n123\n-1", "output": "2.466212\n4.973190\n"}, {"input": "15\n194\n-1", "output": "2.466212\n5.788963\n"}, {"input": "15\n103\n-1", "output": "2.466212\n4.687549\n"}, {"input": "15\n116\n-1", "output": "2.466212\n4.877008\n"}, {"input": "15\n196\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFor the given sequence with n different elements find the number of increasing subsequences with k + 1 elemen...
[{"input": "100 7\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n74\n75\n76\n77\n78...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYouKn0wWho has an integer sequence a_1, a_2, …, a_n. He will perform the following operation until the sequen...
[{"input": "5\n3\n1 4 3\n1\n1\n2\n7 11\n10\n384836991 191890310 576823355 183520469 404011431 1289917932 954291757 278929746 155374934 1531647833\n8\n5 73 1379 69130 598267 6969696 114587927 1145009244\n", "output": "YES\nYES\nYES\nYES\nYES\n"}, {"input": "5\n3\n1 4 3\n1\n1\n2\n13 11\n10\n384836991 191890310 576823355 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all...
[{"input": "50\nPFH\nJFV->PFH\nBVP->PFH\nPFH->BVP\nPFH->JFV\nPFH->ETQ\nPFH->LQJ\nZTO->PFH\nPFH->BVP\nPFH->RXO\nPFH->ZTO\nHWL->PFH\nPFH->HIV\nPFH->AFP\nPFH->HWL\nOBB->PFH\nHIV->PFH\nPFH->LSR\nAFP->PFH\nLQJ->PFH\nHWL->PFH\nETQ->PFH\nPFH->HWL\nLSR->PFH\nWBR->PFH\nBNZ->PFH\nHQR->PFH\nZTO->PFH\nPFH->WBR\nPFH->BYJ\nRXO->PFH\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given array $a$ of length $n$. You can choose one segment $[l, r]$ ($1 \\le l \\le r \\le n$) and int...
[{"input": "39 1\n4 2 1 1 3 5 1 5 1 1 3 3 4 3 1 1 4 5 1 5 2 3 3 1 5 1 2 1 1 4 1 1 5 2 2 1 1 2 4\n", "output": "19\n"}, {"input": "39 1\n4 2 1 1 3 5 1 5 1 1 3 3 4 3 1 1 4 5 1 5 2 3 3 1 5 1 2 1 1 4 1 1 5 2 2 1 1 2 4\n", "output": "19\n"}, {"input": "39 1\n4 2 1 1 3 5 1 5 1 1 3 3 4 3 1 1 4 5 1 5 3 3 3 1 5 1 2 1 1 4 1 1 5 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of di...
[{"input": "3\n111 110\n111 11100\n-2 1111011010", "output": "10990\n"}, {"input": "3\n011 110\n111 11100\n-2 1111011010", "output": "11090\n"}, {"input": "3\n010 110\n111 11100\n-2 1111011010", "output": "11091\n"}, {"input": "3\n000 010\n010 11100\n-2 0111011011", "output": "11101\n"}, {"input": "3\n000 011\n2 10000\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nConvert integers to binary as simple as that. You would be given an integer as a argument and you have to ret...
[{"input": "-999999", "output": "[\"11111111111100001011110111000001\"]", "fn_name": "to_binary"}, {"input": "-1000", "output": "[\"11111111111111111111110000011000\"]", "fn_name": "to_binary"}, {"input": "-15", "output": "[\"11111111111111111111111111110001\"]", "fn_name": "to_binary"}, {"input": "-3", "output": "[\"1...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# How many ways can you make the sum of a number?\n\nFrom wikipedia: https://en.wikipedia.org/wiki/Partition_...
[{"input": "275", "output": "[1520980492851175]", "fn_name": "exp_sum"}, {"input": "200", "output": "[3972999029388]", "fn_name": "exp_sum"}, {"input": "90", "output": "[56634173]", "fn_name": "exp_sum"}, {"input": "70", "output": "[4087968]", "fn_name": "exp_sum"}, {"input": "60", "output": "[966467]", "fn_name": "exp...
code_functional
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIt's the year 4527 and the tanks game that we all know and love still exists. There also exists Great Gena's ...
[{"input": "6\n1000000000000000000000000000000000000 11965651543 1000000000000000000000000000000000000 1000000000000000000000000000000000000 1000000000000000000000000000000000000 1000000000000000000000000000000000000\n", "output": "1196565154300000000000000000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given n points on Cartesian plane. Every point is a lattice point (i. e. both of its coordinates are ...
[{"input": "59\n1 0\n0 2\n0 3\n0 4\n0 5\n6 0\n7 0\n8 0\n9 0\n10 0\n0 11\n12 0\n13 0\n14 0\n15 0\n0 16\n0 17\n18 0\n19 0\n20 0\n21 0\n0 22\n23 0\n24 0\n0 25\n26 0\n27 0\n0 28\n0 29\n30 0\n31 0\n0 32\n33 0\n34 0\n0 35\n0 36\n37 0\n0 38\n39 0\n40 0\n0 41\n42 0\n0 43\n0 44\n0 45\n0 46\n47 0\n0 48\n0 49\n50 0\n0 51\n0 52\n5...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe have N ID cards, and there are M gates.\nWe can pass the i-th gate if we have one of the following ID card...
[{"input": "100000 1\n1 100000\n", "output": "100000\n"}, {"input": "101000 1\n1 100000", "output": "100000\n"}, {"input": "101000 1\n1 100100", "output": "100100\n"}, {"input": "101000 1\n1 100110", "output": "100110\n"}, {"input": "101000 1\n1 100010", "output": "100010\n"}, {"input": "101100 1\n2 100110", "output": ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPolycarp has $n$ friends, the $i$-th of his friends has $a_i$ candies. Polycarp's friends do not like when th...
[{"input": "1\n52\n0 1 1 1 1 -1 0 1 2 1 2 1 1 1 1 1 1 1 0 1 3 0 2 0 1 0 1 4 -1 2 1 1 -1 3 2 1 1 2 0 -1 2 1 2 0 1 2 2 1 1 1 1 0\n", "output": "13\n"}, {"input": "1\n52\n0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 0 1 2 -1 2 0 0 -1 3 2 1 1 1 0 1 2 1 2 0 1 2 2 1 1 1 1 1\n", "output": "10\n"}, {"input": "1\n52\n0 1 1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a positive integer $n$, written without leading zeroes (for example, the number 04 is incorrect...
[{"input": "2000000000\n", "output": "-1\n"}, {"input": "2000000000\n", "output": "-1\n"}, {"input": "1881388645\n", "output": "6\n"}, {"input": "1059472069\n", "output": "3\n"}, {"input": "1354124829\n", "output": "4\n"}, {"input": "1999967841\n", "output": "0\n"}, {"input": "1999431225\n", "output": "0\n"}, {"input":...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nProblem statement\n\nJOI decided to start a new social game from tomorrow.\n\nIn this social game, you can lo...
[{"input": "0 1 163", "output": "1141\n"}, {"input": "0 1 146", "output": "1022\n"}, {"input": "0 1 241", "output": "1687\n"}, {"input": "1 -1 229", "output": "267\n"}, {"input": "14 -2 229", "output": "17\n"}, {"input": "0 1 216", "output": "1512\n"}, {"input": "1 -1 163", "output": "190\n"}, {"input": "4 -3 502", "ou...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou invited $n$ guests to dinner! You plan to arrange one or more circles of chairs. Each chair is going to b...
[{"input": "10\n1000000000 1000000000\n1000000000 1000000000\n1000000000 1000000000\n1000000000 1000000000\n1000000000 1000000000\n1000000000 1000000000\n1000000000 1000000000\n1000000000 1000000000\n1000000000 1000000000\n1000000000 1000000000\n", "output": "10000000010\n"}, {"input": "10\n1000000000 1000000000\n10000...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are $n$ robbers at coordinates $(a_1, b_1)$, $(a_2, b_2)$, ..., $(a_n, b_n)$ and $m$ searchlight at coo...
[{"input": "7 3\n0 8\n3 8\n2 7\n0 10\n5 5\n7 0\n3 5\n6 6\n3 11\n11 5\n", "output": "6\n"}, {"input": "7 3\n0 8\n3 8\n2 7\n0 10\n5 5\n7 0\n3 5\n6 1\n3 11\n11 5\n", "output": "6\n"}, {"input": "7 3\n0 8\n3 8\n2 7\n0 10\n5 5\n7 0\n3 5\n6 0\n3 11\n11 5\n", "output": "6\n"}, {"input": "7 3\n0 8\n3 8\n2 7\n0 10\n5 5\n7 0\n3 ...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou want to arrange n integers a_1, a_2, ..., a_{n} in some order in a row. Let's define the value of an arra...
[{"input": "100\n-790 341 910 905 -779 279 696 -375 525 -21 -2 751 -887 764 520 -844 850 -537 -882 -183 139 -397 561 -420 -991 691 587 -93 -701 -957 -89 227 233 545 934 309 -26 454 -336 -994 -135 -840 -320 -387 -943 650 628 -583 701 -708 -881 287 -932 -265 -312 -757 695 985 -165 -329 -4 -462 -627 798 -124 -539 843 -492...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nArkady bought an air ticket from a city A to a city C. Unfortunately, there are no direct flights, but there ...
[{"input": "10 11 4 5 10\n1 2 3 4 5 6 7 8 9 10\n16 17 18 19 20 21 22 23 24 25 26\n", "output": "-1\n"}, {"input": "10 11 4 5 10\n1 2 3 4 5 6 7 8 9 10\n16 17 18 19 20 21 22 23 24 25 26\n", "output": "-1\n"}, {"input": "4 3 2 3 1\n1 999999998 999999999 1000000000\n3 4 1000000000\n", "output": "1000000003\n"}, {"input": "...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n people and k keys on a straight line. Every person wants to get to the office which is located on...
[{"input": "50 55 2000\n9518 9743 9338 9956 9827 9772 9094 9644 9242 9292 9148 9205 9907 9860 9530 9814 9662 9482 9725 9227 9105 9424 9268 9427 9470 9578 9808 9976 9143 9070 9079 9896 9367 9235 9925 9009 9619 9012 9669 9077 9870 9766 9479 9598 9055 9988 9792 9197 9377 9610\n828 656 345 412 69 506 274 994 384 766 587 12...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe only difference between easy and hard versions is constraints.\n\nNow elections are held in Berland and y...
[{"input": "3\n3\n1 5\n2 10\n2 15\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 15\n2 7\n4 4\n5 5\n", "output": "10\n0\n7\n"}, {"input": "3\n3\n1 5\n2 10\n2 4\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 14\n2 1\n4 4\n5 5\n", "output": "4\n0\n4\n"}, {"input": "3\n3\n1 5\n2 5\n2 4\n7\n0 1\n3 0\n1 1\n6 1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAtCoDeer the deer has N square tiles. The tiles are numbered 1 through N, and the number given to each tile i...
[{"input": "400\n196 345 527 695\n685 207 136 831\n303 497 409 762\n464 670 120 403\n867 799 702 490\n986 9 287 852\n519 89 617 973\n291 551 957 275\n329 210 75 744\n685 560 225 510\n568 429 313 112\n94 659 30 204\n51 891 791 326\n890 977 807 600\n203 468 753 791\n738 279 376 58\n377 694 954 955\n436 875 436 104\n942 1...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe academic year has just begun, but lessons and olympiads have already occupied all the free time. It is no...
[{"input": "50\nUUUUUUUUUUUUUUUUUUUUUUUUUDDDDDDDDDDDDDDDDDDDDDDDDD\n", "output": "51 102 153 204 255 306 357 408 459 510 561 612 663 714 765 816 867 918 969 1020 1071 1122 1173 1224 1275 1275 1224 1173 1122 1071 1020 969 918 867 816 765 714 663 612 561 510 459 408 357 306 255 204 153 102 51 "}, {"input": "50\nUUUUUUUUU...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nMr. Bender has a digital table of size n × n, each cell can be switched on or off. He wants the field to have...
[{"input": "1000000000 504951981 646612086 602763371\n", "output": "17360\n"}, {"input": "1000000000 999999946 999999941 715189365\n", "output": "37707\n"}, {"input": "1000000000 999999916 999999940 857945620\n", "output": "41279\n"}, {"input": "1000000000 999999946 999999916 423654797\n", "output": "28970\n"}, {"input...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in on...
[{"input": "xoxoxoxoxoxoxo", "output": "YES\n"}, {"input": "oxoxowoxoxoxox", "output": "YES\n"}, {"input": "oxoxowoooxoxxx", "output": "YES\n"}, {"input": "xxxoxooowoxoxo", "output": "YES\n"}, {"input": "xoxoxooxwoxoxo", "output": "YES\n"}, {"input": "xoxoyoxoxoxoxo", "output": "YES\n"}, {"input": "xxxoxoooooxwxo", "ou...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSnuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N color...
[{"input": "3 130\n011 10 101", "output": "122\n"}, {"input": "3 130\n111 10 101", "output": "222\n"}, {"input": "3 130\n111 10 100", "output": "221\n"}, {"input": "3 130\n011 10 100", "output": "121\n"}, {"input": "3 83\n011 10 101", "output": "114\n"}, {"input": "3 130\n111 7 100", "output": "218\n"}, {"input": "3 13...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nJohn has just bought a new car and is planning a journey around the country. Country has N cities, some of wh...
[{"input": "4\n1 2\n2 3\n3 4\n", "output": "24\n"}, {"input": "4\n1 2\n2 3\n3 4\n", "output": "24\n"}, {"input": "4\n1 2\n1 3\n3 4\n", "output": "24\n"}, {"input": "4\n1 2\n2 3\n2 4\n", "output": "14\n"}, {"input": "4\n1 4\n2 3\n3 4\n", "output": "24\n"}, {"input": "4\n1 4\n2 1\n3 4\n", "output": "24\n"}, {"input": "4\...
code_stdio
[ { "content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n boys and m girls studying in the class. They should stand in a line so that boys and girls altern...
[{"input": "1 852\n", "output": "GBGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG...
code_stdio