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\nGiven a string, remove any characters that are unique from the string.\n\nExample: \n\ninput: \"abccdefee\"\n\noutput: \"cceee\"\n\nWrite your solution by modifying this code:\n\n```python\ndef only_duplicates(string):\n\... | [{"input": "\"foundersandcoders\"", "output": "[\"ondersndoders\"]", "fn_name": "only_duplicates"}, {"input": "\"12314256aaeff\"", "output": "[\"1212aaff\"]", "fn_name": "only_duplicates"}, {"input": "\"colloquial\"", "output": "[\"ollol\"]", "fn_name": "only_duplicates"}, {"input": "\"abccdefee\"", "output": "[\"cceee... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDanil decided to earn some money, so he had found a part-time job. The interview have went well, so now he is a light switcher.\n\nDanil works in a rooted tree (undirected connected acyclic graph) with n vertices, vertex ... | [{"type": "stdin_stdout", "input": "10\n1 1 3 1 3 1 4 6 3\n0 1 1 1 1 1 1 1 0 0\n10\nget 9\nget 10\nget 4\nget 5\nget 5\nget 5\nget 10\nget 7\nget 5\nget 2\n", "output": "0\n0\n2\n1\n1\n1\n0\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "10\n1 1 3 1 3 1 4 6 3\n0 1 1 1 1 1 1 1 1 0\n10\nget 9\nget 10\nget 4\nget 5\nget ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCheck if it is a vowel(a, e, i, o, u,) on the ```n``` position in a string (the first argument). Don't forget about uppercase.\n\nA few cases:\n\n```\n{\ncheckVowel('cat', 1) -> true // 'a' is a vowel\ncheckVowel('cat'... | [{"input": "\"Amanda\"\n-2", "output": "[false]", "fn_name": "check_vowel"}, {"input": "\"Amanda\"\n0", "output": "[true]", "fn_name": "check_vowel"}, {"input": "\"Amanda\"\n2", "output": "[true]", "fn_name": "check_vowel"}, {"input": "\"cat\"\n0", "output": "[false]", "fn_name": "check_vowel"}, {"input": "\"cat\"\n4",... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\n------ Problem description ------ \n\nYou will be given a zero-indexed array A. You need to rearrange its elements in such a way that the following con... | [{"type": "stdin_stdout", "input": "2\n2\n3 -1\n3\n10 5 2", "output": "-1 3\n2 10 5\n"}, {"type": "stdin_stdout", "input": "2\n2\n1 -1\n3\n10 5 2", "output": "-1 1\n2 10 5\n"}, {"type": "stdin_stdout", "input": "2\n2\n4 5\n3\n15 9 -1", "output": "4 5\n-1 15 9\n"}, {"type": "stdin_stdout", "input": "2\n2\n1 -1\n3\n10 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nРодители Васи хотят, чтобы он как можно лучше учился. Поэтому если он получает подряд три положительные оценки («четвёрки» или «пятёрки»), они дарят ему подарок. Соответственно, оценки «единица», «двойка» и «тройка» родит... | [{"type": "stdin_stdout", "input": "250\n4 4 2 5 1 5 5 4 5 4 4 4 4 4 4 5 5 4 4 5 4 5 1 5 5 4 1 5 5 4 5 5 4 4 4 4 5 4 4 5 5 5 5 5 4 5 4 5 5 4 5 4 4 4 4 4 4 5 5 4 5 5 1 4 4 4 5 1 5 3 4 5 4 4 4 4 4 5 5 4 4 4 4 4 5 4 5 5 5 4 4 5 4 4 4 5 5 5 5 4 5 4 5 4 5 5 5 5 4 4 4 4 5 5 5 5 5 5 4 4 3 4 4 5 5 3 5 4 4 4 4 4 4 5 5 5 4 5 4 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given string S and T consisting of lowercase English letters.\nDetermine if S equals T after rotation.\nThat is, determine if S equals T after the following operation is performed some number of times:\nOperation:... | [{"type": "stdin_stdout", "input": "pgykichjtpukfnlxfcevkjezqsmeycanjlbessrfazdprcomdpjimsfbuslksyveergcgmonctcsvypolplcgsqyfkilrixodiwq\nfnlxfcevkjezqsmeycanjlbessrfazdprcomdpjimsfbuslksyveergcgmonctcsvypolplcgsqyfkilrixodiwqpgykichjtpuk\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe palindromic number `595` is interesting because it can be written as the sum of consecutive squares: `6^2 + 7^2 + 8^2 + 9^2 + 10^2 + 11^2 + 12^2 = 595`.\n\nThere are exactly eleven palindromes below one-thousand that ... | [{"input": "10000000", "output": "[110]", "fn_name": "values"}, {"input": "1000000", "output": "[59]", "fn_name": "values"}, {"input": "5000000", "output": "[78]", "fn_name": "values"}, {"input": "9000000", "output": "[98]", "fn_name": "values"}, {"input": "100000", "output": "[30]", "fn_name": "values"}, {"input": "10... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is $n$. \n\nThere is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains $2$ ... | [{"type": "stdin_stdout", "input": "7\n7 3\n1 3\n18 6\n1865 4\n12 2\n2 10\n22 5\n", "output": "3\n1\n4\n467\n6\n1\n5\n"}, {"type": "stdin_stdout", "input": "7\n7 3\n1 3\n18 6\n987 4\n12 2\n2 10\n22 12\n", "output": "3\n1\n4\n248\n6\n1\n3\n"}, {"type": "stdin_stdout", "input": "7\n7 3\n1 3\n18 6\n1865 4\n12 2\n4 10\n22 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call two strings s and t anagrams of each other if it is possible to rearrange symbols in the string s to get a string, equal to t.\n\nLet's consider two strings s and t which are anagrams of each other. We say that... | [{"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 1\n2 4\n2 2\n1 9\n5 7\n3 5\n", "output": "YES\nYES\nYES\nYES\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 1\n2 4\n2 2\n1 9\n5 7\n3 8\n", "output": "YES\nYES\nYES\nYES\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 1\n2 7\n2 2\n1 9\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile walking down the street Vanya saw a label \"Hide&Seek\". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some str... | [{"type": "stdin_stdout", "input": "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_0123456789ABCDEFGHIJKLMNOPQR... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLately, a national version of a bingo game has become very popular in Berland. There are n players playing the game, each player has a card with numbers. The numbers on each card are distinct, but distinct cards can have ... | [{"type": "stdin_stdout", "input": "40\n2 12 19\n4 10 7 1 3\n2 15 17\n1 6\n3 17 8 20\n4 8 16 11 18\n2 2 7\n4 12 13 8 7\n3 6 1 15\n3 19 11 13\n1 2\n2 16 14\n5 1 17 8 9 5\n1 2\n3 15 17 12\n4 20 4 19 18\n1 10\n4 12 1 17 16\n4 5 10 8 11\n1 10\n1 13\n1 17\n2 19 18\n1 3\n2 6 20\n1 8\n2 3 14\n3 17 3 1\n2 4 3\n1 12\n1 15\n1 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInitially, you have the array $a$ consisting of one element $1$ ($a = [1]$).\n\nIn one move, you can do one of the following things:\n\n Increase some (single) element of $a$ by $1$ (choose some $i$ from $1$ to the curre... | [{"type": "stdin_stdout", "input": "5\n1\n13\n42\n2538\n1000000000\n", "output": "0\n6\n11\n99\n63244\n"}, {"type": "stdin_stdout", "input": "5\n1\n10\n143\n255\n1000000000\n", "output": "0\n5\n22\n30\n63244\n"}, {"type": "stdin_stdout", "input": "5\n1\n13\n143\n751\n1000001000\n", "output": "0\n6\n22\n53\n63244\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDaisy is a senior software engineer at RainyDay, LLC. She has just implemented three new features in their product: the first feature makes their product work, the second one makes their product fast, and the third one ma... | [{"type": "stdin_stdout", "input": "16\n1 1 1\n1 1 0\n1 1 0\n1 1 0\n1 1 0\n1 0 1\n1 0 1\n1 0 1\n1 0 1\n0 1 1\n0 1 1\n0 1 1\n0 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n0 0 0\n1 0 0\n0 1 0\n1 1 0\n0 0 0\n1 0 0\n0 0 1\n1 0 1\n0 0 0\n0 1 0\n0 0 1\n0 1 1\n1 0 0\n0 1 0\n0 0 1\n", "output": "Possible\n1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLolek and Bolek are about to travel abroad by plane. The local airport has a special \"Choose Your Plane\" offer. The offer's conditions are as follows:\n\n * it is up to a passenger to choose a plane to fly on; \n * if... | [{"type": "stdin_stdout", "input": "510 132\n50 76 77 69 94 30 47 65 14 62 18 121 26 35 49 17 105 93 47 16 78 3 7 74 7 37 30 36 30 83 121 113 7 58 86 10 65 57 34 102 55 44 43 47 106 44 115 75 109 70 47 45 16 57 62 55 20 88 74 40 45 84 41 1 9 53 65 25 67 31 115 2 63 51 123 70 65 65 18 14 75 14 103 26 117 105 36 104 81 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by $n$ sectors, and the outer area is equally divided by $m$ sectors. A wall exists between each pair of sect... | [{"type": "stdin_stdout", "input": "1 1 10\n1 1 1 1\n1 1 1 1\n1 1 2 1\n1 1 1 1\n2 1 2 1\n2 1 1 1\n1 1 2 1\n1 1 2 1\n2 1 1 1\n2 1 1 1\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "1 1 10\n1 1 1 1\n1 1 1 1\n1 1 2 1\n1 1 1 1\n2 1 2 1\n2 1 1 1\n1 1 2 1\n1 1 2 1\n2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan has number $b$. He is sorting through the numbers $a$ from $1$ to $10^{18}$, and for every $a$ writes $\\frac{[a, \\,\\, b]}{a}$ on blackboard. Here $[a, \\,\\, b]$ stands for least common multiple of $a$ and $b$. Iv... | [{"type": "stdin_stdout", "input": "2793510720\n", "output": "1792\n"}, {"type": "stdin_stdout", "input": "1102701600\n", "output": "1440\n"}, {"type": "stdin_stdout", "input": "2327925600\n", "output": "1728\n"}, {"type": "stdin_stdout", "input": "2095133040\n", "output": "1600\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJack is working on his jumping skills recently. Currently he's located at point zero of the number line. He would like to get to the point x. In order to train, he has decided that he'll first jump by only one unit, and e... | [{"type": "stdin_stdout", "input": "-1000000000\n", "output": "44723\n"}, {"type": "stdin_stdout", "input": "-1028109475\n", "output": "45346\n"}, {"type": "stdin_stdout", "input": "-1050321888\n", "output": "45835\n"}, {"type": "stdin_stdout", "input": "-245245154\n", "output": "22147\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTax Rate Changed\n\nVAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price.\n\nOur store uses the following rules to calculate the after-tax prices.\n\n* When the VAT rate is x%, for an it... | [{"type": "stdin_stdout", "input": "5 8 105\n8 5 105\n1 2 24\n99 98 24\n12 13 26\n1 22 23\n1 19 201\n13 16 112\n2 24 50\n1 82 61\n1 84 125\n1 99 999\n99 1 3106\n98 99 999\n1 99 11\n99 2 12\n0 0 0", "output": "109\n103\n24\n24\n26\n27\n237\n116\n62\n111\n230\n1972\n1576\n1004\n20\n7\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor all x in the range of integers [0, 2 ** n), let y[x] be the binary exclusive-or of x and x // 2. Find the sum of all numbers in y.\n\nWrite a function sum_them that, given n, will return the value of the above sum.\n\... | [{"input": "4", "output": "[120]", "fn_name": "sum_them"}, {"input": "3", "output": "[28]", "fn_name": "sum_them"}, {"input": "0", "output": "[0]", "fn_name": "sum_them"}, {"input": "1", "output": "[1]", "fn_name": "sum_them"}, {"input": "2", "output": "[6]", "fn_name": "sum_them"}] | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.\n\nIt's too hard to learn to solve Rubik's cube instantly, s... | [{"type": "stdin_stdout", "input": "2 6 3 3 5 5 2 6 1 1 12 4 4 4 2 4 6 5 3 1 2 5 3 1\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 2 6 1 5 3 5 3 1 1 3 6 6 2 4 2 5 4 4 2 1 3 4 10\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "2 6 3 3 5 5 2 6 2 1 12 4 4 4 2 4 6 5 3 1 2 5 3 1\n", "output": "NO\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOm Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. [Image] ... | [{"type": "stdin_stdout", "input": "2 100 59\n....................................................................................................\n.DR.D..DLLR.LDRR..L.LDRRRDLD.LDRR.LLR.R...DRLD.RRLL.L.D..R.LD.DL....LR.LR.DRLD.....L.D..RD...D.LL.R.\n", "output": "0 0 0 1 0 0 0 1 1 0 0 2 0 0 0 1 1 1 0 1 0 0 0 1 1 2 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have recently discovered that horses travel in a unique pattern - they're either running (at top speed) or resting (standing still).\n\nHere's an example of how one particular horse might travel:\n\n```\nThe horse Bla... | [{"input": "100000000\n21\n5\n14", "output": "[1130769276]", "fn_name": "travel"}, {"input": "35869784\n90\n100\n5", "output": "[84954920]", "fn_name": "travel"}, {"input": "1234567\n4\n3\n11", "output": "[7760148]", "fn_name": "travel"}, {"input": "1000\n10\n127\n14", "output": "[1120]", "fn_name": "travel"}, {"input"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nGiven the sequence $ A $ of length $ N $. Find the maximum value of $ \\ sum B_i $, where $ B $ is one of the longest increasing subsequences of the sequence $ A $.\n\nThe longest increasing subsequence of the ... | [{"type": "stdin_stdout", "input": "4\n14 15 0 10", "output": "29\n"}, {"type": "stdin_stdout", "input": "4\n17 19 0 20", "output": "56\n"}, {"type": "stdin_stdout", "input": "4\n12 23 0 10", "output": "35\n"}, {"type": "stdin_stdout", "input": "4\n14 8 0 10", "output": "18\n"}, {"type": "stdin_stdout", "input": "4\n7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a set S of N points in a two-dimensional plane. The coordinates of the i-th point are (x_i, y_i). The N points have distinct x-coordinates and distinct y-coordinates.\nFor a non-empty subset T of S, let f(T) be th... | [{"type": "stdin_stdout", "input": "10\n19 -11\n-3 -12\n5 3\n3 -15\n8 -14\n-9 -20\n10 -9\n0 2\n-7 17\n6 -6\n", "output": "7222\n"}, {"type": "stdin_stdout", "input": "10\n19 -11\n-3 -12\n5 3\n3 -15\n13 -14\n-9 -20\n10 -9\n0 2\n-7 17\n6 -6", "output": "7246"}, {"type": "stdin_stdout", "input": "10\n19 -11\n-3 -12\n5 3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA bitstring is a string consisting only of the characters 0 and 1. A bitstring is called k-balanced if every substring of size k of this bitstring has an equal amount of 0 and 1 characters (k/2 of each).\n\nYou are given ... | [{"type": "stdin_stdout", "input": "9\n6 4\n100110\n3 2\n1?1\n3 2\n1?0\n4 4\n????\n7 4\n1?0??1?\n10 10\n11??11??11\n4 4\n1??1\n4 4\n?0?0\n6 2\n????00\n", "output": "YES\nYES\nNO\nYES\nYES\nNO\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "9\n6 4\n100110\n3 2\n1?1\n3 2\n0?1\n4 4\n????\n7 4\n1?0??1?\n10 10\n11???1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function that gets a sequence and value and returns `true/false` depending on whether the variable exists in a multidimentional sequence.\n\nExample:\n```\nlocate(['a','b',['c','d',['e']]],'e'); // should return t... | [{"input": "[\"a\", \"b\", [\"c\", \"d\", [\"e\", [\"a\", \"b\", [\"c\", \"d\", [\"e\", [\"a\", \"b\", [\"c\", \"d\", [\"e4\", [\"a\", \"b\", [\"c\", \"d\", [\"e\", [\"a\", \"b\", [\"c\", \"d\", [\"e\", [\"a\", \"b\", [\"c\", \"d\", [\"e14\"]]]]]]]]]]]]]]]]]]\n\"e\"", "output": "[true]", "fn_name": "locate"}, {"input":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe little girl loves the problems on array queries very much.\n\nOne day she came across a rather well-known problem: you've got an array of n elements (the elements of the array are indexed starting from 1); also, there... | [{"type": "stdin_stdout", "input": "31 48\n45 19 16 42 38 18 50 7 28 40 39 25 45 14 36 18 27 30 16 4 22 6 1 23 16 47 14 35 27 47 2\n6 16\n11 28\n4 30\n25 26\n11 30\n5 9\n4 17\n15 17\n10 25\n15 26\n1 3\n9 26\n8 29\n16 30\n3 24\n27 30\n9 10\n22 29\n2 6\n15 24\n6 21\n19 21\n4 28\n1 7\n18 21\n10 22\n6 15\n14 28\n4 19\n12 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of N integers: A_1, A_2, \\cdots, A_N.\nYou can perform the following operation between 0 and K times (inclusive):\n - Choose two integers i and j such that i \\neq j, each between 1 and N (inclusive). ... | [{"type": "stdin_stdout", "input": "500 1000000000\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.\n\nFor this reason, he made the n prison... | [{"type": "stdin_stdout", "input": "57 3 9\n4 5 2 7 12 1 1 3 2 9 4 9 0 6 12 5 -1 6 11 1 0 0 -1 3 1 0 5 1 0 31 8 8 0 1 7 3 1 13 4 4 5 1 4 -2 1 7 1 1 1 4 5 1 24 5 1 9 6\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "57 3 9\n4 5 2 7 12 1 1 0 2 9 4 9 0 6 12 5 -1 6 11 1 0 0 -1 3 1 0 5 1 0 31 8 8 0 1 7 3 1 13 4 4 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn \"Takahashi-ya\", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).\nA customer ordered a bowl of ramen and told w... | [{"type": "stdin_stdout", "input": "ooo\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "oxo\n", "output": "900\n"}, {"type": "stdin_stdout", "input": "xxx\n", "output": "700\n"}, {"type": "stdin_stdout", "input": "pxo", "output": "800\n"}, {"type": "stdin_stdout", "input": "yxx", "output": "700\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nI decided to plant vegetables in the vegetable garden. There were n seeds, so I sown n seeds one by one a day over n days. All seeds sprout and grow quickly. I can't wait for the harvest time.\n\nOne day, when I was water... | [{"type": "stdin_stdout", "input": "5\n1 2 3 11 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9 11 12\n0", "output": "11\n1\n12\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 14 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9 11 12\n0", "output": "14\n1\n12\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 25 4 5\n6\n1 3 6 9 12 15 18\n4\n5 7 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this:\n\nThere are space-separated non-empty words of lowercase and uppercase Latin letters.\n\nThere are ... | [{"type": "stdin_stdout", "input": "2\nWjrWBWqKIeSndDHeiVmfChQNsoUiRQHVplnIWkwBtxAJhOdTigAAzKtbNEqcgvbWHOopfCNgWHfwXyzSCfNqGMLnmlIdKQonLsmGSJlPBcYfHNJJDGlKNnOGtrWUhaTWuilHWMUlFEzbJYbeAWvgnSOOOPLxX-eJEKRsKqSnMjrPbFDprCqgbTfwAnPjFapVKiTjCcWEzhahwPRHScfcLnUixnxckQJzuHzshyBFKPwVGzHeJWniiRKynDFQdaazmTZtDGnFVTmTUZCRCpUHFmUHA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains number i × j. The rows and columns are numbered starting from 1.\n\nYou are given a posi... | [{"type": "stdin_stdout", "input": "100000 1000000000\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "100000 183783600\n", "output": "438\n"}, {"type": "stdin_stdout", "input": "100000 551350800\n", "output": "392\n"}, {"type": "stdin_stdout", "input": "100000 479001600\n", "output": "254\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this integer is between 1 and 100 000, inclusive. It is possible that some cards have the same integers on them.\n\nVasily decide... | [{"type": "stdin_stdout", "input": "100\n12 9 97 55 14 8 55 34 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 63 48 96 79 53 8 47 69 49 21 23 77 12 21 176 66 9 29 13 61 69 54 77 10 13 4 68 37 74 7 6 29 76 55 72 89 4 78 27 29 82 18 83 12 4 32 69 89 85 66 13 92 54 38 5 26 56 17 55 29 4 17 39 29 94 3 67 85 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Do you ever wish you could talk like Siegfried of KAOS ?\n\n## YES, of course you do!\n\nhttps://en.wikipedia.org/wiki/Get_Smart\n\n\n\n# Task\n\nWrite the function ```siegfried``` to replace the letters of a given sent... | [{"input": "5\n\"And another thing Mr Smart, I want no more trouble!\"", "output": "[\"Und unozer zink Mr Schmart, I vunt no mor trubl!\"]", "fn_name": "siegfried"}, {"input": "5\n\"You ought to behave yourself Smart!\"", "output": "[\"Yu ught to behav yurself Schmart!\"]", "fn_name": "siegfried"}, {"input": "5\n\"Smar... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecall that MEX of an array is a minimum non-negative integer that does not belong to the array. Examples: for the array $[0, 0, 1, 0, 2]$ MEX equals to $3$ because numbers $0, 1$ and $2$ are presented in the array and $... | [{"type": "stdin_stdout", "input": "7 3\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n4\n4\n7\n"}, {"type": "stdin_stdout", "input": "7 5\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n3\n3\n3\n"}, {"type": "stdin_stdout", "input": "7 3\n0\n1\n2\n2\n0\n0\n10\n", "output": "1\n2\n3\n3\n4\n4\n7\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function \n\n`titleToNumber(title) or title_to_number(title) or titleToNb title ...`\n\n(depending on the language)\n\nthat given a column title as it appears in an Excel sheet, returns its corresponding column nu... | [{"input": "\"UNFORGIVABLE\"", "output": "[79089429845931757]", "fn_name": "title_to_number"}, {"input": "\"LONELINESS\"", "output": "[68400586976949]", "fn_name": "title_to_number"}, {"input": "\"CODEWARS\"", "output": "[28779382963]", "fn_name": "title_to_number"}, {"input": "\"ZZZTOP\"", "output": "[321268054]", "fn... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFriends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a_1 percent and second one is charged at a_2 percent. You can connect charger to a joystick ... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "197\n"}, {"type": "stdin_stdout", "input": "100 100\n", "output": "197\n"}, {"type": "stdin_stdout", "input": "100 25\n", "output": "122\n"}, {"type": "stdin_stdout", "input": "100 25\n", "output": "122\n"}, {"type": "stdin_stdout", "input": "100 26\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Polycarpus has learned the \"bitwise AND\" operation (which is also called \"AND\") of non-negative integers. Now he wants to demonstrate the school IT teacher his superb manipulation with the learned operation.\... | [{"type": "stdin_stdout", "input": "7\n-1 1000000000 999999488 999999488 1000000000 1000000000 999999488\n1000000000 -1 999999488 999999488 1000000000 1000000000 999999488\n999999488 999999488 -1 999999999 999999488 999999488 999999999\n999999488 999999488 999999999 -1 999999488 999999488 999999999\n1000000000 10000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\n-----Constraints-----\n - S and T are strings consisti... | [{"type": "stdin_stdout", "input": "oekdkfjdjgjknbfkwnfnhaoekdkfjdjgjknbfkwnfnhahjekkengkfoekdkfjdjgjknbfkwnfnhaoekdkfjdjgjknbfkwnfnhahj yowkymbmhkkgjjeokdlakbndkkworqotkfnblgpnkkrogjrfnvmbjisnbkzvmbnrrrigeoibgpefjobvmovpqosqoqrgrkengrlk\n", "output": "yowkymbmhkkgjjeokdlakbndkkworqotkfnblgpnkkrogjrfnvmbjisnbkzvmbnrrri... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n## Debugging sayHello function\n\nThe starship Enterprise has run into some problem when creating a program to greet everyone as they come aboard. It is your job to fix the code and get the program working again!\n\nExamp... | [{"input": "\"Liutenant Uhura\"", "output": "[\"Hello, Liutenant Uhura\"]", "fn_name": "say_hello"}, {"input": "\"Captain Kirk\"", "output": "[\"Hello, Captain Kirk\"]", "fn_name": "say_hello"}, {"input": "\"Mr. Spock\"", "output": "[\"Hello, Mr. Spock\"]", "fn_name": "say_hello"}, {"input": "\"Dr. McCoy\"", "output": ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an array containing only integers, add all the elements and return the binary equivalent of that sum.\n\nIf the array contains any non-integer element (e.g. an object, a float, a string and so on), return false.\n\n... | [{"input": "[1, 10, 100, 1000]", "output": "[\"10001010111\"]", "fn_name": "arr2bin"}, {"input": "[1, 2, 3, 4, 5]", "output": "[\"1111\"]", "fn_name": "arr2bin"}, {"input": "[1, 2, -1, -2, 1]", "output": "[\"1\"]", "fn_name": "arr2bin"}, {"input": "[1, 2, -1, -2]", "output": "[\"0\"]", "fn_name": "arr2bin"}, {"input": ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreatnx has $n$ mirrors, numbered from $1$ to $n$. Every day, Creatnx asks exactly one mirror \"Am I beautiful?\". The $i$-th mirror will tell Creatnx that he is beautiful with probability $\\frac{p_i}{100}$ for all $1 \\... | [{"type": "stdin_stdout", "input": "100\n60 79 48 35 18 24 87 1 44 65 60 78 11 43 71 79 90 6 94 49 22 91 58 93 55 21 22 31 7 15 17 65 76 9 100 89 50 96 14 38 27 87 29 93 54 12 99 35 27 51 36 44 6 26 91 1 53 8 49 63 18 4 31 55 95 15 77 1 16 98 75 26 26 43 2 11 18 70 3 65 11 74 64 69 26 54 9 51 25 82 98 12 90 75 19 23 78... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine that your city is an infinite 2D plane with Cartesian coordinate system. The only crime-affected road of your city is the x-axis. Currently, there are n criminals along the road. No police station has been built o... | [{"type": "stdin_stdout", "input": "44 37298\n-100 -100 -98 -93 -92 -91 -91 -89 -87 -86 -84 -80 -79 -76 -71 -70 -58 -53 -52 -52 -49 -48 -45 -45 -40 -39 -37 -35 -31 -30 -30 -29 -29 -28 -22 -22 -21 -11 -8 -7 -7 -6 -1 0\n", "output": "200\n"}, {"type": "stdin_stdout", "input": "45 45\n-95 -94 -92 -83 -83 -76 -75 -74 -71 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the stri... | [{"type": "stdin_stdout", "input": "VRPHBNWNWVWBWMFJJDCTJQJDJBKSJRZLVQRVVFLTZFSGCGDXCWQVWWWMFVCQHPKXXVRKTGWGPSMQTPKNDQJHNSKLXPCXDJDQDZZD\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "DZZDQDJDXCPXLKSNHJQDNKPTQMSPGWGTKRVXXKPHQCVFMWWWVQWCXDGCGSFZTLFVVRQVLZRJSKBJDJQJTCDJJFMWBWVWNWNBHPRV\n", "output": "101\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes:\n\n* Hit his pocket, which magically increases the number... | [{"type": "stdin_stdout", "input": "314159265 35897932 384626433", "output": "48518828981938099"}, {"type": "stdin_stdout", "input": "407766107 9307229 14836778", "output": "1101648954500241\n"}, {"type": "stdin_stdout", "input": "407766107 9307229 25447105", "output": "3215538450316794\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n - For each 1 ≤ i ≤ N - 1, the pr... | [{"type": "stdin_stdout", "input": "6\n2 7 1 8 2 8\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n4 7 0 -1 6 4", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n2 7 2 12 2 8", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n4 7 2 8 2 10", "output": "Yes\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function called that takes a string of parentheses, and determines if the order of the parentheses is valid. The function should return `true` if the string is valid, and `false` if it's invalid.\n\n## Examples\n\... | [{"input": "\"(c(b(a)))(d)\"", "output": "[true]", "fn_name": "valid_parentheses"}, {"input": "\"((())()())\"", "output": "[true]", "fn_name": "valid_parentheses"}, {"input": "\"hi(hi))(\"", "output": "[false]", "fn_name": "valid_parentheses"}, {"input": "\"hi(hi)(\"", "output": "[false]", "fn_name": "valid_parentheses... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\n-----Constraints-----\n - 1 \\leq N < 10^{100}\n - 1 \\leq K \\leq 3\n\n-----Input-----\nInput i... | [{"type": "stdin_stdout", "input": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n", "output": "117879300\n"}, {"type": "stdin_stdout", "input": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nπ (spelled pi in English) is a mathematical constant representing the circumference of a circle whose di- ameter is one unit length. The name π is said to come from the first letter of the Greek words περιφέρεια (meaning ... | [{"type": "stdin_stdout", "input": "1.1386381399168386\n0.08430864816896695\n0.0", "output": "3/1\n16/5\n"}, {"type": "stdin_stdout", "input": "0.5656950408067312\n0.06616503278329884\n0.0", "output": "3/1\n16/5\n"}, {"type": "stdin_stdout", "input": "0.9300839575225542\n0.09342351193849237\n0.0", "output": "3/1\n16/5\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJack has become a soldier now. Unfortunately, he has trouble with the drill. Instead of marching beginning with the left foot and then changing legs with each step, as ordered, he keeps repeating a sequence of steps, in w... | [{"type": "stdin_stdout", "input": "RXLLRXXLLRLRLLXXXXRXXRLLRRRRXLLRRLXXLRXXLXLRLLLLLRXLRXLXRXLXLRRXXRRLXLXLRLRXRXLXXXLRXLLXLRRRRXRLLXRRLLRRXRRRLRLLRLRXXXRLXLXLLLRXXLLXLRXXLLLRLXRRXRLXLXXXXXXLXRXXRXXXRXLXXRRXLLXRRXLXXRRXLXXRLXLXXLXRXXRLRLLXLXLXLRXLXLXLLLRLXXLXLLRLLLLRLRRRRXRRLLRLXLXXRLRRLXRRXXXRLLXRRRXXRRRXXLRXRLLXRRRX... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function that takes as its parameters *one or more numbers which are the diameters of circles.* \n\nThe function should return the *total area of all the circles*, rounded to the nearest integer in a string that s... | [{"input": "56894.04839\n843975.4839\n4.08437403489", "output": "[\"We have this much circle: 561977165367\"]", "fn_name": "sum_circles"}, {"input": "5\n6\n7\n8\n9\n10\n105083\n48839\n4853\n28\n483", "output": "[\"We have this much circle: 10564760498\"]", "fn_name": "sum_circles"}, {"input": "4.5456\n746.5\n98.34\n344... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGreg the Dwarf has been really busy recently with excavations by the Neverland Mountain. However for the well-known reasons (as you probably remember he is a very unusual dwarf and he cannot stand sunlight) Greg can only ... | [{"type": "stdin_stdout", "input": "1000 1000\n-20.534295190826231 133.273184243935670 865.154166109953510\n-711.474516721095600 -638.507879949720520 44.024947657417599\n", "output": "1355.67674395639642\n"}, {"type": "stdin_stdout", "input": "1000 1000\n-865.729850457726000 -306.217565767793640 81.709538567284440\n891... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are the \"computer expert\" of a local Athletic Association (C.A.A.).\nMany teams of runners come to compete. Each time you get a string of \nall race results of every team who has run.\nFor example here is a string s... | [{"input": "\"11|15|59, 10|16|16, 12|17|20, 9|22|34, 13|19|34, 11|15|17, 11|22|00, 10|26|37, 12|17|48, 9|16|30, 12|20|14, 11|25|11\"", "output": "[\"Range: 04|03|04 Average: 11|14|36 Median: 11|18|59\"]", "fn_name": "stat"}, {"input": "\"1|15|59, 1|16|16, 1|17|20, 1|22|34, 1|19|34, 1|15|17, 1|22|00, 1|26|37, 1|17|48, 1... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sequence $a_1, a_2, \\dots, a_n$ is called good if, for each element $a_i$, there exists an element $a_j$ ($i \\ne j$) such that $a_i+a_j$ is a power of two (that is, $2^d$ for some non-negative integer $d$).\n\nFor exa... | [{"type": "stdin_stdout", "input": "10\n3 10 14 1 10 12 5 16 5 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n3 10 14 1 10 8 5 16 5 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n3 10 9 1 10 8 5 16 5 2\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\n2 10 9 1 10 4 7 8 5 4\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe mayor of Amida, the City of Miracle, is not elected like any other city. Once exhausted by long political struggles and catastrophes, the city has decided to leave the fate of all candidates to the lottery in order to... | [{"type": "stdin_stdout", "input": "4 3 1\n3 1 2\n0 1 3\n4 3 4\n1 0 1\n0 0 0", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "4 3 1\n3 1 1\n0 1 3\n4 3 4\n1 0 1\n0 0 0", "output": "3\n1\n"}, {"type": "stdin_stdout", "input": "6 4 1\n3 -1 2\n2 2 3\n3 3 4\n0 2 4\n0 0 0", "output": "1\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minut... | [{"type": "stdin_stdout", "input": "14 5\n4 2\n5 4\n3 3\n2 3\n1 2\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "14 5\n4 2\n3 8\n3 3\n2 3\n1 2\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "14 5\n4 2\n5 4\n3 3\n2 3\n1 1\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "14 5\n4 2\n9 4\n3 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Asimov, a robotics researcher, released cleaning robots he developed (see Problem B). His robots soon became very popular and he got much income. Now he is pretty rich. Wonderful.\n\nFirst, he renovated his house. Onc... | [{"type": "stdin_stdout", "input": "34 1\n1 6\n2 6\n0 0", "output": "..................................\n.EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.\n.E..............................E.\n.E.EEEEEEEEEEEEEEEEEEEEEEEEEEEE.E.\n.E.E..........................E.E.\n.E.E.EEEEEEEEEEEEEEEEEEEEEEEE.E.E.\n.E.E.E......................E.E.E.\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour website is divided vertically in sections, and each can be of different size (height). \nYou need to establish the section index (starting at `0`) you are at, given the `scrollY` and `sizes` of all sections. \nSect... | [{"input": "1600\n[300, 200, 400, 600, 100]", "output": "[-1]", "fn_name": "get_section_id"}, {"input": "1599\n[300, 200, 400, 600, 100]", "output": "[4]", "fn_name": "get_section_id"}, {"input": "299\n[300, 200, 400, 600, 100]", "output": "[0]", "fn_name": "get_section_id"}, {"input": "300\n[300, 200, 400, 600, 100]",... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current ... | [{"type": "stdin_stdout", "input": "11\npwd\ncd /home/vasya\npwd\ncd ..\npwd\ncd vasya/../../petya\npwd\ncd /a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a/a\npwd\ncd ..\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n\nWrite a function `deNico`/`de_nico()` that accepts two parameters:\n- `key`/`$key` - string consists of unique letters and digits\n- `message`/`$message` - string with encoded message \n\nand decodes the `messag... | [{"input": "\"crazy\"\n\"cseerntiofarmit on \"", "output": "[\"secretinformation\"]", "fn_name": "de_nico"}, {"input": "\"crazy\"\n\"cseerntiofarmit on\"", "output": "[\"secretinformation\"]", "fn_name": "de_nico"}, {"input": "\"ba\"\n\"2143658709\"", "output": "[\"1234567890\"]", "fn_name": "de_nico"}, {"input": "\"a... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.\n\nThe i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.\n\nHe... | [{"type": "stdin_stdout", "input": "100 1000\n1 2 1\n1 3 1\n1 4 1\n1 5 1\n1 6 1\n1 7 1\n1 8 1\n1 9 1\n1 10 1\n1 11 1\n1 12 1\n1 13 1\n1 14 1\n1 15 1\n1 16 1\n1 17 1\n1 18 1\n1 19 1\n1 20 1\n1 21 1\n1 22 1\n1 23 1\n1 24 1\n1 25 1\n1 26 1\n1 27 1\n1 28 1\n1 29 1\n1 30 1\n1 31 1\n1 32 1\n1 33 1\n1 34 1\n1 35 1\n1 36 1\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan is collecting coins. There are only $N$ different collectible coins, Ivan has $K$ of them. He will be celebrating his birthday soon, so all his $M$ freinds decided to gift him coins. They all agreed to three terms: ... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000010000000000000 1000000000000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n## Task\n\nCreate a function that given a sequence of strings, groups the elements that can be obtained by rotating others, ignoring upper or lower cases. \n\nIn the event that an element appears more than once in the inp... | [{"input": "[\"Tokyo\", \"London\", \"Rome\", \"Donlon\", \"Kyoto\", \"Paris\", \"Okyot\"]", "output": "[[[\"Kyoto\", \"Okyot\", \"Tokyo\"], [\"Donlon\", \"London\"], [\"Paris\"], [\"Rome\"]]]", "fn_name": "group_cities"}, {"input": "[\"Tokyo\", \"London\", \"Rome\", \"Donlon\"]", "output": "[[[\"Donlon\", \"London\"],... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA film festival is coming up in the city N. The festival will last for exactly n days and each day will have a premiere of exactly one film. Each film has a genre — an integer from 1 to k.\n\nOn the i-th day the festival ... | [{"type": "stdin_stdout", "input": "129 37\n15 22 28 15 30 16 11 20 4 26 14 37 29 17 15 15 14 18 1 9 16 22 13 32 5 18 25 11 6 33 33 22 17 9 1 5 27 27 37 4 6 1 3 18 17 33 6 17 2 24 23 1 1 37 35 21 21 17 18 6 31 17 29 18 10 10 30 31 8 3 25 20 34 11 12 12 24 13 5 27 20 31 28 1 36 2 4 13 14 9 33 25 4 26 36 6 2 7 15 9 20 33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKefa wants to celebrate his first big salary by going to restaurant. However, he needs company. \n\nKefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amou... | [{"type": "stdin_stdout", "input": "15 1234\n2738 322313356\n1160 970909702\n2594 902749351\n3126 324754476\n3151 177963947\n3424 396145897\n5578 737768323\n3423 687640543\n381 848813098\n1058 197211286\n936 650181776\n1025 776492538\n3598 142176544\n3595 680519527\n1191 32199940\n", "output": "3634263641\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBuild a function `sumNestedNumbers`/`sum_nested_numbers` that finds the sum of all numbers in a series of nested arrays raised to the power of their respective nesting levels. Numbers in the outer most array should be ra... | [{"input": "[6, [5], [[4]], [[[3]]], [[[[2]]]], [[[[[1]]]]]]", "output": "[209]", "fn_name": "sum_nested_numbers"}, {"input": "[1, [-1], [[1]], [[[-1]]], [[[[1]]]]]", "output": "[5]", "fn_name": "sum_nested_numbers"}, {"input": "[1, [2], 3, [4, [5]]]", "output": "[149]", "fn_name": "sum_nested_numbers"}, {"input": "[1,... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.\n\nThe to... | [{"type": "stdin_stdout", "input": "50\n31 80 40 85 12 38 30 97 51 18 45 81 56 82 91 94 95 13 26 93 98 35 44 69 98 39 83 77 38 68 13 71 80 41 21 80 81 17 88 46 61 67 65 49 29 55 37 74 88\n71 8 42 74 14 70 100 96 25 56 95 38 41 88 45 43 46 16 55 77 100 68 51 30 73 51 25 88 64 26 22 50 4 57 88 85 45 32 11 96 94 19 9 12 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe [Sharkovsky's Theorem](https://en.wikipedia.org/wiki/Sharkovskii%27s_theorem) involves the following ordering of the natural numbers:\n```math\n3≺5≺7≺9≺ ...\\\\\n≺2·3≺2·5≺2·7≺2·9≺...\\\\\n≺2^n·3≺2^n·5≺2^n·7≺2^n·9≺...\... | [{"input": "32\n1024", "output": "[false]", "fn_name": "sharkovsky"}, {"input": "17\n17", "output": "[false]", "fn_name": "sharkovsky"}, {"input": "18\n12", "output": "[true]", "fn_name": "sharkovsky"}, {"input": "10\n16", "output": "[true]", "fn_name": "sharkovsky"}, {"input": "1\n22", "output": "[false]", "fn_name": ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMaria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.\n\nShe has $n$ friends who are also grannies (Maria is not included in this num... | [{"type": "stdin_stdout", "input": "4\n5\n1 1 0 2 1\n6\n2 3 4 4 12 7\n6\n2 5 4 5 0 11\n5\n1 2 1 5 6\n", "output": "6\n5\n6\n4\n"}, {"type": "stdin_stdout", "input": "4\n5\n1 1 2 2 1\n6\n2 3 4 4 6 7\n6\n2 5 4 5 0 11\n5\n1 2 1 5 6\n", "output": "6\n5\n6\n4\n"}, {"type": "stdin_stdout", "input": "4\n5\n2 0 2 2 -1\n6\n2 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou like the card board game \"Set\". Each card contains $k$ features, each of which is equal to a value from the set $\\{0, 1, 2\\}$. The deck contains all possible variants of cards, that is, there are $3^k$ different c... | [{"type": "stdin_stdout", "input": "37 5\n0 2 0 1 0\n2 2 0 2 2\n2 0 2 0 0\n2 2 2 2 2\n1 2 0 0 2\n0 1 1 1 2\n0 2 0 2 2\n0 0 1 2 2\n2 0 0 1 0\n0 2 2 2 1\n0 2 2 2 0\n2 0 2 2 1\n0 0 2 0 1\n2 1 1 1 2\n1 2 0 1 0\n1 0 1 0 1\n1 2 1 0 0\n1 2 2 2 2\n2 2 1 2 1\n1 0 2 1 2\n2 1 1 2 1\n0 1 0 2 2\n1 0 1 1 1\n0 0 1 0 2\n0 1 0 0 1\n2 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMake a function that receives a value, ```val``` and outputs the smallest higher number than the given value, and this number belong to a set of positive integers that have the following properties:\n\n- their digits occu... | [{"input": "9999999999", "output": "[\"There is no possible number that fulfills those requirements\"]", "fn_name": "next_numb"}, {"input": "999999", "output": "[1023459]", "fn_name": "next_numb"}, {"input": "99", "output": "[105]", "fn_name": "next_numb"}, {"input": "12", "output": "[15]", "fn_name": "next_numb"}, {"i... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis Christmas Santa gave Masha a magic picture and a pencil. The picture consists of n points connected by m segments (they might cross in any way, that doesn't matter). No two segments connect the same pair of points, a... | [{"type": "stdin_stdout", "input": "100 50\n66 3\n92 79\n9 44\n84 45\n30 63\n30 20\n33 86\n8 83\n40 75\n7 36\n91 4\n76 88\n77 76\n28 27\n6 52\n41 57\n8 23\n34 75\n50 15\n86 68\n36 98\n30 84\n37 62\n22 4\n6 45\n72 80\n98 74\n78 84\n1 54\n99 27\n84 91\n78 7\n80 61\n67 48\n51 52\n36 72\n97 87\n25 17\n20 80\n20 39\n72 5\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this simple assignment you are given a number and have to make it negative. But maybe the number is already negative?\n\n**Example:**\n``` c\nmakeNegative(1); // return -1\nmakeNegative(-5); // return -5\nmakeNegative(... | [{"input": "42", "output": "[-42]", "fn_name": "make_negative"}, {"input": "-9", "output": "[-9]", "fn_name": "make_negative"}, {"input": "-1", "output": "[-1]", "fn_name": "make_negative"}, {"input": "1", "output": "[-1]", "fn_name": "make_negative"}, {"input": "0", "output": "[0]", "fn_name": "make_negative"}] | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integers $n$ and $s$. Find the maximum possible median of an array of $n$ non-negative integers (not necessarily distinct), such that the sum of its elements is equal to $s$.\n\nA median of an a... | [{"type": "stdin_stdout", "input": "8\n1 1\n1 10\n3 5\n2 2\n14 33\n4 23\n1 1010001000\n1000100000 1\n", "output": "1\n10\n2\n1\n4\n7\n1010001000\n0\n"}, {"type": "stdin_stdout", "input": "8\n1 1\n1 10\n3 5\n2 1\n14 33\n4 23\n1 1010001000\n1000100000 1\n", "output": "1\n10\n2\n0\n4\n7\n1010001000\n0\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn n × n square matrix is special, if: it is binary, that is, each cell contains either a 0, or a 1; the number of ones in each row and column equals 2. \n\nYou are given n and the first m rows of the matrix. Print the ... | [{"type": "stdin_stdout", "input": "7 4 100501\n0100010\n0000101\n0100100\n0000011\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "7 4 100501\n0100010\n0000101\n0100100\n0000011\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "6 4 100501\n100010\n100100\n010100\n000011\n", "output": "2\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo integer sequences existed initially, one of them was strictly increasing, and another one — strictly decreasing.\n\nStrictly increasing sequence is a sequence of integers $[x_1 < x_2 < \\dots < x_k]$. And strictly dec... | [{"type": "stdin_stdout", "input": "12\n12 8 1 3 7 5 9 6 4 10 11 2\n", "output": "YES\n1 1 0 0 1 0 0 1 1 0 0 1 \n"}, {"type": "stdin_stdout", "input": "12\n12 8 1 3 7 5 9 6 4 10 11 2\n", "output": "YES\n1 1 0 0 1 0 0 1 1 0 0 1 \n"}, {"type": "stdin_stdout", "input": "12\n12 10 1 3 7 5 9 6 4 10 11 2\n", "output": "YES\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMaxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems.\n\nThere are m types of discounts. We assume that the discounts are indexed from 1 to m. To use the discount ... | [{"type": "stdin_stdout", "input": "48\n14 2 5 3 10 10 5 6 14 8 19 13 4 4 3 13 18 19 9 16 3 1 14 9 13 10 13 4 12 11 8 2 18 20 14 11 3 11 18 11 4 2 7 2 18 19 2 8\n70\n9497 5103 1001 2399 5701 4053 3557 8481 1736 4139 5829 1107 6461 4089 5936 7961 6017 1416 1191 4635 4288 5605 8857 1822 71 1435 2837 5523 6993 2404 2840 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're given an integer N. Write a program to calculate the sum of all the digits of N. \n\n-----Input-----\n\nThe first line contains an integer T, the total number of testcases. Then follow T lines, each line contains a... | [{"type": "stdin_stdout", "input": "3 \n36926\n147301\n1688", "output": "26\n16\n23\n"}, {"type": "stdin_stdout", "input": "3 \n36926\n168223\n1688", "output": "26\n22\n23\n"}, {"type": "stdin_stdout", "input": "3 \n36926\n168223\n2811", "output": "26\n22\n12\n"}, {"type": "stdin_stdout", "input": "3 \n17364\n141737\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.\n\nMerlin, the wizard predicted to King Arthur that the next month will turn out to b... | [{"type": "stdin_stdout", "input": "113\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands. \n\nThis board game is played on the n× n board. Rows and ... | [{"type": "stdin_stdout", "input": "10\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n-1 -1 2 2 2 3 2 4 2 5 2 6 2 7 2 8 2 9 -1 -1\n-1 -1 -1 -1 3 3 3 4 3 5 3 6 3 7 3 8 -1 -1 -1 -1\n-1 -1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 -1 -1 -1 -1\n-1 -1 5 2 5 3 5 3 5 5 5 6 5 7 5 9 5 9 -1 -1\n-1 -1 6 2 6 3 6 5 6 5 6 6 6 7 6 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ of length $n$ consisting of lowercase Latin letters. You may apply some operations to this string: in one operation you can delete some contiguous substring of this string, if all letters in the... | [{"type": "stdin_stdout", "input": "500\nbbababaabaabaabbbbbbaabbabbabbaabababababbbbabaaabbbbaaabbbbbbbabababaaaaabbbbabaababbababbaaaaaabbaaabbaabaaababbbbbabbaabaabaabbbaaabaabbaaabbaabababbaaabaaabaaaaabbbababaabbbbabbbbbababbbaabaabbabaabbabbababbbbbaababbaabbbbbbbbaabbabbbabababaaaaaaaaaabababaaabbaabbbabbabbbbab... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Greg and his friends were walking in the forest. Overall there were n people walking, including Greg. Soon he found himself in front of a river. The guys immediately decided to get across the river. Luckily, there... | [{"type": "stdin_stdout", "input": "50 207\n50 100 100 100 100 50 100 100 100 50 100 100 100 50 100 100 50 100 50 100 50 100 100 100 50 100 50 50 100 50 100 100 50 100 100 100 100 50 100 100 100 100 50 50 50 100 100 50 100 100\n", "output": "55\n833060250"}, {"type": "stdin_stdout", "input": "50 125\n50 50 50 100 100 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour job is to return the volume of a cup when given the diameter of the top, the diameter of the bottom and the height.\n\nYou know that there is a steady gradient from the top to the bottom.\n\nYou want to return the vo... | [{"input": "1000\n1000\n1000", "output": "[785398163.4]", "fn_name": "cup_volume"}, {"input": "13.123\n123.12\n1", "output": "[4436.57]", "fn_name": "cup_volume"}, {"input": "5\n12\n31", "output": "[1858.51]", "fn_name": "cup_volume"}, {"input": "10\n8\n10", "output": "[638.79]", "fn_name": "cup_volume"}, {"input": "1\... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree of $2^n - 1$ vertices. Every vertex of this tree has either $0$ children, or $2$ children. All leaves of this tree have the same distance from the root, and for every non-leaf vertex, one of it... | [{"type": "stdin_stdout", "input": "8\nABBBAAABBBAABABAAAABAABAABBABABBABABBBBBAABBAABBBAABBBBAAABBABAABBBBBAAABBABAABAABBBBBAABBBABAAAAAAABBAAABBAABBABABABABBAABBAAABBBBBAAAABBBBAAAABAABABAABBBAABBBAABBAAABBABAABAAABBBAAAABBAAABABBBABAAAAABBABBABAABBBBBAAABBBBBBAABABBAAABBABBABABAAABBABBABABA\n", "output": "479173089\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohnny has just found the new, great tutorial: \"How to become a grandmaster?\". The tutorial tells many strange and unexpected for Johnny things, such as you have to be patient or that very important is solving many hard... | [{"type": "stdin_stdout", "input": "1\n71 4\n100 99 98 97 96 95 94 93 92 91 90 87 86 82 79 78 76 71 70 69 68 66 64 63 62 56 55 53 52 51 50 46 43 42 39 38 37 35 33 31 30 29 22 20 19 18 11 13 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": "862166308\n"}, {"type": "stdin_stdout", "input": "1\n71 2\n100 99 98 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nScientists working internationally use metric units almost exclusively. Unless that is, they wish to crash multimillion dollars worth of equipment on Mars.\n\nYour task is to write a simple function that takes a number of... | [{"input": "9000000000000000.0", "output": "[\"9Pm\"]", "fn_name": "meters"}, {"input": "9000000000000.0", "output": "[\"9Tm\"]", "fn_name": "meters"}, {"input": "123456", "output": "[\"123.456km\"]", "fn_name": "meters"}, {"input": "9000000000.0", "output": "[\"9Gm\"]", "fn_name": "meters"}, {"input": "12300000", "out... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\n\nAt the request of a friend who started learning abacus, you decided to create a program to display the abacus beads. Create a program that takes a certain number as input and outputs a row of abacus beads. Ho... | [{"type": "stdin_stdout", "input": "2006\n1101", "output": "**** \n *\n=====\n * *\n**** \n* ***\n*****\n*****\n\n*****\n \n=====\n ** *\n* * \n*****\n*****\n*****\n"}, {"type": "stdin_stdout", "input": "2006\n0101", "output": "**** \n *\n=====\n * *\n**** \n* ***\n*****\n*****\n\n*****\n \n=====\n * ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWelcome to CODE FESTIVAL 2016! In order to celebrate this contest, find a string s that satisfies the following conditions:\n\n* The length of s is between 1 and 5000, inclusive.\n* s consists of uppercase letters.\n* s c... | [{"type": "stdin_stdout", "input": "1441", "output": "FESTIVALLLLLLLFESTIVAFESTIVALLFESTIVALLFESTIVALFESTIVALFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAFESTIVAF... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen you divide the successive powers of `10` by `13` you get the following remainders of the integer divisions: \n\n`1, 10, 9, 12, 3, 4`. \n\nThen the whole pattern repeats.\n\nHence the following method:\nMultiply the ... | [{"input": "1111111111", "output": "[71]", "fn_name": "thirt"}, {"input": "987654321", "output": "[30]", "fn_name": "thirt"}, {"input": "85299258", "output": "[31]", "fn_name": "thirt"}, {"input": "8529", "output": "[79]", "fn_name": "thirt"}, {"input": "5634", "output": "[57]", "fn_name": "thirt"}] | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are visiting a large electronics store to buy a refrigerator and a microwave.\n\nThe store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \\le i \\le A ) is sold at a_i yen (the cu... | [{"type": "stdin_stdout", "input": "5 5 0\n-10 0\n12 10 -2\n-1 2 1", "output": "-12\n"}, {"type": "stdin_stdout", "input": "2 10 0\n-5 -1\n13 10 -1\n0 2 7", "output": "-6\n"}, {"type": "stdin_stdout", "input": "3 10 -1\n-5 0\n11 10 -2\n0 2 1", "output": "-7\n"}, {"type": "stdin_stdout", "input": "5 10 0\n-6 0\n12 10 -2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a string, s, return a new string that orders the characters in order of frequency. \n\nThe returned string should have the same number of characters as the original string. \n\nMake your transformation stable, meani... | [{"input": "\"Four score and seven years ago\"", "output": "[\" eeeeorsorasarsaonnFucdvyg\"]", "fn_name": "most_common"}, {"input": "\"wubz dermatoglyphics\"", "output": "[\"wubz dermatoglyphics\"]", "fn_name": "most_common"}, {"input": "\"Hello He worldwrd\"", "output": "[\"lllHeo He wordwrd\"]", "fn_name": "most_... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Japan, temperature is usually expressed using the Celsius (℃) scale. In America, they used the Fahrenheit (℉) scale instead. $20$ degrees Celsius is roughly equal to $68$ degrees Fahrenheit. A phrase such as \"Today’s ... | [{"type": "stdin_stdout", "input": "22485", "output": "11227\n"}, {"type": "stdin_stdout", "input": "37535", "output": "18752\n"}, {"type": "stdin_stdout", "input": "54760", "output": "27365\n"}, {"type": "stdin_stdout", "input": "10347", "output": "5158\n"}, {"type": "stdin_stdout", "input": "10699", "output": "5334\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou planned a trip using trains and buses.\nThe train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket.\nSimilarly, the bus fare will be C yen ... | [{"type": "stdin_stdout", "input": "549\n817\n715\n603\n", "output": "1152\n"}, {"type": "stdin_stdout", "input": "600\n300\n220\n420\n", "output": "520\n"}, {"type": "stdin_stdout", "input": "555\n555\n400\n200\n", "output": "755\n"}, {"type": "stdin_stdout", "input": "549\n838\n715\n603", "output": "1152\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis time no story, no theory. The examples below show you how to write function `accum`:\n\n**Examples:**\n```\naccum(\"abcd\") -> \"A-Bb-Ccc-Dddd\"\naccum(\"RqaEzty\") -> \"R-Qq-Aaa-Eeee-Zzzzz-Tttttt-Yyyyyyy\"\naccum(\"... | [{"input": "\"ZpglnRxqenU\"", "output": "[\"Z-Pp-Ggg-Llll-Nnnnn-Rrrrrr-Xxxxxxx-Qqqqqqqq-Eeeeeeeee-Nnnnnnnnnn-Uuuuuuuuuuu\"]", "fn_name": "accum"}, {"input": "\"NyffsGeyylB\"", "output": "[\"N-Yy-Fff-Ffff-Sssss-Gggggg-Eeeeeee-Yyyyyyyy-Yyyyyyyyy-Llllllllll-Bbbbbbbbbbb\"]", "fn_name": "accum"}, {"input": "\"MjtkuBovqrU\""... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. He doesn't have many toys and thus he often plays with polynomials.\n\nHe considers a polynomial valid if its degree is n and its coefficients are integers not exceeding k by the absolute val... | [{"type": "stdin_stdout", "input": "100 1000\n-62 57 -27 -67 49 -10 66 -64 -36 -78 62 -75 -39 75 -47 -36 41 -88 62 -43 22 29 -20 58 40 16 71 -2 -87 12 86 -90 -92 67 -12 -48 -10 -26 78 68 22 -3 66 -95 -81 34 14 -76 -27 76 -60 87 -84 3 35 -60 46 -65 29 -29 2 -44 -55 18 -75 91 36 34 -86 53 59 -54 -29 33 -95 66 9 72 67 -44... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've came to visit your grandma and she straight away found you a job - her Christmas tree needs decorating!\n\nShe first shows you a tree with an identified number of branches, and then hands you a some baubles (or loa... | [{"input": "5\n0", "output": "[\"Grandma, we will have to buy a Christmas tree first!\"]", "fn_name": "baubles_on_tree"}, {"input": "0\n10", "output": "[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]", "fn_name": "baubles_on_tree"}, {"input": "50\n9", "output": "[[6, 6, 6, 6, 6, 5, 5, 5, 5]]", "fn_name": "baubles_on_tree"}, {"input":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is winter now, and Max decided it's about time he watered the garden.\n\nThe garden can be represented as n consecutive garden beds, numbered from 1 to n. k beds contain water taps (i-th tap is located in the bed x_{i}... | [{"type": "stdin_stdout", "input": "1\n177 99\n1 4 7 10 11 13 14 15 16 17 19 21 22 24 25 26 27 28 32 34 35 38 39 40 42 45 46 52 54 55 57 58 59 60 62 64 65 67 70 71 74 77 78 79 80 81 83 84 88 92 93 94 95 100 101 102 104 106 107 108 109 110 112 113 114 115 116 118 122 123 124 125 127 128 129 130 134 135 137 138 139 140 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA tetromino is a figure formed by joining four squares edge to edge. We will refer to the following seven kinds of tetromino as I-, O-, T-, J-, L-, S- and Z-tetrominos, respectively:\n\na60bcb8e9e8f22e3af51049eda063392.pn... | [{"type": "stdin_stdout", "input": "10 1 2 0 0 -1 0", "output": "11\n"}, {"type": "stdin_stdout", "input": "1 13 1 0 1 -1 2", "output": "13\n"}, {"type": "stdin_stdout", "input": "10 2 0 0 4 -1 0", "output": "16\n"}, {"type": "stdin_stdout", "input": "1 26 1 0 1 -1 2", "output": "26\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYouKn0wWho has an integer sequence $a_1, a_2, \\ldots a_n$. Now he will split the sequence $a$ into one or more consecutive subarrays so that each element of $a$ belongs to exactly one subarray. Let $k$ be the number of r... | [{"type": "stdin_stdout", "input": "4\n7\n1 12 3 0 1 1 5\n3\n2 2 5\n5\n1 3 2 4 4\n4\n4 5 -1 1\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n7\n1 11 3 2 1 1 5\n3\n2 2 5\n5\n1 3 2 4 4\n4\n4 5 -2 1\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n7\n1 4 3 2 -1 1 -... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.