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\nYou are given a permutation P_1 ... P_N of the set {1, 2, ..., N}.\n\nYou can apply the following operation to this permutation, any number of times (possibly zero):\n\n* Choose two indices i,j (1 ≦ i < j ≦ N), such that ... | [{"type": "stdin_stdout", "input": "8 2\n4 5 7 8 3 1 2 6", "output": "1\n2\n3\n6\n5\n4\n7\n8\n"}, {"type": "stdin_stdout", "input": "8 6\n4 5 7 8 3 1 2 6", "output": "4\n5\n7\n8\n3\n1\n2\n6\n"}, {"type": "stdin_stdout", "input": "8 5\n4 5 7 8 3 1 2 6", "output": "4\n5\n6\n8\n3\n1\n2\n7\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub has drawn a set of n points in the cartesian plane which he calls \"special points\". A quadrilateral is a simple polygon without self-intersections with four sides (also called edges) and four vertices (also called... | [{"type": "stdin_stdout", "input": "50\n-768 -243\n-741 -984\n-370 213\n-808 571\n-726 442\n234 452\n-105 -990\n-876 -278\n987 473\n-968 -531\n-274 -842\n259 -655\n-59 -555\n976 -396\n878 -85\n551 213\n675 599\n-990 -507\n1 48\n-147 919\n-218 798\n-191 928\n916 263\n-975 169\n567 -967\n394 16\n-224 915\n280 -613\n804 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is a competitive programmer. He wants to become red, and for that he needs a strict training regime. He went to the annual meeting of grandmasters and asked $n$ of them how much effort they needed to reach red.\n\n\"O... | [{"type": "stdin_stdout", "input": "15\n5318008\n379009\n06\n79153975193751375917591379919397337913333535330\n791539751937513759175913799193973379133301353533\n123456789023487138475693874561834576138495713485673485364857638475673465873457346581495713641\n7915397519375137511917591379919397337913333535330\n31553555535353... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that will return whether an input value is a str, int, float, or bool. Return the name of the value.\n\n### Examples\n- Input = 23 --> Output = int\n- Input = 2.3 --> Output = float\n- Input = \"Hello\" -... | [{"input": "{\"name\": \"John\", \"age\": 32}", "output": "[\"dict\"]", "fn_name": "types"}, {"input": "\"Hello World!\"", "output": "[\"str\"]", "fn_name": "types"}, {"input": "[1, 2, 3, 4]", "output": "[\"list\"]", "fn_name": "types"}, {"input": "null", "output": "[\"NoneType\"]", "fn_name": "types"}, {"input": "3.14... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be w_{i}, th... | [{"type": "stdin_stdout", "input": "100 50 10\n7 8 7 1 6 7 9 2 4 6 7 7 3 9 4 5 1 7 8 10 4 1 3 6 8 10 4 6 6 1 6 12 7 4 10 3 10 1 3 2 10 6 9 9 5 2 9 2 9 8 10 2 10 3 3 2 3 8 6 2 7 10 7 2 7 2 8 9 6 2 5 4 4 5 3 3 9 10 9 4 9 3 9 5 3 6 6 1 3 6 10 3 10 2 6 10 10 10 4 8\n3 3 2 9 4 4 10 2 7 3 3 2 6 3 3 4 7 4 1 2 3 8 1 6 7 7 2 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is a number of elements in the array.\n\nYou are given an array $a$ consisting of $n$ integers. The value of the $i$-th element of the array is $a_i$.\n\nYou are also giv... | [{"type": "stdin_stdout", "input": "50 50\n1 -9 8 -9 5 -4 -4 3 -2 -1 3 -8 -6 -6 2 -5 -1 -2 -5 10 2 0 10 10 5 -3 12 -1 -9 9 -10 4 7 0 -6 0 -1 4 8 0 -3 -8 10 10 6 6 -3 -5 -3 -8\n28 41\n28 49\n49 49\n6 38\n22 30\n50 50\n41 45\n30 32\n17 44\n24 25\n27 39\n17 39\n50 50\n10 14\n11 12\n18 28\n11 20\n36 42\n45 49\n29 36\n32 44... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus is a system administrator. There are two servers under his strict guidance — a and b. To stay informed about the servers' performance, Polycarpus executes commands \"ping a\" and \"ping b\". Each ping command s... | [{"type": "stdin_stdout", "input": "14\n1 7 3\n1 0 10\n1 7 3\n1 1 9\n2 2 8\n2 0 10\n1 1 9\n2 8 2\n2 6 4\n1 3 7\n1 3 7\n2 6 4\n2 1 9\n2 7 3\n", "output": "DEAD\nDEAD\n"}, {"type": "stdin_stdout", "input": "14\n1 7 3\n1 0 10\n1 7 3\n1 1 9\n2 2 8\n2 0 10\n1 1 9\n2 8 2\n2 6 4\n1 3 7\n1 3 7\n2 6 4\n2 1 9\n2 7 3\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n*This kata is inspired by [Project Euler Problem #387](https://projecteuler.net/problem=387)*\n\n---\n\nA [Harshad number](https://en.wikipedia.org/wiki/Harshad_number) (or Niven number) is a number that is divisible by t... | [{"input": "1000\n2000", "output": "[[1000, 1002, 1008, 1020, 1026, 1080, 1088, 1200, 1204, 1206, 1260, 1800, 2000]]", "fn_name": "rthn_between"}, {"input": "30\n100", "output": "[[30, 36, 40, 42, 45, 48, 50, 54, 60, 63, 70, 72, 80, 81, 84, 90, 100]]", "fn_name": "rthn_between"}, {"input": "9000002182976\n9000195371842... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nA graph is given in which N vertices, each numbered from 1 to N, are connected by N-1 undirected edges. For each vertex, output the shortest number of steps to start from that vertex and visit all vertices.\n\n... | [{"type": "stdin_stdout", "input": "6\n1 2\n2 3\n3 4\n3 5\n5 6", "output": "6\n7\n8\n7\n7\n6\n"}, {"type": "stdin_stdout", "input": "6\n1 2\n2 3\n6 4\n3 5\n5 6", "output": "5\n6\n7\n5\n7\n6\n"}, {"type": "stdin_stdout", "input": "6\n1 2\n2 3\n6 4\n3 4\n5 6", "output": "5\n6\n7\n7\n5\n6\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an array, return the reversed version of the array (a different kind of reverse though), you reverse portions of the array, you'll be given a length argument which represents the length of each portion you are to re... | [{"input": "[2, 4, 6, 8, 10, 12, 14, 16]\n3", "output": "[[6, 4, 2, 12, 10, 8, 16, 14]]", "fn_name": "sel_reverse"}, {"input": "[2, 4, 6, 8, 10, 12, 14, 16]\n2", "output": "[[4, 2, 8, 6, 12, 10, 16, 14]]", "fn_name": "sel_reverse"}, {"input": "[1, 2, 3, 4, 5, 6]\n10", "output": "[[6, 5, 4, 3, 2, 1]]", "fn_name": "sel_r... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this Kata, you will be given a string and two indexes (`a` and `b`). Your task is to reverse the portion of that string between those two indices inclusive. \n\n~~~if-not:fortran\n```\nsolve(\"codewars\",1,5) = \"cawed... | [{"input": "\"abcefghijklmnopqrstuvwxyz\"\n0\n20", "output": "[\"vutsrqponmlkjihgfecbawxyz\"]", "fn_name": "solve"}, {"input": "\"abcefghijklmnopqrstuvwxyz\"\n5\n20", "output": "[\"abcefvutsrqponmlkjihgwxyz\"]", "fn_name": "solve"}, {"input": "\"FunctionalProgramming\"\n2\n15", "output": "[\"FuargorPlanoitcnmming\"]", ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got table a, consisting of n rows, numbered from 1 to n. The i-th line of table a contains ci cells, at that for all i (1 < i ≤ n) holds ci ≤ ci - 1. \n\nLet's denote s as the total number of cells of table a, that... | [{"type": "stdin_stdout", "input": "4\n40 40 24 5\n56 14 59 76 92 34 43 96 33 44 72 37 81 27 42 5 7 95 22 4 60 18 61 103 74 84 93 55 3 62 70 82 77 51 86 102 29 67 91 9\n71 53 21 64 17 45 46 101 97 30 109 100 57 16 80 87 28 12 94 23 39 98 32 52 54 10 19 41 90 11 66 65 99 89 40 36 58 20 78 108\n35 88 73 75 104 63 79 31 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPermutation p is an ordered set of integers p_1, p_2, ..., p_{n}, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as p_{i}. We'll call number n ... | [{"type": "stdin_stdout", "input": "1000 500\n", "output": "979041279\n"}, {"type": "stdin_stdout", "input": "1000 700\n", "output": "642759746\n"}, {"type": "stdin_stdout", "input": "1000 900\n", "output": "301804159\n"}, {"type": "stdin_stdout", "input": "1000 998\n", "output": "583666213\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIkta loves fast programs. Recently, I'm trying to speed up the division program. However, it doesn't get much faster, so I thought it would be better to make it faster only for \"common sense and typical\" inputs. The pro... | [{"type": "stdin_stdout", "input": "001", "output": "2\n"}, {"type": "stdin_stdout", "input": "000", "output": "1\n"}, {"type": "stdin_stdout", "input": "178", "output": "0\n"}, {"type": "stdin_stdout", "input": "209", "output": "0\n"}, {"type": "stdin_stdout", "input": "375", "output": "0\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTokitsukaze and CSL are playing a little game of stones.\n\nIn the beginning, there are n piles of stones, the i-th pile of which has a_i stones. The two players take turns making moves. Tokitsukaze moves first. On each t... | [{"type": "stdin_stdout", "input": "14\n9 9 1000 2000 39999 48888 16 32 123456 959658 111 987584 125632 125468\n", "output": "sjfnb\n"}, {"type": "stdin_stdout", "input": "14\n9 9 1000 2000 39999 48888 16 32 123456 959658 111 987584 125632 125477\n", "output": "cslnb\n"}, {"type": "stdin_stdout", "input": "14\n9 9 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe marmots need to prepare k problems for HC^2 over n days. Each problem, once prepared, also has to be printed.\n\nThe preparation of a problem on day i (at most one per day) costs a_{i} CHF, and the printing of a probl... | [{"type": "stdin_stdout", "input": "13 13\n93 19 58 34 96 7 35 46 60 5 36 40 41\n57 3 42 68 26 85 25 45 50 21 60 23 79\n", "output": "1154\n"}, {"type": "stdin_stdout", "input": "13 13\n93 19 58 34 96 7 35 46 60 5 66 40 41\n57 3 42 68 26 85 25 45 50 21 60 23 79\n", "output": "1184\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of $36... | [{"type": "stdin_stdout", "input": "15\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "15\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n168\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "15\n180\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXenia the beginner programmer has a sequence a, consisting of 2^{n} non-negative integers: a_1, a_2, ..., a_2^{n}. Xenia is currently studying bit operations. To better understand how they work, Xenia decided to calculate... | [{"type": "stdin_stdout", "input": "2 10\n47 17 22 0\n2 15\n2 42\n1 9\n3 13\n3 28\n1 20\n1 13\n1 50\n2 20\n2 12\n", "output": "57\n57\n61\n38\n55\n34\n51\n38\n42\n34\n"}, {"type": "stdin_stdout", "input": "2 10\n47 17 22 0\n4 15\n2 42\n1 9\n3 13\n3 28\n1 20\n1 13\n1 50\n2 20\n2 12\n", "output": "32\n48\n52\n36\n52\n33\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's March and you just can't seem to get your mind off brackets. However, it is not due to basketball. You need to extract statements within strings that are contained within brackets.\n\nYou have to write a function tha... | [{"input": "\"logger?]?system...12.12.133333 at [12-32-1432-16]\"", "output": "[[\"12-32-1432-16\"]]", "fn_name": "bracket_buster"}, {"input": "\"Big [L][e][B][r][o][n]!][[\"", "output": "[[\"L\", \"e\", \"B\", \"r\", \"o\", \"n\"]]", "fn_name": "bracket_buster"}, {"input": "\"[][]]]][[[[[[][]\"", "output": "[[\"\", \"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define a function $f(x)$ ($x$ is a positive integer) as follows: write all digits of the decimal representation of $x$ backwards, then get rid of the leading zeroes. For example, $f(321) = 123$, $f(120) = 21$, $f(10... | [{"type": "stdin_stdout", "input": "100\n1\n2\n3\n4\n5\n4\n7\n8\n9\n10\n11\n12\n13\n17\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n17\n28\n29\n30\n31\n32\n31\n34\n35\n36\n27\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n29\n54\n100\n56\n57\n58\n59\n109\n61\n62\n63\n120\n65\n66\n67\n68\n69\n70\n71\n7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a graph with $3 \\cdot n$ vertices and $m$ edges. You are to find a matching of $n$ edges, or an independent set of $n$ vertices.\n\nA set of edges is called a matching if no two edges share an endpoint.\n\n... | [{"type": "stdin_stdout", "input": "1\n5 39\n1 2\n3 4\n5 6\n7 8\n1 9\n3 10\n3 11\n5 12\n5 13\n7 14\n7 15\n9 2\n10 2\n11 2\n12 2\n13 2\n14 2\n15 2\n9 4\n10 4\n11 4\n12 4\n13 4\n14 4\n15 4\n9 6\n10 6\n11 6\n12 6\n13 6\n14 6\n15 6\n9 8\n10 8\n11 8\n12 8\n13 8\n14 8\n15 8\n", "output": "IndSet\n9 10 11 12 13 \n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.\n\nYou may shoot t... | [{"type": "stdin_stdout", "input": "10\n8\n7 4\n9 10\n4 8\n3 1\n1 7\n9 5\n1 4\n2 5\n8\n9 8\n4 7\n7 7\n3 6\n14 9\n2 5\n4 9\n2 8\n7\n2 2\n2 7\n2 10\n8 6\n1 4\n2 6\n3 10\n4\n4 10\n7 5\n6 10\n9 5\n7\n8 9\n8 1\n3 4\n5 1\n3 10\n9 3\n5 5\n5\n6 1\n7 3\n6 5\n6 1\n1 8\n2\n7 8\n7 10\n4\n6 8\n9 3\n8 1\n9 7\n4\n13 7\n5 7\n10 10\n8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSergey is testing a next-generation processor. Instead of bytes the processor works with memory cells consisting of n bits. These bits are numbered from 1 to n. An integer is stored in the cell in the following way: the l... | [{"type": "stdin_stdout", "input": "100\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasilisa the Wise from a far away kingdom got a present from her friend Helga the Wise from a farther away kingdom. The present is a surprise box, yet Vasilisa the Wise doesn't know yet what the surprise actually is becau... | [{"type": "stdin_stdout", "input": "RRYOGB\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "YROVBG\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "RYGOBG\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "VOBYGO\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "GRBYVO\n", "output": "30... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n## Description:\n\n Remove all exclamation marks from the end of words. Words are separated by spaces in the sentence.\n\n### Examples\n\n```\nremove(\"Hi!\") === \"Hi\"\nremove(\"Hi!!!\") === \"Hi\"\nremove(\"!Hi\") === ... | [{"input": "\"Hi! Hi!\"", "output": "[\"Hi Hi\"]", "fn_name": "remove"}, {"input": "\"Hi!!!\"", "output": "[\"Hi\"]", "fn_name": "remove"}, {"input": "\"!Hi!\"", "output": "[\"!Hi\"]", "fn_name": "remove"}, {"input": "\"!Hi\"", "output": "[\"!Hi\"]", "fn_name": "remove"}, {"input": "\"Hi!\"", "output": "[\"Hi\"]", "fn_... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are required to create a simple calculator that returns the result of addition, subtraction, multiplication or division of two numbers.\n\nYour function will accept three arguments:\nThe first and second argument shou... | [{"input": "\":\"\n\",\"\n\"+\"", "output": "[\"unknown value\"]", "fn_name": "calculator"}, {"input": "6\n\"$\"\n\"+\"", "output": "[\"unknown value\"]", "fn_name": "calculator"}, {"input": "\"a\"\n3\n\"+\"", "output": "[\"unknown value\"]", "fn_name": "calculator"}, {"input": "4\n3\n\"\\\\\"", "output": "[\"unknown v... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an array (or list or vector) of arrays (or, guess what, lists or vectors) of integers, your goal is to return the sum of a specific set of numbers, starting with elements whose position is equal to the main array le... | [{"input": "[[3, 2, 1, 0], [4, 6, 5, 3, 2], [9, 8, 7, 4]]", "output": "[16]", "fn_name": "elements_sum"}, {"input": "[[3, 2, 1, 0], [4, 6, 5, 3, 2], []]\n5", "output": "[12]", "fn_name": "elements_sum"}, {"input": "[[3], [4, 6, 5, 3, 2], [9, 8, 7, 4]]", "output": "[15]", "fn_name": "elements_sum"}, {"input": "[[3, 2, 1... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n## Task\nIn this kata you'll be given a string of English digits \"collapsed\" together, like this:\n\n`zeronineoneoneeighttwoseventhreesixfourtwofive`\n\nYour task is to split the string back to digits:\n\n`zero nine one... | [{"input": "\"threesevensevensixninenineninefiveeighttwofiveeightsixthreeeight\"", "output": "[\"three seven seven six nine nine nine five eight two five eight six three eight\"]", "fn_name": "uncollapse"}, {"input": "\"fivethreefivesixthreenineonesevenoneeight\"", "output": "[\"five three five six three nine one seven... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA nearby pie shop is having a special sale. For each pie you pay full price for, you may select one pie of a strictly lesser value to get for free. Given the prices of all the pies you wish to acquire, determine the minim... | [{"type": "stdin_stdout", "input": "50\n4 2 6 7 2 6 3 8 8 2 4 8 4 4 1 4 5 2 2 5 6 4 3 3 3 6 8 2 1 3 1 8 2 3 7 4 7 5 4 8 3 5 7 8 6 7 5 8 7 1\n", "output": "130\n"}, {"type": "stdin_stdout", "input": "50\n4 2 6 7 2 6 3 8 8 2 4 8 4 4 1 3 5 2 2 5 6 4 3 3 3 6 8 2 1 3 1 8 2 3 7 4 7 5 4 8 3 5 7 8 6 7 5 8 7 1\n", "output": "12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings $s$ and $t$ both of length $2$ and both consisting only of characters 'a', 'b' and 'c'.\n\nPossible examples of strings $s$ and $t$: \"ab\", \"ca\", \"bb\".\n\nYou have to find a string $res$ con... | [{"type": "stdin_stdout", "input": "24288\naa\nbc\n", "output": "YES\nacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacbacba... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to ... | [{"type": "stdin_stdout", "input": "155\n", "output": "12013\nC.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C\n.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.C.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlgorithmic predicament - Bug Fixing #9\n\nOh no! Timmy's algorithim has gone wrong! help Timmy fix his algorithim! \n\nTask\nYour task is to fix timmy's algorithim so it returns the group name with the highest total age.... | [{"input": "[{\"name\": \"kay\", \"age\": 1}, {\"name\": \"john\", \"age\": 130}, {\"name\": \"kay\", \"age\": 130}]\n[{\"name\": \"john\", \"age\": 1}, {\"name\": \"alice\", \"age\": 76}]", "output": "[\"john\"]", "fn_name": "highest_age"}, {"input": "[{\"name\": \"kay\", \"age\": 1}, {\"name\": \"john\", \"age\": 13}... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnna is a girl so brave that she is loved by everyone in the city and citizens love her cookies. She is planning to hold a party with cookies. Now she has $a$ vanilla cookies and $b$ chocolate cookies for the party.\n\nSh... | [{"type": "stdin_stdout", "input": "6\n2 2 1 2\n0 100 0 1\n12 13 25 1\n27 83 14 25\n0 0 1 0\n1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "Yes\nNo\nNo\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "6\n2 2 1 2\n0 100 0 1\n11 13 25 1\n27 83 14 25\n0 0 1 0\n100000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFirst-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most talented students in this university. The education is not easy because you need to have fundamental knowledge ... | [{"type": "stdin_stdout", "input": "prntaxhysjfcfmrjngdsitlguahtpnwgbaxptubgpwcfxqehrulbxfcjssgocqncscduvyvarvwxzvmjoatnqfsvsilubexmwugedtzavyamqjqtkxzuslielibjnvkpvyrbndehsqcaqzcrmomqqwskwcypgqoawxdutnxmeivnfpzwvxiyscbfnloqjhjacsfnkfmbhgzpujrqdbaemjsqphokkiplblbflvadcyykcqrdohfasstobwrobslaofbasylwiizrpozvhtwyxtzl\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Chanek The Ninja is one day tasked with a mission to handle mad snakes that are attacking a site. Now, Mr. Chanek already arrived at the hills where the destination is right below these hills. The mission area can be ... | [{"type": "stdin_stdout", "input": "20 17 998\n1000 1000 295133\n1 1000 322998\n31 1 412809\n1 457 347941\n1000 579 600207\n1 708 315587\n1 159 302269\n1000 447 1582128\n247 1 591835\n933 1 16036\n140 1 305582\n1 1 147502\n1000 1 631288\n216 1000 145614\n402 1000 875933\n594 1000 874200\n1000 963 839096\n1 865 156116\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer N. Find the minimum possible positive integer k such that (1+2+\\cdots+k) is a multiple of N. It can be proved that such a positive integer k always exists.\n\nConstraints\n\n* 1 \\leq N \\leq 10^{15}\... | [{"type": "stdin_stdout", "input": "150916391", "output": "67547447\n"}, {"type": "stdin_stdout", "input": "116446379", "output": "20549361\n"}, {"type": "stdin_stdout", "input": "39730771", "output": "39730770\n"}, {"type": "stdin_stdout", "input": "71266519", "output": "17269679\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBishwock is a chess figure that consists of three squares resembling an \"L-bar\". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states:\n\n \n\nXX XX .X X.\n\nX. .X XX XX\... | [{"type": "stdin_stdout", "input": "0000000000000000000000000000000000000000000000000000000000X0000000000000000000000000000000000000X000\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "66\n"}, {"type": "stdin_stdout", "input": "0000X00X000000X0000X00X... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi and Aoki love calculating things, so they will play with numbers now.\n\nFirst, they came up with one positive integer each. Takahashi came up with X, and Aoki came up with Y. Then, they will enjoy themselves by... | [{"type": "stdin_stdout", "input": "10 10 14\n1100110011\n1011001101", "output": "100001000000000010001000\n100001000000000000100010\n"}, {"type": "stdin_stdout", "input": "10 10 14\n1110110011\n1011001101", "output": "100001000000000100001000\n100001000000000000100010\n"}, {"type": "stdin_stdout", "input": "10 10 14\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are many caves deep in mountains found in the countryside. In legend, each cave has a treasure hidden within the farthest room from the cave's entrance. The Shogun has ordered his Samurais to explore these caves wit... | [{"type": "stdin_stdout", "input": "3\n1 0\n0 1\n-2 0\n1 0\n0 8\n-1 0\n0 -1\n5 0\n0 1\n0 -4\n1 0\n0 -5\n-3 0\n0 3\n2 0\n-1 -1\n-2 1\n0 1\n0 -1\n1 0\n0 2\n-2 -1\n0 -3\n3 1\n-1 0\n-4 0\n0 0\n-2 0\n1 0\n0 0\n-3 0\n0 0\n2 0\n0 1\n-1 0\n-1 1\n-1 0\n0 -2\n0 0", "output": "4 9\n-2 0\n-3 0\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph.\n\nThere are n vertices in the tree, each of them is painted black or white. Anton doesn't like multicolored tre... | [{"type": "stdin_stdout", "input": "42\n1 0 0 1 0 1 1 0 1 1 1 1 0 1 0 0 0 1 1 1 0 1 1 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0\n35 6\n35 39\n4 31\n31 5\n14 35\n1 2\n40 32\n35 31\n37 35\n32 38\n1 36\n3 25\n35 11\n26 35\n24 35\n3 2\n35 23\n21 1\n20 27\n16 26\n2 18\n34 39\n39 28\n3 32\n26 30\n41 7\n13 35\n1 8\n31 22\n33 21\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the hard version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.\n\nYou are ... | [{"type": "stdin_stdout", "input": "5\n2 2\n10\n11\n3 3\n011\n101\n010\n4 4\n1111\n0110\n0110\n1111\n5 5\n01011\n11001\n00010\n11011\n10000\n2 3\n011\n101\n", "output": "1\n1 1 2 1 2 2 \n5\n1 2 1 3 2 2 \n2 1 2 2 3 2 \n2 2 3 2 2 3 \n2 2 2 3 3 3 \n3 2 2 3 3 3 \n8\n1 1 1 2 2 1 \n1 3 1 4 2 3 \n2 1 2 2 3 1 \n3 1 4 1 3 2 \n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nI conducted an exit poll of the shopping amount at a department store. Create a program that takes the shopping amount data as input, calculates the average shopping amount per person, and outputs it. The number of people... | [{"type": "stdin_stdout", "input": "6\n23426\n5600\n33800\n0\n26495\n52000", "output": "23553\n"}, {"type": "stdin_stdout", "input": "6\n23426\n5600\n33800\n0\n17519\n52000", "output": "22057\n"}, {"type": "stdin_stdout", "input": "6\n23426\n5600\n33800\n0\n14222\n52000", "output": "21508\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDescription\n\nIn English we often use \"neutral vowel sounds\" such as \"umm\", \"err\", \"ahh\" as fillers in conversations to help them run smoothly.\n\nBob always finds himself saying \"err\". Infact he adds an \"err\... | [{"input": "\"This, is. another! test? case to check your beautiful code.\"", "output": "[\"Thiserr, iserr. anothererr! testerr? case to checkerr yourerr beautifulerr code.\"]", "fn_name": "err_bob"}, {"input": "\"Punctuation? is, important! double space also\"", "output": "[\"Punctuationerr? iserr, importanterr! dou... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\nLet the current time be time 0. Kizahashi has N jobs numbered 1 ... | [{"type": "stdin_stdout", "input": "30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe number 81 has a special property, a certain power of the sum of its digits is equal to 81 (nine squared). Eighty one (81), is the first number in having this property (not considering numbers of one digit). \nThe next... | [{"input": "6", "output": "[17576]", "fn_name": "power_sumDigTerm"}, {"input": "7", "output": "[19683]", "fn_name": "power_sumDigTerm"}, {"input": "3", "output": "[2401]", "fn_name": "power_sumDigTerm"}, {"input": "4", "output": "[4913]", "fn_name": "power_sumDigTerm"}, {"input": "5", "output": "[5832]", "fn_name": "po... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation of size $n$ is an array of size $n$ such that each integer from $1$ to $n$ occurs exactly once in this array. An inversion in a permutation $p$ is a pair of indices $(i, j)$ such that $i > j$ and $a_i < a_j$... | [{"type": "stdin_stdout", "input": "69\n-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": " ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSummer vacation ended at last and the second semester has begun. You, a Kyoto University student, came to university and heard a rumor that somebody will barricade the entrance of your classroom. The barricade will be bui... | [{"type": "stdin_stdout", "input": "5 5 5\n3\n2\n11\n16\n18", "output": "5\n"}, {"type": "stdin_stdout", "input": "5 5 5\n3\n2\n11\n29\n18", "output": "5\n"}, {"type": "stdin_stdout", "input": "5 4 5\n3\n2\n11\n29\n18", "output": "5\n"}, {"type": "stdin_stdout", "input": "5 4 5\n3\n2\n11\n29\n30", "output": "5\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has N blue cards and M red cards.\nA string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i.\nTakahashi will now announce a string, an... | [{"type": "stdin_stdout", "input": "1\nvoldemort\n10\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\nvoldemort\n10\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nuoldemort\nvoldemort\nvoldemort\nvolde... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTheofanis started playing the new online game called \"Among them\". However, he always plays with Cypriot players, and they all have the same name: \"Andreas\" (the most common name in Cyprus).\n\nIn each game, Theofanis... | [{"type": "stdin_stdout", "input": "5\n3 2\n1 2 imposter\n2 3 crewmate\n5 4\n1 5 crewmate\n2 5 crewmate\n2 4 imposter\n3 4 imposter\n2 2\n1 2 imposter\n2 1 crewmate\n3 5\n1 2 imposter\n1 2 imposter\n3 2 crewmate\n2 2 crewmate\n1 3 imposter\n13 0\n", "output": "2\n4\n-1\n2\n13\n"}, {"type": "stdin_stdout", "input": "5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and people who enter the platform ca... | [{"type": "stdin_stdout", "input": "10 4\nA\nB\nB\nC\n8 4\nD\nD\nB\nB\n0 0", "output": "AC######BB\nD####BBD\n"}, {"type": "stdin_stdout", "input": "12 4\nA\nB\nB\nD\n5 4\nC\nD\nB\nB\n0 0", "output": "A####D####BB\nD#CBB\n"}, {"type": "stdin_stdout", "input": "10 4\nA\nC\nD\nB\n7 4\nC\nA\nB\nB\n0 0", "output": "AC#####... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond to weekdays, and cells conta... | [{"type": "stdin_stdout", "input": "11 6\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 2\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 3\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 4\n", "output": "5\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZibi is a competitive programming coach. There are $n$ competitors who want to be prepared well. The training contests are quite unusual – there are two people in a team, two problems, and each competitor will code exactl... | [{"type": "stdin_stdout", "input": "40 39\n0 -2\n-2 3\n3 3\n3 -2\n-1 1\n2 0\n-3 2\n-2 1\n0 -3\n-1 -3\n1 -1\n-3 -1\n2 2\n0 2\n1 -3\n-2 -1\n1 2\n-1 -2\n-1 0\n3 2\n1 3\n-3 1\n-2 -3\n-3 -1\n3 0\n-1 3\n3 1\n-2 2\n0 3\n3 -1\n2 -3\n1 1\n-1 -1\n0 1\n-3 0\n1 0\n-3 3\n-3 -3\n2 2\n-1 2\n1 29\n29 2\n29 3\n29 4\n5 29\n29 6\n7 29\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program that extracts n different numbers from the numbers 0 to 9 and outputs the number of combinations that add up to s. Each n number is from 0 to 9, and the same number cannot be used in one combination. For e... | [{"type": "stdin_stdout", "input": "4 14\n3 1\n0 0", "output": "13\n0\n"}, {"type": "stdin_stdout", "input": "3 10\n5 -2\n0 0", "output": "8\n0\n"}, {"type": "stdin_stdout", "input": "2 -1\n13 1\n0 0", "output": "0\n0\n"}, {"type": "stdin_stdout", "input": "3 -1\n13 1\n0 0", "output": "0\n0\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an integer N, Chef wants to find the smallest positive integer M such that the bitwise XOR of M and M+1 is N. If no such M exists output -1.\n\n-----Input-----\nThe first line of input contain an integer T denoting ... | [{"type": "stdin_stdout", "input": "1\n127", "output": "63\n"}, {"type": "stdin_stdout", "input": "1\n101", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1\n100", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1\n110", "output": "-1\n"}, {"type": "stdin_stdout", "input": "1\n111", "output": "-1\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.\n\nHe looks at the first two students and ... | [{"type": "stdin_stdout", "input": "484\nLLRRRL==RRLRRLR=LRR=RL=LLLRL===RLRRRLRR=RRRL=LLLLRL==RL==R==LLLRL=RLLRLRLLLLLLLRRLL=LLR=LLR==RLL==LLLR=RL==LL=LRRL=LLRRRLR====R=R=LRRRLLL==RLRRLR=LL==LLRLR===RR=LR==RL==L==R====LRL=LR=R=R=R=LL=L=RLR=RL==R==LRLRL==L==LL=LR=L=RRRR=R==RRLRRRLR==R=LL===R===RLRRR===LRRLLRRRRR=L==LLRR... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese , Russian and Vietnamese \n\nChuru is taking the course called “Introduction to Data Structures”. Yesterday, he learned how to use a stack to check is a given parentheses expr... | [{"type": "stdin_stdout", "input": "2\n4 1\n0 3\n4 2\n0 3\n-1 -2", "output": "()()\n()()\n"}, {"type": "stdin_stdout", "input": "2\n4 1\n0 3\n4 2\n0 3\n-2 -2", "output": "()()\n()()\n"}, {"type": "stdin_stdout", "input": "2\n4 1\n0 3\n4 1\n0 3\n-1 -2", "output": "()()\n()()\n"}, {"type": "stdin_stdout", "input": "2\n4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\ncrc\n1\n\n\nOutput\n\ncrc\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this problem. Your progra... | [{"type": "stdin_stdout", "input": "epi\n-2", "output": "eipie\n"}, {"type": "stdin_stdout", "input": "eoi\n-2", "output": "eioie\n"}, {"type": "stdin_stdout", "input": "eoj\n-2", "output": "ejoje\n"}, {"type": "stdin_stdout", "input": "enj\n-2", "output": "ejnje\n"}, {"type": "stdin_stdout", "input": "fnj\n-2", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor he knew every Who down in Whoville beneath, Was busy now, hanging a mistletoe wreath. \"And they're hanging their stockings!\" he snarled with a sneer, \"Tomorrow is Christmas! It's practically here!\"\n\nDr. Suess, H... | [{"type": "stdin_stdout", "input": "336 336\nHHHHHHHHHS..S..HH..H.S.H..HHH.H.H.H.S.H.S.S.H.S..SS..H.SS.H.HH.HH..HH.H...H.H.H.HSS..H...HH..HH.H..H.S.S....S.H.HH..HS..S.S.S.H.H.S..S.H.HH.HH..HH.HH.HS.HH.HSSHHHHHHHHH.H.HH..HHH.H.H.S..H.HH.S.H..HH.HS.HH.S.H.H.H..H.HH.HS.HHHHH.HH.S.SSS.S.S.HH.HS.H.S.HH.H.HH.H.S.HH.HS.HH..HH... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are $\\frac{n \\cdot(n - 1)}{2}$ roads in total. It takes exactly y seconds to traverse any single... | [{"type": "stdin_stdout", "input": "50 23129 410924\n18 28\n17 23\n21 15\n18 50\n50 11\n32 3\n44 41\n50 31\n50 34\n5 14\n36 13\n22 40\n20 9\n9 43\n19 47\n48 40\n20 22\n33 45\n35 22\n33 24\n9 6\n13 1\n13 24\n49 20\n1 20\n29 38\n10 35\n25 23\n49 30\n42 8\n20 18\n32 15\n32 1\n27 10\n20 47\n41 7\n20 14\n18 26\n4 20\n20 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima overslept the alarm clock, which was supposed to raise him to school.\n\nDima wonders if he will have time to come to the first lesson. To do this, he needs to know the minimum time it will take him to get from home ... | [{"type": "stdin_stdout", "input": "10 8 2\n0 -1 0 -1 -1 0 0 -1 -1\n-1 0 -1 0 0 -1 -1 0 -1\n-1 -1 -1 0 -1 -1 0 0 0\n0 0 0 0 -1 0 0 0 -1\n0 -1 -1 0 -1 -1 -1 0 0\n-1 -1 -1 0 -1 -2 0 -1 0\n0 0 0 0 -1 0 0 0 -1\n0 0 -1 0 -1 0 0 -1 0\n-1 0 0 0 -1 -1 -1 0 0\n-1 -1 -1 0 0 0 -1 -1 0\n", "output": "-1\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile surfing in web I found interesting math problem called \"Always perfect\". That means if you add 1 to the product of four consecutive numbers the answer is ALWAYS a perfect square.\nFor example we have: 1,2,3,4 and ... | [{"input": "\"2000000,2000001,2000002,2000003\"", "output": "[\"16000048000044000012000001, 4000006000001\"]", "fn_name": "check_root"}, {"input": "\"25000,25001,25002,25003\"", "output": "[\"390718756875150001, 625075001\"]", "fn_name": "check_root"}, {"input": "\"1015,1016,1017,1018\"", "output": "[\"1067648959441, 1... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consi... | [{"type": "stdin_stdout", "input": "ttspivgoupgupvgpusvppogsseueusuglpiugssviuutlvgvugtpovuvspvpipggooplgvgugpogvesppulovugsvuougveiivgvslllviogpvtolepglguuellotpvgevspvoiiggiiplppgosuguvtstttpielteuglopgeoeeuivtptggltoltpgliviotsospvitupiopisoetupvvspooilsopslpoloptigstspoiuutiuvvuvlpplvioitsuvlpvtleveslslovolloogsgpv... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a method that returns true if a given parameter is a power of 4, and false if it's not. If parameter is not an Integer (eg String, Array) method should return false as well.\n\n(In C# Integer means all integer Types... | [{"input": "\"pippi\"", "output": "[false]", "fn_name": "powerof4"}, {"input": "4.2", "output": "[false]", "fn_name": "powerof4"}, {"input": "-25", "output": "[false]", "fn_name": "powerof4"}, {"input": "40", "output": "[false]", "fn_name": "powerof4"}, {"input": "256", "output": "[true]", "fn_name": "powerof4"}, {"inp... | code_functional |
[
{
"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\nMr. F has n positive integers, a_1, a_2, …, a_n.\n\nHe thinks the greatest common divisor of these integers is too small. So he wants to enlarge it by removing some of the integers.\n\nBut this problem is too simple for h... | [{"type": "stdin_stdout", "input": "100\n95 94 31 65 35 95 70 78 81 36 69 97 39 28 89 62 36 23 35 21 36 11 65 39 13 34 79 87 91 70 43 82 24 97 6 87 49 140 60 92 63 9 16 6 31 90 6 5 55 48 27 86 65 66 45 8 67 17 24 44 34 93 26 32 82 54 72 83 94 81 79 79 15 9 4 59 42 83 80 67 28 62 56 58 87 67 34 3 61 10 62 19 94 31 74 97... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile most devs know about [big/little-endianness](https://en.wikipedia.org/wiki/Endianness), only a selected few know the secret of real hard core coolness with mid-endians.\n\nYour task is to take a number and return it... | [{"input": "43135012110", "output": "[\"0D0B0A0C0E\"]", "fn_name": "mid_endian"}, {"input": "168496141", "output": "[\"0D0B0A0C\"]", "fn_name": "mid_endian"}, {"input": "9999999", "output": "[\"96987F\"]", "fn_name": "mid_endian"}, {"input": "658188", "output": "[\"0B0A0C\"]", "fn_name": "mid_endian"}, {"input": "0", "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo integers are coprimes if the their only greatest common divisor is 1.\n\n## Task\nIn this kata you'll be given a number ```n >= 2``` and output a list with all positive integers less than ```gcd(n, k) == 1```, with ``... | [{"input": "25", "output": "[[1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, 24]]", "fn_name": "coprimes"}, {"input": "30", "output": "[[1, 7, 11, 13, 17, 19, 23, 29]]", "fn_name": "coprimes"}, {"input": "20", "output": "[[1, 3, 7, 9, 11, 13, 17, 19]]", "fn_name": "coprimes"}, {"input": "10", "outp... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is a pirate looking for the greatest treasure the world has ever seen. The treasure is located at the point $T$, which coordinates to be found out.\n\nBob travelled around the world and collected clues of the treasure... | [{"type": "stdin_stdout", "input": "25\n2 2\n1 -2\n1 1\n0 1\n2 1\n-2 2\n-1 -2\n-1 2\n0 -2\n-1 1\n-2 -1\n-1 -1\n1 -1\n2 -1\n1 2\n-2 -2\n2 0\n-2 0\n-2 1\n2 -2\n-1 0\n1 0\n0 -1\n0 2\n0 0\n1 3\n-3 -1\n-2 0\n-3 1\n1 1\n0 0\n-2 2\n-1 -1\n1 -1\n-3 3\n0 3\n-2 1\n0 1\n-3 2\n-1 3\n-2 3\n-2 -1\n1 2\n1 0\n-3 0\n0 -1\n-1 2\n-1 1\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Bob decided to lay a parquet floor in his living room. The living room is of size n × m metres. Bob had planks of three types: a planks 1 × 2 meters, b planks 2 × 1 meters, and c planks 2 × 2 meters. Help Bob find ou... | [{"type": "stdin_stdout", "input": "100 100 10000 10000 10000\n", "output": "aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabb\naabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabb\nbbaabbaabbaabbaabbaabbaabbaabbaabbaabba... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA dial lock is a kind of lock which has some dials with printed numbers. It has a special sequence of numbers, namely an unlocking sequence, to be opened.\n\nYou are working at a manufacturer of dial locks. Your job is to... | [{"type": "stdin_stdout", "input": "4\n1433 4680\n6\n777777 003330\n0", "output": "4\n2\n"}, {"type": "stdin_stdout", "input": "4\n1357 4680\n6\n509138 003330\n0", "output": "1\n4\n"}, {"type": "stdin_stdout", "input": "4\n1357 4680\n6\n297443 003330\n0", "output": "1\n5\n"}, {"type": "stdin_stdout", "input": "4\n1357 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has been playing Plane of Tanks with his friends the whole year. Now it is time to divide the participants into several categories depending on their results. \n\nA player is given a non-negative integer number of p... | [{"type": "stdin_stdout", "input": "10\nj 10\ni 9\nh 8\ng 7\nf 6\ne 5\nd 4\nc 3\nb 2\na 1\n", "output": "10\na noob\nb noob\nc noob\nd noob\ne random\nf random\ng random\nh average\ni hardcore\nj pro\n"}, {"type": "stdin_stdout", "input": "10\na 1\nb 2\nc 3\nd 4\ne 5\nf 6\ng 7\nh 8\ni 9\nj 10\n", "output": "10\na noob\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangular grid of size $n \\times m$. Each cell of the grid is colored black ('0') or white ('1'). The color of the cell $(i, j)$ is $c_{i, j}$. You are also given a map of directions: for each cell, there is... | [{"type": "stdin_stdout", "input": "3\n1 2\n01\nRL\n3 3\n001\n101\n110\nRLL\nDLD\nULL\n3 3\n000\n000\n000\nRRD\nRLD\nULL\n", "output": "2 1\n4 3\n2 2\n"}, {"type": "stdin_stdout", "input": "3\n1 2\n01\nRL\n3 3\n000\n101\n110\nRLL\nDLD\nULL\n3 3\n000\n000\n000\nRRD\nRLD\nULL\n", "output": "2 1\n4 3\n2 2\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeveral drivers had lined up for the Drag Racing Competition at the Tokyo Drift Street. Dom had organized the competition, but he was not available during all the races and hence he did not know their results. In the drag... | [{"type": "stdin_stdout", "input": "12\nylwdycynzm qikgzjftsy\nuyjjakdllg oupsqupono\nrzydxwplrl rarepbgeqk\nhzunfitubv tmnfmyxhmb\njqomnyflox znowiqbzyq\nuxpwihqnjy hxsmfvssru\nglsafbvhvu xfszigeomu\niahkxbubof rzvfmulbxj\nsreepibkei wrhzprsrme\nuroagvltiy ahxrusrokr\nrpyfumbrxy wklfolgpzi\ndyejhfnwml rztiqhzhmx\nidzq... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor an integer ```k``` rearrange all the elements of the given array in such way, that:\n\nall elements that are less than ```k``` are placed before elements that are not less than ```k```;\nall elements that are less tha... | [{"input": "5\n[1, 3, 5, 7, 6, 4, 2]", "output": "[[1, 3, 4, 2, 5, 7, 6]]", "fn_name": "split_by_value"}, {"input": "1\n[3, 2, 8, 3, 2, 1]", "output": "[[3, 2, 8, 3, 2, 1]]", "fn_name": "split_by_value"}, {"input": "6\n[6, 4, 10, 10, 6]", "output": "[[4, 6, 10, 10, 6]]", "fn_name": "split_by_value"}, {"input": "10\n[9,... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDue to another of his misbehaved, \nthe primary school's teacher of the young Gauß, Herr J.G. Büttner, to keep the bored and unruly young schoolboy Karl Friedrich Gauss busy for a good long time, while he teaching arithm... | [{"input": "50000", "output": "[1250025000]", "fn_name": "f"}, {"input": "300", "output": "[45150]", "fn_name": "f"}, {"input": "303", "output": "[46056]", "fn_name": "f"}, {"input": "3.14", "output": "[null]", "fn_name": "f"}, {"input": "100", "output": "[5050]", "fn_name": "f"}, {"input": "\"n\"", "output": "[null]",... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe just discovered a new data structure in our research group: a suffix three!\n\nIt's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a s... | [{"type": "stdin_stdout", "input": "30\nmnidamnida\nopmnida\nadinm_masu\nus`m_masu\nuseddesu\nadinmmasu\nmnida_po\ndnmnida\nmasumnida\nusam_po\nmnidadesu\nuted_masu\nmnida_mnida\nadinm_mnida\nusammasu\nmasu_desu\nvsammnida\ngenki_desu\nmm_mnida\nadinmmnida\nop_mnida\nadinm_desu\nused_desu\nusam_desu\nadinmdesu\nsarangh... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPaladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the swamp is very difficult, so people tramped exactly n - 1 paths. Each o... | [{"type": "stdin_stdout", "input": "50 2 5\n9 14\n46 34\n40 35\n44 30\n32 16\n1 38\n48 2\n17 14\n50 25\n6 1\n45 19\n21 15\n22 11\n15 33\n8 28\n2 32\n10 22\n37 3\n43 39\n25 16\n9 19\n16 3\n28 32\n20 45\n24 32\n4 18\n49 39\n13 45\n26 4\n11 33\n14 37\n42 19\n31 45\n38 3\n34 8\n18 29\n35 34\n29 16\n7 46\n19 28\n27 33\n30 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the same letter written on the... | [{"type": "stdin_stdout", "input": "ABCDEFGHIJKLMNOPQRSGTUVWXYZ\n", "output": "YXWVUTGHIJKLM\nZABCDEFSRQPON\n"}, {"type": "stdin_stdout", "input": "UTEDBZRVWLOFUASHCYIPXGJMKNQ\n", "output": "PIYCHSAUTEDBZ\nXGJMKNQFOLWVR\n"}, {"type": "stdin_stdout", "input": "ZWMFLTCQIAJEVUPODMSGXKHRNYB\n", "output": "HKXGSMFLTCQIA\nRN... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nAndy and Bob are the only two delivery men of Pizza-chef store. Today, the store received N orders. \nIt's known that the amount of tips may be different when... | [{"type": "stdin_stdout", "input": "5 3 3\n2 1 1 16 4\n11 4 1 -1 1", "output": "36\n"}, {"type": "stdin_stdout", "input": "5 3 3\n1 1 1 8 15\n18 1 0 -1 1", "output": "43\n"}, {"type": "stdin_stdout", "input": "5 3 4\n0 2 3 2 34\n-1 2 6 0 3", "output": "44\n"}, {"type": "stdin_stdout", "input": "5 2 11\n3 0 -1 1 0\n3 4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three numbers. Is there a way to replace variables A, B and C with these numbers so the equality A + B = C is correct?\n\nInput:\n\nThere are three numbers X1, X2 and X3 (1 ≤ Xi ≤ 10^100), each on a separate... | [{"type": "stdin_stdout", "input": "200000000000000000000000000000000000000000000000000000000000000000000000000000\n100000000000000000000000000000000000000000000000000000000000000000000000000000\n300000000000000000000000000000000000000000000000000000000000000000000000000000", "output": "YES"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nC: Mod! Mod!\n\nstory\n\nThat's right! I'm looking for eyewitness testimony! A phantom thief has appeared in Aizu! Everyone's horse stick was stolen! Who is the culprit! ?? Unravel! Mod! Mod!\n\nProblem statement\n\n\"Eye... | [{"type": "stdin_stdout", "input": "6\n1 25 1 10 1 3", "output": "4\n"}, {"type": "stdin_stdout", "input": "6\n0 15 1 10 2 3", "output": "6\n"}, {"type": "stdin_stdout", "input": "6\n0 15 0 10 2 3", "output": "6\n"}, {"type": "stdin_stdout", "input": "6\n0 15 0 10 2 4", "output": "6\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTeacher thinks that we make a lot of progress. Now we are even allowed to use decimal notation instead of counting sticks. After the test the teacher promised to show us a \"very beautiful number\". But the problem is, he... | [{"type": "stdin_stdout", "input": "40020 4\n", "output": "102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that inputs the vertex information of two polygons inscribed in one circle and outputs the magnitude relationship of their areas.\n\nAssume that each vertex of the X-side is numbered counterclockwise from... | [{"type": "stdin_stdout", "input": "4\n30\n125\n75\n4\n30\n125\n75\n5\n30\n125\n149\n65\n4\n30\n125\n75\n4\n30\n125\n75\n6\n52\n50\n50\n25\n75\n0", "output": "0\n2\n2\n"}, {"type": "stdin_stdout", "input": "4\n30\n125\n75\n4\n30\n125\n75\n5\n30\n125\n149\n65\n4\n30\n125\n75\n4\n30\n125\n75\n6\n52\n79\n50\n25\n75\n0", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFinish the solution so that it sorts the passed in array of numbers. If the function passes in an empty array or null/nil value then it should return an empty array.\n\nFor example:\n\n```python\nsolution([1,2,3,10,5]) # ... | [{"input": "[1, 2, 3, 10, 5]", "output": "[[1, 2, 3, 5, 10]]", "fn_name": "solution"}, {"input": "[20, 2, 10]", "output": "[[2, 10, 20]]", "fn_name": "solution"}, {"input": "[2, 20, 10]", "output": "[[2, 10, 20]]", "fn_name": "solution"}, {"input": "null", "output": "[[]]", "fn_name": "solution"}, {"input": "[]", "outp... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Introduction:\n\nReversi is a game usually played by 2 people on a 8x8 board.\nHere we're only going to consider a single 8x1 row.\n\nPlayers take turns placing pieces, which are black on one side and white on the\nothe... | [{"input": "[0, 1, 2, 3, 4, 5, 6, 7]", "output": "[\"*******O\"]", "fn_name": "reversi_row"}, {"input": "[1, 0, 2, 3, 4, 5, 6, 7]", "output": "[\"OOOOOOOO\"]", "fn_name": "reversi_row"}, {"input": "[3, 4, 5, 6, 0, 2]", "output": "[\"*.OOOOO.\"]", "fn_name": "reversi_row"}, {"input": "[1, 7, 0, 5, 6, 4]", "output": "[\"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n A media access control address (MAC address) is a unique identifier assigned to network interfaces for communications on the physical network segment.\n\n The standard (IEEE 802) format for printing MAC-48 addres... | [{"input": "\"not a MAC-48 address\"", "output": "[false]", "fn_name": "is_mac_48_address"}, {"input": "\"02-03-04-05-06-07-\"", "output": "[false]", "fn_name": "is_mac_48_address"}, {"input": "\"Z1-1B-63-84-45-E6\"", "output": "[false]", "fn_name": "is_mac_48_address"}, {"input": "\"G0-00-00-00-00-00\"", "output": "[f... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game.\n\nInitially, Bob chooses integer m, bit depth of the game, which means that all num... | [{"type": "stdin_stdout", "input": "17 15\na := 010000111111110\nb := 101100110000100\nc := 100101100100111\nd := 010110101110110\ne := 111111000010110\nf := 011001110111110\ng := 110011010100101\nh := 000001010010001\ni := 110000111001011\nj := 000010000010111\nk := 110110111110110\nl := 010000110000100\nm := 00011110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's say Pak Chanek has an array $A$ consisting of $N$ positive integers. Pak Chanek will do a number of operations. In each operation, Pak Chanek will do the following:\n\nChoose an index $p$ ($1 \\leq p \\leq N$).\n\nL... | [{"type": "stdin_stdout", "input": "8 8\n1\n2\n3\n4\n5\n6\n7\n8\n", "output": "27\n1\n2\n3\n3\n4\n4\n5\n5\n"}, {"type": "stdin_stdout", "input": "7 7\n1\n2\n3\n4\n5\n6\n7\n", "output": "22\n1\n2\n3\n3\n4\n4\n5\n"}, {"type": "stdin_stdout", "input": "6 6\n1\n2\n3\n4\n5\n6\n", "output": "17\n1\n2\n3\n3\n4\n4\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStepan has the newest electronic device with a display. Different digits can be shown on it. Each digit is shown on a seven-section indicator like it is shown on the picture below. [Image] \n\nSo, for example, to show the... | [{"type": "stdin_stdout", "input": "196542\n", "output": "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer found two positive integers, a and b.\nDetermine whether the product of a and b is even or odd.\n\n-----Constraints-----\n - 1 ≤ a,b ≤ 10000\n - a and b are integers.\n\n-----Input-----\nInput is given f... | [{"type": "stdin_stdout", "input": "-1 -2", "output": "Even\n"}, {"type": "stdin_stdout", "input": "-2 -2", "output": "Even\n"}, {"type": "stdin_stdout", "input": "-2 -1", "output": "Even\n"}, {"type": "stdin_stdout", "input": "-4 -1", "output": "Even\n"}, {"type": "stdin_stdout", "input": "-6 -1", "output": "Even\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe \"Western calendar\" is a concept imported from the West, but in Japan there is a concept called the Japanese calendar, which identifies the \"era name\" by adding a year as a method of expressing the year on the cale... | [{"type": "stdin_stdout", "input": "1 1914", "output": "3781\n"}, {"type": "stdin_stdout", "input": "2 1914", "output": "3825\n"}, {"type": "stdin_stdout", "input": "1 125", "output": "1992\n"}, {"type": "stdin_stdout", "input": "2 125", "output": "2036\n"}, {"type": "stdin_stdout", "input": "2 141", "output": "2052\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Valery have come across an entirely new programming language. Most of all the language attracted him with template functions and procedures. Let us remind you that templates are tools of a language, designed to ... | [{"type": "stdin_stdout", "input": "5\n void 8os6s2b ( T )\n void 8os6s2b ( int, int, int,int, int ) \n void 8os6s2b ( int, int, T) \n void fow8dmm ( T,T, int, int ) \n void fow8dmm ( int) \n2\n int 2 \n double 9c9t0 \n7\n 8os6s2b ( 9c9t0 ) \n 8os6s2b (9c9t0,9c9t0,9c9t0 ) \n8os6s2b ( 9c9t0,... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells ... | [{"type": "stdin_stdout", "input": "100 10 30\n40 4\n15 3\n75 3\n88 10\n32 1\n16 5\n81 8\n45 2\n72 8\n11 6\n86 4\n50 2\n9 4\n11 1\n20 3\n47 3\n2 4\n68 3\n90 5\n85 2\n88 1\n88 5\n86 3\n70 9\n49 3\n34 4\n5 7\n77 5\n50 1\n87 5\n", "output": "402737011\n"}, {"type": "stdin_stdout", "input": "100000 100000 4\n50001 50001\n5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNot considering number 1, the integer 153 is the first integer having this property:\nthe sum of the third-power of each of its digits is equal to 153. Take a look:\n153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153\n\nThe next... | [{"input": "1000\n3", "output": "[[153, 370, 371, 407]]", "fn_name": "eq_sum_powdig"}, {"input": "1500\n3", "output": "[[153, 370, 371, 407]]", "fn_name": "eq_sum_powdig"}, {"input": "500\n3", "output": "[[153, 370, 371, 407]]", "fn_name": "eq_sum_powdig"}, {"input": "400\n3", "output": "[[153, 370, 371]]", "fn_name": ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path.\n\nYou are given l and r. For all integers from l to r, inclusive, we wrote down all of the... | [{"type": "stdin_stdout", "input": "519002744 519002744\n", "output": "519002744\n"}, {"type": "stdin_stdout", "input": "331900277 331900277\n", "output": "331900277\n"}, {"type": "stdin_stdout", "input": "349533413 349533413\n", "output": "349533413\n"}, {"type": "stdin_stdout", "input": "568814539 568814539\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nChef had a hard day and want to play little bit. The game is called \"Chain\". Chef has the sequence of symbols. Each symbol is either '-' or '+'. The sequenc... | [{"type": "stdin_stdout", "input": "2\n+++-+-+---\n-------", "output": "2\n3\n"}, {"type": "stdin_stdout", "input": "2\n-+--+++--+\n-------", "output": "4\n3\n"}, {"type": "stdin_stdout", "input": "2\n-+-+-+-+-+\n-------", "output": "0\n3\n"}, {"type": "stdin_stdout", "input": "2\n--++---+++\n-----+-", "output": "4\n2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe chef has a recipe he wishes to use for his guests,\nbut the recipe will make far more food than he can serve to the guests.\nThe chef therefore would like to make a reduced version of the recipe which has the same rat... | [{"type": "stdin_stdout", "input": "3\n2 4 11\n3 2 2 7\n4 3 36 13 11", "output": "4 11\n2 2 7\n3 36 13 11\n"}, {"type": "stdin_stdout", "input": "3\n2 4 10\n3 2 2 7\n4 3 36 13 11", "output": "2 5\n2 2 7\n3 36 13 11\n"}, {"type": "stdin_stdout", "input": "3\n2 2 10\n3 2 2 7\n4 3 36 13 11", "output": "1 5\n2 2 7\n3 36 13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of N integer numbers A. Calculate the sum of A_{i} AND A_{j} for all the pairs (i, j) where i < j. \nThe AND operation is the Bitwise AND operation, defined as in here. \n\n------ Input ------ \n\... | [{"type": "stdin_stdout", "input": "5\n2 14 11 2 0", "output": "20\n"}, {"type": "stdin_stdout", "input": "5\n13 2 12 4 2", "output": "22\n"}, {"type": "stdin_stdout", "input": "5\n11 1 29 8 2", "output": "29\n"}, {"type": "stdin_stdout", "input": "5\n4 2 5 15 12", "output": "35\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is that you should complete all the projects in easy version but this is not necessary in hard version.\n\nPolycarp is a very famous freelancer. His current rating is $r$... | [{"type": "stdin_stdout", "input": "50 15000\n142 -300\n20 -298\n560 -300\n1815 -292\n282 -297\n92 -293\n34 -284\n555 -299\n408 -293\n504 -284\n278 -284\n139 -291\n64 -298\n311 -293\n130 -293\n89 -298\n129 -294\n385 -295\n136 -288\n41 -293\n112 -290\n416 -295\n178 -294\n154 -300\n110 -300\n346 -299\n209 -294\n1394 -295... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≤ li ≤ ri ≤ n) meaning that value <image>... | [{"type": "stdin_stdout", "input": "6 2\n1 2 536870912\n2 3 864795845\n", "output": "YES\n536870912 864795845 864795845 0 0 0\n"}, {"type": "stdin_stdout", "input": "6 2\n1 1 536870912\n2 3 864795845\n", "output": "YES\n536870912 864795845 864795845 0 0 0\n"}, {"type": "stdin_stdout", "input": "3 2\n1 2 536870912\n2 3 ... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.