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\nAlexandra has a paper strip with n numbers on it. Let's call them ai from left to right.\n\nNow Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy:\n\n * Each piece should...
[{"type": "stdin_stdout", "input": "2 1000000000 2\n-1000000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2 1000000000 1\n-1000000000 1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "2 1000000000 4\n-1000000000 1000000000\n", "output": "-1"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThe popular video posting site \"ZouTube\" is now in the midst of an unprecedented \"virtual ZouTuber\" boom. Among them, the one that has been attracting particular attention recently is the junior virtual Zou...
[{"type": "stdin_stdout", "input": "110000", "output": "110000\n"}, {"type": "stdin_stdout", "input": "100010", "output": "100000\n"}, {"type": "stdin_stdout", "input": "121470", "output": "121000\n"}, {"type": "stdin_stdout", "input": "101101", "output": "101000\n"}, {"type": "stdin_stdout", "input": "113193", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis morning Chef wants to jump a little. In a few minutes he will arrive at the point 0. Then he will perform a lot of jumps in such a sequence: 1-jump, 2-jump, 3-jump, 1-jump, 2-jump, 3-jump, 1-jump, and so on.\n1-jump ...
[{"type": "stdin_stdout", "input": "-114", "output": "yes\n"}, {"type": "stdin_stdout", "input": "-138", "output": "yes\n"}, {"type": "stdin_stdout", "input": "-119", "output": "yes\n"}, {"type": "stdin_stdout", "input": "-17", "output": "yes\n"}, {"type": "stdin_stdout", "input": "-11", "output": "yes\n"}, {"type": "s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The n destina...
[{"type": "stdin_stdout", "input": "50\n3987477 8934938 4067156 6712855 7269334 5039822 9533601 9335400 5992073 2619268 438734 8620973 4347619 4307947 2249161 815221 7615258 8244100 8341666 5908546 6646952 4812769 6215114 7479369 6290438 5623785 6466133 9953199 3525873 4326034 3510072 8117068 2342953 1717542 9766539 65...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a multiset (i. e. a set that can contain multiple equal integers) containing $2n$ integers. Determine if you can split it into exactly $n$ pairs (i. e. each element should be in exactly one pair) so that the...
[{"type": "stdin_stdout", "input": "2\n28\n15 72 79 36 2 43 100 11 236 94 76 83 90 20 58 39 47 57 37 88 92 92 59 80 97 22 20 47 9 88 21 82 94 71 25 38 45 51 23 76 58 5 39 11 15 9 11 24 9 84 90 58 0 37 54 65\n43\n79 24 82 7 26 19 63 22 94 22 4 72 19 5 92 92 83 93 35 19 45 87 40 61 58 65 21 48 96 85 63 100 86 63 30 50 58...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has an array, consisting of n integers a_1, a_2, ..., a_{n}. Polycarpus likes it when numbers in an array match. That's why he wants the array to have as many equal numbers as possible. For that Polycarpus perf...
[{"type": "stdin_stdout", "input": "100\n968 793 -628 -416 942 -308 977 168 728 -879 952 781 -425 -475 -480 738 -740 142 -319 -116 -701 -183 41 324 -918 -391 -176 781 763 888 475 -617 134 -802 -133 -211 855 -869 -236 503 550 387 137 -221 -957 -800 -56 -673 440 -791 -217 -959 -892 886 -593 427 890 223 -425 -342 -262 693...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMasha has $n$ types of tiles of size $2 \\times 2$. Each cell of the tile contains one integer. Masha has an infinite number of tiles of each type.\n\nMasha decides to construct the square of size $m \\times m$ consisting...
[{"type": "stdin_stdout", "input": "6\n3 4\n1 2\n5 6\n5 7\n7 4\n8 9\n9 8\n2 5\n1 1\n1 1\n2 2\n2 2\n1 100\n10 10\n10 10\n1 2\n4 5\n8 4\n2 2\n1 1\n1 1\n1 2\n3 4\n1 2\n1 1\n1 1\n", "output": "YES\nNO\nYES\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "6\n3 4\n0 2\n5 6\n5 7\n7 4\n8 9\n9 8\n2 5\n1 1\n1 1\n2 2\n2 2\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyramid. The height of the pyr...
[{"type": "stdin_stdout", "input": "10 10000\n", "output": "55\n"}, {"type": "stdin_stdout", "input": "10 10000\n", "output": "55\n"}, {"type": "stdin_stdout", "input": "10 1022\n", "output": "53\n"}, {"type": "stdin_stdout", "input": "10 1023\n", "output": "55\n"}, {"type": "stdin_stdout", "input": "10 1024\n", "outpu...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza com...
[{"type": "stdin_stdout", "input": "1500 2000 500 90000 100000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "1143 3132 1087 90000 100000", "output": "217400000\n"}, {"type": "stdin_stdout", "input": "1500 2445 500 90000 100000", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "1500 3132 7...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke had N cards numbered 1 through N.\nEach card has an integer written on it; written on Card i is a_i.\nSnuke did the following procedure:\n - Let X and x be the maximum and minimum values written on Snuke's cards, re...
[{"type": "stdin_stdout", "input": "7961\n570641734 802212645 776309598 809873412 803841293 359931843 792939994 233099102 401692872 600486353 217303985 108107734 560874418 799955982 883190766 630019949 636623822 273032982 235540677 331099668 777155291 724397459 613181400 534080974 922902142 15555595 732730818 469781636...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBaby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to...
[{"type": "stdin_stdout", "input": "100\n2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYui Hirasawa, who attends private Sakuragaoka Girls' High School, has to make a career hope by the day after tomorrow, but the trouble is that she hasn't decided anything yet. When I consulted with my friend Wa, I knew th...
[{"type": "stdin_stdout", "input": "3\n49 128 67 78 41\n29 59 100 45 84\n50 36 40 95 66\n2\n100 000 100 100 110\n0 0 -1 0 0\n1\n89 90 85 120 82\n0", "output": "363 287\n410 -1\n466 466\n"}, {"type": "stdin_stdout", "input": "3\n49 128 67 78 19\n29 59 100 45 84\n50 36 40 95 66\n2\n100 000 100 100 110\n0 0 -1 0 0\n1\n89 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N people numbered 1 to N. Each person wears a red hat or a blue hat.\n\nYou are given a string s representing the colors of the people. Person i wears a red hat if s_i is `R`, and a blue hat if s_i is `B`.\n\nDe...
[{"type": "stdin_stdout", "input": "4\nRBRR", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "4\nRRCR", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "4\nRRAR", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "4\nRARR", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "4\nRCRR", "output": "Yes...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring cleaning the coast, Alice found $n$ piles of stones. The $i$-th pile has $a_i$ stones.\n\nPiles $i$ and $i + 1$ are neighbouring for all $1 \\leq i \\leq n - 1$. If pile $i$ becomes empty, piles $i - 1$ and $i + 1$...
[{"type": "stdin_stdout", "input": "5\n3\n1 2 1\n3\n1 1 2\n5\n2 2 2 1 3\n5\n2100 1900 1600 3000 1600\n2\n2443 2445\n", "output": "\nYES\nYES\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "5\n3\n1 2 1\n3\n1 1 2\n5\n2 2 2 1 3\n5\n2100 1900 1600 3000 1600\n2\n2443 2445\n", "output": "YES\nYES\nYES\nYES\nNO\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the building of Jewelry Art Gallery (JAG), there is a long corridor in the east-west direction. There is a window on the north side of the corridor, and $N$ windowpanes are attached to this window. The width of each wi...
[{"type": "stdin_stdout", "input": "8 10 18\n2 12 16 14 18 4 17 10", "output": "430\n"}, {"type": "stdin_stdout", "input": "8 10 18\n2 12 16 14 18 6 17 10", "output": "410\n"}, {"type": "stdin_stdout", "input": "8 10 18\n2 12 16 14 18 4 17 11", "output": "420\n"}, {"type": "stdin_stdout", "input": "8 10 18\n2 12 18 14 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHaving two standards for a keypad layout is inconvenient! \nComputer keypad's layout: \n\n\n \nCell phone keypad's layout: \n\n\nSolve the horror of unstandartized keypads by providing a function that converts computer...
[{"input": "\"0789456123\"", "output": "[\"0123456789\"]", "fn_name": "computer_to_phone"}, {"input": "\"94561\"", "output": "[\"34567\"]", "fn_name": "computer_to_phone"}, {"input": "\"000\"", "output": "[\"000\"]", "fn_name": "computer_to_phone"}, {"input": "\"919\"", "output": "[\"373\"]", "fn_name": "computer_to_ph...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nRule 30 is a one-dimensional binary cellular automaton. You can have some information here: \n\n* [https://en.wikipedia.org/wiki/Rule_30](https://en.wikipedia.org/wiki/Rule_30)\n\nYou have to write a function that takes ...
[{"input": "[1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1]\n75", "output": "[[1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt the pancake shop you work for, pancake dough is lined up in a row on an elongated iron plate and baked. Pancakes can be completed by turning them over with a spatula several times. How many times you turn it over to co...
[{"type": "stdin_stdout", "input": "3\n5 4423 -1", "output": "8846\n"}, {"type": "stdin_stdout", "input": "3\n4 1618 1", "output": "3236\n"}, {"type": "stdin_stdout", "input": "3\n4 2801 1", "output": "5602\n"}, {"type": "stdin_stdout", "input": "3\n5 4573 2", "output": "9146\n"}, {"type": "stdin_stdout", "input": "3\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a convex polygon P with n distinct vertices p_1, p_2, ..., p_{n}. Vertex p_{i} has coordinates (x_{i}, y_{i}) in the 2D plane. These vertices are listed in clockwise order.\n\nYou can choose a real number D ...
[{"type": "stdin_stdout", "input": "19\n449447997 711296339\n530233434 692216537\n535464528 613140435\n535533467 100893188\n530498867 -265063956\n519107979 -271820709\n482156929 -287792333\n-303730271 -287970295\n-416935204 -263348201\n-443613873 -249980523\n-453444829 -173903413\n-462102798 -80789280\n-462064673 -1322...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves takoyaki - a ball-shaped snack.\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\nHow long does it take to make N t...
[{"type": "stdin_stdout", "input": "1000 1 1000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "999 10 1000\n", "output": "100000\n"}, {"type": "stdin_stdout", "input": "1000 1 1100", "output": "1100000\n"}, {"type": "stdin_stdout", "input": "1010 1 1100", "output": "1111000\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVova, the Ultimate Thule new shaman, wants to build a pipeline. As there are exactly n houses in Ultimate Thule, Vova wants the city to have exactly n pipes, each such pipe should be connected to the water supply. A pipe ...
[{"type": "stdin_stdout", "input": "499999998500000001 1000000000\n", "output": "999955279\n"}, {"type": "stdin_stdout", "input": "499999998500000000 1000000000\n", "output": "999955279\n"}, {"type": "stdin_stdout", "input": "499999999500000000 1000000000\n", "output": "999999998\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYour task is to validate rhythm with a meter.\n\n_________________________________________________\nRules:\n\n1. Rhythmic division requires that in one whole note (1) there are two half notes (2) or four quarter notes (4)...
[{"input": "[7, 2]\n\"222|1112|2222222|2222\"", "output": "[\"Valid rhythm with anacrusis\"]", "fn_name": "validate_rhythm"}, {"input": "[5, 8]\n\"888|448|82|88\"", "output": "[\"Valid rhythm with anacrusis\"]", "fn_name": "validate_rhythm"}, {"input": "[7, 2]\n\"222|111|2222222|1112|2222\"", "output": "[\"Invalid rhyt...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n Given a `sequence` of integers, check whether it is possible to obtain a strictly increasing sequence by erasing no more than one element from it.\n\n# Example\n\n For `sequence = [1, 3, 2, 1]`, the output should...
[{"input": "[149, 15, 23, 32, 41, 48, 58, 66, 69, 75, 81, 91, 178, 100, 109, 118, 128, 134, 143]", "output": "[false]", "fn_name": "almost_increasing_sequence"}, {"input": "[10, 1, 2, 3, 4, 5]", "output": "[true]", "fn_name": "almost_increasing_sequence"}, {"input": "[4, 5, 6, 1, 2, 3]", "output": "[false]", "fn_name":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. A is planning to travel alone on a highway bus (hereinafter referred to as \"bus\") during his high school holidays. First, Mr. A chose the town he wanted to visit the most and made it his destination. Next, you have ...
[{"type": "stdin_stdout", "input": "1 3 3 1 3\n1 3 2000\n1 2 1000\n2 3 1001\n2 3 3 1 3\n1 3 2300\n1 2 1000\n2 3 1200\n2 6 6 5 1\n1 2 1500\n1 3 4500\n2 6 2000\n5 4 1000\n6 4 2200\n3 5 3000\n0 0 0 0 0", "output": "1000\n1100\n3750\n"}, {"type": "stdin_stdout", "input": "1 3 3 1 3\n1 3 2000\n1 2 1000\n2 3 1001\n2 3 3 1 3\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet A = {a1, a2, ..., an} be any permutation of the first n natural numbers {1, 2, ..., n}. You are given a positive integer k and another sequence B = {b1, b2, ..., bn}, where bi is the number of elements aj in A to the ...
[{"type": "stdin_stdout", "input": "130 32\n72 56 81 71 45 17 65 13 87 22 17 75 72 80 68 76 62 35 14 53 49 72 19 55 10 57 28 35 66 59 45 24 37 65 46 31 34 1 30 12 37 13 40 41 39 6 31 28 30 0 2 7 23 32 0 34 21 0 23 3 18 33 7 6 20 19 21 10 27 28 19 23 5 15 22 13 14 1 3 14 0 5 1 14 0 0 7 11 10 1 1 1 6 5 3 3 0 1 0 0 0 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI decided to create a program that displays a \"round and round pattern\". The \"round and round pattern\" is as follows.\n\n* If the length of one side is n, it is displayed as a character string with n rows and n column...
[{"type": "stdin_stdout", "input": "2\n9\n64", "output": "#########\n# #\n# ##### #\n# # # #\n# # # # #\n# # # # #\n# # ### #\n# # #\n# #######\n\n################################################################\n# #\n# ###########################...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA multi-subject competition is coming! The competition has $m$ different subjects participants can choose from. That's why Alex (the coach) should form a competition delegation among his students. \n\nHe has $n$ candidate...
[{"type": "stdin_stdout", "input": "19 2\n1 2\n1 -3\n1 -1\n1 -2\n2 0\n1 -2\n1 -3\n2 -2\n2 -4\n2 -3\n2 0\n1 2\n1 -1\n1 -2\n1 -3\n1 -4\n2 2\n1 1\n1 -4\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "19 2\n1 2\n1 -3\n1 -1\n1 -2\n2 0\n1 -2\n1 -3\n2 -2\n2 -4\n2 -3\n2 0\n1 2\n1 -1\n1 -2\n1 -3\n1 -4\n2 2\n1 1\n1 -4\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the city, there are two pastry shops. One shop was very popular because its cakes are pretty tasty. However, there was a man who is displeased at the shop. He was an owner of another shop. Although cause of his shop's ...
[{"type": "stdin_stdout", "input": "2\n-1\n3\n26 4 2\n0", "output": "-1\n16\n"}, {"type": "stdin_stdout", "input": "2\n-1\n3\n26 4 1\n0", "output": "-1\n15\n"}, {"type": "stdin_stdout", "input": "2\n-1\n4\n1 -1 1\n0", "output": "-1\n0\n"}, {"type": "stdin_stdout", "input": "2\n1\n54\n13 9 10\n0", "output": "1\n0\n"}, {...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are an all-powerful being and you have created a rectangular world. In fact, your world is so bland that it could be represented by a $r \\times c$ grid. Each cell on the grid represents a country. Each country has a ...
[{"type": "stdin_stdout", "input": "4\n7 8\nAAP@AABA\nPPPPAAAA\nPPPPAAAA\nAPAAPPPP\nAPAPPAPP\nAAAAPPAP\nAAAAPPAA\n6 5\nAAAAA\nAAAAA\nAAPAA\nAAPAP\nAAAPP\nAAAOP\n4 4\nPPPP\nPPPP\nPPPP\nPPPP\n1 4\nPPPP\nPA@P\nPPPP\n", "output": "2\n1\nMORTAL\nMORTAL\n"}, {"type": "stdin_stdout", "input": "4\n7 8\nAAPAAAAA\nPPPPAAAA\nPPPP...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou may be familiar with the concept of combinations: for example, if you take 5 cards from a 52 cards deck as you would playing poker, you can have a certain number (2,598,960, would you say?) of different combinations.\...
[{"input": "100\n10", "output": "[17310309456440]", "fn_name": "choose"}, {"input": "200\n8", "output": "[55098996177225]", "fn_name": "choose"}, {"input": "300\n6", "output": "[962822846700]", "fn_name": "choose"}, {"input": "500\n4", "output": "[2573031125]", "fn_name": "choose"}, {"input": "1000\n3", "output": "[166...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by...
[{"type": "stdin_stdout", "input": "9999 10000\n", "output": "5000\n"}, {"type": "stdin_stdout", "input": "9999 10000\n", "output": "5000\n"}, {"type": "stdin_stdout", "input": "9998 10000\n", "output": "4999\n"}, {"type": "stdin_stdout", "input": "9998 10000\n", "output": "4999\n"}, {"type": "stdin_stdout", "input": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller. (The operation is the sam...
[{"type": "stdin_stdout", "input": "10\n1000 193 256 777 -1 3 2173 4898286181422 34 221", "output": "4898286186026\n"}, {"type": "stdin_stdout", "input": "10\n1000 193 256 777 -2 3 1355 4898286181422 34 224", "output": "4898286185212\n"}, {"type": "stdin_stdout", "input": "10\n1000 193 256 777 -2 3 2159 4898286181422 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of $n$ integers $a_1, a_2, \\ldots, a_n$.\n\nYou have to construct two sequences of integers $b$ and $c$ with length $n$ that satisfy: for every $i$ ($1\\leq i\\leq n$) $b_i+c_i=a_i$ $b$ is non-...
[{"type": "stdin_stdout", "input": "6\n-18 -12 -9 -10 -6 4\n3\n1 6 -9\n1 3 -10\n6 6 -3\n", "output": "3\n-2\n-2\n-4\n"}, {"type": "stdin_stdout", "input": "6\n-9 -12 -9 -6 -6 4\n3\n1 6 -9\n1 2 -10\n4 6 -3\n", "output": "4\n-1\n-1\n-2\n"}, {"type": "stdin_stdout", "input": "6\n-9 -12 -9 -10 -6 4\n3\n1 6 -9\n1 3 -10\n6 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe first positive integer, `n`, with its value `4nΒ² + 1`, being divisible by `5` and `13` is `4`. (condition 1)\n\nIt can be demonstrated that we have infinite numbers that may satisfy the above condition.\n\nIf we name ...
[{"input": "14313", "output": "[14313]", "fn_name": "find_closest_value"}, {"input": "20005", "output": "[20293]", "fn_name": "find_closest_value"}, {"input": "18331", "output": "[17944]", "fn_name": "find_closest_value"}, {"input": "18332", "output": "[18720]", "fn_name": "find_closest_value"}, {"input": "5000", "outp...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nMultiplication of Big Integers II\n\nGiven two integers $A$ and $B$, compute the product, $A \\times B$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the prod...
[{"type": "stdin_stdout", "input": "-15 87", "output": "-1305\n"}, {"type": "stdin_stdout", "input": "-81 -15", "output": "1215\n"}, {"type": "stdin_stdout", "input": "-1 -111", "output": "111\n"}, {"type": "stdin_stdout", "input": "-23 -15", "output": "345\n"}, {"type": "stdin_stdout", "input": "-46 -15", "output": "6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe marmots have prepared a very easy problem for this year's HC^2 – this one. It involves numbers n, k and a sequence of n positive integers a_1, a_2, ..., a_{n}. They also came up with a beautiful and riveting story for...
[{"type": "stdin_stdout", "input": "100 60\n1443 3849 6174 8249 696 8715 3461 9159 4468 2496 3044 2301 2437 7559 7235 7956 8959 2036 4399 9595 8664 9743 7688 3730 3705 1203 12615 7088 8563 3860 2794 8014 6951 1160 8616 970 9885 2421 17193 4885 5246 6146 8849 5141 8602 9486 7257 3300 8323 4797 4082 7135 80 9622 4543 656...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou will be given two strings `a` and `b` consisting of lower case letters, but `a` will have at most one asterix character. The asterix (if any) can be replaced with an arbitrary sequence (possibly empty) of lowercase le...
[{"input": "\"code*warrior\"\n\"codewars\"", "output": "[false]", "fn_name": "solve"}, {"input": "\"codewar*s\"\n\"codewars\"", "output": "[true]", "fn_name": "solve"}, {"input": "\"code*s\"\n\"codewars\"", "output": "[true]", "fn_name": "solve"}, {"input": "\"aaa*aaa\"\n\"aaa\"", "output": "[false]", "fn_name": "solve...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider an array that has no prime numbers, and none of its elements has any prime digit. It would start with: `[1,4,6,8,9,10,14,16,18,..]`. \n\n`12` and `15` are not in the list because `2` and `5` are primes.\n\nYou wi...
[{"input": "2000", "output": "[18118]", "fn_name": "solve"}, {"input": "3000", "output": "[46166]", "fn_name": "solve"}, {"input": "1000", "output": "[9110]", "fn_name": "solve"}, {"input": "200", "output": "[1060]", "fn_name": "solve"}, {"input": "300", "output": "[1668]", "fn_name": "solve"}, {"input": "400", "output...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nzscoder loves simple strings! A string t is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple whereas aa, add are not simple.\n\nzscoder is given a string s. He wants...
[{"type": "stdin_stdout", "input": "rxxxrrxrxxxxxrrrrrxxxxrrrrxrxxrxxrxrxrrrxrrxrrxrxxxrxrrxrrxrxrxxxxxrxxxxrrrxrxxrxxrxxxrrrrrxrrxrrxrr\n", "output": "rxaxraxrxaxaxrararxaxararaxrxarxarxrxrarxraxraxrxaxrxraxraxrxrxaxaxrxaxararxrxarxarxaxrararxraxraxra\n"}, {"type": "stdin_stdout", "input": "xxxxrrxrxxxxxrrrrrxxxxrrrrx...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers n and d. You need to construct a rooted binary tree consisting of n vertices with a root at the vertex 1 and the sum of depths of all vertices equals to d.\n\nA tree is a connected graph without...
[{"type": "stdin_stdout", "input": "9\n6 9\n5 7\n4 6\n4 4\n612 4624\n53 311\n8 25\n3 3\n6 11\n", "output": "YES\n1 1 2 2 4 \nYES\n1 1 2 4 \nYES\n1 2 3 \nYES\n1 1 2 \nYES\n1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring a normal walk in the forest, Katie has stumbled upon a mysterious code! However, the mysterious code had some characters unreadable. She has written down this code as a string c consisting of lowercase English char...
[{"type": "stdin_stdout", "input": "********************************************************************************************************************************************************************************************************************************************************************************************...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nTaro often shop at JOI general stores. At JOI general stores, there are enough coins of 500 yen, 100 yen, 50 yen, 10 yen, 5 yen, and 1 yen, and we always pay the change so that the number of coins is the smalle...
[{"type": "stdin_stdout", "input": "380\n-48\n0", "output": "4\n10\n"}, {"type": "stdin_stdout", "input": "380\n10\n0", "output": "4\n10\n"}, {"type": "stdin_stdout", "input": "380\n12\n0", "output": "4\n13\n"}, {"type": "stdin_stdout", "input": "380\n16\n0", "output": "4\n13\n"}, {"type": "stdin_stdout", "input": "380...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce Bob took a paper stripe of n squares (the height of the stripe is 1 square). In each square he wrote an integer number, possibly negative. He became interested in how many ways exist to cut this stripe into two piece...
[{"type": "stdin_stdout", "input": "100\n-4 2 4 4 1 3 -3 -3 2 1 -4 0 0 2 3 -1 -4 -3 4 -2 -3 -3 -3 -1 -2 -3 -1 -4 0 4 0 -1 4 0 -4 -4 4 -4 -2 1 -4 1 -3 -2 3 -4 4 0 -1 3 -1 4 -1 4 -1 3 -3 -3 -2 -2 4 -3 -3 4 -3 -2 -1 0 -2 4 0 -3 -1 -2 -3 1 -4 1 -3 -3 -3 -2 -3 0 1 -2 -2 -4 -3 -1 2 3 -1 1 1 0 3 -3 -1 -2\n", "output": "1\n"},...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nBaby Ehab has a piece of Cut and Stick with an array a of length n written on it. He plans to grab a pair of scissors and do the following to it:\n\n * pick a range (l, r) and cut out every element a_l, a_{l + 1}, ..., a...
[{"type": "stdin_stdout", "input": "100 1\n1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 1 2 1 1 1 2 2 1 2 2 2 2 1 1 2 1 1 1 2 2 1 1 1 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 1 2 2 2 1 1 2 2 2 1 1 2 2 2 1 2 2 2\n1 100\n", "output": "46\n"}, {"type": "stdin_stdout", "input": "100 1\n1 1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them f...
[{"type": "stdin_stdout", "input": "64 28\n+54\n+44\n+55\n-3\n+33\n-54\n-54\n-7\n+33\n+54\n+54\n+26\n-54\n+14\n-54\n-47\n+25\n-54\n-54\n-54\n-52\n+54\n+54\n+54\n+54\n+20\n+7\n+54\n+4\n+32\n+46\n-54\n-47\n+15\n+32\n-54\n+7\n+62\n-16\n-54\n+3\n+54\n+54\n+54\n+54\n-54\n+54\n-54\n+54\n-52\n+27\n-7\n+54\n-5\n-54\n-18\n+1\n+...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ consisting only of lowercase Latin letters.\n\nYou can rearrange all letters of this string as you wish. Your task is to obtain a good string by rearranging the letters of the given string or re...
[{"type": "stdin_stdout", "input": "100\naa\nb\ncbc\nc\nbab\nc\nbdb\ndd\nhfh\nebe\nb\nf\ngg\na\nm\nkkk\nqq\ni\noo\nss\ntt\nere\njgj\nqiq\nkk\nn\naaa\nb\naa\nb\nc\na\nf\ne\na\naa\nff\ne\na\nafa\no\nmom\nqq\nf\niii\nh\njj\njj\nkgk\nbb\nhih\nj\na\naaa\nbb\nbab\ne\naa\nd\nb\nfdf\nibi\nbb\nfhf\ncc\nf\ngig\nene\nbob\na\nrcr\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLapindrome is defined as a string which when split in the middle, gives two halves having the same characters and same frequency of each character. If there are odd number of characters in the string, we ignore the middle...
[{"type": "stdin_stdout", "input": "6\ngaga\nabcde\nrotor\nxyzxy\nabbbab\nababc", "output": "YES\nNO\nYES\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "6\ngaga\nedcca\nrouos\nxyzxy\nabbbab\nabbab", "output": "YES\nNO\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "6\ngaga\nabcde\nrosor\nxyzxy\nabbbab...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a matrix $2 \\times 2$ filled with distinct integers. You want your matrix to become beautiful. The matrix is beautiful if the following two conditions are satisfied:\n\nin each row, the first element is smaller ...
[{"type": "stdin_stdout", "input": "6\n1 3\n5 7\n8 10\n3 4\n8 10\n4 3\n6 1\n9 2\n7 5\n4 2\n1 2\n4 3\n", "output": "YES\nYES\nNO\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "1\n13 54\n91 10\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n14 54\n91 11\n", "output": "NO\n"}, {"type": "stdin_stdout", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n## Sum Even Fibonacci Numbers\n\n* Write a func named SumEvenFibonacci that takes a parameter of type int and returns a value of type int\n\n* Generate all of the Fibonacci numbers starting with 1 and 2 and ending on the ...
[{"input": "123456789000000", "output": "[154030760585064]", "fn_name": "SumEvenFibonacci"}, {"input": "10000000000000", "output": "[8583840088782]", "fn_name": "SumEvenFibonacci"}, {"input": "7347000000", "output": "[6293134512]", "fn_name": "SumEvenFibonacci"}, {"input": "144100000", "output": "[82790070]", "fn_name"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S...
[{"type": "stdin_stdout", "input": "ABA\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "BBA\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "BAB\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "AAB\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "ABB\n", "output": "Yes\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne cold winter evening Alice and her older brother Bob was sitting at home near the fireplace and giving each other interesting problems to solve. When it was Alice's turn, she told the number n to Bob and said:\n\nβ€”Shuf...
[{"type": "stdin_stdout", "input": "918273645\n546372819\n", "output": "WRONG_ANSWER\n"}, {"type": "stdin_stdout", "input": "111111111\n111110111\n", "output": "WRONG_ANSWER\n"}, {"type": "stdin_stdout", "input": "987235645\n206049167\n", "output": "WRONG_ANSWER\n"}, {"type": "stdin_stdout", "input": "918273645\n278718...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's call an undirected graph of n vertices p-interesting, if the following conditions fulfill: \n\n * the graph contains exactly 2n + p edges; \n * the graph doesn't contain self-loops and multiple edges; \n * for an...
[{"type": "stdin_stdout", "input": "5\n24 228\n24 228\n24 228\n24 228\n24 228\n", "output": "1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 18\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n2 10\n2 11\n2 12\n2 13\n2 14\n2 15\n2 16\n2 17\n2 18\n2 19\n2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe problem describes the properties of a command line. The description somehow resembles the one you usually see in real operating systems. However, there are differences in the behavior. Please make sure you've read the...
[{"type": "stdin_stdout", "input": "\"RUn.exe O\" \"\" \" 2ne, \" two! . \" \"\n", "output": "<RUn.exe O>\n<>\n< 2ne, >\n<two!>\n<.>\n< >\n"}, {"type": "stdin_stdout", "input": "\"RUn.exe O\" \"\" \" 2ne, \" two! . \" \"\n", "output": "<RUn.exe O>\n<>\n< 2ne, >\n<two!>\n<.>\n< >\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are an adventurer currently journeying inside an evil temple. After defeating a couple of weak zombies, you arrived at a square room consisting of tiles forming an n Γ— n grid. The rows are numbered 1 through n from to...
[{"type": "stdin_stdout", "input": "17\n.EEEEE...EEEE..EE\nEEE..E...EEEEE..E\n.E..E..EEE.EE...E\n.EEE.EE..EE...E..\nE..EEEEEE.EE.....\nE.EE...EEEEEEE.E.\nEEEE....EE..E.EEE\n...EEEEE.E..EE...\nEEE.E..EEEE.EEE..\n..E.E....EEE.....\nEE..E..E.E..EEEEE\nEEE..E.EEEEE.E...\n..EEEEE.E..EE.EE.\nEE.E...E..E..E.EE\n..E.EEE.EE..EE...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nImagine a triangle of numbers which follows this pattern:\n\n * Starting with the number \"1\", \"1\" is positioned at the top of the triangle. As this is the 1st row, it can only support a single number.\n * The 2nd row ...
[{"input": "10000", "output": "[500000005000]", "fn_name": "cumulative_triangle"}, {"input": "1000", "output": "[500000500]", "fn_name": "cumulative_triangle"}, {"input": "500", "output": "[62500250]", "fn_name": "cumulative_triangle"}, {"input": "150", "output": "[1687575]", "fn_name": "cumulative_triangle"}, {"input"...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer k and an undirected tree, consisting of n vertices.\n\nThe length of a simple path (a path in which each vertex appears at most once) between some pair of vertices is the number of edges in this p...
[{"type": "stdin_stdout", "input": "20 2\n3 14\n13 1\n4 3\n13 5\n12 20\n19 12\n6 3\n12 15\n11 2\n11 17\n9 5\n19 7\n6 11\n17 5\n16 18\n16 7\n12 8\n19 11\n16 10\n", "output": "122844\n"}, {"type": "stdin_stdout", "input": "20 2\n6 14\n13 1\n4 3\n13 5\n12 20\n19 12\n6 3\n12 15\n11 2\n11 17\n9 5\n19 7\n6 11\n17 5\n16 18\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence A_1, A_2, ..., A_N and an integer K.\n\nPrint the maximum possible length of a sequence B that satisfies the following conditions:\n\n* B is a (not necessarily continuous) subsequence of A.\n* For...
[{"type": "stdin_stdout", "input": "10 3\n1\n5\n2\n1\n1\n6\n11\n11\n4\n2", "output": "6\n"}, {"type": "stdin_stdout", "input": "10 3\n0\n5\n4\n3\n14\n11\n9\n5\n3\n4", "output": "6\n"}, {"type": "stdin_stdout", "input": "10 3\n0\n5\n4\n3\n11\n11\n9\n7\n6\n1", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 1\n2\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two matrices $A$ and $B$. Each matrix contains exactly $n$ rows and $m$ columns. Each element of $A$ is either $0$ or $1$; each element of $B$ is initially $0$.\n\nYou may perform some operations with matrix...
[{"type": "stdin_stdout", "input": "5 50\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nChef Shifu and Chef Po are participating in the Greatest Dumpling Fight of 2012.\nOf course, Masterchef Oogway has formed the rules of the fight.\n\nThere is a long horizontal rope of infinite length with a center point P...
[{"type": "stdin_stdout", "input": "3\n2 4 3 8 12\n1 4 0 2 -1\n11 22 10 18 16", "output": "13\n-1\n1\n"}, {"type": "stdin_stdout", "input": "3\n2 4 3 8 12\n1 4 4 2 -1\n10 22 12 9 16", "output": "13\n-1\n5\n"}, {"type": "stdin_stdout", "input": "3\n2 4 3 8 12\n1 4 0 2 -1\n11 22 10 7 16", "output": "13\n-1\n3\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOh no! You have stumbled upon a mysterious signal consisting of beeps of various lengths, and it is of utmost importance that you find out the secret message hidden in the beeps. There are long and short beeps, the long...
[{"input": "\".- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --.. ----- .---- ..--- ...-- ....- ..... -.... --... ---.. ----.\"", "output": "[\"abcdefghijklmnopqrstuvwxyz0123456789\"]", "fn_name": "decode"}, {"input": "\".... . .-.. .-.. --- .-- --- .-. .-.. -..\...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N balance beams numbered 1 to N. The length of each beam is 1 meters. Snuke walks on Beam i at a speed of 1/A_i meters per second, and Ringo walks on Beam i at a speed of 1/B_i meters per second.\n\nSnuke and Ring...
[{"type": "stdin_stdout", "input": "10\n1375710043 178537096\n1332309236 80797230\n164044598 544580992\n117241210 865935868\n383133839 231371336\n378371075 681212831\n304570952 16537461\n1789737664 267238505\n844917655 218662351\n662961957 100386692", "output": "1121712759 3406064155"}, {"type": "stdin_stdout", "input"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStudents love to celebrate their holidays. Especially if the holiday is the day of the end of exams!\n\nDespite the fact that Igor K., unlike his groupmates, failed to pass a programming test, he decided to invite them to...
[{"type": "stdin_stdout", "input": "50 1000 49\n", "output": "YES\n1 1000.00000000000000000000 2 20.40816326530612201395 \n2 979.59183673469385666976 3 40.81632653061224402791 \n3 959.18367346938771333953 4 61.22448979591836604186 \n4 938.77551020408168369613 5 81.63265306122448805581 \n5 918.36734693877554036590 6 102...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nKicker (table football) is a board game based on football, in which players control the footballers' figures mounted on rods by using bars to get the ball into the opponent's goal. When playing two on two, one player of e...
[{"type": "stdin_stdout", "input": "1 100\n100 1\n99 99\n99 99\n", "output": "Team 1\n"}, {"type": "stdin_stdout", "input": "80 79\n79 30\n80 81\n40 80\n", "output": "Team 2\n"}, {"type": "stdin_stdout", "input": "48 41\n15 47\n11 38\n19 31\n", "output": "Team 1\n"}, {"type": "stdin_stdout", "input": "51 54\n95 28\n42 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProfessor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way. \n\nIn total there are n piles of boxes, arranged in a line, from left to right, i-th pile (1 ≀ i ≀ n) cont...
[{"type": "stdin_stdout", "input": "5 3\n999999999 999999999 999999999 999999999 19992232\n", "output": " 1339997413"}, {"type": "stdin_stdout", "input": "19 100000\n1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1\n", "output": " ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDid you hear about the Nibiru collision ? It is a supposed disastrous encounter between the earth and a large planetary object. Astronomers reject this idea. But why listen to other people's beliefs and opinions. We are c...
[{"type": "stdin_stdout", "input": "3\n-1 0 R\n2\n1 -1 U\n1 1 D\n1 1 U\n1\n1 0 U\n0 0 R\n1\n4 -1 L", "output": "SAFE\nSAFE\nSAFE\n"}, {"type": "stdin_stdout", "input": "3\n0 0 R\n2\n1 -4 U\n2 3 D\n1 2 U\n1\n2 -1 U\n0 0 R\n1\n7 1 L", "output": "SAFE\nSAFE\nSAFE\n"}, {"type": "stdin_stdout", "input": "3\n0 0 R\n2\n1 -4 U...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe great hero guards the country where Homer lives. The hero has attack power $A$ and initial health value $B$. There are $n$ monsters in front of the hero. The $i$-th monster has attack power $a_i$ and initial health va...
[{"type": "stdin_stdout", "input": "10\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSonya was unable to think of a story for this problem, so here comes the formal description.\n\nYou are given the array containing n positive integers. At one turn you can pick any element and increase or decrease it by 1...
[{"type": "stdin_stdout", "input": "75\n392 1038 98 533 515 448 220 310 386 28 539 294 208 828 75 534 875 493 94 205 656 105 546 493 60 188 222 108 788 504 809 621 934 455 307 178 630 298 938 62 850 421 839 134 950 256 934 817 209 559 866 67 990 835 534 672 468 768 757 516 959 893 275 136 692 927 321 554 801 805 885 12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two circles. Find the area of their intersection.\n\n\n-----Input-----\n\nThe first line contains three integers x_1, y_1, r_1 ( - 10^9 ≀ x_1, y_1 ≀ 10^9, 1 ≀ r_1 ≀ 10^9) β€” the position of the center and the...
[{"type": "stdin_stdout", "input": "368831644 125127030 959524552\n690900461 -368007601 1000000000\n", "output": "1877639096067727828.75000000000000000000\n"}, {"type": "stdin_stdout", "input": "368831644 125127030 959524552\n690900461 -368007601 1000000000\n", "output": "1877639096067727828.62500000000000000000"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are two 100-story buildings, called A and B. (In this problem, the ground floor is called the first floor.)\nFor each i = 1,\\dots, 100, the i-th floor of A and that of B are connected by a corridor.\nAlso, for each...
[{"type": "stdin_stdout", "input": "1 100 100 100\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "1 100 50 100\n", "output": "9950\n"}, {"type": "stdin_stdout", "input": "1 100 33 65\n", "output": "6468\n"}, {"type": "stdin_stdout", "input": "1 100 33 67\n", "output": "6567\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn order to participate in the Asian Regional Qualifiers of the International Collegiate Programming Contest held every year in Japan, we must break through the strict domestic qualifiers.\n\nEven though it is a universit...
[{"type": "stdin_stdout", "input": "6\n1 1 6 200\n2 1 11 300\n3 0 1 400\n4 0 5 1200\n5 0 5 1674\n10 4 4 6\n3\n1015 1 5 84\n1343 2 4 20\n123 3 6 500\n2\n4 1 3 100\n1 1 1 100\n0", "output": "2\n1\n4\n5\n10\n3\n123\n1015\n1343\n4\n1\n"}, {"type": "stdin_stdout", "input": "6\n1 1 6 200\n2 1 11 300\n3 0 1 400\n4 0 5 1200\n5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI need some help with my math homework. I have a number of problems I need to return the derivative for.\n\nThey will all be of the form: \nax^b, \nA and B are both integers, but can be positive or negative.\nNote: \n ...
[{"input": "\"-954x^2\"", "output": "[\"-1908x\"]", "fn_name": "get_derivative"}, {"input": "\"-3x^10\"", "output": "[\"-30x^9\"]", "fn_name": "get_derivative"}, {"input": "\"3x^-1\"", "output": "[\"-3x^-2\"]", "fn_name": "get_derivative"}, {"input": "\"-3x^-1\"", "output": "[\"3x^-2\"]", "fn_name": "get_derivative"}, ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function that calculates the original product price, without VAT.\n\n## Example\nIf a product price is `200.00` and VAT is `15%`, then the final product price (with VAT) is: `200.00 + 15% = 230.00`\n\nThus, if you...
[{"input": "230.0", "output": "[200.0]", "fn_name": "excluding_vat_price"}, {"input": "460.0", "output": "[400.0]", "fn_name": "excluding_vat_price"}, {"input": "123", "output": "[106.96]", "fn_name": "excluding_vat_price"}, {"input": "777", "output": "[675.65]", "fn_name": "excluding_vat_price"}, {"input": "null", "ou...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nA game field is a strip of 1 Γ— n square cells. In some cells there are Packmen, in some cellsΒ β€” asterisks, other cells are empty.\n\nPackman can move to neighboring cell in 1 time unit. If there is an asterisk in the targ...
[{"type": "stdin_stdout", "input": "100\n************************************************************P***************************************\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "100\n************************************************************P***************************************\n", "output":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\...
[{"type": "stdin_stdout", "input": "1334146180889758954\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "123456789123456789\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "999999999999994744\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "446486416781684178\n", "output": "YES\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has a sequence, consisting of n non-negative integers: a_1, a_2, ..., a_{n}.\n\nLet's define function f(l, r) (l, r are integer, 1 ≀ l ≀ r ≀ n) for sequence a as an operation of bitwise OR of all the sequence e...
[{"type": "stdin_stdout", "input": "10\n375813 659427 484038 348181 432640 368050 271089 721588 345312 630771\n", "output": "29\n"}, {"type": "stdin_stdout", "input": "10\n375813 873836 484038 348181 432640 368050 271089 721588 345312 630771\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "10\n375813 873836 48...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA trick I learned in elementary school to determine whether or not a number was divisible by three is to add all of the integers in the number together and to divide the resulting sum by three. If there is no remainder fr...
[{"input": "\"9876543211234567890002\"", "output": "[false]", "fn_name": "divisible_by_three"}, {"input": "\"9876543211234567890009\"", "output": "[true]", "fn_name": "divisible_by_three"}, {"input": "\"10110101011\"", "output": "[false]", "fn_name": "divisible_by_three"}, {"input": "\"10987654321\"", "output": "[false...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nSorting algorithms for sorting data are basic algorithms indispensable in computer science. For example, as shown in the figure below, the operation of \"sorting the elements of an array of integer values ​​in ascending o...
[{"type": "stdin_stdout", "input": "5\n5\n1\n2\n-1\n0\n4\n1\n6\n2\n4\n4\n22\n3\n4\n1\n-1\n0", "output": "8\n2\n5\n0\n"}, {"type": "stdin_stdout", "input": "5\n10\n1\n4\n-1\n0\n8\n0\n3\n9\n7\n5\n22\n3\n4\n1\n-1\n0", "output": "8\n11\n0\n"}, {"type": "stdin_stdout", "input": "5\n5\n1\n2\n-1\n0\n8\n1\n6\n2\n4\n5\n22\n3\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValera considers a number beautiful, if it equals 2^{k} or -2^{k} for some integer k (k β‰₯ 0). Recently, the math teacher asked Valera to represent number n as the sum of beautiful numbers. As Valera is really greedy, he w...
[{"type": "stdin_stdout", "input": "10001100101100101000100101000100100111100001111001000011101001010001100111001010011111100101110101010011101101110000111111010100100111110000011111000100011000000010111011000110010110001100010011111100110011100001110011011110000011101111000110100010000111011010011101100101010010110011...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Disgaea as in most role-playing games, characters have skills that determine the character's ability to use certain weapons or spells. If the character does not have the necessary skill, he cannot use it. The skill lev...
[{"type": "stdin_stdout", "input": "20 1 0.78\nxc 6799\nztrfjsq 3023\nkhbcbsaztwigxeidh 2974\nkksvbmtjiiqlguwv 188\nwvqzzjrpmxsdbfvua 4547\niqkqqwtqifdpxfhslpv 6264\nwarmknju 9472\nfheisuiufwmtagl 292\nwge 4338\nzaklermeji 6733\nfcn 6282\nbjyjzgzkgzy 1778\ngufpvhdnsesyfuegef 4998\nxnhuhwzzxqbaphktqbc 8485\ncokabaqahfw ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya has got many devices that work on electricity. He's got n supply-line filters to plug the devices, the i-th supply-line filter has a_{i} sockets.\n\nOverall Vasya has got m devices and k electrical sockets in his fl...
[{"type": "stdin_stdout", "input": "50 50 2\n2 2 4 5 2 1 5 4 5 4 5 2 1 2 3 3 5 1 2 2 1 3 4 5 5 4 3 2 2 1 3 2 3 2 4 4 1 3 5 4 3 2 4 3 4 4 4 4 3 4\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "50 30 1\n2 1 2 1 2 3 3 1 2 2 3 2 1 3 1 3 1 2 2 3 2 1 3 1 1 2 3 2 2 1 1 3 3 2 2 2 3 2 3 3 3 3 1 1 3 1 1 3 1 3\n", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.\n\nPolycarp wants to free at least $m$ units of memory (by removing some app...
[{"type": "stdin_stdout", "input": "5\n5 13\n6 4 2 2 2\n2 1 1 2 1\n1 3\n2\n1\n5 10\n2 3 10 2 3\n1 1 2 2 1\n4 10\n4 1 3 1\n1 2 1 2\n4 9\n2 2 1 2\n1 1 2 1\n", "output": "5\n-1\n2\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "5\n5 7\n6 4 2 2 2\n2 1 1 2 1\n1 3\n2\n1\n5 10\n2 3 10 2 3\n1 1 2 2 1\n4 10\n4 1 3 1\n1 2 1 2\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given n points on a line with their coordinates x_{i}. Find the point x so the sum of distances to the given points is minimal.\n\n\n-----Input-----\n\nThe first line contains integer n (1 ≀ n ≀ 3Β·10^5) β€” the numb...
[{"type": "stdin_stdout", "input": "100\n457 827 807 17 871 935 907 -415 536 170 551 -1454 865 758 -457 -892 -875 -488 684 19 0 555 -807 -624 -239 826 318 811 20 -732 -91 460 551 -610 555 -493 -154 442 -141 946 -913 -104 704 -380 699 32 106 -455 -518 214 -464 -861 243 -798 -472 559 529 -844 -32 871 -459 236 387 626 -31...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a function that takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed (Just like the name of this Kata). Strings passed in will consist of only letters ...
[{"input": "\"This sentence is a sentence\"", "output": "[\"This ecnetnes is a ecnetnes\"]", "fn_name": "spin_words"}, {"input": "\"Hey fellow warriors\"", "output": "[\"Hey wollef sroirraw\"]", "fn_name": "spin_words"}, {"input": "\"CodeWars\"", "output": "[\"sraWedoC\"]", "fn_name": "spin_words"}, {"input": "\"Welcom...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nTwo little greedy bears have found two pieces of cheese in the forest of weight a and b grams, correspondingly. The bears are so greedy that they are ready to fight for the larger piece. That's where the fox comes in and ...
[{"type": "stdin_stdout", "input": "1488496828 607500000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1183431925 540244525\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1270836736 387420489\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "100000007 800000011\n", "output": "-1\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDuring the last Sereja's Codesecrof round the server crashed many times, so the round was decided to be made unrated for some participants. \n\nLet's assume that n people took part in the contest. Let's assume that the pa...
[{"type": "stdin_stdout", "input": "10 -6\n5 2 1 9 5 2 4 4 9 2\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"type": "stdin_stdout", "input": "10 -6\n5 2 1 8 5 2 4 4 9 2\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"type": "stdin_stdout", "input": "10 0\n5 14 1 1 5 1 1 4 9 2\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSam has opened a new sushi train restaurant - a restaurant where sushi is served on plates that travel around the bar on a conveyor belt and customers take the plate that they like.\n\nSam is using Glamazon's new visual r...
[{"input": "\"rrrrrrrrrrrrrrrrrr rr r\"", "output": "[34]", "fn_name": "total_bill"}, {"input": "\"rr rrr rrr rr\"", "output": "[16]", "fn_name": "total_bill"}, {"input": "\"rr rrr\"", "output": "[8]", "fn_name": "total_bill"}, {"input": "\"rr\"", "output": "[4]", "fn_name": "total_bill"}, {"input": "\"\"", "output":...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven are integers S and P.\nIs there a pair of positive integers (N,M) such that N + M = S and N \\times M = P?\n\n-----Constraints-----\n - All values in input are integers.\n - 1 \\leq S,P \\leq 10^{12}\n\n-----Input--...
[{"type": "stdin_stdout", "input": "1000000000000 999999999999\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "50000000002 100000000000\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "978530427494 321593407609\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "203939391324 871114841657\n", ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nInput\n\nThe input contains two integers a1, a2 (0 ≀ ai ≀ 109), separated by a single space.\n\nOutput\n\nOutput a single integer.\n\nExamples\n\nInput\n\n3 14\n\n\nOutput\n\n44\n\n\nInput\n\n27 12\n\n\nOutput\n\n48\n\n\n...
[{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "1000000001\n"}, {"type": "stdin_stdout", "input": "1000000000 0000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "1999999999\n"}, {"type": "stdin_stdout", "input": "937477084 827336327\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nOnce upon a time there were settlements and many people lived there. People built buildings of various shapes and sizes. But those buildings have already been lost, only the literature and the pillars found in ...
[{"type": "stdin_stdout", "input": "10\n2 0\n1 1\n1 0\n1 -1\n2 5\n0 1\n2 1\n1 4\n1 14\n18 1\n10\n4 14\n4 0\n2 1\n0 2\n1 4\n0 5\n4 1\n1 1\n2 6\n5 -1\n0", "output": "1\n0\n"}, {"type": "stdin_stdout", "input": "10\n16 0\n0 1\n1 1\n1 0\n2 7\n0 3\n3 1\n1 3\n1 14\n18 2\n10\n2 7\n5 5\n2 1\n0 2\n1 4\n1 4\n4 1\n1 1\n1 6\n5 4\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have $N$ items that you want to put them into a knapsack of capacity $W$. Item $i$ ($1 \\le i \\le N$) has weight $w_i$ and value $v_i$ for the weight.\n\nWhen you put some items into the knapsack, the following condi...
[{"type": "stdin_stdout", "input": "1 96\n113 10\n111 20\n120 31", "output": "113.0000000000\n"}, {"type": "stdin_stdout", "input": "1 77\n119 10\n111 20\n120 31", "output": "119.0000000000\n"}, {"type": "stdin_stdout", "input": "1 77\n197 10\n111 20\n120 31", "output": "197.0000000000\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider the infinite sequence s of positive integers, created by repeating the following steps:\n\n 1. Find the lexicographically smallest triple of positive integers (a, b, c) such that \n * a βŠ• b βŠ• c = 0, where βŠ• d...
[{"type": "stdin_stdout", "input": "9\n2\n2\n6\n4\n14\n11\n13\n8\n17\n", "output": "2\n2\n12\n4\n9\n11\n7\n10\n32\n"}, {"type": "stdin_stdout", "input": "9\n2\n2\n3\n4\n10\n12\n12\n8\n11\n", "output": "2\n2\n3\n4\n6\n13\n13\n10\n11\n"}, {"type": "stdin_stdout", "input": "9\n2\n2\n6\n4\n14\n17\n13\n8\n17\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nRecently, the Fair Nut has written k strings of length n, consisting of letters \"a\" and \"b\". He calculated c β€” the number of strings that are prefixes of at least one of the written strings. Every string was counted o...
[{"type": "stdin_stdout", "input": "100 1000000000\nbbabbaabbbaaaaabbabbbaaabbbbabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbaabbbbabaabbbabbaaaaabbbbaab\nbbabbaabbbaaaaabbabbbaaabbbbabbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaababbbabbbbaaaaabbaaaaaaaab\n", "output": "41073741883\n"}, {"type": "stdin_stdout", "input":...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n# Task\n Your Informatics teacher at school likes coming up with new ways to help you understand the material. When you started studying numeral systems, he introduced his own numeral system, which he's convinced will hel...
[{"input": "\"O\"", "output": "[[\"A + O\", \"B + N\", \"C + M\", \"D + L\", \"E + K\", \"F + J\", \"G + I\", \"H + H\"]]", "fn_name": "new_numeral_system"}, {"input": "\"G\"", "output": "[[\"A + G\", \"B + F\", \"C + E\", \"D + D\"]]", "fn_name": "new_numeral_system"}, {"input": "\"E\"", "output": "[[\"A + E\", \"B + ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. Kitayuta has just bought an undirected graph consisting of n vertices and m edges. The vertices of the graph are numbered from 1 to n. Each edge, namely edge i, has a color c_{i}, connecting vertex a_{i} and b_{i}.\n\...
[{"type": "stdin_stdout", "input": "5 7\n1 5 1\n2 5 1\n3 5 1\n4 5 1\n1 2 2\n2 3 2\n3 4 2\n5\n1 5\n5 1\n2 5\n1 5\n1 4\n", "output": "1\n1\n1\n1\n2\n"}, {"type": "stdin_stdout", "input": "5 7\n1 1 1\n2 5 1\n3 5 1\n4 5 1\n1 2 2\n2 3 2\n3 4 2\n5\n1 5\n5 1\n2 5\n1 5\n1 4\n", "output": "0\n0\n1\n0\n1\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a bracket sequence consisting of $n$ characters '(' and/or )'. You perform several operations with it.\n\nDuring one operation, you choose the shortest prefix of this string (some amount of first characters ...
[{"type": "stdin_stdout", "input": "8\n3\n)()\n8\n)()()(((\n4\n(()(\n5\n(())(\n6\n))((()\n5\n))())\n1\n)\n2\n)(\n", "output": "1 0\n3 1\n1 2\n2 1\n3 0\n2 1\n0 1\n0 2\n"}, {"type": "stdin_stdout", "input": "5\n3\n)()\n8\n)()()(((\n4\n(()(\n5\n(())(\n6\n))((()\n", "output": "1 0\n3 1\n1 2\n2 1\n3 0\n"}, {"type": "stdin_s...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWelcome! Everything is fine.\n\nYou have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity.\n\nYou h...
[{"type": "stdin_stdout", "input": "2\n3\n1 2 3\n3 2 4\n2 4 0\n4 5 10\n5 6 5\n1\n1 2 2\n1 5 2\n1 4 6\n", "output": "12 32\n2 2\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 2 3\n3 2 4\n2 4 3\n4 5 6\n5 6 5\n2\n1 2 1\n1 3 0\n1 4 3\n", "output": "15 33\n4 4\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 2 3\n3 2 4\n2 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDreamoon likes coloring cells very much.\n\nThere is a row of $n$ cells. Initially, all cells are empty (don't contain any color). Cells are numbered from $1$ to $n$.\n\nYou are given an integer $m$ and $m$ integers $l_1,...
[{"type": "stdin_stdout", "input": "2000 100\n5 128 1368 1679 1265 313 1854 1512 1924 338 38 1971 238 1262 1834 1878 1749 784 770 1617 191 395 303 214 1910 1300 741 1966 1367 24 268 403 1828 1033 1424 218 1146 925 1501 1760 1164 1881 1628 1596 1358 1360 29 1343 922 618 1537 1839 1114 1381 704 464 692 1450 1590 1121 670...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n### Description:\n\n Remove all exclamation marks from sentence except at the end.\n\n### Examples\n\n```\nremove(\"Hi!\") == \"Hi!\"\nremove(\"Hi!!!\") == \"Hi!!!\"\nremove(\"!Hi\") == \"Hi\"\nremove(\"!Hi!\") == \"Hi!\"...
[{"input": "\"Hi! Hi!\"", "output": "[\"Hi Hi!\"]", "fn_name": "remove"}, {"input": "\"Hi!!!\"", "output": "[\"Hi!!!\"]", "fn_name": "remove"}, {"input": "\"!Hi!\"", "output": "[\"Hi!\"]", "fn_name": "remove"}, {"input": "\"Hi!\"", "output": "[\"Hi!\"]", "fn_name": "remove"}, {"input": "\"!Hi\"", "output": "[\"Hi\"]", ...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven a string of characters, I want the function `findMiddle()`/`find_middle()` to return the middle number in the product of each digit in the string.\n\nExample: 's7d8jd9' -> 7, 8, 9 -> 7\\*8\\*9=504, thus 0 should be ...
[{"input": "\"asd.f855dasd.gasdfgsdfgh-sdfghsdfg/asdfga=sdfg\"", "output": "[0]", "fn_name": "find_middle"}, {"input": "\"asd.fasd.ga654sdfgsdfgh-sdfghsdfg/asdfga=sdfg\"", "output": "[2]", "fn_name": "find_middle"}, {"input": "\"asd.fasd.gasdfgsdfgh-sdfghsdfg/asdfga=sdfg\"", "output": "[-1]", "fn_name": "find_middle"},...
code_functional
[ { "content": "Solve the following coding problem using the programming language python:\n\nConsider a football tournament where n teams participate. Each team has two football kits: for home games, and for away games. The kit for home games of the i-th team has color xi and the kit for away games of this team h...
[{"type": "stdin_stdout", "input": "10000\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 1\n1 100\n100 ...
code_stdio