question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
# Story&Task
There are three parties in parliament. The "Conservative Party", the "Reformist Party", and a group of independants.
You are a member of the “Conservative Party” and you party is trying to pass a bill. The “Reformist Party” is trying to ... |
Solve the programming task below in a Python markdown code block.
An army of n droids is lined up in one row. Each droid is described by m integers a_1, a_2, ..., a_{m}, where a_{i} is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of maximum... |
Solve the programming task below in a Python markdown code block.
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is conside... |
Solve the programming task below in a Python markdown code block.
There is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so that I can play with everyone in this game, but sadly ther... |
Solve the programming task below in a Python markdown code block.
Consider a game, wherein the player has to guess a target word. All the player knows is the length of the target word.
To help them in their goal, the game will accept guesses, and return the number of letters that are in the correct position.
Write a... |
Solve the programming task below in a Python markdown code block.
The Zoo in the Grid Kingdom is represented by an infinite grid. The Zoo has n observation binoculars located at the OX axis. For each i between 1 and n, inclusive, there exists a single binocular located at the point with coordinates (i, 0). There are m... |
Solve the programming task below in a Python markdown code block.
New Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.
Vasya's verse contains $n$ parts. It takes $a_i$ seconds to recite the $i$-th part. Vasya can't change the order of parts in the verse: firstly he... |
Solve the programming task below in a Python markdown code block.
After Vitaly was expelled from the university, he became interested in the graph theory.
Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.
Vitaly was wondering how to solve the following problem. You are giv... |
Solve the programming task below in a Python markdown code block.
You are given a simple connected undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M.
Edge i connects Vertex a_i and b_i bidirectionally.
Determine if three circuits (see Notes) ca... |
Solve the programming task below in a Python markdown code block.
A long time ago in some far country lived king Copa. After the recent king's reform, he got so large powers that started to keep the books by himself.
The total income A of his kingdom during 0-th year is known, as well as the total income B during n-t... |
Solve the programming task below in a Python markdown code block.
You're given a row with $n$ chairs. We call a seating of people "maximal" if the two following conditions hold: There are no neighbors adjacent to anyone seated. It's impossible to seat one more person without violating the first rule.
The seating i... |
Solve the programming task below in a Python markdown code block.
Given an array of integers your solution should find the smallest integer.
For example:
- Given `[34, 15, 88, 2]` your solution will return `2`
- Given `[34, -345, -1, 100]` your solution will return `-345`
You can assume, for the purpose of this ka... |
Solve the programming task below in a Python markdown code block.
Xenia the vigorous detective faced n (n ≥ 2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to n from left to right.
Spy s has an important note. He has to pass the note to spy f. Xenia interrogates the spies in several step... |
Solve the programming task below in a Python markdown code block.
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. ... |
Solve the programming task below in a Python markdown code block.
In Aizu prefecture, we decided to create a new town to increase the population. To that end, we decided to cultivate a new rectangular land and divide this land into squares of the same size. The cost of developing this land is proportional to the numbe... |
Solve the programming task below in a Python markdown code block.
Anfisa the monkey learns to type. She is yet unfamiliar with the "space" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into k lines not sho... |
Solve the programming task below in a Python markdown code block.
The famous global economic crisis is approaching rapidly, so the states of Berman, Berance and Bertaly formed an alliance and allowed the residents of all member states to freely pass through the territory of any of them. In addition, it was decided tha... |
Solve the programming task below in a Python markdown code block.
Problem statement
A $ 2 $ human-player match-up game tournament is about to take place in front of Kyoto University Camphor Tree.
There are $ 2 ^ N $ participants in this tournament, numbered from $ 1 $ to $ 2 ^ N $.
Winning or losing when $ 2 $ of p... |
Solve the programming task below in a Python markdown code block.
As a New Year's gift, Dolphin received a string s of length 19.
The string s has the following format: [five lowercase English letters],[seven lowercase English letters],[five lowercase English letters].
Dolphin wants to convert the comma-separated st... |
Solve the programming task below in a Python markdown code block.
In the year of $30XX$ participants of some world programming championship live in a single large hotel. The hotel has $n$ floors. Each floor has $m$ sections with a single corridor connecting all of them. The sections are enumerated from $1$ to $m$ alon... |
Solve the programming task below in a Python markdown code block.
You have N items that you want to put them into a knapsack. Item i has value vi and weight wi.
You want to find a subset of items to put such that:
* The total value of the items is as large as possible.
* The items have combined weight at most W, tha... |
Solve the programming task below in a Python markdown code block.
Given a time in AM/PM format as a string, convert it to military (24-hour) time as a string.
Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock
Sample Inp... |
Solve the programming task below in a Python markdown code block.
Write a function that returns the index of the first occurence of the word "Wally". "Wally" must not be part of another word, but it can be directly followed by a punctuation mark. If no such "Wally" exists, return -1.
Examples:
"Wally" => 0
"Wher... |
Solve the programming task below in a Python markdown code block.
There are N dishes of cuisine placed in front of Takahashi and Aoki. For convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.
When Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happine... |
Solve the programming task below in a Python markdown code block.
Your company, [Congo Pizza](http://interesting-africa-facts.com/Africa-Landforms/Congo-Rainforest-Facts.html), is the second-largest online frozen pizza retailer. You own a number of international warehouses that you use to store your frozen pizzas, and... |
Solve the programming task below in a Python markdown code block.
Alice and Bob are playing a game. They are given an array $A$ of length $N$. The array consists of integers. They are building a sequence together. In the beginning, the sequence is empty. In one turn a player can remove a number from the left or right ... |
Solve the programming task below in a Python markdown code block.
Sagheer is working at a kindergarten. There are n children and m different toys. These children use well-defined protocols for playing with the toys:
* Each child has a lovely set of toys that he loves to play with. He requests the toys one after ano... |
Solve the programming task below in a Python markdown code block.
You are given an array a of n positive integers.
You can use the following operation as many times as you like: select any integer 1 ≤ k ≤ n and do one of two things:
* decrement by one k of the first elements of the array.
* decrement by one k ... |
Solve the programming task below in a Python markdown code block.
You are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft $k$ torches. One torch can be crafted using one stick and one coal.
Hopefully, you've met a very handsome wandering trader who has two trade offers: ... |
Solve the programming task below in a Python markdown code block.
In this Kata, we are going to see how a Hash (or Map or dict) can be used to keep track of characters in a string.
Consider two strings `"aabcdefg"` and `"fbd"`. How many characters do we have to remove from the first string to get the second string? ... |
Solve the programming task below in a Python markdown code block.
Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist of n nodes connected with minimum possible number of wires into one network (a wire directly connects two nodes). Exactly k of the ... |
Solve the programming task below in a Python markdown code block.
A new airplane SuperPuperJet has an infinite number of rows, numbered with positive integers starting with 1 from cockpit to tail. There are six seats in each row, denoted with letters from 'a' to 'f'. Seats 'a', 'b' and 'c' are located to the left of a... |
Solve the programming task below in a Python markdown code block.
Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!).
Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choose one of three items independently fr... |
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.
An array is called `zero-balanced` if its elements sum to `0` and for each positive element `n`, there exists another element that is the negative of `n`. Write a function named `ìsZeroBalanced` that returns `true` if its argument is `zero-balanced` arr... |
Solve the programming task below in a Python markdown code block.
Given a tree T with non-negative weight, find the height of each node of the tree. For each node, the height is the distance to the most distant leaf from the node.
Constraints
* 1 ≤ n ≤ 10,000
* 0 ≤ wi ≤ 1,000
Input
n
s1 t1 w1
s2 t2 w2
:
sn-1 tn-1... |
Solve the programming task below in a Python markdown code block.
Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones.
Once he thought about a string of length n consisting of zeroes and ones. Consider the following operation: we choose any two... |
Solve the programming task below in a Python markdown code block.
# RegExp Fun #1 - When I miss few days of gym
## Disclaimer
The background story of this Kata is 100% fiction. Any resemblance to real people or real events is **nothing more than a coincidence** and should be regarded as such.
## Background Story
... |
Solve the programming task below in a Python markdown code block.
In this problem, we use the 24-hour clock.
Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is t... |
Solve the programming task below in a Python markdown code block.
An elementary school student Takahashi has come to a variety store.
He has two coins, A-yen and B-yen coins (yen is the currency of Japan), and wants to buy a toy that costs C yen. Can he buy it?
Note that he lives in Takahashi Kingdom, and may have coi... |
Solve the programming task below in a Python markdown code block.
You are given a square grid with $n$ rows and $n$ columns, where each cell has a non-negative integer written in it. There is a chip initially placed at the top left cell (the cell with coordinates $(1, 1)$). You need to move the chip to the bottom righ... |
Solve the programming task below in a Python markdown code block.
One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.
As mom wasn't home, Vasya decided t... |
Solve the programming task below in a Python markdown code block.
Write a program that extracts n different numbers from the numbers 0 to 100 and outputs the number of combinations that add up to s. Each n number is from 0 to 100, and the same number cannot be used in one combination. For example, if n is 3 and s is 6... |
Solve the programming task below in a Python markdown code block.
The capital of Berland looks like a rectangle of size n × m of the square blocks of same size.
Fire!
It is known that k + 1 blocks got caught on fire (k + 1 ≤ n·m). Those blocks are centers of ignition. Moreover positions of k of these centers are kno... |
Solve the programming task below in a Python markdown code block.
A string is called bracket sequence if it does not contain any characters other than "(" and ")". A bracket sequence is called regular (shortly, RBS) if it is possible to obtain correct arithmetic expression by inserting characters "+" and "1" into this... |
Solve the programming task below in a Python markdown code block.
There are many freight trains departing from Kirnes planet every day. One day on that planet consists of $h$ hours, and each hour consists of $m$ minutes, where $m$ is an even number. Currently, there are $n$ freight trains, and they depart every day at... |
Solve the programming task below in a Python markdown code block.
# A History Lesson
The Pony Express was a mail service operating in the US in 1859-60.
It reduced the time for messages to travel between the Atlantic and Pacific coasts to about 10 days, before it was made obsolete by the [transcontinental telegra... |
Solve the programming task below in a Python markdown code block.
It's well known that the best way to distract from something is to do one's favourite thing. Job is such a thing for Leha.
So the hacker began to work hard in order to get rid of boredom. It means that Leha began to hack computers all over the world. F... |
Solve the programming task below in a Python markdown code block.
International Carpenters Professionals Company (ICPC) is a top construction company with a lot of expert carpenters. What makes ICPC a top company is their original language.
The syntax of the language is simply given in CFG as follows:
S -> SS | (S)... |
Solve the programming task below in a Python markdown code block.
You have unweighted tree of $n$ vertices. You have to assign a positive weight to each edge so that the following condition would hold:
For every two different leaves $v_{1}$ and $v_{2}$ of this tree, bitwise XOR of weights of all edges on the simple... |
Solve the programming task below in a Python markdown code block.
Fox Ciel has some flowers: r red flowers, g green flowers and b blue flowers. She wants to use these flowers to make several bouquets. There are 4 types of bouquets:
To make a "red bouquet", it needs 3 red flowers. To make a "green bouquet", it need... |
Solve the programming task below in a Python markdown code block.
You have N cards. On the i-th card, an integer A_i is written.
For each j = 1, 2, ..., M in this order, you will perform the following operation once:
Operation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card w... |
Solve the programming task below in a Python markdown code block.
Let A, B, C, D, E be sets of integers and let U is a universal set that includes all sets under consideration. All elements in any set are different (no repetitions).
u - union of two sets, AuB = {x ∈ U : x ∈ A or x ∈ B} is the set of all elements whic... |
Solve the programming task below in a Python markdown code block.
Valeric and Valerko missed the last Euro football game, so they decided to watch the game's key moments on the Net. They want to start watching as soon as possible but the connection speed is too low. If they turn on the video right now, it will "hang u... |
Solve the programming task below in a Python markdown code block.
As a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:
* A consists of integers between X and Y (inclusive).
* For each 1\leq i \leq |A|-1, A_{i+1} is a multiple ... |
Solve the programming task below in a Python markdown code block.
A monster is chasing after Rick and Morty on another planet. They're so frightened that sometimes they scream. More accurately, Rick screams at times b, b + a, b + 2a, b + 3a, ... and Morty screams at times d, d + c, d + 2c, d + 3c, .... [Image]
The ... |
Solve the programming task below in a Python markdown code block.
It all started with a black-and-white picture, that can be represented as an $n \times m$ matrix such that all its elements are either $0$ or $1$. The rows are numbered from $1$ to $n$, the columns are numbered from $1$ to $m$.
Several operations were ... |
Solve the programming task below in a Python markdown code block.
Create a function that returns an array containing the first `l` digits from the `n`th diagonal of [Pascal's triangle](https://en.wikipedia.org/wiki/Pascal's_triangle).
`n = 0` should generate the first diagonal of the triangle (the 'ones'). The first ... |
Solve the programming task below in a Python markdown code block.
Polycarp is wondering about buying a new computer, which costs $c$ tugriks. To do this, he wants to get a job as a programmer in a big company.
There are $n$ positions in Polycarp's company, numbered starting from one. An employee in position $i$ earns... |
Solve the programming task below in a Python markdown code block.
There is a binary string $a$ of length $n$. In one operation, you can select any prefix of $a$ with an equal number of $0$ and $1$ symbols. Then all symbols in the prefix are inverted: each $0$ becomes $1$ and each $1$ becomes $0$.
For example, suppose... |
Solve the programming task below in a Python markdown code block.
You are given an array $a$ of $n$ positive integers.
You can use the following operation as many times as you like: select any integer $1 \le k \le n$ and do one of two things: decrement by one $k$ of the first elements of the array. decrement by on... |
Solve the programming task below in a Python markdown code block.
Write a function that receives two strings and returns n, where n is equal to the number of characters we should shift the first string forward to match the second.
For instance, take the strings "fatigue" and "tiguefa". In this case, the first string ... |
Solve the programming task below in a Python markdown code block.
In the capital city of Berland, Bertown, demonstrations are against the recent election of the King of Berland. Berland opposition, led by Mr. Ovalny, believes that the elections were not fair enough and wants to organize a demonstration at one of the s... |
Solve the programming task below in a Python markdown code block.
A browser-based puzzle game called "Bubble Puzzle" is now popular on the Internet.
The puzzle is played on a 4 × 4 grid, and initially there are several bubbles in the grid squares. Each bubble has a state expressed by a positive integer, and the state... |
Solve the programming task below in a Python markdown code block.
When provided with a number between 0-9, return it in words.
Input :: 1
Output :: "One".
If your language supports it, try using a switch statement.
Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on... |
Solve the programming task below in a Python markdown code block.
# Task
let F(N) be the sum square of digits of N. So:
`F(1) = 1, F(3) = 9, F(123) = 14`
Choose a number A, the sequence {A0, A1, ...} is defined as followed:
```
A0 = A
A1 = F(A0)
A2 = F(A1) ...
```
if A = 123, we have:
```
123 ... |
Solve the programming task below in a Python markdown code block.
There is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white.
Snuke plotted N po... |
Solve the programming task below in a Python markdown code block.
Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet — it calculates the maximum flow in an undirected graph. The graph consists of n vertices and m edges. Vertices are numbered from 1 to n. Vertice... |
Solve the programming task below in a Python markdown code block.
Kuriyama Mirai has killed many monsters and got many (namely n) stones. She numbers the stones from 1 to n. The cost of the i-th stone is v_{i}. Kuriyama Mirai wants to know something about these stones so she will ask you two kinds of questions: She w... |
Solve the programming task below in a Python markdown code block.
In a public bath, there is a shower which emits water for T seconds when the switch is pushed.
If the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds. Note that it does not mean that ... |
Solve the programming task below in a Python markdown code block.
This kata requires you to convert minutes (`int`) to hours and minutes in the format `hh:mm` (`string`).
If the input is `0` or negative value, then you should return `"00:00"`
**Hint:** use the modulo operation to solve this challenge. The modulo ope... |
Solve the programming task below in a Python markdown code block.
There is an undirected tree of $n$ vertices, connected by $n-1$ bidirectional edges. There is also a snake stuck inside of this tree. Its head is at vertex $a$ and its tail is at vertex $b$. The snake's body occupies all vertices on the unique simple pa... |
Solve the programming task below in a Python markdown code block.
Chef is good at making pancakes. Generally he gets requests to serve N pancakes at once.
He serves them in the form of a stack.
A pancake can be treated as a circular disk with some radius.
Chef needs to take care that when he places a pancake on the t... |
Solve the programming task below in a Python markdown code block.
To become the king of Codeforces, Kuroni has to solve the following problem.
He is given $n$ numbers $a_1, a_2, \dots, a_n$. Help Kuroni to calculate $\prod_{1\le i<j\le n} |a_i - a_j|$. As result can be very big, output it modulo $m$.
If you are not ... |
Solve the programming task below in a Python markdown code block.
Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells a_{i} theorems during the i-th minute.
Mishka is really interested in calculus, though it is so hard to stay awake for all the time of lecture. You are given ... |
Solve the programming task below in a Python markdown code block.
The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectures for him. Professor Binns, the history of magic te... |
Solve the programming task below in a Python markdown code block.
Toad Zitz has an array of integers, each integer is between $0$ and $m-1$ inclusive. The integers are $a_1, a_2, \ldots, a_n$.
In one operation Zitz can choose an integer $k$ and $k$ indices $i_1, i_2, \ldots, i_k$ such that $1 \leq i_1 < i_2 < \ldots ... |
Solve the programming task below in a Python markdown code block.
You are given a multiset S. Over all pairs of subsets A and B, such that:
* B ⊂ A;
* |B| = |A| - 1;
* greatest common divisor of all elements in A is equal to one;
find the sum of ∑_{x ∈ A}{x} ⋅ ∑_{x ∈ B}{x}, modulo 998 244 353.
Input
The... |
Solve the programming task below in a Python markdown code block.
The Cybernetics Failures (CF) organisation made a prototype of a bomb technician robot. To find the possible problems it was decided to carry out a series of tests. At the beginning of each test the robot prototype will be placed in cell (x_0, y_0) of a... |
Solve the programming task below in a Python markdown code block.
Daisy, being a good hacker as we all know, recently came across a file of the evil organization-Hydra which requires a password to open, and you have been assigned the task to help her in it.
She knows that the password of Hydra files are usually made ... |
Solve the programming task below in a Python markdown code block.
Your favorite music streaming platform has formed a perfectly balanced playlist exclusively for you. The playlist consists of $n$ tracks numbered from $1$ to $n$. The playlist is automatic and cyclic: whenever track $i$ finishes playing, track $i+1$ sta... |
Solve the programming task below in a Python markdown code block.
You have to rebuild a string from an enumerated list.
For this task, you have to check if input is correct beforehand.
* Input must be a list of tuples
* Each tuple has two elements.
* Second element is an alphanumeric character.
* First element is the... |
Solve the programming task below in a Python markdown code block.
According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time n snacks of distinct sizes will fall on the city, and the residents should build a Snacktower of them... |
Solve the programming task below in a Python markdown code block.
problem
You love pasta, and you make and eat pasta for dinner every day. You can make three types of pasta: tomato sauce, cream sauce, and basil sauce.
I decided to plan a dinner for N days. Choose one of the three types of pasta each day. However, if... |
Solve the programming task below in a Python markdown code block.
The life goes up and down, just like nice sequences. Sequence t_1, t_2, ..., t_{n} is called nice if the following two conditions are satisfied: t_{i} < t_{i} + 1 for each odd i < n; t_{i} > t_{i} + 1 for each even i < n.
For example, sequences (2,... |
Solve the programming task below in a Python markdown code block.
There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line has a one-dimensional coordinate, and a point that is farther east has a greater coordinate value. The coordinate of to... |
Solve the programming task below in a Python markdown code block.
You have n problems. You have estimated the difficulty of the i-th one as integer c_{i}. Now you want to prepare a problemset for a contest, using some of the problems you've made.
A problemset for the contest must consist of at least two problems. You... |
Solve the programming task below in a Python markdown code block.
Description
F, who likes to dance, decided to practice a hardcore dance called JUMP STYLE at a certain dance hall.
The floor is tiled in an N × N grid. To support the dance practice, each tile has the coordinates of the tile to jump to the next step. ... |
Solve the programming task below in a Python markdown code block.
Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numbered from 1 to n, each node i having an initial value a_{i}. The root of the tree is node 1.
This tree has a special proper... |
Solve the programming task below in a Python markdown code block.
In the capital city of Berland, Bertown, demonstrations are against the recent election of the King of Berland. Berland opposition, led by Mr. Ovalny, believes that the elections were not fair enough and wants to organize a demonstration at one of the s... |
Solve the programming task below in a Python markdown code block.
This contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`.
So he has decided to make a program that puts the single space he omitted.
You are given a string s with ... |
Solve the programming task below in a Python markdown code block.
You have N coins each of which has a value ai. Find the number of combinations that result when you choose K different coins in such a way that the total value of the coins is greater than or equal to L and less than or equal to R.
Constraints
* 1 ≤ K... |
Solve the programming task below in a Python markdown code block.
Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox! Space and time replaced each o... |
Solve the programming task below in a Python markdown code block.
We have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively.
We will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms cannot be chosen at the same time... |
Solve the programming task below in a Python markdown code block.
The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. In response an SMS activation co... |
Solve the programming task below in a Python markdown code block.
Snuke found N strange creatures. Each creature has a fixed color and size. The color and size of the i-th creature are represented by i and A_i, respectively.
Every creature can absorb another creature whose size is at most twice the size of itself. Wh... |
Solve the programming task below in a Python markdown code block.
This time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city ai.
Today the bus has completed m trips, each t... |
Solve the programming task below in a Python markdown code block.
In the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.
In Taknese, the plural form of a noun is spelled based on the following rules:
- If a noun's singular form does not end with s, append s to the end o... |
Solve the programming task below in a Python markdown code block.
There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are ... |
Solve the programming task below in a Python markdown code block.
A boy Valera registered on site Codeforces as Valera, and wrote his first Codeforces Round #300. He boasted to a friend Arkady about winning as much as x points for his first contest. But Arkady did not believe his friend's words and decided to check wh... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.