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\nAwruk is taking part in elections in his school. It is the final round. He has only one opponent — Elodreip. ... | [{"input": "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100... | 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-----Input-----\n\nThe input contains a single integer $a$ ($1 \\le a \\le 99$).\n\n\n-----Output-----\n\nOut... | [{"input": "46\n", "output": "YES\n"}, {"input": "12\n", "output": "YES\n"}, {"input": "30\n", "output": "YES\n"}, {"input": "35\n", "output": "YES\n"}, {"input": "43\n", "output": "YES\n"}, {"input": "52\n", "output": "YES\n"}, {"input": "64\n", "output": "YES\n"}, {"input": "86\n", "output": "YES\n"}, {"input": "011\... | 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 a string of length n s = s1, s2,…, sn and m queries. Each query qk (1 ≤ k ≤ m) is one of four types, \"... | [{"input": "10 13\naacacbabac\nR++\nR++\nL++\nR++\nR++\nL++\nL++\nR++\nR++\nL--\nL--\nR--\nR--", "output": "11"}, {"input": "4 6\nbaba\nR++\nL++\nR++\nL++\nR++\nL++", "output": "4\n"}, {"input": "4 6\nbaab\nR++\nL++\nR++\nL++\nR++\nL++", "output": "5\n"}, {"input": "8 6\nbacb\nR++\nL++\nR++\nL++\nR++\nL++", "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\nNantendo Co., Ltd. has released a game software called Packet Monster. This game was intended to catch, raise... | [{"input": "CBA\ncba\ncCa\nX\nYZ\nZ\n-", "output": "BbA\nYX\n"}, {"input": "CBA\ncba\ncCa\nY\nYZ\nZ\n-", "output": "BbA\nYY\n"}, {"input": "CBA\ncca\ncCa\nX\nZY\nZ\n-", "output": "BcA\nXY\n"}, {"input": "CAB\ncba\ncCa\nX\nYZ\nZ\n-", "output": "AbB\nYX\n"}, {"input": "CAB\ncca\ncCa\nX\nYZ\nZ\n-", "output": "AcB\nYX\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 several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this conne... | [{"input": "55 1000\n2612 1306 4300 1790 3173 9493 7209 7763 8563 4534 7466 1281 4483 6863 3787 7292 3957 8775 7221 4016 5743 6556 2070 2119 4795 9094 1913 2077 8786 4520 1865 2357 7871 3288 8231 5808 9383 9820 9974 3056 5343 2169 5177 6299 5805 8132 9315 6747 5226 3531 1206 4073 8290 1423 6720\n", "output": "3 1\n37 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\nTo stay woke and attentive during classes, Karen needs some coffee! [Image] \n\nKaren, a coffee aficionado, w... | [{"input": "3 2 4\n91 288\n92 97\n116 271\n92 192\n93 97\n95 138\n90 100\n", "output": "83\n5\n26\n6\n"}, {"input": "3 2 4\n91 510\n92 97\n66 271\n51 94\n93 97\n95 316\n100 111\n", "output": "4\n5\n177\n12\n"}, {"input": "3 2 4\n91 288\n92 97\n116 271\n86 192\n93 97\n95 138\n90 100\n", "output": "83\n5\n26\n6\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 are some beautiful girls in Arpa’s land as mentioned before.\n\nOnce Arpa came up with an obvious probl... | [{"input": "64 118\n361 547 410 294 448 377 482 490 13 116 346 50 251 330 443 128 543 580 370 489 337 509 414 291 228 71 245 308 319 314 154 39 317 288 145 248 547 152 262 278 89 108 522 238 128 575 112 469 86 230 310 492 127 270 475 25 179 72 345 444 17 332 544 338\n", "output": "3\n"}, {"input": "64 118\n361 547 410 ... | 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\nValentin participates in a show called \"Shockers\". The rules are quite easy: jury selects one letter which ... | [{"input": "15\n. r\n? e\n. s\n. rw\n? y\n. fj\n. zftyd\n? r\n! wq\n? w\n? p\n. ours\n. dto\n. lbyfru\n? q\n", "output": "2\n"}, {"input": "8\n! hello\n! codeforces\n? c\n. o\n? d\n? h\n. l\n? e\n", "output": "2\n"}, {"input": "7\n! ababahalamaha\n? a\n? b\n? a\n? b\n? a\n? h\n", "output": "0\n"}, {"input": "3\n. abcde... | 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\nA programming contest will be held in the Russian Federation. The contest has N question... | [{"input": "6\n1 2 0 15 0 2\n7\n2 5 4 2 6 1 0\n1 28 1 3 5 1 0", "output": "Yes\nNo\nYes\nYes\nYes\nYes\nYes\n"}, {"input": "6\n1 1 0 15 0 3\n7\n2 5 4 2 10 1 0\n1 28 1 3 0 1 0", "output": "Yes\nNo\nYes\nNo\nYes\nYes\nYes\n"}, {"input": "6\n1 2 0 15 1 4\n7\n0 5 8 2 11 1 0\n1 11 1 5 0 0 -1", "output": "No\nNo\nYes\nNo\nYe... | 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 s.\nAmong the different substrings of s, print the K-th lexicographically smallest one... | [{"input": "atcoderandatcodeer\n5\n", "output": "andat\n"}, {"input": "atcoderamdatcodeer\n5", "output": "amdat\n"}, {"input": "roddadtadmaoefectr\n5", "output": "admao\n"}, {"input": "atcoderamdascodeer\n5", "output": "amdas\n"}, {"input": "atcoderandatcodeer\n4", "output": "anda\n"}, {"input": "roddadtadmboefectr\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\nKate likes to count words in text blocks. By words she means continuous sequences of English alphabetic chara... | [{"input": "\"Really2374239847 long ^&#$&(*@# sequence\"", "output": "[3]", "fn_name": "word_count"}, {"input": "\"Hello there, little user5453 374 ())$.\"", "output": "[4]", "fn_name": "word_count"}, {"input": "\"Slow-moving user6463 has been here\"", "output": "[6]", "fn_name": "word_count"}, {"input": "\"I'd like to... | 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\nFox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The com... | [{"input": "-1000000000 -1000000000\nDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL\n", "output": "Yes\n"}, {"input": "-1000000000 -1000000000\nDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDLDL\n", "output": "Yes\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 an infinite checkered field. You should get from a square (x1; y1) to a square (x2; y2). Using ... | [{"input": "999999999 1000000000 1000000000 -999999999 -1000000000 999999999\n", "output": "1"}, {"input": "101304499 148554333 -590787464 -890180401 -117457421 997140710\n", "output": "12"}, {"input": "1000000000 1000000000 871940474 991768763 -914352281 -886310260\n", "output": "1"}, {"input": "781751245 1100000000 -... | 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\nYou are given a sequence $a$ consisting... | [{"input": "6\n8\n1 1 4 2 1 2 1 1\n3\n1 3 12\n4\n1 10 10 1\n1\n26\n2\n2 4\n3\n2 1 1\n", "output": "6\n1\n4\n1\n1\n2\n"}, {"input": "6\n8\n1 1 2 2 3 2 1 1\n3\n1 3 3\n4\n1 10 10 1\n1\n26\n2\n2 1\n3\n1 1 1\n", "output": "7\n2\n4\n1\n1\n3\n"}, {"input": "6\n8\n1 1 2 2 3 2 1 1\n3\n1 3 3\n4\n1 10 10 1\n1\n26\n2\n2 2\n3\n1 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\nRamesses knows a lot about problems involving trees (undirected connected graphs without cycles)!\n\nHe creat... | [{"input": "9\n1 2\n1 3\n1 4\n1 5\n1 6\n6 7\n7 8\n8 9\n", "output": "Yes\n5\n1 2\n1 3\n1 4\n1 5\n1 9\n"}, {"input": "9\n1 2\n2 3\n1 4\n1 5\n1 6\n6 7\n5 8\n7 9\n", "output": "Yes\n4\n1 3\n1 4\n1 8\n1 9\n"}, {"input": "9\n1 2\n2 3\n1 4\n1 8\n1 6\n6 7\n5 8\n7 9\n", "output": "Yes\n4\n1 3\n1 4\n1 5\n1 9\n"}, {"input": "5\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 permutation is a sequence of integers from $1$ to $n$ of length $n$ containing each number exactly once. Fo... | [{"input": "5 4\n1 2 5\n2 3\n1 1 3\n1 3 4\n", "output": "14\n7\n9\n"}, {"input": "4 4\n1 2 4\n2 3\n1 1 2\n1 1 4\n", "output": "9\n4\n10\n"}, {"input": "5 4\n1 1 4\n2 5\n1 1 2\n1 3 4\n", "output": "10\n3\n9\n"}, {"input": "5 4\n1 1 4\n2 5\n1 1 1\n1 3 4\n", "output": "10\n1\n9\n"}, {"input": "4 4\n1 1 4\n2 3\n1 1 2\n1 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\nOnce Vasya and Petya assembled a figure of m cubes, each of them is associated with a number between 0 and m ... | [{"input": "25\n-611859852 0\n-611859842 0\n-611859837 0\n-611859843 0\n-611859863 0\n-611859851 0\n-611859857 0\n-611859858 0\n-611859845 0\n-611859865 0\n-611859836 0\n-611859839 0\n-611859850 0\n-611859854 0\n-611859838 0\n-611859840 0\n-611859860 0\n-611859853 0\n-611859848 0\n-611859844 0\n-611859861 0\n-611859856... | 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\nBessie the cow has just intercepted a text that Farmer John sent to Burger Queen! However, Bessie is sure tha... | [{"input": "abcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuv... | 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\nAs you probably know, Fibonacci sequence are the numbers in the following integer sequence:\n1, 1, 2, 3, 5, 8... | [{"input": "193150", "output": "[5]", "fn_name": "get_last_digit"}, {"input": "193241", "output": "[1]", "fn_name": "get_last_digit"}, {"input": "20001", "output": "[6]", "fn_name": "get_last_digit"}, {"input": "99999", "output": "[6]", "fn_name": "get_last_digit"}, {"input": "1001", "output": "[1]", "fn_name": "get_la... | 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\nKoa the Koala has a binary string $s$ of length $n$. Koa can perform no more than $n-1$ (possibly zero) opera... | [{"input": "0100111100100101001101111001011101011001111100110111101110001001010111100010011100011011101111010111111010010101000001110110111110010001100010101110111111000011101110000000001101010011000111111100000000000000001010011111010111\n", "output": "975171002\n"}, {"input": "0100111100100101001101111001011101011001... | 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 task for you!\n\nYou have to create a method, that corrects a given time string.\nThere was a problem i... | [{"input": "\"09:10:01\"", "output": "[\"09:10:01\"]", "fn_name": "time_correct"}, {"input": "\"11:70:10\"", "output": "[\"12:10:10\"]", "fn_name": "time_correct"}, {"input": "\"19:99:99\"", "output": "[\"20:40:39\"]", "fn_name": "time_correct"}, {"input": "\"24:01:01\"", "output": "[\"00:01:01\"]", "fn_name": "time_co... | 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\nJATC and his friend Giraffe are currently in their room, solving some problems. Giraffe has written on the bo... | [{"input": "100\n901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976... | 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 have a string of decimal digits s. Let's define b_{ij} = s_{i}·s_{j}. Find in matrix b the number of such... | [{"input": "700\n100101011011001100111101100101000100000000011001111000111110001011011100010110000000000100100000001100000011110011101110011101101110111011011100001001101011000100000000000110001000101001100011111110011010101011010100010100001011011111001011000101001101000111010100110000100100110011111100010111100010000... | 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 often have to copy large volumes of information. Such operation can take up many computer resources. There... | [{"input": "20 30\n5 6 -6 10 10 -6 10 7 0 -20 3 1 -7 -13 1 -7 5 1 -1 1\n2 10 -10 -1 -9 3 9 -9 6 5 10 -2 -5 -14 1 5 -4 -1 -8 -7\n2 14\n1 8 11 1\n2 7\n1 6 11 1\n1 9 2 7\n1 12 1 7\n2 20\n2 5\n1 14 8 3\n1 8 17 4\n2 4\n1 11 12 9\n2 8\n2 3\n2 2\n1 17 13 2\n1 3 18 1\n2 11\n1 5 12 6\n1 12 13 1\n2 16\n2 11\n2 10\n2 19\n2 20\n2 ... | 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$ segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments ... | [{"input": "10\n841746 527518 -841746 -527518\n595261 331297 -595261 -331297\n-946901 129987 946901 -129987\n670374 -140388 -670374 140388\n-684770 309555 684770 -309555\n-302589 415564 302589 -415564\n-387435 613331 387435 -613331\n-624940 -95922 624940 95922\n945847 -199224 -945847 199224\n24636 -565799 -24636 565799... | 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 has a string $s$ of length $n$ consisting only of digits 0 and 1. Also he has an array $a$ of length $n... | [{"input": "99\n101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101\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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1000000000 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 1 1 1 1 1 1 1 1 1 1 1 1 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\nIn Japan, people make offerings called hina arare, colorful crackers, on March 3.\nWe have a bag that contain... | [{"input": "100\nP P P G G P P P G G P P G G P G W G W G G G P G P P G P P P G G G P P G P G P P G P P G G G W G G G P P P W G P G G P G G G G G P P W P G G G G G P P G G P G P G G G G P G G G G W P G P P P G G P G P\n", "output": "Three\n"}, {"input": "100\nG G G G G W W W W W W G W G G G W G P W W W W G G W G W G W W... | 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 going to buy N items one by one.\nThe price of the i-th item he buys is A_i yen (the currency of... | [{"input": "7955 99805\n280223699 243184364 149210358 462114945 880243783 898930650 89064311 63969626 29578760 282083932 336425831 645450084 410674240 438196631 429198606 786790252 782175216 882975396 529275843 756821367 312076396 771188495 855523957 734650681 911233499 357477721 909515813 72334495 882955704 862214008 ... | 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 educational program (AHK Education) of the Aiz Broadcasting Corporation broadcasts a program called \"Pla... | [{"input": "2 -1\n2 9\n-1 1\n0 -1\n-1 6\n-1 5", "output": "no\n"}, {"input": "2 -1\n2 6\n-1 1\n0 -1\n-1 6\n-1 5", "output": "no\n"}, {"input": "2 -1\n2 6\n-1 1\n0 -1\n-1 6\n-2 5", "output": "no\n"}, {"input": "2 -1\n2 7\n-1 1\n0 -1\n-1 6\n-2 5", "output": "no\n"}, {"input": "2 -1\n2 7\n-2 1\n0 -1\n-1 6\n-2 5", "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\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, wha... | [{"input": "-1000000000 1000000000 -1000000000 1000000000\n", "output": "1000000000000000000\n"}, {"input": "418379342 802780784 -790013317 -445130206\n", "output": "-186233282690604452\n"}, {"input": "-477104372 -381646699 -939378260 508013173\n", "output": "448181474807752720\n"}, {"input": "-683353808 -213997410 -57... | 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\nSome time ago Leonid have known about idempotent functions. Idempotent function defined on a set {1, 2, ..., ... | [{"input": "142\n34 88 88 88 88 88 131 53 88 130 131 88 88 130 88 131 53 130 130 34 88 88 131 130 53 88 88 34 131 130 88 131 130 34 130 53 53 34 53 34 130 34 88 88 130 88 131 130 34 53 88 34 53 88 130 53 34 53 88 131 130 34 88 88 130 88 130 130 131 131 130 53 131 130 131 130 53 34 131 34 88 53 88 53 34 130 88 88 130 53... | 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 have N cups and 1 ball.\n\nThe cups are arranged in a row, from left to right.\n\nYou turned down all the... | [{"input": "20 3\n1 4\n10 17\n1 19", "output": "4\n"}, {"input": "20 3\n1 4\n10 17\n1 14", "output": "4\n"}, {"input": "20 3\n1 4\n10 17\n1 13", "output": "4\n"}, {"input": "20 3\n1 1\n10 17\n1 13", "output": "4\n"}, {"input": "24 1\n2 1\n11 18\n1 35", "output": "3\n"}, {"input": "20 3\n1 4\n10 17\n2 14", "output": "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\nChef loves arrays. But he really loves a specific kind of them - Rainbow Arrays. \nThe array is a Rainbow Arr... | [{"input": "1018", "output": "857373624\n"}, {"input": "200", "output": "120529249\n"}, {"input": "140", "output": "119877472\n"}, {"input": "320", "output": "398506989\n"}, {"input": "147", "output": "170230452\n"}, {"input": "269", "output": "177979760\n"}, {"input": "229", "output": "666926094\n"}, {"input": "303", ... | 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 $s$, consisting only of characters '0' and '1'.\n\nYou have to choose a contiguous sub... | [{"input": "1\n101010101010101010101010101010010101010101010101010101010101010101010100000\n", "output": "35\n"}, {"input": "1\n10101010101010101010101010101001010101010101010101010101010101010101010000\n", "output": "35\n"}, {"input": "1\n1101010101111010110101010101001010111010\n", "output": "17\n"}, {"input": "1\n00... | 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\nRead problems statements in Mandarin Chinese here \nRead problems statements in Russian here \n\n------ Probl... | [{"input": "3\n10:00\n09:00\n14\n10:00\n08:00\n151\n10:00\n09:00\n167", "output": "74.0 60.0\n271.0 211.0\n227.0 197.0\n"}, {"input": "3\n10:00\n09:00\n20\n10:00\n08:00\n151\n10:00\n09:00\n167", "output": "80.0 60.0\n271.0 211.0\n227.0 197.0\n"}, {"input": "3\n10:00\n09:00\n15\n10:00\n08:00\n151\n10:00\n09:00\n167", "o... | 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\nFibonacci number f(i) appear in a variety of puzzles in nature and math, including packing problems, family t... | [{"input": "10 1\n118 1\n22 23", "output": "10\n109\n12\n"}, {"input": "10 7\n118 1\n22 23", "output": "6\n109\n12\n"}, {"input": "10 3\n118 1\n22 23", "output": "8\n109\n12\n"}, {"input": "21 2\n104 7\n52 12", "output": "20\n59\n30\n"}, {"input": "16 2\n50 2\n22 20", "output": "15\n47\n13\n"}, {"input": "16 2\n75 2\n2... | 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\nGoldbach's Conjecture: For any even number n greater than or equal to 4, there exists at least one pair of pr... | [{"input": "6\n10\n14\n0", "output": "1\n2\n2\n"}, {"input": "6\n1\n12\n0", "output": "1\n0\n1\n"}, {"input": "6\n10\n8\n0", "output": "1\n2\n1\n"}, {"input": "6\n4\n12\n0", "output": "1\n1\n1\n"}, {"input": "6\n2\n14\n0", "output": "1\n0\n2\n"}, {"input": "6\n16\n1\n0", "output": "1\n2\n0\n"}, {"input": "6\n6\n14\n0",... | 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\nAt Akabe High School, which is a programmer training school, the roles of competition programmers in team bat... | [{"input": "4\n2 1 2\n2 1 2\n13 15 2\n0 1 3", "output": "1\n1\n7\n0\n"}, {"input": "4\n2 1 2\n2 2 2\n13 15 2\n0 1 3", "output": "1\n2\n7\n0\n"}, {"input": "4\n11 0 1\n0 3 3\n2 10 4\n1 2 3", "output": "3\n0\n2\n1\n"}, {"input": "4\n0 1 2\n3 0 2\n13 19 2\n0 1 3", "output": "0\n1\n7\n0\n"}, {"input": "4\n2 1 2\n2 4 2\n13 ... | 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 are N positive integers A_1,...,A_N.\nConsider positive integers B_1, ..., B_N that satisfy the followi... | [{"input": "10000\n996426 991040 991394 993249 993789 994392 991787 998270 994534 999447 995337 997096 996535 997215 994454 999779 998240 991404 991682 999870 990794 994313 993602 993869 997730 991987 994764 993847 993506 990653 996555 994126 992060 995401 997275 995702 995833 993070 990511 991728 996911 991730 991236 ... | 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\nRead problems statements in Mandarin Chinese and Russian. \n\nChef is on a vacation these days, so his frien... | [{"input": "6\n1 1\n2 4\n3 16\n4 16\n4 1\n1 4", "output": "0\n1\n5\n2\n2\n2\n"}, {"input": "6\n2 1\n2 1\n3 8\n14 16\n1 1\n2 4", "output": "1\n1\n4\n7\n0\n1\n"}, {"input": "6\n1 2\n2 4\n5 4\n16 32\n3 2\n1 8", "output": "1\n1\n2\n1\n2\n3\n"}, {"input": "6\n1 2\n4 4\n5 4\n16 32\n3 2\n1 8", "output": "1\n0\n2\n1\n2\n3\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 have two variables a and b. Consider the following sequence of actions performed with these variables: If... | [{"input": "1000000000000000000 1000000000000000000\n", "output": "1000000000000000000 1000000000000000000\n"}, {"input": "1100000000000000000 1000000000000000000\n", "output": "1100000000000000000 1000000000000000000\n"}, {"input": "1100000000000000000 1000000000000010000\n", "output": "1100000000000000000 10000000000... | 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<image>\n\nTo monitor cryptocurrency exchange rates trader William invented a wonderful device consisting of ... | [{"input": "10\n100000 99990\n100000 99997\n100000 99995\n100000 99993\n100000 99990\n100000 99992\n100000 99999\n100000 99992\n100000 99994\n100000 99992\n", "output": "969821134\n814889585\n537223949\n802818035\n969821134\n889337472\n635814936\n889337472\n352113525\n889337472\n"}, {"input": "10\n100000 99991\n100000 ... | 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 problem uses a simplified TCP/IP address model, please make sure you've read the statement attentively.\n... | [{"input": "15 8\n244.1.125.160\n39.50.68.162\n142.253.101.137\n52.239.241.147\n194.4.189.143\n200.238.160.30\n245.78.177.243\n89.249.140.19\n169.51.142.22\n123.246.20.99\n133.44.192.119\n226.240.179.30\n76.209.211.184\n98.15.6.117\n227.219.117.153\n", "output": "-1\n"}, {"input": "15 8\n244.1.125.160\n39.50.68.162\n14... | 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# RoboScript #3 - Implement the RS2 Specification\n\n## Disclaimer\n\nThe story presented in this Kata Series... | [{"input": "\"((F3)10(F2)11)10\"", "output": "[\"*******************************************************************************************************************************************************************************************************************************************************************************... | 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\nPari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is ci. The pr... | [{"input": "15 388\n33 232 106 369 266 135 22 169 367 37 14 181 232 25 257\n", "output": "89\n0 14 22 25 33 36 37 39 47 51 55 58 59 61 62 69 70 72 73 76 80 84 92 94 95 98 106 109 117 131 135 149 157 160 168 169 172 174 181 182 183 186 191 193 194 195 197 202 205 206 207 214 216 219 220 228 231 239 253 257 271 279 282 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\nGiven are N integers A_1,\\ldots,A_N.\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq ... | [{"input": "4\n141421356 17320508 22360679 244949\n", "output": "437235829\n"}, {"input": "4\n141421356 17320508 22360679 176612", "output": "432841470\n"}, {"input": "4\n141421356 17320508 44188846 176612", "output": "442072669\n"}, {"input": "4\n141421356 15438004 10545868 176612", "output": "309796111\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\nJoisino is planning to open a shop in a shopping street.\nEach of the five weekdays is divided into two perio... | [{"input": "3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 0 1 0 1 0\n1 0 1 1 0 0 0 1 0 1\n-8 6 -2 -11 -12 4 14 9 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 9 -9 12 -5 8 0 -9 -7 -7", "output": "33\n"}, {"input": "3\n1 1 1 1 1 1 0 0 0 0\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -16 -15 0 11 7 -6 0 2\n-9 2 0 1 7 -5 0 -2 -7 5 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\nYou are given an array $a$ consisting of $n$ integers. Beauty of array is the maximum sum of some consecutive... | [{"input": "42 0\n286046708 405034560 -729242288 -594215986 -417878652 197367358 -252467864 -633931002 396498018 -511564535 -989028451 133570042 -189524845 -823874429 -29495943 609283144 349227466 -228464789 -326269641 -837429605 310547279 27725681 -167613209 -86658444 900798243 607258117 280296177 -521198948 862072118... | 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 rectangle with sides $A$ and $B$ is cut into rectangles with cuts parallel to its sides. For example, if $p... | [{"input": "2\n2 2 20\n2 10 40\n", "output": "6\n"}, {"input": "2\n2 2 20\n1 10 11\n", "output": "0\n"}, {"input": "2\n2 2 35\n1 10 11\n", "output": "0\n"}, {"input": "2\n2 3 20\n2 4 40\n", "output": "6\n"}, {"input": "2\n2 2 20\n2 4 40\n", "output": "6\n"}, {"input": "2\n2 2 20\n2 7 16\n", "output": "3\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\nConsider a tunnel on a one-way road. During a particular day, $n$ cars numbered from $1$ to $n$ entered and e... | [{"input": "7\n5 2 3 6 7 1 4\n2 3 6 7 1 4 5\n", "output": "6\n"}, {"input": "7\n5 2 3 6 7 1 4\n2 3 6 7 1 4 5\n", "output": "6\n"}, {"input": "5\n3 5 2 1 4\n4 3 2 5 1\n", "output": "2\n"}, {"input": "5\n3 5 2 1 4\n4 3 2 5 1\n", "output": "2\n"}, {"input": "2\n1 2\n1 2\n", "output": "0\n"}, {"input": "2\n1 2\n2 1\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\nThere are n banks in the city where Vasya lives, they are located in a circle, such that any two banks are ne... | [{"input": "50\n108431864 128274949 -554057370 -384620666 -202862975 -803855410 -482167063 -55139054 -215901009 0 0 0 0 0 94325701 730397219 358214459 -673647271 -131397668 -377892440 0 0 0 0 0 -487994257 -360271553 639988328 489338210 -281060728 250208758 0 993242346 -213071841 -59752620 -864351041 -114363541 50627995... | 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 servers in a laboratory, each of them can perform tasks. Each server has a unique id — integer fr... | [{"input": "1 10\n4 1 1\n9 1 1\n10 1 1\n12 1 1\n13 1 1\n15 1 1\n16 1 1\n18 1 1\n19 1 1\n20 1 1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"input": "1 10\n4 1 1\n9 1 1\n10 1 1\n12 1 1\n13 1 1\n15 1 1\n16 1 1\n18 1 1\n19 1 1\n20 1 1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"input": "4 10\n1 1 1\n3 1 2\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\nCengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After get... | [{"input": "10\n669924290 408119795 804030560\n663737793 250734602 29671646\n431160679 146708815 289491233\n189259304 606497663 379372476\n707829111 49504411 81710658\n54555019 65618101 626948607\n578351356 288589794 974275296\n400531973 205638174 323247740\n219131617 178762989 799964854\n825160173 502080627 608216046\... | 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\nBike loves looking for the second maximum element in the sequence. The second maximum element in the sequence... | [{"input": "10\n29272229 8752316 10025994 52398694 16706314 49609605 28150935 102254532 44865054 87041483\n", "output": "129354579\n"}, {"input": "10\n4547989 39261040 185956581 38131456 26174500 1101740 71295827 77784626 155701452 61318416\n", "output": "263691991\n"}, {"input": "10\n4547989 39261040 185956581 3813145... | 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\nHolidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce t... | [{"input": "6\n4 7\n...*...\n..***..\n.****..\n*******\n6 10\n....*.*...\n...*****..\n..*******.\n.********.\n********.*\n**********\n5 5\n*...*\n**.**\n*****\n**.**\n*...*\n5 6\n.*....\n.**...\n.***..\n.****.\n.*****\n3 3\n*.*\n...\n*.*\n2 4\n.**.\n****\n", "output": "24\n89\n19\n22\n4\n8\n"}, {"input": "6\n4 7\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, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a tr... | [{"input": "3\n28\nqaabzwsxedcrfvtgbyhnujmiklop\n13\ncleanairactbd\n10\naannttoonn\n", "output": "\nac\nf\nb\n"}, {"input": "4\n5\noisha\n10\niloveoisha\n16\nshahromloveoisha\n16\noishaloveshahrom\n", "output": "b\nb\nb\nb\n"}, {"input": "4\n5\naisho\n10\niloveoisha\n16\nshahromloveoisha\n16\noishaloveshahrom\n", "outp... | 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\nPolar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev deci... | [{"input": "1000000000000\n", "output": "272165"}, {"input": "225849940487\n", "output": "129343\n"}, {"input": "542905489591\n", "output": "200537\n"}, {"input": "376593918338\n", "output": "167021\n"}, {"input": "249436457427\n", "output": "135929\n"}, {"input": "468135010961\n", "output": "186217\n"}, {"input": "235... | 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 have an initially empty cauldron, and you want to brew a potion in it. The potion consists of two ingredi... | [{"input": "100\n2\n36\n43\n19\n99\n100\n98\n9\n79\n57\n1\n78\n56\n14\n66\n93\n62\n50\n76\n33\n25\n41\n15\n61\n97\n33\n51\n97\n95\n96\n83\n53\n12\n77\n87\n85\n37\n72\n82\n70\n44\n69\n58\n52\n48\n73\n21\n24\n20\n8\n31\n32\n45\n55\n29\n13\n28\n49\n60\n54\n90\n86\n94\n10\n71\n47\n40\n74\n80\n23\n26\n84\n38\n89\n4\n39\n6\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\nLet's arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, ... 9). ... | [{"input": "5\nH4 B9 S4 D2 C3", "output": "D2 C3 H4 S4 B9\nStable\nD2 C3 S4 H4 B9\nNot stable\n"}, {"input": "5\nH4 C9 S4 D2 C2", "output": "D2 C2 H4 S4 C9\nStable\nD2 C2 S4 H4 C9\nNot stable\n"}, {"input": "5\nH4 B9 S4 E2 C3", "output": "E2 C3 H4 S4 B9\nStable\nE2 C3 S4 H4 B9\nNot stable\n"}, {"input": "5\nI4 C9 S4 D2... | 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\nAiz, which is located in cyberspace, trades information with Wakamatsu. The two countries are developing thei... | [{"input": "5\n18\n102\n-181\n53\n9", "output": "0\n"}, {"input": "5\n18\n102\n-155\n53\n9", "output": "3\n"}, {"input": "5\n18\n146\n-181\n53\n9", "output": "0\n"}, {"input": "5\n33\n146\n-181\n53\n9", "output": "0\n"}, {"input": "5\n55\n146\n-181\n53\n9", "output": "0\n"}, {"input": "5\n18\n102\n-155\n53\n32", "outpu... | 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\nNiwango created a playlist of N songs. The title and the duration of the i-th song are s_i and t_i seconds, r... | [{"input": "15\nypnxn 279\njgjfwx 926\nqpuhuwq 327\nrxing 1136\npmuduhznoaqu 912\ndagktgdarveusju 764\nwocppgafnui 200\ndhavrncwfw 725\njpcmigg 658\nwrczqxycivdqn 1232\nmcmkkbnifeod 1503\nhtqvkgkbhtytsz 130\ntwflegsjz 1089\npkhfxzuxrxzwsd 989\nszfwtzfpnscgue 958\npmuduhznoaqu", "output": "8248\n"}, {"input": "15\nypnxn... | 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 first algorithm for detecting a face on the image working in realtime was developed by Paul Viola and Mic... | [{"input": "100 1\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\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\nPetya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, g... | [{"input": "100\n2382 7572 9578 1364 2325 2929 7670 5574 2836 2440 6553 1751 929 8785 6894 9373 9308 7338 6380 9541 9951 6785 13181 9942 5087 7544 6582 7139 8458 7424 9759 8199 9464 8817 7625 6200 4955 9373 9500 3062 849 4210 9337 5466 2190 8150 4971 3145 869 5675 1975 161 1998 378 5229 9000 8958 761 358 434 7636 8295 ... | 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 integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the ... | [{"input": "4", "output": "4\n1 2\n1 3\n2 4\n3 4\n"}, {"input": "4", "output": "4\n1 2\n1 3\n2 4\n3 4\n"}, {"input": "3", "output": "2\n1 3\n2 3"}, {"input": "000", "output": "0\n"}, {"input": "001", "output": "0\n"}, {"input": "001", "output": "0\n"}, {"input": "000", "output": "0\n"}, {"input": "0", "output": "0\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$ students numerated from $1$ to $n$. The level of the $i$-th student is $a_i$. You need to split... | [{"input": "96 15 21\n76 26 108 220 384 4 170 198 568 571 2 193 244 359 78 133 107 340 110 135 565 341 109 572 243 138 357 52 293 344 595 105 569 362 639 134 82 356 27 137 194 291 499 104 28 290 197 477 339 50 288 289 160 54 358 640 343 542 566 79 136 385 3 641 195 355 361 169 196 429 242 162 338 80 77 161 81 337 132 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\nYou have a tree of $n$ vertices. You are going to convert this tree into $n$ rubber bands on infinitely large... | [{"input": "28\n2 24\n2 4\n2 3\n1 2\n1 17\n1 21\n1 22\n10 22\n22 23\n22 26\n25 26\n16 25\n7 26\n5 7\n5 8\n5 15\n5 14\n5 12\n10 20\n11 4\n9 25\n6 9\n12 19\n9 28\n13 14\n18 28\n27 28\n", "output": "13\n"}, {"input": "28\n2 24\n2 4\n2 3\n1 2\n1 17\n1 21\n1 22\n10 22\n22 23\n22 26\n25 26\n16 25\n7 26\n5 7\n5 8\n5 15\n5 14\... | 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 + B is often used as an example of the easiest problem possible to show some contest platform. However, som... | [{"input": "1094 350\n", "output": "1444\n"}, {"input": "1132 485\n", "output": "1617\n"}, {"input": "1062 519\n", "output": "1581\n"}, {"input": "260 1041\n", "output": "1301\n"}, {"input": "1132 306\n", "output": "1438\n"}, {"input": "1267 243\n", "output": "1510\n"}, {"input": "1062 931\n", "output": "1993\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\n_A mad sociopath scientist just came out with a brilliant invention! He extracted his own memories to forget ... | [{"input": "\"Albert Einstein, !Sarah Connor, Marilyn Monroe, Abraham Lincoln, Sarah Connor, Sean Connery, Marilyn Monroe, Bjarne Stroustrup, Manson Marilyn, Monroe Mary\"", "output": "[\"Albert Einstein, Abraham Lincoln, Sean Connery, Bjarne Stroustrup, Manson Marilyn, Monroe Mary\"]", "fn_name": "select"}, {"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\nYou play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on f... | [{"input": "21 21\n.....X...X.........X.\n...X...XX......X.....\n..X........X.X...XX..\n.........X....X...X..\nX...X...........XX...\n...X...X....XX...XXX.\n.X............X......\n......X.X............\n.X...X.........X.X...\n......XX......X.X....\n....X.......X.XXX....\n.X.......X..XXX.X..X.\n..X........X....X...X\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\nLucy loves to travel. Luckily she is a renowned computer scientist and gets to travel to international confer... | [{"input": "[\"Mexico City\", \"Dubai\", \"Philadelphia\", \"Madrid\", \"Houston\", \"Chicago\", \"Delhi\", \"Seoul\", \"Mumbai\", \"Lisbon\", \"Hong Kong\", \"Brisbane\", \"Stockholm\", \"Tokyo\", \"San Francisco\", \"Rio De Janeiro\"]\n[\"Lisbon\", \"Mexico City\"]", "output": "[\"No worthwhile conferences this year!... | 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\nRead problems statements in Mandarin Chinese and Russian. \n\nN one dimensional kingdoms are represented as ... | [{"input": "1\n3\n1 4\n-1 14\n12 12", "output": "2\n"}, {"input": "1\n3\n0 4\n-1 14\n12 12", "output": "2\n"}, {"input": "1\n3\n0 3\n-2 12\n12 19", "output": "2\n"}, {"input": "1\n3\n0 4\n-1 14\n12 22", "output": "2\n"}, {"input": "1\n3\n1 3\n-1 10\n23 13", "output": "2\n"}, {"input": "1\n3\n0 4\n-1 14\n12 16", "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\nYou are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a mirror string.... | [{"input": "qbdp", "output": "Yes\n"}, {"input": "dqpb", "output": "Yes\n"}, {"input": "dpqb", "output": "Yes\n"}, {"input": "bpqd", "output": "Yes\n"}, {"input": "bqpd", "output": "Yes\n"}, {"input": "pbdq", "output": "Yes\n"}, {"input": "qdbp", "output": "Yes\n"}, {"input": "dbqp", "output": "No\n"}, {"input": "bdqp"... | 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 USA Construction Operation (USACO) recently ordered Farmer John to arrange a row of $n$ haybale piles on ... | [{"input": "3\n4 4\n0 0 2 2\n2 1\n100 2\n1 14\n0\n", "output": "2\n101\n0\n"}, {"input": "3\n4 5\n0 0 0 2\n2 2\n110 2\n1 14\n0\n", "output": "1\n112\n0\n"}, {"input": "3\n4 4\n0 0 2 2\n2 1\n100 4\n1 23\n1\n", "output": "2\n101\n1\n"}, {"input": "3\n4 5\n1 0 0 4\n2 1\n110 2\n1 14\n1\n", "output": "2\n111\n1\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\nAmr bought a new video game \"Guess Your Way Out! II\". The goal of the game is to find an exit from the maze... | [{"input": "4 3\n4 10 14 1\n3 7 6 0\n2 3 3 1\n", "output": "Data not sufficient!\n"}, {"input": "4 3\n4 10 26 1\n3 7 6 0\n2 3 3 1\n", "output": "Data not sufficient!\n"}, {"input": "4 3\n4 10 23 1\n3 7 6 0\n2 3 3 1\n", "output": "Data not sufficient!\n"}, {"input": "8 3\n4 10 14 1\n3 7 6 0\n2 3 3 1\n", "output": "Data ... | 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 positive integers A_1, A_2, ..., A_N. Takahashi can perform the following operation on these inte... | [{"input": "8\n657312726 129662684 181537270 131300599 468214806 916875077 825989291 319670097", "output": "11\n"}, {"input": "8\n67210447 129662684 189766490 160785725 468214806 1492516422 483353884 319670097", "output": "15\n"}, {"input": "8\n347554626 129662684 181537270 324043958 468214806 916875077 825989291 31967... | 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 has an integer sequence A of length N.\n\nHe will make three cuts in A and divide it into four (non-emp... | [{"input": "10\n10 102 113 60 6 47 23 25 52 118", "output": "58\n"}, {"input": "10\n10 102 113 60 6 90 16 25 52 118", "output": "61\n"}, {"input": "10\n10 102 113 72 6 90 16 25 52 118", "output": "73\n"}, {"input": "10\n10 102 113 72 6 90 16 25 89 118", "output": "95\n"}, {"input": "10\n19 183 113 60 6 194 16 6 52 118"... | 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 has an array a_1, a_2, ..., a_n.\n\nYou don't know this array, but he told you m facts about this array... | [{"input": "1001 2\n1 999 1000\n0 230 581\n", "output": "YES\n1001 1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 ... | 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 April 2008, Aizuwakamatsu City succeeded in making yakitori with a length of 20 m 85 cm. The chicken used ... | [{"input": "17 5128 240 126 32\n20 4907 303 151 7\n60 73980 2086 337 15\n3 3216 562 010 6\n40 8478 221 53 307\n23 27966 5 92 13\n50 107893 4497 65 20\n199 88677 2825 226 8\n0", "output": "21 0\n7 18\n15 126\n5 40\n37 5\n13 303\n20 276\n8 292\n"}, {"input": "49 5128 240 252 32\n20 4907 303 151 7\n60 73980 2086 337 15\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\nThis problem is same as the previous one, but has larger constraints.\n\nShiro's just moved to the new house.... | [{"input": "10\n30518 30518 30518 30518 30518 30518 30518 30518 30518 30518\n", "output": "10\n"}, {"input": "10\n30518 30518 30518 30518 30518 30518 30518 30518 30518 30518\n", "output": "10"}, {"input": "10\n30518 96518 74071 59971 50121 4862 43967 73607 19138 90754\n", "output": "10\n"}, {"input": "10\n30518 96518 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\nYour task is to create function```isDivideBy``` (or ```is_divide_by```) to check if an integer number is divi... | [{"input": "-100\n-25\n10", "output": "[true]", "fn_name": "is_divide_by"}, {"input": "10000\n5\n-3", "output": "[false]", "fn_name": "is_divide_by"}, {"input": "-96\n25\n17", "output": "[false]", "fn_name": "is_divide_by"}, {"input": "48\n2\n-5", "output": "[false]", "fn_name": "is_divide_by"}, {"input": "12\n-3\n4", ... | 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\nVova is playing a computer game. There are in total $n$ turns in the game and Vova really wants to play all o... | [{"input": "20\n1000000001 510000100 2 1\n1000000000 500000000 2 1\n1000000000 500000000 2 1\n1000000000 500000000 2 1\n1000000000 500000000 2 1\n1000000000 684100035 2 1\n1000000100 500000000 2 1\n1000000000 690764083 2 1\n1000000000 500000000 2 1\n1000000000 167868648 2 1\n1000000001 999999995 2 1\n1000000000 2618165... | 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 is seeing a quick report of election results on TV.\nTwo candidates are standing for the el... | [{"input": "5\n3 10\n48 17\n31 199\n231 23\n3 2\n", "output": "6930\n"}, {"input": "5\n3 10\n48 28\n31 199\n300 23\n3 4", "output": "12600\n"}, {"input": "5\n3 11\n87 28\n31 199\n300 23\n3 2", "output": "13000\n"}, {"input": "5\n3 11\n33 28\n31 269\n300 23\n3 2", "output": "12000\n"}, {"input": "5\n1 10\n48 28\n31 199\... | 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\nWelcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Co... | [{"input": "29 30 989\n450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 434\n451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451\n", "output": "1023\n"}, {"input": "29 30 989\n450 450 450 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\nArya has n opponents in the school. Each day he will fight with all opponents who are present this day. His o... | [{"input": "1 100\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\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\nYou are given a sequence of positive integers a_1, a_2, ..., a_{n}. \n\nWhile possible, you perform the follo... | [{"input": "4\n1101111010 1000000000 1000010000 1001001010\n", "output": "4\n1101111010 1000000000 1000010000 1001001010\n"}, {"input": "4\n1101111010 1000000000 1100010000 1001001010\n", "output": "4\n1101111010 1000000000 1100010000 1001001010\n"}, {"input": "4\n1101111010 1000000000 1100000000 1001001010\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\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n - If both 3 and 5 divides i, a_i=\\mbox{FizzBuz... | [{"input": "1000000\n", "output": "266666333332\n"}, {"input": "999997\n", "output": "266665333334\n"}, {"input": "870108\n", "output": "201890463153\n"}, {"input": "1100000", "output": "322667033332\n"}, {"input": "1110000", "output": "328560000000\n"}, {"input": "1110010", "output": "328565550022\n"}, {"input": "1111... | 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\nLittle Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 10... | [{"input": "25\n1 1 1 2 2 2 1 2 1 2 2 2 2 2 1 2 2 2 1 2 2 2 2 1 2\n", "output": "1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n"}, {"input": "25\n1 1 1 2 2 2 1 2 1 2 4 2 2 2 1 2 2 2 1 2 2 2 2 1 2\n", "output": "1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n"}, {"input": "25\n2 1 1 2 2 2 1 2 1 2 2 2 2 2 1 2 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\nOne of the first algorithm used for approximating the integer square root of a positive integer `n` is known ... | [{"input": "9094947017729282379150390625\n1", "output": "[52]", "fn_name": "int_rac"}, {"input": "125348981764\n356243", "output": "[3]", "fn_name": "int_rac"}, {"input": "835871232077058\n1", "output": "[30]", "fn_name": "int_rac"}, {"input": "246391990316004\n1", "output": "[29]", "fn_name": "int_rac"}, {"input": "40... | 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\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n - I... | [{"input": "100000\n", "output": "3234566667\n"}, {"input": "94598\n", "output": "2345654334\n"}, {"input": "91278\n", "output": "2332345676\n"}, {"input": "97979\n", "output": "3223456555\n"}, {"input": "94981\n", "output": "3210111111\n"}, {"input": "96910\n", "output": "3222212323\n"}, {"input": "32454\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\nWrite a program which reads a $n \\times m$ matrix $A$ and a $m \\times l$ matrix $B$, and prints their produ... | [{"input": "4 0 13\n1 1\n2 4\n4 15\n-1 0 2\n1 5 2", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"input": "4 0 12\n1 1\n-1 2\n4 1\n1 0 -1\n1 12 5", "output": "0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 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\nThere is a set of cards with positive integers written on them. Stack the cards to make several piles and arr... | [{"input": "3\n2 21\n0 48\n-1 12", "output": "-1152\n"}, {"input": "3\n4 21\n0 48\n-1 12", "output": "-2304\n"}, {"input": "3\n4 21\n0 28\n-1 12", "output": "-1344\n"}, {"input": "3\n6 93\n1 -14\n1 -1", "output": "-7728\n"}, {"input": "3\n2 4\n-1 -12\n27 2", "output": "-1200\n"}, {"input": "3\n2 4\n-1 -12\n27 4", "outp... | 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 islands lining up from west to east, connected by N-1 bridges.\nThe i-th bridge connects the i-th... | [{"input": "21189 4345\n10171 15645\n10849 16732\n6014 18169\n3995 20232\n1557 8296\n2238 15717\n10071 12875\n2148 13213\n14696 19948\n2063 14524\n7571 10285\n2102 14395\n12673 13427\n15751 16347\n317 13928\n9825 17447\n7990 9393\n8479 14766\n6185 6858\n2781 11064\n14909 16382\n8468 9916\n7189 12428\n16941 18034\n8365 ... | 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-----Input-----\n\nThe input contains a single integer a (1 ≤ a ≤ 64).\n\n\n-----Output-----\n\nOutput a sing... | [{"input": "64\n", "output": "267\n"}, {"input": "16\n", "output": "14\n"}, {"input": "24\n", "output": "15\n"}, {"input": "32\n", "output": "51\n"}, {"input": "36\n", "output": "14\n"}, {"input": "40\n", "output": "14\n"}, {"input": "48\n", "output": "52\n"}, {"input": "54\n", "output": "15\n"}, {"input": "56\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\nWell, those numbers were right and we're going to feed their ego.\n\nWrite a function, isNarcissistic, that t... | [{"input": "0\n1\n2\n3\n4\n5\n6\n7\n22\n9", "output": "[false]", "fn_name": "is_narcissistic"}, {"input": "0\n1\n2\n3\n4\n5\n6\n7\n8\n9", "output": "[true]", "fn_name": "is_narcissistic"}, {"input": "\"4\"\n7\n\"9\"", "output": "[true]", "fn_name": "is_narcissistic"}, {"input": "5\n\"\"\n407", "output": "[false]", "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\nGrandma Capa has decided to knit a scarf and asked Grandpa Sher to make a pattern for it, a pattern is a stri... | [{"input": "5\n8\nabbaacab\n6\nxyzwyz\n4\nabba\n8\nspaqrlap\n10\nykhyhhyyhl\n", "output": "-1\n-1\n0\n-1\n-1\n"}, {"input": "5\n8\nabcaacbb\n6\nxyzxyz\n4\nabca\n8\nrpqarlap\n10\nykhxhhyyhk\n", "output": "-1\n-1\n1\n-1\n-1\n"}, {"input": "5\n8\nabbaacab\n6\nxyzwyz\n4\nbcaa\n8\nrpqarlap\n10\nykhyhhyyhk\n", "output": "-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\nPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representat... | [{"input": "1000000000 1000000000\n", "output": "1022\n"}, {"input": "1000010000 1000000000\n", "output": "1022\n"}, {"input": "77777779 1000000000\n", "output": "508\n"}, {"input": "444747744 1000000000\n", "output": "554"}, {"input": "77777779 1000000001\n", "output": "508\n"}, {"input": "854459 95554455\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\nLate last night in the Tanner household, ALF was repairing his spaceship so he might get back to Melmac. Unfo... | [{"input": "\"..........\\n..........\\n.......X..\\n..........\\n..........\"", "output": "[[7, 2]]", "fn_name": "find_spaceship"}, {"input": "\"..........\\n..........\\n..........\\n........X.\\n..........\"", "output": "[[8, 1]]", "fn_name": "find_spaceship"}, {"input": "\"........................\"", "output": "[\... | 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# Task\n\nChristmas is coming. In the [previous kata](https://www.codewars.com/kata/5a405ba4e1ce0e1d7800012e)... | [{"input": "\"dbdbebedbddbedededeeddbbdeddbeddeebdeddeebbbb\"", "output": "[\"deededebddeebeddeddeddbddeddeddebeeddbededeed\"]", "fn_name": "center_of"}, {"input": "\"vttussvutvuvvtustsvsvtvu\"", "output": "[\"vsvvtvvtvvsv\"]", "fn_name": "center_of"}, {"input": "\"aaaaaaaaaaaaaa\"", "output": "[\"a\"]", "fn_name": "ce... | 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\nA burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there... | [{"input": "200000000 20\n983125 2\n7453215 9\n9193588 2\n11558049 7\n28666199 1\n34362244 1\n5241493 5\n15451270 4\n19945845 8\n6208681 3\n38300385 7\n6441209 8\n21046742 7\n577198 10\n3826434 8\n9764276 8\n6264675 7\n8567063 3\n3610303 4\n2908232 3\n", "output": "1131379312\n"}, {"input": "200000000 20\n983125 2\n745... | 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 became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences,... | [{"input": "318\nTATCAATCGGTACGTGCGCATCATTGTCAATCGGGCTTCATGGCTTGCGGGCGCTACCCGAGGGGAAGCTGCGGACAGGTAGGTAAGATACACACGAACCAAACGGAGTTATGTTGGATAAATTGGCTGGAAGGGCGTAGGTATATCGAGTCGCGGACCTGGCATAGACTATCAGGGGCAGCGGTACAAGGCAACCGTGAGCGGGGTCTGCCCACCATTAGACCGATGCGCCGGCTCGTATATGTGATTCTGGTGAAAAGTATCATGCCGGGACGCGTAATGACCCGGCTGGCTAATCCACCG... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.