messages listlengths 1 1 | ground_truth stringlengths 156 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Mojtaba and Arpa are playing a game. They have a list of n numbers in the game.\n\nIn a player's turn, he chooses a number pk (where p is a prime number and k is a positive integer) such that pk divides at least one number in the list. For each number in the list divisible by pk, call it x, the pl... | [{"input": "63\n16807 1 1419857 59049 1 2187 6859 1 33554432 129140163 11 1 16777216 3 9765625 1331 2197 268435456 2 169 390625 343 1048576 536870912 19683 125 16384 27 40353607 815730721 32 130321 43046721 524288 17 8388608 7 4782969 15625 282475249 134217728 1 25 4913 9 19 131072 244140625 625 2476099 1 2048 21435888... | code_stdio |
[
{
"content": "Task:\nGiven an array arr of strings complete the function landPerimeter by calculating the total perimeter of all the islands. Each piece of land will be marked with 'X' while the water fields are represented as 'O'. Consider each tile being a perfect 1 x 1piece of land. Some examples for better ... | [{"input": "[\"OXOOOX\", \"OXOXOO\", \"XXOOOX\", \"OXXXOO\", \"OOXOOX\", \"OXOOOO\", \"OOXOOX\", \"OOXOOO\", \"OXOOOO\", \"OXOOXX\"]", "output": "[\"Total land perimeter: 60\"]", "fn_name": "land_perimeter"}, {"input": "[\"OXOOO\", \"OOXXX\", \"OXXOO\", \"XOOOO\", \"XOOOO\", \"XXXOO\", \"XOXOO\", \"OOOXO\", \"OXOOX\", ... | code_functional |
[
{
"content": "Sergei B., the young coach of Pokemons, has found the big house which consists of n flats ordered in a row from left to right. It is possible to enter each flat from the street. It is possible to go out from each flat. Also, each flat is connected with the flat to the left and the flat to the righ... | [{"input": "100\nfAfhfNNNhfffAfNffNANhffNffffffNfffffhNfffNfefNfffNfNNNffNfffNfhNNNffffNfNfffAffNffNffNNfhfffNhNffNNN\n", "output": "26\n"}, {"input": "100\nfAfhfNNNhfffAfNffNANhffNffffffNfffffhNfffNfffNfffNfNNNffNfffNfhNNNffffNfNfffAffNffNffNNfhfffNhNffNNN\n", "output": "4\n"}, {"input": "100\nfAfhfNNNhfffAfNffNANhffN... | code_stdio |
[
{
"content": "AtCoDeer the deer found N rectangle lying on the table, each with height 1.\nIf we consider the surface of the desk as a two-dimensional plane, the i-th rectangle i(1≤i≤N) covers the vertical range of [i-1,i] and the horizontal range of [l_i,r_i], as shown in the following figure:\n\nAtCoDeer will... | [{"input": "5\n999999999 1000000000\n1 2\n314 315\n500000 500001\n999999999 1000000000\n", "output": "1999999680\n"}, {"input": "5\n999999999 1000001000\n1 -1\n269 106\n500000 500001\n999999999 1000000000", "output": "1999999892\n"}, {"input": "5\n999999999 1000001000\n1 -1\n269 101\n500000 500001\n999999999 1000000000... | code_stdio |
[
{
"content": "Currently, people's entertainment is limited to programming contests. The activity of the entertainment club of a junior high school to which she belongs is to plan and run a programming contest. Her job is not to create problems. It's a behind-the-scenes job of soliciting issues from many, organi... | [{"input": "1 2 1 1 1 0\n1 2 1 0 0 -1\n1 0 0 0 1 1\n3 -1 0 0 2 0\n3 1 0 1 3 1\n0 2 0 2 -1 0\n0 0 1 1 0 7\n2 0 0 1 0 0\n0 0 0 0 0 0", "output": "1\n0\n1\n1\n3\n0\n2\n1\n"}, {"input": "1 2 1 1 1 0\n1 2 1 0 0 -1\n1 0 0 0 1 1\n3 -1 0 0 2 0\n3 0 0 1 3 1\n0 2 0 2 -1 0\n0 0 1 1 0 7\n2 0 0 1 0 0\n0 0 0 0 0 0", "output": "1\n0\... | code_stdio |
[
{
"content": "M-kun is a student in Aoki High School, where a year is divided into N terms.\nThere is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:\n\n* For the first through (K-1)-th terms: not given.\n* For each of the K-th throu... | [{"input": "15 1\n4 1 4 0 6 9 2 6 5 3 5 7 9 1 9", "output": "No\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nYes\n"}, {"input": "15 1\n3 0 8 1 6 9 1 6 5 5 9 7 2 7 16", "output": "No\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\nYes\nNo\nNo\nYes\nYes\n"}, {"input": "15 2\n6 1 8 2 12 9 1 8 1 6 9 15 9 3 28", "output": "... | code_stdio |
[
{
"content": "Allen is hosting a formal dinner party. 2n people come to the event in n pairs (couples). After a night of fun, Allen wants to line everyone up for a final picture. The 2n people line up, but Allen doesn't like the ordering. Allen prefers if each pair occupies adjacent positions in the line, as th... | [{"input": "86\n33 6 22 8 54 43 57 85 70 41 20 17 35 12 66 25 45 78 67 55 50 19 31 75 77 29 58 78 34 15 40 48 14 82 6 37 44 53 62 23 56 22 34 18 71 83 21 80 47 38 3 42 60 9 73 49 84 7 76 30 5 4 11 28 69 16 26 10 59 48 64 46 32 68 24 63 79 36 13 1 27 61 39 74 2 51 51 2 74 39 61 27 1 13 36 79 86 24 68 32 46 64 63 59 10 2... | code_stdio |
[
{
"content": "A plurality of trampolines are arranged in a line at 10 m intervals. Each trampoline has its own maximum horizontal distance within which the jumper can jump safely. Starting from the left-most trampoline, the jumper jumps to another trampoline within the allowed jumping range. The jumper wants to... | [{"input": "4\n163\n51\n2\n32", "output": "yes\n"}, {"input": "4\n001\n103\n-1\n0", "output": "no\n"}, {"input": "4\n001\n136\n-1\n0", "output": "no\n"}, {"input": "4\n001\n155\n-1\n0", "output": "no\n"}, {"input": "4\n20\n51\n1\n20", "output": "yes\n"}, {"input": "4\n37\n51\n1\n20", "output": "yes\n"}, {"input": "4\n5... | code_stdio |
[
{
"content": "In this kata you should simply determine, whether a given year is a leap year or not. In case you don't know the rules, here they are:\n\n* years divisible by 4 are leap years\n* but years divisible by 100 are **not** leap years\n* but years divisible by 400 are leap years\n\nAdditional Notes:\n\n... | [{"input": "1234", "output": "[false]", "fn_name": "isLeapYear"}, {"input": "1100", "output": "[false]", "fn_name": "isLeapYear"}, {"input": "1194", "output": "[false]", "fn_name": "isLeapYear"}, {"input": "1984", "output": "[true]", "fn_name": "isLeapYear"}, {"input": "2000", "output": "[true]", "fn_name": "isLeapYear... | code_functional |
[
{
"content": "Ann has recently started commuting by subway. We know that a one ride subway ticket costs a rubles. Besides, Ann found out that she can buy a special ticket for m rides (she can buy it several times). It costs b rubles. Ann did the math; she will need to use subway n times. Help Ann, tell her what... | [{"input": "1000 1 1000 1000\n", "output": "1000000\n"}, {"input": "1000 1 1000 1000\n", "output": "1000000\n"}, {"input": "1000 3 1000 1000\n", "output": "334000\n"}, {"input": "1000 3 1000 1000\n", "output": "334000\n"}, {"input": "1000 3 1001 1000\n", "output": "334000\n"}, {"input": "1000 5 1000 1000\n", "output": ... | code_stdio |
[
{
"content": "Given is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order.\n\n-----Constraints-----\n - C is a lowercase English letter that is not z.\n\n-----Input-----\nInput is given from Standard Input in the following format:\nC\n\n-----Output-----\nPrint the ... | [{"input": "a\n", "output": "b\n"}, {"input": "y\n", "output": "z\n"}, {"input": "c\n", "output": "d\n"}, {"input": "p\n", "output": "q\n"}, {"input": "d\n", "output": "e\n"}, {"input": "t\n", "output": "u\n"}, {"input": "z", "output": "{\n"}, {"input": "b", "output": "c\n"}, {"input": "x", "output": "y\n"}, {"input": ... | code_stdio |
[
{
"content": "Given are an integer N and four characters c_{\\mathrm{AA}}, c_{\\mathrm{AB}}, c_{\\mathrm{BA}}, and c_{\\mathrm{BB}}.\nHere, it is guaranteed that each of those four characters is A or B.\nSnuke has a string s, which is initially AB.\nLet |s| denote the length of s.\nSnuke can do the four kinds o... | [{"input": "1000\nB\nA\nA\nA\n", "output": "589888339\n"}, {"input": "1000\nA\nB\nA\nA\n", "output": "336052903\n"}, {"input": "1000\nB\nB\nA\nA\n", "output": "336052903\n"}, {"input": "1000\nB\nA\nB\nA\n", "output": "336052903\n"}, {"input": "1000\nA\nB\nB\nA\n", "output": "589888339\n"}, {"input": "1000\nB\nB\nB\nA\n... | code_stdio |
[
{
"content": "An autumn sports festival is held. There are four events: foot race, ball-carrying, obstacle race, and relay. There are n teams participating, and we would like to commend the team with the shortest total time in this 4th event as the \"winner\", the next smallest team as the \"runner-up\", and th... | [{"input": "8\n65541 3 20 3 8 6 27 2 25\n20941 3 5 2 41 7 19 2 42\n90585 4 8 3 12 11 46 2 34\n92201 3 28 2 47 6 37 2 58\n10001 3 50 2 42 7 12 4 54\n63812 4 11 3 11 6 98 2 22\n54092 3 33 2 54 6 18 2 19\n25012 3 44 2 58 6 45 2 46\n4\n1 3 23 1 23 1 34 4 69\n2 5 12 2 12 3 41 2 29\n3 5 24 1 24 2 0 3 35\n4 4 49 2 22 4 41 4 2... | code_stdio |
[
{
"content": "You are given an alphabet consisting of n letters, your task is to make a string of the maximum possible length so that the following conditions are satisfied: the i-th letter occurs in the string no more than a_{i} times; the number of occurrences of each letter in the string must be distinct ... | [{"input": "26\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "259... | code_stdio |
[
{
"content": "You are given nonnegative integers a and b (a ≤ b), and a positive integer x.\nAmong the integers between a and b, inclusive, how many are divisible by x?\n\n-----Constraints-----\n - 0 ≤ a ≤ b ≤ 10^{18}\n - 1 ≤ x ≤ 10^{18}\n\n-----Input-----\nThe input is given from Standard Input in the followin... | [{"input": "1 1000000000000000000 3\n", "output": "333333333333333333\n"}, {"input": "-1 1010010100000100000 4", "output": "252502525000025001\n"}, {"input": "-1 1010010110000100000 3", "output": "336670036666700001\n"}, {"input": "-1 1010010111000100000 3", "output": "336670037000033334\n"}, {"input": "1 1000010000000... | code_stdio |
[
{
"content": "You were dreaming that you are traveling to a planet named Planetforces on your personal spaceship. Unfortunately, its piloting system was corrupted and now you need to fix it in order to reach Planetforces.\n\nSpace can be represented as the $XY$ plane. You are starting at point $(0, 0)$, and Pla... | [{"input": "6\n10 5\nRRRRRRRRRRUUUUU\n1 -1\nUDDDRLLL\n-3 -5\nLDLDLDDDR\n-1 2\nUULLLL\n6 -2\nRDULRLLDR\n-1 6\nRUDURUUUUR\n", "output": "YES\nYES\nYES\nYES\nNO\nNO\n"}, {"input": "6\n10 5\nRRRRRRRRRRUUUUU\n1 -1\nUDDDRLLL\n-3 -5\nLDLDLDDDR\n0 2\nUULLLL\n6 -2\nRDULRLLDR\n-1 6\nRUDURUUUUR\n", "output": "YES\nYES\nYES\nYES\n... | code_stdio |
[
{
"content": "After his wife's tragic death, Eurydice, Orpheus descended to the realm of death to see her. Reaching its gates was uneasy, but passing through them proved to be even more challenging. Mostly because of Cerberus, the three-headed hound of Hades.\n\nOrpheus, a famous poet, and musician plans to cal... | [{"input": "7\nbabba\nabaac\ncodeforces\nzeroorez\nabcdcba\nbbbbbbb\na\n", "output": "\n1\n1\n0\n1\n1\n4\n0\n"}, {"input": "7\nbabba\nabaac\ncodeforces\nzeroorez\nabcdcba\nbbbbbbb\na\n", "output": "1\n1\n0\n1\n1\n4\n0\n"}, {"input": "7\nabbab\nabaac\ncodeforces\nzeroorez\nabcdcba\nbbbbbbb\na\n", "output": "1\n1\n0\n1\n... | code_stdio |
[
{
"content": "Yet another round on DecoForces is coming! Grandpa Maks wanted to participate in it but someone has stolen his precious sofa! And how can one perform well with such a major loss?\n\nFortunately, the thief had left a note for Grandpa Maks. This note got Maks to the sofa storehouse. Still he had no ... | [{"input": "6\n10 10\n3 6 3 7\n4 9 5 9\n5 4 5 3\n7 1 8 1\n9 10 8 10\n7 7 7 8\n0 5 2 3\n", "output": "1\n"}, {"input": "6\n10 10\n3 6 3 7\n4 9 5 9\n5 4 5 3\n7 1 8 1\n9 10 8 10\n7 7 7 8\n0 5 2 3\n", "output": "1\n"}, {"input": "5\n4 6\n4 3 3 3\n4 2 4 1\n3 6 2 6\n2 4 2 3\n1 1 1 2\n1 2 2 1\n", "output": "-1\n"}, {"input": ... | code_stdio |
[
{
"content": "Chef changed the password of his laptop a few days ago, but he can't remember it today. Luckily, he wrote the encrypted password on a piece of paper, along with the rules for decryption.\nThe encrypted password is a string S consists of ASCII printable characters except space (ASCII 33 - 126, in d... | [{"input": "4\n2\n2 3\n1 1\n8\n0\n1800.7150295041072\n0\n0.42064717124502127\n3\nx 1\nc 2\n# .\n0xd21#dc/98x", "output": "8\n1800.7150295041072\n.42064717124502127\n1d21.d2/981\n"}, {"input": "4\n2\n7 3\n3 1\n10\n0\n1800.0493927440593\n0\n0.9085107376538183\n3\ny 0\nd 3\n# .\n0xd21#xd098d", "output": "10\n1800.04939274... | code_stdio |
[
{
"content": "n evenly spaced points have been marked around the edge of a circle. There is a number written at each point. You choose a positive real number k. Then you may repeatedly select a set of 2 or more points which are evenly spaced, and either increase all numbers at points in the set by k or decrease... | [{"input": "488\n453349582488862562152454328120974624021885842759505659322561694358728150516204337664755243733316681382547751353198982127441183878962690095592236469807087207161691714104527568781618875688104415243715506909284770554256616642020503116458540489226220383015748323400356936736149732496461685474945266209347338... | code_stdio |
[
{
"content": "Write a program which solve a simultaneous equation:\n\nax + by = c\ndx + ey = f\n\nThe program should print x and y for given a, b, c, d, e and f (-1,000 ≤ a, b, c, d, e, f ≤ 1,000). You can suppose that given equation has a unique solution.\n\n\n\nInput\n\nThe input consists of several data sets... | [{"input": "3 -1 -3 1 0 -3\n2 -1 -3 -9 18 27", "output": "-3.000 -6.000\n-1.000 1.000\n"}, {"input": "3 -2 -3 1 0 -3\n2 -1 -3 -9 18 27", "output": "-3.000 -3.000\n-1.000 1.000\n"}, {"input": "3 -1 -3 1 0 -3\n2 -1 -3 -9 13 27", "output": "-3.000 -6.000\n-0.706 1.588\n"}, {"input": "3 -2 -6 1 0 -3\n2 -1 -3 -9 18 27", "ou... | code_stdio |
[
{
"content": "N people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green.\n\nThe person numbered i says:\n\n* \"In front of me, exactly A_i people are wearing hats with the same color as mine.\"\n\n\n\nAssuming that all these statements a... | [{"input": "54\n0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17", "output": "115295190"}, {"input": "54\n0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 20 13 14 14 15 15 15 16 16 16 17 17 17... | code_stdio |
[
{
"content": "You are given a string $a$, consisting of $n$ characters, $n$ is even. For each $i$ from $1$ to $n$ $a_i$ is one of 'A', 'B' or 'C'.\n\nA bracket sequence is a string containing only characters \"(\" and \")\". A regular bracket sequence is a bracket sequence that can be transformed into a correct... | [{"input": "28\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nAABBAC\nCACA\n", "output": "YES\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\... | code_stdio |
[
{
"content": "Lee just became Master in Codeforces, and so, he went out to buy some gifts for his friends. He bought $n$ integers, now it's time to distribute them between his friends rationally...\n\nLee has $n$ integers $a_1, a_2, \\ldots, a_n$ in his backpack and he has $k$ friends. Lee would like to distrib... | [{"input": "3\n4 2\n1 13 7 17\n1 3\n6 2\n10 10 10 10 11 11\n3 3\n4 4\n1000000000 1000000000 1000000000 1000000000\n1 1 1 1\n", "output": "48\n42\n8000000000\n"}, {"input": "3\n4 2\n1 13 12 1\n1 3\n6 2\n10 10 10 10 11 11\n3 3\n4 4\n1000000000 1000000000 1000000000 1000000000\n1 1 1 1\n", "output": "39\n42\n8000000000\n"... | code_stdio |
[
{
"content": "M-kun is a competitor in AtCoder, whose highest rating is X.\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\n* From 400 through 599: 8-kyu\n* From 600 through 799: 7-kyu\n* From 800 through ... | [{"input": "1359", "output": "4\n"}, {"input": "1855", "output": "1\n"}, {"input": "1485", "output": "3\n"}, {"input": "1125", "output": "5\n"}, {"input": "1764", "output": "2\n"}, {"input": "1596", "output": "3\n"}, {"input": "1543", "output": "3\n"}, {"input": "1815", "output": "1\n"}, {"input": "1307", "output": "4\... | code_stdio |
[
{
"content": "You are given an array $a$ consisting of $n$ integers. Each $a_i$ is one of the six following numbers: $4, 8, 15, 16, 23, 42$.\n\nYour task is to remove the minimum number of elements to make this array good.\n\nAn array of length $k$ is called good if $k$ is divisible by $6$ and it is possible to... | [{"input": "100\n4 42 23 23 16 42 16 23 42 16 42 8 4 23 4 4 23 42 16 42 23 23 23 42 4 42 8 8 16 23 15 23 16 4 42 15 15 23 16 15 16 4 4 15 23 42 42 15 8 23 8 23 4 15 16 15 42 8 23 16 15 42 23 8 4 16 15 16 23 16 16 4 23 16 8 23 16 15 23 4 4 8 15 4 4 15 8 23 23 4 4 8 8 4 42 15 4 4 42 16\n", "output": "64\n"}, {"input": "1... | code_stdio |
[
{
"content": "John has some amount of money of which he wants to deposit a part `f0` to the bank at the beginning\nof year `1`. He wants to withdraw each year for his living an amount `c0`.\n\nHere is his banker plan:\n\n- deposit `f0` at beginning of year 1\n- his bank account has an interest rate of `p` perce... | [{"input": "100000000\n1.5\n10000000\n50\n1", "output": "[false]", "fn_name": "fortune"}, {"input": "9998.5\n61.8155\n10000.0\n3\n0", "output": "[false]", "fn_name": "fortune"}, {"input": "9999\n61.8161\n10000.0\n3\n0", "output": "[false]", "fn_name": "fortune"}, {"input": "100000000\n5\n1000000\n50\n1", "output": "[tr... | code_functional |
[
{
"content": "Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this ... | [{"input": "hzkqvwliymwjbejfpnydrbwskhyrtrlsdinfrgwmnbdpwytcnjeoowxrfgfuaffzayjylvzu\n1\nhzkqvwliymwjbejfpnydrbwskhyrtrlsdinfrgwmnbdpwytcnjeoowxrfgfuaffzayjylvzubwjlvhhsfurqb\n", "output": "hzkqvwliymwjbejfpnydrbwskhyrtrlsdinfrgwmnbdpwytcnjeoowxrfgfuaffzayjylvzubwjlvhhsfurqb\n"}, {"input": "uzvlyjyazffaufgfrxwooejnctyw... | code_stdio |
[
{
"content": "Manao is trying to open a rather challenging lock. The lock has n buttons on it and to open it, you should press the buttons in a certain order to open the lock. When you push some button, it either stays pressed into the lock (that means that you've guessed correctly and pushed the button that go... | [{"input": "2000\n", "output": "1333335000\n"}, {"input": "1999\n", "output": "1331335999\n"}, {"input": "1837\n", "output": "1033182073\n"}, {"input": "2000\n", "output": "1333335000\n"}, {"input": "1837\n", "output": "1033182073\n"}, {"input": "1999\n", "output": "1331335999\n"}, {"input": "1747\n", "output": "888644... | code_stdio |
[
{
"content": "Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others are unread.\n\nAlexey's mail program can either show a list of all letters or show the content of a single letter. As soon as the program shows the content of an unread letter, it becomes read lett... | [{"input": "213\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... | code_stdio |
[
{
"content": "The next lecture in a high school requires two topics to be discussed. The $i$-th topic is interesting by $a_i$ units for the teacher and by $b_i$ units for the students.\n\nThe pair of topics $i$ and $j$ ($i < j$) is called good if $a_i + a_j > b_i + b_j$ (i.e. it is more interesting for the teac... | [{"input": "14\n137698508 528184026 54130884 239033739 1038011779 720680829 605286542 89272810 284191042 179359950 186766648 570400677 107541072 25121211\n195343970 709242622 422954170 980941827 265963618 812646456 943660193 344102432 295006337 221455256 203711937 632473368 334173424 49206958\n", "output": "13\n"}, {"i... | code_stdio |
[
{
"content": "It has been noted that if some ants are put in the junctions of the graphene integer lattice then they will act in the following fashion: every minute at each junction (x, y) containing at least four ants a group of four ants will be formed, and these four ants will scatter to the neighbouring jun... | [{"input": "30000 39\n2650 -1515\n-3169 4818\n-1896 2727\n1323 -2335\n-387 901\n-4299 1481\n-2114 4435\n3654 -2730\n4569 3801\n-3815 -3355\n4777 1749\n4486 -780\n-3936 -158\n717 -3518\n4765 -909\n-3032 3726\n-2970 3346\n2067 -1560\n-521 -1331\n-4953 -2098\n-849 580\n-4941 4018\n1338 -2629\n-1444 -3550\n1502 4995\n1156 ... | code_stdio |
[
{
"content": "You have a list of numbers from $1$ to $n$ written from left to right on the blackboard.\n\nYou perform an algorithm consisting of several steps (steps are $1$-indexed). On the $i$-th step you wipe the $i$-th number (considering only remaining numbers). You wipe the whole number (not one digit). $... | [{"input": "2\n1000000000 1\n1000000000 500000000\n", "output": "2\n1000000000\n"}, {"input": "2\n1000000000 1\n1000000000 500000000\n", "output": "2\n1000000000\n"}, {"input": "3\n3 1\n4 2\n69 6\n", "output": "2\n4\n12\n"}, {"input": "3\n3 1\n5 2\n69 6\n", "output": "2\n4\n12\n"}, {"input": "3\n3 1\n5 2\n34 6\n", "out... | code_stdio |
[
{
"content": "ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) and '$\\sqrt{}$' (square root). Initially, the number 2 is displayed on the screen. There are n + 1 levels in the game and ZS the Coder start at the level 1.\n\nWhen ZS the Coder is at... | [{"input": "6723\n", "output": "2\n17\n46\n97\n176\n289\n442\n641\n892\n1201\n1574\n2017\n2536\n3137\n3826\n4609\n5492\n6481\n7582\n8801\n10144\n11617\n13226\n14977\n16876\n18929\n21142\n23521\n26072\n28801\n31714\n34817\n38116\n41617\n45326\n49249\n53392\n57761\n62362\n67201\n72284\n77617\n83206\n89057\n95176\n101569\... | code_stdio |
[
{
"content": "In the State of Takahashi in AtCoderian Federation, there are N cities, numbered 1, 2, ..., N.\nM bidirectional roads connect these cities.\nThe i-th road connects City A_i and City B_i.\nEvery road connects two distinct cities.\nAlso, for any two cities, there is at most one road that directly co... | [{"input": "10 39\n7 2\n7 1\n5 6\n5 8\n9 10\n2 8\n8 7\n3 10\n10 1\n8 10\n2 3\n7 4\n3 9\n4 10\n3 4\n6 1\n6 7\n9 5\n9 7\n6 9\n9 4\n4 6\n7 5\n8 3\n2 5\n9 2\n10 7\n8 6\n8 9\n7 3\n5 3\n4 5\n6 3\n2 10\n5 10\n4 2\n6 2\n8 4\n10 6\n", "output": "21\n"}, {"input": "10 39\n7 2\n7 1\n5 6\n5 8\n9 10\n2 8\n8 7\n3 10\n10 1\n8 10\n2 3... | code_stdio |
[
{
"content": "We will call a non-negative integer increasing if, for any two adjacent digits in its decimal representation, the digit to the right is greater than or equal to the digit to the left. For example, 1558, 11, 3 and 0 are all increasing; 10 and 20170312 are not.\n\nSnuke has an integer N. Find the mi... | [{"input": "3704579452095997258280591217784156184311155893966777597430447796450532", "output": "32\n"}, {"input": "4271374355872521214646189206931447259915557225329718337053006899386612", "output": "33\n"}, {"input": "4636365955583185577236629139430025754175155260406833067161877454344706", "output": "37\n"}, {"input": ... | code_stdio |
[
{
"content": "A: Many Kinds of Apples\n\nProblem Statement\n\nApple Farmer Mon has two kinds of tasks: \"harvest apples\" and \"ship apples\".\n\nThere are N different species of apples, and N distinguishable boxes. Apples are labeled by the species, and boxes are also labeled, from 1 to N. The i-th species of ... | [{"input": "2\n1 0\n0\n-1 -1 1\n-1 1 0\n3 1 3\n-1 1 2", "output": "0\n"}, {"input": "2\n1 0\n0\n-1 -1 1\n-1 1 3\n3 1 3\n0 3 2", "output": "0\n"}, {"input": "2\n1 0\n0\n-1 -1 1\n-1 1 0\n3 1 3\n0 3 2", "output": "0\n"}, {"input": "2\n1 0\n0\n-1 -1 1\n-1 1 0\n2 1 3\n0 3 2", "output": "0\n"}, {"input": "2\n1 -1\n0\n0 -1 1\... | code_stdio |
[
{
"content": "You are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect.\n\nThe interior of the square is considered to be part of the square, i.e. if one square is completely inside another,... | [{"input": "-17 -91 -17 -27 -81 -27 -81 -91\n-48 -21 -12 -57 -48 -93 -84 -57\n", "output": "YES\n"}, {"input": "-100 -100 -100 -99 -99 -99 -99 -100\n-10 -10 -9 -9 -10 -8 -11 -9\n", "output": "NO\n"}, {"input": "-100 -100 -100 100 100 100 100 -100\n-100 0 0 100 100 0 0 -100\n", "output": "YES\n"}, {"input": "-12 -54 -12... | code_stdio |
[
{
"content": "The following sorting operation is repeated for the stacked blocks as shown in Fig. A.\n\n1. Stack all the bottom blocks (white blocks in Figure a) on the right edge (the remaining blocks will automatically drop one step down, as shown in Figure b).\n2. If there is a gap between the blocks, pack i... | [{"input": "6\n1 4 1 3 2 4\n5\n1 2 5 4 5\n10\n1 1 1 1 1 1 1 1 1 1\n9\n1 1 1 1 1 1 1 1 1\n12\n1 4 1 3 2 4 3 3 2 1 2 2\n1\n5050\n3\n10000 10000 100\n0", "output": "24\n-1\n10\n-1\n48\n5049\n-1\n"}, {"input": "6\n1 4 1 3 2 4\n5\n1 2 5 4 5\n10\n1 1 1 1 1 1 1 1 1 1\n9\n1 1 1 1 1 1 1 1 1\n12\n1 4 1 3 2 4 3 1 2 1 2 2\n1\n5050... | code_stdio |
[
{
"content": "Translator's note: in Russia's most widespread grading system, there are four grades: 5, 4, 3, 2, the higher the better, roughly corresponding to A, B, C and F respectively in American grading system.\n\nThe term is coming to an end and students start thinking about their grades. Today, a professo... | [{"input": "100\n3 2 4 3 3 3 4 2 3 5 5 2 5 2 3 2 4 4 4 5 5 4 2 5 4 3 2 5 3 4 3 4 2 4 5 4 2 4 3 4 5 2 5 3 3 4 2 2 4 4 4 5 4 3 3 3 2 5 2 2 2 3 5 4 3 2 4 5 5 5 2 2 4 2 3 3 3 5 3 2 2 4 5 5 4 5 5 4 2 3 2 2 2 2 5 3 5 2 3 4\n", "output": "40\n"}, {"input": "100\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ... | code_stdio |
[
{
"content": "Compute A \\times B.\n\n-----Constraints-----\n - 1 \\leq A \\leq 100\n - 1 \\leq B \\leq 100\n - All values in input are integers.\n\n-----Input-----\nInput is given from Standard Input in the following format:\nA B\n\n-----Output-----\nPrint the value A \\times B as an integer.\n\n-----Sample In... | [{"input": "100 100\n", "output": "10000\n"}, {"input": "101 110", "output": "11110\n"}, {"input": "101 111", "output": "11211\n"}, {"input": "101 101", "output": "10201\n"}, {"input": "100 110", "output": "11000\n"}, {"input": "100 111", "output": "11100\n"}, {"input": "100 101", "output": "10100\n"}, {"input": "111 1... | code_stdio |
[
{
"content": "Tonio has a keyboard with only two letters, \"V\" and \"K\".\n\nOne day, he has typed out a string s with only these two letters. He really likes it when the string \"VK\" appears, so he wishes to change at most one letter in the string (or do no changes) to maximize the number of occurrences of t... | [{"input": "VVKKVKKVVKKVKKVKVVKKVKKVVKKVKVVKKVKKVKVVKKVVKKVKVVKKVKVVKKVVKVVKKVKKVKKVKKVKKVKVVKKVKKVKKVKKVKKVVKVK\n", "output": "32\n"}, {"input": "VVVVVKKVKVKVKVVKVVKKVVKVKKKKKKKVKKKVVVVVVKKVVVKVKVVKVKKVVKVVVKKKKKVVVVVKVVVVKVVVKKVKKVKKKVKKVKKVVKKV\n", "output": "25\n"}, {"input": "KKVVKKVVVKKVKKVKKVVVKVVVKKVKKVVVKKVVVK... | code_stdio |
[
{
"content": "# Task\nWe know that some numbers can be split into two primes. ie. `5 = 2 + 3, 10 = 3 + 7`. But some numbers are not. ie. `17, 27, 35`, etc.. \n\nGiven a positive integer `n`. Determine whether it can be split into two primes. If yes, return the maximum product of two primes. If not, return `0` i... | [{"input": "100", "output": "[2491]", "fn_name": "prime_product"}, {"input": "10", "output": "[25]", "fn_name": "prime_product"}, {"input": "12", "output": "[35]", "fn_name": "prime_product"}, {"input": "20", "output": "[91]", "fn_name": "prime_product"}, {"input": "7", "output": "[10]", "fn_name": "prime_product"}, {"... | code_functional |
[
{
"content": "Vasya has an array a consisting of positive integer numbers. Vasya wants to divide this array into two non-empty consecutive parts (the prefix and the suffix) so that the sum of all elements in the first part equals to the sum of elements in the second part. It is not always possible, so Vasya wil... | [{"input": "100\n27 95 57 29 91 85 83 36 72 86 39 5 79 61 78 93 100 97 73 23 82 66 41 92 38 92 100 96 48 23 66 47 5 32 69 13 95 23 46 62 99 83 57 66 98 82 81 57 37 37 81 64 45 76 72 43 99 76 86 22 37 39 93 80 99 36 53 83 3 32 52 9 78 34 47 100 33 72 19 40 29 56 77 32 79 72 15 88 100 98 56 50 22 81 88 92 58 70 21 19\n",... | code_stdio |
[
{
"content": "Vasya thinks that lucky tickets are the tickets whose numbers are divisible by 3. He gathered quite a large collection of such tickets but one day his younger brother Leonid was having a sulk and decided to destroy the collection. First he tore every ticket exactly in two, but he didn’t think it w... | [{"input": "10\n146767769 71795210 50866429 35232438 22664883 56785812 91050433 75677099 84393937 43832346\n", "output": "5\n"}, {"input": "10\n146767769 71795210 50866429 35232438 22664883 56785812 91050433 75677099 18053121 43832346\n", "output": "4\n"}, {"input": "10\n146767769 71795210 50866429 35232438 22664883 56... | code_stdio |
[
{
"content": "An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.\nGiven an integer N, determine whether it is a Harshad number.\n\n-----Constraints-----\n - 1?N?10^8\n - N is an integer.\n\n-----Input-----\nInput is given from Sta... | [{"input": "12\n", "output": "Yes\n"}, {"input": "148\n", "output": "No\n"}, {"input": "112", "output": "Yes\n"}, {"input": "224", "output": "Yes\n"}, {"input": "133", "output": "Yes\n"}, {"input": "162", "output": "Yes\n"}, {"input": "190", "output": "Yes\n"}, {"input": "171", "output": "Yes\n"}, {"input": "375", "out... | code_stdio |
[
{
"content": "Kevin and Nicky Sun have invented a new game called Lieges of Legendre. In this game, two players take turns modifying the game state with Kevin moving first. Initially, the game is set up so that there are n piles of cows, with the i-th pile containing ai cows. During each player's turn, that pla... | [{"input": "10 2\n3 10 10 8 6 10 9 9 5 7\n", "output": "Kevin\n"}, {"input": "10 2\n3 10 10 7 6 10 9 9 5 7\n", "output": "Nicky\n"}, {"input": "10 2\n3 10 10 7 6 10 9 9 1 7\n", "output": "Kevin\n"}, {"input": "10 1\n5 6 3 10 6 6 1 1 5 3\n", "output": "Kevin\n"}, {"input": "2 3\n1000000000 1000000000\n", "output": "Nick... | code_stdio |
[
{
"content": "Quickly after finishing the tutorial of the online game ATChat, you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the friendliness of Player i is A_i.\nThe N players will arrive at the place one by on... | [{"input": "7\n-1 100 -2 1 -1 -1 18", "output": "137\n"}, {"input": "7\n-1 111 -2 2 -1 -16 3", "output": "120\n"}, {"input": "7\n-1 111 -2 2 -1 -24 4", "output": "122\n"}, {"input": "7\n-1 111 -2 2 -2 -16 6", "output": "126\n"}, {"input": "7\n0 101 -2 4 -1 -16 10", "output": "129\n"}, {"input": "7\n0 100 -2 4 -1 -27 10... | code_stdio |
[
{
"content": "For his computer science class, Jacob builds a model tree with sticks and balls containing n nodes in the shape of a tree. Jacob has spent a_{i} minutes building the i-th ball in the tree.\n\nJacob's teacher will evaluate his model and grade Jacob based on the effort he has put in. However, she do... | [{"input": "10 10\n794273 814140 758469 932911 607860 683826 1479233 652494 952171 698608\n1 3\n3 8\n2 7\n2 1\n2 9\n3 10\n6 4\n9 6\n3 5\n", "output": "607860\n"}, {"input": "10 10\n794273 594029 758469 932911 607860 683826 1479233 652494 952171 698608\n1 3\n3 8\n2 7\n2 1\n2 9\n3 10\n6 4\n9 6\n3 5\n", "output": "594029\... | code_stdio |
[
{
"content": "# Story&Task\n There are three parties in parliament. The \"Conservative Party\", the \"Reformist Party\", and a group of independants.\n\n You are a member of the “Conservative Party” and you party is trying to pass a bill. The “Reformist Party” is trying to block it.\n\n In order for a bill to p... | [{"input": "13\n4\n7", "output": "[-1]", "fn_name": "pass_the_bill"}, {"input": "11\n4\n6", "output": "[-1]", "fn_name": "pass_the_bill"}, {"input": "16\n7\n8", "output": "[-1]", "fn_name": "pass_the_bill"}, {"input": "16\n1\n8", "output": "[-1]", "fn_name": "pass_the_bill"}, {"input": "11\n4\n1", "output": "[2]", "fn_... | code_functional |
[
{
"content": "An army of n droids is lined up in one row. Each droid is described by m integers a_1, a_2, ..., a_{m}, where a_{i} is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of maximum length. He has m weapons, the i-th weapon ca... | [{"input": "49 2 1971\n794 866\n401 575\n341 83\n103 208\n352 134\n260 878\n497 931\n630 570\n885 464\n23 663\n60 1461\n416 870\n955 405\n392 961\n530 258\n73 404\n736 923\n44 436\n594 314\n904 138\n980 163\n76 720\n879 809\n81 838\n263 599\n218 139\n659 493\n1044 754\n679 302\n490 7\n204 530\n184 758\n114 849\n113 649... | code_stdio |
[
{
"content": "Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.\n\nThe ticket is considered lucky if the sum of first three digits ... | [{"input": "000000\n", "output": "0\n"}, {"input": "123456\n", "output": "2\n"}, {"input": "111000\n", "output": "1\n"}, {"input": "120111\n", "output": "0\n"}, {"input": "999999\n", "output": "0\n"}, {"input": "199880\n", "output": "1\n"}, {"input": "899889\n", "output": "1\n"}, {"input": "899888\n", "output": "1\n"},... | code_stdio |
[
{
"content": "There is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so that I can play with everyone in this game, but sadly there is no opponent to play against. I'm not the... | [{"input": "10\n4 17 1 9 5 18 2 3 2 1\n8 12 6 5 10 5 4 4 7 6\n5\n4 3 2 1 1\n2 4 4 4 4\n4\n1 1 3 2\n5 3 2 1\n0", "output": "1\nNA\nNA\n"}, {"input": "10\n4 17 1 9 5 18 2 3 2 1\n8 12 6 5 10 5 4 4 7 6\n5\n4 3 2 1 1\n2 4 4 4 4\n4\n2 1 3 2\n5 3 2 1\n0", "output": "1\nNA\nNA\n"}, {"input": "10\n4 17 1 9 5 18 2 3 2 1\n8 12 6 ... | code_stdio |
[
{
"content": "Consider a game, wherein the player has to guess a target word. All the player knows is the length of the target word.\n\nTo help them in their goal, the game will accept guesses, and return the number of letters that are in the correct position.\n\nWrite a method that, given the correct word and ... | [{"input": "\"abcde\"\n\"abcde\"", "output": "[5]", "fn_name": "count_correct_characters"}, {"input": "\"same\"\n\"same\"", "output": "[4]", "fn_name": "count_correct_characters"}, {"input": "\"dog\"\n\"car\"", "output": "[0]", "fn_name": "count_correct_characters"}, {"input": "\"dog\"\n\"god\"", "output": "[1]", "fn_n... | code_functional |
[
{
"content": "The Zoo in the Grid Kingdom is represented by an infinite grid. The Zoo has n observation binoculars located at the OX axis. For each i between 1 and n, inclusive, there exists a single binocular located at the point with coordinates (i, 0). There are m flamingos in the Zoo, located at points with... | [{"input": "3 10\n1000000000 1000000000\n1000000000 999999999\n1000000000 999999998\n1000010000 1199925182\n1000000000 999999996\n1000000000 999999995\n1000000000 999999994\n1000000000 999999993\n1000000000 999999992\n1000000000 999999991\n", "output": "3\n"}, {"input": "3 10\n1000000000 1000000000\n1000000000 99999999... | code_stdio |
[
{
"content": "New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.\n\nVasya's verse contains $n$ parts. It takes $a_i$ seconds to recite the $i$-th part. Vasya can't change the order of parts in the verse: firstly he recites the part which takes $a_1$ seconds... | [{"input": "1\n50 1\n2 1 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 10000... | code_stdio |
[
{
"content": "After Vitaly was expelled from the university, he became interested in the graph theory.\n\nVitaly especially liked the cycles of an odd length in which each vertex occurs at most once.\n\nVitaly was wondering how to solve the following problem. You are given an undirected graph consisting of n ve... | [{"input": "5 5\n1 2\n2 3\n3 4\n4 5\n5 1\n", "output": "0 1\n"}, {"input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 1\n", "output": "0 1\n"}, {"input": "9 5\n1 2\n2 3\n3 4\n4 5\n5 1\n", "output": "0 1\n"}, {"input": "100000 0\n", "output": "3 166661666700000\n"}, {"input": "59139 1\n10301 5892\n", "output": "2 59137\n"}, {"input": ... | code_stdio |
[
{
"content": "You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M.\n\nEdge i connects Vertex a_i and b_i bidirectionally.\n\nDetermine if three circuits (see Notes) can be formed using each of the edges exact... | [{"input": "18 27\n17 9\n12 15\n18 17\n13 18\n13 1\n5 7\n12 1\n14 5\n15 11\n14 6\n1 9\n5 1\n18 16\n4 6\n7 2\n7 11\n6 3\n12 14\n5 3\n10 5\n5 8\n10 15\n3 15\n9 8\n7 15\n2 16\n18 15", "output": "No\n"}, {"input": "18 15\n17 9\n12 15\n18 17\n13 18\n13 1\n5 7\n12 1\n14 5\n15 11\n14 6\n1 9\n5 1\n18 16\n4 6\n7 2\n7 11\n6 3\n1... | code_stdio |
[
{
"content": "A long time ago in some far country lived king Copa. After the recent king's reform, he got so large powers that started to keep the books by himself.\n\nThe total income A of his kingdom during 0-th year is known, as well as the total income B during n-th year (these numbers can be negative — it ... | [{"input": "-1 -512 10\n", "output": "No solution\n"}, {"input": "-3 -768 13\n", "output": "No solution\n"}, {"input": "-173 373 3\n", "output": "No solution\n"}, {"input": "-521 526 1\n", "output": "No solution\n"}, {"input": "-1 -512 19\n", "output": "No solution\n"}, {"input": "-2 -768 13\n", "output": "No solution\... | code_stdio |
[
{
"content": "You're given a row with $n$ chairs. We call a seating of people \"maximal\" if the two following conditions hold: There are no neighbors adjacent to anyone seated. It's impossible to seat one more person without violating the first rule. \n\nThe seating is given as a string consisting of zeros a... | [{"input": "459\n000111000101010000100001001010111110011011010001100101111010111011101110111101111101100101100011011001100110001001111001101000111001011100110100011111011111000010000110010011100110011011111110011100001101001111000100111011001000001011111100110100001001001100101011100001110110100101011011110100100111101... | code_stdio |
[
{
"content": "Given an array of integers your solution should find the smallest integer. \n\nFor example:\n\n- Given `[34, 15, 88, 2]` your solution will return `2`\n- Given `[34, -345, -1, 100]` your solution will return `-345`\n\nYou can assume, for the purpose of this kata, that the supplied array will not b... | [{"input": "[0, 18446744073709551616, -18446744073709551617, 18446744073709551616, 18446744073709551616]", "output": "[-18446744073709551617]", "fn_name": "find_smallest_int"}, {"input": "[0, -18446744073709551615, 18446744073709551616]", "output": "[-18446744073709551615]", "fn_name": "find_smallest_int"}, {"input": "... | code_functional |
[
{
"content": "Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right. \n\nSpy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several steps. During one step the spy keeping the impo... | [{"input": "100000 1 11500 86289\n1 86 75626\n", "output": "XRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR... | code_stdio |
[
{
"content": "Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Eac... | [{"input": "10\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "64000000\n"}, {"input": "10\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "64000000\n"}, {"input": "10\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 ... | code_stdio |
[
{
"content": "In Aizu prefecture, we decided to create a new town to increase the population. To that end, we decided to cultivate a new rectangular land and divide this land into squares of the same size. The cost of developing this land is proportional to the number of plots, but the prefecture wants to minim... | [{"input": "10 29 10", "output": "2900\n"}, {"input": "10 29 13", "output": "3770\n"}, {"input": "4 -1 104", "output": "-416\n"}, {"input": "20 -1 18", "output": "-360\n"}, {"input": "12 -1 14", "output": "-168\n"}, {"input": "3 -1 43", "output": "-129\n"}, {"input": "10 29 5", "output": "1450\n"}, {"input": "10 7 16",... | code_stdio |
[
{
"content": "Anfisa the monkey learns to type. She is yet unfamiliar with the \"space\" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into k lines not shorter than a and not longer than b, for the ... | [{"input": "200 1 200\nlycjpjrpkgxrkfvutlcwglghxadttpihmlpphwfttegfpimjxintjdxgqfhzrmxfcfojnxruhyfynlzgpxjeobjyxarsfxaqeogxfzvdlwsimupkwujudtfenryulzvsiazneyibqtweeuxpzrbumqqswjasliyjnnzfzuvthhzcsgfljikkajqkpjftztrzpjneaxqg\n", "output": "l\ny\nc\nj\np\nj\nr\np\nk\ng\nx\nr\nk\nf\nv\nu\nt\nl\nc\nw\ng\nl\ng\nh\nx\na\nd\n... | code_stdio |
[
{
"content": "The famous global economic crisis is approaching rapidly, so the states of Berman, Berance and Bertaly formed an alliance and allowed the residents of all member states to freely pass through the territory of any of them. In addition, it was decided that a road between the states should be built t... | [{"input": "10 10\n##.#..#.#2\n...###....\n#..#....##\n.....#....\n.#........\n.....#####\n...#..#...\n....###...\n###.##...#\n.#...1#.3.\n", "output": "-1\n"}, {"input": "10 10\n#...33.#.#\n#.#.33.#1.\n2.....#.11\n222#.#.#..\n####...#.#\n#.........\n.#....#...\n..#..#.##.\n##.....#.#\n#..#....#.\n", "output": "12\n"},... | code_stdio |
[
{
"content": "Problem statement\n\nA $ 2 $ human-player match-up game tournament is about to take place in front of Kyoto University Camphor Tree.\n\nThere are $ 2 ^ N $ participants in this tournament, numbered from $ 1 $ to $ 2 ^ N $.\n\nWinning or losing when $ 2 $ of participants fight is represented by the... | [{"input": "2\n010\n-2 1 1 -1", "output": "-2\n-2\n-2\n-2\n"}, {"input": "2\n001\n-2 1 0 -1", "output": "-1\n-2\n-1\n-2\n"}, {"input": "2\n100\n-2 1 0 -1", "output": "-2\n-1\n-2\n-1\n"}, {"input": "2\n001\n-1 1 0 0", "output": "-1\n-1\n-1\n-1\n"}, {"input": "2\n010\n-2 1 0 -1", "output": "-2\n0\n-2\n0\n"}, {"input": "2... | code_stdio |
[
{
"content": "As a New Year's gift, Dolphin received a string s of length 19.\n\nThe string s has the following format: [five lowercase English letters],[seven lowercase English letters],[five lowercase English letters].\n\nDolphin wants to convert the comma-separated string s into a space-separated string.\n\n... | [{"input": "happy,newyear,enjoy\n", "output": "happy newyear enjoy\n"}, {"input": "haiku,atcoder,tasks\n", "output": "haiku atcoder tasks\n"}, {"input": "abcde,fghihgf,edcba\n", "output": "abcde fghihgf edcba\n"}, {"input": "mzbmw,yydiadt,coueg\n", "output": "mzbmw yydiadt coueg\n"}, {"input": "dbyfw,rpwbpuv,ifnua\n", ... | code_stdio |
[
{
"content": "In the year of $30XX$ participants of some world programming championship live in a single large hotel. The hotel has $n$ floors. Each floor has $m$ sections with a single corridor connecting all of them. The sections are enumerated from $1$ to $m$ along the corridor, and all sections with equal n... | [{"input": "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n2 1 15 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 5 1\n6 1 9 1\n", "output": "3\n4\n6\n3\n3\n4\n3\n3\n4\n3\n"}, {"input": "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n2 1 15 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 0... | code_stdio |
[
{
"content": "You have N items that you want to put them into a knapsack. Item i has value vi and weight wi.\n\nYou want to find a subset of items to put such that:\n\n* The total value of the items is as large as possible.\n* The items have combined weight at most W, that is capacity of the knapsack.\n\n\n\nFi... | [{"input": "1 10\n15 4\n0 3\n4 1\n13 3", "output": "15\n"}, {"input": "1 10\n27 4\n0 0\n6 1\n13 3", "output": "27\n"}, {"input": "1 10\n39 4\n1 0\n6 1\n13 3", "output": "39\n"}, {"input": "1 10\n24 4\n0 3\n5 1\n13 5", "output": "24\n"}, {"input": "1 10\n29 4\n0 3\n5 1\n16 5", "output": "29\n"}, {"input": "2 8\n33 1\n4 ... | code_stdio |
[
{
"content": "Given a time in AM/PM format as a string, convert it to military (24-hour) time as a string.\n\nMidnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock\n\n\nSample Input: 07:05:45PM\nSample Output: 19:05:45\... | [{"input": "\"12:00:01AM\"", "output": "[\"00:00:01\"]", "fn_name": "get_military_time"}, {"input": "\"01:02:03AM\"", "output": "[\"01:02:03\"]", "fn_name": "get_military_time"}, {"input": "\"02:04:05AM\"", "output": "[\"02:04:05\"]", "fn_name": "get_military_time"}, {"input": "\"03:06:07AM\"", "output": "[\"03:06:07\"... | code_functional |
[
{
"content": "Write a function that returns the index of the first occurence of the word \"Wally\". \"Wally\" must not be part of another word, but it can be directly followed by a punctuation mark. If no such \"Wally\" exists, return -1.\n\n\nExamples:\n\n\"Wally\" => 0\n\n\"Where's Wally\" => 8\n\n\"Where's... | [{"input": "\"Walley ,Wally -Wally ;Wally +Wally :Wally\"", "output": "[-1]", "fn_name": "wheres_wally"}, {"input": "\"Walley Wally, Wally- Wally: Wally+ Wally:\"", "output": "[7]", "fn_name": "wheres_wally"}, {"input": "\"wally mollyWally Wallybrolly 'Wally\"", "output": "[-1]", "fn_name": "wheres_wally"}, {"input": "... | code_functional |
[
{
"content": "There are N dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.\n\nWhen Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happiness.\n\nStarting from Takahashi, they altern... | [{"input": "6\n-1 0000110001\n0 0110011010\n-1 1110000001\n-1 0100100000\n2 1100111110\n-1 1000010001", "output": "-1210232124\n"}, {"input": "6\n-1 0000110011\n0 0110011010\n-1 1110000001\n-1 0100100100\n2 1100111110\n-1 1000010001", "output": "-1210232134\n"}, {"input": "6\n-2 1000010101\n-1 0110011010\n0 1100000001\... | code_stdio |
[
{
"content": "Your company, [Congo Pizza](http://interesting-africa-facts.com/Africa-Landforms/Congo-Rainforest-Facts.html), is the second-largest online frozen pizza retailer. You own a number of international warehouses that you use to store your frozen pizzas, and you need to figure out how many crates of pi... | [{"input": "32\n64\n16", "output": "[13824]", "fn_name": "box_capacity"}, {"input": "80\n40\n20", "output": "[27000]", "fn_name": "box_capacity"}, {"input": "70\n60\n15", "output": "[25740]", "fn_name": "box_capacity"}, {"input": "20\n20\n20", "output": "[3375]", "fn_name": "box_capacity"}, {"input": "53\n21\n13", "out... | code_functional |
[
{
"content": "Alice and Bob are playing a game. They are given an array $A$ of length $N$. The array consists of integers. They are building a sequence together. In the beginning, the sequence is empty. In one turn a player can remove a number from the left or right side of the array and append it to the sequen... | [{"input": "6\n7 4 0 0 17 11\n", "output": "Alice\n"}, {"input": "6\n7 6 0 0 17 11\n", "output": "Alice\n"}, {"input": "6\n7 6 0 0 17 12\n", "output": "Alice\n"}, {"input": "6\n6 6 0 0 17 12\n", "output": "Alice\n"}, {"input": "6\n4 3 2 0 12 11\n", "output": "Alice\n"}, {"input": "6\n4 3 0 -1 12 9\n", "output": "Alice\... | code_stdio |
[
{
"content": "Sagheer is working at a kindergarten. There are n children and m different toys. These children use well-defined protocols for playing with the toys:\n\n * Each child has a lovely set of toys that he loves to play with. He requests the toys one after another at distinct moments of time. A child s... | [{"input": "13 18 27 13\n1 1\n1 2\n1 3\n1 4\n1 17\n2 5\n2 1\n3 6\n3 2\n5 14\n5 3\n4 4\n6 9\n6 3\n7 8\n7 3\n8 7\n8 9\n10 11\n10 14\n11 10\n11 15\n11 11\n9 12\n9 11\n12 10\n13 15\n6 8\n6 14\n6 1\n6 17\n6 18\n11 12\n11 1\n11 1\n11 17\n1 18\n1 12\n1 7\n1 14\n", "output": "3\n0\n0\n0\n0\n4\n0\n0\n0\n0\n13\n13\n13\n"}, {"inp... | code_stdio |
[
{
"content": "You are given an array a of n positive integers.\n\nYou can use the following operation as many times as you like: select any integer 1 ≤ k ≤ n and do one of two things: \n\n * decrement by one k of the first elements of the array. \n * decrement by one k of the last elements of the array. \n\n\... | [{"input": "4\n3\n1 2 1\n5\n11 14 9 10 8\n5\n0 3 1 4 1\n4\n5 2 1 10\n", "output": "YES\nYES\nNO\nYES\n"}, {"input": "4\n3\n1 2 1\n5\n11 14 9 6 10\n5\n0 3 1 2 1\n4\n5 2 1 10\n", "output": "YES\nYES\nNO\nYES\n"}, {"input": "4\n3\n0 2 1\n5\n11 14 9 10 8\n5\n0 3 1 4 1\n4\n5 2 1 10\n", "output": "NO\nYES\nNO\nYES\n"}, {"inp... | code_stdio |
[
{
"content": "You are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft $k$ torches. One torch can be crafted using one stick and one coal.\n\nHopefully, you've met a very handsome wandering trader who has two trade offers: exchange $1$ stick for $x$ sticks (you lose... | [{"input": "5\n2 1 5\n42 13 24\n12 11 12\n1000000000 1000000000 1000000000\n2 1000000000 1000000000\n", "output": "14\n33\n25\n2000000003\n1000000001999999999\n"}, {"input": "5\n2 2 5\n42 13 24\n12 11 12\n1000000000 1000000000 1000000000\n2 1000000000 1000000000\n", "output": "19\n33\n25\n2000000003\n100000000199999999... | code_stdio |
[
{
"content": "In this Kata, we are going to see how a Hash (or Map or dict) can be used to keep track of characters in a string. \n\nConsider two strings `\"aabcdefg\"` and `\"fbd\"`. How many characters do we have to remove from the first string to get the second string? Although not the only way to solve thi... | [{"input": "\"abcdexyz\"\n\"yxz\"", "output": "[5]", "fn_name": "solve"}, {"input": "\"abdegfg\"\n\"ffdb\"", "output": "[0]", "fn_name": "solve"}, {"input": "\"aabcdefg\"\n\"fbd\"", "output": "[5]", "fn_name": "solve"}, {"input": "\"abcxyz\"\n\"ayxz\"", "output": "[2]", "fn_name": "solve"}, {"input": "\"xyz\"\n\"yxxz\"... | code_functional |
[
{
"content": "Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist of n nodes connected with minimum possible number of wires into one network (a wire directly connects two nodes). Exactly k of the nodes should be exit-nodes, that means that e... | [{"input": "2132 164\n", "output": "26\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 18\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n1 25\n1 26\n1 27\n1 28\n1 29\n1 30\n1 31\n1 32\n1 33\n1 34\n1 35\n1 36\n1 37\n1 38\n1 39\n1 40\n1 41\n1 42\n1 43\n1 44\n1 45\n1 46\n1 47\n1 48\n1 49\n... | code_stdio |
[
{
"content": "A new airplane SuperPuperJet has an infinite number of rows, numbered with positive integers starting with 1 from cockpit to tail. There are six seats in each row, denoted with letters from 'a' to 'f'. Seats 'a', 'b' and 'c' are located to the left of an aisle (if one looks in the direction of the... | [{"input": "1000000000000000000d\n", "output": "3999999999999999994\n"}, {"input": "1000000000000000000a\n", "output": "3999999999999999995\n"}, {"input": "1000000000000000000e\n", "output": "3999999999999999993\n"}, {"input": "1000000000000000000f\n", "output": "3999999999999999992\n"}, {"input": "1000000000000000000c... | code_stdio |
[
{
"content": "Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!).\n\nLet us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items independently from each other. They show the items with the... | [{"input": "1457057352\nR\nPSRSRSSRPSRRSSSRSRRPRSPPSPPRPSRRPPRSRRSPPSPPSPRPRPRPSSRPRPRRPSSSSSPSRRRPSRSPPSPSRRSPSSRSRPSPRRRSRRRPSPRPPRPPPPPRPPRRRRRRPPRRSPSPSSPSSPRPRSPPRRRPSPSRSRRRRRPPPSRPRSPPSSRRRRPRPPRSPSSPRRRPPPPPRRSRSPRPPSRPRSRSRRPRRRPRSRSPRRRSRSSRPPPRRSRRSSRRPSRPPRSPSPRPRSSSRSSRRPSRRRRPSRRPPRPPRRPRSRPRSRRPPPPPSPPPS... | code_stdio |
[
{
"content": "The Smart Beaver from ABBYY invented a new message encryption method and now wants to check its performance. Checking it manually is long and tiresome, so he decided to ask the ABBYY Cup contestants for help.\n\nA message is a sequence of n integers a1, a2, ..., an. Encryption uses a key which is ... | [{"input": "80 6 99\n48 97 9 77 73 21 86 78 48 5 71 16 42 67 90 27 30 52 41 86 53 4 60 17 66 38 94 46 51 51 70 11 1 16 74 53 17 12 82 95 51 33 83 70 45 27 90 57 67 2 68 15 20 61 47 90 11 5 95 33 69 35 79 51 95 45 10 17 12 88 93 43 31 31 85 68 85 81 70 43\n47 92 59 85 73 38\n", "output": "95 38 9 63 33 19 84 76 46 3 69 ... | code_stdio |
[
{
"content": "An array is called `zero-balanced` if its elements sum to `0` and for each positive element `n`, there exists another element that is the negative of `n`. Write a function named `ìsZeroBalanced` that returns `true` if its argument is `zero-balanced` array, else return `false`. Note that an `empty ... | [{"input": "[-1, 1, -2, 2, -2, -2, -4, 4]", "output": "[false]", "fn_name": "is_zero_balanced"}, {"input": "[0, 0, 0, 0, 0, 0]", "output": "[true]", "fn_name": "is_zero_balanced"}, {"input": "[0, 0, 0, 0, 0]", "output": "[true]", "fn_name": "is_zero_balanced"}, {"input": "[3, -2, -1]", "output": "[false]", "fn_name": "... | code_functional |
[
{
"content": "Given a tree T with non-negative weight, find the height of each node of the tree. For each node, the height is the distance to the most distant leaf from the node.\n\nConstraints\n\n* 1 ≤ n ≤ 10,000\n* 0 ≤ wi ≤ 1,000\n\nInput\n\n\nn\ns1 t1 w1\ns2 t2 w2\n:\nsn-1 tn-1 wn-1\n\n\nThe first line consi... | [{"input": "4\n0 2 2\n1 2 2\n2 3 12", "output": "14\n14\n12\n14\n"}, {"input": "4\n0 2 2\n1 2 2\n2 3 21", "output": "23\n23\n21\n23\n"}, {"input": "4\n0 2 2\n1 2 2\n2 3 31", "output": "33\n33\n31\n33\n"}, {"input": "4\n0 2 2\n1 2 3\n2 3 31", "output": "33\n34\n31\n34\n"}, {"input": "4\n0 2 4\n1 2 3\n2 3 31", "output": ... | code_stdio |
[
{
"content": "Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones.\n\nOnce he thought about a string of length n consisting of zeroes and ones. Consider the following operation: we choose any two adjacent positions in the string, and if o... | [{"input": "9\n011111101\n", "output": "5\n"}, {"input": "9\n011111111\n", "output": "7\n"}, {"input": "9\n011101111\n", "output": "5\n"}, {"input": "9\n011101101\n", "output": "3\n"}, {"input": "9\n001101101\n", "output": "1\n"}, {"input": "9\n001111101\n", "output": "3\n"}, {"input": "9\n001011101\n", "output": "1\n"... | code_stdio |
[
{
"content": "# RegExp Fun #1 - When I miss few days of gym\n\n## Disclaimer\n\nThe background story of this Kata is 100% fiction. Any resemblance to real people or real events is **nothing more than a coincidence** and should be regarded as such.\n\n## Background Story\n\nYou are a person who loves to go to t... | [{"input": "\"probably Probably probably Probably probably Probably probably Probably probably Probably\"", "output": "[\"prolly Prolly prolly Prolly prolly Prolly prolly Prolly prolly Prolly\"]", "fn_name": "gym_slang"}, {"input": "\"instagram Instagram instagram Instagram instagram Instagram instagram Instagram insta... | code_functional |
[
{
"content": "In this problem, we use the 24-hour clock.\n\nTakahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is the length of the period in which he can sta... | [{"input": "17 -4 435 10 -1", "output": "25095\n"}, {"input": "17 -4 722 10 -1", "output": "42315\n"}, {"input": "-1 -3 436 11 -1", "output": "26235\n"}, {"input": "-1 -3 239 11 -1", "output": "14415\n"}, {"input": "-1 -5 239 11 -1", "output": "14417\n"}, {"input": "10 -1 206 6 -1", "output": "11768\n"}, {"input": "15 ... | code_stdio |
[
{
"content": "An elementary school student Takahashi has come to a variety store.\nHe has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it?\nNote that he lives in Takahashi Kingdom, and may have coins that do not exist in Japan.\n\n-----Cons... | [{"input": "1977 001 1111", "output": "Yes\n"}, {"input": "1977 011 1111", "output": "Yes\n"}, {"input": "1977 011 1110", "output": "Yes\n"}, {"input": "1977 011 0110", "output": "Yes\n"}, {"input": "1677 011 0110", "output": "Yes\n"}, {"input": "1677 011 0100", "output": "Yes\n"}, {"input": "1677 111 0100", "output": ... | code_stdio |
[
{
"content": "You are given a square grid with $n$ rows and $n$ columns, where each cell has a non-negative integer written in it. There is a chip initially placed at the top left cell (the cell with coordinates $(1, 1)$). You need to move the chip to the bottom right cell (the cell with coordinates $(n, n)$).\... | [{"input": "7\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1\n1000000000 1000000000 1000000000 1000000000 1000000000 1 1000000000\n1000000000 1000000000 1000000000 1000000000 1 1000000000 1000000000\n1000000000 1000000000 1000000000 1 1000000000 1000000000 1000000000\n1000000000 1000000000 1 10000... | code_stdio |
[
{
"content": "One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.\n\nAs mom wasn't home, Vasya decided to play with names: he chose three integers ... | [{"input": "30 10\nUTNTGOKZYJ\nQHOUHNYZVW\nLTVGHJRZVW\nMZHYHOLZYJ\nERYEUEPZYE\nUZDBFTURYJ\nRVSMQTIZGW\nWDJQHMIRYY\nKCORHQPZYE\nRRPLFOZZVY\nJTXMFNNNYJ\nMVTGGOZZVV\nEHAFFNUZVF\nLBRNWJZNYE\nJVMOHTPZYJ\nWTARFJLZVV\nLVJCWOURVW\nLCLQFJYRVV\nQVBVGNJRYF\nNTZGHOLRYE\nMGQKHOUPYJ\nRRSSBXPZYJ\nRYCRGTLZYJ\nJRDEGNKRVW\nRZKFGHYRVG\nM... | code_stdio |
[
{
"content": "Write a program that extracts n different numbers from the numbers 0 to 100 and outputs the number of combinations that add up to s. Each n number is from 0 to 100, and the same number cannot be used in one combination. For example, if n is 3 and s is 6, the combination of the three numbers totali... | [{"input": "4 133\n-1 0\n0 0", "output": "15011\n0\n"}, {"input": "4 102\n-1 0\n0 0", "output": "7153\n0\n"}, {"input": "8 80\n2 -2\n0 0", "output": "37638\n0\n"}, {"input": "3 133\n-1 0\n0 0", "output": "1202\n0\n"}, {"input": "6 80\n2 -1\n0 0", "output": "28009\n0\n"}, {"input": "6 98\n2 -1\n0 0", "output": "81979\n0... | code_stdio |
[
{
"content": "The capital of Berland looks like a rectangle of size n × m of the square blocks of same size.\n\nFire!\n\nIt is known that k + 1 blocks got caught on fire (k + 1 ≤ n·m). Those blocks are centers of ignition. Moreover positions of k of these centers are known and one of these stays unknown. All k ... | [{"input": "1000000000 1010000000 10\n668983398 843926244\n730038846 389721428\n400508549 779159281\n683648123 559948749\n105869012 181419826\n391396726 503295408\n248489591 686114055\n102102370 108241714\n610800354 28286278\n587730768 379340837\n", "output": "331016602\n"}, {"input": "1000000000 1000000000 10\n9462185... | code_stdio |
[
{
"content": "A string is called bracket sequence if it does not contain any characters other than \"(\" and \")\". A bracket sequence is called regular (shortly, RBS) if it is possible to obtain correct arithmetic expression by inserting characters \"+\" and \"1\" into this sequence. For example, \"\", \"(())\... | [{"input": "20\n(())(()()())(())()()\n", "output": "01100111111001100000\n"}, {"input": "20\n(()()()())(()())()()\n", "output": "01111111100111100000\n"}, {"input": "20\n(())(())(())()(())()\n", "output": "01100110011000011000\n"}, {"input": "20\n()((())((()))())(())\n", "output": "00010011011011100110\n"}, {"input": "... | code_stdio |
[
{
"content": "There are many freight trains departing from Kirnes planet every day. One day on that planet consists of $h$ hours, and each hour consists of $m$ minutes, where $m$ is an even number. Currently, there are $n$ freight trains, and they depart every day at the same time: $i$-th train departs at $h_i$... | [{"input": "10 24 60 8\n10 59\n21 56\n0 42\n21 27\n5 24\n5 53\n16 5\n5 22\n10 11\n10 46\n", "output": "1 5\n1 \n"}, {"input": "10 24 60 8\n10 59\n21 56\n0 42\n21 27\n5 24\n5 53\n16 5\n5 22\n10 11\n10 46\n", "output": "1 5\n1 \n"}, {"input": "9 24 60 21\n1 36\n2 35\n2 16\n2 55\n1 16\n0 35\n0 55\n1 56\n0 15\n", "output":... | code_stdio |
[
{
"content": "# A History Lesson\n\nThe Pony Express was a mail service operating in the US in 1859-60.\n\n\n\n\nIt reduced the time for messages to travel between the Atlantic and Pacific coasts to about 10 days, before it was made obsolete by the [transcontinental telegraph](https://en.wikipedia.org/wiki/Firs... | [{"input": "[90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,... | code_functional |
[
{
"content": "It's well known that the best way to distract from something is to do one's favourite thing. Job is such a thing for Leha.\n\nSo the hacker began to work hard in order to get rid of boredom. It means that Leha began to hack computers all over the world. For such zeal boss gave the hacker a vacatio... | [{"input": "15 17\n1 10 8\n5 19 1\n12 14 6\n9 19 8\n6 7 3\n5 11 9\n7 12 5\n17 20 8\n6 12 6\n11 19 4\n3 14 1\n15 19 10\n3 20 5\n5 19 9\n10 18 10\n", "output": "11\n"}, {"input": "15 17\n1 10 8\n5 19 1\n12 14 6\n9 19 8\n6 7 3\n5 11 9\n7 12 5\n17 20 8\n6 12 6\n11 19 4\n3 14 1\n15 19 10\n3 20 5\n5 19 9\n10 18 10\n", "outpu... | code_stdio |
[
{
"content": "International Carpenters Professionals Company (ICPC) is a top construction company with a lot of expert carpenters. What makes ICPC a top company is their original language.\n\nThe syntax of the language is simply given in CFG as follows:\n\n\nS -> SS | (S) | )S( | ε\n\n\nIn other words, a right ... | [{"input": "3\n-1 ( 10\n10 ) 5\n10 ) 5", "output": "No\nNo\nYes\n"}, {"input": "3\n-1 ( 0\n10 ) 4\n20 ( 4", "output": "Yes\nNo\nYes\n"}, {"input": "3\n-1 ) 10\n10 ( 12\n10 ( 7", "output": "No\nNo\nNo\n"}, {"input": "3\n-1 ( 10\n10 ( 12\n10 ( 7", "output": "No\nNo\nNo\n"}, {"input": "3\n-1 ) 10\n14 ( 12\n10 ( 7", "outpu... | code_stdio |
[
{
"content": "You have unweighted tree of $n$ vertices. You have to assign a positive weight to each edge so that the following condition would hold:\n\n For every two different leaves $v_{1}$ and $v_{2}$ of this tree, bitwise XOR of weights of all edges on the simple path between $v_{1}$ and $v_{2}$ has to be... | [{"input": "7\n1 2\n2 7\n3 4\n4 7\n5 6\n6 7\n", "output": "1 6\n"}, {"input": "7\n1 2\n2 6\n3 4\n4 7\n5 6\n6 7\n", "output": "3 6\n"}, {"input": "7\n1 2\n2 6\n3 4\n4 7\n5 6\n1 7\n", "output": "1 6\n"}, {"input": "7\n1 2\n2 7\n3 4\n4 7\n5 6\n6 1\n", "output": "1 6\n"}, {"input": "7\n1 2\n2 6\n3 4\n4 7\n5 6\n2 7\n", "out... | code_stdio |
[
{
"content": "Fox Ciel has some flowers: r red flowers, g green flowers and b blue flowers. She wants to use these flowers to make several bouquets. There are 4 types of bouquets:\n\n To make a \"red bouquet\", it needs 3 red flowers. To make a \"green bouquet\", it needs 3 green flowers. To make a \"blue bo... | [{"input": "1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"input": "1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"input": "1000000000 1100000000 1000000000\n", "output": "1033333333\n"}, {"input": "1137468270 1106087921 972974334\n", "output": "1072176841\n"}, {"input": "109786360... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.