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\nThis is the harder version of the problem. In this version, $1 \\le n, m \\le 2\\cdot10^5$. You can hack this problem if you locked it. But you can hack the previous problem only if you locked both problems.\n\nYou are gi... | [{"type": "stdin_stdout", "input": "5\n3 1 4 1 2\n15\n5 5\n5 4\n5 3\n5 2\n5 1\n4 4\n4 3\n4 2\n4 1\n3 3\n3 2\n3 1\n2 2\n2 1\n1 1\n", "output": "2\n1\n4\n1\n3\n2\n4\n1\n3\n2\n4\n3\n4\n3\n4\n"}, {"type": "stdin_stdout", "input": "5\n3 1 4 1 2\n15\n5 5\n5 4\n5 3\n5 2\n5 1\n4 4\n4 3\n4 2\n4 1\n3 3\n3 2\n3 1\n2 2\n2 1\n1 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, you will sort elements in an array by decreasing frequency of elements. If two elements have the same frequency, sort them by increasing value. \n\n\nMore examples in test cases. \n\nGood luck!\n\nPlease als... | [{"input": "[1, 2, 3, 0, 5, 0, 1, 6, 8, 8, 6, 9, 1]", "output": "[[1, 1, 1, 0, 0, 6, 6, 8, 8, 2, 3, 5, 9]]", "fn_name": "solve"}, {"input": "[5, 9, 6, 9, 6, 5, 9, 9, 4, 4]", "output": "[[9, 9, 9, 9, 4, 4, 5, 5, 6, 6]]", "fn_name": "solve"}, {"input": "[4, 4, 2, 5, 1, 1, 3, 3, 2, 8]", "output": "[[1, 1, 2, 2, 3, 3, 4, 4... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string.\n\nA Bitlandish string is a string made only of characters \"0\" and... | [{"type": "stdin_stdout", "input": "1000000000000000000000000000000000000011111111000000000000\n0111111111100000000000111111111000000000000000111111110001\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1000000000000000000000000000000000000011111111000000000000\n0111111111100000000000111111111000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\nOn this sequence, Snuke can perform the following operation:\n - Choose K consecutive elements in the sequen... | [{"type": "stdin_stdout", "input": "7635 1737\n1 4336 5028 2246 3376 4632 3484 5018 6851 5712 6421 1045 4582 6443 5762 2211 5622 2385 1213 6493 6742 4499 7581 6655 2974 2212 2861 4283 5757 1316 4008 2602 5971 4098 5433 1398 4622 7224 93 4338 1998 1188 853 2588 2210 7123 3903 1360 1308 3213 3437 2333 6285 2126 3228 2323... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe customer telephone support center of the computer sales company called JAG is now in- credibly confused. There are too many customers who request the support, and they call the support center all the time. So, the com... | [{"type": "stdin_stdout", "input": "3 300\n100 46 150\n100 50 150\n101 50 148\n3 300\n110 50 150\n100 50 150\n200 50 150\n9 18\n5 1 1\n3 1 1\n3 1 1\n4 100 1\n5 100 1\n5 100 1\n10 5 5\n10 5 5\n2 7 1000\n10 18\n1 2 6\n2 3 1\n3 4 5\n4 5 6\n5 6 7\n6 7 8\n7 8 9\n12 9 10\n9 10 11\n18 11 12\n0 0", "output": "2\n3\n5\n10\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a sorted array of numbers, return the summary of its ranges.\n\n## Examples\n```python\nsummary_ranges([1, 2, 3, 4]) == [\"1->4\"]\nsummary_ranges([1, 1, 1, 1, 1]) == [\"1\"]\nsummary_ranges([0, 1, 2, 5, 6, 9]) == [... | [{"input": "[-2, 0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 12]", "output": "[[\"-2\", \"0->7\", \"9->10\", \"12\"]]", "fn_name": "summary_ranges"}, {"input": "[0, 1, 2, 3, 4, 5, 6, 7, 9, 10]", "output": "[[\"0->7\", \"9->10\"]]", "fn_name": "summary_ranges"}, {"input": "[0, 1, 2, 5, 6, 9]", "output": "[[\"0->2\", \"5->6\", \"9\"]... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new dog show on TV is starting next week. On the show dogs are required to demonstrate bottomless stomach, strategic thinking and self-preservation instinct. You and your dog are invited to compete with other participan... | [{"type": "stdin_stdout", "input": "100 154\n132 88 72 98 184 47 176 56 68 168 137 88 188 140 198 18 162 139 94 133 90 91 37 156 196 28 186 1 51 47 4 92 18 51 37 121 86 195 153 195 183 191 15 24 104 174 94 83 102 61 131 40 149 46 22 112 13 136 133 177 3 175 160 152 172 48 44 174 77 100 155 157 167 174 64 109 118 194 12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $n$ and $m$. You have to construct the array $a$ of length $n$ consisting of non-negative integers (i.e. integers greater than or equal to zero) such that the sum of elements of this array is ex... | [{"type": "stdin_stdout", "input": "5\n1 100\n2 -1\n5 5\n2 1000000000\n1000100000 1000000000\n", "output": "0\n-1\n10\n1000000000\n2000000000\n"}, {"type": "stdin_stdout", "input": "5\n1 100\n2 2\n5 5\n2 1000000000\n1000000000 1000000000\n", "output": "0\n2\n10\n1000000000\n2000000000\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe preferred way to generate user login in Polygon is to concatenate a prefix of the user's first name and a prefix of their last name, in that order. Each prefix must be non-empty, and any of the prefixes can be the ful... | [{"type": "stdin_stdout", "input": "asdfghjkli ware\n", "output": "asdfghjkliw\n"}, {"type": "stdin_stdout", "input": "asdfghjkli ware\n", "output": "asdfghjkliw\n"}, {"type": "stdin_stdout", "input": "asdfghkkli ware\n", "output": "asdfghkkliw\n"}, {"type": "stdin_stdout", "input": "ilkkhgfdsa ware\n", "output": "ilkk... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Feynman's squares\nRichard Phillips Feynman was a well-known American physicist and a recipient of the Nobel Prize in Physics. He worked in theoretical physics and pioneered the field of quantum computing.\n\nRecently, ... | [{"input": "15", "output": "[1240]", "fn_name": "count_squares"}, {"input": "8", "output": "[204]", "fn_name": "count_squares"}, {"input": "3", "output": "[14]", "fn_name": "count_squares"}, {"input": "5", "output": "[55]", "fn_name": "count_squares"}, {"input": "1", "output": "[1]", "fn_name": "count_squares"}, {"inpu... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N cells arranged in a row, numbered 1, 2, \\ldots, N from left to right.\nTak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below.\nYou are given ... | [{"type": "stdin_stdout", "input": "200000 10\n195313 197047\n198503 199144\n199910 200000\n193793 195312\n186922 193792\n199860 199909\n199145 199570\n197048 198502\n1 186921\n199571 199859\n", "output": "946746535\n"}, {"type": "stdin_stdout", "input": "199993 10\n23896 23905\n92651 92660\n184931 184940\n101332 10134... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integer sequences S and T of length N and M, respectively, both consisting of integers between 1 and 10^5 (inclusive).\nIn how many pairs of a subsequence of S and a subsequence of T do the two subsequen... | [{"type": "stdin_stdout", "input": "1989 1986\n84234 80908 59749 63761 63761 49034 63761 64697 84234 84234 64697 64697 49034 80908 80908 63761 66200 59749 59749 80908 84234 63761 80908 80908 66200 92283 84234 63761 80908 63761 92283 59749 49034 78052 53613 49034 92283 80908 53613 59749 49034 49034 59749 80908 66200 809... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.\nDetermine whether N is a multiple of 9.\n\n-----Constraints-----\n - 0 \\leq N < 10^{200000}\n -... | [{"type": "stdin_stdout", "input": "33813819154164361588118768953262516554574111032083043031384286303065210509562262038973079975476396016546146039303789823110933080134565927492314604458575884820133400398416950126075966048913496870281342656762187821939147033106717650124502612019109078419691362651717290499399798948652832... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGenos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color c_{i}. The goal of the game is to destroy all the gemstones in the line as quickly as possible.\... | [{"type": "stdin_stdout", "input": "50\n22 19 14 22 20 11 16 28 23 15 3 23 6 16 30 15 15 10 24 28 19 19 22 30 28 1 27 12 12 14 17 30 17 26 21 26 27 1 11 23 9 30 18 19 17 29 11 20 29 24\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "50\n22 19 14 22 20 11 16 28 23 15 3 23 6 16 30 15 15 10 24 28 19 19 22 30 28 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe spring is coming and it means that a lot of fruits appear on the counters. One sunny day little boy Valera decided to go shopping. He made a list of m fruits he wanted to buy. If Valera want to buy more than one fruit... | [{"type": "stdin_stdout", "input": "24 24\n25 69 103 18 40 8 78 14 14 10 27 61 75 140 10 69 80 71 102 8 91 14 15 10\nswtcofrcpeys{ydwkrg\nszyd\ndyzsyep\nrcpeyszydwkrgfj\nfgrkwdyzsyfp\ndwyz\nsmzginydyrtua\nj\nk\ntzwsw\ngfj\nmsplnqossy\ninydyrtuatzw\ninxdy\nlpsmzginydyrtuatzwswtcofrcpeyszy\nyssoqnlpsm\npeyszyd\nysosqnlps... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBessie the cow and her best friend Elsie each received a sliding puzzle on Pi Day. Their puzzles consist of a 2 × 2 grid and three tiles labeled 'A', 'B', and 'C'. The three tiles sit on top of the grid, leaving one grid ... | [{"type": "stdin_stdout", "input": "AB\nXC\nXB\nAC\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "AB\nXC\nAX\nCB\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "CB\nAX\nXA\nBC\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "CB\nAX\nCX\nAB\n", "output": "YES\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThink of New York as a rectangular grid consisting of N vertical avenues numerated from 1 to N and M horizontal streets numerated 1 to M. C friends are staying at C hotels located at some street-avenue crossings. They are... | [{"type": "stdin_stdout", "input": "100 100\n10\n53 20\n97 6\n12 74\n48 92\n97 13\n47 96\n123 32\n69 21\n95 75\n1 54\n10\n36 97\n41 1\n1 87\n39 23\n27 44\n73 97\n1 1\n6 26\n48 3\n5 69\n", "output": "108\n4\n"}, {"type": "stdin_stdout", "input": "100 100\n10\n53 20\n97 6\n12 74\n48 92\n97 13\n47 96\n123 32\n69 21\n95 75... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, you will be given a number and your task will be to return the nearest prime number. \n\n```Haskell\nsolve(4) = 3. The nearest primes are 3 and 5. If difference is equal, pick the lower one. \nsolve(125) = 1... | [{"input": "10000000000", "output": "[10000000019]", "fn_name": "solve"}, {"input": "3500000", "output": "[3499999]", "fn_name": "solve"}, {"input": "350000", "output": "[350003]", "fn_name": "solve"}, {"input": "35000", "output": "[34981]", "fn_name": "solve"}, {"input": "1110", "output": "[1109]", "fn_name": "solve"}... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start i... | [{"type": "stdin_stdout", "input": "100 3 4\n644\n861\n478\n250\n560\n998\n141\n162\n386\n778\n123\n811\n602\n533\n391\n515\n898\n215\n965\n556\n446\n883\n256\n195\n573\n889\n515\n240\n179\n339\n258\n593\n930\n730\n735\n949\n522\n067\n549\n366\n452\n405\n473\n188\n488\n994\n000\n046\n930\n217\n897\n580\n509\n032\n343\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N rabbits, numbered 1 through N.\n\nThe i-th (1≤i≤N) rabbit likes rabbit a_i. Note that no rabbit can like itself, that is, a_i≠i.\n\nFor a pair of rabbits i and j (i<j), we call the pair (i,j) a friendly pair i... | [{"type": "stdin_stdout", "input": "5\n5 5 5 -1 2", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n5 5 5 -2 2", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n3 5 5 -1 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n5 5 5 -1 1", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n3 3 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches.\n\nThe current state of ... | [{"type": "stdin_stdout", "input": "20\n10 5 2 3 5 7 7 9 4 9 9 4 9 7 7 5 3 2 5 10\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "20\n10 5 2 3 5 7 7 9 4 9 9 4 9 7 7 5 3 2 5 10\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "20\n10 1 2 3 5 7 7 9 4 9 9 4 9 7 7 5 3 2 5 10\n", "output": "NO\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: \"fced\", \"xyz\", \"r\" and \"dabcef\". ... | [{"type": "stdin_stdout", "input": "69\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n railway stations in Berland. They are connected to each other by n-1 railway sections. The railway network is connected, i.e. can be represented as an undirected tree.\n\nYou have a map of that network, so for... | [{"type": "stdin_stdout", "input": "10\n9 4\n5 7\n2 1\n3 4\n2 10\n6 3\n2 5\n1 3\n4 8\n8\n6 8 3\n10 5 3\n2 10 3\n3 5 2\n8 4 3\n1 9 3\n9 5 2\n3 10 2\n", "output": "3 1 2 3 3 3 3 3 3 \n"}, {"type": "stdin_stdout", "input": "10\n3 6\n3 2\n4 1\n1 10\n3 8\n5 2\n6 7\n2 1\n6 9\n7\n9 10 3\n5 7 1\n9 10 3\n7 4 1\n3 10 4\n3 6 4\n5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTranform of input array of zeros and ones to array in which counts number of continuous ones:\n\n[1, 1, 1, 0, 1] -> [3,1]\n\nWrite your solution by modifying this code:\n\n```python\ndef ones_counter(input):\n\t\n```\n\nY... | [{"input": "[1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1]", "output": "[[1, 2, 4, 1]]", "fn_name": "ones_counter"}, {"input": "[1, 1, 1, 0, 0, 1, 0, 1, 1, 0]", "output": "[[3, 1, 2]]", "fn_name": "ones_counter"}, {"input": "[0, 0, 0, 1, 0, 0, 1, 1]", "output": "[[1, 2]]", "fn_name": "ones_counter"}, {"input": "[0, 0, 0, 0, 0... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the edit distance between given two words s1 and s2.\n\nThe disntace is the minimum number of single-character edits required to change one word into the other. The edits including the following operations:\n\n* inse... | [{"type": "stdin_stdout", "input": "icpc\nipcc", "output": "2\n"}, {"type": "stdin_stdout", "input": "icpb\ncbio", "output": "4\n"}, {"type": "stdin_stdout", "input": "cpci\nipcc", "output": "2\n"}, {"type": "stdin_stdout", "input": "cpci\nccpi", "output": "2\n"}, {"type": "stdin_stdout", "input": "icpc\nccpi", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n Given a rectangular `matrix` and integers `a` and `b`, consider the union of the ath row and the bth (both 0-based) column of the `matrix`. Return sum of all elements of that union.\n\n# Example\n\n For\n```\nmat... | [{"input": "[[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]]\n1\n3", "output": "[12]", "fn_name": "crossing_sum"}, {"input": "[[1, 1], [3, 3], [1, 1], [2, 2]]\n3\n0", "output": "[9]", "fn_name": "crossing_sum"}, {"input": "[[1], [2], [3], [4], [5]]\n0\n0", "output": "[15]", "fn_name": "crossing_sum"}, {"input": "[[1, 2, 3, 4... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are $ 2 $ teams, Team UKU and Team Ushi. Initially, Team UKU has $ N $ people and Team Uku has $ M $ people. Team UKU and Team Ushi decided to play a game called \"U & U\". \"U & U\" has a common score fo... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000010000000", "output": "4\n"}, {"type": "stdin_stdout", "input": "1000000001000000000 1000000000010000000", "output": "2\n"}, {"type": "stdin_stdout", "input": "1000001001000000000 1000000000010000000", "output": "2\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSimply find the closest value to zero from the list. Notice that there are negatives in the list.\n\nList is always not empty and contains only integers. Return ```None``` if it is not possible to define only one of such ... | [{"input": "[28, -36, 49, 39, -33, 22, -5, 23, -24, 47, -47, -30, -20, -18, 40, -21, -45, 10, -48, -26, -12, -21, 48, 16, 26, 21, -9, 33, 8, -49]", "output": "[-5]", "fn_name": "closest"}, {"input": "[20, 26, 13, -47, -35, 39, 24, 46, -16, 5, 46, -30, -33, -38, -47, 23, 10, -39, -36, 41, 5, -24, 28, -30, 40, -24, -28, ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is the hard version of the problem. The only difference is that in this version $1 \\le n \\le 300$.\n\nIn the cinema seats can be represented as the table with $n$ rows and $m$ columns. The rows are numbered with inte... | [{"type": "stdin_stdout", "input": "7\n1 2\n1 1\n3 2\n1 1 2 2 4 6\n3 3\n3 4 4 1 1 1 1 1 5\n2 2\n2 1 2 1\n4 2\n50 50 50 50 3 50 56 50\n4 2\n6 6 6 10 2 2 9 6\n2 9\n1 3 2 3 3 6 1 1 3 2 3 1 1 6 3 1 1 3\n", "output": "0\n1\n2\n0\n0\n0\n12\n"}, {"type": "stdin_stdout", "input": "7\n1 2\n1 1\n3 2\n1 1 2 4 4 6\n3 3\n3 4 4 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn IPv6-address is a 128-bit number. For convenience, this number is recorded in blocks of 16 bits in hexadecimal record, the blocks are separated by colons — 8 blocks in total, each block has four hexadecimal digits. Her... | [{"type": "stdin_stdout", "input": "20\n0:0:9e39:9:b21:c9b:c:0\n0:0:0:0:0:a27:6b:cb0a\n2:7:4d:b:0:3:2:f401\n17:2dc6::0:89e3:0:dc:0\nca:4:0:0:d6:b999:e:0\n4af:553:b29:dd7:2:5b:0:7\n0:c981:8f:a4d:0:d4:0:f61\n0:0:1:0:dc33:0:1964:0\n84:da:0:6d6:0ecc:1:f:0\n4:fb:4d37:0:8c:4:4a52:24\nc:e:a:0:0:0:e:0\n0:3761:72ed:b7:3b0:ff7:f... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya often uses public transport. The transport in the city is of two types: trolleys and buses. The city has n buses and m trolleys, the buses are numbered by integers from 1 to n, the trolleys are numbered by integers ... | [{"type": "stdin_stdout", "input": "680 871 347 800\n10 100\n872 156 571 136 703 201 832 213 15 333\n465 435 870 173 660 237 694 594 423 405 27 866 325 490 255 989 128 345 278 125 708 210 771 848 961 448 871 190 745 343 532 174 103 999 874 221 252 500 886 129 185 208 137 425 758 34 696 15 198 981 91 50 545 885 194 583 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function that takes a number or a string and gives back the number of **permutations without repetitions** that can generated using all of its element.; more on permutations [here](https://en.wikipedia.org/wiki/Pe... | [{"input": "76853", "output": "[120]", "fn_name": "perms"}, {"input": "1397", "output": "[24]", "fn_name": "perms"}, {"input": "\"abc\"", "output": "[6]", "fn_name": "perms"}, {"input": "66666", "output": "[1]", "fn_name": "perms"}, {"input": "\"ab\"", "output": "[2]", "fn_name": "perms"}, {"input": "342", "output": "[... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo players, Red and Blue, are at it again, and this time they're playing with crayons! The mischievous duo is now vandalizing a rooted tree, by coloring the nodes while playing their favorite game.\n\nThe game works as f... | [{"type": "stdin_stdout", "input": "21 2\n1 2\n2 3\n2 4\n4 5\n10 6\n6 7\n13 8\n8 9\n1 10\n3 11\n11 12\n12 13\n3 15\n14 15\n20 16\n14 17\n14 18\n14 19\n14 20\n17 21\n", "output": "-70\n"}, {"type": "stdin_stdout", "input": "21 1\n1 2\n2 3\n2 4\n4 5\n10 6\n6 7\n14 8\n8 9\n9 10\n3 11\n11 12\n12 13\n5 14\n14 15\n14 16\n14 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA card pyramid of height $1$ is constructed by resting two cards against each other. For $h>1$, a card pyramid of height $h$ is constructed by placing a card pyramid of height $h-1$ onto a base. A base consists of $h$ pyr... | [{"type": "stdin_stdout", "input": "50\n11833308\n5211498\n64660\n9077929\n2699416\n2432035\n234901\n1337830\n8457191\n10523566\n5722429\n5452712\n5511654\n8587879\n348160\n3141182\n2661936\n395300\n6950223\n2119926\n4407089\n3559060\n10228325\n5752720\n1607500\n647047\n8904557\n1954681\n698061\n9852830\n1972893\n13760... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWilliam arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.\n\nTh... | [{"type": "stdin_stdout", "input": "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4\n", "output": "1\n2\n3\n4\n5\n5\n6\n8\n"}, {"type": "stdin_stdout", "input": "7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7\n", "output": "1\n1\n3\n3\n3\n6\n"}, {"type": "stdin_stdout", "input": "4 3\n2 1\n4 1\n1 2\n", "output": "1\n2\n3\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N integers A_1, A_2, ..., A_N.\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the K-... | [{"type": "stdin_stdout", "input": "30 413\n-170202098 -268409015 537203564 983211703 11883920 -443999067 -286607651 -159124657 -358352725 526800997 -1907718835 648738515 -1273635706 -1268616353 37909651 -1 1196187672 -20098238 0 -948955241 1 -214720580 287839163 -18897162 694477644 0 -425610555 158912296 842295515 0",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter a long journey, the super-space-time immigrant ship carrying you finally discovered a planet that seems to be habitable. The planet, named JOI, is a harsh planet with three types of terrain, \"Jungle,\" \"Ocean,\" a... | [{"type": "stdin_stdout", "input": "4 7\n4\nJIOJOIJ\nIJIOJOO\nJOIJOOI\nOOJJIJO\n5 7 0 7\n2 2 3 0\n2 3 2 2\n1 1 0 7", "output": "-1 -2 -1\n-1 0 -1\n0 0 0\n0 0 0\n"}, {"type": "stdin_stdout", "input": "4 7\n4\nJIOJOIJ\nIJIOJOO\nJOIJOOI\nOOJJIJO\n5 2 0 7\n2 2 2 0\n2 3 2 2\n1 1 0 7", "output": "-8 -10 -6\n0 0 -1\n0 0 0\n0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJoisino is working as a receptionist at a theater.\nThe theater has 100000 seats, numbered from 1 to 100000.\nAccording to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seat... | [{"type": "stdin_stdout", "input": "2\n151 -2\n0 4", "output": "-147\n"}, {"type": "stdin_stdout", "input": "2\n276 -2\n0 4", "output": "-272\n"}, {"type": "stdin_stdout", "input": "2\n276 -1\n0 4", "output": "-271\n"}, {"type": "stdin_stdout", "input": "2\n276 -1\n0 7", "output": "-268\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n`late_clock` function receive an array with 4 digits and should return the latest time that can be built with those digits.\nThe time should be in `HH:MM` format.\n\nExamples:\n```\n[1, 9, 8, 3] => 19:38\n[9, 1, 2, 5] => ... | [{"input": "[9, 1, 2, 5]", "output": "[\"21:59\"]", "fn_name": "late_clock"}, {"input": "[1, 9, 8, 3]", "output": "[\"19:38\"]", "fn_name": "late_clock"}, {"input": "[0, 2, 2, 2]", "output": "[\"22:20\"]", "fn_name": "late_clock"}, {"input": "[3, 5, 0, 2]", "output": "[\"23:50\"]", "fn_name": "late_clock"}, {"input": "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a beautiful garden of stones in Innopolis.\n\nIts most beautiful place is the $n$ piles with stones numbered from $1$ to $n$.\n\nEJOI participants have visited this place twice. \n\nWhen they first visited it, th... | [{"type": "stdin_stdout", "input": "50\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\n1000 1000 1000 1000 1000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N stones arranged in a row. The i-th stone from the left is painted in the color C_i.\n\nSnuke will perform the following operation zero or more times:\n\n* Choose two stones painted in the same color. Repaint a... | [{"type": "stdin_stdout", "input": "7\n1\n2\n10\n2\n1\n6\n2", "output": "5\n"}, {"type": "stdin_stdout", "input": "7\n1\n2\n1\n2\n3\n3\n2", "output": "6\n"}, {"type": "stdin_stdout", "input": "7\n1\n3\n1\n2\n1\n3\n2", "output": "7\n"}, {"type": "stdin_stdout", "input": "7\n1\n3\n1\n2\n4\n3\n2", "output": "5\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEugeny has array a = a_1, a_2, ..., a_{n}, consisting of n integers. Each integer a_{i} equals to -1, or to 1. Also, he has m queries: Query number i is given as a pair of integers l_{i}, r_{i} (1 ≤ l_{i} ≤ r_{i} ≤ n). ... | [{"type": "stdin_stdout", "input": "10 10\n-1 1 -1 1 -1 -1 -1 -1 -1 -1\n6 10\n4 5\n3 6\n2 3\n3 5\n4 5\n3 4\n1 7\n1 1\n1 1\n", "output": "0\n1\n1\n1\n0\n1\n1\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "10 10\n-1 1 -1 1 -1 -1 -1 -1 -1 -1\n6 13\n4 5\n3 6\n2 3\n0 5\n4 5\n3 4\n1 4\n1 1\n1 1\n", "output": "0\n1\n1\n1\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Russian also. \nChef plays with the sequence of N numbers. During a single move Chef is able to choose a non-decreasing subsequence of the sequence and to remove it from the sequence. Help him ... | [{"type": "stdin_stdout", "input": "4\n20 -1 -2 -4", "output": "4\n"}, {"type": "stdin_stdout", "input": "4\n0 -2 6 10", "output": "2\n"}, {"type": "stdin_stdout", "input": "4\n1 -2 6 10", "output": "2\n"}, {"type": "stdin_stdout", "input": "4\n2 -2 6 10", "output": "2\n"}, {"type": "stdin_stdout", "input": "4\n4 -2 6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n>When no more interesting kata can be resolved, I just choose to create the new kata, to solve their own, to enjoy the process --myjinxin2015 said\n\n# Description:\n Given a string `str` that contains some \"(\" or \")\... | [{"input": "\"())()))))()()(\"", "output": "[4]", "fn_name": "find_longest"}, {"input": "\"())(((\"", "output": "[2]", "fn_name": "find_longest"}, {"input": "\")()(\"", "output": "[2]", "fn_name": "find_longest"}, {"input": "\"((()\"", "output": "[2]", "fn_name": "find_longest"}, {"input": "\"(((\"", "output": "[0]", "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1.\n\nYou are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you... | [{"type": "stdin_stdout", "input": "128982\n", "output": "17 16 15 14 13 11 10 9 8 7 5 3 2\n"}, {"type": "stdin_stdout", "input": "97205\n", "output": "17 15 14 13 12 10 9 8 6 5 3 1 \n"}, {"type": "stdin_stdout", "input": "97205\n", "output": "17 15 14 13 12 10 9 8 6 5 3 1\n"}, {"type": "stdin_stdout", "input": "32698\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called \"Testing Pants for Sadness\".\n\nThe test consists of n questio... | [{"type": "stdin_stdout", "input": "50\n515844718 503470143 928669067 209884122 322869098 241621928 844696197 105586164 552680307 968792756 135928721 842094825 298782438 829020472 791637138 285482545 811025527 428952878 887796419 11883658 546401594 6272027 100292274 308219869 372132044 955814846 644008184 521195760 919... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ strings $s_1, s_2, \\ldots, s_n$ consisting of lowercase Latin letters.\n\nIn one operation you can remove a character from a string $s_i$ and insert it to an arbitrary position in a string $s_j$ ($j$ ma... | [{"type": "stdin_stdout", "input": "4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc\n", "output": "YES\nNO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc\n", "output": "YES\nNO\nYES\nNO\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNaman has two binary strings $s$ and $t$ of length $n$ (a binary string is a string which only consists of the characters \"0\" and \"1\"). He wants to convert $s$ into $t$ using the following operation as few times as po... | [{"type": "stdin_stdout", "input": "12\n011001010101\n111001010101\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12\n011101010101\n101001010101\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12\n011001010101\n111001010101\n", "output": "-1"}, {"type": "stdin_stdout", "input": "12\n011101010101\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLeha is planning his journey from Moscow to Saratov. He hates trains, so he has decided to get from one city to another by car.\n\nThe path from Moscow to Saratov can be represented as a straight line (well, it's not that... | [{"type": "stdin_stdout", "input": "100\n3 3 3 4 7 8 8 8 9 9 10 12 12 13 14 14 15 15 16 17 17 20 21 21 22 22 23 25 29 31 36 37 37 38 39 40 41 41 41 42 43 44 45 46 46 47 47 49 49 49 51 52 52 53 54 55 59 59 59 60 62 63 63 64 66 69 70 71 71 72 74 76 76 77 77 78 78 79 80 81 81 82 82 84 85 86 87 87 87 89 91 92 92 92 92 97 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x_1 = a, another one is in the point x_2 = b. \n\nEach of the friends can move by one along the line in any directi... | [{"type": "stdin_stdout", "input": "864\n179\n", "output": "117649\n"}, {"type": "stdin_stdout", "input": "967\n102\n", "output": "187489\n"}, {"type": "stdin_stdout", "input": "967\n142\n", "output": "170569\n"}, {"type": "stdin_stdout", "input": "967\n282\n", "output": "117649\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are integer sequence of length N, A = (A_1, A_2, \\cdots, A_N), and an integer K.\nFor each X such that 1 \\le X \\le K, find the following value:\n\\left(\\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L+1}^{N} (A_L+A_R)... | [{"type": "stdin_stdout", "input": "192 275\n426 445 272 81 447 129 497 202 275 325 482 284 417 156 432 402 228 37 357 239 418 211 179 6 340 68 368 16 440 263 93 449 491 310 355 68 431 80 257 218 434 328 176 355 221 80 422 45 11 67 467 174 191 4 335 34 465 480 221 395 1 152 325 231 302 153 396 22 489 399 107 466 432 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe problem statement looms below, filling you with determination.\n\nConsider a grid in which some cells are empty and some cells are filled. Call a cell in this grid exitable if, starting at that cell, you can exit the ... | [{"type": "stdin_stdout", "input": "3 3\nXX.\n...\n.XX\n10\n1 3\n1 3\n1 2\n1 2\n3 3\n1 3\n2 3\n3 3\n2 3\n2 2\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3 3\n..X\nX.X\n..X\n10\n2 3\n2 2\n3 3\n1 3\n1 1\n3 3\n3 3\n1 1\n1 2\n1 1\n", "output": "YES\nYES\nYES\nYES\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ beautiful skyscrapers in New York, the height of the $i$-th one is $h_i$. Today some villains have set on fire first $n - 1$ of them, and now the only safety building is $n$-th skyscraper.\n\nLet's call a ju... | [{"type": "stdin_stdout", "input": "8\n7 2 5 5 1 2 5 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "8\n7 2 5 5 1 2 2 2\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "8\n7 2 5 5 2 2 5 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "8\n4 3 5 5 1 2 5 2\n", "output": "4\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce a Mathematician was trapped by military people during a world war with his forty colleagues. The colleagues were without any weapons, only the mathematician had a knife. And with no weapons they were not able to figh... | [{"type": "stdin_stdout", "input": "934\n48171068\n63138680\n25597136\n5610719\n22559303\n19374620\n52609147\n76485130\n4119341\n84687324\n74124384\n29214349\n76525070\n27296334\n62086857\n7062292\n70121510\n32711240\n40766945\n75911566\n64205975\n68575226\n83591193\n54443307\n63540837\n4289505\n8767969\n70478582\n7243... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in a wonderful sunny morning, walking around blocks of ice, Mishka met her friend Chris, and they star... | [{"type": "stdin_stdout", "input": "100\n4 3\n3 4\n5 1\n2 5\n5 3\n1 5\n6 3\n2 4\n5 2\n2 6\n5 2\n1 5\n6 3\n1 5\n6 3\n3 4\n5 2\n1 5\n6 1\n1 5\n4 2\n3 5\n6 3\n2 6\n6 3\n1 4\n6 2\n3 4\n4 1\n3 6\n5 1\n2 4\n5 1\n3 4\n6 2\n3 5\n4 1\n2 6\n4 3\n2 6\n5 2\n3 6\n6 2\n3 5\n4 3\n1 5\n5 3\n3 6\n4 2\n3 4\n6 1\n3 4\n5 2\n2 6\n5 2\n2 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKuro has just learned about permutations and he is really excited to create a new permutation type. He has chosen $n$ distinct positive integers and put all of them in a set $S$. Now he defines a magical permutation to be... | [{"type": "stdin_stdout", "input": "69\n1034 414 632 614 62 855 915 385 1098 8 462 1750 1227 960 450 25 1307 578 37 262 482 1143 844 696 1004 1008 70 1137 509 1217 561 557 192 513 792 794 1335 1201 1290 543 698 55 119 536 1088 162 1074 676 246 457 662 595 1054 1252 778 165 703 1222 326 158 145 272 729 381 1087 1261 717... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Kingdom of Kremland is a tree (a connected undirected graph without cycles) consisting of $n$ vertices. Each vertex $i$ has its own value $a_i$. All vertices are connected in series by edges. Formally, for every $1 \\... | [{"type": "stdin_stdout", "input": "44\n42 44 4 24 29 17 32 30 30 9 28 9 22 16 20 41 17 19 41 23 28 19 38 44 1 34 41 34 19 36 32 37 22 31 4 3 27 23 21 21 26 39 20 8\n", "output": "6926\n"}, {"type": "stdin_stdout", "input": "44\n42 44 4 24 29 17 32 30 30 9 28 9 22 16 20 41 17 19 41 23 28 19 38 44 1 34 41 34 19 36 32 37... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 40XX, the Earth was invaded by aliens! Already most of the Earth has been dominated by aliens, leaving Tsuruga Castle Fortress as the only remaining defense base. Suppression units are approaching the Tsuruga Castle Fo... | [{"type": "stdin_stdout", "input": "110 5\n111 101 5 5\n110 110 2 3\n-112 -100 5 11\n-208 160 109 90\n-110 159 10 3\n26 11\n15 -1 5 2\n25 0 5 1\n35 0 5 1\n118 0 5 1\n55 0 5 1\n65 0 5 1\n149 -1 5 1\n169 0 1 1\n90 0 5 1\n-19 -1 5 20\n-30 0 500 5\n0 0", "output": "1\n4\n"}, {"type": "stdin_stdout", "input": "100 5\n111 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function to split a string and convert it into an array of words. For example:\n\n```python\n\"Robin Singh\" ==> [\"Robin\", \"Singh\"]\n\n\"I love arrays they are my favorite\" ==> [\"I\", \"love\", \"arrays\", \... | [{"input": "\"I love arrays they are my favorite\"", "output": "[[\"I\", \"love\", \"arrays\", \"they\", \"are\", \"my\", \"favorite\"]]", "fn_name": "string_to_array"}, {"input": "\"Robin Singh\"", "output": "[[\"Robin\", \"Singh\"]]", "fn_name": "string_to_array"}, {"input": "\"CodeWars\"", "output": "[[\"CodeWars\"]... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is sad — New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands.\n\nThe local store introduced a new service thi... | [{"type": "stdin_stdout", "input": "11\n1000000000 500000000 500000000\n1000000000 500000000 499999999\n1000000000 499999999 499999999\n500000000 1000000000 500000000\n500000000 1000000000 499999999\n499999999 1000000000 499999999\n500000000 500000000 1000000000\n500000000 499999999 1000000000\n499999999 499999999 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n points on a straight line, and the i-th point among them is located at x_{i}. All these coordinates are distinct.\n\nDetermine the number m — the smallest number of points you should add on the line to make th... | [{"type": "stdin_stdout", "input": "10\n711183437 845779129 -106125616 -481773790 66231250 -183390793 -711197523 -196001897 -440633306 -873649505\n", "output": "156311685\n"}, {"type": "stdin_stdout", "input": "10\n711183437 845779129 -106125616 -481773790 66231250 -183390793 -711197523 -196001897 -440633306 -873649505... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour task is to return the number of visible dots on a die after it has been rolled(that means the total count of dots that would not be touching the table when rolled)\n\n6, 8, 10, 12, 20 sided dice are the possible inpu... | [{"input": "19\n20", "output": "[208]", "fn_name": "totalAmountVisible"}, {"input": "15\n20", "output": "[204]", "fn_name": "totalAmountVisible"}, {"input": "6\n20", "output": "[195]", "fn_name": "totalAmountVisible"}, {"input": "8\n20", "output": "[197]", "fn_name": "totalAmountVisible"}, {"input": "12\n12", "output":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. \n\nHan Solo has the newest duplex ... | [{"type": "stdin_stdout", "input": "10 -4 -4\n2 -4\n2 0\n-4 2\n5 -4\n-3 -5\n1 4\n-4 2\n-3 5\n0 -3\n2 4\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "10 -4 -4\n2 -4\n2 0\n-4 2\n5 -4\n-3 -5\n1 4\n-4 2\n-3 5\n0 -3\n2 4\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "10 -4 -4\n1 -4\n2 0\n-4 2\n5 -4\n-3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHanh lives in a shared apartment. There are $n$ people (including Hanh) living there, each has a private fridge. \n\n$n$ fridges are secured by several steel chains. Each steel chain connects two different fridges and is ... | [{"type": "stdin_stdout", "input": "10\n10 10\n8 9 2 10 3 8 10 9 1 10\n10 10\n3 10 3 13 12 14 3 3 4 4\n10 5\n7 13 10 14 5 12 5 5 7 11\n10 10\n12 13 3 6 12 9 6 6 5 7\n10 10\n4 10 15 13 13 15 9 8 8 14\n10 10\n2 3 8 5 9 7 11 12 7 9\n10 10\n12 15 11 10 1 8 10 3 4 2\n10 5\n8 11 7 14 7 9 5 2 8 9\n10 10\n4 9 9 9 10 4 1 12 13 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a dictionary $M$ that stores elements formed by a pair of a string key and an integer value, perform a sequence of the following operations. Note that each key in $M$ must be unique.\n\n* insert($key$, $x$): Insert an... | [{"type": "stdin_stdout", "input": "7\n0 blue 4\n0 red -1\n0 white 9\n1 red\n1 blue\n0 black 11\n1 black", "output": "-1\n4\n11\n"}, {"type": "stdin_stdout", "input": "7\n0 blue 15\n0 red 1\n0 whiue 5\n1 red\n1 blue\n0 black 11\n1 black", "output": "1\n15\n11\n"}, {"type": "stdin_stdout", "input": "7\n0 blue 4\n0 red -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several advan... | [{"type": "stdin_stdout", "input": "285642 492030 560100 388288 354938 20867\n", "output": "216690.214383517276\n"}, {"type": "stdin_stdout", "input": "111724 287004 931554 512877 139642 23002\n", "output": "257255.653204436792"}, {"type": "stdin_stdout", "input": "246310 320553 585881 278070 443362 23788\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as p... | [{"type": "stdin_stdout", "input": "13 78\n10 2\n6 5\n5 7\n10 3\n6 13\n4 7\n4 13\n1 12\n13 2\n1 7\n10 5\n10 13\n12 2\n10 6\n5 3\n10 8\n9 11\n6 1\n4 5\n12 3\n6 7\n8 2\n1 9\n4 11\n5 8\n6 3\n9 5\n5 2\n13 11\n10 4\n12 7\n5 13\n12 8\n10 12\n6 12\n5 11\n1 8\n7 8\n12 4\n10 7\n1 5\n1 2\n10 11\n2 11\n12 13\n9 7\n8 3\n12 9\n9 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is September 9 in Japan now.\nYou are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?\n\n-----Constraints-----\n - 10≤N≤99\n\n-----Input-----\nInput is given from Standard... | [{"type": "stdin_stdout", "input": "29\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "91\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "929", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "109", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "189", "output": "Yes\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHarry Potter has a difficult homework. Given a rectangular table, consisting of n × m cells. Each cell of the table contains the integer. Harry knows how to use two spells: the first spell change the sign of the integers ... | [{"type": "stdin_stdout", "input": "10 20\n0 -7 2 -3 3 5 10 4 -8 7 1 -2 8 9 8 9 -4 -5 8 4\n-4 -1 0 0 8 6 4 8 10 0 5 5 9 5 10 1 8 1 1 9\n-8 9 7 2 9 7 5 -1 8 9 -7 9 4 2 2 -4 8 8 0 9\n7 9 10 6 -1 10 -4 6 3 1 9 4 7 -1 10 4 10 -6 -7 7\n-9 7 -2 10 2 1 1 4 5 6 6 10 7 11 9 1 8 9 5 -6\n5 5 10 6 9 3 0 5 1 2 8 3 3 9 5 7 8 -4 4 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two binary strings $a$ and $b$ of the same length. You can perform the following two operations on the string $a$:\n\n Swap any two bits at indices $i$ and $j$ respectively ($1 \\le i, j \\le n$), the cost ... | [{"type": "stdin_stdout", "input": "91\n0010010000110001001011011011111001000110001000100111110010010001100110010111100111011111100\n1101110110000100110000100011010110111101100000011011100111111000110000001101101111100100101\n", "output": "43\n"}, {"type": "stdin_stdout", "input": "91\n001001000011000100101101101111100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integers $n$ and $k$. Print the $k$-th positive integer that is not divisible by $n$.\n\nFor example, if $n=3$, and $k=7$, then all numbers that are not divisible by $3$ are: $1, 2, 4, 5, 7, 8, ... | [{"type": "stdin_stdout", "input": "6\n2 7\n4 12\n2 1000000000\n7 97\n1000000000 1000000000\n2 1\n", "output": "\n13\n\n15\n\n1999999999\n\n113\n\n1000000001\n\n1\n"}, {"type": "stdin_stdout", "input": "6\n2 7\n4 12\n4 1000000000\n7 97\n1000000000 1000000000\n2 1\n", "output": "\n13\n\n15\n\n1333333333\n\n113\n\n100000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSantosh has a farm at Byteland. He has a very big family to look after. His life takes a sudden turn and he runs into a financial crisis. After giving all the money he has in his hand, he decides to sell his plots. The s... | [{"type": "stdin_stdout", "input": "2\n15 28\n13 1", "output": "420\n13\n"}, {"type": "stdin_stdout", "input": "2\n11 28\n13 1", "output": "308\n13\n"}, {"type": "stdin_stdout", "input": "2\n11 28\n12 1", "output": "308\n12\n"}, {"type": "stdin_stdout", "input": "2\n11 51\n12 1", "output": "561\n12\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlperen has two strings, $s$ and $t$ which are both initially equal to \"a\".\n\nHe will perform $q$ operations of two types on the given strings:\n\n$1 \\;\\; k \\;\\; x$ — Append the string $x$ exactly $k$ times at the ... | [{"type": "stdin_stdout", "input": "3\n5\n2 1 aa\n1 2 a\n2 3 a\n1 2 b\n2 3 abca\n2\n1 5 mihai\n2 2 buiucani\n3\n1 5 b\n2 3 a\n2 4 paiu\n", "output": "YES\nNO\nYES\nNO\nYES\nNO\nYES\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "1\n8\n2 7 z\n1 2 xpt\n2 5 aosu\n2 3 veel\n1 3 dnx\n1 8 tgly\n2 5 rqlmvchcir\n1 10 qklu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first a... | [{"type": "stdin_stdout", "input": "20 30\n19 29\n2 1 2 2 3 3 4 4 7 7 7 9 8 8 8 8 1 0 9 10\n6 9 9 7 9 9 9 9 5 9 9 9 9 18 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "20 30\n19 29\n2 1 2 2 2 3 4 4 7 10 7 8 8 8 8 8 9 9 9 9\n6 9 9 9 9 9 9 9 9 9 9 9 9 18 9 9 10 10 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe determinant of a matrix 2 × 2 is defined as follows:$\\operatorname{det} \\left(\\begin{array}{ll}{a} & {b} \\\\{c} & {d} \\end{array} \\right) = a d - b c$\n\nA matrix is called degenerate if its determinant is equal... | [{"type": "stdin_stdout", "input": "1000000000 -1000000000\n1000000000 1000000000\n", "output": "1000000000.0000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n1000000000 -1000000000\n", "output": "1000000000.0000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 -1000000000\n1000000000 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-n... | [{"type": "stdin_stdout", "input": "50 20\n592183311 362557946 154127088 616872926 395353745 675069471 509655682 79915471 356656666 937992998 304422065 724106263 472338455 792258113 796069631 1325917135 201799298 566151622 722278085 827802227 703159587 690854023 925377265 11010958 69791159 990158269 535460930 167415727... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N squares aligned in a row. The i-th square from the left contains an integer a_i.\n\nInitially, all the squares are white. Snuke will perform the following operation some number of times:\n\n* Select K consecut... | [{"type": "stdin_stdout", "input": "10 5\n5 -4 -5 -16 -4 0 2 -4 -1 3", "output": "10\n"}, {"type": "stdin_stdout", "input": "10 5\n6 -4 -5 -16 -4 0 2 -4 -1 3", "output": "11\n"}, {"type": "stdin_stdout", "input": "10 5\n6 -4 -5 -16 -4 0 2 -4 -2 3", "output": "11\n"}, {"type": "stdin_stdout", "input": "10 5\n5 -4 -5 -8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLong ago, when Petya was a schoolboy, he was very much interested in the Petr# language grammar. During one lesson Petya got interested in the following question: how many different continuous substrings starting with the... | [{"type": "stdin_stdout", "input": "bgphoaomnjcjhgkgbflfclbjmkbfonpbmkdomjmkahaoclcbijdjlllnpfkbilgiiidbabgojbbfmliemhicaanadbaahagmfdldbbklelkihlcbkhchlikhefeeafbhkabfdlhnnjnlimbhneafcfeapcbeifgcnaijdnkjpikedmdbhahhgcijddfmamdiaapaeimdhfblpkedamifbbdndmmljmdcffcpmanndeeclnpnkdoieiahchdnkdmfnbocnimclgckdcbp\npcbeifgcna... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n4\n5\n8\n58\n85\n\n\nOutput\n\n2970.000000000\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this ... | [{"type": "stdin_stdout", "input": "4\n5\n10\n108\n152", "output": "9263.000000000000000\n"}, {"type": "stdin_stdout", "input": "4\n5\n20\n55\n152", "output": "5887.500000000000000\n"}, {"type": "stdin_stdout", "input": "4\n2\n11\n55\n152", "output": "5082.000000000000000\n"}, {"type": "stdin_stdout", "input": "4\n5\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nI decided to move and decided to leave this place. There is nothing wrong with this land itself, but there is only one thing to worry about. It's a plum tree planted in the garden. I was looking forward to this plum bloom... | [{"type": "stdin_stdout", "input": "6 3\n2 1\n0 2\n5 8\n1 3\n1 5\n-2 2\n1 1 1 59 30 16\n3 -4\n-3 0\n2 -2\n45 11\n90 6\n135 1\n2 1\n1 3\n5 2\n0 1 1 124 30 22\n-3 0\n1 -2\n37 2\n0 0", "output": "1 2 3 4 5\nNA\n"}, {"type": "stdin_stdout", "input": "6 3\n2 1\n1 2\n5 3\n1 2\n1 5\n-2 3\n1 1 1 90 30 45\n3 -4\n-3 0\n2 -2\n45 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of $n$ non... | [{"type": "stdin_stdout", "input": "50 20\n592183311 362557946 154127088 616872926 395353745 675069471 509655682 79915471 356656666 937992998 304422065 724106263 472338455 792258113 796069631 663370025 201799298 566151622 722278085 508905399 703159587 690854023 925377265 11010958 69791159 990158269 535460930 167415727 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with siz... | [{"type": "stdin_stdout", "input": "50\n840868705 387420489 387420489 795385082 634350497 206851546 536870912 536870912 414927754 306894916 387420489 536870912 387420489 149011306 373106005 536870912 700746206 387420489 777952883 847215247 176645254 576664386 387420489 230876513 536870912 536870912 536870912 387420489 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, ababa is adorable ... | [{"type": "stdin_stdout", "input": "aaaaaaabbbbbbcder\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "aaaaaaaabbbbbcder\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "abaaaaaabbbbbcder\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "abaaaaaabbbbbcdes\n", "output": "No\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. \n\nFor... | [{"type": "stdin_stdout", "input": "40\n313 97063\n372 23668\n377 56079\n428 88458\n435 57330\n454 88869\n456 75553\n466 87607\n468 4542\n469 30243\n471 8958\n472 59745\n473 90985\n474 32247\n475 71576\n476 14016\n477 91574\n478 38345\n479 93280\n480 89902\n481 41828\n482 3233\n483 66725\n484 23523\n485 46772\n486 9568... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the game of Mastermind, there are two players — Alice and Bob. Alice has a secret code, which Bob tries to guess. Here, a code is defined as a sequence of n colors. There are exactly n+1 colors in the entire universe, ... | [{"type": "stdin_stdout", "input": "7\n5 2 4\n3 1 1 2 5\n5 3 4\n1 1 2 1 2\n4 0 4\n5 5 3 3\n4 1 1\n2 3 2 3\n6 1 2\n3 2 1 1 1 1\n6 2 4\n3 3 2 1 1 1\n6 3 6\n1 1 3 2 1 1\n", "output": "YES\n5 1 1 4 2 \nYES\n3 1 1 1 2 \nYES\n3 3 5 5 \nYES\n1 1 1 3 \nYES\n4 4 4 4 3 1 \nYES\n2 1 4 4 1 1 \nYES\n2 1 1 3 1 1 \n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n*Shamelessly stolen from Here :)*\n\nYour server has sixteen memory banks; each memory bank can hold any number of blocks. You must write a routine to balance the blocks between the memory banks.\n\nThe reallocation routi... | [{"input": "[53, 21, 10, 0, 1, 7, 13, 14, 3, 12, 8, 10, 7, 12, 0, 60]", "output": "[316]", "fn_name": "mem_alloc"}, {"input": "[14, 21, 10, 0, 1, 7, 0, 14, 3, 12, 8, 10, 17, 12, 0, 19]", "output": "[826]", "fn_name": "mem_alloc"}, {"input": "[17, 17, 3, 5, 1, 10, 6, 2, 0, 12, 8, 11, 16, 2, 1, 6]", "output": "[158378]",... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Berland University is preparing to celebrate the 256-th anniversary of its founding! A specially appointed Vice Rector for the celebration prepares to decorate the campus. In the center of the campus n ice sculptures ... | [{"type": "stdin_stdout", "input": "97\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 -1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 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\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "97\n0 0 0 0 0 0 0 0 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is drawing a segment on grid paper.\n\nFrom a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).\n\nWhen Takahashi draws a segment connecting the lower left... | [{"type": "stdin_stdout", "input": "124 -2 -1 -1", "output": "125\n"}, {"type": "stdin_stdout", "input": "241 -2 -1 -1", "output": "242\n"}, {"type": "stdin_stdout", "input": "121 -1 -1 0", "output": "122\n"}, {"type": "stdin_stdout", "input": "116 1 -2 -1", "output": "118\n"}, {"type": "stdin_stdout", "input": "209 -1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn genetics a reading frame is a way to divide a sequence of nucleotides (DNA bases) into a set of consecutive non-overlapping triplets (also called codon). Each of this triplets is translated into an amino-acid during a ... | [{"input": "\"AGGTGACACCGCAAGCCTTATATTAGC\"", "output": "[[\"R*HRKPYIS\", \"GDTASLIL\", \"VTPQALY*\", \"ANIRLAVSP\", \"LI*GLRCH\", \"*YKACGVT\"]]", "fn_name": "translate_with_frame"}, {"input": "\"AGGTGACACCGCAAGCCTTATATTAGC\"\n[1, 2]", "output": "[[\"R*HRKPYIS\", \"GDTASLIL\"]]", "fn_name": "translate_with_frame"}, {"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains 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": "00000000000000000000000000000000000000000000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "110996812575168252737244204200508745829735318381381\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "122094830270541438292052920866473330280784608392695\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integers d and s. Find minimal positive integer n which is divisible by d and has sum of digits equal to s.\n\nInput\n\nThe first line contains two positive integers d and s (1 ≤ d ≤ 500, 1 ≤ s ... | [{"type": "stdin_stdout", "input": "500 5000\n", "output": "99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInaka has a disc, the circumference of which is $n$ units. The circumference is equally divided by $n$ points numbered clockwise from $1$ to $n$, such that points $i$ and $i + 1$ ($1 \\leq i < n$) are adjacent, and so are... | [{"type": "stdin_stdout", "input": "30000 28\n10601 1119\n11119 20601\n9493 25771\n14351 4869\n13101 3619\n23101 13619\n29869 9351\n6119 15601\n3101 23619\n1851 22369\n11851 2369\n8619 18101\n19579 20882\n18619 28101\n16851 7369\n8101 28619\n24869 4351\n24351 14869\n27369 6851\n9869 19351\n5601 26119\n3976 21301\n21851... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA histogram is made of a number of contiguous bars, which have same width.\n\nFor a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the la... | [{"type": "stdin_stdout", "input": "8\n1 20 9 13 4 10 1 26", "output": "27\n"}, {"type": "stdin_stdout", "input": "8\n1 36 9 13 4 10 1 26", "output": "36\n"}, {"type": "stdin_stdout", "input": "8\n1 36 9 13 4 10 1 38", "output": "38\n"}, {"type": "stdin_stdout", "input": "8\n1 20 3 13 4 7 1 26", "output": "26\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Introduction \n\nDigital Cypher assigns a unique number to each letter of the alphabet:\n\n```\n a b c d e f g h i j k l m n o p q r s t u v w x y z\n 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15... | [{"input": "\"notencrypted\"\n[14, 15, 20, 5, 14, 3, 18, 25, 16, 20, 5, 4]", "output": "[0]", "fn_name": "find_the_key"}, {"input": "\"masterpiece\"\n[14, 10, 22, 29, 6, 27, 19, 18, 6, 12, 8]", "output": "[1939]", "fn_name": "find_the_key"}, {"input": "\"tenthousand\"\n[21, 5, 14, 20, 8, 16, 21, 19, 1, 14, 5]", "output... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an array $A_1, A_2, ..., A_N$, count the number of subarrays of array $A$ which are non-decreasing.\n\nA subarray $A[i, j]$, where $1 ≤ i ≤ j ≤ N$ is a sequence of integers $A_i, A_i+1, ..., A_j$.\nA subarray $A[i, ... | [{"type": "stdin_stdout", "input": "2\n4\n-1 1 2 2\n1\n4", "output": "10\n1\n"}, {"type": "stdin_stdout", "input": "2\n4\n1 4 2 3\n1\n5\n", "output": "6\n1\n"}, {"type": "stdin_stdout", "input": "2\n4\n1 2 2 3\n1\n5", "output": "10\n1\n"}, {"type": "stdin_stdout", "input": "2\n4\n1 2 2 3\n1\n2", "output": "10\n1\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonocarp is playing a game \"Assimilation IV\". In this game he manages a great empire: builds cities and conquers new lands.\n\nMonocarp's empire has $n$ cities. In order to conquer new lands he plans to build one Monume... | [{"type": "stdin_stdout", "input": "3 5\n1 4 4 3 4\n1 4 1 4 2\n1 4 4 4 3\n", "output": "\n166374062\n"}, {"type": "stdin_stdout", "input": "3 5\n1 4 4 3 4\n1 4 1 4 2\n1 4 4 4 3\n", "output": "166374062\n"}, {"type": "stdin_stdout", "input": "3 5\n1 4 4 3 4\n1 4 2 4 2\n1 4 4 4 3\n", "output": "831870297\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree with n nodes. You have to write non-negative integers on its edges so that the following condition would be satisfied:\n\nFor every two nodes i, j, look at the path between them and count the sum of n... | [{"type": "stdin_stdout", "input": "40\n11 8\n18 34\n21 23\n6 7\n23 28\n27 14\n8 18\n12 1\n27 4\n11 30\n40 22\n29 19\n17 32\n13 12\n15 9\n34 5\n27 37\n20 2\n18 33\n39 13\n27 17\n35 1\n40 3\n11 21\n1 35\n20 10\n27 20\n1 16\n27 6\n11 26\n38 36\n40 11\n17 25\n2 38\n40 39\n1 15\n12 27\n30 29\n14 14\n", "output": "12 1 1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0.\n\nWrite the program which finds the number of points i... | [{"type": "stdin_stdout", "input": "100 100 100\n-100 100 -100\n", "output": "1"}, {"type": "stdin_stdout", "input": "12 -32 89\n0 67 -23\n", "output": "1"}, {"type": "stdin_stdout", "input": "-1 1 -1\n-1 1 -1\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "0 -1 -1\n-1 -1 -1\n", "output": "1\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe legendary Farmer John is throwing a huge party, and animals from all over the world are hanging out at his house. His guests are hungry, so he instructs his cow Bessie to bring out the snacks! Moo!\n\nThere are $n$ sn... | [{"type": "stdin_stdout", "input": "100000 12\n8 11\n1 9\n5 4\n11 12\n7 11\n3 4\n6 5\n12 15\n15 13\n13 14\n7 11\n11 14\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "100000 12\n8 10\n1 9\n5 4\n11 12\n7 11\n3 4\n3 5\n12 15\n15 13\n13 14\n7 8\n11 14\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider some positive integer $x$. Its prime factorization will be of form $x = 2^{k_1} \\cdot 3^{k_2} \\cdot 5^{k_3} \\cdot \\dots$\n\nLet's call $x$ elegant if the greatest common divisor of the sequence $k_1, k_2, \\d... | [{"type": "stdin_stdout", "input": "4\n4\n2\n72\n10\n", "output": " 2\n 1\n 61\n ... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.