question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
A crop circle suddenly appeared on the vast agricultural land of Argentina. A total of n crop circles were confirmed, including overlapping, popping, large, and small ones.
When a mystery hunter tried to capture the whole picture of a crop circle from ... |
Solve the programming task below in a Python markdown code block.
Polycarp is very fond of playing the game Minesweeper. Recently he found a similar game and there are such rules.
There are mines on the field, for each the coordinates of its location are known ($x_i, y_i$). Each mine has a lifetime in seconds, after ... |
Solve the programming task below in a Python markdown code block.
Let's call a list of positive integers $a_0, a_1, ..., a_{n-1}$ a power sequence if there is a positive integer $c$, so that for every $0 \le i \le n-1$ then $a_i = c^i$.
Given a list of $n$ positive integers $a_0, a_1, ..., a_{n-1}$, you are allowed t... |
Solve the programming task below in a Python markdown code block.
Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side length y.
In a single second, he can... |
Solve the programming task below in a Python markdown code block.
We have an undirected graph G with N vertices numbered 1 to N and N edges as follows:
- For each i=1,2,...,N-1, there is an edge between Vertex i and Vertex i+1.
- There is an edge between Vertex X and Vertex Y.
For each k=1,2,...,N-1, solve the probl... |
Solve the programming task below in a Python markdown code block.
Create a program that converts the date expressed in the Christian era to the Japanese calendar using the era name and outputs the date. The input is three integers, as shown in the example, in the order year, month, and day. Convert this as shown in th... |
Solve the programming task below in a Python markdown code block.
Dwarfs have planted a very interesting plant, which is a triangle directed "upwards". This plant has an amusing feature. After one year a triangle plant directed "upwards" divides into four triangle plants: three of them will point "upwards" and one wil... |
Solve the programming task below in a Python markdown code block.
Make a program that takes a value (x) and returns "Bang" if the number is divisible by 3, "Boom" if it is divisible by 5, "BangBoom" if it divisible by 3 and 5, and "Miss" if it isn't divisible by any of them.
Note: Your program should only return one v... |
Solve the programming task below in a Python markdown code block.
Given are N points on the circumference of a circle centered at (0,0) in an xy-plane. The coordinates of the i-th point are (\cos(\frac{2\pi T_i}{L}),\sin(\frac{2\pi T_i}{L})).
Three distinct points will be chosen uniformly at random from these N point... |
Solve the programming task below in a Python markdown code block.
Find the least common multiple (LCM) of given n integers.
Constraints
* 2 ≤ n ≤ 10
* 1 ≤ ai ≤ 1000
* Product of given integers ai(i = 1, 2, ... n) does not exceed 231-1
Input
n
a1 a2 ... an
n is given in the first line. Then, n integers are given... |
Solve the programming task below in a Python markdown code block.
Gotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible diverse words in lexicographical order.
A word is called ... |
Solve the programming task below in a Python markdown code block.
A pair of numbers has a unique LCM but a single number can be the LCM of more than one possible
pairs. For example `12` is the LCM of `(1, 12), (2, 12), (3,4)` etc. For a given positive integer N, the number of different integer pairs with LCM is equal ... |
Solve the programming task below in a Python markdown code block.
In this problem we consider a special type of an auction, which is called the second-price auction. As in regular auction n bidders place a bid which is price a bidder ready to pay. The auction is closed, that is, each bidder secretly informs the organi... |
Solve the programming task below in a Python markdown code block.
Cat Snuke is learning to write characters.
Today, he practiced writing digits 1 and 9, but he did it the other way around.
You are given a three-digit integer n written by Snuke.
Print the integer obtained by replacing each digit 1 with 9 and each digit... |
Solve the programming task below in a Python markdown code block.
Lee tried so hard to make a good div.2 D problem to balance his recent contest, but it still doesn't feel good at all. Lee invented it so tediously slow that he managed to develop a phobia about div.2 D problem setting instead. And now he is hiding behi... |
Solve the programming task below in a Python markdown code block.
A famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, devised a game to help them:
All o... |
Solve the programming task below in a Python markdown code block.
In the spirit of the holidays, Saitama has given Genos two grid paths of length n (a weird gift even by Saitama's standards). A grid path is an ordered sequence of neighbouring squares in an infinite grid. Two squares are neighbouring if they share a si... |
Solve the programming task below in a Python markdown code block.
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
The text includes only alphabetical chara... |
Solve the programming task below in a Python markdown code block.
Problem
I started a part-time job at the rental DVD shop "NEO". First of all, I decided to study the fee system of this store.
There are three types of rental DVDs, old, semi-new, and new, and the rental fee for one DVD is a yen, b yen, and c yen, res... |
Solve the programming task below in a Python markdown code block.
Complete the function that accepts a string parameter, and reverses each word in the string. **All** spaces in the string should be retained.
## Examples
```
"This is an example!" ==> "sihT si na !elpmaxe"
"double spaces" ==> "elbuod secaps"
```... |
Solve the programming task below in a Python markdown code block.
There is a railroad in Takahashi Kingdom. The railroad consists of N sections, numbered 1, 2, ..., N, and N+1 stations, numbered 0, 1, ..., N. Section i directly connects the stations i-1 and i. A train takes exactly A_i minutes to run through section i... |
Solve the programming task below in a Python markdown code block.
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifically, each string ties together two studen... |
Solve the programming task below in a Python markdown code block.
Polycarpus takes part in the "Field of Wonders" TV show. The participants of the show have to guess a hidden word as fast as possible. Initially all the letters of the word are hidden.
The game consists of several turns. At each turn the participant te... |
Solve the programming task below in a Python markdown code block.
Maga and Alex are good at string manipulation problems. Just now they have faced a problem related to string. But it is not a standard string problem. They have no idea to solve it. They need your help.
A string is called unique if all characters of st... |
Solve the programming task below in a Python markdown code block.
In Berland the opposition is going to arrange mass walking on the boulevard. The boulevard consists of n tiles that are lain in a row and are numbered from 1 to n from right to left. The opposition should start walking on the tile number 1 and the finis... |
Solve the programming task below in a Python markdown code block.
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 loves tickets very much. ... |
Solve the programming task below in a Python markdown code block.
We have a string S consisting of uppercase English letters. Additionally, an integer N will be given.
Shift each character of S by N in alphabetical order (see below), and print the resulting string.
We assume that A follows Z. For example, shifting A b... |
Solve the programming task below in a Python markdown code block.
While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000.
If the quantity and price per item are input, write a program to calculate the total expenses.
------ Input Format ------
The first line contai... |
Solve the programming task below in a Python markdown code block.
One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of n different natural numbers from 1 to n to obtain total c... |
Solve the programming task below in a Python markdown code block.
You are given $n$ lengths of segments that need to be placed on an infinite axis with coordinates.
The first segment is placed on the axis so that one of its endpoints lies at the point with coordinate $0$. Let's call this endpoint the "start" of the f... |
Solve the programming task below in a Python markdown code block.
Here is a very simple variation of the game backgammon, named “Minimal Backgammon”. The game is played by only one player, using only one of the dice and only one checker (the token used by the player).
The game board is a line of (N + 1) squares label... |
Solve the programming task below in a Python markdown code block.
There is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0. During the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to ... |
Solve the programming task below in a Python markdown code block.
Input
The input is given from standard input in the following format.
> $H \ W$ $a_{1, 1} \ a_{1, 2} \ \cdots \ a_{1, W}$ $a_{2, 1} \ a_{2, 2} \ \cdots \ a_{2, W}$ $\vdots \ \ \ \ \ \ \ \ \ \ \vdots \ \ \ \ \ \ \ \ \ \ \vdots$ $a_{H, 1} \ a_{H, 2} \ ... |
Solve the programming task below in a Python markdown code block.
Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started making cube towers by placing the cubes one on top of the other. They defined multiple towe... |
Solve the programming task below in a Python markdown code block.
It's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several advantages over the other guys. For e... |
Solve the programming task below in a Python markdown code block.
You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?
-----Constraints-----
- -40 \leq X \leq 4... |
Solve the programming task below in a Python markdown code block.
On a chessboard with a width of $10^9$ and a height of $10^9$, the rows are numbered from bottom to top from $1$ to $10^9$, and the columns are numbered from left to right from $1$ to $10^9$. Therefore, for each cell of the chessboard you can assign the... |
Solve the programming task below in a Python markdown code block.
Write a program which counts and reports the number of each alphabetical letter. Ignore the case of characters.
Constraints
* The number of characters in the sentence < 1200
Input
A sentence in English is given in several lines.
Output
Prints the ... |
Solve the programming task below in a Python markdown code block.
The string $s$ is given, the string length is odd number. The string consists of lowercase letters of the Latin alphabet.
As long as the string length is greater than $1$, the following operation can be performed on it: select any two adjacent letters ... |
Solve the programming task below in a Python markdown code block.
Andi and Budi were given an assignment to tidy up their bookshelf of $n$ books. Each book is represented by the book title — a string $s_i$ numbered from $1$ to $n$, each with length $m$. Andi really wants to sort the book lexicographically ascending, w... |
Solve the programming task below in a Python markdown code block.
Hr0d1y has $q$ queries on a binary string $s$ of length $n$. A binary string is a string containing only characters '0' and '1'.
A query is described by a pair of integers $l_i$, $r_i$ $(1 \leq l_i \lt r_i \leq n)$.
For each query, he has to determine... |
Solve the programming task below in a Python markdown code block.
To write a research paper, you should definitely follow the structured format. This format, in many cases, is strictly defined, and students who try to write their papers have a hard time with it.
One of such formats is related to citations. If you ref... |
Solve the programming task below in a Python markdown code block.
For given an integer $n$, print all permutations of $\\{1, 2, ..., n\\}$ in lexicographic order.
Constraints
* $1 \leq n \leq 9$
Input
An integer $n$ is given in a line.
Output
Print each permutation in a line in order. Separate adjacency elements... |
Solve the programming task below in a Python markdown code block.
Today an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya!
Sonya is an owl and she sleeps during the day and stay awake from minute l_1 to minute r_1 inclusive. Also, during the minute k she prinks an... |
Solve the programming task below in a Python markdown code block.
You are given a positive integer $n$. Since $n$ may be very large, you are given its binary representation.
You should compute the number of triples $(a,b,c)$ with $0 \leq a,b,c \leq n$ such that $a \oplus b$, $b \oplus c$, and $a \oplus c$ are the sid... |
Solve the programming task below in a Python markdown code block.
Given are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N. Determine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \leq B_i holds:
* Choose two dist... |
Solve the programming task below in a Python markdown code block.
A special type of prime is generated by the formula `p = 2^m * 3^n + 1` where `m` and `n` can be any non-negative integer.
The first `5` of these primes are `2, 3, 5, 7, 13`, and are generated as follows:
```Haskell
2 = 2^0 * 3^0 + 1
3 = 2^1 * 3^0 + 1... |
Solve the programming task below in a Python markdown code block.
"This problem is rubbish! There is not statement, and there are only 5 test cases. The problemsetter took liberties with this problem!" — people complained in the comments to one round on Codeforces. And even more... No, wait, the checker for the proble... |
Solve the programming task below in a Python markdown code block.
The Little Elephant has got a problem — somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.
The Little Elephant doesn't want to call the police until he understands if he could ha... |
Solve the programming task below in a Python markdown code block.
This is an interactive problem.
Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to find something to occupy herself. She couldn't think of any... |
Solve the programming task below in a Python markdown code block.
Monocarp is the coach of the Berland State University programming teams. He decided to compose a problemset for a training session for his teams.
Monocarp has $n$ problems that none of his students have seen yet. The $i$-th problem has a topic $a_i$ (a... |
Solve the programming task below in a Python markdown code block.
You've been collecting change all day, and it's starting to pile up in your pocket, but you're too lazy to see how much you've found.
Good thing you can code!
Create ```change_count()``` to return a dollar amount of how much change you have!
Valid ty... |
Solve the programming task below in a Python markdown code block.
If `a = 1, b = 2, c = 3 ... z = 26`
Then `l + o + v + e = 54`
and `f + r + i + e + n + d + s + h + i + p = 108`
So `friendship` is twice stronger than `love` :-)
The input will always be in lowercase and never be empty.
Write your solution by modif... |
Solve the programming task below in a Python markdown code block.
Shortest Common Non-Subsequence
A subsequence of a sequence $P$ is a sequence that can be derived from the original sequence $P$ by picking up some or no elements of $P$ preserving the order. For example, "ICPC" is a subsequence of "MICROPROCESSOR".
A... |
Solve the programming task below in a Python markdown code block.
Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immediately. Can you?
You are given a syste... |
Solve the programming task below in a Python markdown code block.
# # Task:
* #### Complete the pattern, using the special character ```■ □```
* #### In this kata, we draw some histogram of the sound performance of ups and downs.
# # Rules:
- parameter ```waves``` The value of sound waves, an array of numbe... |
Solve the programming task below in a Python markdown code block.
Seiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aizu for a long time in the 18th century. In order to reward him for his meritorious career in education, Katanobu Matsudaira, the lord of the domain of Aizu, had decid... |
Solve the programming task below in a Python markdown code block.
problem
There are many $ N $ colored balls of different weights in the queue. The queue is in ascending order from the beginning: $ 1,2,3, \ dots, N-1, N, 1,2,3, \ dots, N-1, N, 1,2,3, \ dots $ The balls are lined up, followed by the balls of color $ N... |
Solve the programming task below in a Python markdown code block.
One not particularly beautiful evening Valera got very bored. To amuse himself a little bit, he found the following game.
He took a checkered white square piece of paper, consisting of n × n cells. After that, he started to paint the white cells black ... |
Solve the programming task below in a Python markdown code block.
##Task:
You have to write a function `add` which takes two binary numbers as strings and returns their sum as a string.
##Note:
* You are `not allowed to convert binary to decimal & vice versa`.
* The sum should contain `No leading zeroes`.
##Examples... |
Solve the programming task below in a Python markdown code block.
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway network of $n$ sta... |
Solve the programming task below in a Python markdown code block.
Find the last element of the given argument(s).
## Examples
```python
last([1, 2, 3, 4]) ==> 4
last("xyz") ==> "z"
last(1, 2, 3, 4) ==> 4
```
In **javascript** and **CoffeeScript** a **list** will be an `array`, a `string` or the list of `a... |
Solve the programming task below in a Python markdown code block.
Implement a function which takes a string, and returns its hash value.
Algorithm steps:
* `a` := sum of the ascii values of the input characters
* `b` := sum of every difference between the consecutive characters of the input (second char minus first ... |
Solve the programming task below in a Python markdown code block.
Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they talked ... |
Solve the programming task below in a Python markdown code block.
In some country live wizards. They love to ride trolleybuses.
A city in this country has a trolleybus depot with n trolleybuses. Every day the trolleybuses leave the depot, one by one and go to the final station. The final station is at a distance of d... |
Solve the programming task below in a Python markdown code block.
Simple interest on a loan is calculated by simply taking the initial amount (the principal, p) and multiplying it by a rate of interest (r) and the number of time periods (n).
Compound interest is calculated by adding the interest after each time peri... |
Solve the programming task below in a Python markdown code block.
*Based on this Numberphile video: https://www.youtube.com/watch?v=Wim9WJeDTHQ*
---
Multiply all the digits of a nonnegative integer `n` by each other, repeating with the product until a single digit is obtained. The number of steps required is known a... |
Solve the programming task below in a Python markdown code block.
Chefs from all over the globe gather each year for an international convention. Each chef represents some country. Please, note that more than one chef can represent a country.
Each of them presents their best dish to the audience. The audience then sen... |
Solve the programming task below in a Python markdown code block.
Beaches are filled with sand, water, fish, and sun. Given a string, calculate how many times the words `"Sand"`, `"Water"`, `"Fish"`, and `"Sun"` appear without overlapping (regardless of the case).
## Examples
```python
sum_of_a_beach("WAtErSlIde") ... |
Solve the programming task below in a Python markdown code block.
Maksim walks on a Cartesian plane. Initially, he stands at the point $(0, 0)$ and in one move he can go to any of four adjacent points (left, right, up, down). For example, if Maksim is currently at the point $(0, 0)$, he can go to any of the following ... |
Solve the programming task below in a Python markdown code block.
Ayush, Ashish and Vivek are busy preparing a new problem for the next Codeforces round and need help checking if their test cases are valid.
Each test case consists of an integer $n$ and two arrays $a$ and $b$, of size $n$. If after some (possibly zero... |
Solve the programming task below in a Python markdown code block.
Variation of this nice kata, the war has expanded and become dirtier and meaner; both even and odd numbers will fight with their pointy `1`s. And negative integers are coming into play as well, with, ça va sans dire, a negative contribution (think of th... |
Solve the programming task below in a Python markdown code block.
In this kata we are focusing on the Numpy python package. You must write a function called `looper` which takes three integers `start, stop and number` as input and returns a list from `start` to `stop` with `number` total values in the list. Five exam... |
Solve the programming task below in a Python markdown code block.
Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x that a ≤ x ≤ b and x is divisible by k.
-----Input-----
The only line contains three space-separated integers k, a and b... |
Solve the programming task below in a Python markdown code block.
The Fair Nut likes kvass very much. On his birthday parents presented him $n$ kegs of kvass. There are $v_i$ liters of kvass in the $i$-th keg. Each keg has a lever. You can pour your glass by exactly $1$ liter pulling this lever. The Fair Nut likes thi... |
Solve the programming task below in a Python markdown code block.
Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. Also, when... |
Solve the programming task below in a Python markdown code block.
The Fair Nut is going to travel to the Tree Country, in which there are $n$ cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connected graph without cycles). Nut wants to rent a car in the c... |
Solve the programming task below in a Python markdown code block.
For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows:
- Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations.
- Change S_i... |
Solve the programming task below in a Python markdown code block.
You have $n \times n$ square grid and an integer $k$. Put an integer in each cell while satisfying the conditions below. All numbers in the grid should be between $1$ and $k$ inclusive. Minimum number of the $i$-th row is $1$ ($1 \le i \le n$). Minim... |
Solve the programming task below in a Python markdown code block.
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon ... |
Solve the programming task below in a Python markdown code block.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.
The park is a ... |
Solve the programming task below in a Python markdown code block.
Mike and !Mike are old childhood rivals, they are opposite in everything they do, except programming. Today they have a problem they cannot solve on their own, but together (with you) — who knows?
Every one of them has an integer sequences a and b of ... |
Solve the programming task below in a Python markdown code block.
Little town Nsk consists of n junctions connected by m bidirectional roads. Each road connects two distinct junctions and no two roads connect the same pair of junctions. It is possible to get from any junction to any other junction by these roads. The ... |
Solve the programming task below in a Python markdown code block.
Sereja loves number sequences very much. That's why he decided to make himself a new one following a certain algorithm.
Sereja takes a blank piece of paper. Then he starts writing out the sequence in m stages. Each time he either adds a new number to t... |
Solve the programming task below in a Python markdown code block.
Ancient Egyptians are known to have used a large set of symbols $\sum$ to write on the walls of the temples. Fafa and Fifa went to one of the temples and found two non-empty words S_1 and S_2 of equal lengths on the wall of temple written one below the ... |
Solve the programming task below in a Python markdown code block.
You are given a tree (an undirected connected graph without cycles) and an integer $s$.
Vanya wants to put weights on all edges of the tree so that all weights are non-negative real numbers and their sum is $s$. At the same time, he wants to make the d... |
Solve the programming task below in a Python markdown code block.
Is the number even?
If the numbers is even return `true`. If it's odd, return `false`.
Oh yeah... the following symbols/commands have been disabled!
use of ```%```
use of ```.even?``` in Ruby
use of ```mod``` in Python
Write your solution by mo... |
Solve the programming task below in a Python markdown code block.
Given a random string consisting of numbers, letters, symbols, you need to sum up the numbers in the string.
Note:
- Consecutive integers should be treated as a single number. eg, `2015` should be treated as a single number `2015`, NOT four numbers
-... |
Solve the programming task below in a Python markdown code block.
Alice is playing with some stones.
Now there are three numbered heaps of stones. The first of them contains $a$ stones, the second of them contains $b$ stones and the third of them contains $c$ stones.
Each time she can do one of two operations: take... |
Solve the programming task below in a Python markdown code block.
From the divine land of heaven came to earth a fruit known as Magic fruit.Unfortunately the fruit was found by two friends X and Y.
After lot of fighting,they came to the conclusion that they will share the fruit if and only if when they can divide it i... |
Solve the programming task below in a Python markdown code block.
Recently Luba learned about a special kind of numbers that she calls beautiful numbers. The number is called beautiful iff its binary representation consists of k + 1 consecutive ones, and then k consecutive zeroes.
Some examples of beautiful numbers: ... |
Solve the programming task below in a Python markdown code block.
Given two words and a letter, return a single word that's a combination of both words, merged at the point where the given letter first appears in each word. The returned word should have the beginning of the first word and the ending of the second, wit... |
Solve the programming task below in a Python markdown code block.
Ridbit starts with an integer $n$.
In one move, he can perform one of the following operations:
divide $n$ by one of its proper divisors, or
subtract $1$ from $n$ if $n$ is greater than $1$.
A proper divisor is a divisor of a number, excluding itsel... |
Solve the programming task below in a Python markdown code block.
Problem
You brought a flat, holeless donut with a $ W $ horizontal $ H $ vertical $ H $ rectangle for ACPC.
Place this donut on the $ 2 $ dimension plane coordinate $ (0,0) $ with the center of the donut so that the side of length H and the $ y $ axis ... |
Solve the programming task below in a Python markdown code block.
Arkady coordinates rounds on some not really famous competitive programming platform. Each round features $n$ problems of distinct difficulty, the difficulties are numbered from $1$ to $n$.
To hold a round Arkady needs $n$ new (not used previously) pro... |
Solve the programming task below in a Python markdown code block.
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.
A message is a sequence of n integers a1, a... |
Solve the programming task below in a Python markdown code block.
A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs.
Catacombs consist of several rooms and bidirectional passages between some pairs of them.... |
Solve the programming task below in a Python markdown code block.
One of the oddest traditions of the town of Gameston may be that even the town mayor of the next term is chosen according to the result of a game. When the expiration of the term of the mayor approaches, at least three candidates, including the mayor of... |
Solve the programming task below in a Python markdown code block.
You are given a functional graph. It is a directed graph, in which from each vertex goes exactly one arc. The vertices are numerated from 0 to n - 1.
Graph is given as the array f_0, f_1, ..., f_{n} - 1, where f_{i} — the number of vertex to which goes... |
Solve the programming task below in a Python markdown code block.
You are given a matrix, consisting of n rows and m columns. The rows are numbered top to bottom, the columns are numbered left to right.
Each cell of the matrix can be either free or locked.
Let's call a path in the matrix a staircase if it:
* sta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.