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\nVasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letter... | [{"type": "stdin_stdout", "input": "10 10 2\nfriuxvShvg\nerslojqtgu\nzeqsmdewry\nwvhbeeyeSu\ngkofbjaavr\ntwkcdxugps\nnzlylSmafu\nstamkpxnzt\nuwxwximkrm\nmzxyboazbl\n100\nmRIfAtrLKmztpVkAmojDCiIgseBwlUilBIiyDQhqNhNAqVLLIobuCIretLdSvixNNdCiouFMXtwHZFlObCeaygmIiFBfaCirbmCa\n", "output": "19\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCity X consists of n vertical and n horizontal infinite roads, forming n × n intersections. Roads (both vertical and horizontal) are numbered from 1 to n, and the intersections are indicated by the numbers of the roads th... | [{"type": "stdin_stdout", "input": "9\n4 5\n2 3\n8 3\n5 6\n9 3\n4 4\n5 4\n4 7\n1 7\n8 4\n1 4\n1 5\n5 7\n7 8\n7 1\n9 9\n8 7\n7 5\n3 7\n6 6\n7 3\n5 2\n3 6\n7 4\n9 6\n5 8\n9 7\n6 3\n7 9\n1 2\n1 1\n6 2\n5 3\n7 2\n1 6\n4 1\n6 1\n8 9\n2 2\n3 9\n2 9\n7 7\n2 8\n9 4\n2 5\n8 6\n3 4\n2 1\n2 7\n6 5\n9 1\n3 3\n3 8\n5 5\n4 3\n3 1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call a string \"s-palindrome\" if it is symmetric about the middle of the string. For example, the string \"oHo\" is \"s-palindrome\", but the string \"aa\" is not. The string \"aa\" is not \"s-palindrome\", because... | [{"type": "stdin_stdout", "input": "mmmmmmmmmmmmmmmm\n", "output": "NIE\n"}, {"type": "stdin_stdout", "input": "mmmmmmmmmmmmmmmm\n", "output": "NIE\n"}, {"type": "stdin_stdout", "input": "mmmmmmmmmmmmmmmn\n", "output": "NIE\n"}, {"type": "stdin_stdout", "input": "nnnnnnnnnnnnn\n", "output": "NIE\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a team of N people. For a particular task, you can pick any non-empty subset of people. The cost of having x people for the task is x^{k}. \n\nOutput the sum of costs over all non-empty subsets of people.\n\n\n--... | [{"type": "stdin_stdout", "input": "1000000000 5000\n", "output": "642932262\n"}, {"type": "stdin_stdout", "input": "1000000000 5000\n", "output": "642932262\n"}, {"type": "stdin_stdout", "input": "158260522 4575\n", "output": "875142289\n"}, {"type": "stdin_stdout", "input": "602436426 4445\n", "output": "582490088\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a polynomial of degree N with integer coefficients: f(x)=a_Nx^N+a_{N-1}x^{N-1}+...+a_0. Find all prime numbers p that divide f(x) for every integer x.\n\nConstraints\n\n* 0 \\leq N \\leq 10^4\n* |a_i| \\leq ... | [{"type": "stdin_stdout", "input": "0\n461740266", "output": "2\n3\n13\n1327\n1487\n"}, {"type": "stdin_stdout", "input": "0\n1326078230", "output": "2\n5\n1051\n126173\n"}, {"type": "stdin_stdout", "input": "0\n754892205", "output": "3\n5\n41\n853\n1439\n"}, {"type": "stdin_stdout", "input": "0\n732779016", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSitting in a station waiting room, Joisino is gazing at her train ticket.\nThe ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).\nIn the formula A op1 B op2 C op3 D = 7, re... | [{"type": "stdin_stdout", "input": "1222\n", "output": "1+2+2+2=7\n"}, {"type": "stdin_stdout", "input": "0290\n", "output": "0-2+9+0=7\n"}, {"type": "stdin_stdout", "input": "3242\n", "output": "3+2+4-2=7\n"}, {"type": "stdin_stdout", "input": "2364", "output": "2+3+6-4=7\n"}, {"type": "stdin_stdout", "input": "1114",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n## Task\n\nYou will receive a string consisting of lowercase letters, uppercase letters and digits as input. Your task is to return this string as blocks separated by dashes (`\"-\"`). The elements of a block should be so... | [{"input": "\"dasf6ds65f45df65gdf651vdf5s1d6g5f65vqweAQWIDKsdds\"", "output": "[\"adefgqsvwADIKQW1456-dfgsv156-dfs56-dfs56-dfs56-df56-d5-d\"]", "fn_name": "blocks"}, {"input": "\"SDF45648374RHF8BFVYg378rg3784rf87g3278bdqG\"", "output": "[\"bdfgqrBDFGHRSVY2345678-grF3478-gF3478-3478-78-8\"]", "fn_name": "blocks"}, {"inp... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmidakuji is a traditional method of lottery in Japan.\nTo make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 [cm], and th... | [{"type": "stdin_stdout", "input": "100 8 8\n", "output": "467571711\n"}, {"type": "stdin_stdout", "input": "100 8 3\n", "output": "938282570\n"}, {"type": "stdin_stdout", "input": "100 8 1\n", "output": "755868507\n"}, {"type": "stdin_stdout", "input": "15 8 5\n", "output": "437760187\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the corresp... | [{"type": "stdin_stdout", "input": "10\njrojjyqqjtrfjf\nvuwzvmwjyfvifdfddymwfuzmvvummwdfzjzdvzuvfvjiuvyzymviyyumvziyimfzfiji\nwxzwojjzqzyqlojjbrjlbqrrwqw\nqfwppnuvbgegbqgbmeqpbguwmmqhunnquepepeewubbmnenvmwhnvhunnmsqmmgfepevupewvenmwpmgspnebv\nrxqzorkizznsiirciokscrrjqqqzkfijrrkkfrqjjifczcjcnqoisorszkjxcxvqzcfczqfcrvfrs... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe last contest held on Johnny's favorite competitive programming platform has been received rather positively. However, Johnny's rating has dropped again! He thinks that the presented tasks are lovely, but don't show th... | [{"type": "stdin_stdout", "input": "3\n576460752303423484\n576460752303423484\n576460752303423485\n", "output": "1152921504606846911\n1152921504606846911\n1152921504606846912\n"}, {"type": "stdin_stdout", "input": "3\n576460752303423484\n576460752303423484\n576460752303423485\n", "output": "1152921504606846911\n1152921... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAuthors have come up with the string $s$ consisting of $n$ lowercase Latin letters.\n\nYou are given two permutations of its indices (not necessary equal) $p$ and $q$ (both of length $n$). Recall that the permutation is t... | [{"type": "stdin_stdout", "input": "6 5\n5 6 1 2 3 4\n6 5 1 2 3 4\n", "output": "YES\nbcdeaa\n"}, {"type": "stdin_stdout", "input": "6 5\n5 6 1 2 3 4\n6 5 1 2 3 4\n", "output": "YES\nbcdeaa\n"}, {"type": "stdin_stdout", "input": "5 2\n5 2 4 3 1\n5 4 3 1 2\n", "output": "YES\nbbbba\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of $2n+1$ integer points on a Cartesian plane. Points are numbered from $0$ to $2n$ inclusive. Let $P_i$ be the $i$-th point. The $x$-coordinate of the point $P_i$ equals $i$. The $y$-coordinate of the... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000001 1000000000000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn AI has infected a text with a character!! \n\nThis text is now **fully mutated** to this character.\n\nIf the text or the character are empty, return an empty string. \nThere will never be a case when both are empty a... | [{"input": "\"_3ebzgh4\"\n\"&\"", "output": "[\"&&&&&&&&\"]", "fn_name": "contamination"}, {"input": "\"//case\"\n\" \"", "output": "[\" \"]", "fn_name": "contamination"}, {"input": "\"abc\"\n\"z\"", "output": "[\"zzz\"]", "fn_name": "contamination"}, {"input": "\"abc\"\n\"\"", "output": "[\"\"]", "fn_name": "cont... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKostya likes the number 4 much. Of course! This number has such a lot of properties, like:\n\n- Four is the smallest composite number;\n- It is also the smallest Smith number;\n- The smallest non-cyclic group has four ele... | [{"type": "stdin_stdout", "input": "5\n794947\n1850\n2424\n119\n24", "output": "2\n0\n2\n0\n1\n"}, {"type": "stdin_stdout", "input": "5\n447474\n228\n6664\n40\n81\n", "output": "4\n0\n1\n1\n0\n"}, {"type": "stdin_stdout", "input": "5\n1167956\n340\n2424\n40\n42", "output": "0\n1\n2\n1\n1\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp starts his own business. Tomorrow will be the first working day of his car repair shop. For now the car repair shop is very small and only one car can be repaired at a given time.\n\nPolycarp is good at marketing... | [{"type": "stdin_stdout", "input": "30\n522692116 159\n589719489 488\n662495181 961\n915956552 470\n683572975 271\n498400137 480\n327010963 181\n200704287 367\n961198611 54\n978100746 208\n345455616 986\n106372142 876\n446972337 42\n309349333 200\n93462198 543\n167946793 318\n325598940 427\n121873339 459\n174934933 598... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: \"Fox\"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. \n\nAfter checking some e... | [{"type": "stdin_stdout", "input": "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkoatks\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever\n", "output": "aghjlopqrstuvwxyznefikdmbc\n"}, {"type": "stdin_stdout", "input": "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkoatks\ndmitriyh\nma... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n### Task:\n\nYou have to write a function `pattern` which returns the following Pattern(See Examples) upto (2n-1) rows, where n is parameter.\n\n* Note:`Returning` the pattern is not the same as `Printing` the pattern.\n\... | [{"input": "15", "output": "[\"1 1\\n 2 2 \\n 3 3 \\n 4 4 \\n 5 5 \\n 6 6 \\n 7 7 \\n 8 8 \\n 9 9 \\n ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of o... | [{"type": "stdin_stdout", "input": "1000000000 -1000000000\n1000000000 1000000000\n-1000000000 -1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1000000000 -1000000000\n1000000000 1000000000\n-1000000000 -1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1000000000 -1000000000\n1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Introduction\n\n\nFish are an integral part of any ecosystem. Unfortunately, fish are often seen as high maintenance. Contrary to popular belief, fish actually reduce pond maintenance as they graze on string algae and b... | [{"input": "\"111111111111111111112222222222\"", "output": "[5]", "fn_name": "fish"}, {"input": "\"151128241212192113722321331\"", "output": "[5]", "fn_name": "fish"}, {"input": "\"111122223333\"", "output": "[4]", "fn_name": "fish"}, {"input": "\"111111111111\"", "output": "[3]", "fn_name": "fish"}, {"input": "\"11112... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGigi is a clever monkey, living in the zoo, his teacher (animal keeper) recently taught him some knowledge of \"0\".\n\nIn Gigi's eyes, \"0\" is a character contains some circle(maybe one, maybe two).\n\nSo, a is a \"0\",... | [{"input": "\"abcdefghijklmnopqrstuvwxyz\"", "output": "[8]", "fn_name": "countzero"}, {"input": "\"1234567890\"", "output": "[5]", "fn_name": "countzero"}, {"input": "\"0oO0oO\"", "output": "[6]", "fn_name": "countzero"}, {"input": "\"BRA\"", "output": "[3]", "fn_name": "countzero"}, {"input": "\"()\"", "output": "[1]... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a function that will return true if all numbers in the sequence follow the same counting pattern. If the sequence of numbers does not follow the same pattern, the function should return false.\n\nSequences will be ... | [{"input": "[2, 4, 6, 8, 10, 12, 14, 16, 18, 22]", "output": "[false]", "fn_name": "validate_sequence"}, {"input": "[2, 4, 6, 8, 10, 12, 13, 16, 18, 20]", "output": "[false]", "fn_name": "validate_sequence"}, {"input": "[2, 4, 6, 8, 10, 12, 14, 16, 18, 20]", "output": "[true]", "fn_name": "validate_sequence"}, {"input"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWherever the destination is, whoever we meet, let's render this song together.\n\nOn a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and ... | [{"type": "stdin_stdout", "input": "20 50000 50000\n2 45955 55488\n1 19804 29337\n2 3767 90811\n2 24025 33558\n1 46985 56518\n2 21094 30627\n2 5787 15320\n1 4262 91306\n2 37231 46764\n1 18125 27658\n1 36532 12317\n1 31330 40863\n1 18992 28525\n1 29387 38920\n1 44654 54187\n2 45485 55018\n2 36850 46383\n1 44649 54182\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXXI Berland Annual Fair is coming really soon! Traditionally fair consists of $n$ booths, arranged in a circle. The booths are numbered $1$ through $n$ clockwise with $n$ being adjacent to $1$. The $i$-th booths sells som... | [{"type": "stdin_stdout", "input": "78 74\n20194 1621 21498 13827 31277 19791 6583 13579 11160 20419 26490 160 3450 12925 18134 10381 27009 28815 10209 6478 18504 15371 32608 14197 12075 13723 12612 19020 28762 11057 12891 31164 16684 13717 19933 25453 2742 4955 6814 2863 10397 15461 20616 10905 2600 20137 4681 9199 27... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFrog Gorf is traveling through Swamp kingdom. Unfortunately, after a poor jump, he fell into a well of $n$ meters depth. Now Gorf is on the bottom of the well and has a long way up.\n\nThe surface of the well's walls vary... | [{"type": "stdin_stdout", "input": "19\n1 1 3 4 5 3 5 0 0 6 3 1 10 3 13 9 1 4 2\n3 0 6 3 8 6 8 7 8 6 0 0 5 0 0 1 1 1 0\n", "output": "5\n17 15 2 1 0\n"}, {"type": "stdin_stdout", "input": "19\n1 1 3 4 5 3 5 11 0 6 5 3 10 3 13 9 1 4 17\n3 0 6 3 8 6 8 7 8 6 -1 0 5 0 0 1 1 1 0\n", "output": "3\n2 1 0\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string s. Ivan preferred making a new string to finding the old one. \n\nIvan knows some information ... | [{"type": "stdin_stdout", "input": "20\nadabacabaeabacabada 1 359\nabadabacabafabaca 1 213\nacabagabacaba 1 315\ncabaeabacabadabacab 1 268\nfabacabadabacabaeab 1 352\ncabafabacabada 1 28\nacabadabacabaea 1 67\ncabadabacabaeabacaba 1 484\nabacabadabacaba 1 209\nacabaiabacaba 1 251\nacabafabacabadabac 1 475\nabacabaeabac... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads $n$ dices constructed in the same way as Dice I, and determines whether they are all different. For the determination, use the same way as Dice III.\n\nConstraints\n\n* $2 \\leq n \\leq 100$\n*... | [{"type": "stdin_stdout", "input": "3\n-1 10 1 14 13 17\n6 0 35 1 0 0\n4 4 2 7 -1 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "3\n-1 10 1 14 13 17\n6 0 35 1 0 0\n4 4 2 5 -1 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "3\n0 10 1 14 9 17\n6 0 35 1 0 0\n13 4 2 7 -1 -1", "output": "Yes\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp was given an array of $a[1 \\dots n]$ of $n$ integers. He can perform the following operation with the array $a$ no more than $n$ times:\n\nPolycarp selects the index $i$ and adds the value $a_i$ to one of his ch... | [{"type": "stdin_stdout", "input": "50\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWelcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the... | [{"type": "stdin_stdout", "input": "100\nmntyyerijtaaditeyqvxstrwxoxglpaubigaggtrepaegniybvfmssawvhrgjjhwwkwuqhtyrimxvolcstyllbhlcursvgfafpts\nbsgmhsgavsbgtwiiqaigmtyjxihphxdlseeajfywugawigrjruttuykthfrvwagpcsxlxsopnarqcvetnbtvfrvlyymwoyelrlta\n", "output": "300\n67 1 100 88 1 100 93 1 100 70 1 100 46 1 100 96 1 100 88... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConnected undirected graph without cycles is called a tree. Trees is a class of graphs which is interesting not only for people, but for ants too.\n\nAn ant stands at the root of some tree. He sees that there are n vertex... | [{"type": "stdin_stdout", "input": "51\n28 3\n42 40\n40 51\n48 20\n13 28\n18 40\n44 40\n22 5\n22 27\n45 34\n40 9\n34 46\n40 34\n22 1\n22 11\n40 7\n28 40\n40 22\n14 40\n34 30\n40 20\n47 40\n12 34\n28 23\n40 24\n40 43\n41 40\n28 15\n49 32\n40 8\n32 10\n40 50\n40 36\n40 21\n16 33\n40 38\n34 2\n28 16\n34 4\n17 34\n19 40\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.\n\nGiven two strings a and b, find the... | [{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe [Chinese zodiac](https://en.wikipedia.org/wiki/Chinese_zodiac) is a repeating cycle of 12 years, with each year being represented by an animal and its reputed attributes. The lunar calendar is divided into cycles of 6... | [{"input": "6673", "output": "[\"Water Rooster\"]", "fn_name": "chinese_zodiac"}, {"input": "1968", "output": "[\"Earth Monkey\"]", "fn_name": "chinese_zodiac"}, {"input": "2323", "output": "[\"Water Rabbit\"]", "fn_name": "chinese_zodiac"}, {"input": "1938", "output": "[\"Earth Tiger\"]", "fn_name": "chinese_zodiac"},... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro is addicted to a novel. The novel has n volumes in total, and each volume has a different thickness. Taro likes this novel so much that he wants to buy a bookshelf dedicated to it. However, if you put a large bookshe... | [{"type": "stdin_stdout", "input": "3 9\n1051\n300\n800\n200\n100\n600\n900\n1032\n400\n4 3\n1000\n1000\n1000\n0 0", "output": "2151\n1000\n"}, {"type": "stdin_stdout", "input": "3 9\n1051\n300\n800\n200\n100\n600\n900\n1032\n400\n4 3\n1000\n1000\n1001\n0 0", "output": "2151\n1001\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA binary heap which satisfies max-heap property is called max-heap. In a max-heap, for every node $i$ other than the root, $A[i] \\leq A[parent(i)]$, that is, the value of a node is at most the value of its parent. The la... | [{"type": "stdin_stdout", "input": "10\n-1 2 2 0 140 11 1 1 12 5", "output": " 140 12 11 1 5 2 1 -1 0 2\n"}, {"type": "stdin_stdout", "input": "10\n0 2 2 0 140 11 1 -1 12 5", "output": " 140 12 11 0 5 2 1 -1 0 2\n"}, {"type": "stdin_stdout", "input": "10\n1 -1 0 0 15 18 1 -1 -1 2", "output": " 18 15 1 0 2 0 1 -1 -1 -1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe store sells $n$ beads. The color of each bead is described by a lowercase letter of the English alphabet (\"a\"–\"z\"). You want to buy some beads to assemble a necklace from them.\n\nA necklace is a set of beads conn... | [{"type": "stdin_stdout", "input": "1\n364 1485\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddeeeeeeeeeeeeeeeeeeeeeeefffffffffffffffffffffffffffgggggggggggggggggggggggggggggggggggggggghhhhhhh... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task:\nThis kata asks you to make a custom esolang interpreter for the language [MiniBitMove](https://esolangs.org/wiki/MiniBitMove). MiniBitMove has only two commands and operates on a array of bits. It works like this... | [{"input": "\"100\"\n\"1111111111\"", "output": "[\"0101010101\"]", "fn_name": "interpreter"}, {"input": "\"0\"\n\"100010001\"", "output": "[\"100010001\"]", "fn_name": "interpreter"}, {"input": "\"10\"\n\"1100101\"", "output": "[\"0011010\"]", "fn_name": "interpreter"}, {"input": "\"101010\"\n\"111\"", "output": "[\"0... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCodeforces user' handle color depends on his rating — it is red if his rating is greater or equal to 2400; it is orange if his rating is less than 2400 but greater or equal to 2200, etc. Each time participant takes part i... | [{"type": "stdin_stdout", "input": "9\nmwAz9lQ 1786 -1631\nnYgYFXZQfY -1849 -1775\nKU4jF -1773 -3376\nopR 3752 2931\nGl -1481 -1002\nR -1111 3778\n0i9B21DC 3650 279\nQ8L2dS0 358 -3305\ng -2662 3968\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "9\nmwAz9lQ 1786 -1631\nnYgYFXZQfY -1849 -1775\nKU4jF -1773 -3376... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to ... | [{"type": "stdin_stdout", "input": "babbbbabbabbbababbabbbbbbabaabaababaaabbbbbabbbbaaaaabbaaabbaabaabbbbabbbababbabaaabbababaaababbbaaa\n", "output": "babababababababababababa\n"}, {"type": "stdin_stdout", "input": "aaabbbabaaabababbaaababbababbbabbbbaabaabbaaabbaaaaabbbbabbbbbaaababaabaababbbbbbabbababbbabbabbbbab\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Bob got to a sale of old TV sets. There were n TV sets at that sale. TV set with index i costs ai bellars. Some TV sets have a negative price — their owners are ready to pay Bob if he buys their useless apparatus. Bo... | [{"type": "stdin_stdout", "input": "99 17\n-993 -1745 -959 -989 -991 -995 -976 -997 -990 -1000 -996 -994 -999 -354 -1000 -983 -979 -1000 -989 -968 -994 -992 -962 -1593 -999 -983 -991 -979 -995 -993 -973 -999 -995 -995 -999 -993 -995 -992 -947 -1000 -999 -998 -982 -988 -757 -993 -426 -988 -980 -990 -979 -976 -995 -999 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou can't possibly imagine how cold our friends are this winter in Nvodsk! Two of them play the following game to warm up: initially a piece of paper has an integer q. During a move a player should write any integer numbe... | [{"type": "stdin_stdout", "input": "7938986881993\n", "output": "1\n378028993\n"}, {"type": "stdin_stdout", "input": "472670214391\n", "output": "1\n23020027\n"}, {"type": "stdin_stdout", "input": "1468526771489\n", "output": "1\n613783\n"}, {"type": "stdin_stdout", "input": "1245373417369\n", "output": "1\n908209\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider creating the following number pattern.\n\n\n4 8 2 3 1 0 8 3 7 6\n2 0 5 4 1 8 1 0 3\n2 5 9 5 9 9 1 3\n7 4 4 4 8 0 4\n1 8 8 2 8 4\n9 6 0 0 2\n5 6 0 2\n1 6 2\n7 8\nFive\n\n\nThis pattern follows the rules below.\n\n... | [{"type": "stdin_stdout", "input": "4823108376\n2273064329\n0123456789", "output": "5\n1\n4\n"}, {"type": "stdin_stdout", "input": "4823108376\n2314825047\n0123456789", "output": "5\n4\n4\n"}, {"type": "stdin_stdout", "input": "4823108376\n1842094049\n0123456789", "output": "5\n0\n4\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a directed graph with N vertices numbered 1 to N and M edges.\nThe i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins placed along that edge.\nAdditionally, there is a button on Vertex N... | [{"type": "stdin_stdout", "input": "2500 5000 0\n1206 2272 100000\n315 2399 100000\n1186 1435 100000\n303 1569 100000\n2364 581 100000\n1683 1969 100000\n700 1088 100000\n717 410 100000\n1412 1595 100000\n2066 813 100000\n1190 949 100000\n258 2307 100000\n423 2263 100000\n671 425 100000\n1712 1110 100000\n787 1469 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n The sequence of `Chando` is an infinite sequence of all Chando's numbers in ascending order.\n\n A number is called `Chando's` if it is an integer that can be represented as a sum of different positive integer po... | [{"input": "123", "output": "[97530]", "fn_name": "nth_chandos_number"}, {"input": "23", "output": "[3280]", "fn_name": "nth_chandos_number"}, {"input": "9", "output": "[630]", "fn_name": "nth_chandos_number"}, {"input": "2", "output": "[25]", "fn_name": "nth_chandos_number"}, {"input": "1", "output": "[5]", "fn_name":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given two segments s1 and s2, print the distance between them.\n\ns1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.\n\nConstraints\n\n* 1 ≤ q ≤ 1000\n* -10000 ≤ xpi, ypi ≤ 10000\n* p0 ≠ p... | [{"type": "stdin_stdout", "input": "3\n-1 -1 -1 -6 -1 1 1 1\n0 -1 18 -1 2 0 -1 2\n-11 1 2 -1 0 2 -1 0", "output": "2.0000000000\n1.0000000000\n0.5322001449\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1 -1 -6 -1 1 1 1\n0 -1 18 -1 2 0 -1 2\n-11 1 3 -1 0 2 -1 0", "output": "2.0000000000\n1.0000000000\n0.4242640687\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (`HH:MM:SS`)\n\n* `HH` = hours, padded to 2 digits, range: 00 - 99\n* `MM` = minutes, padded to 2 dig... | [{"input": "359999", "output": "[\"99:59:59\"]", "fn_name": "make_readable"}, {"input": "86399", "output": "[\"23:59:59\"]", "fn_name": "make_readable"}, {"input": "86400", "output": "[\"24:00:00\"]", "fn_name": "make_readable"}, {"input": "3599", "output": "[\"00:59:59\"]", "fn_name": "make_readable"}, {"input": "3600... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro is playing with a puzzle that places numbers 1-9 in 9x9 squares. In this puzzle, you have to arrange the numbers according to the following rules.\n\n* One number appears exactly once in the same column\n* A number a... | [{"type": "stdin_stdout", "input": "2\n-1 2 3 3 4 10 8 13 9\n6 5 1 7 39 9 1 2 3\n7 11 11 2 -1 3 2 5 8\n2 4 0 1 6 9 12 9 0\n0 8 7 8 9 1 2 1 4\n8 9 1 0 3 4 2 8 7\n1 4 5 8 7 8 9 1 3\n8 12 8 9 1 4 3 4 5\n12 0 2 3 4 0 13 7 0\n2 1 3 2 5 4 7 8 14\n4 5 6 7 8 9 0 1 3\n7 8 13 1 4 4 8 5 8\n2 6 4 8 6 7 8 9 1\n5 6 12 8 9 1 2 6 3\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes... | [{"type": "stdin_stdout", "input": "138 245 30\n3 5 6 8 9 13 15 16 19 20 24 25 27 29 30 32 33 34 35 36 37 38 40 42 47 51 52 53 55 56 58 59 63 66 67 68 69 72 73 74 75 77 78 80 81 82 85 86 87 89 91 93 95 96 99 100 102 104 105 108 110 111 112 117 122 124 125 128 129 131 133 136 139 144 145 146 147 148 149 151 153 155 156 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour search for Heidi is over – you finally found her at a library, dressed up as a human. In fact, she has spent so much time there that she now runs the place! Her job is to buy books and keep them at the library so tha... | [{"type": "stdin_stdout", "input": "80 4\n71 49 41 21 72 71 37 14 51 59 73 11 70 15 36 46 32 57 58 15 72 67 16 75 70 11 67 3 40 36 2 9 63 68 32 22 63 52 67 55 35 19 72 59 22 19 44 55 59 74 4 34 53 3 22 57 32 27 78 12 71 4 26 15 43 21 79 10 67 39 34 74 38 26 31 78 2 78 69 42\n", "output": "62\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe robot is placed in the top left corner of a grid, consisting of $n$ rows and $m$ columns, in a cell $(1, 1)$.\n\nIn one step, it can move into a cell, adjacent by a side to the current one:\n\n$(x, y) \\rightarrow (x,... | [{"type": "stdin_stdout", "input": "3\n2 3 1 3 0\n2 3 1 3 1\n5 5 3 4 1\n", "output": "3\n-1\n8\n"}, {"type": "stdin_stdout", "input": "2\n3 5 2 3 1\n5 3 3 2 1\n", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\n2 3 1 3 0\n2 3 1 3 1\n", "output": "3\n-1\n"}, {"type": "stdin_stdout", "input": "2\n3 3 2 2 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. \n\nSuitability of string s is calculated by following metric:\n\nAny two letters can be swapped positions, th... | [{"type": "stdin_stdout", "input": "ccaaa?bc?baccbccccbca?cccab??aacccbaac?bccacc?accccaccbcbbcbc\ncbaaacccc\n", "output": "ccaaaabcabaccbccccbcaacccabaaaacccbaaczbccacczaccccaccbcbbcbc\n"}, {"type": "stdin_stdout", "input": "ccaaa?bc?baccbccccbca?cccab??aacccbaac?bccacc?accccaccbcbbcbc\ncbaaacccc\n", "output": "ccaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHarry Water, Ronaldo, Her-my-oh-knee and their friends have started a new school year at their MDCS School of Speechcraft and Misery. At the time, they are very happy to have seen each other after a long time. The sun is ... | [{"type": "stdin_stdout", "input": "2\n10\n10\n", "output": "200\n"}, {"type": "stdin_stdout", "input": "2\n19\n10\n", "output": "380\n"}, {"type": "stdin_stdout", "input": "2\n4\n18\n", "output": "144\n"}, {"type": "stdin_stdout", "input": "2\n6\n18\n", "output": "216\n"}, {"type": "stdin_stdout", "input": "2\n6\n23\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with an... | [{"type": "stdin_stdout", "input": "95 97575868 5\n4612 1644 3613 5413 5649 2419 5416 3926 4610 4419 2796 5062 2112 1071 3790 4220 3955 2142 4638 2832 2702 2115 2045 4085 3599 2452 5495 4767 1368 2344 4625 4132 5755 5815 2581 6259 1330 4938 815 5430 1628 3108 4342 3692 2928 1941 3714 4498 4471 4842 1822 867 3395 2587 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function ```convert_temp(temp, from_scale, to_scale)``` converting temperature from one scale to another. \nReturn converted temp value. \n\nRound converted temp value to an integer(!).\n\nReading: http://en.wikip... | [{"input": "128.25\n\"Ro\"\n\"C\"", "output": "[230]", "fn_name": "convert_temp"}, {"input": "373.15\n\"K\"\n\"N\"", "output": "[33]", "fn_name": "convert_temp"}, {"input": "-273.15\n\"C\"\n\"R\"", "output": "[0]", "fn_name": "convert_temp"}, {"input": "-30\n\"De\"\n\"K\"", "output": "[393]", "fn_name": "convert_temp"}... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Metropolis computer network consists of n servers, each has an encryption key in the range from 0 to 2^k - 1 assigned to it. Let c_i be the encryption key assigned to the i-th server. Additionally, m pairs of servers ... | [{"type": "stdin_stdout", "input": "10 40 10\n838 215 738 782 183 422 127 283 103 129\n1 2\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n2 10\n3 3\n3 5\n3 6\n3 7\n3 8\n3 9\n3 10\n4 5\n4 6\n4 7\n4 9\n4 10\n5 7\n5 8\n5 9\n5 10\n6 7\n6 8\n6 9\n6 10\n7 9\n7 10\n8 10\n9 10\n", "output": "1028608\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUnscramble the eggs.\n\nThe string given to your function has had an \"egg\" inserted directly after each consonant. You need to return the string before it became eggcoded.\n\n## Example\n\nKata is supposed to be for be... | [{"input": "\"veggegeggyeggmeggitegge onegg teggoaseggtegg\"", "output": "[\"vegymite on toast\"]", "fn_name": "unscramble_eggs"}, {"input": "\"seggceggreggameggbeggleggedegg egegggeggsegg\"", "output": "[\"scrambled eggs\"]", "fn_name": "unscramble_eggs"}, {"input": "\"Heggeleggleggo weggoreggleggdegg\"", "output": "[... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe student council has a shared document file. Every day, some members of the student council write the sequence TMT (short for Towa Maji Tenshi) in it.\n\nHowever, one day, the members somehow entered the sequence into ... | [{"type": "stdin_stdout", "input": "5\n3\nTMT\n3\nTMT\n6\nTMTMTT\n6\nTMTTTT\n6\nTTMMTT\n", "output": "YES\nYES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "5\n3\nTMT\n3\nMTT\n6\nTMTMTT\n6\nTMTTTT\n6\nTTMMTT\n", "output": "\nYES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "5\n3\nTMT\n3\nMTT\n6\nTMT... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYaroslav has an array, consisting of (2·n - 1) integers. In a single operation Yaroslav can change the sign of exactly n elements in the array. In other words, in one operation Yaroslav can select exactly n array elements... | [{"type": "stdin_stdout", "input": "56\n-157 136 457 598 -138 -586 -338 752 -566 -718 -333 -965 309 -125 -938 -188 -390 17 -75 -902 -320 163 820 -970 -525 -329 81 488 -412 978 138 344 305 -358 -273 -967 253 -665 -245 187 602 252 -825 -511 828 764 -402 278 995 541 542 549 612 -536 527 -884 225 800 160 -409 -926 -795 -32... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ people who want to participate in a boat competition. The weight of the $i$-th participant is $w_i$. Only teams consisting of two people can participate in this competition. As an organizer, you think that i... | [{"type": "stdin_stdout", "input": "4\n14\n2 6 5 9 5 8 13 14 12 5 6 14 5 2\n36\n15 22 27 14 23 36 10 17 33 21 18 22 3 4 32 24 8 19 36 22 17 11 24 10 33 4 30 6 2 17 11 16 18 1 2 20\n2\n2 2\n12\n4 9 10 6 1 9 5 8 12 9 9 12\n", "output": "3\n11\n1\n4\n"}, {"type": "stdin_stdout", "input": "4\n14\n2 6 5 9 5 8 13 14 12 5 6 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice has a string $s$. She really likes the letter \"a\". She calls a string good if strictly more than half of the characters in that string are \"a\"s. For example \"aaabb\", \"axaa\" are good strings, and \"baca\", \"... | [{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "ababababababababababababababababababababababababav\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs their story unravels, a timeless tale is told once again...\n\nShirahime, a friend of Mocha's, is keen on playing the music game Arcaea and sharing Mocha interesting puzzles to solve. This day, Shirahime comes up with ... | [{"type": "stdin_stdout", "input": "5\n7\n?R???BR\n7\n???R???\n1\n?\n1\nB\n10\n?R??RB??B?\n", "output": "BRBRBBR\nBRBRBRB\nR\nB\nBRBRRBRBBR\n"}, {"type": "stdin_stdout", "input": "5\n7\n?R???BR\n7\n???R???\n1\n?\n1\nB\n10\n?R??RB??B?\n", "output": "BRBRBBR\nBRBRBRB\nB\nB\nBRBRRBRBBR\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPrior to having fancy iPhones, teenagers would wear out their thumbs sending SMS\nmessages on candybar-shaped feature phones with 3x4 numeric keypads.\n\n ------- ------- -------\n | | | ABC | | DEF |\n | 1 ... | [{"input": "\"WHERE DO U WANT 2 MEET L8R\"", "output": "[47]", "fn_name": "presses"}, {"input": "\"IS NE1 OUT THERE\"", "output": "[31]", "fn_name": "presses"}, {"input": "\"#codewars #rocks\"", "output": "[36]", "fn_name": "presses"}, {"input": "\"HOW R U\"", "output": "[13]", "fn_name": "presses"}, {"input": "\"ZER0\... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou want to go on a trip with a friend. However, friends who have a habit of spending money cannot easily save travel expenses. I don't know when my friends will go on a trip if they continue their current lives. So, if y... | [{"type": "stdin_stdout", "input": "10000\n1225 3150\n861 12737\n0 -1\n5000 1050\n5000 4211\n5000 412\n5000 5000\n5000 5000\n-1 -1\n5075 1951\n9143 2494\n5000 2100\n29170\n100000 000000\n100010 110000\n100000 100000\n100000 100000\n100100 100100\n100000 111000\n100000 100000\n101000 100000\n100000 100010\n100000 100000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Norge found a string $s = s_1 s_2 \\ldots s_n$ consisting of $n$ lowercase Latin letters. As an exercise to improve his typing speed, he decided to type all substrings of the string $s$. Yes, all $\\frac{n (n + ... | [{"type": "stdin_stdout", "input": "200 13\nvgfjhgkgwkftaeqejmbgildembgxdbskxfndwmcckjfkbeekxkgakmcjhclqsecpnkaigcxxhfghgegfadjktckftdhtifriemfifakygoesjfginnddjjklwiwlbjsgftwhtjdxmcadpvhaeddxwnmguwhetwbmffbmvdvuhecgjckddrbikgwkrfwfhdhqolidgkfm\na b c d e f g h i j k l m\n", "output": "578\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMasha and Grisha like studying sets of positive integers.\n\nOne day Grisha has written a set A containing n different integers a_{i} on a blackboard. Now he asks Masha to create a set B containing n different integers b_... | [{"type": "stdin_stdout", "input": "1\n100\n74 14 24 45 22 9 49 78 79 20 60 1 31 91 32 39 90 5 42 57 30 58 64 68 12 11 86 8 3 38 76 17 98 26 85 92 56 65 89 66 36 87 23 67 13 48 15 47 81 73 117 50 34 93 82 44 77 69 96 100 41 19 35 16 88 27 99 40 62 95 70 18 46 21 53 59 37 6 61 71 2 4 52 28 97 25 29 51 7 33 80 83 72 10 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLord Omkar has permitted you to enter the Holy Church of Omkar! To test your worthiness, Omkar gives you a password which you must interpret!\n\nA password is an array $a$ of $n$ positive integers. You apply the following... | [{"type": "stdin_stdout", "input": "80\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs Famil Door’s birthday is coming, some of his friends (like Gabi) decided to buy a present for him. His friends are going to buy a string consisted of round brackets since Famil Door loves string of brackets of length n... | [{"type": "stdin_stdout", "input": "1980 464\n))(()()))(((((((((()))))))(()(((()((()))()()())()))()))(()))))))(())((())))()())()((())())()())))(())()(()))(()())()((((()))())()(())))))(()()(()(((((()(()()))(((()))(())))))()())(())))))())()()((())))))))((()(())))))()()(()((()((()()))(()))(())(()))()((((())()()))))))()(()... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe \"BerCorp\" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of... | [{"type": "stdin_stdout", "input": "100 100\n1 33\n0\n2 35 4\n2 40 78\n1 69\n0\n1 2\n0\n0\n2 81 34\n1 45\n0\n1 87\n1 50\n1 97\n0\n2 100 59\n0\n0\n0\n1 45\n0\n0\n0\n1 6\n1 54\n0\n0\n0\n4 79 96 52 84\n1 86\n0\n0\n0\n0\n0\n0\n0\n0\n3 90 2 80\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n1 2\n0\n1 64\n0\n1 78\n1 82\n0\n0\n0\n0\n0\n1 6\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe classic programming language of Bitland is Bit++. This language is so peculiar and complicated.\n\nThe language is that peculiar as it has exactly one variable, called x. Also, there are two operations:\n\n Operation... | [{"type": "stdin_stdout", "input": "101\nX++\nX++\nX++\n++X\n--X\nX--\nX++\nX--\nX--\n--X\n--X\n++X\nX++\n++X\n++X\nX--\n--X\n++X\nX++\nX--\n++X\n--X\n--X\n--X\n++X\n--X\n++X\nX++\nX++\n++X\n--X\nX++\nX--\nX++\n++X\n++X\nX--\nX--\nX--\nX++\nX++\nX--\nX--\nX++\n++X\n++X\n++X\n--X\n--X\n++X\nX--\nX--\n--X\n++X\nX--\n++X\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the story of 20XX. The number of air passengers increased as a result of the stable energy supply by the renewable power network and the invention of liquefied synthetic fuel. However, the threat of terrorism by a... | [{"type": "stdin_stdout", "input": "6\n1 1\n.\n3 3\n...\n.W.\n...\n10 10\n..........\n.DDDDCCC..\n.DDDDCCC..\n.DDDDCCC..\nADDDDCCC..\nAAA..CCC..\n..CBBBBAAA\nAAABBBB...\n..BBBBB...\n..........\n10 10\n..........\n.DDDDDD...\n.DDDDCCC..\n.DDDDCCC..\nADDDDCCC..\nAAA.-CCC..\nAAABBBBC..\nAAABBBB...\n..BBBBB...\n..........\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem F Pizza Delivery\n\nAlyssa is a college student, living in New Tsukuba City. All the streets in the city are one-way. A new social experiment starting tomorrow is on alternative traffic regulation reversing the on... | [{"type": "stdin_stdout", "input": "4 5\n1 3 7\n4 2 6\n4 3 0\n2 1 34\n3 3 12", "output": "SOSO\nSOSO\nHAPPY\nHAPPY\nSOSO\n"}, {"type": "stdin_stdout", "input": "4 5\n1 1 5\n3 4 6\n4 2 13\n2 1 6\n2 3 17", "output": "SOSO\nSOSO\nSOSO\nHAPPY\nSOSO\n"}, {"type": "stdin_stdout", "input": "4 5\n1 3 5\n3 4 6\n2 2 7\n2 1 1\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBilly investigates the question of applying greedy algorithm to different spheres of life. At the moment he is studying the application of greedy algorithm to the problem about change. There is an amount of n coins of dif... | [{"type": "stdin_stdout", "input": "91\n4000000 3000000 2900000 2511334 2511333 2102003 1901011 1700000 1200000 999999 800000 750000 600000 508111 202000 101000 35000 20000 9000 5000 2000 899 630 629 628 627 626 625 624 623 622 621 620 619 618 617 616 615 614 613 612 611 610 609 608 607 606 605 604 603 602 601 504 405 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is a simplified version of D2, but it has significant differences, so read the whole statement.\n\nPolycarp has an array of $n$ ($n$ is even) integers $a_1, a_2, \\dots, a_n$. Polycarp conceived of a positive... | [{"type": "stdin_stdout", "input": "10\n10\n25 25 7 61 97 -47 43 7 -11 -29\n10\n44 -10 -10 -64 -64 98 -64 62 -10 -64\n10\n20 50 65 35 65 -40 50 20 -55 -10\n10\n7 -91 -77 -91 -21 7 77 35 21 -7\n10\n56 -76 78 12 -54 -43 23 1 -65 45\n10\n-68 12 -88 -48 52 -8 -28 -8 92 -88\n10\n55 -2 -2 74 36 -59 -59 55 36 -78\n10\n70 -66 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is playing a game of Spaceship Solitaire. The goal of this game is to build a spaceship. In order to do this, he first needs to accumulate enough resources for the construction. There are $n$ types of resources, numbe... | [{"type": "stdin_stdout", "input": "2\n4 4\n9\n1 1 1\n1 2 1\n1 3 1\n2 1 2\n2 2 2\n2 3 2\n2 3 1\n2 2 1\n2 1 1\n", "output": "7\n6\n5\n4\n3\n2\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "2\n4 4\n9\n1 1 1\n1 2 1\n1 3 1\n2 1 2\n2 2 2\n2 3 2\n2 3 1\n2 2 1\n2 1 1\n", "output": "7\n6\n5\n4\n3\n2\n2\n3\n4\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohn Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was fo... | [{"type": "stdin_stdout", "input": "18\n68 32 84 6\n44 53 11 21\n61 34 77 82\n19 36 47 58\n47 73 31 96\n17 50 82 16\n57 90 64 8\n14 37 45 69\n48 1 18 58\n42 34 96 14\n56 82 33 77\n40 66 30 53\n33 31 44 95\n0 90 24 8\n7 85 39 1\n76 77 93 35\n98 9 62 13\n24 84 60 51\n", "output": "8\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a matrix with $n$ rows (numbered from $1$ to $n$) and $m$ columns (numbered from $1$ to $m$). A number $a_{i, j}$ is written in the cell belonging to the $i$-th row and the $j$-th column, each number is eith... | [{"type": "stdin_stdout", "input": "4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 0 1 1 1 0 1\n2 5\n1 0 1 0 0\n1 1 1 1 0\n-1 1 1 0 0\n", "output": "0\n3\n5\n4\n"}, {"type": "stdin_stdout", "input": "4\n2 2\n1 1\n0 1\n2 3\n1 1 1\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 1 0 0 1 0\n1 0 1 0 1 0 1\n2 5\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHere's a way to construct a list containing every positive rational number:\n\nBuild a binary tree where each node is a rational and the root is `1/1`, with the following rules for creating the nodes below:\n* The value o... | [{"input": "1000000000", "output": "[[73411, 65788]]", "fn_name": "rat_at"}, {"input": "10", "output": "[[5, 2]]", "fn_name": "rat_at"}, {"input": "0", "output": "[[1, 1]]", "fn_name": "rat_at"}, {"input": "3", "output": "[[1, 3]]", "fn_name": "rat_at"}, {"input": "4", "output": "[[3, 2]]", "fn_name": "rat_at"}] | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSalem gave you $n$ sticks with integer positive lengths $a_1, a_2, \\ldots, a_n$.\n\nFor every stick, you can change its length to any other positive integer length (that is, either shrink or stretch it). The cost of chan... | [{"type": "stdin_stdout", "input": "113\n86 67 31 33 72 100 88 63 16 12 79 80 76 45 31 96 44 10 24 33 53 11 56 100 23 57 9 48 28 73 18 48 12 89 73 9 51 11 82 94 90 92 34 99 54 58 33 67 35 87 58 90 94 64 57 80 87 99 84 99 20 1 63 12 16 40 50 95 33 58 7 23 71 89 53 15 95 29 71 16 65 21 66 89 82 30 6 45 6 66 58 32 27 78 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus likes studying at school a lot and he is always diligent about his homework. Polycarpus has never had any problems with natural sciences as his great-great-grandfather was the great physicist Seinstein. On the ... | [{"type": "stdin_stdout", "input": "10\n58 22116\n112840 772160\n127432 399484\n182031 255417\n459340 548097\n603984 739189\n606173 663033\n280170 366159\n779239 906234\n874623 155443\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "10\n58 22116\n112840 772160\n122094 399484\n182031 255417\n459340 548097\n60398... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.\n\nWe will call point a bad if there are different points b and c, not equal to a, from the given set such ... | [{"type": "stdin_stdout", "input": "11\n358 -724 -232 53 -520\n486 -554 -328 53 -220\n358 -554 -232 -372 -520\n358 -554 -232 308 -520\n868 -554 448 53 -520\n478 -554 -322 53 -600\n358 296 -232 53 -520\n256 -554 -368 53 -520\n230 -554 -136 53 -820\n-182 -554 173 53 -160\n358 -554 -232 53 -520\n", "output": "1\n11\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour task is to make function, which returns the sum of a sequence of integers.\n\nThe sequence is defined by 3 non-negative values: **begin**, **end**, **step**.\n\nIf **begin** value is greater than the **end**, functio... | [{"input": "2\n24\n22", "output": "[26]", "fn_name": "sequence_sum"}, {"input": "0\n15\n3", "output": "[45]", "fn_name": "sequence_sum"}, {"input": "16\n15\n3", "output": "[0]", "fn_name": "sequence_sum"}, {"input": "1\n15\n3", "output": "[35]", "fn_name": "sequence_sum"}, {"input": "2\n6\n2", "output": "[12]", "fn_nam... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA Pythagorean triple is a triple of integer numbers $(a, b, c)$ such that it is possible to form a right triangle with the lengths of the first cathetus, the second cathetus and the hypotenuse equal to $a$, $b$ and $c$, r... | [{"type": "stdin_stdout", "input": "3\n2131\n21165\n6666\n", "output": "32\n102\n57\n"}, {"type": "stdin_stdout", "input": "3\n2131\n21165\n6666\n", "output": "32\n102\n57\n"}, {"type": "stdin_stdout", "input": "3\n2131\n38301\n6666\n", "output": "32\n137\n57\n"}, {"type": "stdin_stdout", "input": "3\n1625\n38301\n6666... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA thief sneaked into a museum with a lot of treasures with only one large furoshiki. There are many things I want to steal, but the weight that the furoshiki can withstand is limited, and if it exceeds this, the furoshiki... | [{"type": "stdin_stdout", "input": "50\n5\n60,10\n100,10\n03,022\n210,45\n10,4\n162\n5\n60,10\n100,20\n120,30\n210,45\n10,4\n0", "output": "Case 1:\n220\n49\nCase 2:\n500\n109\n"}, {"type": "stdin_stdout", "input": "50\n5\n60,20\n100,20\n03,021\n210,45\n10,4\n143\n5\n60,10\n100,20\n120,30\n200,45\n10,4\n0", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n## Emotional Sort ( ︶︿︶)\n\nYou'll have a function called \"**sortEmotions**\" that will return an array of **emotions** sorted. It has two parameters, the first parameter called \"**arr**\" will expect an array of **emot... | [{"input": "[\":)\", \"T_T\", \":)\", \":D\", \":D\"]\nfalse", "output": "[[\"T_T\", \":)\", \":)\", \":D\", \":D\"]]", "fn_name": "sort_emotions"}, {"input": "[\":)\", \"T_T\", \":)\", \":D\", \":D\"]\ntrue", "output": "[[\":D\", \":D\", \":)\", \":)\", \"T_T\"]]", "fn_name": "sort_emotions"}, {"input": "[\":D\", \"T_... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKaavi, the mysterious fortune teller, deeply believes that one's fate is inevitable and unavoidable. Of course, she makes her living by predicting others' future. While doing divination, Kaavi believes that magic spells c... | [{"type": "stdin_stdout", "input": "babbaaababbbbabbaaaababbbaabababbaabbaababbaaabaabbabaabbaababababbaabaaabaaaaababbaabaaaaabaabbabaaababbbb\nbbaabbbbabbbbaaaaaababbbabaaabbbbabababbbaabbbbbabaababbaabaaabaabbababababaaaaabaabbabaaabaaaaaaaaaaaaabbb\n", "output": "284471294"}, {"type": "stdin_stdout", "input": "bbbb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImplement the function unique_in_order which takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements.\n\nFor examp... | [{"input": "\"AAAABBBCCDAABBB\"", "output": "[[\"A\", \"B\", \"C\", \"D\", \"A\", \"B\"]]", "fn_name": "unique_in_order"}, {"input": "\"ABBCcAD\"", "output": "[[\"A\", \"B\", \"C\", \"c\", \"A\", \"D\"]]", "fn_name": "unique_in_order"}, {"input": "[\"a\", \"b\", \"b\"]", "output": "[[\"a\", \"b\"]]", "fn_name": "unique... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n8\n-10 0\n-10 5\n-5 5\n-5 0\n10 0\n10 -5\n5 -5\n5 0\n\n\nOutput\n\n50\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 Py... | [{"type": "stdin_stdout", "input": "8\n-18 1\n-10 2\n-10 8\n-27 -1\n11 0\n22 -5\n4 -8\n5 0", "output": "137\n"}, {"type": "stdin_stdout", "input": "8\n-18 1\n-10 2\n-10 8\n-27 -1\n11 0\n22 -7\n4 -8\n5 0", "output": "144\n"}, {"type": "stdin_stdout", "input": "8\n-18 1\n-10 2\n-10 8\n-7 -1\n11 0\n22 -14\n4 -8\n5 0", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHi there! \nYou have to implement the \n\n`String get_column_title(int num) // syntax depends on programming language`\n\nfunction that takes an integer number (index of the Excel column) and returns the string represents... | [{"input": "702", "output": "[\"ZZ\"]", "fn_name": "get_column_title"}, {"input": "52", "output": "[\"AZ\"]", "fn_name": "get_column_title"}, {"input": "53", "output": "[\"BA\"]", "fn_name": "get_column_title"}, {"input": "26", "output": "[\"Z\"]", "fn_name": "get_column_title"}, {"input": "1", "output": "[\"A\"]", "fn... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.\n\n* If sage $i$ is right-handed and a left-handed s... | [{"type": "stdin_stdout", "input": "5\n1 1 0 1 0\n1 3 1 -2 4", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5\n1 1 0 1 0\n1 3 1 -1 4", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n1 1 0 0 2\n1 3 0 2 13", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n1 0 0 1 0\n2 3 6 1 2", "output": "3\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja has got an array, consisting of n integers, a_1, a_2, ..., a_{n}. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make v_{i}-th array element ... | [{"type": "stdin_stdout", "input": "6 6\n202714501 613423725 367325359 862808465 196327629 745008828\n2 492\n2 1943\n1 3 173984392\n1 5 17007494\n3 4\n1 5 472683539\n", "output": "862810900\n\n"}, {"type": "stdin_stdout", "input": "6 6\n202714501 613423725 367325359 862808465 196327629 745008828\n2 492\n2 1943\n1 3 173... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N strings arranged in a row. It is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right. That is, S_1<S_2<...<S_N holds lexicographically, wh... | [{"type": "stdin_stdout", "input": "5\n11 1 2 2 2", "output": "3"}, {"type": "stdin_stdout", "input": "5\n14 1 2 2 2", "output": "3"}, {"type": "stdin_stdout", "input": "5\n28 1 2 2 2", "output": "3"}, {"type": "stdin_stdout", "input": "5\n3 1 2 1 13", "output": "3"}, {"type": "stdin_stdout", "input": "5\n11 1 2 2 1", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn accordion is a string (yes, in the real world accordions are musical instruments, but let's forget about it for a while) which can be represented as a concatenation of: an opening bracket (ASCII code $091$), a colon (A... | [{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSomeone give a strange birthday present to Ivan. It is hedgehog — connected undirected graph in which one vertex has degree at least 3 (we will call it center) and all other vertices has degree 1. Ivan thought that hedgeh... | [{"type": "stdin_stdout", "input": "33 2\n3 13\n17 3\n2 6\n5 33\n4 18\n1 2\n31 5\n4 19\n3 16\n1 3\n9 2\n10 3\n5 1\n5 28\n21 4\n7 2\n1 4\n5 24\n30 5\n14 3\n3 11\n27 5\n8 2\n22 4\n12 3\n20 4\n26 5\n4 23\n32 5\n25 5\n15 3\n29 5\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "25 2\n1 2\n1 3\n1 4\n2 5\n2 6\n2 7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the maximum value of $n$.\n\nYou are given a positive integer number $n$. You really love good numbers so you want to find the smallest good number greater than or equ... | [{"type": "stdin_stdout", "input": "100\n1\n2\n3\n4\n5\n6\n7\n8\n14\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Covfefe\n\n\nYour are given a string. You must replace the word(s) `coverage` by `covfefe`, however, if you don't find the word `coverage` in the string, you must add `covfefe` at the end of the string with a leading sp... | [{"input": "\"double space \"", "output": "[\"double space covfefe\"]", "fn_name": "covfefe"}, {"input": "\"coverage coverage\"", "output": "[\"covfefe covfefe\"]", "fn_name": "covfefe"}, {"input": "\"nothing\"", "output": "[\"nothing covfefe\"]", "fn_name": "covfefe"}, {"input": "\"covfefe\"", "output": "[\"covfefe c... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!).\n\nThe flying saucer, on which the brave pioneers set off, consists... | [{"type": "stdin_stdout", "input": "602799218 494169337\n", "output": "105935725\n"}, {"type": "stdin_stdout", "input": "523061914 144515354\n", "output": "127493116\n"}, {"type": "stdin_stdout", "input": "622152471 448257864\n", "output": "210299666\n"}, {"type": "stdin_stdout", "input": "549662082 945236243\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA telephone number is a sequence of exactly 11 digits, where the first digit is 8. For example, the sequence 80011223388 is a telephone number, but the sequences 70011223388 and 80000011223388 are not.\n\nYou are given a ... | [{"type": "stdin_stdout", "input": "2\n13\n7818005553535\n11\n31415926535\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\n13\n14222439333841\n11\n31415926535\n", "output": "NO\nNO\n"}, {"type": "stdin_stdout", "input": "2\n13\n3872943379171\n11\n45489461254\n", "output": "YES\nNO\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote.\n\nHowever, the site is not so simple on the in... | [{"type": "stdin_stdout", "input": "9\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "9\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "9\n1\n1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya plays the Need For Brake. He plays because he was presented with a new computer wheel for birthday! Now he is sure that he will win the first place in the championship in his favourite racing computer game! \n\nn ra... | [{"type": "stdin_stdout", "input": "20\ng 1000000\nibb 1000000\nidj 1000000\nkccg 1000000\nbbe 1000000\nhjf 1000000\na 1000000\nf 1000000\niij 1000000\nakgf 1000000\nkdkhj 1000000\ne 1000000\nh 1000000\nhb 1000000\nfaie 1000000\nj 1000000\ni 1000000\nhgg 1000000\nfi 1000000\nicf 1000000\n12\n1000000 1000000 1000000 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA positive integer is called a 2-3-integer, if it is equal to 2^{x}·3^{y} for some non-negative integers x and y. In other words, these integers are such integers that only have 2 and 3 among their prime divisors. For exa... | [{"type": "stdin_stdout", "input": "1088391168 1934917632\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "1088391167 1934917632\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "1088391169 1934917632\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "1088391168 1934917631\n", "output": "16\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation $p$ of $n$ integers $1$, $2$, ..., $n$ (a permutation is an array where each element from $1$ to $n$ occurs exactly once).\n\nLet's call some subsegment $p[l, r]$ of this permutation special if... | [{"type": "stdin_stdout", "input": "5\n3 4 1 5 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n4 5 1 3 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n5 4 1 3 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n3 4 2 5 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Fourier transformations are hard. Fouriest transformations are harder.\n\nThis Kata is based on the SMBC Comic on fourier transformations.\n\nA fourier transformation on a number is one that converts the number to a bas... | [{"input": "2579111107964987025047536361483312385374008248282655401675211033926782006920415224913494809688581314878892733564", "output": "[\"2579111107964987025047536361483312385374008248282655401675211033926782006920415224913494809688581314878892733564 is the fouriest (4444444444444444444444444444444444444444444444) i... | code_functional |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.