question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Kevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length n. Each character of Kevin's string represents Kevin's score on one of the n questions of the olympiad—'1' for... |
Solve the programming task below in a Python markdown code block.
Karen has just arrived at school, and she has a math test today!
<image>
The test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time to make an actual test. So, they ... |
Solve the programming task below in a Python markdown code block.
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.
Artem wants to create a basic multiset of in... |
Solve the programming task below in a Python markdown code block.
There are N holes in a two-dimensional plane. The coordinates of the i-th hole are (x_i,y_i).
Let R=10^{10^{10^{10}}}. Ringo performs the following operation:
* Randomly choose a point from the interior of a circle of radius R centered at the origin, ... |
Solve the programming task below in a Python markdown code block.
Takahashi has two positive integers A and B.
It is known that A plus B equals N. Find the minimum possible value of "the sum of the digits of A" plus "the sum of the digits of B" (in base 10).
Constraints
* 2 ≤ N ≤ 10^5
* N is an integer.
Input
Inp... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian as well.
A version control system(VCS) is a repository of files, often the files for the source code of computer programs, with monitored access. Every change made to the source is tracked, alo... |
Solve the programming task below in a Python markdown code block.
You are given a huge decimal number consisting of $n$ digits. It is guaranteed that this number has no leading zeros. Each digit of this number is either 0 or 1.
You may perform several (possibly zero) operations with this number. During each operation... |
Solve the programming task below in a Python markdown code block.
Maya writes weekly articles to a well known magazine, but she is missing one word each time she is about to send the article to the editor. The article is not complete without this word. Maya has a friend, Dan, and he is very good with words, but he doe... |
Solve the programming task below in a Python markdown code block.
If you draw a few infinitely long straight lines on an infinitely wide plane, this plane will be divided into several areas. For example, if you draw a straight line, the plane will be divided into two areas. Even if you draw the same number of straight... |
Solve the programming task below in a Python markdown code block.
Mr. E Ven only likes even length words.
Please create a translator so that he doesn't have to hear those pesky odd length words.
For some reason he also hates punctuation, he likes his sentences to flow.
Your translator should take in a string and outp... |
Solve the programming task below in a Python markdown code block.
At 17:00, special agent Jack starts to escape from the enemy camp. There is a cliff in between the camp and the nearest safety zone. Jack has to climb the almost vertical cliff by stepping his feet on the blocks that cover the cliff. The cliff has slipp... |
Solve the programming task below in a Python markdown code block.
This kata is from check py.checkio.org
You are given an array with positive numbers and a number N. You should find the N-th power of the element in the array with the index N. If N is outside of the array, then return -1. Don't forget that the first e... |
Solve the programming task below in a Python markdown code block.
The official capital and the cultural capital of Berland are connected by a single road running through n regions. Each region has a unique climate, so the i-th (1 ≤ i ≤ n) region has a stable temperature of ti degrees in summer.
This summer a group of... |
Solve the programming task below in a Python markdown code block.
Nezzar has $n$ balls, numbered with integers $1, 2, \ldots, n$. Numbers $a_1, a_2, \ldots, a_n$ are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that $a_i \leq a_{i+1}$ for all $1 \leq i < n$.
Nezzar... |
Solve the programming task below in a Python markdown code block.
We, the researchers who discovered and investigated the ancient nation Iwashiro, finally discovered the temple in the center of Iwashiro. A lithograph dedicated to the god of Iwashiro was stored in the temple. On the lithograph, two strings were written... |
Solve the programming task below in a Python markdown code block.
You are given a string $s$ consisting of $n$ lowercase Latin letters.
You have to remove at most one (i.e. zero or one) character of this string in such a way that the string you obtain will be lexicographically smallest among all strings that can be o... |
Solve the programming task below in a Python markdown code block.
Omkar is playing his favorite pixelated video game, Bed Wars! In Bed Wars, there are $n$ players arranged in a circle, so that for all $j$ such that $2 \leq j \leq n$, player $j - 1$ is to the left of the player $j$, and player $j$ is to the right of pl... |
Solve the programming task below in a Python markdown code block.
Notice that the memory limit is non-standard.
Recently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he even got himself a favorite correct brack... |
Solve the programming task below in a Python markdown code block.
Wherever the destination is, whoever we meet, let's render this song together.
On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with corners (0, 0), (w, 0), (w, h) and (0, h). It can be seen that no col... |
Solve the programming task below in a Python markdown code block.
We ask you to select some number of positive integers, and calculate the sum of them.
It is allowed to select as many integers as you like, and as large integers as you wish.
You have to follow these, however: each selected integer needs to be a multipl... |
Solve the programming task below in a Python markdown code block.
You are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get from the lectu... |
Solve the programming task below in a Python markdown code block.
We have a rectangular grid of squares with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left. On this grid, there is a piece, which is initially placed at square (s_r,s_c... |
Solve the programming task below in a Python markdown code block.
For an array $b$ of length $m$ we define the function $f$ as $ f(b) = \begin{cases} b[1] & \quad \text{if } m = 1 \\ f(b[1] \oplus b[2],b[2] \oplus b[3],\dots,b[m-1] \oplus b[m]) & \quad \text{otherwise,} \end{cases} $
where $\oplus$ is bitwise exclu... |
Solve the programming task below in a Python markdown code block.
At Akabeko Elementary School, all the students participate in a slightly unusual jogging. Students run their own lap courses at their own pace. After going around each of your courses, you will be returned to elementary school. How many laps do they all... |
Solve the programming task below in a Python markdown code block.
Now I have a card with n numbers on it. Consider arranging some or all of these appropriately to make numbers. Find the number obtained by adding all the numbers created at this time.
For example, if you have 1 and 2, you will get 4 numbers 1, 2, 12, 2... |
Solve the programming task below in a Python markdown code block.
A **bouncy number** is a positive integer whose digits neither increase nor decrease. For example, `1235` is an increasing number, `5321` is a decreasing number, and `2351` is a bouncy number. By definition, all numbers under `100` are non-bouncy, and `... |
Solve the programming task below in a Python markdown code block.
Assume that you started to store items in progressively expanding square location, like this for the first 9 numbers:
```
05 04 03
06 01 02
07 08 09
```
And like this for the expanding to include up to the first 25 numbers:
```
17 16 15 14 13
18 05 0... |
Solve the programming task below in a Python markdown code block.
Taking into consideration the [3.5 edition rules](http://www.dandwiki.com/wiki/SRD:Ability_Scores#Table:_Ability_Modifiers_and_Bonus_Spells), your goal is to build a function that takes an ability score (worry not about validation: it is always going to... |
Solve the programming task below in a Python markdown code block.
Write a function named `first_non_repeating_letter` that takes a string input, and returns the first character that is not repeated anywhere in the string.
For example, if given the input `'stress'`, the function should return `'t'`, since the letter *... |
Solve the programming task below in a Python markdown code block.
Vasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell $(0, 0)$. Robot can perform the following four kinds of operations: U — move from $(x, y)$ to $(x, y + 1)$; D — move from $(x, y)$ to $(x, y - 1)$; L — mov... |
Solve the programming task below in a Python markdown code block.
In some country live wizards. They love playing with numbers.
The blackboard has two numbers written on it — a and b. The order of the numbers is not important. Let's consider a ≤ b for the sake of definiteness. The players can cast one of the two spe... |
Solve the programming task below in a Python markdown code block.
Given a hash of letters and the number of times they occur, recreate all of the possible anagram combinations that could be created using all of the letters, sorted alphabetically.
The inputs will never include numbers, spaces or any special characters... |
Solve the programming task below in a Python markdown code block.
As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.
Snuke, an employee, would like to play with this sequence.
Specifically, he would like to repeat the f... |
Solve the programming task below in a Python markdown code block.
For a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros in base 10 and is divisible by n.
For example, 4-rounding of 375 is 375·80 = 30000. 30000 is the minimum integer such that it ... |
Solve the programming task below in a Python markdown code block.
You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.
For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".
Note it ... |
Solve the programming task below in a Python markdown code block.
In this problem you have to solve a simple classification task: given an image, determine whether it depicts a Fourier doodle.
You are given a set of 50 images with ids 1 through 50. You are also given a text file labels.txt containing the labels for ... |
Solve the programming task below in a Python markdown code block.
Vus the Cossack holds a programming competition, in which $n$ people participate. He decided to award them all with pens and notebooks. It is known that Vus has exactly $m$ pens and $k$ notebooks.
Determine whether the Cossack can reward all participan... |
Solve the programming task below in a Python markdown code block.
A substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.
You are given a set of strings. A string (not necessarily from this set) is called good if all eleme... |
Solve the programming task below in a Python markdown code block.
Write a function which outputs the positions of matching bracket pairs. The output should be a dictionary with keys the positions of the open brackets '(' and values the corresponding positions of the closing brackets ')'.
For example: input = "(first)... |
Solve the programming task below in a Python markdown code block.
Addition of Big Integers
Given two integers $A$ and $B$, compute the sum, $A + B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the sum in a line.
Constraints
* $-1 \times 10^{100000} \leq A, B \... |
Solve the programming task below in a Python markdown code block.
Diamond Miner is a game that is similar to Gold Miner, but there are $n$ miners instead of $1$ in this game.
The mining area can be described as a plane. The $n$ miners can be regarded as $n$ points on the y-axis. There are $n$ diamond mines in the min... |
Solve the programming task below in a Python markdown code block.
Kate has a set $S$ of $n$ integers $\{1, \dots, n\} $.
She thinks that imperfection of a subset $M \subseteq S$ is equal to the maximum of $gcd(a, b)$ over all pairs $(a, b)$ such that both $a$ and $b$ are in $M$ and $a \neq b$.
Kate is a very neat ... |
Solve the programming task below in a Python markdown code block.
A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are not.
You are given string s consisting of... |
Solve the programming task below in a Python markdown code block.
You might have heard about our new goodie distribution program aka the "Laddu Accrual System". This problem is designed to give you a glimpse of its rules. You can read the page once before attempting the problem if you wish, nonetheless we will be prov... |
Solve the programming task below in a Python markdown code block.
The only difference between easy and hard versions are constraints on $n$ and $k$.
You are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most $k$ most recent conversations with your friends. Initially,... |
Solve the programming task below in a Python markdown code block.
According to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of them Vasya happened to determine... |
Solve the programming task below in a Python markdown code block.
You are given a sequence $a_1, a_2, \dots, a_n$ consisting of $n$ integers.
You may perform the following operation on this sequence: choose any element and either increase or decrease it by one.
Calculate the minimum possible difference between the m... |
Solve the programming task below in a Python markdown code block.
In this problem is used an extremely simplified version of HTML table markup. Please use the statement as a formal document and read it carefully.
A string is a bHTML table, if it satisfies the grammar:
TABLE ::= <table>ROWS</tabl... |
Solve the programming task below in a Python markdown code block.
In this simple exercise, you will build a program that takes a value, `integer `, and returns a list of its multiples up to another value, `limit `. If `limit` is a multiple of ```integer```, it should be included as well. There will only ever be positi... |
Solve the programming task below in a Python markdown code block.
One day shooshuns found a sequence of n integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps:
1. Find the number that goes k-th in the current sequence and add the same number to the ... |
Solve the programming task below in a Python markdown code block.
Mr. A, who will graduate next spring, decided to move when he got a job. The company that finds a job has offices in several towns, and the offices that go to work differ depending on the day. So Mr. A decided to live in a town where he had a short time... |
Solve the programming task below in a Python markdown code block.
B: Dansunau www --Dance Now!-
story
Last lab life! Daigakuin! !! Dosanko Snow has won 9th place in the event "Master Idol World", which can be said to be the outpost of the biggest competition "Lab Life" where master idols compete. The sharp dance is ... |
Solve the programming task below in a Python markdown code block.
problem
Five students, Taro, Jiro, Saburo, Shiro, and Hanako, participated in the JOI High School class.
In this class, a final exam was conducted. All five people took the final exam. For students with a final exam score of 40 or higher, the final ex... |
Solve the programming task below in a Python markdown code block.
Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b.
Constraints
* 0 < a, b ≤ 2,000,000,000
* LCM(a, b) ≤ 2,000,000,000
* The number of data sets ≤ 50
Input
Input consists of several ... |
Solve the programming task below in a Python markdown code block.
Takahashi has a lot of peculiar devices. These cylindrical devices receive balls from left and right. Each device is in one of the two states A and B, and for each state, the device operates as follows:
* When a device in state A receives a ball from e... |
Solve the programming task below in a Python markdown code block.
There is a programming language in which every program is a non-empty sequence of "<" and ">" signs and digits. Let's explain how the interpreter of this programming language works. A program is interpreted using movement of instruction pointer (IP) whi... |
Solve the programming task below in a Python markdown code block.
See the following triangle:
```
____________________________________
1
2 4 2
3 6 9 6 3
4 8 12 16 12 8 4
5 10 15 20 25 ... |
Solve the programming task below in a Python markdown code block.
Step through my `green glass door`.
You can take the `moon`, but not the `sun`.
You can take your `slippers`, but not your `sandals`.
You can go through `yelling`, but not `shouting`.
You can't run through `fast`, but you can run with `speed`.
You ... |
Solve the programming task below in a Python markdown code block.
10^{10^{10}} participants, including Takahashi, competed in two programming contests.
In each contest, all participants had distinct ranks from first through 10^{10^{10}}-th.
The score of a participant is the product of his/her ranks in the two contests... |
Solve the programming task below in a Python markdown code block.
After you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the English teacher told him to prepare an essay. Fedor didn't want to prepare the essay, so he asked Alex for help. Alex came to help an... |
Solve the programming task below in a Python markdown code block.
Gerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denominations that are powers of three: 1 ma... |
Solve the programming task below in a Python markdown code block.
N of us are going on a trip, by train or taxi.
The train will cost each of us A yen (the currency of Japan).
The taxi will cost us a total of B yen.
How much is our minimum total travel expense?
-----Constraints-----
- All values in input are integers... |
Solve the programming task below in a Python markdown code block.
Pari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is c_{i}. The price of the chocolate is k, so Pari will take a subset of her coins with sum equal to k and give it to Arya.
Looking at her coins, a question... |
Solve the programming task below in a Python markdown code block.
Write a program which reads three integers a, b and c, and prints "Yes" if a < b < c, otherwise "No".
Constraints
* 0 ≤ a, b, c ≤ 100
Input
Three integers a, b and c separated by a single space are given in a line.
Output
Print "Yes" or "No" in a ... |
Solve the programming task below in a Python markdown code block.
A population of bears consists of black bears, brown bears, and white bears.
The input is an array of two elements.
Determine whether the offspring of the two bears will return `'black'`, `'brown'`, `'white'`, `'dark brown'`, `'grey'`, `'light brown'... |
Solve the programming task below in a Python markdown code block.
Clock shows 'h' hours, 'm' minutes and 's' seconds after midnight.
Your task is to make 'Past' function which returns time converted to milliseconds.
## Example:
```python
past(0, 1, 1) == 61000
```
Input constraints: `0 <= h <= 23`, `0 <= m <= 59`,... |
Solve the programming task below in a Python markdown code block.
You are given a permutation of n numbers p1, p2, ..., pn. We perform k operations of the following type: choose uniformly at random two indices l and r (l ≤ r) and reverse the order of the elements pl, pl + 1, ..., pr. Your task is to find the expected ... |
Solve the programming task below in a Python markdown code block.
Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of them is able to perform any non-negative number of shots.
For every bullet that hits the shie... |
Solve the programming task below in a Python markdown code block.
Arithmetic Progressions
An arithmetic progression is a sequence of numbers $a_1, a_2, ..., a_k$ where the difference of consecutive members $a_{i+1} - a_i$ is a constant ($1 \leq i \leq k-1$). For example, the sequence 5, 8, 11, 14, 17 is an arithmetic... |
Solve the programming task below in a Python markdown code block.
A triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.
You will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.
-----Constraints-... |
Solve the programming task below in a Python markdown code block.
You are playing a strange game with Li Chen. You have a tree with n nodes drawn on a piece of paper. All nodes are unlabeled and distinguishable. Each of you independently labeled the vertices from 1 to n. Neither of you know the other's labelling of th... |
Solve the programming task below in a Python markdown code block.
Ivan unexpectedly saw a present from one of his previous birthdays. It is array of $n$ numbers from $1$ to $200$. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its neighbours ls not less than it, mo... |
Solve the programming task below in a Python markdown code block.
General primality test are often computationally expensive, so in the biggest prime number race the idea is to study special sub-families of prime number and develop more effective tests for them.
[Mersenne Primes](https://en.wikipedia.org/wiki/Mersen... |
Solve the programming task below in a Python markdown code block.
Karafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. [Image]
Each Karafs has a positive integer height. Tavas has an infin... |
Solve the programming task below in a Python markdown code block.
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonneg... |
Solve the programming task below in a Python markdown code block.
Your task is to determine the top 3 place finishes in a pole vault competition involving several different competitors. This is isn't always so simple, and it is often a source of confusion for people who don't know the actual rules.
Here's what you ne... |
Solve the programming task below in a Python markdown code block.
One day, Niwango-kun, an employee of Dwango Co., Ltd., found an integer sequence (a_1, ..., a_N) of length N. He is interested in properties of the sequence a.
For a nonempty contiguous subsequence a_l, ..., a_r (1 \leq l \leq r \leq N) of the sequence... |
Solve the programming task below in a Python markdown code block.
Zonk is addictive dice game. In each round player rolls 6 dice. Then (s)he composes combinations from them. Each combination gives certain points.
Then player can take one or more dice combinations to his hand and re-roll remaining dice or save his sc... |
Solve the programming task below in a Python markdown code block.
King of Berland Berl IV has recently died. Hail Berl V! As a sign of the highest achievements of the deceased king the new king decided to build a mausoleum with Berl IV's body on the main square of the capital.
The mausoleum will be constructed from 2... |
Solve the programming task below in a Python markdown code block.
Professor Matsuzaki is a scientist studying the truth of the universe. Life, the universe, all the answers are said to be 42, but Professor Matsuzaki thinks that this alone is not enough to elucidate the truth of the universe. Professor Matsuzaki believ... |
Solve the programming task below in a Python markdown code block.
In the Bus of Characters there are $n$ rows of seat, each having $2$ seats. The width of both seats in the $i$-th row is $w_i$ centimeters. All integers $w_i$ are distinct.
Initially the bus is empty. On each of $2n$ stops one passenger enters the bus.... |
Solve the programming task below in a Python markdown code block.
We have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i.
Vertex i has an integer a_i written on it.
For every integer k from 1 through N, solve the following problem:
- We will make a sequence by lining up the integers writte... |
Solve the programming task below in a Python markdown code block.
We have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of substrings "ab" in the string and replace it with the string "bba". If we have no "ab" as a substring, our job is done. Print the minimum nu... |
Solve the programming task below in a Python markdown code block.
Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.
She will concatenate all of the strings in some order, to produce a long string.
Among all strings that she can produce in this way, find the lexicographically smalles... |
Solve the programming task below in a Python markdown code block.
Suppose there is a $h \times w$ grid consisting of empty or full cells. Let's make some definitions:
$r_{i}$ is the number of consecutive full cells connected to the left side in the $i$-th row ($1 \le i \le h$). In particular, $r_i=0$ if the leftmos... |
Solve the programming task below in a Python markdown code block.
In the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.
Write a program which reads an... |
Solve the programming task below in a Python markdown code block.
All of the animals are having a feast! Each animal is bringing one dish. There is just one rule: the dish must start and end with the same letters as the animal's name. For example, the great blue heron is bringing garlic naan and the chickadee is bring... |
Solve the programming task below in a Python markdown code block.
<image> <image>
*The two images are equivalent, feel free to use either one.
Input
The input contains a single integer a (-100 ≤ a ≤ 100).
Output
Output the result – an integer number.
Example
Input
1
Output
1
Read the inputs from stdin s... |
Solve the programming task below in a Python markdown code block.
There are S sheep and W wolves.
If the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.
If the wolves will attack the sheep, print unsafe; otherwise, print safe.
-----Constraints-----
- 1 \leq S \leq 100
-... |
Solve the programming task below in a Python markdown code block.
The pair of integer numbers `(m, n)`, such that `10 > m > n > 0`, (below 10), that its sum, `(m + n)`, and rest, `(m - n)`, are perfect squares, is (5, 4).
Let's see what we have explained with numbers.
```
5 + 4 = 9 = 3²
5 - 4 = 1 = 1²
(10 > 5 > 4 > ... |
Solve the programming task below in a Python markdown code block.
Takahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten. He remembers that the remainder of a divided by b was greater than or equal to K. Find the number of possible pairs that he may have had.
Constraints
* 1 \le... |
Solve the programming task below in a Python markdown code block.
Food contains three nutrients called "protein", "fat" and "carbohydrate", which are called three major nutrients. It is calculated that protein and carbohydrate are 4 kcal (kilocalories) and fat is 9 kcal per 1 g (gram). For example, according to the ta... |
Solve the programming task below in a Python markdown code block.
I'm traveling to a country with a rabbit. There are n cities in this country numbered from 1 to n, and the rabbit is now in city 1. City i is a point on the coordinate plane (xi, yi) ).
Rabbits travel to meet the following conditions.
* The travel pat... |
Solve the programming task below in a Python markdown code block.
Numbers of black and white points are placed on a plane. Let's imagine that a straight line of infinite length is drawn on the plane. When the line does not meet any of the points, the line divides these points into two groups. If the division by such a... |
Solve the programming task below in a Python markdown code block.
Consider a tic-tac-toe on a 3x3 board. Tic-tac-toe is a two-player battle game. Decide the first attack and the second attack, one hits Kuroishi and one hits Shiraishi. The winner is the person who puts stones one by one on the board alternately and arr... |
Solve the programming task below in a Python markdown code block.
Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.
The exam consists of $n$ problems that can be solved in $T$ minutes. Thus, the exam begins at time $0... |
Solve the programming task below in a Python markdown code block.
Vasya is reading a e-book. The file of the book consists of $n$ pages, numbered from $1$ to $n$. The screen is currently displaying the contents of page $x$, and Vasya wants to read the page $y$. There are two buttons on the book which allow Vasya to sc... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian.
Chef loves to prepare delicious dishes. This time, Chef has decided to prepare a special dish for you, and needs to gather several apples to do so.
Chef has N apple trees in his home garden. ... |
Solve the programming task below in a Python markdown code block.
The only difference between easy and hard versions is constraints.
There are $n$ kids, each of them is reading a unique book. At the end of any day, the $i$-th kid will give his book to the $p_i$-th kid (in case of $i = p_i$ the kid will give his book ... |
Solve the programming task below in a Python markdown code block.
We define $x \bmod y$ as the remainder of division of $x$ by $y$ ($\%$ operator in C++ or Java, mod operator in Pascal).
Let's call an array of positive integers $[a_1, a_2, \dots, a_k]$ stable if for every permutation $p$ of integers from $1$ to $k$, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.