question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Three people, A, B and C, are trying to communicate using transceivers.
They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively.
Two people can directly communicate when the distance between them... |
Solve the programming task below in a Python markdown code block.
Petya is the most responsible worker in the Research Institute. So he was asked to make a very important experiment: to melt the chocolate bar with a new laser device. The device consists of a rectangular field of n × m cells and a robotic arm. Each cel... |
Solve the programming task below in a Python markdown code block.
Given a string, remove any characters that are unique from the string.
Example:
input: "abccdefee"
output: "cceee"
Write your solution by modifying this code:
```python
def only_duplicates(string):
```
Your solution should implemented in the fu... |
Solve the programming task below in a Python markdown code block.
Danil decided to earn some money, so he had found a part-time job. The interview have went well, so now he is a light switcher.
Danil works in a rooted tree (undirected connected acyclic graph) with n vertices, vertex 1 is the root of the tree. There i... |
Solve the programming task below in a Python markdown code block.
Check if it is a vowel(a, e, i, o, u,) on the ```n``` position in a string (the first argument). Don't forget about uppercase.
A few cases:
```
{
checkVowel('cat', 1) -> true // 'a' is a vowel
checkVowel('cat', 0) -> false // 'c' is not a vowel
... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian as well.
------ Problem description ------
You will be given a zero-indexed array A. You need to rearrange its elements in such a way that the following conditions are satisfied:
A[i] ≤ A[i+1... |
Solve the programming task below in a Python markdown code block.
Родители Васи хотят, чтобы он как можно лучше учился. Поэтому если он получает подряд три положительные оценки («четвёрки» или «пятёрки»), они дарят ему подарок. Соответственно, оценки «единица», «двойка» и «тройка» родители Васи считают плохими. Когда ... |
Solve the programming task below in a Python markdown code block.
You are given string S and T consisting of lowercase English letters.
Determine if S equals T after rotation.
That is, determine if S equals T after the following operation is performed some number of times:
Operation: Let S = S_1 S_2 ... S_{|S|}. Chang... |
Solve the programming task below in a Python markdown code block.
The palindromic number `595` is interesting because it can be written as the sum of consecutive squares: `6^2 + 7^2 + 8^2 + 9^2 + 10^2 + 11^2 + 12^2 = 595`.
There are exactly eleven palindromes below one-thousand that can be written as consecutive squa... |
Solve the programming task below in a Python markdown code block.
Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is $n$.
There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains $2$ apartments, every other floor cont... |
Solve the programming task below in a Python markdown code block.
Let's call two strings s and t anagrams of each other if it is possible to rearrange symbols in the string s to get a string, equal to t.
Let's consider two strings s and t which are anagrams of each other. We say that t is a reducible anagram of s if ... |
Solve the programming task below in a Python markdown code block.
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number... |
Solve the programming task below in a Python markdown code block.
Lately, a national version of a bingo game has become very popular in Berland. There are n players playing the game, each player has a card with numbers. The numbers on each card are distinct, but distinct cards can have equal numbers. The card of the i... |
Solve the programming task below in a Python markdown code block.
Initially, you have the array $a$ consisting of one element $1$ ($a = [1]$).
In one move, you can do one of the following things:
Increase some (single) element of $a$ by $1$ (choose some $i$ from $1$ to the current length of $a$ and increase $a_i$ ... |
Solve the programming task below in a Python markdown code block.
Daisy is a senior software engineer at RainyDay, LLC. She has just implemented three new features in their product: the first feature makes their product work, the second one makes their product fast, and the third one makes their product correct. The c... |
Solve the programming task below in a Python markdown code block.
Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows:
* it is up to a passenger to choose a plane to fly on;
* if the chosen plane has x (x > 0) empty... |
Solve the programming task below in a Python markdown code block.
Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by $n$ sectors, and the outer area is equally divided by $m$ sectors. A wall exists between each pair of sectors of same area (inner or outer... |
Solve the programming task below in a Python markdown code block.
Ivan has number $b$. He is sorting through the numbers $a$ from $1$ to $10^{18}$, and for every $a$ writes $\frac{[a, \,\, b]}{a}$ on blackboard. Here $[a, \,\, b]$ stands for least common multiple of $a$ and $b$. Ivan is very lazy, that's why this task... |
Solve the programming task below in a Python markdown code block.
Jack is working on his jumping skills recently. Currently he's located at point zero of the number line. He would like to get to the point x. In order to train, he has decided that he'll first jump by only one unit, and each subsequent jump will be exac... |
Solve the programming task below in a Python markdown code block.
Tax Rate Changed
VAT (value-added tax) is a tax imposed at a certain rate proportional to the sale price.
Our store uses the following rules to calculate the after-tax prices.
* When the VAT rate is x%, for an item with the before-tax price of p yen,... |
Solve the programming task below in a Python markdown code block.
For all x in the range of integers [0, 2 ** n), let y[x] be the binary exclusive-or of x and x // 2. Find the sum of all numbers in y.
Write a function sum_them that, given n, will return the value of the above sum.
This can be implemented a simple lo... |
Solve the programming task below in a Python markdown code block.
During the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.
It's too hard to learn to solve Rubik's cube instantly, so she learns to understand if it's... |
Solve the programming task below in a Python markdown code block.
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. [Image]
The park can be represented as... |
Solve the programming task below in a Python markdown code block.
You have recently discovered that horses travel in a unique pattern - they're either running (at top speed) or resting (standing still).
Here's an example of how one particular horse might travel:
```
The horse Blaze can run at 14 metres/second for 60... |
Solve the programming task below in a Python markdown code block.
problem
Given the sequence $ A $ of length $ N $. Find the maximum value of $ \ sum B_i $, where $ B $ is one of the longest increasing subsequences of the sequence $ A $.
The longest increasing subsequence of the sequence $ A $ is the longest subsequ... |
Solve the programming task below in a Python markdown code block.
We have a set S of N points in a two-dimensional plane. The coordinates of the i-th point are (x_i, y_i). The N points have distinct x-coordinates and distinct y-coordinates.
For a non-empty subset T of S, let f(T) be the number of points contained in t... |
Solve the programming task below in a Python markdown code block.
A bitstring is a string consisting only of the characters 0 and 1. A bitstring is called k-balanced if every substring of size k of this bitstring has an equal amount of 0 and 1 characters (k/2 of each).
You are given an integer k and a string s which ... |
Solve the programming task below in a Python markdown code block.
Write a function that gets a sequence and value and returns `true/false` depending on whether the variable exists in a multidimentional sequence.
Example:
```
locate(['a','b',['c','d',['e']]],'e'); // should return true
locate(['a','b',['c','d',['e']]]... |
Solve the programming task below in a Python markdown code block.
The little girl loves the problems on array queries very much.
One day she came across a rather well-known problem: you've got an array of n elements (the elements of the array are indexed starting from 1); also, there are q queries, each one is define... |
Solve the programming task below in a Python markdown code block.
We have a sequence of N integers: A_1, A_2, \cdots, A_N.
You can perform the following operation between 0 and K times (inclusive):
- Choose two integers i and j such that i \neq j, each between 1 and N (inclusive). Add 1 to A_i and -1 to A_j, possibly... |
Solve the programming task below in a Python markdown code block.
The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.
For this reason, he made the n prisoners to stand in a line, with a num... |
Solve the programming task below in a Python markdown code block.
In "Takahashi-ya", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).
A customer ordered a bowl of ramen and told which toppings to put on his ramen t... |
Solve the programming task below in a Python markdown code block.
I decided to plant vegetables in the vegetable garden. There were n seeds, so I sown n seeds one by one a day over n days. All seeds sprout and grow quickly. I can't wait for the harvest time.
One day, when I was watering the seedlings as usual, I noti... |
Solve the programming task below in a Python markdown code block.
The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this:
There are space-separated non-empty words of lowercase and uppercase Latin letters.
There are hyphen characters '-' in some words,... |
Solve the programming task below in a Python markdown code block.
Let's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains number i × j. The rows and columns are numbered starting from 1.
You are given a positive integer x. Your task is to co... |
Solve the programming task below in a Python markdown code block.
Vasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this integer is between 1 and 100 000, inclusive. It is possible that some cards have the same integers on them.
Vasily decided to sort the cards. To do this, h... |
Solve the programming task below in a Python markdown code block.
# Do you ever wish you could talk like Siegfried of KAOS ?
## YES, of course you do!
https://en.wikipedia.org/wiki/Get_Smart
# Task
Write the function ```siegfried``` to replace the letters of a given sentence.
Apply the rules using the course no... |
Solve the programming task below in a Python markdown code block.
Recall that MEX of an array is a minimum non-negative integer that does not belong to the array. Examples: for the array $[0, 0, 1, 0, 2]$ MEX equals to $3$ because numbers $0, 1$ and $2$ are presented in the array and $3$ is the minimum non-negative i... |
Solve the programming task below in a Python markdown code block.
Write a function
`titleToNumber(title) or title_to_number(title) or titleToNb title ...`
(depending on the language)
that given a column title as it appears in an Excel sheet, returns its corresponding column number. All column titles will be upperc... |
Solve the programming task below in a Python markdown code block.
Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at a_1 percent and second one is charged at a_2 percent. You can connect charger to a joystick only at the beginning of each mi... |
Solve the programming task below in a Python markdown code block.
Recently Polycarpus has learned the "bitwise AND" operation (which is also called "AND") of non-negative integers. Now he wants to demonstrate the school IT teacher his superb manipulation with the learned operation.
For that Polycarpus came to school ... |
Solve the programming task below in a Python markdown code block.
Given are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.
-----Constraints-----
- S and T are strings consisting of lowercase English letters.
-... |
Solve the programming task below in a Python markdown code block.
## Debugging sayHello function
The starship Enterprise has run into some problem when creating a program to greet everyone as they come aboard. It is your job to fix the code and get the program working again!
Example output:
```
Hello, Mr. Spock
```... |
Solve the programming task below in a Python markdown code block.
Given an array containing only integers, add all the elements and return the binary equivalent of that sum.
If the array contains any non-integer element (e.g. an object, a float, a string and so on), return false.
**Note:** The sum of an empty array ... |
Solve the programming task below in a Python markdown code block.
Creatnx has $n$ mirrors, numbered from $1$ to $n$. Every day, Creatnx asks exactly one mirror "Am I beautiful?". The $i$-th mirror will tell Creatnx that he is beautiful with probability $\frac{p_i}{100}$ for all $1 \le i \le n$.
Creatnx asks the mirro... |
Solve the programming task below in a Python markdown code block.
Imagine that your city is an infinite 2D plane with Cartesian coordinate system. The only crime-affected road of your city is the x-axis. Currently, there are n criminals along the road. No police station has been built on this road yet, so the mayor wa... |
Solve the programming task below in a Python markdown code block.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of th... |
Solve the programming task below in a Python markdown code block.
Snuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes:
* Hit his pocket, which magically increases the number of biscuits by one.
* Exchange A ... |
Solve the programming task below in a Python markdown code block.
We have a sequence of length N, a = (a_1, a_2, ..., a_N).
Each a_i is a positive integer.
Snuke's objective is to permute the element in a so that the following condition is satisfied:
- For each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a mul... |
Solve the programming task below in a Python markdown code block.
Write a function called that takes a string of parentheses, and determines if the order of the parentheses is valid. The function should return `true` if the string is valid, and `false` if it's invalid.
## Examples
```
"()" => true
")((... |
Solve the programming task below in a Python markdown code block.
Find the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.
-----Constraints-----
- 1 \leq N < 10^{100}
- 1 \leq K \leq 3
-----Input-----
Input is given from Standard Input in the followi... |
Solve the programming task below in a Python markdown code block.
π (spelled pi in English) is a mathematical constant representing the circumference of a circle whose di- ameter is one unit length. The name π is said to come from the first letter of the Greek words περιφέρεια (meaning periphery) and περίμετρος (perim... |
Solve the programming task below in a Python markdown code block.
Jack has become a soldier now. Unfortunately, he has trouble with the drill. Instead of marching beginning with the left foot and then changing legs with each step, as ordered, he keeps repeating a sequence of steps, in which he sometimes makes the wron... |
Solve the programming task below in a Python markdown code block.
Write a function that takes as its parameters *one or more numbers which are the diameters of circles.*
The function should return the *total area of all the circles*, rounded to the nearest integer in a string that says "We have this much circle: xyz... |
Solve the programming task below in a Python markdown code block.
Greg the Dwarf has been really busy recently with excavations by the Neverland Mountain. However for the well-known reasons (as you probably remember he is a very unusual dwarf and he cannot stand sunlight) Greg can only excavate at night. And in the mo... |
Solve the programming task below in a Python markdown code block.
You are the "computer expert" of a local Athletic Association (C.A.A.).
Many teams of runners come to compete. Each time you get a string of
all race results of every team who has run.
For example here is a string showing the individual results of a te... |
Solve the programming task below in a Python markdown code block.
A sequence $a_1, a_2, \dots, a_n$ is called good if, for each element $a_i$, there exists an element $a_j$ ($i \ne j$) such that $a_i+a_j$ is a power of two (that is, $2^d$ for some non-negative integer $d$).
For example, the following sequences are go... |
Solve the programming task below in a Python markdown code block.
The mayor of Amida, the City of Miracle, is not elected like any other city. Once exhausted by long political struggles and catastrophes, the city has decided to leave the fate of all candidates to the lottery in order to choose all candidates fairly an... |
Solve the programming task below in a Python markdown code block.
Gerald plays the following game. He has a checkered field of size n × n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every minute moves ea... |
Solve the programming task below in a Python markdown code block.
Dr. Asimov, a robotics researcher, released cleaning robots he developed (see Problem B). His robots soon became very popular and he got much income. Now he is pretty rich. Wonderful.
First, he renovated his house. Once his house had 9 rooms that were ... |
Solve the programming task below in a Python markdown code block.
Your website is divided vertically in sections, and each can be of different size (height).
You need to establish the section index (starting at `0`) you are at, given the `scrollY` and `sizes` of all sections.
Sections start with `0`, so if first s... |
Solve the programming task below in a Python markdown code block.
Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he decided to go with just two commands: cd (change the current directory) and pwd (display the current directory).
Directories in Vasy... |
Solve the programming task below in a Python markdown code block.
# Task
Write a function `deNico`/`de_nico()` that accepts two parameters:
- `key`/`$key` - string consists of unique letters and digits
- `message`/`$message` - string with encoded message
and decodes the `message` using the `key`.
First create a ... |
Solve the programming task below in a Python markdown code block.
You are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.
The i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.
Here, a self-loop is an edge where a_i... |
Solve the programming task below in a Python markdown code block.
Ivan is collecting coins. There are only $N$ different collectible coins, Ivan has $K$ of them. He will be celebrating his birthday soon, so all his $M$ freinds decided to gift him coins. They all agreed to three terms: Everyone must gift as many coins... |
Solve the programming task below in a Python markdown code block.
## Task
Create a function that given a sequence of strings, groups the elements that can be obtained by rotating others, ignoring upper or lower cases.
In the event that an element appears more than once in the input sequence, only one of them will b... |
Solve the programming task below in a Python markdown code block.
A film festival is coming up in the city N. The festival will last for exactly n days and each day will have a premiere of exactly one film. Each film has a genre — an integer from 1 to k.
On the i-th day the festival will show a movie of genre a_{i}. ... |
Solve the programming task below in a Python markdown code block.
Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company.
Kefa has n friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and the friends... |
Solve the programming task below in a Python markdown code block.
Build a function `sumNestedNumbers`/`sum_nested_numbers` that finds the sum of all numbers in a series of nested arrays raised to the power of their respective nesting levels. Numbers in the outer most array should be raised to the power of 1.
For exa... |
Solve the programming task below in a Python markdown code block.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty lives in is not ... |
Solve the programming task below in a Python markdown code block.
The [Sharkovsky's Theorem](https://en.wikipedia.org/wiki/Sharkovskii%27s_theorem) involves the following ordering of the natural numbers:
```math
3≺5≺7≺9≺ ...\\
≺2·3≺2·5≺2·7≺2·9≺...\\
≺2^n·3≺2^n·5≺2^n·7≺2^n·9≺...\\
≺2^{(n+1)}·3≺2^{(n+1)}·5≺2^{(n+1)}·7≺2... |
Solve the programming task below in a Python markdown code block.
Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.
She has $n$ friends who are also grannies (Maria is not included in this number). The $i$-th granny is ready t... |
Solve the programming task below in a Python markdown code block.
You like the card board game "Set". Each card contains $k$ features, each of which is equal to a value from the set $\{0, 1, 2\}$. The deck contains all possible variants of cards, that is, there are $3^k$ different cards in total.
A feature for three ... |
Solve the programming task below in a Python markdown code block.
Make a function that receives a value, ```val``` and outputs the smallest higher number than the given value, and this number belong to a set of positive integers that have the following properties:
- their digits occur only once
- they are odd
- the... |
Solve the programming task below in a Python markdown code block.
This Christmas Santa gave Masha a magic picture and a pencil. The picture consists of n points connected by m segments (they might cross in any way, that doesn't matter). No two segments connect the same pair of points, and no segment connects the point... |
Solve the programming task below in a Python markdown code block.
In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative?
**Example:**
``` c
makeNegative(1); // return -1
makeNegative(-5); // return -5
makeNegative(0); // return 0
```
``` cfml
makeNegat... |
Solve the programming task below in a Python markdown code block.
You are given two positive integers $n$ and $s$. Find the maximum possible median of an array of $n$ non-negative integers (not necessarily distinct), such that the sum of its elements is equal to $s$.
A median of an array of integers of length $m$ is ... |
Solve the programming task below in a Python markdown code block.
An n × n square matrix is special, if: it is binary, that is, each cell contains either a 0, or a 1; the number of ones in each row and column equals 2.
You are given n and the first m rows of the matrix. Print the number of special n × n matrices, ... |
Solve the programming task below in a Python markdown code block.
Two integer sequences existed initially, one of them was strictly increasing, and another one — strictly decreasing.
Strictly increasing sequence is a sequence of integers $[x_1 < x_2 < \dots < x_k]$. And strictly decreasing sequence is a sequence of i... |
Solve the programming task below in a Python markdown code block.
Maxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems.
There are m types of discounts. We assume that the discounts are indexed from 1 to m. To use the discount number i, the customer takes a spe... |
Solve the programming task below in a Python markdown code block.
You're given an integer N. Write a program to calculate the sum of all the digits of N.
-----Input-----
The first line contains an integer T, the total number of testcases. Then follow T lines, each line contains an integer N.
-----Output-----
For ... |
Solve the programming task below in a Python markdown code block.
There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the re... |
Solve the programming task below in a Python markdown code block.
Nash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands.
This board game is played on the n× n board. Rows and columns of this board are numbered... |
Solve the programming task below in a Python markdown code block.
You are given a string $s$ of length $n$ consisting of lowercase Latin letters. You may apply some operations to this string: in one operation you can delete some contiguous substring of this string, if all letters in the substring you delete are equal.... |
Solve the programming task below in a Python markdown code block.
One day Greg and his friends were walking in the forest. Overall there were n people walking, including Greg. Soon he found himself in front of a river. The guys immediately decided to get across the river. Luckily, there was a boat by the river bank, j... |
Solve the programming task below in a Python markdown code block.
Your job is to return the volume of a cup when given the diameter of the top, the diameter of the bottom and the height.
You know that there is a steady gradient from the top to the bottom.
You want to return the volume rounded to 2 decimal places.
E... |
Solve the programming task below in a Python markdown code block.
You are given a rooted tree of $2^n - 1$ vertices. Every vertex of this tree has either $0$ children, or $2$ children. All leaves of this tree have the same distance from the root, and for every non-leaf vertex, one of its children is the left one, and ... |
Solve the programming task below in a Python markdown code block.
Johnny has just found the new, great tutorial: "How to become a grandmaster?". The tutorial tells many strange and unexpected for Johnny things, such as you have to be patient or that very important is solving many harder and harder problems.
The boy ... |
Solve the programming task below in a Python markdown code block.
Scientists working internationally use metric units almost exclusively. Unless that is, they wish to crash multimillion dollars worth of equipment on Mars.
Your task is to write a simple function that takes a number of meters, and outputs it using metr... |
Solve the programming task below in a Python markdown code block.
<image>
At the request of a friend who started learning abacus, you decided to create a program to display the abacus beads. Create a program that takes a certain number as input and outputs a row of abacus beads. However, the number of digits of the ... |
Solve the programming task below in a Python markdown code block.
Welcome to CODE FESTIVAL 2016! In order to celebrate this contest, find a string s that satisfies the following conditions:
* The length of s is between 1 and 5000, inclusive.
* s consists of uppercase letters.
* s contains exactly K occurrences of the... |
Solve the programming task below in a Python markdown code block.
When you divide the successive powers of `10` by `13` you get the following remainders of the integer divisions:
`1, 10, 9, 12, 3, 4`.
Then the whole pattern repeats.
Hence the following method:
Multiply the right most digit of the number with the... |
Solve the programming task below in a Python markdown code block.
You are visiting a large electronics store to buy a refrigerator and a microwave.
The store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \le i \le A ) is sold at a_i yen (the currency of Japan), and the j-th micro... |
Solve the programming task below in a Python markdown code block.
Given a string, s, return a new string that orders the characters in order of frequency.
The returned string should have the same number of characters as the original string.
Make your transformation stable, meaning characters that compare equal sho... |
Solve the programming task below in a Python markdown code block.
In Japan, temperature is usually expressed using the Celsius (℃) scale. In America, they used the Fahrenheit (℉) scale instead. $20$ degrees Celsius is roughly equal to $68$ degrees Fahrenheit. A phrase such as "Today’s temperature is $68$ degrees" is c... |
Solve the programming task below in a Python markdown code block.
You planned a trip using trains and buses.
The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket.
Similarly, the bus fare will be C yen if you buy ordinary tickets along ... |
Solve the programming task below in a Python markdown code block.
This time no story, no theory. The examples below show you how to write function `accum`:
**Examples:**
```
accum("abcd") -> "A-Bb-Ccc-Dddd"
accum("RqaEzty") -> "R-Qq-Aaa-Eeee-Zzzzz-Tttttt-Yyyyyyy"
accum("cwAt") -> "C-Ww-Aaa-Tttt"
```
The parameter of... |
Solve the programming task below in a Python markdown code block.
Limak is a little polar bear. He doesn't have many toys and thus he often plays with polynomials.
He considers a polynomial valid if its degree is n and its coefficients are integers not exceeding k by the absolute value. More formally:
Let a0, a1, ..... |
Solve the programming task below in a Python markdown code block.
You've came to visit your grandma and she straight away found you a job - her Christmas tree needs decorating!
She first shows you a tree with an identified number of branches, and then hands you a some baubles (or loads of them!).
You know your grand... |
Solve the programming task below in a Python markdown code block.
It is winter now, and Max decided it's about time he watered the garden.
The garden can be represented as n consecutive garden beds, numbered from 1 to n. k beds contain water taps (i-th tap is located in the bed x_{i}), which, if turned on, start deli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.