question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
ZS the Coder has drawn an undirected graph of n vertices numbered from 0 to n - 1 and m edges between them. Each edge of the graph is weighted, each weight is a positive integer.
The next day, ZS the Coder realized that some of the weights were erased!... |
Solve the programming task below in a Python markdown code block.
School holidays come in Berland. The holidays are going to continue for n days. The students of school βN are having the time of their lives and the IT teacher Marina Sergeyevna, who has spent all the summer busy checking the BSE (Berland State Examinat... |
Solve the programming task below in a Python markdown code block.
Two players play a game. The game is played on a rectangular board with n Γ m squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the same square. The second player ai... |
Solve the programming task below in a Python markdown code block.
Dima has a hamsters farm. Soon N hamsters will grow up on it and Dima will sell them in a city nearby.
Hamsters should be transported in boxes. If some box is not completely full, the hamsters in it are bored, that's why each box should be completely f... |
Solve the programming task below in a Python markdown code block.
Boboniu gives you
$r$ red balls, $g$ green balls, $b$ blue balls, $w$ white balls.
He allows you to do the following operation as many times as you want:
Pick a red ball, a green ball, and a blue ball and then change their color to white.
... |
Solve the programming task below in a Python markdown code block.
A hero is on his way to the castle to complete his mission. However, he's been told that the castle is surrounded with a couple of powerful dragons! each dragon takes 2 bullets to be defeated, our hero has no idea how many bullets he should carry.. Assu... |
Solve the programming task below in a Python markdown code block.
Given the integer $n$ β the number of available blocks. You must use all blocks to build a pedestal.
The pedestal consists of $3$ platforms for $2$-nd, $1$-st and $3$-rd places respectively. The platform for the $1$-st place must be strictly higher tha... |
Solve the programming task below in a Python markdown code block.
Truncate the given string (first argument) if it is longer than the given maximum length (second argument). Return the truncated string with a `"..."` ending.
Note that inserting the three dots to the end will add to the string length.
However, if the... |
Solve the programming task below in a Python markdown code block.
During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that had been living at this planet. What's interesting is that t... |
Solve the programming task below in a Python markdown code block.
Petya has got an interesting flower. Petya is a busy person, so he sometimes forgets to water it. You are given n days from Petya's live and you have to determine what happened with his flower in the end.
The flower grows as follows:
* If the flowe... |
Solve the programming task below in a Python markdown code block.
AND gates and OR gates are basic components used in building digital circuits. Both gates have two input lines and one output line. The output of an AND gate is 1 if both inputs are 1, otherwise the output is 0. The output of an OR gate is 1 if at least... |
Solve the programming task below in a Python markdown code block.
For a dictionary $M$ that stores elements formed by a pair of a string key and an integer value, perform a sequence of the following operations. Note that each key in $M$ must be unique.
* insert($key$, $x$): Insert an element formed by a pair of $key$... |
Solve the programming task below in a Python markdown code block.
You're re-designing a blog and the blog's posts have the following format for showing the date and time a post was made:
*Weekday* *Month* *Day*, *time*
e.g.,
Friday May 2, 7pm
You're running out of screen real estate, and on some pages you want to ... |
Solve the programming task below in a Python markdown code block.
Niwango-kun has \\(N\\) chickens as his pets. The chickens are identified by numbers \\(1\\) to \\(N\\), and the size of the \\(i\\)-th chicken is a positive integer \\(a_i\\).
\\(N\\) chickens decided to take each other's hand (wing) and form some cyc... |
Solve the programming task below in a Python markdown code block.
Once upon a time when people still believed in magic, there was a great wizard Aranyaka Gondlir. After twenty years of hard training in a deep forest, he had finally mastered ultimate magic, and decided to leave the forest for his home.
Arriving at his... |
Solve the programming task below in a Python markdown code block.
The Travelling Salesman spends a lot of time travelling so he tends to get bored. To pass time, he likes to perform operations on numbers. One such operation is to take a positive integer x and reduce it to the number of bits set to 1 in the binary repr... |
Solve the programming task below in a Python markdown code block.
Polycarp decided to relax on his weekend and visited to the performance of famous ropewalkers: Agafon, Boniface and Konrad.
The rope is straight and infinite in both directions. At the beginning of the performance, Agafon, Boniface and Konrad are locat... |
Solve the programming task below in a Python markdown code block.
In a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0.
You are given a sequence h=\{h_1,h_2,h_3,......\} as input. You would like to change the height of Flower k to h_k for all k (1 \leq k \leq N), by... |
Solve the programming task below in a Python markdown code block.
Arkady owns a non-decreasing array $a_1, a_2, \ldots, a_n$. You are jealous of its beauty and want to destroy this property. You have a so-called XOR-gun that you can use one or more times.
In one step you can select two consecutive elements of the arr... |
Solve the programming task below in a Python markdown code block.
Given a number `n` we will define its scORe to be `0 | 1 | 2 | 3 | ... | n`, where `|` is the [bitwise OR operator](https://en.wikipedia.org/wiki/Bitwise_operation#OR).
Write a function that takes `n` and finds its scORe.
---------------------
| n ... |
Solve the programming task below in a Python markdown code block.
Alice wants to send an email to Miku on her mobile phone.
The only buttons that can be used for input on mobile phones are number buttons. Therefore, in order to input characters, the number buttons are pressed several times to input characters. The fo... |
Solve the programming task below in a Python markdown code block.
You are given three integers A, B and C.
Determine whether C is not less than A and not greater than B.
-----Constraints-----
- -100β€A,B,Cβ€100
- A, B and C are all integers.
-----Input-----
Input is given from Standard Input in the following format... |
Solve the programming task below in a Python markdown code block.
You are given a non-decreasing array of non-negative integers $a_1, a_2, \ldots, a_n$. Also you are given a positive integer $k$.
You want to find $m$ non-decreasing arrays of non-negative integers $b_1, b_2, \ldots, b_m$, such that: The size of $b_i$... |
Solve the programming task below in a Python markdown code block.
-----Input-----
The only line of the input is a string of 7 characters. The first character is letter A, followed by 6 digits. The input is guaranteed to be valid (for certain definition of "valid").
-----Output-----
Output a single integer.
-----... |
Solve the programming task below in a Python markdown code block.
Recently Luba bought a monitor. Monitor is a rectangular matrix of size n Γ m. But then she started to notice that some pixels cease to work properly. Luba thinks that the monitor will become broken the first moment when it contains a square k Γ k consi... |
Solve the programming task below in a Python markdown code block.
Create an identity matrix of the specified size( >= 0).
Some examples:
```
(1) => [[1]]
(2) => [ [1,0],
[0,1] ]
[ [1,0,0,0,0],
[0,1,0,0,0],
(5) => [0,0,1,0,0],
[0,0,0,1,0],
[0,0,0,0,1] ]
```
Write ... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese , Russian and Vietnamese as well.
Akhil comes across a string S of length N. He started wondering about the smallest lexicographical subsequence of string S of length K.
A subsequence of a string is formed b... |
Solve the programming task below in a Python markdown code block.
Write a program which replace all the lower-case letters of a given text with the corresponding captital letters.
Input
A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or ... |
Solve the programming task below in a Python markdown code block.
Tom is solving an IQ quiz in which he is stuck in a question which says that there are two circles whose center coordinates and radius are given. Now Tom has to find whether the two circles overlap, do not overlap or are tangential with each other. Help... |
Solve the programming task below in a Python markdown code block.
In order to do some research, n^2 labs are built on different heights of a mountain. Let's enumerate them with integers from 1 to n^2, such that the lab with the number 1 is at the lowest place, the lab with the number 2 is at the second-lowest place, β¦... |
Solve the programming task below in a Python markdown code block.
Complete the function that takes two numbers as input, ```num``` and ```nth``` and return the `nth` digit of `num` (counting from right to left).
## Note
- If ```num``` is negative, ignore its sign and treat it as a positive value
- If ```nth``` is not... |
Solve the programming task below in a Python markdown code block.
Guy-Manuel and Thomas have an array $a$ of $n$ integers [$a_1, a_2, \dots, a_n$]. In one step they can add $1$ to any element of the array. Formally, in one step they can choose any integer index $i$ ($1 \le i \le n$) and do $a_i := a_i + 1$.
If either... |
Solve the programming task below in a Python markdown code block.
A smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program that reads the participant number and the number of fish caught or released in order as one event, and outputs the participan... |
Solve the programming task below in a Python markdown code block.
Bit Vectors/Bitmaps
A bitmap is one way of efficiently representing sets of unique integers using single bits.
To see how this works, we can represent a set of unique integers between `0` and `< 20` using a vector/array of 20 bits:
```
var set = [3, 14,... |
Solve the programming task below in a Python markdown code block.
Tenten runs a weapon shop for ninjas. Today she is willing to sell $n$ shurikens which cost $1$, $2$, ..., $n$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is ... |
Solve the programming task below in a Python markdown code block.
One of the games that uses the Hyakunin Isshu tag is "Buddhist turning". It is a simple game that uses only picture cards, so it is widely enjoyed. There are various derivative types of rules, but the shaved turn considered here is performed by N partic... |
Solve the programming task below in a Python markdown code block.
You are a biologist working on the amino acid composition of proteins. Every protein consists of a long chain of 20 different amino acids with different properties.
Currently, you are collecting data on the percentage, various amino acids make up a pr... |
Solve the programming task below in a Python markdown code block.
Vus the Cossack has a field with dimensions n Γ m, which consists of "0" and "1". He is building an infinite field from this field. He is doing this in this way:
1. He takes the current field and finds a new inverted field. In other words, the new fi... |
Solve the programming task below in a Python markdown code block.
Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easiest one. She takes in her hand one or several camomiles and... |
Solve the programming task below in a Python markdown code block.
In this Kata, you will be given an integer array and your task is to return the sum of elements occupying prime-numbered indices.
~~~if-not:fortran
The first element of the array is at index `0`.
~~~
~~~if:fortran
The first element of an array is at ... |
Solve the programming task below in a Python markdown code block.
# Task
The string is called `prime` if it cannot be constructed by concatenating some (more than one) equal strings together.
For example, "abac" is prime, but "xyxy" is not("xyxy"="xy"+"xy").
Given a string determine if it is prime or not.
# Inp... |
Solve the programming task below in a Python markdown code block.
Morning desert sun horizon
Rise above the sands of time...
Fates Warning, "Exodus"
After crossing the Windswept Wastes, Ori has finally reached the Windtorn Ruins to find the Heart of the Forest! However, the ancient repository containing this pricel... |
Solve the programming task below in a Python markdown code block.
There are a total of W x H squares, with H rows vertically and W columns horizontally. Some squares are marked. Create a program that reads the marked state of each square and outputs the maximum rectangular area consisting of only the unmarked squares.... |
Solve the programming task below in a Python markdown code block.
A very passive-aggressive co-worker of yours was just fired. While he was gathering his things, he quickly inserted a bug into your system which renamed everything to what looks like jibberish. He left two notes on his desk, one reads: "ABCDEFGHIJKLMNOP... |
Solve the programming task below in a Python markdown code block.
You are currently in the United States of America. The main currency here is known as the United States Dollar (USD). You are planning to travel to another country for vacation, so you make it today's goal to convert your USD (all bills, no cents) into ... |
Solve the programming task below in a Python markdown code block.
Andrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary art.
The main exhibit is a construction of n matryoshka dolls that can be nested one into another. The matryoshka dolls a... |
Solve the programming task below in a Python markdown code block.
Maki is a house cat. One day she fortunately came at a wonderful-looking dried fish. Since she felt not hungry on that day, she put it up in her bed. However there was a problem; a rat was living in her house, and he was watching for a chance to steal h... |
Solve the programming task below in a Python markdown code block.
Last week, Hamed learned about a new type of equations in his math class called Modular Equations. Lets define i modulo j as the remainder of division of i by j and denote it by $i \operatorname{mod} j$. A Modular Equation, as Hamed's teacher described,... |
Solve the programming task below in a Python markdown code block.
Let us consider the following operations on a string consisting of A and B:
- Select a character in a string. If it is A, replace it with BB. If it is B, replace with AA.
- Select a substring that is equal to either AAA or BBB, and delete it from the ... |
Solve the programming task below in a Python markdown code block.
There are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S.
Adjacent... |
Solve the programming task below in a Python markdown code block.
A rare article in the Internet is posted without a possibility to comment it. On a Polycarp's website each article has comments feed.
Each comment on Polycarp's website is a non-empty string consisting of uppercase and lowercase letters of English alph... |
Solve the programming task below in a Python markdown code block.
Create a function that returns the sum of the two lowest positive numbers given an array of minimum 4 positive integers. No floats or non-positive integers will be passed.
For example, when an array is passed like `[19, 5, 42, 2, 77]`, the output shoul... |
Solve the programming task below in a Python markdown code block.
Internet search engines, such as Google, automatically sort and categorize web pages around the world to create a huge database. It also parses the search keywords entered by the user and creates an inquiry statement for database search.
In each case, ... |
Solve the programming task below in a Python markdown code block.
Consider the range `0` to `10`. The primes in this range are: `2, 3, 5, 7`, and thus the prime pairs are: `(2,2), (2,3), (2,5), (2,7), (3,3), (3,5), (3,7),(5,5), (5,7), (7,7)`.
Let's take one pair `(2,7)` as an example and get the product, then sum the... |
Solve the programming task below in a Python markdown code block.
Complete the function `scramble(str1, str2)` that returns `true` if a portion of ```str1``` characters can be rearranged to match ```str2```, otherwise returns ```false```.
**Notes:**
* Only lower case letters will be used (a-z). No punctuation or dig... |
Solve the programming task below in a Python markdown code block.
Each student eagerly awaits the day he would pass the exams successfully. Thus, Vasya was ready to celebrate, but, alas, he didn't pass it. However, many of Vasya's fellow students from the same group were more successful and celebrated after the exam.
... |
Solve the programming task below in a Python markdown code block.
Sam has been teaching Jon the Game of Stones to sharpen his mind and help him devise a strategy to fight the white walkers. The rules of this game are quite simple: The game starts with n piles of stones indexed from 1 to n. The i-th pile contains s_{i... |
Solve the programming task below in a Python markdown code block.
There is a cave consisting of N rooms and M one-directional passages. The rooms are numbered 1 through N.
Takahashi is now in Room 1, and Room N has the exit. The i-th passage connects Room s_i and Room t_i (s_i < t_i) and can only be traversed in the d... |
Solve the programming task below in a Python markdown code block.
# Task
Given an array of integers, sum consecutive even numbers and consecutive odd numbers. Repeat the process while it can be done and return the length of the final array.
# Example
For `arr = [2, 1, 2, 2, 6, 5, 0, 2, 0, 5, 5, 7, 7, 4, 3, 3, 9]`
... |
Solve the programming task below in a Python markdown code block.
Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to play the game with him.
Before the very beginning of the game several cards are lain... |
Solve the programming task below in a Python markdown code block.
You have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \leq i \leq N) is v_i.
When you put two ingredients in the pot, they will vanish and result in the formation of a new ing... |
Solve the programming task below in a Python markdown code block.
Whereas humans nowadays read fewer and fewer books on paper, book readership among marmots has surged. Heidi has expanded the library and is now serving longer request sequences.
-----Input-----
Same as the easy version, but the limits have changed: ... |
Solve the programming task below in a Python markdown code block.
The look and say sequence is a sequence in which each number is the result of a "look and say" operation on the previous element.
Considering for example the classical version startin with `"1"`: `["1", "11", "21, "1211", "111221", ...]`. You can see t... |
Solve the programming task below in a Python markdown code block.
Little Petya wanted to give an April Fools Day present to some scientists. After some hesitation he decided to give them the array that he got as a present in Codeforces Round #153 (Div.2). The scientists rejoiced at the gift and decided to put some imp... |
Solve the programming task below in a Python markdown code block.
Jeel and Ashish play a game on an $n \times m$ matrix. The rows are numbered $1$ to $n$ from top to bottom and the columns are numbered $1$ to $m$ from left to right. They play turn by turn. Ashish goes first.
Initially, each cell of the matrix contain... |
Solve the programming task below in a Python markdown code block.
Vasya and Petya take part in a Codeforces round. The round lasts for two hours and contains five problems.
For this round the dynamic problem scoring is used. If you were lucky not to participate in any Codeforces round with dynamic problem scoring, he... |
Solve the programming task below in a Python markdown code block.
Write
```python
remove(text, what)
```
that takes in a string ```str```(```text``` in Python) and an object/hash/dict/Dictionary ```what``` and returns a string with the chars removed in ```what```.
For example:
```python
remove('this is a string',{'t':... |
Solve the programming task below in a Python markdown code block.
This problem differs from the next one only in the presence of the constraint on the equal length of all numbers $a_1, a_2, \dots, a_n$. Actually, this problem is a subtask of the problem D2 from the same contest and the solution of D2 solves this subta... |
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 a_0, a_1, ... |
Solve the programming task below in a Python markdown code block.
Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.
Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns TV off.
Yo... |
Solve the programming task below in a Python markdown code block.
Igor has been into chess for a long time and now he is sick of the game by the ordinary rules. He is going to think of new rules of the game and become world famous.
Igor's chessboard is a square of size n Γ n cells. Igor decided that simple rules guar... |
Solve the programming task below in a Python markdown code block.
You have a grid with `$m$` rows and `$n$` columns. Return the number of unique ways that start from the top-left corner and go to the bottom-right corner. You are only allowed to move right and down.
For example, in the below grid of `$2$` rows and `$3... |
Solve the programming task below in a Python markdown code block.
You will be given a string (x) featuring a cat 'C' and a mouse 'm'. The rest of the string will be made up of '.'.
You need to find out if the cat can catch the mouse from it's current position. The cat can jump over three characters. So:
C.....m ret... |
Solve the programming task below in a Python markdown code block.
Vasya has the square chessboard of size n Γ n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.
The cell of the field is under rook's attack, if there is at least one rook located in t... |
Solve the programming task below in a Python markdown code block.
Alice, Bob and Charlie are playing Card Game for Three, as below:
- At first, each of the three players has a deck consisting of some number of cards. Each card has a letter a, b or c written on it. The orders of the cards in the decks cannot be rearra... |
Solve the programming task below in a Python markdown code block.
You have a password which you often type β a string s of length n. Every character of this string is one of the first m lowercase Latin letters.
Since you spend a lot of time typing it, you want to buy a new keyboard.
A keyboard is a permutation of th... |
Solve the programming task below in a Python markdown code block.
Problem
Neat lives on the world line for a total of 360 days until the 30th of every month for 1 year and 12 months. In that world, N consecutive holidays with the same schedule were applied to people all over the world every year. Consecutive holidays... |
Solve the programming task below in a Python markdown code block.
Problem
Satake doesn't like being bent.
For example, I don't like pencils, chopsticks, and bent-shaped houses, and I don't like taking actions such as turning right or left.
By the way, Satake who lives on the XY plane is $ N $ shops $ (X_ {1}, Y_ {1}... |
Solve the programming task below in a Python markdown code block.
Little kids, Jack and Evan like playing their favorite game Glass-and-Stone. Today they want to play something new and came across Twitter on their father's laptop.
They saw it for the first time but were already getting bored to see a bunch of sentenc... |
Solve the programming task below in a Python markdown code block.
Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.
But I also don't want to use many numbers, so I'll choose three positive integers (they don't have to be... |
Solve the programming task below in a Python markdown code block.
Given an array A of N numbers, find the number of distinct pairs (i, j) such that j β₯i and A[i] = A[j].
First line of the input contains number of test cases T. Each test case has two lines, first line is the number N, followed by a line consisting of ... |
Solve the programming task below in a Python markdown code block.
One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks.
According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the... |
Solve the programming task below in a Python markdown code block.
A student of z-school found a kind of sorting called z-sort. The array a with n elements are z-sorted if two conditions hold:
a_{i} β₯ a_{i} - 1 for all even i, a_{i} β€ a_{i} - 1 for all odd i > 1.
For example the arrays [1,2,1,2] and [1,1,1,1] are... |
Solve the programming task below in a Python markdown code block.
High school student Vasya got a string of length n as a birthday present. This string consists of letters 'a' and 'b' only. Vasya denotes beauty of the string as the maximum length of a substring (consecutive subsequence) consisting of equal letters.
V... |
Solve the programming task below in a Python markdown code block.
A zero-indexed array ```arr``` consisting of n integers is given. The dominator of array ```arr``` is the value that occurs in more than half of the elements of ```arr```.
For example, consider array ```arr``` such that ```arr = [3,4,3,2,3,1,3,3]``` The... |
Solve the programming task below in a Python markdown code block.
Problem
Here is a list of strings. Let's take a break and play with shiritori. Shiritori is performed according to the following rules.
1. First of all, select one of your favorite strings from the list and exclude that string from the list.
2. Next, ... |
Solve the programming task below in a Python markdown code block.
Deoxyribonucleic acid, DNA is the primary information storage molecule in biological systems. It is composed of four nucleic acid bases Guanine ('G'), Cytosine ('C'), Adenine ('A'), and Thymine ('T').
Ribonucleic acid, RNA, is the primary messenger mo... |
Solve the programming task below in a Python markdown code block.
For integers b (b \geq 2) and n (n \geq 1), let the function f(b,n) be defined as follows:
- f(b,n) = n, when n < b
- f(b,n) = f(b,\,{\rm floor}(n / b)) + (n \ {\rm mod} \ b), when n \geq b
Here, {\rm floor}(n / b) denotes the largest integer not exce... |
Solve the programming task below in a Python markdown code block.
You are given an array $a_1, a_2 \dots a_n$. Calculate the number of tuples $(i, j, k, l)$ such that: $1 \le i < j < k < l \le n$; $a_i = a_k$ and $a_j = a_l$;
-----Input-----
The first line contains a single integer $t$ ($1 \le t \le 100$)Β β the... |
Solve the programming task below in a Python markdown code block.
A lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands "T" ("turn around") and "F" ("move 1 unit forward").
You are given a list of commands that will be give... |
Solve the programming task below in a Python markdown code block.
Sereja and his friends went to a picnic. The guys had n soda bottles just for it. Sereja forgot the bottle opener as usual, so the guys had to come up with another way to open bottles.
Sereja knows that the i-th bottle is from brand a_{i}, besides, you... |
Solve the programming task below in a Python markdown code block.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length $k$ is vowelly if there are positive integers $n$ and $m$ such that $n\cdot m = k$ and when the word is written by using $n$ rows a... |
Solve the programming task below in a Python markdown code block.
Problem D: Legendary Sword
* This problem contains a lot of two ingredients in the kitchen. Please be careful about heartburn.
The Demon King, who has finally revived, is about to invade the human world to wrap the world in darkness again.
The Demon ... |
Solve the programming task below in a Python markdown code block.
You are organizing a boxing tournament, where $n$ boxers will participate ($n$ is a power of $2$), and your friend is one of them. All boxers have different strength from $1$ to $n$, and boxer $i$ wins in the match against boxer $j$ if and only if $i$ i... |
Solve the programming task below in a Python markdown code block.
After all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of n bullet slots able to contain exactly k bullets, now the boy... |
Solve the programming task below in a Python markdown code block.
A large banner with word CODEFORCES was ordered for the 1000-th onsite round of Codeforces^{Ο} that takes place on the Miami beach. Unfortunately, the company that made the banner mixed up two orders and delivered somebody else's banner that contains so... |
Solve the programming task below in a Python markdown code block.
One day, the lord ordered a carpenter to "build a sturdy and large building where the townspeople could evacuate in the event of a typhoon or earthquake." However, large thick pillars are needed to complete the sturdy and large building. There is no suc... |
Solve the programming task below in a Python markdown code block.
There are K nuclear reactor chambers labelled from 0 to K-1. Particles are bombarded onto chamber 0. The particles keep collecting in the chamber 0. However if at any time, there are more than N particles in a chamber, a reaction will cause 1 particle t... |
Solve the programming task below in a Python markdown code block.
Polycarp analyzes the prices of the new berPhone. At his disposal are the prices for $n$ last days: $a_1, a_2, \dots, a_n$, where $a_i$ is the price of berPhone on the day $i$.
Polycarp considers the price on the day $i$ to be bad if later (that is, a ... |
Solve the programming task below in a Python markdown code block.
Zookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either "AB" or "BB". When he bombs such a substring, the substring gets deleted from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.