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\nIf we multiply the integer `717 (n)` by `7 (k)`, the result will be equal to `5019`.\n\nConsider all the... | [{"input": "1611\n3", "output": "[1989]", "fn_name": "next_higher"}, {"input": "100\n3", "output": "[162]", "fn_name": "next_higher"}, {"input": "200\n4", "output": "[260]", "fn_name": "next_higher"}, {"input": "300\n5", "output": "[846]", "fn_name": "next_higher"}, {"input": "500\n7", "output": "[717]", "fn_name": "ne... | 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\nWarawreh created a great company called Nanosoft. The only thing that Warawreh still has to do is to place a ... | [{"input": "8 8 8\nRRRRGGGG\nRRRRGGGG\nRRRRGGGG\nRRRRGGGG\nYYYYBBBB\nYYYYBBBB\nYYYYBBBB\nYYYYBBBB\n1 1 8 8\n5 2 5 7\n3 1 8 6\n2 3 5 8\n1 2 6 8\n2 1 5 5\n2 1 7 7\n6 5 7 5\n", "output": "64\n0\n16\n4\n16\n4\n36\n0\n"}, {"input": "8 8 8\nRRRRGGGG\nRRRRGGGG\nRRRRGGGG\nRRRRGGGG\nYYYYBBBB\nYYYYBBBB\nYYYYBBBB\nYYYYBBBB\n1 1 8... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet us call two integers $x$ and $y$ adjacent if $\\frac{lcm(x, y)}{gcd(x, y)}$ is a perfect square. For exam... | [{"input": "1\n40\n1 1 5 6 2 10 12 10 4 2 17 18 6 3 1 4 1 1 7 2 9 10 3 2 4 1 9 1 1 4 2 7 8 1 7 9 2 17 7 2\n40\n1\n10\n1\n9\n0\n12\n9\n2\n1\n5\n13\n7\n3\n10\n4\n5\n0\n9\n0\n8\n5\n5\n3\n0\n6\n9\n1\n10\n13\n8\n3\n1\n2\n2\n7\n2\n2\n8\n4\n1\n", "output": "24\n24\n24\n24\n16\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n24\n16\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\nIgor found out discounts in a shop and decided to buy n items. Discounts at the store will last for a week an... | [{"input": "50 45\n80 125 152 122 85 62 123 195 157 73 8 127 47 193 70 132 131 38 98 115 185 98 68 166 114 53 144 106 141 106 191 123 44 199 35 18 84 169 46 52 129 102 155 130 63 169 116 145 154 41\n155 187 79 106 136 173 17 146 9 47 173 21 37 183 110 74 185 14 82 156 147 25 162 195 26 25 22 80 171 180 7 92 53 18 100 1... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given two arrays of length $n$: $a_1, a_2, \\dots, a_n$ and $b_1, b_2, \\dots, b_n$.\n\nYou can perfo... | [{"input": "3\n4\n3 3 10 10\n10 10 3 3\n5\n1 2 3 4 5\n6 7 8 9 10\n6\n72 101 108 108 111 44\n10 87 111 114 108 100\n", "output": "0\n8\n218\n"}, {"input": "1\n10\n12345 12345 12345 12345 12345 12345 12345 12345 12345 12345\n1 1 1 1 11 1 1 1 11 1\n", "output": "40\n"}, {"input": "1\n10\n123 123 123 123 123 123 123 123 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\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C ... | [{"input": "206383196 349216559 1444400245 1999999999\n", "output": "-1238017048\n"}, {"input": "206383196 349216559 1444400245 2000000000\n", "output": "-1238017049\n"}, {"input": "1000000000 199342280 739321284 1199342280\n", "output": "1000000000\n"}, {"input": "1000000000 199342280 739321284 1199342281\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$ seats in the train's car and there is exactly one passenger occupying every seat. The seats are... | [{"input": "100 1000000000\n12 803 439 1031 435 300 497 520 718 573 782 523 328 88 275 159 128 389 920 869 503 80 490 289 22 889 353 799 29 131 1138 123 405 221 727 135 248 348 299 833 19 943 471 410 635 626 784 1205 213 724 550 437 860 536 718 173 406 832 520 748 512 29 466 982 574 848 11 693 915 965 177 479 122 498 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\nAlice got many presents these days. So she decided to pack them into boxes and send them to her friends.\n\nT... | [{"input": "1000000000 1000000000\n", "output": "751201557\n"}, {"input": "1000000000 1000000000\n", "output": "751201557"}, {"input": "534571158 222043261\n", "output": "212941625\n"}, {"input": "922338645 900544285\n", "output": "187784871\n"}, {"input": "188186551 379116090\n", "output": "655244255\n"}, {"input": "8... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given several queries. Each query consists of three integers $p$, $q$ and $b$. You need to answer whe... | [{"input": "11\n1 1000000000000000000 10000000\n4 692 9\n1 2272 333111\n1 9 7\n25 31 1\n13 906830565560158478 22\n1971402979058461 750473176484995605 54\n14 19 23\n4 42409608949005314 23\n3 21914624432020321 46\n3 21914624432020321 47\n", "output": "Finite\nInfinite\nInfinite\nInfinite\nInfinite\nInfinite\nInfinite\nIn... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 know that the Martians use a number system with base k. Digit b (0 β€ b < k) is considered lucky, as the f... | [{"input": "11 1 199\n10 1 2 1 6 2 0 1 9 9 0 5 5 4 0 1 8 7 7 5 2 5 6 10 7 1 6 8 0 8 10 9 1 8 1 6 1 3 6 1 9 0 5 3 6 8 7 5 10 1 1 10 1 6 10 8 10 10 9 1 3 10 2 3 8 10 6 1 7 7 10 5 2 2 7 2 0 2 1 8 6 5 9 6 7 10 2 9 1 4 2 4 5 4 1 5 6 1 1 1 5 2 6 8 8 3 8 6 5 4 2 1 6 5 0 6 5 4 3 7 4 7 6 8 6 6 6 4 10 4 6 5 5 7 10 1 9 2 4 8 4 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\nGoa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis... | [{"input": "8 10\n1 2 3\n2 8 3\n1 4 1\n4 3 6\n3 7 7\n4 5 5\n5 7 2\n7 8 1\n1 6 8\n6 8 7\n0\n4 1 2 3 4\n0\n0\n0\n0\n0\n0\n", "output": " 8"}, {"input": "7 6\n1 2 1\n1 3 2\n2 4 3\n2 5 4\n3 5 6\n3 6 7\n0\n3 1 2 3\n2 2 3\n0\n2 7 8\n0\n0\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\nYou are given integers N and M.\nConsider a sequence a of length N consisting of positive integers such that ... | [{"input": "000001 1010001101", "output": "1010001101\n"}, {"input": "000001 1010011101", "output": "1010011101\n"}, {"input": "000001 1110110010", "output": "1110110010\n"}, {"input": "000001 1110111010", "output": "1110111010\n"}, {"input": "000100 1010000101", "output": "10000001\n"}, {"input": "001000 1000110000", ... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 define $S(x)$ to be the sum of digits of number $x$ written in decimal system. For example, $S(5) = 5$,... | [{"input": "5\n1\n10\n16\n178\n276008776\n", "output": "0\n1\n1\n17\n27600877\n"}, {"input": "5\n0\n16\n16\n178\n164382836\n", "output": "0\n1\n1\n17\n16438283\n"}, {"input": "5\n0\n27\n3\n128\n880055535\n", "output": "0\n2\n0\n12\n88005553\n"}, {"input": "5\n0\n27\n3\n128\n629030259\n", "output": "0\n2\n0\n12\n6290302... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 alphabetized kata\n---------------------\n\nRe-order the characters of a string, so that they are concate... | [{"input": "\" a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z\"", "output": "[\"aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ\"]", "fn_name": "alphabetized"}, {"input": "\"CodeWars can't Load Today\"", "output": "[\"aaaaCcdddeLnooorstTWy\"]", "fn_name": "a... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSomeone give a strange birthday present to Ivan. It is hedgehogΒ β connected undirected graph in which one ver... | [{"input": "33 2\n3 13\n17 3\n2 6\n5 33\n4 18\n1 2\n31 5\n4 19\n3 16\n1 3\n9 2\n10 3\n5 1\n5 28\n21 4\n7 2\n1 4\n5 24\n30 5\n14 3\n3 11\n27 5\n8 2\n22 4\n12 3\n20 4\n26 5\n4 23\n32 5\n25 5\n15 3\n29 5\n", "output": "Yes\n"}, {"input": "33 2\n3 13\n17 3\n2 6\n5 33\n4 18\n1 2\n31 5\n4 19\n3 16\n1 3\n9 2\n10 3\n5 1\n5 28\... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 rectangular chocolate bar consisting of n Γ m single squares. You want to eat exactly k squares, s... | [{"input": "4\n2 2 1\n2 2 3\n2 2 2\n2 2 4\n", "output": " 5\n 5\n 4\n 0\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an array $a$ consisting of $n$ integers. In one move, you can jump from the position $i$ to the... | [{"input": "150\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 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 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 1 1 1 1 2\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 an array a with length n, you can perform operations. Each operation is like this: choose two adjace... | [{"input": "15\n10 10 10 10 10 10 21 21 21 21 21 21 21 21 21\n", "output": "15\n"}, {"input": "15\n10 10 10 10 10 10 10 10 10 10 10 10 15 15 21\n", "output": "17\n"}, {"input": "15\n10 10 10 10 10 10 21 21 21 21 21 30 21 21 21\n", "output": "15\n"}, {"input": "15\n10 10 10 10 10 10 21 21 20 21 21 30 21 21 21\n", "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\nManao is taking part in a quiz. The quiz consists of n consecutive questions. A correct answer gives one poin... | [{"input": "1000000000 1000000000 1290529127\n", "output": "1000000000\n"}, {"input": "1000000000 1000000000 1000000000\n", "output": "999999991\n"}, {"input": "1000000000 1000000000 1000000000\n", "output": "999999991\n"}, {"input": "1000000000 1000000000 1000000000\n", "output": "999999991\n"}, {"input": "1000000000 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands. For convenience, we wil... | [{"input": "7 3\n2 16\n4 2\n5 -1\n1 4\n-1 7", "output": "IMPOSSIBLE\n"}, {"input": "7 3\n2 16\n4 2\n5 -1\n1 1\n-1 7", "output": "IMPOSSIBLE\n"}, {"input": "7 3\n2 16\n4 2\n5 -1\n1 4\n0 7", "output": "IMPOSSIBLE\n"}, {"input": "10 5\n1 1\n4 5\n2 3\n2 4\n1 -1", "output": "IMPOSSIBLE\n"}, {"input": "10 5\n1 1\n4 5\n2 5\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\nKefa wants to celebrate his first big salary by going to restaurant. However, he needs company. \n\nKefa has ... | [{"input": "15 1234\n2738 322313356\n1160 970909702\n2594 902749351\n3126 324754476\n3151 177963947\n3424 396145897\n5578 737768323\n3423 687640543\n381 848813098\n1058 197211286\n936 650181776\n1025 776492538\n3598 142176544\n3595 680519527\n1191 32199940\n", "output": "3634263641\n"}, {"input": "15 1234\n2738 3653703... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 boy named Ayrat lives on planet AMI-1511. Each inhabitant of this planet has a talent. Specifically, Ayrat ... | [{"input": "jjjbjjbjbbbbbbjbjbbjbjbbbjbjbbjbbjbbjjbjbjjjbbbbjbjjjjbbbjbjjjjjbjbjbjjjbjjjjjjjjbbjbjbbjbbjbbbbbjjjbbjjbjjbbbbjbbjbbbbbjbbjjbjjbbjjjbjjbbbbjbjjbjbbjbbjbjbjbbbjjjjbjbjbbjbjjjjbbjbjbbbjjjjjbjjbjbjjjbjjjbbbjbjjbbbbbbbjjjjbbbbj\njjbbjbbjjjbjbbjjjjjbjbjjjbjbbbbjbbjbjjbjbbjbbbjjbjjbjbbbjbbjjbbjjjbbbjbbjbjjbbjjjj... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The ... | [{"input": "50\n31 80 40 85 12 38 30 97 51 18 45 81 56 82 91 94 95 13 26 93 98 35 44 69 98 39 83 77 38 68 13 71 80 41 21 80 81 17 88 46 61 67 65 49 29 55 37 74 88\n71 8 42 74 14 70 100 96 25 56 95 38 41 88 45 43 46 16 55 77 100 68 51 30 73 51 25 88 64 26 22 50 4 57 88 85 45 32 11 96 94 19 9 12 10 66 24 8 60\n46 55 55 9... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLimak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive in... | [{"input": "1000000000000000\n", "output": "18 999999993541753\n"}, {"input": "409477218238717\n", "output": "17 409477218238717\n"}, {"input": "419477218238718\n", "output": "18 419466459294818\n"}, {"input": "999088000000000\n", "output": "18 999087986204952\n"}, {"input": "415000000238718\n", "output": "18 414993991... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 [Sharkovsky's Theorem](https://en.wikipedia.org/wiki/Sharkovskii%27s_theorem) involves the following orde... | [{"input": "32\n1024", "output": "[false]", "fn_name": "sharkovsky"}, {"input": "17\n17", "output": "[false]", "fn_name": "sharkovsky"}, {"input": "18\n12", "output": "[true]", "fn_name": "sharkovsky"}, {"input": "10\n16", "output": "[true]", "fn_name": "sharkovsky"}, {"input": "1\n22", "output": "[false]", "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\nMaria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a c... | [{"input": "4\n5\n1 1 0 2 1\n6\n2 3 4 4 12 7\n6\n2 5 4 5 0 11\n5\n1 2 1 5 6\n", "output": "6\n5\n6\n4\n"}, {"input": "4\n5\n1 1 2 2 1\n6\n2 3 4 4 6 7\n6\n2 5 4 5 0 11\n5\n1 2 1 5 6\n", "output": "6\n5\n6\n4\n"}, {"input": "4\n5\n2 0 2 2 -1\n6\n2 3 4 5 6 7\n6\n1 5 4 5 1 9\n5\n1 2 3 5 6\n", "output": "6\n1\n6\n4\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 like the card board game \"Set\". Each card contains $k$ features, each of which is equal to a value from... | [{"input": "37 5\n0 2 0 1 0\n2 2 0 2 2\n2 0 2 0 0\n2 2 2 2 2\n1 2 0 0 2\n0 1 1 1 2\n0 2 0 2 2\n0 0 1 2 2\n2 0 0 1 0\n0 2 2 2 1\n0 2 2 2 0\n2 0 2 2 1\n0 0 2 0 1\n2 1 1 1 2\n1 2 0 1 0\n1 0 1 0 1\n1 2 1 0 0\n1 2 2 2 2\n2 2 1 2 1\n1 0 2 1 2\n2 1 1 2 1\n0 1 0 2 2\n1 0 1 1 1\n0 0 1 0 2\n0 1 0 0 1\n2 0 1 0 1\n1 2 2 1 2\n2 1 1... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given two strings s and t consisting of lowercase Latin letters. The length of t is 2 (i.e. this stri... | [{"input": "200 150\neabadadbeaeddccaabddacabacbaeecdbcdaadceaaaaacbabeaadbbcdbdabaeedbcaacdcecababaceeecddcbcabdcddedecccbcdcdeddacebbaacebbeccceeccabcedbdcdcdecadcebcaeeddbbdcebabdccbaddcbdacebaccececdadabdebcbcbbaedace\ncc\n", "output": "19503\n"}, {"input": "200 200\naaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaabaaaa... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nButCoder Inc. runs a programming competition site called ButCoder. In this site, a user is given an integer v... | [{"input": "1110010000100001010 -1 -2", "output": "2220020000200002023\n"}, {"input": "1110010000100001010 -1 -3", "output": "1110010000100001013\n"}, {"input": "1100000010001000010 -1 -10", "output": "244444446666888893\n"}, {"input": "1100010010100001010 0 -2", "output": "1100010010100001011\n"}, {"input": "111001001... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 tree is a connected graph without cycles. A rooted tree has a special vertex called the root. The parent of... | [{"input": "5\n7\n1 2\n1 3\n1 7\n1 5\n2 6\n4 7\n6\n1 2\n1 3\n2 4\n2 5\n3 6\n2\n1 2\n7\n6 3\n1 5\n1 3\n4 6\n4 7\n2 1\n5\n2 1\n2 3\n4 5\n3 4\n3 11\n", "output": "2\n2\n1\n2\n1\n"}, {"input": "5\n7\n1 2\n1 3\n1 4\n2 5\n2 6\n4 7\n6\n1 2\n1 3\n2 4\n2 5\n3 6\n2\n1 2\n7\n6 3\n1 5\n1 6\n4 6\n4 7\n2 1\n5\n2 1\n1 3\n3 5\n3 4\n5 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou have been assigned to develop a filter for bad messages in the in-game chat. A message is a string $S$ of... | [{"input": "5\n2\n))\n12\ngl))hf))))))\n9\ngege)))))\n14\n)aa))b))))))))\n1\n)\n", "output": "Yes\nNo\nYes\nYes\nYes\n"}, {"input": "2\n6\naaaaa)\n6\n))))))\n", "output": "No\nYes\n"}, {"input": "1\n10\nsa)ttttttt\n", "output": "No\n"}, {"input": "1\n7\nabcd)))\n", "output": "No\n"}, {"input": "1\n5\naaaaa\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\nImplement a function, so it will produce a sentence out of the given parts.\n\nArray of parts could contain:\... | [{"input": "[\"The\", \"Earth\", \"rotates\", \"around\", \"The\", \"Sun\", \"in\", \"365\", \"days\", \",\", \"I\", \"know\", \"that\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\", \".\"]", "output": "[\"The Earth rotates around The Sun in 365 days, I know that.\"]", "fn_name": "make_se... | 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 are given n integers a_1, a_2, ..., a_{n}. Find the number of pairs of indexes i, j (i < j) that a_{i} + ... | [{"input": "100\n3 6 12 1 16 4 9 5 4 4 5 8 12 4 6 14 5 1 2 2 2 1 7 1 9 10 1 13 7 8 3 11 8 11 7 5 15 6 14 10 4 2 10 9 1 8 14 10 5 11 3 4 1 12 6 14 13 4 8 5 4 13 13 1 3 9 14 7 14 10 7 3 12 8 9 8 6 15 9 10 12 14 15 4 16 8 8 4 8 7 5 10 16 4 10 13 6 16 16 5\n", "output": "536\n"}, {"input": "100\n3 6 12 1 16 4 9 5 4 4 5 8 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\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two n... | [{"input": "86483718001", "output": "15724312364\n"}, {"input": "79402108049", "output": "14436746918\n"}, {"input": "59146214190", "output": "10753857126\n"}, {"input": "149696127901", "output": "27217477801"}, {"input": "14885609983", "output": "2706474543\n"}, {"input": "19238477126", "output": "3497904932\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\nA pair of positive integers $(a,b)$ is called special if $\\lfloor \\frac{a}{b} \\rfloor = a mod b$. Here, $\... | [{"input": "9\n3 6\n1 101\n11 6\n50 3\n12 4\n69 420\n12345 6789\n123456 789\n29238676 9\n", "output": "1\n0\n7\n3\n5\n141\n53384\n160909\n36\n"}, {"input": "9\n3 4\n1 100\n4 6\n20 3\n19 4\n69 420\n12345 10703\n123456 789\n16177647 9\n", "output": "1\n0\n2\n3\n6\n141\n57298\n160909\n36\n"}, {"input": "9\n3 4\n2 100\n4 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\nHeidi the Cow is aghast: cracks in the northern Wall? Zombies gathering outside, forming groups, preparing th... | [{"input": "350000 140000\n", "output": "453366\n"}, {"input": "350000 160000\n", "output": "155549\n"}, {"input": "350000 180000\n", "output": "708073\n"}, {"input": "350000 200000\n", "output": "504934\n"}, {"input": "400000 140000\n", "output": "956370\n"}, {"input": "400000 160000\n", "output": "480365\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\nThis kata is part of the collection [Mary's Puzzle Books](https://www.codewars.com/collections/marys-puzzle-b... | [{"input": "\"72102450111111090\"", "output": "[11]", "fn_name": "largest_sum"}, {"input": "\"4755843230\"", "output": "[41]", "fn_name": "largest_sum"}, {"input": "\"3388049750\"", "output": "[25]", "fn_name": "largest_sum"}, {"input": "\"3902864190\"", "output": "[30]", "fn_name": "largest_sum"}, {"input": "\"4098611... | 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\nOne day n friends gathered together to play \"Mafia\". During each round of the game some player must be the ... | [{"input": "100\n1 555 876 444 262 234 231 598 416 261 206 165 181 988 469 123 602 592 533 149 864 716 831 156 962 341 207 377 892 51 866 96 757 317 832 476 549 472 770 1000 887 145 956 515 992 653 972 677 973 527 1384 559 280 346 580 30 372 547 209 929 492 520 446 726 47 170 699 560 814 206 688 955 308 287 26 102 77 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 Al Gorithm was reading a book about climate and oceans when he encountered the word βglaciologicalβ. He ... | [{"input": "4\naaiigcloocllg 0\nmf`mtate 0\noosseisspnt 11\ndffensdmesrlesr 5", "output": "1\n2\n0\n0\n"}, {"input": "4\nglbciological 0\nuebmm`se 0\nsnoissessop 10\nelsfnsdeesenets 0", "output": "3\n2\n0\n7\n"}, {"input": "4\nglbciological 1\nuebmm`se 0\nsnoissessop 10\nelsfnsdeesenets 0", "output": "1\n2\n0\n7\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\nTwo players play a game. The game is played on a rectangular board with n Γ m squares. At the beginning of th... | [{"input": "100 100 1 1 100 100\n", "output": "Second\n"}, {"input": "100 100 10 10 13 14\n", "output": "Second\n"}, {"input": "110 100 1 1 100 100\n", "output": "Second\n"}, {"input": "99 100 24 1 24 100\n", "output": "Second\n"}, {"input": "37 100 33 13 32 30\n", "output": "Second\n"}, {"input": "89 100 54 1 55 100\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\nGeneralized leap year\n\nNormally, whether or not the year x is a leap year is defined as follows.\n\n1. If x... | [{"input": "3 295 2014\n695\n100\n4\n1 1000 1999\n1\n2 1111 4526\n1\n2\n6 2000 3409\n5\n11\n21\n9\n3\n13\n0 0 0", "output": "414\n1000\n3416\n1159\n"}, {"input": "3 295 2014\n695\n100\n4\n1 1000 1999\n1\n2 1111 4526\n1\n2\n6 2000 3409\n9\n11\n21\n9\n3\n13\n0 0 0", "output": "414\n1000\n3416\n1230\n"}, {"input": "3 1221... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 Hitachi string is a concatenation of one or more copies of the string `hi`.\n\nFor example, `hi` and `hihi`... | [{"input": "hhhi", "output": "No\n"}, {"input": "hhhj", "output": "No\n"}, {"input": "jhhh", "output": "No\n"}, {"input": "hjhh", "output": "No\n"}, {"input": "gjhh", "output": "No\n"}, {"input": "hjgh", "output": "No\n"}, {"input": "gjgh", "output": "No\n"}, {"input": "gkgh", "output": "No\n"}, {"input": "hgjg", "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\nMister B once received a gift: it was a book about aliens, which he started read immediately. This book had c... | [{"input": "1000 500 500 1000 499\n", "output": "501\n"}, {"input": "1000 500 500 1000 499\n", "output": "501\n"}, {"input": "1000 999 1000 1000 998\n", "output": "2\n"}, {"input": "1000 999 1000 1000 998\n", "output": "2\n"}, {"input": "1000 500 500 1000 475\n", "output": "21\n"}, {"input": "1000 999 1000 1000 948\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\nBinary with 0 and 1 is good, but binary with only 0 is even better! Originally, this is a concept designed by... | [{"input": "\"Chuck Norris' keyboard has 2 keys: 0 and white space.\"", "output": "[\"0 0 00 0000 0 0000 00 0 0 0 00 000 0 000 00 0 0 0 00 0 0 000 00 000 0 0000 00 0 0 0 00 0 0 00 00 0 0 0 00 00000 0 0 00 00 0 000 00 0 0 00 00 0 0 0000000 00 00 0 0 00 0 0 000 00 00 0 0 00 0 0 00 00 0 0 0 00 00 0 0000 00 00 0 00 00 0 0 ... | 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\nAttention: we lost all the test cases for this problem, so instead of solving the problem, we need you to gen... | [{"input": "100000\n", "output": "199998 2\n1 2"}, {"input": "99971\n", "output": "199940 2\n1 2\n"}, {"input": "65535\n", "output": "131068 2\n1 2\n"}, {"input": "65537\n", "output": "131072 2\n1 2\n"}, {"input": "99991\n", "output": "199980 2\n1 2\n"}, {"input": "65888\n", "output": "131774 2\n1 2\n"}, {"input": "604... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 country with n citizens. The i-th of them initially has a_{i} money. The government strictly contr... | [{"input": "10\n7 9 4 4 7 6 3 7 9 8\n10\n1 3 2\n1 10 5\n1 5 3\n1 5 2\n1 2 9\n1 2 9\n1 2 10\n1 5 7\n1 6 10\n1 10 9\n", "output": "7 10 2 4 7 10 3 7 9 9\n"}, {"input": "10\n7 9 4 4 7 6 3 7 9 8\n10\n1 3 2\n1 10 5\n1 5 3\n1 5 2\n1 2 9\n1 2 7\n1 2 10\n1 5 7\n1 6 10\n1 10 9\n", "output": "7 10 2 4 7 10 3 7 9 9\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\nOne day Alex decided to remember childhood when computers were not too powerful and lots of people played onl... | [{"input": "21 10\n62637783*1\n23*51**531\n35*7*6.**.\n.*3***581*\n2.32*745**\n83*7*6*6*5\n*74.**6**3\n323*6**7*6\n3454*67.*1\n**63265*6*\n3725*4553*\n24****5**4\n23.34****4\n55257*1*4*\n4*3253*456\n**.3*45488\n*7318**4*5\n234.*4557*\n12..21*.*3\n286.235*4*\n834*11*.3*\n", "output": "NO\n"}, {"input": "21 10\n62637783*... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 k-multiple free set is a set of integers where there is no pair of integers where one is equal to another i... | [{"input": "100 2\n191 17 61 40 77 95 128 88 26 69 79 10 131 106 142 152 68 39 182 53 83 81 6 89 65 148 33 22 5 47 107 121 52 163 150 158 189 118 75 180 177 176 112 167 140 184 29 166 25 46 169 145 187 123 196 18 115 126 155 100 63 58 159 19 173 113 133 60 130 161 76 157 93 199 50 97 15 67 109 164 99 149 3 137 153 136 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 integers. The i-th integer is a_i. Find the number, modulo 998244353, of ways to paint each o... | [{"input": "20\n3\n1\n1\n1\n5\n14\n1\n2\n5\n3\n5\n8\n10\n1\n9\n3\n2\n3\n18\n4", "output": "100507388\n"}, {"input": "20\n3\n1\n1\n1\n5\n14\n1\n2\n5\n3\n5\n8\n10\n2\n9\n3\n3\n3\n18\n4", "output": "139231148\n"}, {"input": "20\n3\n1\n2\n1\n5\n9\n3\n2\n6\n2\n0\n8\n14\n1\n16\n3\n0\n3\n1\n4", "output": "883576933\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\n<image>\n\nInput\n\nThe input contains a single integer a (1 β€ a β€ 18257).\n\nOutput\n\nPrint a single intege... | [{"input": "15000\n", "output": "1349910001\n"}, {"input": "16344\n", "output": "1602659953\n"}, {"input": "13170\n", "output": "1040614381\n"}, {"input": "15302\n", "output": "1404815413\n"}, {"input": "16331\n", "output": "1600111381\n"}, {"input": "18257\n", "output": "1999798753\n"}, {"input": "15479\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\n*Are you a file extension master? Let's find out by checking if Bill's files are images or audio files. Pleas... | [{"input": "\"Nothing Else Matters.mp3\"", "output": "[false]", "fn_name": "is_audio"}, {"input": "\"NothingElseMatters.mp3\"", "output": "[true]", "fn_name": "is_audio"}, {"input": "\" Amon Tobin.alac\"", "output": "[false]", "fn_name": "is_audio"}, {"input": "\"DaftPunk.FLAC\"", "output": "[false]", "fn_name": "is_au... | 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\nWe have N+M balls, each of which has an integer written on it.\n\nIt is known that: \n - The numbers written... | [{"input": "100 100\n", "output": "9900\n"}, {"input": "-1 -173", "output": "15052\n"}, {"input": "-1 -295", "output": "43661\n"}, {"input": "560 1", "output": "156520\n"}, {"input": "-1 -118", "output": "7022\n"}, {"input": "0 -295", "output": "43660\n"}, {"input": "91 59\n", "output": "5806\n"}, {"input": "85 60\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 array $a$ of length $n$, and an integer $x$. You can perform the following operation as many... | [{"input": "1\n20 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "20000000000 20000000000\n"}, {"input": "1\n20 1\n1000000000 1000... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBy 2312 there were n Large Hadron Colliders in the inhabited part of the universe. Each of them corresponded ... | [{"input": "1 100\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+ 1\n- 1\n+... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThroughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the viru... | [{"input": "446237720 920085248 296916273 439113596\n", "output": "1\n"}, {"input": "491259590 529594367 305425951 326414536\n", "output": "1\n"}, {"input": "960442940 572344654 77422042 406189391\n", "output": "1\n"}, {"input": "609162932 300548167 21640850 411089609\n", "output": "2\n"}, {"input": "191971162 30611272... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFind the intersection of two sets $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ and $B = \\\\{b_0, b_1, ..., b_{m-1}... | [{"input": "4\n-1 3 10 3\n8\n-1 1 10 13 14", "output": "-1\n10\n"}, {"input": "4\n0 2 5 12\n5\n0 3 5 10 12", "output": "0\n5\n12\n"}, {"input": "4\n0 3 10 8\n8\n0 1 10 16 14", "output": "0\n10\n"}, {"input": "4\n-1 2 5 12\n5\n0 3 5 10 12", "output": "5\n12\n"}, {"input": "4\n0 2 5 8\n5\n0 2 5 29 14", "output": "0\n2\n5... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given n... | [{"input": "100\n44 40 6 40 56 90 98 8 36 64 76 86 98 76 36 92 6 30 98 70 24 98 96 60 24 82 88 68 86 96 34 42 58 10 40 26 56 10 88 58 70 32 24 28 14 82 52 12 62 36 70 60 52 34 74 30 78 76 10 16 42 94 66 90 70 38 52 12 58 22 98 96 14 68 24 70 4 30 84 98 8 50 14 52 66 34 100 10 28 100 56 48 38 12 38 14 91 80 70 86\n", "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\nYou had $n$ positive integers $a_1, a_2, \\dots, a_n$ arranged in a circle. For each pair of neighboring numb... | [{"input": "1\nNEEEEEEEEEEEEEEEEEEEEEEEEEEEEENNNNEENNE\n", "output": "YES\n"}, {"input": "1\nNEEEEEEEEEEEEEEEEEEEEEEEEEEEEENNNNEENNE\n", "output": "YES\n"}, {"input": "1\nNEEEEEEEFEEEEEEEEEEEEEEEEEEEEENNNNEENNE\n", "output": "YES\n"}, {"input": "1\nNEEFEEEEFEEEEEEEEEEEEEEEEEEEEENNNNEENNE\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\nAn element in an array is dominant if it is greater than all elements to its right. You will be given an arra... | [{"input": "[67, 54, 27, 85, 66, 88, 31, 24, 49]", "output": "[[88, 49]]", "fn_name": "solve"}, {"input": "[104, 18, 37, 9, 36, 47, 28]", "output": "[[104, 47, 28]]", "fn_name": "solve"}, {"input": "[16, 17, 14, 3, 14, 5, 2]", "output": "[[17, 14, 5, 2]]", "fn_name": "solve"}, {"input": "[92, 52, 93, 31, 89, 87, 77, 10... | 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 still have partial information about the score during the historic football match. You are given a set of... | [{"input": "11\n1 100000000\n200000000 100000000\n200000000 300000000\n400000000 300000000\n400000000 500000000\n600000000 639960479\n618182416 700000000\n800000000 700000000\n800000000 900000000\n1000000000 900000000\n1000000000 1000000000\n", "output": "100000011\n"}, {"input": "11\n1 100000000\n200000000 100000100\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\nAs a part of this Kata, you need to create a function that when provided with a triplet, returns the index of... | [{"input": "[-0.41, -23, 4]", "output": "[0]", "fn_name": "gimme"}, {"input": "[-15, -10, 14]", "output": "[1]", "fn_name": "gimme"}, {"input": "[15, 10, 14]", "output": "[2]", "fn_name": "gimme"}, {"input": "[5, 10, 14]", "output": "[1]", "fn_name": "gimme"}, {"input": "[2, 3, 1]", "output": "[0]", "fn_name": "gimme"}... | 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\nHow many multiples of d are there among the integers between L and R (inclusive)?\n\nConstraints\n\n* All val... | [{"input": "-1 110 1", "output": "112\n"}, {"input": "-1 111 1", "output": "113\n"}, {"input": "-1 101 1", "output": "103\n"}, {"input": "12 139 1", "output": "128\n"}, {"input": "12 152 1", "output": "141\n"}, {"input": "12 191 1", "output": "180\n"}, {"input": "11 191 1", "output": "181\n"}, {"input": "11 167 1", "ou... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an array $a$, consisting of $n$ positive integers.\n\nLet's call a concatenation of numbers $x$... | [{"input": "100 3\n14717 1461 5753 7023 6804 1826 8793 9148 9920 240 8768 15059 11439 2732 794 959 9744 2253 3273 4685 4730 6873 11982 2875 1303 2535 4901 147 8587 339 4792 154 3104 6020 10358 5537 2686 6208 9494 1826 8083 1269 1841 6210 538 3105 4092 5163 9696 9013 2153 3985 2787 4471 1170 4991 4059 6047 7181 14053 48... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAndrii is good in Math, but not in Programming. He is asking you to solve following problem: Given an integer... | [{"input": "17 5\n5\n4\n9\n32\n1", "output": "0\n0\n0\n14\n0\n"}, {"input": "10 5\n19\n-1\n2\n0\n0", "output": "8\n0\n0\n0\n0\n"}, {"input": "12 5\n5\n4\n14\n18\n1", "output": "0\n0\n1\n5\n0\n"}, {"input": "21 5\n5\n4\n9\n32\n1", "output": "0\n0\n0\n10\n0\n"}, {"input": "12 5\n1\n4\n17\n32\n0", "output": "0\n0\n4\n5\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\nA bracket sequence is a string that is one of the following:\n - An empty string;\n - The concatenation of (,... | [{"input": "4\n((()))\n((((((\n))))))\n()()()\n", "output": "Yes\n"}, {"input": "4\n((()))\n((((((\n))))))\n)()()(", "output": "Yes\n"}, {"input": "4\n)))(((\n((((((\n))))))\n)()()(", "output": "Yes\n"}, {"input": "4\n((())(\n(()(()\n))))))\n)((()(", "output": "Yes\n"}, {"input": "4\n())(((\n(()(()\n))))))\n()((()", "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\nD: Sontaku (Surmise)\n\nSome twins like even numbers.\n\nCount how many even numbers are in $ N $ integers $ ... | [{"input": "5\n5 12 0 2 18", "output": "4\n"}, {"input": "5\n2 12 0 2 18", "output": "5\n"}, {"input": "5\n5 12 1 2 12", "output": "3\n"}, {"input": "5\n5 12 1 2 18", "output": "3\n"}, {"input": "5\n4 12 0 2 18", "output": "5\n"}, {"input": "5\n5 12 1 0 18", "output": "3\n"}, {"input": "5\n1 12 0 2 18", "output": "4\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\nProgram a function `sumAverage(arr)` where `arr` is an array containing arrays full of numbers, for example:\... | [{"input": "[[41, 16, 99, 93, 59, 18, 35, 23, 55, 45, 38, 39, 74, 60, 95, 44, 59, 70, 44, 89, 90, 19, 23, 67, 65, 66, 41, 89, 49, 22, 23, 47, 60, 12, 59, 58, 25, 69, 66, 82, 53, 41, 51, 69, 78, 18, 17, 44, 74, 96, 46, 73, 22, 37, 95, 32, 62, 49, 8, 88, 59, 66, 23, 10, 61, 28, 11, 99, 27, 98, 8, 18, 73, 18, 61, 25, 60, ... | 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# Definition\n\nA **number** is called **_Automorphic number_** if and only if *its square ends in the same d... | [{"input": "625", "output": "[\"Automorphic\"]", "fn_name": "automorphic"}, {"input": "25", "output": "[\"Automorphic\"]", "fn_name": "automorphic"}, {"input": "76", "output": "[\"Automorphic\"]", "fn_name": "automorphic"}, {"input": "1", "output": "[\"Automorphic\"]", "fn_name": "automorphic"}, {"input": "6", "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\nThe pizza store wants to know how long each order will take. They know:\n\n- Prepping a pizza takes 3 mins\n-... | [{"input": "13\n0\n0", "output": "[39.5]", "fn_name": "order"}, {"input": "3\n1\n2", "output": "[14.5]", "fn_name": "order"}, {"input": "2\n0\n0", "output": "[13]", "fn_name": "order"}, {"input": "0\n3\n2", "output": "[19]", "fn_name": "order"}, {"input": "6\n2\n4", "output": "[26]", "fn_name": "order"}, {"input": "6\n... | 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\nPolycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polyc... | [{"input": "SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS\n100 100 100\n100 100 100\n1000000000000\n", "output": "100000001\n"}, {"input": "SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS\n100 100 100\n100 100 10... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a string $s$. Each character is either 0 or 1.\n\nYou want all 1's in the string to form a cont... | [{"input": "7\n0\n0\n0\n0\n0\n0\n0\n", "output": "0\n0\n0\n0\n0\n0\n0\n"}, {"input": "7\n0\n0\n0\n0\n0\n0\n0\n", "output": "0\n0\n0\n0\n0\n0\n0\n"}, {"input": "7\n0\n0\n0\n0\n1\n0\n0\n", "output": "0\n0\n0\n0\n0\n0\n0\n"}, {"input": "3\n010011\n0\n1111000\n", "output": "2\n0\n0\n"}, {"input": "3\n010011\n0\n1101000\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\nComplete the function that calculates the derivative of a polynomial. A polynomial is an expression like: 3x^... | [{"input": "\"-1000x^7+200x^4+6x^2+x+1000\"", "output": "[\"-7000x^6+800x^3+12x+1\"]", "fn_name": "derivative"}, {"input": "\"100x^5+12x^3-3x-3\"", "output": "[\"500x^4+36x^2-3\"]", "fn_name": "derivative"}, {"input": "\"10x^9+10x^3+10x\"", "output": "[\"90x^8+30x^2+10\"]", "fn_name": "derivative"}, {"input": "\"-x^5-x... | 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 telephone number is a sequence of exactly $11$ digits such that its first digit is 8.\n\nVasya and Petya ar... | [{"input": "109\n8800880880088088880888808880888088800880888088088088888080880000080000800000808008008800080008000888000808880\n", "output": "YES\n"}, {"input": "109\n8800880880088088880888808880888088800880888088088088888080880000080000800000808008008800080008000888000808880\n", "output": "YES\n"}, {"input": "109\n194... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 data that records the customer number of the business partner and the trading date on a monthly basi... | [{"input": "123,10\n56,12\n35,14\n\n123,3\n56,4\n123,5", "output": "56 2\n123 3\n"}, {"input": "123,10\n56,12\n45,13\n\n113,4\n56,4\n123,5", "output": "56 2\n123 2\n"}, {"input": "123,10\n57,12\n35,14\n\n123,3\n57,4\n123,5", "output": "57 2\n123 3\n"}, {"input": "213,10\n56,02\n35,14\n\n213,4\n56,4\n113,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 is a string S consisting of `0` and `1`. Find the number of strings, modulo 998244353, that can result ... | [{"input": "11101111011111000000000110000001111100011111000000001101111110000000111111111", "output": "323558395\n"}, {"input": "11101111011101000000000110000001111100011111000000001101111110000000111111111", "output": "979142942\n"}, {"input": "11101111011100000000000110000001110100011111000000001101111110000000111111... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the score... | [{"input": "1000 993 1000\n176\n400\n733\n753\n822\n429\n929\n697\n176\n191\n80\n247\n40\n891\n773\n889\n453\n777\n451\n40\n120\n222\n697\n906\n441\n251\n324\n193\n970\n558\n824\n390\n824\n36\n209\n120\n849\n548\n393\n668\n561\n289\n560\n970\n575\n53\n154\n931\n750\n404\n478\n120\n542\n98\n551\n390\n614\n822\n600\n238\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn a small town the population is `p0 = 1000` at the beginning of a year. The population\nregularly increases... | [{"input": "1500000\n0.25\n-1000\n2000000", "output": "[151]", "fn_name": "nb_year"}, {"input": "1500000\n2.5\n10000\n2000000", "output": "[10]", "fn_name": "nb_year"}, {"input": "1500000\n0.25\n1000\n2000000", "output": "[94]", "fn_name": "nb_year"}, {"input": "1500000\n0.0\n10000\n2000000", "output": "[50]", "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\nSalve, mi amice.\n\nEt tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non... | [{"input": "100 100 100 100 100\n", "output": "14\n"}, {"input": "100 100 100 100 100\n", "output": "14\n"}, {"input": "100 110 100 100 100\n", "output": "14\n"}, {"input": "100 110 100 110 100\n", "output": "15\n"}, {"input": "60 120 82 71 53\n", "output": "10\n"}, {"input": "64 134 69 96 92\n", "output": "13\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\nThere is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of intege... | [{"input": "abcdefghijklmnopqrstuvwxyz0987654321abcdefghijklmnopqrstuvwxyz0987654321abcdefghijklmnopqrstuvwxyz0987654321\n", "output": "324\n"}, {"input": "1234567890zyxwvutsrqponmlkjihgfedcba1234567890zyxwvutsrqponmlkjihgfedcba1234567890zyxwvutsrqponmlkjihgfedcba\n", "output": "324\n"}, {"input": "abcdeffhijklmnopqsst... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 binary string $s$.\n\nFind the number of distinct cyclical binary strings of length $n$ which... | [{"input": "40\n1111110111111111111111011111111111111110\n", "output": "40\n"}, {"input": "40\n0000000000100000100000000000000000000000\n", "output": "40\n"}, {"input": "40\n0000010010000000000001000110000001010100\n", "output": "40\n"}, {"input": "40\n1111111111111011111111101111111111111111\n", "output": "40\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\nThe University of Aizu has a park covered with grass, and there are no trees or buildings that block the sunl... | [{"input": "10 1\n10\n2 6 6 3 1 2 -1 2 4 0 1 8 5 9 7 9 8 9 6 3\n6 1\n10\n10 2 5 3 1 2 0 12 4 6 1 4 9 9 11 12 8 6 14 0\n0 0", "output": "NA\nNA\n"}, {"input": "10 1\n10\n2 6 6 3 1 2 -1 2 4 0 1 8 5 9 7 9 8 9 6 3\n6 1\n10\n10 2 5 3 1 2 0 12 4 6 1 4 9 9 17 12 8 6 14 0\n0 0", "output": "NA\nNA\n"}, {"input": "10 1\n10\n2 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\nAn array is defined to be `odd-heavy` if it contains at least one odd element and every element whose value i... | [{"input": "[0, 1, 2, 3, 4, 0, -2, -1, -4, -3]", "output": "[false]", "fn_name": "is_odd_heavy"}, {"input": "[-1, 1, -2, 2, -2, -2, -4, 4]", "output": "[false]", "fn_name": "is_odd_heavy"}, {"input": "[1, -1, 2, -2, 3, -3, 0]", "output": "[false]", "fn_name": "is_odd_heavy"}, {"input": "[-3, 2, 1, 3, -1, -2]", "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\nVus the Cossack has two binary strings, that is, strings that consist only of \"0\" and \"1\". We call these ... | [{"input": "10010110100000101100\n11001\n", "output": "10\n"}, {"input": "10010110100000101100\n10011\n", "output": "10\n"}, {"input": "10010110100000101100\n00010\n", "output": "10\n"}, {"input": "10010110100000101100\n01011\n", "output": "10\n"}, {"input": "10010110100000101100\n00001\n", "output": "10\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 a total of A + B cats and dogs.\nAmong them, A are known to be cats, but the remaining B are not kn... | [{"input": "-1 -1 10", "output": "NO\n"}, {"input": "-2 -1 10", "output": "NO\n"}, {"input": "-3 -1 10", "output": "NO\n"}, {"input": "-3 -1 17", "output": "NO\n"}, {"input": "-5 -1 11", "output": "NO\n"}, {"input": "-9 -1 11", "output": "NO\n"}, {"input": "-14 -1 2", "output": "NO\n"}, {"input": "-14 -1 3", "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\nColonel has n badges. He wants to give one badge to every of his n soldiers. Each badge has a coolness factor... | [{"input": "50\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\n", "output": "1225\n"}, {"input": "50\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWater Country Water Deven has n cities. Each city is surrounded by water and looks like an island country. Wa... | [{"input": "5 6\n0 2 0\n0 1 0\n2 3 16\n1 3 2\n3 4 5\n0 0 1\n3 3\n0 2 3\n2 0 3\n0 1 12\n0 0", "output": "7\n15\n"}, {"input": "5 6\n0 0 1\n2 2 3\n2 3 12\n0 3 0\n2 4 14\n1 3 4\n3 3\n0 2 3\n1 0 3\n0 1 1\n0 0", "output": "30\n4\n"}, {"input": "5 6\n0 0 1\n2 2 3\n2 3 12\n0 3 0\n2 4 18\n1 3 4\n3 3\n0 2 3\n1 0 3\n0 1 1\n0 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 problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1β¦iβ¦... | [{"input": "740", "output": "2\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\n"}, {"input": "370", "output": "1\n2\n3\n4\n5\n6\n7\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n"}, {"input": "296", "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\nRead problems statements in Mandarin Chinese and Russian as well. \n\nYou are given a transparent three-dimen... | [{"input": "1 2 0\n-1 5\n0 0\n-1 0", "output": "Impossible\n"}, {"input": "4 2 0\n-2 5\n0 1\n0 -1", "output": "Impossible\n"}, {"input": "3 2 0\n-2 5\n0 1\n0 -1", "output": "Impossible\n"}, {"input": "1 2 3\n0 1\n1 1\n-1 0", "output": "Impossible\n"}, {"input": "1 2 3\n0 1\n1 0\n-1 0", "output": "Impossible\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\nYour task in order to complete this Kata is to write a function which formats a duration, given as a number o... | [{"input": "242062374", "output": "[\"7 years, 246 days, 15 hours, 32 minutes and 54 seconds\"]", "fn_name": "format_duration"}, {"input": "205851834", "output": "[\"6 years, 192 days, 13 hours, 3 minutes and 54 seconds\"]", "fn_name": "format_duration"}, {"input": "253374061", "output": "[\"8 years, 12 days, 13 hours,... | 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've made it through the moat and up the steps of knowledge. You've won the temples games and now you're hu... | [{"input": "11", "output": "[\"X X\\n X X\\n X X\\n X X\\n X X\\n X\\n X X\\n X X\\n X X\\n X X\\nX X\\n\"]", "fn_name": "mark_spot"}, {"input": "5", "output": "[\"X X\\n X... | 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\nVasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do,... | [{"input": "12\n35345 58181 32223 84621 35905 73863 99537 30666 67771 39229 36847 29038\n23\n55052824\n82504840\n35160556\n78141700\n73401989\n86305919\n39430705\n31939373\n23501765\n4406029\n61436920\n14295390\n34275309\n28028753\n91433780\n70158847\n2396455\n66994588\n84024224\n30175981\n34941071\n118223886\n76605341... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 JOI Railways is the only railway company in the Kingdom of JOI. There are $N$ stations numbered from $1$ ... | [{"input": "10 3 1\n10 6 -1\n10\n-1\n1\n10", "output": "3\n"}, {"input": "10 3 5\n3 2 6\n79\n-1\n13\n10", "output": "11\n"}, {"input": "16 3 10\n10 3 6\n16\n2\n11\n11", "output": "2\n"}, {"input": "10 3 1\n10 6 -1\n51\n-1\n1\n10", "output": "7\n"}, {"input": "8 3 1\n10 11 -1\n65\n0\n10\n13", "output": "7\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\nSnuke has decided to play with N cards and a deque (that is, a double-ended queue).\nEach card shows an integ... | [{"input": "2000 1000\n", "output": "674286644\n"}, {"input": "1862 1782\n", "output": "833498751\n"}, {"input": "1999 1223\n", "output": "472460308\n"}, {"input": "2000 1073\n", "output": "303581106\n"}, {"input": "2000 2000\n", "output": "319838403\n"}, {"input": "1058 839\n", "output": "176907232\n"}, {"input": "189... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 positive integers are lucky if their decimal representation d... | [{"input": "30031570122539810394917235521810308756951528310540001786873013276929170093903592140501464021419065914012638320445831511113616470715362861617746753830753466417401868324537734863867785800605235651632883839976995020705498271231449454388975049026825387016009535745686407525035073547430120652345917209266590096502... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 and $m$ clubs in a college. The clubs are numbered from $1$ to $m$. Each student has a... | [{"input": "20 20\n0 0 3 2 1 2 2 3 2 2 1 1 0 3 0 0 1 1 1 3\n15 1 20 13 6 12 16 8 3 14 10 5 18 17 4 9 2 11 7 19\n20\n2\n10\n7\n4\n6\n5\n14\n8\n9\n18\n13\n11\n19\n1\n16\n20\n17\n12\n15\n3\n", "output": "4\n4\n4\n4\n4\n4\n4\n4\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n0\n0\n"}, {"input": "20 20\n0 0 3 2 1 2 2 3 2 2 1 1 0 3 0 0 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\nA professor invented Cookie Breeding Machine for his students who like cookies very much.\n\nWhen one cookie ... | [{"input": "3\n3 0\n4 108\n2 10", "output": "254\n400\n244\n"}, {"input": "3\n3 0\n2 108\n2 10", "output": "254\n146\n244\n"}, {"input": "3\n3 1\n4 108\n2 10", "output": "255\n400\n244\n"}, {"input": "3\n3 1\n4 108\n2 13", "output": "255\n400\n241\n"}, {"input": "3\n6 0\n2 108\n2 10", "output": "762\n146\n244\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# Task\n You know the slogan `p`, which the agitators have been chanting for quite a while now. Roka has hear... | [{"input": "\"dhgusdlifons\"\n\"lifonsssdlifonsgusdlifonssnsdlifonsslifonsifonsdlifonsfonsifons\"", "output": "[13]", "fn_name": "slogans"}, {"input": "\"erjernhxvbqfjsj\"\n\"ernhxvbqfjsjjrnhxvbqfjsjjernhxvbqfjsj\"", "output": "[4]", "fn_name": "slogans"}, {"input": "\"mcoecqwmjdudc\"\n\"dcoecqwmjdudcdcudc\"", "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\nHello! Your are given x and y and 2D array size tuple (width, height) and you have to:\nCalculate the accordi... | [{"input": "1\n5\n[4, 6]", "output": "[21]", "fn_name": "to_1D"}, {"input": "2\n3\n[4, 6]", "output": "[14]", "fn_name": "to_1D"}, {"input": "0\n0\n[3, 3]", "output": "[0]", "fn_name": "to_1D"}, {"input": "1\n1\n[3, 3]", "output": "[4]", "fn_name": "to_1D"}, {"input": "2\n2\n[3, 3]", "output": "[8]", "fn_name": "to_1D"... | 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\nAnn and Borya have n piles with candies and n is even number. There are a_{i} candies in pile with number i.\... | [{"input": "100\n444272562 25 25 0 49 73291074 64 100 638092144 756033694 0 700405846 16 25 25 100 36 25 269573395 288578186 366853675 36 81 49 4 0 25 49 9 64 0 4 36 36 49 0 64 64 532899768 1 64 9 549673690 25 64 4 817183855 25 146555318 36 495564252 100 49 9 36 100 49 100 4 100 9 64 9 432227412 756728309 25 0 33207251... | code_stdio |
[
{
"content": "You are an expert Python programmer. 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 system is transmitting messages in binary, however it is not a perfect transmission, and sometimes errors w... | [{"input": "2\n3\n\"11111010001\"", "output": "[\"11111010001\"]", "fn_name": "correct"}, {"input": "2\n3\n\"11011010001\"", "output": "[\"11111010001\"]", "fn_name": "correct"}, {"input": "2\n3\n\"11111011001\"", "output": "[\"11111010001\"]", "fn_name": "correct"}, {"input": "2\n3\n\"11111010011\"", "output": "[\"111... | code_functional |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.