question stringlengths 29 1.88k | test_input listlengths 0 10 | test_output listlengths 0 10 | test_time_limit int64 1 1 | test_method stringclasses 1
value |
|---|---|---|---|---|
Take an input string and return a string that is made up of the number of occurences of each english letter in the input followed by that letter, sorted alphabetically. The output string shouldn't contain chars missing from input (chars with 0 occurence); leave them out.
An empty string, or one with no letters, should... | [] | [] | 1 | stdio |
Mobile Display Keystrokes
Do you remember the old mobile display keyboards? Do you also remember how inconvenient it was to write on it?
Well, here you have to calculate how much keystrokes you have to do for a specific word.
This is the layout:
Return the amount of keystrokes of input str (! only letters, digits ... | [] | [] | 1 | stdio |
At a geometry lesson Bob learnt that a triangle is called right-angled if it is nondegenerate and one of its angles is right. Bob decided to draw such a triangle immediately: on a sheet of paper he drew three points with integer coordinates, and joined them with segments of straight lines, then he showed the triangle t... | [
"30 8 49 13 25 27\n",
"-67 49 89 -76 -37 87\n",
"34 74 -2 -95 63 -33\n",
"-66 24 8 -29 17 62\n",
"-10 -11 62 6 -12 -3\n",
"49 -7 19 -76 26 3\n",
"0 0 1 0 4 1\n",
"-50 -1 0 50 0 -50\n",
"0 0 1 0 2 1\n",
"-100 -100 100 100 -100 100\n"
] | [
"RIGHT\n",
"NEITHER\n",
"NEITHER\n",
"NEITHER\n",
"ALMOST\n",
"RIGHT\n",
"NEITHER\n",
"ALMOST\n",
"ALMOST\n",
"RIGHT\n"
] | 1 | stdio |
This kata is about multiplying a given number by eight if it is an even number and by nine otherwise.
Write your solution by modifying this code:
```python
def simple_multiplication(number) :
```
Your solution should implemented in the function "simple_multiplication". The inputs will be passed to it and it should... | [] | [] | 1 | stdio |
Description overhauled by V
---
I've invited some kids for my son's birthday, during which I will give to each kid some amount of candies.
Every kid hates receiving less amount of candies than any other kids, and I don't want to have any candies left - giving it to my kid would be bad for his teeth.
However, not ev... | [] | [] | 1 | stdio |
An bydrocarbon is an organic compound which contains only carbons and hydrogens. An isomer is a compound that has the same number of carbons but different structures. Heptane, for example, is a hydrocarbon with 7 carbons. It has nine isomers. The structural formula of three are shown in Figure 1. Carbons are represente... | [
"1\n6",
"1\n8",
"1\n12",
"1\n16",
"1\n1",
"1\n13",
"1\n25",
"1\n5",
"1\n2",
"1\n3"
] | [
"1\n26\n",
"1\n80\n",
"1\n728\n",
"1\n6560\n",
"1\n1\n",
"1\n1457\n",
"1\n1062881\n",
"1\n17\n",
"1\n2\n",
"1\n5\n"
] | 1 | stdio |
You are given an array $a$ consisting of $n$ integers.
You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$.
Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.
Recall that the contiguous subar... | [
"5\n1 2 5 3 4\n",
"2\n1 2\n",
"7\n6 5 4 3 2 4 3\n",
"4\n6 5 4 3\n",
"2\n2 1\n",
"5\n111 111 100 22 3\n",
"4\n26 18 26 9\n",
"2\n1 1\n",
"5\n1 2 3 4 4\n",
"7\n5 2 3 4 5 6 3\n"
] | [
"4\n",
"2\n",
"2\n",
"1\n",
"1\n",
"1\n",
"2\n",
"1\n",
"4\n",
"5\n"
] | 1 | stdio |
Vasya and Petya wrote down all integers from 1 to n to play the "powers" game (n can be quite large; however, Vasya and Petya are not confused by this fact).
Players choose numbers in turn (Vasya chooses first). If some number x is chosen at the current turn, it is forbidden to choose x or all of its other positive in... | [
"1\n",
"2\n",
"8\n",
"52\n",
"53\n",
"3\n",
"4\n",
"5\n",
"6\n",
"7\n"
] | [
"Vasya\n",
"Petya\n",
"Petya\n",
"Petya\n",
"Vasya\n",
"Vasya\n",
"Vasya\n",
"Vasya\n",
"Vasya\n",
"Vasya\n"
] | 1 | stdio |
## Task:
You have to create a function `isPronic` to check whether the argument passed is a Pronic Number and return true if it is & false otherwise.
### Description:
`Pronic Number` -A pronic number, oblong number, rectangular number or heteromecic number, is a number which is the product of two consecutive integers... | [] | [] | 1 | stdio |
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are:
2332
110011
54322345
You'll be given 2 numbers as arguments: ```(num,s)```. Write a function which returns an array of ```s``` number of numerical palindromes tha... | [] | [] | 1 | stdio |
The cows have just learned what a primitive root is! Given a prime p, a primitive root $\operatorname{mod} p$ is an integer x (1 ≤ x < p) such that none of integers x - 1, x^2 - 1, ..., x^{p} - 2 - 1 are divisible by p, but x^{p} - 1 - 1 is.
Unfortunately, computing primitive roots can be time consuming, so the cows ... | [
"3\n",
"5\n",
"7\n",
"11\n",
"17\n",
"19\n",
"1583\n",
"997\n",
"2\n",
"1987\n"
] | [
"1\n",
"2\n",
"2\n",
"4\n",
"8\n",
"6\n",
"672\n",
"328\n",
"1\n",
"660\n"
] | 1 | stdio |
There is data that records the altitude of mountains that have been climbed so far. Create a program that reads this data and outputs the elevation difference between the highest and lowest mountains.
Input
The input is given in the following format:
Mountain height
...
...
The height of the mountain is given o... | [
"3776.5765005393655\n1819.0\n645.2\n2004.1\n1208.6",
"3777.502968017379\n1819.0\n645.2\n2004.1\n1208.6",
"3778.4165917426626\n1819.0\n645.2\n2004.2183724359945\n1208.6",
"3779.3515835085277\n1819.169376096264\n645.2\n2004.5930566110492\n1208.6",
"3779.3515835085277\n1819.169376096264\n645.463437143232\n2005... | [
"3131.37650054\n",
"3132.30296802\n",
"3133.21659174\n",
"3134.15158351\n",
"3133.88814637\n",
"3133.51486032\n",
"3133.4686799\n",
"3134.15227106\n",
"3134.19757792\n",
"3133.42335347\n"
] | 1 | stdio |
There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each worker except the chief has exactly one immediate superior.
There was a request to each of the workers to tell how how many superiors (not only immediate). Worker's superiors are his immediate ... | [
"3 2\n2 1 1\n",
"3 3\n2 1 2\n",
"7 1\n4 4 6 6 6 6 5\n",
"3 2\n2 0 1\n",
"3 1\n2 1 1\n",
"3 1\n0 1 2\n",
"10 6\n3 0 0 0 0 0 0 1 0 0\n",
"5 5\n0 1 1 0 0\n",
"3 2\n2 2 1\n",
"5 1\n0 0 1 3 4\n"
] | [
"1\n",
"1\n",
"4\n",
"0\n",
"1\n",
"0\n",
"7\n",
"2\n",
"1\n",
"1\n"
] | 1 | stdio |
We have a string S consisting of lowercase English letters.
If the length of S is at most K, print S without change.
If the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.
-----Constraints-----
- K is an integer between 1 and 100 (inclusive).
- S is a ... | [
"7\nnikoandsolstice\n",
"40\nferelibenterhominesidquodvoluntcredunt\n",
"1\nz\n",
"2\nz\n",
"9\ncfmfbfbnyigsejhwuhs\n",
"35\npemetdsjkmxuadhyrsyngoawfywyylglksmprtues\n",
"26\newwcjswgwdeijtbfkrlojvygql\n",
"27\nohgmguyzmrwntvrxzzwxtxzlbuc\n",
"51\neelettrhmmoakwpdmfkrvyhtxxtxrxcdimffomblxtoicov\n",... | [
"nikoand...\n",
"ferelibenterhominesidquodvoluntcredunt\n",
"z\n",
"z\n",
"cfmfbfbny...\n",
"pemetdsjkmxuadhyrsyngoawfywyylglksm...\n",
"ewwcjswgwdeijtbfkrlojvygql\n",
"ohgmguyzmrwntvrxzzwxtxzlbuc\n",
"eelettrhmmoakwpdmfkrvyhtxxtxrxcdimffomblxtoicov\n",
"vyfuehycdnzpmjojdak\n"
] | 1 | stdio |
Kavi has 2n points lying on the OX axis, i-th of which is located at x = i.
Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows:
Consider n segments with ends at the points in correspondent pairs. The pairing is called good, if fo... | [
"333625\n",
"693549\n",
"757606\n",
"1000000\n",
"999228\n",
"443013\n",
"825195\n",
"160945\n",
"489857\n",
"563368\n"
] | [
"668510586",
"721751076",
"162462618",
"126330412",
"996260068",
"95736273",
"937989636",
"650435832",
"498405873",
"170858430"
] | 1 | stdio |
Snuke lives at position x on a number line.
On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.
Snuke decided to get food delivery from the closer of stores A and B.
Find out which store is closer to Snuke's residence.
Here, the distance between two points s and t... | [
"5 2 7\n",
"1 999 1000\n",
"1 999 0000",
"1 381 1110",
"5 1 7",
"1 999 0100",
"10 1 7",
"1 999 0101",
"10 2 7",
"1 999 0001"
] | [
"B\n",
"A\n",
"B\n",
"A\n",
"B\n",
"B\n",
"B\n",
"B\n",
"B\n",
"B\n"
] | 1 | stdio |
Simple transposition is a basic and simple cryptography technique. We make 2 rows and put first a letter in the Row 1, the second in the Row 2, third in Row 1 and so on until the end. Then we put the text from Row 2 next to the Row 1 text and thats it.
Complete the function that receives a string and encrypt it with t... | [] | [] | 1 | stdio |
Example
Input
2 2 2 1
0 0 0
Output
24 | [
"2 2 2 0\n0 0 0",
"2 1 2 0\n-1 -1 0",
"2 0 2 0\n-1 0 0",
"4 2 2 0\n0 0 1",
"3 1 2 0\n-1 0 -1",
"1 2 1 0\n-2 -1 0",
"2 2 3 0\n-1 -1 -1",
"1 1 4 0\n0 1 -1",
"3 2 0 0\n-1 -1 -1",
"1 0 1 0\n0 1 -1"
] | [
"24\n",
"16\n",
"8\n",
"40\n",
"22\n",
"10\n",
"32\n",
"18\n",
"12\n",
"2\n"
] | 1 | stdio |
You are given a string of length N. Calculate the number of distinct substrings of S.
Constraints
* 1 \leq N \leq 500,000
* S consists of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
Print the answer.
Examples
Input
abcbcba
Output
21
Input
missi... | [
"abcacbb",
"baaaa",
"aaabacacb",
"mjssissippi",
"abbacbb",
"baaba",
"mjssisrippi",
"bcacabaa`",
"mjssisripph",
"bcacabab`"
] | [
"24\n",
"9\n",
"37\n",
"57\n",
"23\n",
"11\n",
"61\n",
"39\n",
"62\n",
"38\n"
] | 1 | stdio |
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla... | [
"15\naawtvezfntstrcpgbzjbf 681\nzhahpvqiptvksnbjkdvmknb -74\naawtvezfntstrcpgbzjbf 661\njpdwmyke 474\naawtvezfntstrcpgbzjbf -547\naawtvezfntstrcpgbzjbf 600\nzhahpvqiptvksnbjkdvmknb -11\njpdwmyke 711\nbjmj 652\naawtvezfntstrcpgbzjbf -1000\naawtvezfntstrcpgbzjbf -171\nbjmj -302\naawtvezfntstrcpgbzjbf 961\nzhahpvqiptv... | [
"aawtvezfntstrcpgbzjbf\n",
"fcgslzkicjrpbqaifgweyzreajjfdo\n",
"ksjuuerbnlklcfdjeyq\n",
"ivhgbxiv\n",
"kaxqybeultn\n",
"aawtvezfntstrcpgbzjbf\n",
"fcgslzkicjrpbqaifgweyzreajjfdo\n",
"ksjuuerbnlklcfdjeyq\n",
"ivhgbxiv\n",
"kaxqybeultn\n"
] | 1 | stdio |
A permutation p of size n is an array such that every integer from 1 to n occurs exactly once in this array.
Let's call a permutation an almost identity permutation iff there exist at least n - k indices i (1 ≤ i ≤ n) such that p_{i} = i.
Your task is to count the number of almost identity permutations for given numb... | [
"4 1\n",
"4 2\n",
"5 3\n",
"5 4\n",
"200 1\n",
"200 2\n",
"200 3\n",
"200 4\n",
"400 1\n",
"400 2\n"
] | [
"1\n",
"7\n",
"31\n",
"76\n",
"1\n",
"19901\n",
"2646701\n",
"584811251\n",
"1\n",
"79801\n"
] | 1 | stdio |
Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya calls a mask of a positive integer n the number that is obtained after successive writing of... | [
"39999 4774\n",
"40007 74\n",
"31975 74\n",
"69700 77477\n",
"74 77\n",
"45679 77777\n",
"1 4\n",
"40007 74444\n",
"740 4\n",
"369 47\n"
] | [
"40774\n",
"50074\n",
"32074\n",
"77477\n",
"77\n",
"77777\n",
"4\n",
"74444\n",
"804\n",
"407\n"
] | 1 | stdio |
Our master carpenter is designing a condominium called Bange Hills Mansion. The condominium is constructed by stacking up floors of the same height. The height of each floor is designed so that the total height of the stacked floors coincides with the predetermined height of the condominium. The height of each floor ca... | [
"101 2 5",
"100 2 5",
"111 2 5",
"000 2 5",
"000 2 10",
"000 2 12",
"000 2 18",
"000 2 30",
"000 2 51",
"000 2 50"
] | [
"0\n",
"3\n",
"1\n",
"4\n",
"9\n",
"11\n",
"17\n",
"29\n",
"50\n",
"49\n"
] | 1 | stdio |
Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced prog... | [
"2000 2000\n",
"1544 1794\n",
"1639 1056\n",
"56 48\n",
"1066 995\n",
"49 110\n",
"478 1301\n",
"158 772\n",
"162 161\n",
"83 37\n"
] | [
"585712681",
"933285446",
"467464129",
"20742237",
"180753612",
"956247348",
"476483030",
"850911301",
"591739753",
"22793555"
] | 1 | stdio |
Takahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:
* Go one meter in the direction he is facing. Then, turn X degrees counter-clockwise.
Constraints
* 1 \leq X \leq ... | [
"155",
"2",
"297",
"408",
"643",
"810",
"928",
"1780",
"33",
"70"
] | [
"72\n",
"180\n",
"40\n",
"15\n",
"360\n",
"4\n",
"45\n",
"18\n",
"120\n",
"36\n"
] | 1 | stdio |
You are given an array of non-negative integers, your task is to complete the series from 0 to the highest number in the array.
If the numbers in the sequence provided are not in order you should order them, but if a value repeats, then you must return a sequence with only one item, and the value of that item must be ... | [] | [] | 1 | stdio |
To celebrate the start of the Rio Olympics (and the return of 'the Last Leg' on C4 tonight) this is an Olympic inspired kata.
Given a string of random letters, you need to examine each. Some letters naturally have 'rings' in them. 'O' is an obvious example, but 'b', 'p', 'e', 'A', etc are all just as applicable. 'B' e... | [] | [] | 1 | stdio |
Reca company makes monitors, the most popular of their models is AB999 with the screen size a × b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popular with users. That's why the company wants to reduce monitor AB999 size so th... | [
"2000000000 2000000000 1999999998 1999999999\n",
"721746595 799202881 143676564 380427290\n",
"266102152 594841161 15854566 13392106\n",
"548893795 861438648 131329677 177735812\n",
"1243276346 1975662240 38441120 291740200\n",
"625166755 843062051 1463070160 1958300154\n",
"1 1 2 1\n",
"912724694 126... | [
"1999999998 1999999999",
"287353128 760854580",
"266043102 224722482",
"525318708 710943248",
"259477560 1969246350",
"0 0",
"0 0",
"881421208 775091384",
"1561914768 447486816",
"754119492 313489356"
] | 1 | stdio |
Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in <image>, which Sasha coped with. For Sasha not to think that he had learned all, Stas gave him a new task. For each segment of the fixed length Sasha must find t... | [
"10 3\n-55\n-35\n-80\n91\n-96\n-93\n-39\n-77\n4\n29\n",
"10 3\n-6\n2\n79\n-49\n86\n13\n-31\n-71\n57\n93\n",
"10 3\n-38\n68\n-77\n57\n-35\n28\n-61\n-9\n3\n60\n",
"10 3\n-20\n-63\n-64\n45\n-84\n-13\n79\n-31\n70\n-100\n",
"10 3\n2\n-100\n50\n-85\n-48\n68\n-96\n-31\n85\n-29\n",
"10 3\n-13\n26\n-97\n-38\n43\n-... | [
"-35\n91\n91\n91\n-39\n-39\n4\n29\n",
"79\n79\n86\n86\n86\n13\n57\n93\n",
"68\n68\n57\n57\n28\n28\n3\n60\n",
"-20\n45\n45\n45\n79\n79\n79\n70\n",
"50\n50\n50\n68\n68\n68\n85\n85\n",
"26\n26\n43\n43\n80\n80\n80\n45\n",
"25\n25\n60\n60\n60\n48\n48\n48\n",
"46\n46\n46\n22\n19\n44\n44\n44\n",
"-35\n91\n... | 1 | stdio |
Division of Big Integers
Given two integers $A$ and $B$, compute the quotient, $\frac{A}{B}$. Round down to the nearest decimal.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the quotient in a line.
Constraints
* $-1 \times 10^{1000} \leq A, B \leq 10^{1000}$
* $... | [
"5 16",
"9 6",
"18 6",
"18 3",
"21 3",
"21 4",
"16 4",
"2 1",
"52 6",
"36 4"
] | [
"0\n",
"1\n",
"3\n",
"6\n",
"7\n",
"5\n",
"4\n",
"2\n",
"8\n",
"9\n"
] | 1 | stdio |
Rng is going to a festival.
The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer.
Here, assume that the name of "a festival of s" is a string obtained by appending `FESTIVAL` to the end of s. For ex... | [
"YAKINIJUFESTIVAL",
"CODEFESTIVALFERTIVAL",
"CODEFESTIVAM",
"LAVITSEFUJINIKAY",
"CPDEFESTIVAM",
"LAVITSEEUJINIKAY",
"CODEFESTIWALFESTIWAL",
"LAWITSEFLAWITSEFEDOC",
"BPDEFDSTIVBM",
"CODEFWSTIWALFESTIEAL"
] | [
"YAKINIJU\n",
"CODEFESTIVAL\n",
"CODE\n",
"LAVITSEF\n",
"CPDE\n",
"LAVITSEE\n",
"CODEFESTIWAL\n",
"LAWITSEFLAWI\n",
"BPDE\n",
"CODEFWSTIWAL\n"
] | 1 | stdio |
problem
I want to put as many rectangular tiles as possible on a rectangular wall with a size of $ h $ in height and $ w $ in width, and a size of $ a $ in height and $ b $ in width.
The following conditions must be met when attaching tiles.
* Do not stack tiles.
* Do not apply tiles diagonally, that is, any edge o... | [
"5 8\n3 2",
"5 8\n6 2",
"6 8\n6 3",
"12 8\n6 3",
"12 8\n9 3",
"16 8\n9 3",
"27 8\n9 6",
"27 8\n9 9",
"27 14\n9 9",
"27 14\n9 16"
] | [
"16\n",
"40\n",
"12\n",
"24\n",
"42\n",
"74\n",
"54\n",
"216\n",
"135\n",
"378\n"
] | 1 | stdio |
You are given three integers $a$, $b$, and $c$. Determine if one of them is the sum of the other two.
-----Input-----
The first line contains a single integer $t$ ($1 \leq t \leq 9261$) — the number of test cases.
The description of each test case consists of three integers $a$, $b$, $c$ ($0 \leq a, b, c \leq 20$).... | [
"7\n1 4 3\n2 5 8\n9 11 20\n0 0 0\n20 20 20\n4 12 3\n15 7 8\n",
"12\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n",
"47\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1\n1 1 1... | [
"YES\nNO\nYES\nYES\nNO\nNO\nYES\n",
"NO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\n",
"NO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\nNO\n",
"NO\n",
"NO\nNO\nNO\nNO\nNO\... | 1 | stdio |
As a strict big brother, I do limit my young brother Vasya on time he spends on computer games. I define a prime-time as a time period till which Vasya have a permission to play computer games. I specify start hour and end hour as pair of integers.
I need a function which will take three numbers - a present moment (cu... | [] | [] | 1 | stdio |
You are given a rectangular board of M × N squares. Also you are given an unlimited number of standard domino pieces of 2 × 1 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possible on the board so as to meet the following conditions:
1. Each domino completely covers two squa... | [
"2 6\n",
"1 5\n",
"3 6\n",
"2 5\n",
"3 16\n",
"2 7\n",
"3 10\n",
"14 16\n",
"1 16\n",
"5 16\n"
] | [
"6\n",
"2\n",
"9\n",
"5\n",
"24\n",
"7\n",
"15\n",
"112\n",
"8\n",
"40\n"
] | 1 | stdio |
You need to find if a number can be expressed as sum of two perfect powers. That is, given x find if there exists non negative integers a, b, m, n such that a^m + b^n = x.
Input
First line of the input contains number of test cases T. It is followed by T lines, each line contains a sinle number x.
Output
For each te... | [
"20\n178461\n767271\n143872\n917783\n642681\n496408\n735441\n899441\n265715\n772194\n797342\n833227\n479407\n800158\n613225\n498438\n818615\n750993\n597881\n142739\n",
"20\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n",
"20\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n74\n75\n... | [
"No\nYes\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nYes\nNo\nNo\nYes\nNo\nNo\nNo\nNo\nNo\nNo\nYes\n",
"No\nYes\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nNo\nYes\nYes\n",
"No\nNo\nNo\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nYes\nYes\nYes\nYes\nYes\nYes\nNo\nNo\nYes\n",
"Yes\nNo\nYes\nYes\nYes\nNo\nNo\nYes\... | 1 | stdio |
A smelt fishing tournament was held at Lake Hibara. The winner is the one who wins the most smelt.
Create a program that reads the list of participant numbers and the number of fish caught and outputs the number of winners and the number of fish caught. If there are multiple winners, output the one with the lowest par... | [
"6\n1 14\n4 25\n3 42\n4 11\n5 40\n6 37",
"6\n1 14\n4 25\n3 42\n4 11\n5 60\n6 37",
"6\n1 14\n2 25\n3 81\n4 11\n5 40\n6 37",
"6\n1 14\n4 25\n3 72\n4 11\n5 60\n6 37",
"6\n1 14\n2 25\n3 63\n4 11\n5 40\n6 37",
"6\n1 14\n2 25\n3 55\n4 11\n4 40\n6 59",
"6\n1 14\n2 6\n3 3\n4 3\n5 40\n6 37",
"6\n1 14\n2 25\n3 ... | [
"3 42\n",
"5 60\n",
"3 81\n",
"3 72\n",
"3 63\n",
"6 59\n",
"5 40\n",
"3 74\n",
"3 131\n",
"6 37\n"
] | 1 | stdio |
Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon the arriving, they found that citizens are worried about maximum values of the Main Uzhlyandian Function f, which is defined as... | [
"5\n1 4 2 3 1\n",
"4\n1 5 4 7\n",
"8\n16 14 12 10 8 100 50 0\n",
"2\n1 1\n",
"50\n-5 -9 0 44 -10 37 34 -49 11 -22 -26 44 8 -13 23 -46 34 12 -24 2 -40 -15 -28 38 -40 -42 -42 7 -43 5 2 -11 10 43 9 49 -13 36 2 24 46 50 -15 -26 -6 -6 8 4 -44 -3\n",
"100\n23 64 60 -45 -36 -64 -59 15 -75 69 -30 -7 -20 17 -77 58... | [
"3",
"6",
"92",
"0",
"208",
"632",
"0",
"2",
"2000000000",
"2000000000"
] | 1 | stdio |
A little weird green frog speaks in a very strange variation of English: it reverses sentence, omitting all puntuation marks `, ; ( ) - ` except the final exclamation, question or period. We urgently need help with building a proper translator.
To simplify the task, we always use lower-case letters. Apostrophes are fo... | [] | [] | 1 | stdio |
The cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.
When counting pencils in Japanese, the counter word "本" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of "本" in the phrase "N 本" for a posi... | [
"16\n",
"2\n",
"183\n",
"999\n",
"1\n",
"440\n",
"73\n",
"24\n",
"438\n",
"575\n"
] | [
"pon\n",
"hon\n",
"bon\n",
"hon\n",
"pon\n",
"pon\n",
"bon\n",
"hon\n",
"pon\n",
"hon\n"
] | 1 | stdio |
Given a standard english sentence passed in as a string, write a method that will return a sentence made up of the same words, but sorted by their first letter. However, the method of sorting has a twist to it:
* All words that begin with a lower case letter should be at the beginning of the sorted sentence, and sorted... | [] | [] | 1 | stdio |
You are given a secret message you need to decipher. Here are the things you need to know to decipher it:
For each word:
- the second and the last letter is switched (e.g. `Hello` becomes `Holle`)
- the first letter is replaced by its character code (e.g. `H` becomes `72`)
Note: there are no special characters used, ... | [] | [] | 1 | stdio |
Consider the following numbers (where `n!` is `factorial(n)`):
```
u1 = (1 / 1!) * (1!)
u2 = (1 / 2!) * (1! + 2!)
u3 = (1 / 3!) * (1! + 2! + 3!)
...
un = (1 / n!) * (1! + 2! + 3! + ... + n!)
```
Which will win: `1 / n!` or `(1! + 2! + 3! + ... + n!)`?
Are these numbers going to `0` because of `1/n!` or to infinity du... | [] | [] | 1 | stdio |
Mrs Jefferson is a great teacher. One of her strategies that helped her to reach astonishing results in the learning process is to have some fun with her students. At school, she wants to make an arrangement of her class to play a certain game with her pupils. For that, she needs to create the arrangement with **the mi... | [] | [] | 1 | stdio |
Write a function that returns the number of '2's in the factorization of a number.
For example,
```python
two_count(24)
```
should return 3, since the factorization of 24 is 2^3 x 3
```python
two_count(17280)
```
should return 7, since the factorization of 17280 is 2^7 x 5 x 3^3
The number passed to two_count (twoC... | [] | [] | 1 | stdio |
Given a set of $N$ axis-aligned rectangular seals, find the number of overlapped seals on the region which has the maximum number of overlapped seals.
Constraints
* $ 1 \leq N \leq 100000 $
* $ 0 \leq x1_i < x2_i \leq 1000 $
* $ 0 \leq y1_i < y2_i \leq 1000 $
* $ x1_i, y1_i, x2_i, y2_i$ are given in integers
Input
... | [
"2\n0 0 2 2\n2 0 4 4",
"3\n0 0 1 2\n0 0 2 2\n0 0 2 2",
"2\n0 0 3 2\n2 1 4 2",
"2\n0 0 0 1\n2 2 4 2",
"2\n0 0 3 1\n2 1 4 3",
"2\n0 0 3 1\n2 1 4 2",
"2\n0 0 3 1\n2 1 4 4",
"2\n0 0 2 2\n2 0 2 2",
"3\n0 0 2 4\n0 0 2 2\n0 0 2 2",
"3\n0 0 1 2\n0 0 2 3\n0 0 2 2"
] | [
"1\n",
"3\n",
"2\n",
"0\n",
"1\n",
"1\n",
"1\n",
"1\n",
"3\n",
"3\n"
] | 1 | stdio |
It is 2050 and romance has long gone, relationships exist solely for practicality.
MatchMyHusband is a website that matches busy working women with perfect house husbands. You have been employed by MatchMyHusband to write a function that determines who matches!!
The rules are... a match occurs providing the husband's... | [] | [] | 1 | stdio |
# Valid HK Phone Number
## Overview
In Hong Kong, a valid phone number has the format ```xxxx xxxx``` where ```x``` is a decimal digit (0-9). For example:
## Task
Define two functions, ```isValidHKPhoneNumber``` and ```hasValidHKPhoneNumber```, that ```return```s whether a given string is a valid HK phone number a... | [] | [] | 1 | stdio |
```if-not:sql
Create a function (or write a script in Shell) that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers.
```
```if:sql
## SQL Notes:
You will be given a table, `numbers`, with one column `number`.
Return a table with a column `is_even` containing "Even" or "Odd" ... | [] | [] | 1 | stdio |
In this Kata, you will be given a multi-dimensional array containing `2 or more` sub-arrays of integers. Your task is to find the maximum product that can be formed by taking any one element from each sub-array.
```
Examples:
solve( [[1, 2],[3, 4]] ) = 8. The max product is given by 2 * 4
solve( [[10,-15],[-1,-3]] ) =... | [] | [] | 1 | stdio |
Write a program which reads the two dices constructed in the same way as Dice I, and determines whether these two dices are identical. You can roll a dice in the same way as Dice I, and if all integers observed from the six directions are the same as that of another dice, these dices can be considered as identical.
Co... | [
"1 2 3 2 5 6\n6 5 4 3 2 1",
"1 2 3 2 5 6\n6 1 4 3 2 1",
"1 2 3 2 5 6\n6 0 4 3 2 1",
"1 2 3 2 5 6\n6 0 4 3 4 1",
"1 2 3 2 7 6\n6 0 4 3 4 1",
"1 2 3 2 7 3\n6 0 4 3 4 1",
"1 2 2 2 7 6\n6 0 4 3 4 1",
"1 2 2 2 7 9\n6 0 4 3 4 1",
"1 2 2 2 7 9\n6 0 4 5 4 1",
"1 0 2 2 7 9\n6 0 4 5 4 1"
] | [
"No\n",
"No\n",
"No\n",
"No\n",
"No\n",
"No\n",
"No\n",
"No\n",
"No\n",
"No\n"
] | 1 | stdio |
Given a triangle of consecutive odd numbers:
```
1
3 5
7 9 11
13 15 17 19
21 23 25 27 29
...
```
find the triangle's row knowing its index (the rows are 1-indexed), e.g.:
```
odd_row(1) == [1]
odd_row(2) == [3, 5]
odd_row(3) == [7, 9, 11]
```
**... | [] | [] | 1 | stdio |
You are given an array a consisting of n positive integers. You pick two integer numbers l and r from 1 to n, inclusive (numbers are picked randomly, equiprobably and independently). If l > r, then you swap values of l and r. You have to calculate the expected value of the number of unique elements in segment of the ar... | [
"2\n1 2\n",
"2\n2 2\n",
"10\n9 6 8 5 5 2 8 9 2 2\n",
"20\n49 33 9 8 50 21 12 44 23 39 24 10 17 4 17 40 24 19 27 21\n",
"1\n1000000\n",
"10\n9 6 8 5 5 2 8 9 2 2\n",
"20\n49 33 9 8 50 21 12 44 23 39 24 10 17 4 17 40 24 19 27 21\n",
"1\n1000000\n",
"10\n9 6 8 5 5 2 8 9 2 1\n",
"20\n49 33 9 8 50 21 12... | [
"1.500000\n",
"1.000000\n",
"3.100000\n",
"7.010000\n",
"1.000000\n",
"3.1000",
"7.0100",
"1.0000",
"3.28\n",
"7.01\n"
] | 1 | stdio |
You should write a simple function that takes string as input and checks if it is a valid Russian postal code, returning `true` or `false`.
A valid postcode should be 6 digits with no white spaces, letters or other symbols. Empty string should also return false.
Please also keep in mind that a valid post code **cann... | [] | [] | 1 | stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.