messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Jimbo, an applied mathematician, needs to calculate matrices all day for solving his own problems. In his laboratory, he uses an excellent application program for manipulating matrix expressions, however, he cannot us... | [{"type": "stdin_stdout", "input": "1\nA=[1 2 3;4 5 6].\n1\nA=[[1 2 3;4 5 6] [7 8;9 10] [11;12];13 14 15 16 17 18].\n3\nB=[3 -2 1;-9 8 7].\nC=([1 2 3;4 5 6]+B)(2,3).\nD=([1 0 3;4 5 6]+B)([1 2],[2 3]).\n5\nA=2*[1 2;-3 4]'.\nB=A([2 1 2],[2 1]).\nA=[1 2;3 4]*3.\nA=[2]*[1 3;2 4].\nA=[1 2;3 4]*[3].\n2\nA=[11 12 13;0 22 23;0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday there is going to be an unusual performance at the circus — hamsters and tigers will perform together! All of them stand in circle along the arena edge and now the trainer faces a difficult task: he wants to swap th... | [{"type": "stdin_stdout", "input": "178\nTTTTTTHTHHHTHHTHHHHTTTHTHTTHTHHHTHTTTTHHTTHHHTTHHTTHHTTHHHHHTHHTTHTHHTTHHTTTTTTTTTHTHTTHTHHTHHHHHHTTTHTHHHHTHHTTHHHHTTTTTTTTHHHTHHHTHTHHHTTTTTHTHTTTHTHHTTHTTTHHHHHTTHTTHTTTHTHHHT\n", "output": "40\n"}, {"type": "stdin_stdout", "input": "178\nTTTTTTHTHHHTHHTHHHHTTTHTHTTHTHHHTHTTT... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou need to find if a number can be expressed as sum of two perfect powers. That is, given x find if there exists non negative integers a, b, m, n such that a^m + b^n = x. \n\nInput\nFirst line of the input contains numbe... | [{"type": "stdin_stdout", "input": "20\n9783\n879497\n203664\n981484\n588099\n299151\n782262\n108971\n368524\n643461\n815444\n33663\n479878\n908619\n879890\n768921\n703812\n628957\n849817\n569957\n", "output": "Yes\nNo\nYes\nYes\nYes\nNo\nNo\nYes\nNo\nYes\nNo\nYes\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.\n\nCreate a program that reads the list of participant numbers and the number of fish caught and outputs the number of win... | [{"type": "stdin_stdout", "input": "6\n1 14\n2 17\n3 131\n4 11\n4 61\n6 66", "output": "3 131\n"}, {"type": "stdin_stdout", "input": "6\n1 14\n2 25\n3 126\n4 11\n4 40\n6 66", "output": "3 126\n"}, {"type": "stdin_stdout", "input": "6\n1 14\n2 17\n3 169\n4 11\n4 61\n6 66", "output": "3 169\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a garden consisting entirely of grass and weeds. Your garden is described by an n × m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (... | [{"type": "stdin_stdout", "input": "3 150\nGGGWGGGGWWGGGGGGGGGGGGGWGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGWGGGGGGGWGGGGGGGGGGGGGGGGGWGGGGGGGGGGGGGGGGGGW\nGGGGGGGGGGGGWGGGGGGGGGWGGGGGGGGGGGGWGGGGGWGGGGGGGWGGGGGGGWGGGGGWGGGGGGGGGGGGGGGGGGGGGGGGWGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSomething happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found tha... | [{"type": "stdin_stdout", "input": "100\n23 64 60 -45 -36 -64 -59 15 -75 69 -30 -7 -20 17 -77 58 93 -76 -121 -34 -31 16 -50 6 -20 -85 1 64 -88 -8 -15 -6 -57 25 91 10 2 -90 74 -66 -42 73 28 49 -85 30 96 79 -25 49 -59 -89 -75 14 -96 -33 -65 -8 -100 -81 17 99 -91 -5 7 -21 1 85 63 86 -26 85 -31 11 -75 35 -82 15 98 93 -55 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA little weird green frog speaks in a very strange variation of English: it reverses sentence, omitting all puntuation marks `, ; ( ) - ` except the final exclamation, question or period. We urgently need help with build... | [{"input": "\"green, red or orange - we all just frogs, do not you think so?\"", "output": "[\"so think you not do frogs just all we orange or red green?\"]", "fn_name": "frogify"}, {"input": "\"multisentence is good. is not it?\"", "output": "[\"good is multisentence. it not is?\"]", "fn_name": "frogify"}, {"input": "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour task is to calculate the distance between two $n$ dimensional vectors $x = \\\\{x_1, x_2, ..., x_n\\\\}$ and $y = \\\\{y_1, y_2, ..., y_n\\\\}$.\n\nThe Minkowski's distance defined below is a metric which is a genera... | [{"type": "stdin_stdout", "input": "3\n109 25 10\n-1 -3 -3", "output": "151.000000\n114.249726\n110.661278\n110.000000\n"}, {"type": "stdin_stdout", "input": "3\n109 25 10\n0 -3 -3", "output": "150.000000\n113.287246\n109.673356\n109.000000\n"}, {"type": "stdin_stdout", "input": "3\n109 25 10\n-1 -3 0", "output": "148.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's consider a simplified version of order book of some stock. The order book is a list of orders (offers) from people that want to buy or sell one unit of the stock, each order is described by direction (BUY or SELL) a... | [{"type": "stdin_stdout", "input": "15\nADD 14944938\nADD 40032655\nACCEPT 14944938\nACCEPT 40032655\nADD 79373162\nACCEPT 79373162\nADD 55424250\nACCEPT 55424250\nADD 67468892\nACCEPT 67468892\nADD 51815959\nADD 13976252\nADD 2040654\nADD 74300637\nACCEPT 51815959\n", "output": "32\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word... | [{"type": "stdin_stdout", "input": "183\n", "output": "bon\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "hon\n"}, {"type": "stdin_stdout", "input": "440\n", "output": "pon\n"}, {"type": "stdin_stdout", "input": "438\n", "output": "pon\n"}, {"type": "stdin_stdout", "input": "575\n", "output": "hon\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a standard english sentence passed in as a string, write a method that will return a sentence made up of the same words, but sorted by their first letter. However, the method of sorting has a twist to it:\n* All wor... | [{"input": "\"Only themselves understand themselves and the like of themselves, As souls only understand souls\"", "output": "[\"and like of only souls souls the themselves themselves themselves understand understand Only As\"]", "fn_name": "pseudo_sort"}, {"input": "\"I, habitan of the Alleghanies, treating of him as ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence $a$ consisting of $n$ integers $a_1, a_2, \\dots, a_n$, and an integer $x$. Your task is to make the sequence $a$ sorted (it is considered sorted if the condition $a_1 \\le a_2 \\le a_3 \\le \\dot... | [{"type": "stdin_stdout", "input": "6\n4 1\n2 3 5 4\n5 6\n1 1 3 4 4\n1 10\n2\n2 10\n11 9\n2 10\n12 11\n5 18\n81 324 218 413 324\n", "output": "\n3\n0\n0\n-1\n1\n3\n"}, {"type": "stdin_stdout", "input": "6\n4 1\n2 3 5 4\n5 6\n1 1 3 4 4\n1 10\n2\n2 10\n11 9\n2 10\n12 11\n5 18\n81 324 218 413 324\n", "output": "3\n0\n0\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a secret message you need to decipher. Here are the things you need to know to decipher it:\n\nFor each word:\n- the second and the last letter is switched (e.g. `Hello` becomes `Holle`)\n- the first letter ... | [{"input": "\"87yh 99na 119e 110to 97ll 98e 108eki 116tah 119esi 111dl 98dri\"", "output": "[\"Why can we not all be like that wise old bird\"]", "fn_name": "decipher_this"}, {"input": "\"84eh 108sse 104e 115eokp 116eh 109ero 104e 104dare\"", "output": "[\"The less he spoke the more he heard\"]", "fn_name": "decipher_t... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the following numbers (where `n!` is `factorial(n)`):\n```\nu1 = (1 / 1!) * (1!)\nu2 = (1 / 2!) * (1! + 2!)\nu3 = (1 / 3!) * (1! + 2! + 3!)\n...\nun = (1 / n!) * (1! + 2! + 3! + ... + n!)\n```\n\nWhich will win: ... | [{"input": "10110", "output": "[1.000098]", "fn_name": "going"}, {"input": "113", "output": "[1.008929]", "fn_name": "going"}, {"input": "200", "output": "[1.005025]", "fn_name": "going"}, {"input": "523", "output": "[1.001915]", "fn_name": "going"}, {"input": "1011", "output": "[1.00099]", "fn_name": "going"}, {"input... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[Image] \n\nIt's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discusse... | [{"type": "stdin_stdout", "input": "433 3\nFZDDHMJGBZCHFUXBBPIEBBEFDWOMXXEPOMDGSMPIUZOMRZQNSJAVNATGIWPDFISKFQXJNVFXPHOZDAEZFDAHDXXQKZMGNSGKQNWGNGJGJZVVITKNFLVCPMZSDMCHBTVAWYVZLIXXIADXNYILEYNIQHKMOGMVOCWGHCWIYMPEPADSJAAKEGTUSEDWAHMNYJDIHBKHVUHLYGNGZDBULRXLSAJHPCMNWCEAAPYMHDTYWPADOTJTXTXUKLCHWKUSZRHEKQEFPVJEJJHRWCKYOIWAL... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought it... | [{"type": "stdin_stdout", "input": "5 10 15\nDdunkjly\n13 12 4\n83 26 1\n63 42 3\n83 22 2\n57 33 0\n59 10 1\n89 31 1\n57 17 2\n98 79 5\n46 41 3\nFbpbc\n28 21 0\n93 66 5\n66 21 0\n68 58 0\n59 17 3\n57 23 1\n72 71 1\n55 51 2\n58 40 5\n70 67 2\nKeiotmh\n73 44 4\n98 14 0\n19 7 0\n55 10 5\n30 25 4\n66 48 2\n66 51 4\n82 79 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMrs Jefferson is a great teacher. One of her strategies that helped her to reach astonishing results in the learning process is to have some fun with her students. At school, she wants to make an arrangement of her class ... | [{"input": "10", "output": "[[4, 3, 2, 1]]", "fn_name": "shortest_arrang"}, {"input": "14", "output": "[[5, 4, 3, 2]]", "fn_name": "shortest_arrang"}, {"input": "22", "output": "[[7, 6, 5, 4]]", "fn_name": "shortest_arrang"}, {"input": "65", "output": "[[33, 32]]", "fn_name": "shortest_arrang"}, {"input": "16", "output... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a table consisting of n rows and m columns.\n\nNumbers in each row form a permutation of integers from 1 to m.\n\nYou are allowed to pick two elements in one row and swap them, but no more than once for each... | [{"type": "stdin_stdout", "input": "20 8\n4 3 2 1 5 6 7 8\n1 2 3 4 8 7 6 5\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 4 5 6 7 8\n1 2 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function that returns the number of '2's in the factorization of a number. \nFor example,\n```python\ntwo_count(24)\n```\nshould return 3, since the factorization of 24 is 2^3 x 3\n```python\ntwo_count(17280)\n``... | [{"input": "482848428248882482", "output": "[1]", "fn_name": "two_count"}, {"input": "7777777777777777", "output": "[0]", "fn_name": "two_count"}, {"input": "222222222222", "output": "[1]", "fn_name": "two_count"}, {"input": "84934656", "output": "[20]", "fn_name": "two_count"}, {"input": "17280", "output": "[7]", "fn_... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have an array $a_1, a_2, \\dots, a_n$. \n\nLet's call some subarray $a_l, a_{l + 1}, \\dots , a_r$ of this array a subpermutation if it contains all integers from $1$ to $r-l+1$ exactly once. For example, array $a = [... | [{"type": "stdin_stdout", "input": "99\n1 2 3 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 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using t... | [{"type": "stdin_stdout", "input": "3 3 6\n1 2 499999999\n2 3 500000000\n1 3 948187054\n2 499999999\n2 500000000\n2 499999999\n3 999999999\n3 1000000000\n3 1000000000\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3 3 6\n1 2 499999999\n2 3 500000000\n1 2 999999999\n2 499999999\n2 500000000\n2 499999999\n3 999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a set of $N$ axis-aligned rectangular seals, find the number of overlapped seals on the region which has the maximum number of overlapped seals.\n\nConstraints\n\n* $ 1 \\leq N \\leq 100000 $\n* $ 0 \\leq x1_i < x2_... | [{"type": "stdin_stdout", "input": "3\n0 0 1 2\n0 0 2 2\n0 0 2 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n0 0 2 4\n0 0 2 2\n0 0 2 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n0 0 1 2\n0 0 2 3\n0 0 2 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n0 1 2 4\n0 0 2 2\n0 0 2 2", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of integers $a_1, a_2, \\ldots, a_n$ and an integer $x$.\n\nYou need to select the maximum number of elements in the array, such that for every subsegment $a_l, a_{l + 1}, \\ldots, a_r$ containing s... | [{"type": "stdin_stdout", "input": "10\n3\n-54528 42942 -6804\n-54528\n3\n18649 67840 -26344\n43244\n3\n13902 51617 -4691\n32759\n3\n77397 -38549 -51828\n-45188\n3\n21750 -55472 -47700\n-55472\n3\n59264 11044 -311\n35154\n3\n-13132 88555 -52791\n-13132\n3\n-82155 25593 -3193\n-28281\n3\n-1405 586 77255\n586\n3\n30756 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is 2050 and romance has long gone, relationships exist solely for practicality.\n\nMatchMyHusband is a website that matches busy working women with perfect house husbands. You have been employed by MatchMyHusband to wr... | [{"input": "[15, 24, 12]\n4", "output": "[\"No match!\"]", "fn_name": "match"}, {"input": "[11, 25, 36]\n1", "output": "[\"No match!\"]", "fn_name": "match"}, {"input": "[17, 31, 21]\n2", "output": "[\"No match!\"]", "fn_name": "match"}, {"input": "[35, 35, 29]\n0", "output": "[\"No match!\"]", "fn_name": "match"}, {"i... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.\n\nLet's assume that a... | [{"input": "\"WUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUABWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUBWUB\"", "output": "[\"WUAB\"]", "fn_name": "song_decoder"}, {"input": "\"WUBYYRTSMNWUWUBWUBWUBCWUBWUBWUBCWUBWUBWUBFSYUINDWOBVWUBWUBWUBFWU... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The $k$-th layer of the triangle contains $k$ points, numbered from left to r... | [{"type": "stdin_stdout", "input": "4\n3\n1 10 2\n1 3 1\n2\n4 7\n2 2\n2\n1 1000000000\n1 1000000000\n4\n3 18 5 8\n2 4 2 4\n", "output": "3\n2\n999999999\n7\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 10 2\n1 3 1\n2\n3 2\n2 2\n2\n1 1000000000\n1 1000000000\n4\n3 18 5 9\n2 4 2 4\n", "output": "3\n1\n999999999\n7\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi Lake has a perimeter of L. On the circumference of the lake, there is a residence of the lake's owner, Takahashi. Each point on the circumference of the lake has a coordinate between 0 and L (including 0 but not... | [{"type": "stdin_stdout", "input": "314159265 7\n35438742\n77271666\n139044510\n156626166\n160332356\n331169608\n453863319", "output": "1023255587\n"}, {"type": "stdin_stdout", "input": "314159265 7\n35438742\n77271666\n122238627\n156626166\n160332356\n331169608\n453863319", "output": "1040061470\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Vasya learned that, given two points with different x coordinates, you can draw through them exactly one parabola with equation of type y = x^2 + bx + c, where b and c are reals. Let's call such a parabola an U-s... | [{"type": "stdin_stdout", "input": "5\n1 0\n1 -1\n0 -1\n-1 0\n-1 -1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1\n-751115 -16747294\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n-751115 -11499666\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n-751115 -14990265\n", "output": "0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Valid HK Phone Number\n\n## Overview\n\nIn Hong Kong, a valid phone number has the format ```xxxx xxxx``` where ```x``` is a decimal digit (0-9). For example:\n\n## Task\n\nDefine two functions, ```isValidHKPhoneNumber... | [{"input": "\" 1234 5678 \"", "output": "[false]", "fn_name": "is_valid_HK_phone_number"}, {"input": "\"sklfjsdklfjsf\"", "output": "[false]", "fn_name": "is_valid_HK_phone_number"}, {"input": "\"3857 4756\"", "output": "[false]", "fn_name": "is_valid_HK_phone_number"}, {"input": "\"abcd efgh\"", "output": "[fal... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n```if-not:sql\nCreate a function (or write a script in Shell) that takes an integer as an argument and returns \"Even\" for even numbers or \"Odd\" for odd numbers.\n```\n\n```if:sql\n## SQL Notes:\nYou will be given a ta... | [{"input": "1545452", "output": "[\"Even\"]", "fn_name": "even_or_odd"}, {"input": "74156741", "output": "[\"Odd\"]", "fn_name": "even_or_odd"}, {"input": "100000", "output": "[\"Even\"]", "fn_name": "even_or_odd"}, {"input": "-456", "output": "[\"Even\"]", "fn_name": "even_or_odd"}, {"input": "-123", "output": "[\"Odd... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i r... | [{"type": "stdin_stdout", "input": "10\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n100.00000000 BTC\n", "output": "380000000.0\n"}, {"type": "stdin_stdout", "input": "10\n22.49891780 BTC\n59.00375526 B... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, you will be given a multi-dimensional array containing `2 or more` sub-arrays of integers. Your task is to find the maximum product that can be formed by taking any one element from each sub-array.\n\n```\nE... | [{"input": "[[-2, -15, -12, -8, -16], [-4, -15, -7], [-10, -5]]", "output": "[-40]", "fn_name": "solve"}, {"input": "[[-11, -6], [-20, -20], [18, -4], [-20, 1]]", "output": "[17600]", "fn_name": "solve"}, {"input": "[[14, 2], [0, -16], [-12, -16]]", "output": "[3584]", "fn_name": "solve"}, {"input": "[[-1, 2, -3, 4], [... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads the two dices constructed in the same way as Dice I, and determines whether these two dices are identical. You can roll a dice in the same way as Dice I, and if all integers observed from the s... | [{"type": "stdin_stdout", "input": "-2 2 -3 -1 461 1\n3 0 4 0 13 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 2 -3 -1 461 1\n3 0 4 0 13 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 2 -3 -1 461 1\n3 0 6 0 13 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 2 -3 -1 461 2\n3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Artyom decided to study probability theory. He found a book with a lot of nice exercises and now wants you to help him with one of them.\n\nConsider two dices. When thrown each dice shows some integer from 1 to n i... | [{"type": "stdin_stdout", "input": "8\n0.09597231 0.11315755 0.32077119 0.22643005 0.03791746 0.04296694 0.10284494 0.05993956\n0.52402769 0.19814245 0.20452881 0.06686995 0.00468254 0.00103306 0.00055506 0.00016044\n", "output": "0.29869999999999886 0.07920000000000116 0.32760000000000133 0.0734999999999989 0.02229999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's \"Black Square\", Polycarp wants to paint minimum possible number of whit... | [{"type": "stdin_stdout", "input": "20 10\nWWBWWWBBWW\nWWWWWBWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWBBBWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWBWWWWWBWW\nWBWWBWWWBW\nWWBWBWWWWW\nWWWBWWBBWW\nWWBBWBWBWW\nBBWWWWWBWW\nWWBWWBBBWW\nWWWBWBBWWW\nWWWBBWBWWW\nWWWWWWWWWW\nWWWBWWWWWW\nWWWWWWWWWW\n", "output": "-1\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a computer card game called Splay the Sire. Currently you are struggling to defeat the final boss of the game.\n\nThe boss battle consists of $n$ turns. During each turn, you will get several cards. Each c... | [{"type": "stdin_stdout", "input": "5\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 100\n1 1\n1 1\n", "output": "211\n"}, {"type": "stdin_stdout", "input": "5\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 1\n1 1\n1 1\n3\n1 100\n1 1\n1 1\n", "output": "211\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a triangle of consecutive odd numbers:\n\n```\n 1\n 3 5\n 7 9 11\n 13 15 17 19\n21 23 25 27 29\n...\n```\n\nfind the triangle's row knowing its index (the... | [{"input": "93", "output": "[[8557, 8559, 8561, 8563, 8565, 8567, 8569, 8571, 8573, 8575, 8577, 8579, 8581, 8583, 8585, 8587, 8589, 8591, 8593, 8595, 8597, 8599, 8601, 8603, 8605, 8607, 8609, 8611, 8613, 8615, 8617, 8619, 8621, 8623, 8625, 8627, 8629, 8631, 8633, 8635, 8637, 8639, 8641, 8643, 8645, 8647, 8649, 8651, 86... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.\n\nCodesorfes has rounds of two types: Div1 (for advanced coders)... | [{"type": "stdin_stdout", "input": "1122 54\n2 1031\n1 363 364\n1 14 15\n1 902 903\n1 1052 1053\n2 170\n2 36\n2 194\n1 340 341\n1 1018 1019\n1 670 671\n1 558 559\n2 431\n2 351\n2 201\n1 1104 1105\n2 1056\n2 823\n1 274 275\n2 980\n1 542 543\n1 807 808\n2 157\n2 895\n1 505 506\n2 658\n1 484 485\n1 533 534\n1 384 385\n2 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is different from the hard version. In this version Ujan makes exactly one exchange. You can hack this problem only if you solve both problems.\n\nAfter struggling and failing many times, Ujan decided to try ... | [{"type": "stdin_stdout", "input": "10\n11\nartiovnldnp\nartiovsldsp\n2\naa\nzz\n2\naa\nxy\n2\nab\nba\n2\nza\nzz\n3\nabc\nbca\n16\naajjhdsjfdsfkadf\naajjhjsjfdsfkajf\n2\nix\nii\n2\noo\nqo\n2\npp\npa\n", "output": "Yes\nYes\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\n"}, {"type": "stdin_stdout", "input": "10\n11\nartiovnldnp\nart... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation $p_1, p_2, \\ldots, p_n$ of integers from $1$ to $n$ and an integer $k$, such that $1 \\leq k \\leq n$. A permutation means that every number from $1$ to $n$ is contained in $p$ exactly once.\n... | [{"type": "stdin_stdout", "input": "100 77\n59 92 18 16 45 82 63 43 50 68 19 13 53 79 48 28 94 49 25 77 54 8 61 66 40 100 99 20 35 14 52 56 22 17 57 36 23 90 4 65 84 42 30 27 3 15 87 32 93 74 46 91 41 9 34 12 11 7 10 86 78 72 81 73 51 55 58 97 39 31 5 24 29 88 95 6 44 37 60 62 83 33 47 21 2 38 26 98 71 75 96 70 76 69 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima and Seryozha live in an ordinary dormitory room for two. One day Dima had a date with his girl and he asked Seryozha to leave the room. As a compensation, Seryozha made Dima do his homework.\n\nThe teacher gave Seryo... | [{"type": "stdin_stdout", "input": "50\n384672 661179 -775591 -989608 611120 442691 601796 502406 384323 -315945 -934146 873993 -156910 -94123 -930137 208544 816236 466922 473696 463604 794454 -872433 -149791 -858684 -467655 -555239 623978 -217138 -408658 493342 -733576 -350871 711210 884148 -426172 519986 -356885 5271... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n positive integers. You pick two integer numbers l and r from 1 to n, inclusive (numbers are picked randomly, equiprobably and independently). If l > r, then you swap values of l an... | [{"type": "stdin_stdout", "input": "20\n49 33 9 8 50 21 12 44 23 39 24 10 17 4 17 40 24 19 27 21\n", "output": "7.010000\n"}, {"type": "stdin_stdout", "input": "20\n128 33 9 1 50 37 12 44 26 69 24 10 17 4 17 41 11 26 10 14\n", "output": "7.005\n"}, {"type": "stdin_stdout", "input": "20\n49 33 9 8 50 21 12 44 23 39 24 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNatasha's favourite numbers are $n$ and $1$, and Sasha's favourite numbers are $m$ and $-1$. One day Natasha and Sasha met and wrote down every possible array of length $n+m$ such that some $n$ of its elements are equal t... | [{"type": "stdin_stdout", "input": "2000 2000\n", "output": "674532367\n"}, {"type": "stdin_stdout", "input": "1134 1092\n", "output": "134680101\n"}, {"type": "stdin_stdout", "input": "1087 1050\n", "output": "973930225\n"}, {"type": "stdin_stdout", "input": "1994 1981\n", "output": "596939902\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou should write a simple function that takes string as input and checks if it is a valid Russian postal code, returning `true` or `false`.\n\nA valid postcode should be 6 digits with no white spaces, letters or other sym... | [{"input": "\"\\n245980\"", "output": "[false]", "fn_name": "zipvalidate"}, {"input": "\"245980\\n\"", "output": "[false]", "fn_name": "zipvalidate"}, {"input": "\" 310587 \"", "output": "[false]", "fn_name": "zipvalidate"}, {"input": "\"1111111\"", "output": "[false]", "fn_name": "zipvalidate"}, {"input": "\"245980a\"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWelcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. \n\nFrom the window in your room, you see the sequence of n hills, where i-th of them has height a_{i}. T... | [{"type": "stdin_stdout", "input": "100\n1777 339 1249 1644 785 810 228 549 1892 464 1067 639 65 1653 981 1858 863 1980 1174 427 1710 345 309 826 31 1898 255 661 1836 443 802 195 177 752 979 1842 1689 399 568 1906 129 1571 1263 696 911 810 1877 1932 1389 1128 112 619 184 434 22 1269 386 324 1635 1440 705 300 455 1635 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Introduction and Warm-up (Highly recommended)\n\n# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)\n___\n\n# Task\n\n**_Given_** an *array/list [] of integers* , ... | [{"input": "[-102, -16, -1, -2, -367, -9]\n5", "output": "[-2]", "fn_name": "nth_smallest"}, {"input": "[2, 169, 13, -5, 0, -1]\n4", "output": "[2]", "fn_name": "nth_smallest"}, {"input": "[15, 20, 7, 10, 4, 3]\n3", "output": "[7]", "fn_name": "nth_smallest"}, {"input": "[-5, -1, -6, -18]\n4", "output": "[-1]", "fn_nam... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecule.\n\nA molecule consists of atoms, with some pairs of atoms connected by atomic bonds. Each atom... | [{"type": "stdin_stdout", "input": "1000000 1000000 1000000\n", "output": "500000 500000 500000\n"}, {"type": "stdin_stdout", "input": "1000000 1000000 1000000\n", "output": "500000 500000 500000\n"}, {"type": "stdin_stdout", "input": "688348 726472 442198\n", "output": "486311 240161 202037\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA remote island chain contains n islands, labeled 1 through n. Bidirectional bridges connect the islands to form a simple cycle — a bridge connects islands 1 and 2, islands 2 and 3, and so on, and additionally a bridge co... | [{"type": "stdin_stdout", "input": "12\n0 1 2 3 4 5 6 7 8 9 10 11\n1 2 9 8 6 4 5 10 3 7 0 11\n1 2\n2 3\n3 4\n4 5\n4 6\n6 7\n3 8\n8 9\n9 10\n2 11\n11 12\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "12\n0 1 2 3 4 5 6 7 8 9 10 11\n1 2 9 8 6 4 5 10 3 7 0 11\n1 2\n2 3\n3 4\n4 5\n4 6\n6 7\n3 8\n8 9\n9 10\n8 11\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Polycarpus got hold of two non-empty strings s and t, consisting of lowercase Latin letters. Polycarpus is quite good with strings, so he immediately wondered, how many different pairs of \"x y\" are there, such t... | [{"type": "stdin_stdout", "input": "pfdempfohomnpgbeegikfmflnalbbajpnpgeacaicoehopgnabnklheepnlnflohjegcciflmfjhachnhekckfjgoffhkblncidn\nidlhklpclcghngeggpjdgefccihndpoikojdjnbkdfjgaanoolfmnifnmbpeeghpicehjdiipnlfnjpglidpnnnjfmjfhbcogojkcfflmmfcgajbjbfaikhmjofbnjnaolbcdkelcieeodbfjcfiblhhmeelmpcmmcdhjcnnfklgedjjbaljnd... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.