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\nA popular game in a certain country, Pachimon Creature, has been remade and released in Japan. If you love games, after playing this game many times, you've come to think about how you can clear it the fastest. However, n... | [{"type": "stdin_stdout", "input": "6 6\nS.1..4\n5..3..\n..4.1.\n4....5\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0", "output": "3 12\nNA\n"}, {"type": "stdin_stdout", "input": "6 6\nS.1..4\n3..5..\n..4.1.\n4...5.\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0", "output": "2 10\nNA\n"}, {"type": "stdin_stdout", "input": "6 6\nS.1..4\n4..... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIgor is a post-graduate student of chemistry faculty in Berland State University (BerSU). He needs to conduct a complicated experiment to write his thesis, but laboratory of BerSU doesn't contain all the materials require... | [{"type": "stdin_stdout", "input": "11\n1 1 1 1 1 1 1 1 1 1 1\n1 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001 1000000001\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.\n\nThe world can be modeled as an undirected graph with n nodes and m edges. k of t... | [{"type": "stdin_stdout", "input": "24 38 2\n4 13\n7 1\n24 1\n2 8\n17 2\n2 18\n22 2\n23 3\n5 9\n21 5\n6 7\n6 19\n6 20\n11 7\n7 20\n13 8\n16 8\n9 10\n14 9\n21 9\n12 10\n10 22\n23 10\n17 11\n11 24\n20 12\n13 16\n13 23\n15 14\n17 14\n14 20\n19 16\n17 20\n17 23\n18 22\n18 23\n22 19\n21 20\n23 24\n", "output": "215\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou already know that Valery's favorite sport is biathlon. Due to your help, he learned to shoot without missing, and his skills are unmatched at the shooting range. But now a smaller task is to be performed, he should le... | [{"type": "stdin_stdout", "input": "20 20 2\nbaaaaaaaaaaaaaaaaaaa\nbfffffffacfffffffffa\nbgggggggaccgggggggga\nbhhhhhhhaccchhhhhhha\nbiiiiiiiacccciiiiiia\nbjjjjjjjacccccjjjjja\nbkkkkkkkacccccckkkka\nblllllllacccccccllla\nbbbbbbbbSccccccccmma\nbddddddddddcccccccna\nbodddddddcccccccccca\nbppddddddddTaaaaaaaa\nbqqqddddddd... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is taking exams on N subjects. The score on each subject will be an integer between 0 and K (inclusive).\nHe has already taken exams on N-1 subjects and scored A_i points on the i-th subject.\nHis goal is to ach... | [{"type": "stdin_stdout", "input": "100 100 100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nIf you bring an empty bottle of $ a $ milk, you can exchange it for a new bottle of $ b $ milk.\nHow many bottles of milk can Mr. Kawabayashi, who initially has a bottle of $ x $ milk, drink? Output the remaind... | [{"type": "stdin_stdout", "input": "560118409912468 316250877917599 1316995007040099", "output": "500636509\n"}, {"type": "stdin_stdout", "input": "316250877917604 316250877917599 672514164456590", "output": "265329493\n"}, {"type": "stdin_stdout", "input": "560118409912468 316250877917599 681260158257385", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space, so they play it with a computer.\n\nIn this game there are n objects number... | [{"type": "stdin_stdout", "input": "7000\n7 419 1631 1925 3861 6940 379 493\n29 5389 5925 2923 4696 972 6125 3779 6044 5477 1305 6488 5059 5515 3238 3863 248 6947 4023 6168 1915 6607 2991 2220 2023 200 4457 6398 1017 447\n", "output": "Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop Loop... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves playing with arrays. He has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai. \n\nAdditionally the Little Elephant has m queries to the ... | [{"type": "stdin_stdout", "input": "6 6\n2 1 2 3 3 10\n1 2\n2 2\n1 3\n2 4\n3 6\n2 2\n", "output": "1\n1\n2\n1\n0\n1\n"}, {"type": "stdin_stdout", "input": "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 6\n", "output": "1\n0\n2\n1\n1\n3\n"}, {"type": "stdin_stdout", "input": "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n4 4\n4 6\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour job is to write function last_digits(n,d) which return the last `d` digits of an integer `n` as a list.\n`n` will be from 0 to 10^10\n\nExamples:\n\n`last_digits(1,1) --> [1]`\n\n`last_digits(1234,2) --> [3,4]`... | [{"input": "34625647867585\n10", "output": "[[5, 6, 4, 7, 8, 6, 7, 5, 8, 5]]", "fn_name": "solution"}, {"input": "123767\n4", "output": "[[3, 7, 6, 7]]", "fn_name": "solution"}, {"input": "1343\n5", "output": "[[1, 3, 4, 3]]", "fn_name": "solution"}, {"input": "24134\n-4", "output": "[[]]", "fn_name": "solution"}, {"in... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArtist Shinagawa was asked to exhibit n works. Therefore, I decided to exhibit the six sides of the cube colored with paint as a work. The work uses all six colors, Red, Yellow, Blue, Magenta, Green, and Cyan, and each si... | [{"type": "stdin_stdout", "input": "3\nCyan Yellow Red Magenta Green Blue\nCyan Yellow Red Magenta Green Blue\nRed Yellow Magenta Blue Green Cyan\n4\nRed Mahenta Blue Green Yellow Cyan\nRed Yellow Magenta Blue Green Cyan\nMagenta Green Red Cyan Yellow Blue\nCyan Green Yellow Blue Magenta Red\n0", "output": "1\n1\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. \n\nThe manager of logging factory wants them to go to the jungle and cut n trees with heigh... | [{"type": "stdin_stdout", "input": "6\n1 2 3 10 20 30\n6 5 4 3 2 0\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "6\n2 2 3 10 20 30\n6 5 4 3 2 0\n", "output": "138\n"}, {"type": "stdin_stdout", "input": "6\n1 2 3 10 20 25\n6 5 4 3 2 0\n", "output": "118\n"}, {"type": "stdin_stdout", "input": "6\n1 1 2 10 20... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n#Unflatten a list (Easy)\n\nThere are several katas like \"Flatten a list\".\nThese katas are done by so many warriors, that the count of available list to flattin goes down!\n\nSo you have to build a method, that creates... | [{"input": "[1, 4, 5, 2, 1, 2, 4, 5, 2, 6, 2, 3, 3]", "output": "[[1, [4, 5, 2, 1], 2, [4, 5, 2, 6], 2, [3, 3]]]", "fn_name": "unflatten"}, {"input": "[3, 1, 1, 3, 1, 1]", "output": "[[[3, 1, 1], [3, 1, 1]]]", "fn_name": "unflatten"}, {"input": "[99, 1, 1, 1]", "output": "[[[99, 1, 1, 1]]]", "fn_name": "unflatten"}, {"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an equation: \n\nAx2 + Bx + C = 0. \n\nYour task is to find the number of distinct roots of the equation and print all of them in ascending order.\n\nInput\n\nThe first line contains three integer numbers A,... | [{"type": "stdin_stdout", "input": "-50000 110001 -1028\n", "output": "2\n0.009385408263686695\n2.1906345917363135\n"}, {"type": "stdin_stdout", "input": "50000 110001 10338\n", "output": "2\n-2.1016396721343673\n-0.09838032786563272\n"}, {"type": "stdin_stdout", "input": "-50000 100001 -50000\n", "output": "2\n0.99553... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImplement a class/function, which should parse time expressed as `HH:MM:SS`, or `null/nil/None` otherwise.\n\nAny extra characters, or minutes/seconds higher than 59 make the input invalid, and so should return `null/nil/... | [{"input": "\"99:59:59\"", "output": "[359999]", "fn_name": "to_seconds"}, {"input": "\"00:00:00\\n\"", "output": "[null]", "fn_name": "to_seconds"}, {"input": "\"\\n00:00:00\"", "output": "[null]", "fn_name": "to_seconds"}, {"input": "\"100:59:59\"", "output": "[null]", "fn_name": "to_seconds"}, {"input": "\"09:059:59... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeople in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (= 172), i.e., 1-credit coins, 4-credit coins, 9-credit c... | [{"type": "stdin_stdout", "input": "2\n19\n51\n0", "output": "1\n10\n107\n"}, {"type": "stdin_stdout", "input": "2\n19\n92\n0", "output": "1\n10\n804\n"}, {"type": "stdin_stdout", "input": "2\n173\n0\n-6", "output": "1\n13027\n"}, {"type": "stdin_stdout", "input": "2\n10\n51\n0", "output": "1\n4\n107\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGame \"Minesweeper 1D\" is played on a line of squares, the line's height is 1 square, the line's width is n squares. Some of the squares contain bombs. If a square doesn't contain a bomb, then it contains a number from 0... | [{"type": "stdin_stdout", "input": "?2*?2*??1*2**?2*1???*2???100?????*???*?*????0????2?*?*?1??1??*?01**2**1001??**??**??1*?*???00??**??*\n", "output": "147483634\n"}, {"type": "stdin_stdout", "input": "?2*?2*??1*2**?2*1???*2???100?????*???*?*????0????2?*?*?1??1??*?01**2**1001??**??**??1*?*???00??**??*\n", "output": "14... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTrouble came from the overseas lands: a three-headed dragon Gorynych arrived. The dragon settled at point C and began to terrorize the residents of the surrounding villages.\n\nA brave hero decided to put an end to the dr... | [{"type": "stdin_stdout", "input": "-1000000000 1000000000\n-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "LEFT\n"}, {"type": "stdin_stdout", "input": "-1000000000 1000001000\n-1000000000 -1000000000\n1000000000 -1000000000\n", "output": "LEFT\n"}, {"type": "stdin_stdout", "input": "-1000000000 10000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is working on a new project called \"Polychat\". Following modern tendencies in IT, he decided, that this project should contain chat as well. To achieve this goal, Polycarp has spent several hours in front of hi... | [{"type": "stdin_stdout", "input": "+qlHEc2AuYy\nqlHE02AuYy:YYRwDc edNZgpE nGfOguRWnMYpTpGUVM aXDKGWo1GL1tHv9\n0Upwze6PcQNBcUovrqmIcPsG3hvy:yYuA2cEHlq oaNiKV49p[KatlVAx\nqlHEc2AuYy:zuCO6Opey L eu7lTwysaSk00zjpv zrDfbt8l ufHph\n+pErDMxgVgh\nsiLF1I:yYu@1cEHlq mmQbZtd8Ui7y 2vcax6yZBMhVdRD6Ahlq7MNCw\nqlHEc2AuYy:lz MFUNJ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n#It's show time!\nArchers have gathered from all around the world to participate in the Arrow Function Faire. But the faire will only start if there are archers signed and if they all have enough arrows in their quivers -... | [{"input": "[1, 2, 3, 4, 5, 6, 7, 8]", "output": "[false]", "fn_name": "archers_ready"}, {"input": "[1, 2, 3, 4]", "output": "[false]", "fn_name": "archers_ready"}, {"input": "[5, 6, 7, 4]", "output": "[false]", "fn_name": "archers_ready"}, {"input": "[5, 6, 7, 8]", "output": "[true]", "fn_name": "archers_ready"}, {"in... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFollowing from the previous kata and taking into account how cool psionic powers are compare to the Vance spell system (really, the idea of slots to dumb down the game sucks, not to mention that D&D became a smash hit amo... | [{"input": "21\n30", "output": "[448]", "fn_name": "psion_power_points"}, {"input": "1\n10", "output": "[0]", "fn_name": "psion_power_points"}, {"input": "1\n11", "output": "[2]", "fn_name": "psion_power_points"}, {"input": "0\n11", "output": "[0]", "fn_name": "psion_power_points"}, {"input": "1\n20", "output": "[4]", ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus analyzes a string called abracadabra. This string is constructed using the following algorithm: \n\n * On the first step the string consists of a single character \"a\". \n * On the k-th step Polycarpus conca... | [{"type": "stdin_stdout", "input": "156642200 503020953 296806626 871864091\n", "output": "234585497\n"}, {"type": "stdin_stdout", "input": "462616550 929253987 199885647 365920450\n", "output": "166034804\n"}, {"type": "stdin_stdout", "input": "166724572 472113234 358126054 528083792\n", "output": "125430608\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor the multiset of positive integers $s=\\{s_1,s_2,\\dots,s_k\\}$, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of $s$ as follow: $\\gcd(s)$ is the maximum positive integer $x$, such that all ... | [{"type": "stdin_stdout", "input": "10\n972 972 324 972 324 648 1944 243 324 474\n", "output": "162\n"}, {"type": "stdin_stdout", "input": "10\n972 972 324 972 324 648 1944 243 324 474\n", "output": "162\n"}, {"type": "stdin_stdout", "input": "10\n540 648 1116 648 720 540 594 864 972 648\n", "output": "36\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sequence of positive integers is called great for a positive integer $x$, if we can split it into pairs in such a way that in each pair the first number multiplied by $x$ is equal to the second number. More formally, a ... | [{"type": "stdin_stdout", "input": "1\n11 100000\n310065408 310065408 310065408 310065408 89000 89000 89000 89000 10000000 5 69\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "4\n4 4\n1 16 4 4\n6 2\n1 2 2 2 4 7\n5 3\n5 2 3 5 15\n9 10\n10 10 10 20 1 100 200 2000 3\n", "output": "0\n2\n3\n3\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $n$ and $k$.\n\nYou should create an array of $n$ positive integers $a_1, a_2, \\dots, a_n$ such that the sum $(a_1 + a_2 + \\dots + a_n)$ is divisible by $k$ and maximum element in $a$ is minim... | [{"type": "stdin_stdout", "input": "25\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n3 1000000000\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.\n\nYou are given a set of strings. A string (not necessarily from thi... | [{"type": "stdin_stdout", "input": "76\namnctposz\nmnctpos\nos\nu\ne\nam\namnc\neamnctpo\nl\nx\nq\nposzq\neamnc\nctposzq\nctpos\nmnc\ntpos\namnctposzql\ntposzq\nmnctposz\nnctpos\nctposzql\namnctpos\nmnct\np\nux\nposzql\ntpo\nmnctposzql\nmnctp\neamnctpos\namnct\ntposzql\nposz\nz\nct\namnctpo\noszq\neamnct\ntposz\ns\nmn\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova had a pretty weird sleeping schedule. There are $h$ hours in a day. Vova will sleep exactly $n$ times. The $i$-th time he will sleep exactly after $a_i$ hours from the time he woke up. You can assume that Vova woke u... | [{"type": "stdin_stdout", "input": "65 654 560 571\n83 511 615 263 171 146 241 511 582 216 352 632 506 538 536 217 627 213 324 579 172 241 363 584 450 144 447 536 241 523 162 21 437 291 191 111 567 502 170 570 231 493 169 360 107 114 322 160 574 611 460 558 616 361 284 58 41 345 450 560 543 520 105 416 38\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's dive into one of the most interesting areas of magic — writing spells. Learning this exciting but challenging science is very troublesome, so now you will not learn the magic words, but only get to know the basic ru... | [{"type": "stdin_stdout", "input": "# a \n # a \n\n # a \n\n\n # a \n \n # a \n \n\n # a \n\n \n # a\n \n \n # a \n\n\n \n\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nComplete the solution so that it takes the object (JavaScript/CoffeeScript) or hash (ruby) passed in and generates a human readable string from its key/value pairs. \n\nThe format should be \"KEY = VALUE\". Each key/value... | [{"input": "{\"b\": 1, \"c\": 2, \"e\": 3}", "output": "[\"b = 1,c = 2,e = 3\"]", "fn_name": "solution"}, {"input": "{\"a\": \"b\", \"b\": \"a\"}", "output": "[\"a = b,b = a\"]", "fn_name": "solution"}, {"input": "{\"0\": \"a\", \"b\": 2}", "output": "[\"0 = a,b = 2\"]", "fn_name": "solution"}, {"input": "{\"a\": 1, \"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor every string, after every occurrence of `'and'` and `'but'`, insert the substring `'apparently'` directly after the occurrence.\n\nIf input does not contain 'and' or 'but', return the original string. If a blank strin... | [{"input": "\"A fast-food resteraunt down the street was grumbling my tummy but I could not go.\"", "output": "[\"A fast-food resteraunt down the street was grumbling my tummy but apparently I could not go.\"]", "fn_name": "apparently"}, {"input": "\"but the bread and butter apparently brand apparently\"", "output": "[... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCurry making\n\nAs the ACM-ICPC domestic qualifying is approaching, you who wanted to put more effort into practice decided to participate in a competitive programming camp held at a friend's house. Participants decided t... | [{"type": "stdin_stdout", "input": "10 5 3 4\n1 6 2 3\n150 13 7 62\n10 1 3 5\n20 100 3 20\n2 14 13 1\n0 0 0 0", "output": "2\n4\n0\n0\n14\n180\n"}, {"type": "stdin_stdout", "input": "10 5 3 4\n1 5 2 3\n150 13 12 62\n10 1 11 5\n20 100 3 20\n3 14 3 1\n0 0 0 0", "output": "2\n3\n1\n1\n14\n39\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA remote island chain contains n islands, labeled 1 through n. Bidirectional bridges connect the islands to form a simple cycle — a bridge connects islands 1 and 2, islands 2 and 3, and so on, and additionally a bridge co... | [{"type": "stdin_stdout", "input": "10\n2 4 8 3 6 1 15 0 5 14\n3 6 1 10 0 5 7 2 14 4\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10\n2 4 8 3 6 1 15 0 5 7\n3 6 1 10 0 5 7 2 14 4\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10\n2 4 8 3 6 1 15 0 5 7\n3 6 1 10 0 5 7 2 22 4\n", "output": "NO\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.\n\nWe will call point a bad if there are different points b and c, not equal to a, from the given set such ... | [{"type": "stdin_stdout", "input": "11\n358 -724 -232 53 -520\n486 -554 -328 53 -220\n358 -554 -232 -372 -520\n358 -554 -232 308 -520\n868 -554 448 53 -520\n478 -554 -322 53 -600\n358 296 -232 53 -520\n256 -554 -368 53 -520\n230 -554 -136 53 -820\n-182 -554 173 53 -160\n358 -554 -232 53 -520\n", "output": "1\n11\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n Dudka has `n` details. He must keep exactly 3 of them.\n\n To do this, he performs the following operations until he has only 3 details left:\n```\nHe numbers them.\nHe keeps those with either odd or even numbers... | [{"input": "10", "output": "[2]", "fn_name": "three_details"}, {"input": "15", "output": "[1]", "fn_name": "three_details"}, {"input": "3", "output": "[1]", "fn_name": "three_details"}, {"input": "6", "output": "[2]", "fn_name": "three_details"}, {"input": "4", "output": "[0]", "fn_name": "three_details"}] | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNick is interested in prime numbers. Once he read about Goldbach problem. It states that every even integer greater than 2 can be expressed as the sum of two primes. That got Nick's attention and he decided to invent a pr... | [{"type": "stdin_stdout", "input": "1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 1100\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 44\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "428 23\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "332 20\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define the sum of two permutations p and q of numbers 0, 1, ..., (n - 1) as permutation <image>, where Perm(x) is the x-th lexicographically permutation of numbers 0, 1, ..., (n - 1) (counting from zero), and Ord(p)... | [{"type": "stdin_stdout", "input": "84\n83 4 68 34 24 2 48 38 22 51 5 62 31 67 66 53 49 70 9 71 46 41 30 8 50 17 28 79 15 80 32 43 14 74 29 42 81 60 56 65 23 0 77 76 58 78 1 11 37 27 75 35 18 73 54 20 57 33 36 6 61 69 64 55 39 10 3 45 13 26 59 82 21 25 63 52 16 44 47 72 19 12 7 40\n63 41 80 52 36 45 17 69 22 66 37 21 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya came up with his own weather forecasting method. He knows the information about the average air temperature for each of the last n days. Assume that the average air temperature for each day is integral.\n\nVasya bel... | [{"type": "stdin_stdout", "input": "100\n-85 -80 -76 -72 -68 -64 -60 -56 -52 -48 -44 -40 -36 -32 -28 -24 -20 -16 -12 -8 -4 0 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120 124 128 132 136 140 144 148 152 156 160 164 168 172 176 180 184 188 192 196 200 204 208 212 216 220 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle X and Little Z are good friends. They always chat online. But both of them have schedules.\n\nLittle Z has fixed schedule. He always online at any moment of time between a_1 and b_1, between a_2 and b_2, ..., betwe... | [{"type": "stdin_stdout", "input": "13 42 292 733\n304 308\n362 365\n396 397\n686 688\n719 722\n815 816\n901 902\n904 905\n921 924\n929 933\n953 954\n977 980\n982 985\n28 30\n36 37\n108 112\n123 127\n134 135\n151 153\n160 162\n203 205\n208 212\n240 243\n261 264\n271 274\n294 297\n356 358\n383 385\n408 412\n415 418\n435... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three strings $s$, $t$ and $p$ consisting of lowercase Latin letters. You may perform any number (possibly, zero) operations on these strings.\n\nDuring each operation you choose any character from $p$, eras... | [{"type": "stdin_stdout", "input": "1\naaaaaabbbbbbbbcccccccccccdddd\naaaaabbbbbbccccccccddddddddd\naaaaabbbbbbbbbcccccccccddddd\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\naaaaaabbbbbbbbcccccccccccdddd\naaaaabbbbbbccccccccddddddddd\naaaaabbbbbbbbbcccccccccddddd\n", "output": "No\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice got a new doll these days. It can even walk!\n\nAlice has built a maze for the doll and wants to test it. The maze is a grid with n rows and m columns. There are k obstacles, the i-th of them is on the cell (x_i, y_... | [{"type": "stdin_stdout", "input": "10 10 70\n10 4\n5 5\n6 10\n8 9\n3 8\n10 9\n10 10\n8 2\n2 10\n7 2\n7 3\n10 2\n8 3\n9 8\n2 9\n3 1\n6 5\n6 9\n2 8\n10 7\n8 4\n8 6\n7 6\n5 6\n9 10\n3 9\n5 8\n4 8\n3 10\n10 5\n5 2\n5 4\n8 8\n3 2\n3 6\n2 3\n1 9\n6 6\n2 4\n6 2\n5 3\n6 4\n7 9\n2 2\n5 9\n7 10\n7 8\n3 3\n2 6\n7 5\n8 10\n3 4\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova plans to go to the conference by train. Initially, the train is at the point $1$ and the destination point of the path is the point $L$. The speed of the train is $1$ length unit per minute (i.e. at the first minute ... | [{"type": "stdin_stdout", "input": "10\n10 1 1 1\n10 1 1 2\n10 1 1 3\n10 1 1 4\n10 1 1 5\n10 1 1 6\n10 1 1 7\n10 1 1 8\n10 1 1 9\n10 1 1 10\n", "output": "9\n8\n7\n6\n5\n4\n3\n2\n1\n0\n"}, {"type": "stdin_stdout", "input": "10\n10 2 1 1\n10 2 1 2\n10 2 1 3\n10 2 1 4\n10 2 1 5\n10 2 1 6\n10 2 1 7\n10 2 1 8\n10 2 1 9\n10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub got lost in a very big desert. The desert can be represented as a n × n square matrix, where each cell is a zone of the desert. The cell (i, j) represents the cell at row i and column j (1 ≤ i, j ≤ n). Iahub can go ... | [{"type": "stdin_stdout", "input": "999999989 38\n999999980 999999981\n10 8\n2 5\n999999978 999999981\n999999978 999999985\n7 9\n8 10\n9 10\n999999984 999999980\n6 6\n999999985 999999986\n999999982 999999978\n999999981 999999987\n8 5\n999999982 999999980\n999999989 999999980\n999999988 999999983\n999999982 999999984\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program to determine if two numbers are coprime. A pair of numbers are coprime if their greatest shared factor is 1. For example:\n```\n20 and 27\nFactors of 20: 1, 2, 4, 5, 10, 20\nFactors of 27: 1, 3, 9, 27\nGre... | [{"input": "12\n39", "output": "[false]", "fn_name": "are_coprime"}, {"input": "17\n34", "output": "[false]", "fn_name": "are_coprime"}, {"input": "34\n17", "output": "[false]", "fn_name": "are_coprime"}, {"input": "35\n10", "output": "[false]", "fn_name": "are_coprime"}, {"input": "20\n27", "output": "[true]", "fn_nam... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n**This Kata is intended as a small challenge for my students**\n\nAll Star Code Challenge #19\n\nYou work for an ad agency and your boss, Bob, loves a catchy slogan. He's always jumbling together \"buzz\" words until he g... | [{"input": "[\"super\", \"guacamole\", \"super\", \"super\", \"hot\", \"guacamole\"]", "output": "[[\"super guacamole hot\", \"super hot guacamole\", \"guacamole super hot\", \"guacamole hot super\", \"hot super guacamole\", \"hot guacamole super\"]]", "fn_name": "slogan_maker"}, {"input": "[\"super\", \"hot\", \"guaca... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThree poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.\nWe will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b... | [{"type": "stdin_stdout", "input": "-1 -1 -1", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-2 -3 -4", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-1 -2 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 -3 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-2 -4 -1", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n Let's call `product(x)` the product of x's digits. Given an array of integers a, calculate `product(x)` for each x in a, and return the number of distinct results you get.\n\n# Example\n\n For `a = [2, 8, 121, 42... | [{"input": "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]", "output": "[10]", "fn_name": "unique_digit_products"}, {"input": "[100, 23, 42, 239, 22339, 9999999, 456, 78, 228, 1488]", "output": "[10]", "fn_name": "unique_digit_products"}, {"input": "[2, 8, 121, 42, 222, 23]", "output": "[3]", "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a lowercase string that has alphabetic characters only and no spaces, return the highest value of consonant substrings. Consonants are any letters of the alphabet except `\"aeiou\"`. \n\nWe shall assign the followin... | [{"input": "\"mischtschenkoana\"", "output": "[80]", "fn_name": "solve"}, {"input": "\"twelfthstreet\"", "output": "[103]", "fn_name": "solve"}, {"input": "\"chruschtschov\"", "output": "[80]", "fn_name": "solve"}, {"input": "\"catchphrase\"", "output": "[73]", "fn_name": "solve"}, {"input": "\"khrushchev\"", "output":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $x$ and $y$. You can perform two types of operations: Pay $a$ dollars and increase or decrease any of these integers by $1$. For example, if $x = 0$ and $y = 7$ there are four possible outcome... | [{"type": "stdin_stdout", "input": "3\n1 3\n391 555\n129 8437\n9 4\n321 654\n3 4\n", "output": "1337\n75288\n2283\n"}, {"type": "stdin_stdout", "input": "3\n1 3\n391 555\n129 8437\n9 4\n321 654\n3 4\n", "output": "1337\n75288\n2283\n"}, {"type": "stdin_stdout", "input": "3\n1 6\n391 555\n129 8437\n9 4\n321 654\n3 4\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya came up with a password to register for EatForces — a string s. The password in EatForces should be a string, consisting of lowercase and uppercase Latin letters and digits.\n\nBut since EatForces takes care of the ... | [{"type": "stdin_stdout", "input": "6\n11b\n4bh\nBeh\nTuY\n1YJ\nP28\n", "output": "A1b\n4Ah\nB1h\n1uY\n1aJ\nPa8\n"}, {"type": "stdin_stdout", "input": "6\n11b\n4bh\nBeh\nTvY\n1YJ\nP28\n", "output": "A1b\n4Ah\nB1h\n1vY\n1aJ\nPa8\n"}, {"type": "stdin_stdout", "input": "6\n11b\n4bh\nBeh\nvTY\n1YJ\nP28\n", "output": "A1b\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe start with a string $s$ consisting only of the digits $1$, $2$, or $3$. The length of $s$ is denoted by $|s|$. For each $i$ from $1$ to $|s|$, the $i$-th character of $s$ is denoted by $s_i$. \n\nThere is one cursor. T... | [{"type": "stdin_stdout", "input": "9\n1500\n1212\n1500\n1221\n1500\n122\n1500\n12121\n1500\n22\n1500\n1111112111111112\n1500\n1111111111221111111\n1500\n111111122\n1500\n11111121111121111111\n", "output": "1504\n1599\n1502\n1598\n1502\n1510\n1657\n1502\n1763\n"}, {"type": "stdin_stdout", "input": "9\n1500\n1212\n1500\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a regex to validate a 24 hours time string.\nSee examples to figure out what you should check for:\n\nAccepted:\n01:00 - 1:00 \n\nNot accepted:\n\n24:00\n\nYou should check for correct length and no spaces.\n\nWrit... | [{"input": "\"foo12:00bar\"", "output": "[false]", "fn_name": "validate_time"}, {"input": "\"12: 60\"", "output": "[false]", "fn_name": "validate_time"}, {"input": "\"24o:00\"", "output": "[false]", "fn_name": "validate_time"}, {"input": "\"24:000\"", "output": "[false]", "fn_name": "validate_time"}, {"input": "\"010:0... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given 2 numbers is `n` and `k`. You need to find the number of integers between 1 and n (inclusive) that contains exactly `k` non-zero digit.\n\nExample1 \n\n`\nalmost_everywhere_zero(100, 1) return 19`\n\nby foll... | [{"input": "10000000000000000000000\n21", "output": "[2407217760893271902598]", "fn_name": "almost_everywhere_zero"}, {"input": "10000000000000000000000\n3", "output": "[1122660]", "fn_name": "almost_everywhere_zero"}, {"input": "500309160\n2", "output": "[2604]", "fn_name": "almost_everywhere_zero"}, {"input": "100010... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 1234567891011121314151617181920212223242526272829303... | [{"type": "stdin_stdout", "input": "1000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSo you've found a meeting room - phew! You arrive there ready to present, and find that someone has taken one or more of the chairs!! You need to find some quick.... check all the other meeting rooms to see if all of the ... | [{"input": "[[\"XXX\", 1], [\"XXXXXX\", 6], [\"X\", 2], [\"XXXXXX\", 8], [\"X\", 3], [\"XXX\", 1]]\n5", "output": "[[0, 0, 1, 2, 2]]", "fn_name": "meeting"}, {"input": "[[\"XX\", 2], [\"XXXX\", 6], [\"XXXXX\", 4]]\n8", "output": "[\"Not enough!\"]", "fn_name": "meeting"}, {"input": "[[\"XXX\", 3], [\"XXXXX\", 6], [\"XX... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHarry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber of Secrets is Tom Riddle's diary. The diary was with Ginny and it forced her to open the Chamber of Se... | [{"type": "stdin_stdout", "input": "9\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nliyzmbjwnzryjokufuxcqtzwworjeoxkbaqrujrhdidqdvwdfzilwszgnzglnnbogaclckfnbqovtziuhwvyrqwmskx\nhr... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStep up and down\n\nKazuki, commonly known as Kerr, who attends JAG University, was invited by your friend this summer to participate in the ICPC (International Collegiate Potchari Contest). ICPC is a sports contest and r... | [{"type": "stdin_stdout", "input": "4\nlu ru ld rd\n4\nlu ld lu ru\n1\nlu\n10\nru lu ld rd ru rd ru lu rd ld\n0", "output": "2\n1\n0\n4"}, {"type": "stdin_stdout", "input": "4\nlu ru ld rd\n4\nlu ld lu ru\n0\nlu\n10\nur lu ld rd ru rd ru lu rd ld\n-1", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "4\nlu ru ld... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProfessor Tsukuba invented a mysterious jewelry box that can be opened with a special gold key whose shape is very strange. It is composed of gold bars joined at their ends. Each gold bar has the same length and is placed... | [{"type": "stdin_stdout", "input": "19\n 1 +x 1 +y +z 3 +z\n 3 +y -z +x +y -z -x +z 2 +z\n 2 +y\n19\n 1 +x 1 +x +z 3 +y -z +x +y -z -x +z 2 +y\n 3 +z\n 2 +z\n19\n 1 +x 1 +y +z 3 +z\n 3 +y -z +x +y -z -x +z 2 +y\n 2 +z\n18\n 1 -y\n 1 +y -z +x\n 1 +z +y +x +z +y -x -y 1 -y\n 2 +z\n3 +x +y +z\n3 +y +z -x\n0",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. Th... | [{"type": "stdin_stdout", "input": "100 3\n.*.\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\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\nYou are given a permutation of length $n$. Recall that the permutation is an array consisting of $n$ distinct integers from $1$ to $n$ in arbitrary order. For example, $[2, 3, 1, 5, 4]$ is a permutation, but $[1, 2, 2]$ i... | [{"type": "stdin_stdout", "input": "4\n5\n5 4 1 3 2\n4\n1 2 4 3\n1\n1\n4\n4 3 2 1\n", "output": "1 5 2 4 3 \n1 2 3 4 \n1 \n1 4 3 2 \n"}, {"type": "stdin_stdout", "input": "4\n5\n5 4 1 3 2\n4\n1 2 4 3\n1\n1\n4\n4 3 2 1\n", "output": "1 5 2 4 3 \n1 2 3 4 \n1 \n1 4 3 2 \n"}, {"type": "stdin_stdout", "input": "4\n5\n5 4 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N men and N women, both numbered 1, 2, \\ldots, N.\n\nFor each i, j (1 \\leq i, j \\leq N), the compatibility of Man i and Woman j is given as an integer a_{i, j}. If a_{i, j} = 1, Man i and Woman j are compatib... | [{"type": "stdin_stdout", "input": "21\n0 0 0 0 0 0 0 1 1 0 1 1 1 1 0 0 0 1 0 0 1\n1 1 1 0 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 1 0\n0 0 1 1 1 1 0 1 1 0 0 1 0 0 1 1 0 0 0 1 1\n0 1 1 0 1 1 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0\n1 1 0 0 1 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0\n0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 1 1 1 0 0 1\n0 1 0 0 0 1 0 1 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is a member of a programming competition site, ButCoder.\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\nThe Displayed Rating of a member is equal to their Inner Rating if th... | [{"type": "stdin_stdout", "input": "100 4111\n", "output": "4111\n"}, {"type": "stdin_stdout", "input": "22 3051\n", "output": "3051\n"}, {"type": "stdin_stdout", "input": "10 3141\n", "output": "3141\n"}, {"type": "stdin_stdout", "input": "11 3141\n", "output": "3141\n"}, {"type": "stdin_stdout", "input": "2 2919\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGPA is an abbreviation for \"Galaxy Point of Aizu\" and takes real numbers from 0 to 4.\nGPA rock-paper-scissors is a game played by two people. After each player gives a signal of \"rock-paper-scissors, pon (h... | [{"type": "stdin_stdout", "input": "3\n1.2162360718264462\n2.9346880694304285\n3.9759367558439593", "output": "0\n3\n6\n"}, {"type": "stdin_stdout", "input": "3\n1.3676423535538285\n2.5451927881659007\n3.4551403734048662", "output": "0\n3\n6\n"}, {"type": "stdin_stdout", "input": "3\n2.2132650658019095\n2.5451927881659... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an integer sequence A of length N, where A_1 = X, A_{i+1} = A_i + D (1 \\leq i < N ) holds.\nTakahashi will take some (possibly all or none) of the elements in this sequence, and Aoki will take all of the others.... | [{"type": "stdin_stdout", "input": "199903 -42042635 15996643\n", "output": "1331394274247808\n"}, {"type": "stdin_stdout", "input": "199937 46898475 97994148\n", "output": "1332073730358274\n"}, {"type": "stdin_stdout", "input": "199903 2748118 -84690464\n", "output": "1331394274247808\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and hard versions is that the given string $s$ in the easy version is initially a palindrome, this condition is not always true for the hard version.\n\nA palindrome is a string that r... | [{"type": "stdin_stdout", "input": "3\n3\n110\n2\n00\n4\n1010\n", "output": "\nALICE\nBOB\nALICE\n"}, {"type": "stdin_stdout", "input": "3\n3\n110\n2\n00\n4\n1010\n", "output": "ALICE\nBOB\nALICE\n"}, {"type": "stdin_stdout", "input": "3\n3\n110\n2\n00\n4\n1011\n", "output": "ALICE\nBOB\nALICE\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n> If you've finished this kata, you can try the [more difficult version](https://www.codewars.com/kata/5b256145a454c8a6990000b5).\n\n\n## Taking a walk\nA promenade is a way of uniquely representing a fraction by a succes... | [{"input": "\"RLRLRLRRLRLL\"", "output": "[[290, 179]]", "fn_name": "promenade"}, {"input": "\"LRRLLRLLRLRR\"", "output": "[[161, 229]]", "fn_name": "promenade"}, {"input": "\"LRRLRLLLLRLL\"", "output": "[[107, 149]]", "fn_name": "promenade"}, {"input": "\"LLRLRLLRLLRL\"", "output": "[[112, 295]]", "fn_name": "promenad... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this exercise, you will have to create a function named tiyFizzBuzz. This function will take on a string parameter and will return that string with some characters replaced, depending on the value:\n\n- If a letter is ... | [{"input": "\"Hello WORLD!\"", "output": "[\"IronYardllYard IronIron YardIronIronIron!\"]", "fn_name": "tiy_fizz_buzz"}, {"input": "\"H6H4Na ./?U\"", "output": "[\"Iron6Iron4IronYard ./?Iron Yard\"]", "fn_name": "tiy_fizz_buzz"}, {"input": "\"A\"", "output": "[\"Iron Yard\"]", "fn_name": "tiy_fizz_buzz"}, {"input": "\"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s=s_1s_2\\dots s_n$ of length $n$, which only contains digits $1$, $2$, ..., $9$.\n\nA substring $s[l \\dots r]$ of $s$ is a string $s_l s_{l + 1} s_{l + 2} \\ldots s_r$. A substring $s[l \\dots r]... | [{"type": "stdin_stdout", "input": "39\n263254663359864483324578786753512345165\n", "output": "327\n"}, {"type": "stdin_stdout", "input": "39\n263254663359864483324578786753512345165\n", "output": "327"}, {"type": "stdin_stdout", "input": "10\n9572683145\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "10\n957... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef Jessie has a lot of recipes with her (N). She often remembered the starting few characters of the recipe and forgot the rest. As all the great chefs do, Jessie also numbered the recipes depending on the priority. So,... | [{"type": "stdin_stdout", "input": "4\nflour-with-eggs 100\nchicken-ham -10\nflour-without-eggs 200\nfish-with-pepper 1100\n6\nf\nflour-with\nflour-with-\nc\nfl\nchik\n", "output": "fish-with-pepper\nflour-without-eggs\nflour-with-eggs\nchicken-ham\nflour-without-eggs\nNO\n"}, {"type": "stdin_stdout", "input": "4\nflou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Hey You !\n\nSort these integers for me ...\n\nBy name ...\n\nDo it now !\n\n\n---\n\n## Input\n\n* Range is ```0```-```999```\n\n* There may be duplicates\n\n* The array may be empty\n\n## Example\n\n* Input: 1, 2, 3, ... | [{"input": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 7... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAllen has a LOT of money. He has $n$ dollars in the bank. For security reasons, he wants to withdraw it in cash (we will not disclose the reasons here). The denominations for dollar bills are $1$, $5$, $10$, $20$, $100$. ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "10000000\n"}, {"type": "stdin_stdout", "input": "1230910855\n", "output": "12309112\n"}, {"type": "stdin_stdout", "input": "1199225057\n", "output": "11992256\n"}, {"type": "stdin_stdout", "input": "1100000000\n", "output": "11000000\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of ope... | [{"type": "stdin_stdout", "input": "10\n10\n10\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "10\n10\n10\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "10\n5\n6\n", "output": "300\n"}, {"type": "stdin_stdout", "input": "10\n5\n6\n", "output": "300\n"}, {"type": "stdin_stdout", "input": "9\n14\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nComplete the solution so that it returns the number of times the search_text is found within the full_text. \n\nUsage example:\n\nWrite your solution by modifying this code:\n\n```python\ndef solution(full_text, search_te... | [{"input": "\"ccddeeccddeecc\"\n\"cc\"", "output": "[3]", "fn_name": "solution"}, {"input": "\"abcdefdvbhibjkb\"\n\"b\"", "output": "[4]", "fn_name": "solution"}, {"input": "\"abccded\"\n\"cc\"", "output": "[1]", "fn_name": "solution"}, {"input": "\"abccded\"\n\"d\"", "output": "[2]", "fn_name": "solution"}, {"input": ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nManao works on a sports TV. He's spent much time watching the football games of some country. After a while he began to notice different patterns. For example, each team has two sets of uniforms: home uniform and guest un... | [{"type": "stdin_stdout", "input": "30\n44 17\n44 17\n44 17\n17 44\n44 17\n44 17\n17 44\n17 44\n17 44\n44 17\n44 17\n44 17\n44 17\n44 17\n17 44\n17 44\n17 44\n44 17\n44 17\n17 44\n44 17\n44 17\n44 17\n17 44\n17 44\n44 17\n17 44\n44 17\n44 17\n44 17\n", "output": "418\n"}, {"type": "stdin_stdout", "input": "30\n67 21\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCirno has a DAG (Directed Acyclic Graph) with $n$ nodes and $m$ edges. The graph has exactly one node that has no out edges. The $i$-th node has an integer $a_i$ on it.\n\nEvery second the following happens:\n\nLet $S$ be... | [{"type": "stdin_stdout", "input": "5\n3 2\n1 1 1\n1 2\n2 3\n5 5\n1 0 0 0 0\n1 2\n2 3\n3 4\n4 5\n1 5\n10 11\n998244353 0 0 0 998244353 0 0 0 0 0\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n1 3\n7 9\n5 6\n1293 1145 9961 9961 1919\n1 2\n2 3\n3 4\n5 4\n1 4\n2 4\n6 9\n10 10 10 10 10 10\n1 2\n1 3\n2 3\n4 3\n6 3\n3 5\n6 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAquaMoon has n friends. They stand in a row from left to right, and the i-th friend from the left wears a T-shirt with a number a_i written on it. Each friend has a direction (left or right). In the beginning, the directi... | [{"type": "stdin_stdout", "input": "10\n10\n6 2 1 1 1 10 10 2 10 5\n8\n1 3 1 1 4 5 4 4\n9\n9 6 9 9 2 8 7 2 2\n10\n9 4 3 3 5 4 3 10 4 5\n9\n7 5 1 7 5 5 5 5 6\n8\n8 8 4 4 7 6 2 8\n10\n6 8 1 6 8 8 5 6 8 4\n10\n5 5 5 8 3 4 3 3 10 10\n8\n1 1 3 6 6 7 1 2\n8\n4 1 3 5 3 1 3 3\n", "output": "NO\nYES\nYES\nYES\nYES\nYES\nYES\nYE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHere you have to do some mathematical operations on a \"dirty string\". This kata checks some basics, it's not too difficult.\n\n\n__So what to do?__\n\nInput: String which consists of two positive numbers (doubles) and e... | [{"input": "\"fsdfsd235???34.4554s4234df-sdfgf2g3h4j442\"", "output": "[\"-210908\"]", "fn_name": "calculate_string"}, {"input": "\";$%\\u00a7fsdfsd235??df/sdfgf5gh.000kk0000\"", "output": "[\"47\"]", "fn_name": "calculate_string"}, {"input": "\"fsdfsd234.4554s4234df+sf234442\"", "output": "[\"234676\"]", "fn_name": "c... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nYou are in charge of quality control at a machine manufacturing plant. This machine requires a power supply, a motor, and a cable as parts. The manufacturing plant has a power supply, b motors, and c cables, nu... | [{"type": "stdin_stdout", "input": "2 2 8\n4\n1 1 1 0\n5 3 4 0\n1 4 0 0\n1 3 0 0\n0 0 0", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "1 2 8\n4\n4 1 1 0\n5 0 5 0\n-1 4 0 0\n1 3 2 0\n0 0 0", "output": "2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "4 2 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nn people are standing on a coordinate axis in points with positive integer coordinates strictly less than 10^6. For each person we know in which direction (left or right) he is facing, and his maximum speed.\n\nYou can pu... | [{"type": "stdin_stdout", "input": "26 10\n495492 7 1\n256604 5 2\n511773 3 2\n590712 4 1\n206826 7 2\n817878 4 2\n843915 1 1\n349160 3 1\n351298 4 1\n782251 8 2\n910928 4 1\n662354 4 2\n468621 2 2\n466991 7 2\n787303 6 2\n221623 8 2\n343518 6 1\n141123 7 1\n24725 6 1\n896603 3 2\n918129 8 2\n706071 6 2\n512369 2 2\n60... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin and Russian. Translations in Vietnamese to be uploaded soon. \n\nYou have a matrix of size N * N with rows numbered through 1 to N from top to bottom and columns through 1 to N from le... | [{"type": "stdin_stdout", "input": "2\n2\n1 3\n2 4\n3\n2 7 9\n1 4 8\n3 6 5", "output": "4\n13\n"}, {"type": "stdin_stdout", "input": "2\n2\n1 3\n2 4\n3\n1 7 9\n3 4 8\n2 6 5", "output": "4\n12\n"}, {"type": "stdin_stdout", "input": "2\n2\n1 3\n2 4\n3\n1 7 9\n2 4 8\n6 3 5", "output": "4\n14\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the easy version of the problem. The difference is the constraints on $n$, $m$ and $t$. You can make hacks only if all versions of the problem are solved.\n\nAlice and Bob are given the numbers $n$, $m$ and $k$, a... | [{"type": "stdin_stdout", "input": "10\n74 66 762901908\n543 237 181918820\n455 298 213830486\n54 35 373479158\n85 72 98863599\n85 72 351650459\n106 18 450755091\n344 26 748825922\n65 48 594595004\n189 52 282125334\n", "output": "271485562\n845881147\n625043331\n624104397\n478865056\n346406768\n733766402\n149326158\n29... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S consisting of digits from 1 through 9.\nFind the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the following condition:\nCondition: In base ten, the i-th through j-th characters of S... | [{"type": "stdin_stdout", "input": "17363411548681837295128261415319567339781353176864449667411811151437528238242154453591258857339631698313648443916861223514163135267434612598561425414167173299132999132912477426521378378857571251998814421613836117444161875651252375139311654156139512913688822685276844411124583145973751... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAshish has two strings $a$ and $b$, each of length $n$, and an integer $k$. The strings only contain lowercase English letters.\n\nHe wants to convert string $a$ into string $b$ by performing some (possibly zero) operatio... | [{"type": "stdin_stdout", "input": "4\n3 3\nabc\nbcd\n4 2\nabba\nazza\n2 1\nzz\naa\n6 2\naaabba\nddddcc\n", "output": "\nNo\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "4\n3 3\nabc\nbcd\n4 2\nabba\nazza\n2 1\nzz\naa\n6 2\naaabba\nddddcc\n", "output": "No\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nSoccer is popular in JOI, and a league match called the JOI League is held every week.\n\nThere are N teams in the JOI league, numbered from 1 to N. All combinations of matches are played exactly once. In other... | [{"type": "stdin_stdout", "input": "4\n1 1 0 21\n1 4 2 0\n1 -1 12 2\n4 3 1 3\n4 16 6 1\n-1 1 1 12", "output": "1\n4\n2\n2\n"}, {"type": "stdin_stdout", "input": "4\n1 2 0 19\n2 3 2 2\n1 0 22 1\n3 3 3 -1\n3 16 6 0\n0 1 -1 8", "output": "2\n3\n1\n4\n"}, {"type": "stdin_stdout", "input": "4\n1 2 0 19\n2 3 8 1\n2 0 22 1\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSergey Semyonovich is a mayor of a county city N and he used to spend his days and nights in thoughts of further improvements of Nkers' lives. Unfortunately for him, anything and everything has been done already, and ther... | [{"type": "stdin_stdout", "input": "10\n2 3\n3 9\n6 3\n9 8\n9 10\n4 10\n3 1\n2 5\n7 2\n", "output": "70\n"}, {"type": "stdin_stdout", "input": "10\n2 3\n2 9\n6 3\n9 8\n9 10\n4 10\n3 1\n2 5\n7 2\n", "output": "70\n"}, {"type": "stdin_stdout", "input": "10\n2 3\n3 9\n6 4\n10 8\n9 10\n4 2\n3 1\n3 5\n7 1\n", "output": "75\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Cereal Guy's friend Serial Guy likes to watch soap operas. An episode is about to start, and he hasn't washed his plate yet. But he decided to at least put in under the tap to be filled with water. The plate can be re... | [{"type": "stdin_stdout", "input": "4 10 10\n\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n..........\n\n..........\n..........\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\nGiven an array $a$, consisting of $n$ integers, find:\n\n$$\\max\\limits_{1 \\le i < j \\le n} LCM(a_i,a_j),$$\n\nwhere $LCM(x, y)$ is the smallest positive integer that is divisible by both $x$ and $y$. For example, $LCM... | [{"type": "stdin_stdout", "input": "174\n28 44 12 32 9 27 23 5 23 47 14 49 39 5 10 5 20 9 4 34 18 40 16 4 45 30 32 44 44 30 29 23 21 27 35 13 23 46 5 32 47 45 44 23 12 2 9 28 47 23 22 27 45 27 40 41 22 39 50 14 40 44 20 40 49 23 14 29 27 23 16 40 45 44 15 18 28 9 23 15 21 10 46 29 18 6 15 3 11 34 1 15 35 27 46 36 4 20 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a multiset $S$ initially consisting of $n$ distinct non-negative integers. A multiset is a set, that can contain some elements multiple times.\n\nYou will perform the following operation $k$ times:\n\nAdd th... | [{"type": "stdin_stdout", "input": "7\n5 1000000000\n4 2 3 0 1\n4 0\n5 2 0 1\n3 0\n100 0 1\n6 1234567\n1 2 3 4 5 0\n3 114514\n8 0 4\n1 1000000\n0\n1 10000000\n1\n", "output": "1000000005\n4\n3\n1234573\n4\n1000001\n1\n"}, {"type": "stdin_stdout", "input": "7\n5 1000000000\n4 2 3 0 1\n4 0\n5 2 0 1\n3 0\n100 0 1\n6 12345... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are H rows and W columns of white square cells.\nYou will choose h of the rows and w of the columns, and paint all of the cells contained in those rows or columns.\nHow many white cells will remain?\nIt can be prove... | [{"type": "stdin_stdout", "input": "21 -1\n-5 -5", "output": "104\n"}, {"type": "stdin_stdout", "input": "39 -1\n-5 -5", "output": "176\n"}, {"type": "stdin_stdout", "input": "13 13\n8 10\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "20 20\n19 19\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "19 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've purchased a ready-meal from the supermarket.\n\nThe packaging says that you should microwave it for 4 minutes and 20 seconds, based on a 600W microwave.\n\nOh no, your microwave is 800W! How long should you cook th... | [{"input": "\"600W\"\n4\n20\n\"800W\"", "output": "[\"3 minutes 15 seconds\"]", "fn_name": "cooking_time"}, {"input": "\"100W\"\n8\n45\n\"50W\"", "output": "[\"17 minutes 30 seconds\"]", "fn_name": "cooking_time"}, {"input": "\"450W\"\n3\n25\n\"950W\"", "output": "[\"1 minutes 38 seconds\"]", "fn_name": "cooking_time"}... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are numbe... | [{"type": "stdin_stdout", "input": "100000 99999\n", "output": "50000\n"}, {"type": "stdin_stdout", "input": "100000 23458\n", "output": "38272\n"}, {"type": "stdin_stdout", "input": "100000 23457\n", "output": "11729\n"}, {"type": "stdin_stdout", "input": "92480 43074\n", "output": "24704\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation of length n is an array containing each integer from 1 to n exactly once. For example, q = [4, 5, 1, 2, 3] is a permutation. For the permutation q the square of permutation is the permutation p that p[i] = q... | [{"type": "stdin_stdout", "input": "100\n94 22 24 99 58 97 20 29 67 30 38 64 77 50 15 44 92 88 39 42 25 70 2 76 84 6 37 49 17 71 31 19 26 79 10 35 65 63 32 95 5 8 52 27 83 18 53 93 13 81 48 68 54 82 34 60 87 23 16 86 55 40 61 45 28 7 74 41 14 91 3 72 33 11 98 89 90 69 78 36 80 59 56 21 43 1 75 46 47 12 96 73 57 51 4 85... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnya has bought a new smartphone that uses Berdroid operating system. The smartphone menu has exactly n applications, each application has its own icon. The icons are located on different screens, one screen contains k ic... | [{"type": "stdin_stdout", "input": "71 96 75634\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71\n27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 27 26 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n4 3\n1000 1\n2000 2\n3000 3\n\n\nOutput\n\n2 3 4 4\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 ... | [{"type": "stdin_stdout", "input": "25 1\n1010 1\n3784 7\n3000 6", "output": "2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "25 2\n1011 2\n2889 1\n308 2", "output": "3 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "20 3\n0010 1\n4107 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a data which provides heights (in meter) of mountains. The data is only for ten mountains.\n\nWrite a program which prints heights of the top three mountains in descending order.\n\nConstraints\n\n0 ≤ height of m... | [{"type": "stdin_stdout", "input": "1819\n2003\n1094\n2489\n1723\n492\n4419\n2848\n2834\n1724", "output": "4419\n2848\n2834\n"}, {"type": "stdin_stdout", "input": "1819\n2003\n1094\n2489\n1142\n492\n4419\n4289\n2834\n1724", "output": "4419\n4289\n2834\n"}, {"type": "stdin_stdout", "input": "1819\n2003\n876\n2840\n1723\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRemove the parentheses\n=\nIn this kata you are given a string for example:\n\n```python\n\"example(unwanted thing)example\"\n```\n\nYour task is to remove everything inside the parentheses as well as the parentheses them... | [{"input": "\"hello example (words(more words) here) something\"", "output": "[\"hello example something\"]", "fn_name": "remove_parentheses"}, {"input": "\"example (unwanted thing) example\"", "output": "[\"example example\"]", "fn_name": "remove_parentheses"}, {"input": "\"example(unwanted thing)example\"", "output... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a string s, write a method (function) that will return true if its a valid single integer or floating number or false if its not.\n\nValid examples, should return true:\n\nshould return false:\n\nWrite your solution... | [{"input": "\"3 4 \"", "output": "[false]", "fn_name": "isDigit"}, {"input": "\"s2324\"", "output": "[false]", "fn_name": "isDigit"}, {"input": "\"-234.4\"", "output": "[true]", "fn_name": "isDigit"}, {"input": "\"34.65\"", "output": "[true]", "fn_name": "isDigit"}, {"input": "\"3 4\"", "output": "[false]", "fn_name"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from a... | [{"type": "stdin_stdout", "input": "58 5\n1 6 9 18 34 41 82 99 164 179 183 204 240 396 636 1224 2023 2856 4488 4705 5712 9180 9266 18360 18850 20270 23086 60810 190701 197064 211140 214200 222970 243240 263510 314442 425670 486480 708288 789888 1009800 1025349 1054040 1094580 1325184 1579776 1748076 2050698 2635100 289... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe aim of this Kata is to write a function which will reverse the case of all consecutive duplicate letters in a string. That is, any letters that occur one after the other and are identical.\n\nIf the duplicate letters... | [{"input": "\"parallel universe\"", "output": "[\"paraLLel universe\"]", "fn_name": "reverse"}, {"input": "\"hello world\"", "output": "[\"heLLo world\"]", "fn_name": "reverse"}, {"input": "\"HELLO WORLD\"", "output": "[\"HEllO WORLD\"]", "fn_name": "reverse"}, {"input": "\"HeLlo World\"", "output": "[\"HeLlo World\"]"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a simple parser that will parse and run Deadfish. \n\nDeadfish has 4 commands, each 1 character long:\n* `i` increments the value (initially `0`)\n* `d` decrements the value\n* `s` squares the value\n* `o` outputs ... | [{"input": "\"isoisoiso\"", "output": "[[1, 4, 25]]", "fn_name": "parse"}, {"input": "\"ioioio\"", "output": "[[1, 2, 3]]", "fn_name": "parse"}, {"input": "\"idoiido\"", "output": "[[0, 1]]", "fn_name": "parse"}, {"input": "\"ooo\"", "output": "[[0, 0, 0]]", "fn_name": "parse"}, {"input": "\"codewars\"", "output": "[[0... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n types of coins in Byteland. Conveniently, the denomination of the coin type k divides the denomination of the coin type k + 1, the denomination of the coin type 1 equals 1 tugrick. The ratio of the denominatio... | [{"type": "stdin_stdout", "input": "100\n4 1 5 3 2 1 1 1 4 1 1 2 1 1 1 4 1 1 3 1 3 1 1 1 1 4 5 1 5 2 5 3 1 1 1 1 1 1 1 3 2 1 1 3 1 1 3 4 3 2 4 1 1 4 1 1 2 2 4 1 4 1 2 5 1 2 2 1 5 3 1 5 4 2 1 1 2 5 5 1 4 4 2 3 1 4 1 3 2 1 1 1 4 1 3 1 1 5 1\n0 18 10 2 1 9 9 0 9 5 6 8 11 6 28 11 29 50 25 15 9 4 3 51 13 4 68 31 4 6 2 5 26 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNew Year is just around the corner, which means that in School 179, preparations for the concert are in full swing.\n\nThere are $n$ classes in the school, numbered from $1$ to $n$, the $i$-th class has prepared a scene o... | [{"type": "stdin_stdout", "input": "30\n3 1 3 2 3 1 1 3 2 1 1 3 3 3 3 3 2 1 2 1 3 2 2 1 3 1 3 1 2 3\n", "output": "0 1 1 1 1 2 3 3 3 4 5 5 5 6 6 6 6 7 7 8 8 8 9 10 10 11 11 12 12 12 "}, {"type": "stdin_stdout", "input": "7\n2 12 4 8 18 3 6\n", "output": "0 1 1 1 2 2 2 "}, {"type": "stdin_stdout", "input": "3\n1 1000000... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.