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\nIbis is fighting with a monster.\nThe health of the monster is H.\nIbis can cast N kinds of spells. Casting t... | [{"input": "1832 947\n4182 1443\n3979 4739\n5500 1039\n9994 9474\n7064 5254\n3587 2902\n6074 3873\n3865 9760\n8970 4251\n6222 8535\n9192 643\n5820 6677\n9711 4431\n9112 6134\n8614 2404\n9041 3356\n7574 5999\n9710 6045\n2463 3743\n7637 6723\n7802 9816\n5829 2411\n8800 3617\n9653 7\n6034 1399\n5178 9084\n7630 9624\n2005 ... | 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# Making Change\n\nComplete the method that will determine the minimum number of coins needed to make change ... | [{"input": "91", "output": "[{\"H\": 1, \"Q\": 1, \"D\": 1, \"N\": 1, \"P\": 1}]", "fn_name": "make_change"}, {"input": "239", "output": "[{\"H\": 4, \"Q\": 1, \"D\": 1, \"P\": 4}]", "fn_name": "make_change"}, {"input": "43", "output": "[{\"Q\": 1, \"D\": 1, \"N\": 1, \"P\": 3}]", "fn_name": "make_change"}, {"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\nWrite a program which reverses a given string str.\n\n\n\nInput\n\nstr (the size of str ≤ 20) is given in a l... | [{"input": "w32njmda", "output": "admjn23w\n"}, {"input": "admjn23w", "output": "w32njmda\n"}, {"input": "acmjn23w", "output": "w32njmca\n"}, {"input": "3cmjn2aw", "output": "wa2njmc3\n"}, {"input": "3dmjn2aw", "output": "wa2njmd3\n"}, {"input": "wa2njmd3", "output": "3dmjn2aw\n"}, {"input": "xa2njmd3", "output": "3dmj... | 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\nJoe has been hurt on the Internet. Now he is storming around the house, destroying everything in his path.\n\... | [{"input": "20 20\n..+#+.+++.+++#+..#++\n..####+++#..++#+.+.+\n+.+..+++..#.++++++++\n+##++..+.##..#+++.++\n++.+.+.+.++++.+++.++\n.+++++.+#+++++...+#+\n.++.#+++++++++.++.++\n...+.++++++.++#...++\n+++.+++.+....#....+.\n.++++++.+.+..++.++##\n.+..+..++#.+..++++++\n+..#+++++..+##+#++.+\n+.+#+#....+.#+++#+.+\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 + 2$ towns located on a coordinate line, numbered from $0$ to $n + 1$. The $i$-th town is locate... | [{"input": "200000\n", "output": "\n202370013\n"}, {"input": "200000\n", "output": "202370013\n"}, {"input": "199999\n", "output": "503231359\n"}, {"input": "199998\n", "output": "801261687\n"}, {"input": "199998\n", "output": "801261687\n"}, {"input": "199999\n", "output": "503231359\n"}, {"input": "103835\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\nIntroduction\n\nIt's been more than 20 minutes since the negligent waiter has taken your order for the house ... | [{"input": "1735", "output": "[1398915]", "fn_name": "toothpick"}, {"input": "1757", "output": "[1443119]", "fn_name": "toothpick"}, {"input": "1974", "output": "[2038207]", "fn_name": "toothpick"}, {"input": "2048", "output": "[2796203]", "fn_name": "toothpick"}, {"input": "1038", "output": "[699451]", "fn_name": "too... | 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 sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows:\n - The first term s is given as input.\n - L... | [{"input": "54\n", "output": "114\n"}, {"input": "100\n", "output": "27\n"}, {"input": "97\n", "output": "120\n"}, {"input": "95\n", "output": "107\n"}, {"input": "27\n", "output": "113\n"}, {"input": "108", "output": "115\n"}, {"input": "107", "output": "102\n"}, {"input": "161", "output": "100\n"}, {"input": "220", "... | 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 the beginning of the new semester there is new schedule in the Berland State University. According to this... | [{"input": "16\n203671 381501\n58867 59732\n817520 962123\n125391 163027\n601766 617692\n381501 444610\n761937 817520\n16 10551\n21096 38291\n718073 761937\n583868 601766\n554859 731755\n678098 718073\n962123 992003\n163027 203671\n87917 96397\n", "output": "1\n12 "}, {"input": "11\n717170 795210\n866429 970764\n163324... | 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 two strings x and y, both consist only of lowercase Latin letters. Let |s| be the length of str... | [{"input": "justamassivetesttocheck\nhowwellyouhandlemodulooperations\n", "output": "\n667387032\n"}, {"input": "justamassivetestsocheck\nhowwellyouhandlemodulooperations\n", "output": "732028571\n"}, {"input": "kcehcostsetevissamatsuj\nhowwellyouhandlemodulooperations\n", "output": "957292014\n"}, {"input": "kcehcosts... | 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 Association broadcasts a handicraft program f... | [{"input": "0 1 1 4 11 16 3 2 0 0 5 13", "output": "no\n"}, {"input": "0 1 1 4 11 16 6 2 0 0 5 13", "output": "no\n"}, {"input": "0 1 1 4 11 16 6 2 1 0 5 13", "output": "no\n"}, {"input": "0 1 1 4 2 20 6 2 2 0 13 13", "output": "no\n"}, {"input": "0 1 1 4 2 20 6 2 3 0 13 13", "output": "no\n"}, {"input": "0 1 1 4 2 20 ... | 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# Definition \n\nA number is a **_Special Number_** *if it’s digits only consist 0, 1, 2, 3, 4 or 5*\n\n**_Gi... | [{"input": "11350224", "output": "[\"Special!!\"]", "fn_name": "special_number"}, {"input": "23", "output": "[\"Special!!\"]", "fn_name": "special_number"}, {"input": "32", "output": "[\"Special!!\"]", "fn_name": "special_number"}, {"input": "55", "output": "[\"Special!!\"]", "fn_name": "special_number"}, {"input": "2"... | 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\nThere is a n × n grid D where each cell contains either 1 or 0.\n\nYour task is to create a program that take... | [{"input": "5\n00011\n00101\n01000\n10101\n00010\n8\n11000001\n10110111\n01100111\n01111010\n11111111\n01001010\n10100010\n10000001\n2\n01\n00\n3\n000\n000\n000\n0", "output": "4\n8\n1\n0\n"}, {"input": "5\n00011\n00101\n01000\n10101\n00010\n8\n11000001\n10110111\n01100111\n01111010\n11111111\n01001010\n10100010\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\nYou are given an array $a$ consisting of $n$ positive integers.\n\nInitially, you have an integer $x = 0$. Du... | [{"input": "5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 1 10 8 9\n5 13\n20 100 74 20 100500\n10 25\n24 39 19 24 24 87 24 24 24 10\n8 8\n1 2 3 4 5 7 7 12\n", "output": "6\n24\n20\n127\n13\n"}, {"input": "5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 0 10 8 9\n5 13\n20 100 50 20 100500\n10 25\n24 24 19 24 24 40 24 24 24 10\n8 8\n1 2 3 4 5 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\nA queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizon... | [{"input": "10 20\n6 10\n3 10\n10 4\n5 3\n9 4\n10 1\n10 3\n10 7\n8 5\n7 2\n4 7\n5 1\n2 9\n5 5\n6 6\n9 8\n2 10\n9 10\n1 4\n7 4\n", "output": "0 0 4 9 4 1 2 0 0\n"}, {"input": "100 10\n97 5\n53 35\n92 86\n54 95\n98 13\n36 23\n55 56\n96 94\n25 96\n49 31\n", "output": "6 4 0 0 0 0 0 0 0\n"}, {"input": "100 10\n97 5\n53 35\... | 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\nWhen new students come to the Specialized Educational and Scientific Centre (SESC) they need to start many th... | [{"input": "|||||||||||||||||||||||||||||||||||||||||||||||||||+|||||||||||||||||||||||||||||||||||||||||||||||||||=||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\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\nPrint all the integers that satisfies the following in ascending order:\n - Among the integers between A and ... | [{"input": "0 32 110", "output": "0\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\n"}, {"input": "8 35 011", "output": "8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n"}, {"input": "8 39 011", "output": "8\n9... | 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 of length n. We define f_{a} the following way:\n\n Initially f_{a} = 0, M = 1; fo... | [{"input": "9\n347223417 807654168 573530036 826123287 366028010 257025851 15406743 784063803 132844347\n", "output": "932879531\n"}, {"input": "9\n347223417 807654168 573530036 826123287 366028010 257025851 15406743 784063803 138878790\n", "output": "655212093\n"}, {"input": "9\n347223417 807654168 573530036 826123287... | 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 line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whos... | [{"input": "-1548994394 -1586527767 -1203252104\n", "output": "-878123061596147680 857348814150663048\n"}, {"input": "1999999993 1999999991 -1999999997\n", "output": "-1999999987000000015 1999999989000000012\n"}, {"input": "-1516373701 -584304312 -746376800\n", "output": "202167007852295200 -524659372900676000\n"}, {"i... | 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 three integers k, p_{a} and p_{b}.\n\nYou will construct a sequence with the following algorith... | [{"input": "1000 123456 654321\n", "output": "977760856\n"}, {"input": "1000 123456 654321\n", "output": "977760856\n"}, {"input": "305 337309 378395\n", "output": "174667130\n"}, {"input": "108 531040 908573\n", "output": "145579983\n"}, {"input": "781 817338 452871\n", "output": "711597307\n"}, {"input": "270 967166 ... | 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 an embassy of a well-known kingdom an electronic queue is organised. Every person who comes to the embassy... | [{"input": "2 7 1\n10 3 10\n100\n3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 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\nA holiday weekend is coming up,\nand Hotel Bytelandia needs to find out if it has enough rooms to accommodate... | [{"input": "3\n3\n1 2 3\n4 5 7\n5\n1 2 3 4 1\n2 4 4 5 6\n7\n13 6 5 8 2 10 12\n19 18 6 16 9 11 15", "output": "3\n3\n4\n"}, {"input": "3\n3\n1 2 3\n4 5 7\n5\n1 2 3 4 1\n2 4 4 5 6\n7\n13 6 5 8 1 10 12\n19 18 6 16 9 11 15", "output": "3\n3\n4\n"}, {"input": "3\n3\n1 2 3\n4 5 7\n5\n1 2 3 4 1\n3 4 4 5 6\n7\n13 6 5 8 1 10 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 Holmes children are fighting over who amongst them is the cleverest.\n\nMycroft asked Sherlock and Eurus ... | [{"input": "1000000000000 1000000000000\n", "output": "1"}, {"input": "1000000000000 1000000000000\n", "output": "1"}, {"input": "331725641503 465583326659\n", "output": "1\n"}, {"input": "594243639083 188040404706\n", "output": "1\n"}, {"input": "892726102335 265691489675\n", "output": "1\n"}, {"input": "483154390901 ... | 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 Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $p$ of length $n$, and Skynyrd b... | [{"input": "3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5\n", "output": "110\n"}, {"input": "3 6 3\n2 1 3\n1 1 3 1 2 3\n1 5\n2 6\n3 5\n", "output": "110\n"}, {"input": "3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n3 6\n3 5\n", "output": "100\n"}, {"input": "3 6 3\n2 1 3\n1 1 3 1 3 3\n1 5\n2 6\n3 5\n", "output": "000\n"}, {"input": "3 6 ... | 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 kata is part of the collection [Mary's Puzzle Books](https://www.codewars.com/collections/marys-puzzle-b... | [{"input": "\"abcdefghijklmnopqrstuvwxyz\"\n\"zyxwvutsrqponmlkjihgfedcba\"", "output": "[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]]", "fn_name": "spot_diff"}, {"input": "\"Congratulations! You did it!\"\n\"Conglaturations! U did this!\"", "output": "[[4, 8, 17, 18, 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\nHeidi and Doctor Who hopped out of the TARDIS and found themselves at EPFL in 2018. They were surrounded by s... | [{"input": "1 2\n1156621358\n561572949 6885\n312543334 3629\n", "output": "10514\n"}, {"input": "1 2\n458828651\n209599643 7592\n208642144 8751\n", "output": "16343\n"}, {"input": "1 2\n754725914\n561572949 6885\n312543334 3629\n", "output": "10514\n"}, {"input": "1 2\n458828651\n209599643 7611\n208642144 8751\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\n# Summation Of Primes\n\nThe sum of the primes below or equal to 10 is **2 + 3 + 5 + 7 = 17**. Find the sum o... | [{"input": "25000", "output": "[32405717]", "fn_name": "summationOfPrimes"}, {"input": "4000", "output": "[1013507]", "fn_name": "summationOfPrimes"}, {"input": "5000", "output": "[1548136]", "fn_name": "summationOfPrimes"}, {"input": "2000", "output": "[277050]", "fn_name": "summationOfPrimes"}, {"input": "3000", "out... | 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\nWrite a program which judges wheather given length of three side form a right triangle. Print \"YES\" if the ... | [{"input": "3\n-1 -2 0\n0 1 -1\n-2 0 2", "output": "NO\nYES\nYES\n"}, {"input": "3\n-1 -2 -1\n0 1 0\n-2 0 2", "output": "NO\nNO\nYES\n"}, {"input": "3\n1 1 0\n29 1 -1\n0 1 -1", "output": "YES\nNO\nYES\n"}, {"input": "3\n2 2 -2\n-1 5 -1\n3 15 -1", "output": "NO\nNO\nNO\n"}, {"input": "3\n2 2 -2\n-1 5 -1\n3 11 -1", "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\n# Task\n Mr.Nam has `n` candies, he wants to put one candy in each cell of a table-box. The table-box has `r`... | [{"input": "15\n3\n3\n18", "output": "[[-1, -1, -1]]", "fn_name": "get_candy_position"}, {"input": "6\n2\n2\n7", "output": "[[-1, -1, -1]]", "fn_name": "get_candy_position"}, {"input": "15\n3\n3\n14", "output": "[[2, 1, 1]]", "fn_name": "get_candy_position"}, {"input": "15\n3\n3\n1", "output": "[[1, 2, 2]]", "fn_name":... | 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\nLet's call a positive integer extremely round if it has only one non-zero digit. For example, $5000$, $4$, $1... | [{"input": "5\n9\n42\n13\n100\n111\n", "output": "9\n13\n10\n19\n19\n"}, {"input": "1\n707951\n", "output": "52\n"}, {"input": "1\n99889\n", "output": "45\n"}, {"input": "1\n9123\n", "output": "36\n"}, {"input": "1\n9999\n", "output": "36\n"}, {"input": "1\n9998\n", "output": "36\n"}, {"input": "1\n9997\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\nSeen from above, there is a grid-like square shaped like Figure 1. The presence or absence of \"walls\" on ea... | [{"input": "1111\n00001\n0110\n11111\n1010\n00011\n1010\n01011\n1111", "output": "RRRRDDDDLLLLRULRDRRULRULULDLUDRURRDDDRUUUULLLL\n"}, {"input": "1111\n01001\n0010\n11101\n1110\n00111\n1110\n10001\n1110", "output": "RRRRDDDDUUUULLLDDRURLDRDLLLDRRRLLLURRULLUDRUUL\n"}, {"input": "1111\n00010\n1001\n10110\n1111\n00100\n011... | 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\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch th... | [{"input": "11 -1\n-1 -1\n9", "output": "NO\n"}, {"input": "14 -1\n-1 -1\n9", "output": "NO\n"}, {"input": "2 -1\n-1 -2\n5", "output": "YES\n"}, {"input": "3 -1\n-1 -2\n5", "output": "YES\n"}, {"input": "3 -1\n-2 -2\n5", "output": "YES\n"}, {"input": "1 1\n-1 12\n19", "output": "NO\n"}, {"input": "1 0\n-1 12\n19", "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\nAfter a long party Petya decided to return home, but he turned out to be at the opposite end of the town from... | [{"input": "5\n3 1 1\nBC\n1 0 0\nAB\n4 1 11\nAABBBBAABB\n1 3 1\nBBBBB\n6 1 1\nABABAB\n", "output": "1\n2\n1\n5\n6\n"}, {"input": "5\n2 1 1\nBB\n1 1 1\nAB\n3 2 0\nAABBBBAABB\n5 3 4\nBBBBB\n2 1 1\nABABAB\n", "output": "1\n1\n10\n1\n6\n"}, {"input": "5\n3 1 1\nBC\n1 0 1\nAB\n4 1 11\nAABBBBAABB\n1 3 1\nBBBBB\n6 1 1\nABABAB... | 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\nHighway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially ... | [{"input": "3\n3\n1 2 3\n4\n0 1 1 0\n10\n10 3 1 11 5 2 1 7 19 4\n", "output": "0\n4\n21\n"}, {"input": "3\n3\n1 2 3\n4\n0 1 1 0\n10\n10 3 1 11 5 2 1 7 10 4\n", "output": "0\n4\n24\n"}, {"input": "3\n3\n1 1 3\n4\n1 1 1 0\n10\n16 3 6 11 0 2 1 3 10 4\n", "output": "2\n3\n24\n"}, {"input": "3\n3\n1 1 3\n4\n1 1 1 0\n10\n16 ... | 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 very much. Everybody knows that lucky numbers are positive integers whose decimal r... | [{"input": "44447774444474477747774774477777474774744744477444447777477477744747477774744444744777777777747777477447744774744444747477744744\n77777474477477747774777777474474477444474777477747747777477747747744474474747774747747444777474444744744444477477777747744747477\n", "output": "37\n"}, {"input": "774774747744474... | 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\nCreate a program that inputs the test result data of the visual acuity test and outputs the number of people ... | [{"input": "1.4450818768746183 1.8412288178078728\n2.6983178051647414 1.5471720124202895\n2.573217216239934 0.8500864926517523\n4.9346769267643475 2.1903643288076555", "output": "4 3\n0 1\n0 0\n0 0\n"}, {"input": "1.4450818768746183 2.8044369815893004\n2.6983178051647414 1.5471720124202895\n2.573217216239934 0.85008649... | 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 Little Elephant loves numbers. \n\nHe has a positive integer x. The Little Elephant wants to find the num... | [{"input": "1010000000\n", "output": "117\n"}, {"input": "1011000000\n", "output": "171\n"}, {"input": "654885000\n", "output": "698\n"}, {"input": "1000000000\n", "output": "91\n"}, {"input": "101871000\n", "output": "460\n"}, {"input": "211768200\n", "output": "244\n"}, {"input": "901800900\n", "output": "639\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\nRecently, you found a bot to play \"Rock paper scissors\" with. Unfortunately, the bot uses quite a simple al... | [{"input": "3\nRRRR\nRSP\nS\n", "output": "PPPP\nPPP\nR\n"}, {"input": "3\nRRRR\nRSP\nS\n", "output": "PPPP\nPPP\nR\n"}, {"input": "3\nRRRR\nSSP\nS\n", "output": "PPPP\nRRR\nR\n"}, {"input": "3\nQRRR\nRSP\nS\n", "output": "PPPP\nPPP\nR\n"}, {"input": "3\nRRRR\nSSP\nR\n", "output": "PPPP\nRRR\nP\n"}, {"input": "3\nQRRR\... | 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 consisting of $n$ integers $a_1, a_2, \\dots, a_n$, and a positive integer $m$. It is ... | [{"input": "100 25\n6745 2075 7499 7517 1776 5164 2335 2745 4465 1457 7565 2232 2486 9025 8059 9646 8017 7662 9690 3352 2306 366 7422 1073 7169 8966 4506 8225 5614 8628 2908 7452 9625 9332 7097 353 1043 8118 5794 4486 626 971 6731 6618 887 6354 4814 7307 7681 6160 9351 2579 411 3436 5570 2812 2726 4433 3220 577 5891 38... | 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 in Divanovo, a huge river locks system was built. There are now $n$ locks, the $i$-th of them has th... | [{"input": "50\n3 60 52 60 60 84 63 40 50 21 39 59 40 15 59 54 5 84 63 23 11 69 27 65 64 8 39 4 89 19 10 45 51 66 69 60 82 25 82 66 86 35 24 64 43 67 35 25 39 82\n50\n57\n46\n44\n70\n74\n98\n36\n48\n76\n52\n86\n40\n28\n56\n73\n64\n78\n21\n37\n54\n33\n93\n16\n18\n66\n75\n62\n77\n81\n96\n31\n41\n68\n24\n80\n67\n50\n72\n9... | 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 monsters, numbered 1, 2, ..., N.\nInitially, the health of Monster i is A_i.\nBelow, a monster wi... | [{"input": "3\n1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"input": "3\n1000000000 1000000000 1000000000", "output": "1000000000"}, {"input": "3\n1000000100 1000000000 1000000000", "output": "100\n"}, {"input": "3\n1000000100 1000100000 1000000000", "output": "100\n"}, {"input": "3\n1100000100 0100... | 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\nPak Chanek plans to build a garage. He wants the garage to consist of a square and a right triangle that are ... | [{"input": "1000000000\n", "output": "1333333336\n"}, {"input": "999999999\n", "output": "1333333335\n"}, {"input": "999999998\n", "output": "1333333333\n"}, {"input": "999999997\n", "output": "1333333332\n"}, {"input": "767928734\n", "output": "1023904981\n"}, {"input": "999993999\n", "output": "1333325335\n"}, {"inpu... | 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\n\nThere are $ N $ islands numbered from $ 1 $ to $ N $.\nEach island has $ N-1 $ bridges, allowing a... | [{"input": "4 10 1 4\n1 2 45\n2 3 68\n3 4 121", "output": "Yes\n"}, {"input": "4 10 1 4\n1 2 52\n1 3 134\n3 4 17", "output": "Yes\n"}, {"input": "4 10 1 4\n1 2 45\n2 3 68\n3 4 113", "output": "Yes\n"}, {"input": "4 16 1 4\n1 2 45\n2 3 68\n3 4 121", "output": "Yes\n"}, {"input": "4 10 1 4\n1 2 20\n2 3 68\n3 4 113", "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\nVasya's birthday is approaching and Lena decided to sew a patterned handkerchief to him as a present. Lena ch... | [{"input": "9\n", "output": " 0\n 0 1 0\n 0 1 2 1 0\n 0 1 2 3 2 1 0\n 0 1 2 3 4 3 2 1 0\n 0 1 2 3 4 5 4 3 2 1 0\n 0 1 2 3 4 5 6 5 4 3 2 1 0\n 0 1 2 3 4 5 6 7 6 5 4 3 2 1 0\n 0 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1 0\n0 1 2 3 4 5 6 7 8 9 8 7 6 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\nThe Super Duper Secret Meeting of the Super Duper Secret Military Squad takes place in a Super Duper Secret P... | [{"input": "-565 -444 -419 -421\n30\n363 -249 790\n704 57 999\n-316 -305 119\n-778 -543 373\n-589 466 190\n516 -174 893\n-742 -662 390\n-382 825 1000\n520 -732 909\n-220 -985 555\n-49 -697 396\n-701 -882 520\n-105 227 691\n-113 -470 231\n-503 98 1088\n236 69 759\n150 393 951\n414 381 1000\n1096 3 999\n-357 485 905\n432... | 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 m = n·k wooden staves. The i-th stave has length a_{i}. You have to assemble n barrels consisting of... | [{"input": "10 3 726\n277 706 1241 812 692 1291 196 507 911 111 498 704 573 381 463 1095 704 36 443 640 326 405 47 834 962 521 1296 740 520 622\n", "output": "5072\n"}, {"input": "10 3 726\n277 706 1241 812 692 1291 196 507 911 111 498 704 573 381 463 1095 704 36 693 640 326 405 47 834 962 521 1296 740 520 622\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\nPeople in the Tomskaya region like magic formulas very much. You can see some of them below.\n\nImagine you a... | [{"input": "25\n39226529 640445129 936289624 364461191 1096077769 573427707 1919403410 950067229 1217479531 455229458 1574949468 397268319 1267289585 995220637 1920919164 501015483 1815262670 1197059269 86947741 1137410885 667368575 733666398 1536581408 611239452 947487746\n", "output": "259654661\n"}, {"input": "25\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 are given two very long integers a, b (leading zeroes are allowed). You should check what number a or b i... | [{"input": "00011111111111111111111111111111111111000000000000000000000000000000000000000000000000000210000000000000000000000000000000000000000011000\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112091\n", "output": "<\n"}, {"input": "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\nToday, Wet Shark is given n bishops on a 1000 by 1000 grid. Both rows and columns of the grid are numbered fr... | [{"input": "10\n646 171\n816 449\n375 934\n950 299\n702 232\n657 81\n885 306\n660 304\n369 371\n798 657\n", "output": "0\n"}, {"input": "10\n646 171\n816 449\n375 934\n950 299\n702 232\n657 81\n885 306\n660 304\n369 371\n798 657\n", "output": "0\n"}, {"input": "10\n646 171\n816 449\n375 934\n950 299\n702 232\n657 81\n8... | 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 recently found out what a digital root of a number is and he decided to share his knowledge with yo... | [{"input": "4898 3\n", "output": "3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000... | 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$ of $n$ integers. You are asked to find out if the inequality $$\\max(a_i, a_{i + 1... | [{"input": "5\n19\n1 1 -1 -1 -1 0 -1 -1 1 -1 -1 1 0 1 0 -1 0 -1 -1\n11\n1 0 1 0 -1 1 -1 -1 -1 1 0\n58\n1 0 0 -1 -1 0 1 0 1 0 1 -1 1 1 0 0 1 -1 -1 1 -1 1 -1 -1 1 -1 0 1 0 0 0 0 -1 -1 0 0 0 1 0 0 1 -1 0 0 0 -1 0 0 1 -1 0 -1 1 1 -1 0 0 1\n2\n0 0\n10\n0 -1 1 -1 1 -1 0 0 1 0\n", "output": "NO\nNO\nNO\nYES\nYES\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\nDeveloping tools for creation of locations maps for turn-based fights in a new game, Petya faced the followin... | [{"input": "-1000000000 -1000000000 1000000000 1000000000\n", "output": "2000000002000000001"}, {"input": "-1000000000 -1000000000 1000000000 1000000000\n", "output": "2000000002000000001"}, {"input": "-1000000000 -999999999 1000000000 999999999\n", "output": "2000000000000000000"}, {"input": "-999999999 -1000000000 99... | 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, Russian and Vietnamese as well. \n\nThe Head Chef is receiving ... | [{"input": "2\n1\n210", "output": "0\n2628\n"}, {"input": "2\n1\n198", "output": "0\n2484\n"}, {"input": "2\n1\n175", "output": "0\n2288\n"}, {"input": "2\n2\n175", "output": "2\n2288\n"}, {"input": "2\n2\n278", "output": "2\n4204\n"}, {"input": "2\n2\n114", "output": "2\n846\n"}, {"input": "2\n3\n112", "output": "4\n8... | 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 code which should return `true` if the given object is a single ASCII letter (lower or upper cas... | [{"input": "\"a\\n\"", "output": "[false]", "fn_name": "is_letter"}, {"input": "\"ab\"", "output": "[false]", "fn_name": "is_letter"}, {"input": "\"7\"", "output": "[false]", "fn_name": "is_letter"}, {"input": "\"_\"", "output": "[false]", "fn_name": "is_letter"}, {"input": "\"\"", "output": "[false]", "fn_name": "is_l... | 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 pretty straightforward. Your goal is to create a function that removes the first and last characters of ... | [{"input": "\"eloquent\"", "output": "[\"loquen\"]", "fn_name": "remove_char"}, {"input": "\"country\"", "output": "[\"ountr\"]", "fn_name": "remove_char"}, {"input": "\"ooopsss\"", "output": "[\"oopss\"]", "fn_name": "remove_char"}, {"input": "\"person\"", "output": "[\"erso\"]", "fn_name": "remove_char"}, {"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\nIT City company developing computer games decided to upgrade its way to reward its employees. Now it looks th... | [{"input": "1000000000000000000\n", "output": "228571428571428571\n"}, {"input": "1000000010000000000\n", "output": "228571430857142858\n"}, {"input": "1334196189585702396\n", "output": "304959129048160547\n"}, {"input": "1369783456377690936\n", "output": "313093361457757928\n"}, {"input": "1000000010000000100\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\nThe ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kin... | [{"input": "50\nagecd\ncghafi\nfiide\niecc\njbdcfjhgd\ndiee\nhfeg\nehc\ngfijgjh\ngacaifebg\ndicbbddc\nhjgciaei\njjcdh\ng\ngc\ncf\nhfdjhd\nc\nicidbec\nji\neeh\ncgeejggc\nacfd\njjg\najefdj\neghhebiic\nbih\ngbb\njjaa\nidc\ngafi\necg\ndbigbjiehj\ncedif\nahidfaaajg\nhfhhiccbgb\ndgegjgieif\nhgjebhfdc\nj\nahehd\nahdah\nbijbhh... | 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\nVasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are n... | [{"input": "100 10\n1 1 6 6 6 2 5 7 6 5 3 7 10 10 8 9 7 6 9 2 6 7 8 6 7 5 2 5 10 1 10 1 8 10 2 9 7 1 6 8 3 10 9 4 4 8 8 6 6 1 5 5 6 5 6 6 6 9 4 7 5 4 6 6 1 1 2 1 8 10 6 2 1 7 2 1 8 10 9 2 7 3 1 5 10 2 8 10 10 10 8 9 5 4 6 10 8 9 6 6\n2 4 10 11 5 2 6 7 2 15\n", "output": "74\n"}, {"input": "100 10\n1 1 6 6 6 2 5 7 6 5 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\nOld timers of Summer Informatics School can remember previous camps in which each student was given a drink o... | [{"input": "20 4\n1\n1\n1\n1\n1\n2\n2\n2\n2\n2\n3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n", "output": "18\n"}, {"input": "20 4\n1\n1\n1\n1\n1\n2\n2\n2\n2\n2\n3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n", "output": "18\n"}, {"input": "16 12\n1\n1\n1\n2\n2\n4\n3\n3\n3\n4\n4\n4\n5\n5\n6\n6\n", "output": "15\n"}, {"input": "16 12\n1\n1\n1\n2\n2\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 directed graph with $n$ vertices and $m$ directed edges without self-loops or multiple edges.... | [{"input": "18 74\n12 17\n6 3\n7 5\n11 13\n13 12\n16 2\n15 3\n10 6\n18 1\n6 1\n10 18\n3 16\n16 5\n14 12\n12 1\n9 6\n13 11\n11 17\n13 1\n1 7\n18 12\n6 8\n11 15\n2 9\n9 12\n7 4\n8 15\n6 9\n11 9\n11 18\n3 6\n5 7\n1 16\n2 6\n17 11\n4 8\n14 1\n7 13\n18 14\n7 16\n15 5\n11 2\n18 17\n9 16\n4 13\n17 5\n8 6\n18 6\n6 4\n17 10\n10... | 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 two numbers. As long as they are both larger than zero, they go through the same operation: subtra... | [{"input": "20\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 999999999\n1000000000 9999999... | 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 $s$ of length $n$, consisting of lowercase letters of the English alphabet, is given.\n\nYou must ch... | [{"input": "4\n3\nlol\n10\nfecrosedoc\n5\naaaab\n4\nddca\n", "output": "2\n10\n0\n4\n"}, {"input": "4\n3\nnlm\n10\nfecrosedoc\n5\naaaab\n4\nddca\n", "output": "3\n10\n0\n4\n"}, {"input": "4\n3\nlol\n10\ncodeforces\n5\naaaaa\n4\ndcba\n", "output": "2\n6\n0\n4\n"}, {"input": "4\n3\nlol\n10\ncodeforces\n5\nbaaaa\n4\ndcba\... | 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 staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th ... | [{"input": "16090 15931\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\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 a harder version of the problem. In this version, $n \\le 50\\,000$.\n\nThere are $n$ distinct points... | [{"input": "8\n-100000000 -100000000 -100000000\n100000000 100000000 100000000\n-100000000 100000000 100000000\n-100000000 -100000000 100000000\n100000000 100000000 -100000000\n100000000 -100000000 -100000000\n-100000000 100000000 -100000000\n100000000 -100000000 100000000\n", "output": "1 4\n7 3\n6 8\n5 2\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\nIvan has $n$ songs on his phone. The size of the $i$-th song is $a_i$ bytes. Ivan also has a flash drive whic... | [{"input": "1 1364355877\n1000000000 1343571090\n", "output": "0\n"}, {"input": "1 1000000000\n1000000000 999999999\n", "output": "0\n"}, {"input": "1 1000000000\n1000000000 999999999\n", "output": "0\n"}, {"input": "1 1992779579\n1000000000 999999999\n", "output": "0\n"}, {"input": "1 1992779579\n1000000010 999999999\... | 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\nReading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an un... | [{"input": "tttdddssstttssstttdddddddddttttttdddsssdddtttsssdddsssssstttddddddtttdddssstttsssttttttdddtttsssssstttssssssssstttsssssstttssstttdddddddddsssdddssssssdddssstttsssdddssstttdddttttttdddddddddsssssstttdddtttssssssdddddddddttttttdddtttsssdddssstttsssdddssssssdddsssdddddddddtttssstttsssssstttssssssssstttsssssstt... | 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 not good at hide-and-seek. As soon as you hide, you will find it, and it will be difficult to find th... | [{"input": "3\n6 6 3\n19 19 6\n42 10 1\n6\n5 2 2 11\n12 7 2 11\n11 9 1 11\n14 2 22 5\n17 9 20 5\n20 10 20 5\n0", "output": "Safe\nDanger\nDanger\nDanger\nDanger\nDanger\n"}, {"input": "3\n6 2 16\n40 7 8\n42 8 1\n6\n5 3 4 11\n12 4 2 15\n16 2 0 11\n28 2 31 5\n17 9 41 5\n24 10 30 10\n0", "output": "Danger\nDanger\nDanger\... | 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\nAnton has the integer x. He is interested what positive integer, which doesn't exceed x, has the maximum sum ... | [{"input": "1000000000000000000\n", "output": "999999999999999999\n"}, {"input": "1000000000000000000\n", "output": "999999999999999999\n"}, {"input": "978916546899999999\n", "output": "899999999999999999\n"}, {"input": "999999999999999999\n", "output": "999999999999999999\n"}, {"input": "999999999999990999\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\nThere are n schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The bun... | [{"input": "MFFFMMFMFMFMFFFMMMFFMMMMMMFMMFFMMMFMMFMFFFMMFMMMFFMMFFFFFMFMFFFMMMFFFMFMFMFMFFFMMMMFMMFMMFFMMMMMMFFM\n", "output": "54\n"}, {"input": "MMMMMFFMFMFMFMMFMMFFMMFMFFFFFFFMFFFMMMMMMFFMMMFMFMMFMFFMMFMMMFFFFFMMMMMFMMMMFMMMFFMFFMFFFMFFMFFMMFFM\n", "output": "58\n"}, {"input": "MMMMFMMMMMFFMMFMFMMMFMMFMFMMFFFMMFMMMF... | 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 N be a positive even number.\nWe have a permutation of (1, 2, ..., N), p = (p_1, p_2, ..., p_N).\nSnuke i... | [{"input": "8\n2 6 5 2 1 4 -1 1", "output": "-1 1 1 4 2 2 6 5 "}, {"input": "8\n4 6 3 2 8 5 7 1\n", "output": "3 1 2 7 4 6 8 5\n"}, {"input": "8\n4 6 5 2 8 5 7 1", "output": "4 1 2 7 6 5 8 5 "}, {"input": "8\n4 6 5 2 8 5 0 1", "output": "0 1 4 2 6 5 8 5 "}, {"input": "8\n2 6 5 2 8 5 0 1", "output": "0 1 2 2 6 5 8 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 sequence $(b_1, b_2, \\ldots, b_k)$ is called strange, if the absolute difference between any pair of its e... | [{"input": "6\n4\n-1 -2 -1 1\n7\n-3 2 -2 0 -4 7 1\n5\n0 5 -3 2 -5\n3\n2 0 1\n4\n-3 -1 2 0\n6\n-3 -2 -1 1 1 1\n", "output": "3\n5\n4\n2\n3\n4\n"}, {"input": "6\n4\n-1 -2 -1 1\n7\n-3 2 -2 0 -4 7 1\n5\n0 5 -3 1 -5\n3\n2 0 1\n4\n-3 -1 2 0\n6\n-3 -2 -2 1 1 1\n", "output": "3\n5\n4\n2\n3\n3\n"}, {"input": "6\n4\n-1 -2 0 1\n7... | 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 three integers A, B and C.\n\nDetermine if there exists an equilateral triangle whose sides hav... | [{"input": "-1 -1 -1", "output": "Yes\n"}, {"input": "-2 -1 -1", "output": "No\n"}, {"input": "-2 -1 -2", "output": "No\n"}, {"input": "-3 10 -1", "output": "No\n"}, {"input": "-3 1 -11", "output": "No\n"}, {"input": "-3 1 -21", "output": "No\n"}, {"input": "-5 1 -21", "output": "No\n"}, {"input": "-9 1 -21", "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\nDima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. \n\nD... | [{"input": "8\n7 3 3 10 9 9 8 1\n8 2 6 6 0 3 8 0\n1 2 5 1 9 4 7 8\n", "output": "52\n"}, {"input": "8\n7 3 3 10 9 9 8 1\n8 2 4 6 0 3 8 0\n1 2 5 1 9 4 7 8\n", "output": "52\n"}, {"input": "8\n7 3 3 10 9 9 6 1\n8 2 4 6 0 3 8 0\n1 2 5 1 9 4 7 8\n", "output": "52\n"}, {"input": "8\n7 3 3 10 9 9 6 1\n8 2 4 8 0 3 8 0\n1 2 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\nLittle Dima has two sequences of points with integer coordinates: sequence (a1, 1), (a2, 2), ..., (an, n) and... | [{"input": "100\n2 2 10 3 5 6 4 7 9 8 2 7 5 5 1 7 5 9 2 2 10 3 6 10 9 9 10 7 3 9 7 8 8 3 9 3 9 3 3 6 3 7 9 9 7 10 9 1 1 3 6 2 9 5 9 9 6 2 6 5 6 8 2 10 1 1 6 8 8 4 5 2 6 8 8 5 9 2 3 3 7 7 10 5 4 2 10 6 7 6 5 4 10 6 10 3 9 9 1 5\n3 5 6 4 2 3 2 9 3 8 3 1 10 7 4 3 6 9 3 5 9 5 3 10 4 7 9 7 4 3 3 6 9 8 1 1 10 9 1 6 8 8 8 2 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\nInna loves digit 9 very much. That's why she asked Dima to write a small number consisting of nines. But Dima... | [{"input": "44444444444444544444444445444444444444444444444444554444444444444444444444444444444444444444455444444444444444444444444444444444444444545444444444444444444444444444444444444445444444444444444444444444444444444444544444444444444444444444444444444444444444444544444444444444444444444444444444445666666666666666... | 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 bought food at the store to make a lunch box to eat at lunch. At the store, I only got an elongated bag to ... | [{"input": "4\nsandwich 30 120\nelppa 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 101 500\nchocolate 50 350\niookce 30 132\npurin 40 400\ncracker 40 154\n0", "output": "cake\nelppa\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri\nonigiri\nanpan\nmikan\... | 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\n\nFor the integer n (1 ≤ n), let Pn be a string of n + 1 I's and n O's starting with I and alternati... | [{"input": "1\n119\nOOJOIOIOIIOII\n1\n14\nKIOIIOIOIOJOO\n0", "output": "3\n3\n"}, {"input": "1\n13\nOIIOIOIOIIOIO\n2\n13\nOOIOIOIOIIOII\n0", "output": "4\n2\n"}, {"input": "1\n13\nOOIOIOIOIIOII\n3\n13\nOOIOIOIOIIOII\n0", "output": "4\n1\n"}, {"input": "1\n25\nOOIOIOIOIIOII\n3\n13\nOOJOIOIOIIOIJ\n0", "output": "4\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\nGottfried learned about binary number representation. He then came up with this task and presented it to you.... | [{"input": "37\n1048575 327657 1046479 686078 513773 589787 387035 736754 1038077 1048056 59263 753353 784318 647131 519679 294910 185560 604141 456668 849789 521404 782287 6137 1047551 849874 523933 521721 278491 1042415 581468 1013705 439526 1011709 917469 655311 327646 917499\n", "output": "24197296011217\n"}, {"inp... | 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 goal of the matrix-chain multiplication problem is to find the most efficient way to multiply given $n$ m... | [{"input": "6\n30 35\n35 15\n15 5\n5 10\n10 20\n20 29", "output": "16125\n"}, {"input": "6\n30 35\n35 15\n15 5\n5 10\n10 20\n20 27", "output": "15625\n"}, {"input": "6\n30 35\n35 15\n15 5\n5 10\n10 20\n20 47", "output": "20625\n"}, {"input": "6\n30 35\n35 15\n15 5\n5 10\n10 20\n20 14", "output": "12375\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$ athletes in front of you. Athletes are numbered from $1$ to $n$ from left to right. You know th... | [{"input": "5\n5\n3 1 2 10 4\n6\n2 1 3 4 4 3\n4\n14 9 3 1\n2\n0 1000\n3\n110 150 200\n", "output": "1\n0\n2\n1000\n40\n"}, {"input": "5\n5\n3 1 2 10 4\n6\n2 1 3 4 4 3\n4\n14 9 3 1\n2\n0 1000\n3\n100 150 200\n", "output": "1\n0\n2\n1000\n50\n"}, {"input": "5\n5\n3 1 2 10 4\n6\n2 1 3 4 4 3\n4\n7 9 3 1\n2\n0 1000\n3\n100 ... | 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 History Lesson\n\nThe Pony Express was a mail service operating in the US in 1859-60.\n\n\n\n\n\nIt reduc... | [{"input": "[6, 24, 6, 8, 28, 8, 23, 47, 17, 29, 37, 18, 40, 49]\n2", "output": "[5]", "fn_name": "riders"}, {"input": "[33, 8, 16, 47, 30, 30, 46]\n5", "output": "[5]", "fn_name": "riders"}, {"input": "[50, 100, 25, 50, 26]\n3", "output": "[6]", "fn_name": "riders"}, {"input": "[50, 50, 25, 50, 24]\n3", "output": "[3]... | 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\nYour security guard friend recently got a new job at a new security company. The company requires him to patr... | [{"input": "1000000\n", "output": "4000\n"}, {"input": "1000000\n", "output": "4000\n"}, {"input": "999000\n", "output": "3998\n"}, {"input": "999001\n", "output": "4000\n"}, {"input": "999999\n", "output": "4000\n"}, {"input": "933206\n", "output": "3866\n"}, {"input": "718351\n", "output": "3392\n"}, {"input": "60744... | 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\nLogical quantifiers are very useful tools for expressing claims about a set. For this problem, let's focus on... | [{"input": "100 50\n55 13\n84 2\n22 63\n100 91\n2 18\n98 64\n1 86\n93 11\n17 6\n24 97\n14 35\n24 74\n22 3\n42 5\n63 79\n31 89\n81 22\n86 88\n77 51\n81 34\n19 55\n41 54\n34 57\n45 9\n55 72\n67 61\n41 84\n39 32\n51 89\n58 74\n32 79\n65 6\n86 64\n63 42\n100 57\n46 39\n100 9\n23 58\n26 81\n61 49\n71 83\n66 2\n79 74\n30 27\... | 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\nKawashiro Nitori is a girl who loves competitive programming.\n\nOne day she found a string and an integer. A... | [{"input": "7\n5 2\nrwrwq\n2 0\nac\n3 1\nioi\n4 0\nibdp\n22 0\ndokidoktliteraiureclub\n19 0\necilbiahgaahsmnetmi\n6 2\naaaaaa\n", "output": "NO\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"input": "7\n5 1\nqwqwq\n2 0\nab\n3 1\nioi\n4 2\nipcc\n22 0\ncokidokiliteratureclub\n19 11\nimtdamshanghaialice\n6 2\naaaaaa\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\nStudents in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces len... | [{"input": "1000000 1000000\n", "output": "3000000\n"}, {"input": "1000000 1000000\n", "output": "3000000\n"}, {"input": "1000000 999999\n", "output": "2999998\n"}, {"input": "999999 1000000\n", "output": "3000000\n"}, {"input": "1000000 666667\n", "output": "2500000\n"}, {"input": "1000000 999999\n", "output": "299999... | 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 as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (F... | [{"input": "2019/04/30\n", "output": "Heisei\n"}, {"input": "2019/01/01\n", "output": "Heisei\n"}, {"input": "2019/02/28\n", "output": "Heisei\n"}, {"input": "2019/04/29\n", "output": "Heisei\n"}, {"input": "2019/03/30", "output": "Heisei\n"}, {"input": "2019/04/20", "output": "Heisei\n"}, {"input": "1019/04/30", "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\nThis contest, AtCoder Beginner Contest, is abbreviated as ABC.\nWhen we refer to a specific round of ABC, a t... | [{"input": "1530", "output": "ABC1530\n"}, {"input": "2825", "output": "ABC2825\n"}, {"input": "5621", "output": "ABC5621\n"}, {"input": "-105", "output": "ABC-105\n"}, {"input": "-136", "output": "ABC-136\n"}, {"input": "-215", "output": "ABC-215\n"}, {"input": "-111", "output": "ABC-111\n"}, {"input": "-104", "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\nComplete the solution so that it returns true if it contains any duplicate argument values. Any number of arg... | [{"input": "\"a\"\n\"b\"\n\"c\"\n\"d\"\n\"e\"\n\"f\"\n\"f\"\n\"b\"", "output": "[true]", "fn_name": "solution"}, {"input": "\"a\"\n\"b\"\n\"c\"\n\"d\"", "output": "[false]", "fn_name": "solution"}, {"input": "1\n2\n42\n3\n4\n5\n42", "output": "[true]", "fn_name": "solution"}, {"input": "\"a\"\n\"b\"\n\"c\"\n\"c\"", "ou... | 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## Description\n\nGiven an array X of positive integers, its elements are to be transformed by running the fo... | [{"input": "[71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71]", "output": "[923]", "fn_name": "solution"}, {"input": "[60, 12, 96, 48, 60, 24, 72, 36, 72, 72, 48]", "output": "[132]", "fn_name": "solution"}, {"input": "[3, 13, 23, 7, 83]", "output": "[5]", "fn_name": "solution"}, {"input": "[4, 16, 24]", "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\nGenos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of ... | [{"input": "50\n22 19 14 22 20 11 16 28 23 15 3 23 6 16 30 15 15 10 43 28 19 19 22 30 28 1 27 12 12 14 17 30 17 26 21 26 27 1 11 23 9 30 18 19 17 29 11 20 29 24\n", "output": "25\n"}, {"input": "50\n22 19 14 22 20 11 16 28 38 15 3 23 6 16 30 15 15 10 43 28 19 19 22 30 28 1 27 12 12 14 17 30 17 26 21 26 27 1 11 23 9 30 ... | 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 Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupi... | [{"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\nWe want to know the index of the vowels in a given word, for example, there are two vowels in the word super ... | [{"input": "\"supercalifragilisticexpialidocious\"", "output": "[[2, 4, 7, 9, 12, 14, 16, 19, 21, 24, 25, 27, 29, 31, 32, 33]]", "fn_name": "vowel_indices"}, {"input": "\"narboonnee\"", "output": "[[2, 5, 6, 9, 10]]", "fn_name": "vowel_indices"}, {"input": "\"UNDISARMED\"", "output": "[[1, 4, 6, 9]]", "fn_name": "vowel... | 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 and her best friend want to play a game.\n\nThe game starts with an array a of length n consist... | [{"input": "4\n5\n4 1 5 1 4\n4\n1 0 0 12\n1\n0\n2\n5 4\n", "output": "LOSE\nWIN\nDRAW\nWIN\n"}, {"input": "4\n5\n2 1 3 1 0\n4\n1 0 1 6\n1\n0\n2\n5 4\n", "output": "LOSE\nWIN\nDRAW\nWIN\n"}, {"input": "4\n5\n4 1 5 1 4\n4\n1 0 1 12\n1\n1\n2\n5 4\n", "output": "LOSE\nWIN\nWIN\nWIN\n"}, {"input": "4\n5\n4 1 5 1 3\n4\n1 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\nThe King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day h... | [{"input": "5\nAJMP\naB33d\nE\n86AE\nAM\n-1\nMPJE\nWaEaETC302Q\nCP\nrTurnAGumdam1isdefferentf", "output": "33Bad\nAE86\n2-\nEC302QTWaEa\nTurnAGumdam0isdefferentfr\n"}, {"input": "5\nAJMP\naB33d\nE\n86AE\nMA\n-1\nMPJE\nWaEaETC302Q\nCP\nftnereffedsi1madmuGAnruTr", "output": "33Bad\nAE86\n2-\nEC302QTWaEa\ntnereffedsi0madm... | 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 day, little Vasya found himself in a maze consisting of (n + 1) rooms, numbered from 1 to (n + 1). Initia... | [{"input": "129\n1 1 3 3 1 4 7 4 3 5 8 11 3 9 15 4 11 17 1 6 18 9 11 13 17 22 8 18 26 13 16 20 3 16 35 26 23 28 27 30 39 29 43 8 14 6 17 32 26 31 2 18 3 47 52 21 57 1 35 35 53 47 16 26 30 65 48 2 32 11 10 5 4 1 4 53 71 21 53 8 58 49 17 6 19 80 1 49 43 60 12 60 35 25 86 45 47 97 52 74 10 91 93 31 69 41 80 90 67 4 94 92 ... | 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$2^n$ teams participate in a playoff tournament. The tournament consists of $2^n - 1$ games. They are held as... | [{"input": "7\n1011011\n", "output": "32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 11... | 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 table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. I... | [{"input": "10 10\n0000000000\n0000001000\n0000000100\n0101000100\n0000000000\n0000000000\n1000110000\n1011010010\n0000100000\n0000001001\n", "output": "-1\n"}, {"input": "10 10\n0000000000\n0000000010\n0010000000\n0111000010\n1000000000\n0000000100\n0000000100\n0000100100\n0010000000\n0000100000\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\nYou are given integers A and B, each between 1 and 3 (inclusive).\nDetermine if there is an integer C between... | [{"input": "-1 -1", "output": "Yes\n"}, {"input": "-3 -1", "output": "Yes\n"}, {"input": "-1 -3", "output": "Yes\n"}, {"input": "-5 -1", "output": "Yes\n"}, {"input": "-1 -5", "output": "Yes\n"}, {"input": "-3 -3", "output": "Yes\n"}, {"input": "-12 -2", "output": "No\n"}, {"input": "3 1\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 given an array of integers. Your task is to sort odd numbers within the array in ascending order, and... | [{"input": "[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]", "output": "[[1, 8, 3, 6, 5, 4, 7, 2, 9, 0]]", "fn_name": "sort_array"}, {"input": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]", "output": "[[8, 1, 6, 3, 4, 5, 2, 7, 0, 9]]", "fn_name": "sort_array"}, {"input": "[0, 1, 2, 3, 4, 9, 8, 7, 6, 5]", "output": "[[8, 1, 6, 3, 4, 5, 2, 7, 0, 9]]... | 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\nGreatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such tha... | [{"input": "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000... | 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 day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters \"a\"... | [{"input": "15 84\n11 9\n3 11\n13 10\n2 12\n5 9\n1 7\n14 4\n14 2\n14 1\n11 8\n1 8\n14 10\n4 15\n10 5\n5 12\n13 11\n6 14\n5 7\n12 11\n9 1\n10 15\n2 6\n7 15\n14 9\n9 7\n11 14\n8 15\n12 7\n13 6\n2 9\n9 6\n15 3\n12 15\n6 15\n4 6\n4 1\n9 12\n10 7\n6 1\n11 10\n2 3\n5 2\n13 2\n13 3\n12 6\n4 3\n5 8\n12 1\n9 15\n14 5\n12 14\n10... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.