question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Selection of Participants of an Experiment
Dr. Tsukuba has devised a new method of programming training. In order to evaluate the effectiveness of this method, he plans to carry out a control experiment. Having two students as the participants of the e... |
Solve the programming task below in a Python markdown code block.
Taro has decided to move. Taro has a lot of luggage, so I decided to ask a moving company to carry the luggage. Since there are various weights of luggage, I asked them to arrange them in order from the lightest one for easy understanding, but the mover... |
Solve the programming task below in a Python markdown code block.
Curry making
As the ACM-ICPC domestic qualifying is approaching, you who wanted to put more effort into practice decided to participate in a competitive programming camp held at a friend's house. Participants decided to prepare their own meals.
On the... |
Solve the programming task below in a Python markdown code block.
Revised
The current era, Heisei, will end on April 30, 2019, and a new era will begin the next day. The day after the last day of Heisei will be May 1, the first year of the new era.
In the system developed by the ACM-ICPC OB / OG Association (Japanes... |
Solve the programming task below in a Python markdown code block.
Problem
Given the strings $ s $, $ t $.
First, let the string set $ A = $ {$ s $}, $ B = \ phi $.
At this time, I want to perform the following operations as much as possible.
operation
step1
Perform the following processing for all $ u β A $.
1. F... |
Solve the programming task below in a Python markdown code block.
Write a program which converts uppercase/lowercase letters to lowercase/uppercase for a given string.
Constraints
* The length of the input string < 1200
Input
A string is given in a line.
Output
Print the converted string in a line. Note that you... |
Solve the programming task below in a Python markdown code block.
Chef has a box full of infinite number of identical coins. One day while playing, he made N piles each containing equal number of coins. Chef suddenly remembered an important task and left the room for sometime. While he was away, his newly hired assist... |
Solve the programming task below in a Python markdown code block.
The sequence of integers a_1, a_2, ..., a_k is called a good array if a_1 = k - 1 and a_1 > 0. For example, the sequences [3, -1, 44, 0], [1, -99] are good arrays, and the sequences [3, 7, 8], [2, 5, 4, 1], [0] β are not.
A sequence of integers is call... |
Solve the programming task below in a Python markdown code block.
There is a card game called "Durak", which means "Fool" in Russian. The game is quite popular in the countries that used to form USSR. The problem does not state all the game's rules explicitly β you can find them later yourselves if you want.
To play ... |
Solve the programming task below in a Python markdown code block.
There are n houses along the road where Anya lives, each one is painted in one of k possible colors.
Anya likes walking along this road, but she doesn't like when two adjacent houses at the road have the same color. She wants to select a long segment o... |
Solve the programming task below in a Python markdown code block.
Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya wonders eagerly what minimu... |
Solve the programming task below in a Python markdown code block.
Monocarp has got two strings s and t having equal length. Both strings consist of lowercase Latin letters "a" and "b".
Monocarp wants to make these two strings s and t equal to each other. He can do the following operation any number of times: choose ... |
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.
You are given two strings s and t both of length n and both consisting of lowercase Latin letters.
In one move, you can choose any length len from 1 to n and perform the following operation:
* Choose any contiguous substring of the string s of leng... |
Solve the programming task below in a Python markdown code block.
We start with a string s consisting only of the digits 1, 2, or 3. The length of s is denoted by |s|. For each i from 1 to |s|, the i-th character of s is denoted by s_i.
There is one cursor. The cursor's location β is denoted by an integer in \{0, β¦,... |
Solve the programming task below in a Python markdown code block.
You are given some Tetris field consisting of n columns. The initial height of the i-th column of the field is a_i blocks. On top of these columns you can place only figures of size 2 Γ 1 (i.e. the height of this figure is 2 blocks and the width of this... |
Solve the programming task below in a Python markdown code block.
Ashish and Vivek play a game on a matrix consisting of n rows and m columns, where they take turns claiming cells. Unclaimed cells are represented by 0, while claimed cells are represented by 1. The initial state of the matrix is given. There can be som... |
Solve the programming task below in a Python markdown code block.
You are given a sequence of n integers a_1, a_2, β¦, a_n.
You have to construct two sequences of integers b and c with length n that satisfy:
* for every i (1β€ iβ€ n) b_i+c_i=a_i
* b is non-decreasing, which means that for every 1<iβ€ n, b_iβ₯ b_{i-1... |
Solve the programming task below in a Python markdown code block.
You found a useless array a of 2n positive integers. You have realized that you actually don't need this array, so you decided to throw out all elements of a.
It could have been an easy task, but it turned out that you should follow some rules:
1. ... |
Solve the programming task below in a Python markdown code block.
By 2312 there were n Large Hadron Colliders in the inhabited part of the universe. Each of them corresponded to a single natural number from 1 to n. However, scientists did not know what activating several colliders simultaneously could cause, so the co... |
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.
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.
Shaass has n books. He wants to make a bookshelf for all his books. He wants the bookshelf's dimensions to be as small as possible. The thickness of the i-th book is ti and its pages' width is equal to wi. The thickness of each book is either 1 or 2. Al... |
Solve the programming task below in a Python markdown code block.
You have array a1, a2, ..., an. Segment [l, r] (1 β€ l β€ r β€ n) is good if ai = ai - 1 + ai - 2, for all i (l + 2 β€ i β€ r).
Let's define len([l, r]) = r - l + 1, len([l, r]) is the length of the segment [l, r]. Segment [l1, r1], is longer than segment [... |
Solve the programming task below in a Python markdown code block.
Fox Ciel is playing a game with numbers now.
Ciel has n positive integers: x1, x2, ..., xn. She can do the following operation as many times as needed: select two different indexes i and j such that xi > xj hold, and then apply assignment xi = xi - xj... |
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.
Today Vasya visited a widely known site and learned that the continuation of his favourite game Codecraft II will appear after exactly k months. He looked at the calendar and learned that at the moment is the month number s. Vasya immediately got intere... |
Solve the programming task below in a Python markdown code block.
Polycarpus got an internship in one well-known social network. His test task is to count the number of unique users who have visited a social network during the day. Polycarpus was provided with information on all user requests for this time period. For... |
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.
A long time ago, in a galaxy far far away two giant IT-corporations Pineapple and Gogol continue their fierce competition. Crucial moment is just around the corner: Gogol is ready to release it's new tablet Lastus 3000.
This new device is equipped with... |
Solve the programming task below in a Python markdown code block.
Bearland has n cities, numbered 1 through n. Cities are connected via bidirectional roads. Each road connects two distinct cities. No two roads connect the same pair of cities.
Bear Limak was once in a city a and he wanted to go to a city b. There was ... |
Solve the programming task below in a Python markdown code block.
Sometimes some words like "localization" or "internationalization" are so long that writing them many times in one text is quite tiresome.
Let's consider a word too long, if its length is strictly more than 10 characters. All too long words should be r... |
Solve the programming task below in a Python markdown code block.
Young Timofey has a birthday today! He got kit of n cubes as a birthday present from his parents. Every cube has a number ai, which is written on it. Timofey put all the cubes in a row and went to unpack other presents.
In this time, Timofey's elder br... |
Solve the programming task below in a Python markdown code block.
Maxim wants to buy an apartment in a new house at Line Avenue of Metropolis. The house has n apartments that are numbered from 1 to n and are arranged in a row. Two apartments are adjacent if their indices differ by 1. Some of the apartments can already... |
Solve the programming task below in a Python markdown code block.
You are given a rooted tree with n vertices. The vertices are numbered from 1 to n, the root is the vertex number 1.
Each vertex has a color, let's denote the color of vertex v by cv. Initially cv = 0.
You have to color the tree into the given colors ... |
Solve the programming task below in a Python markdown code block.
One very experienced problem writer decided to prepare a problem for April Fools Day contest. The task was very simple - given an arithmetic expression, return the result of evaluating this expression. However, looks like there is a bug in the reference... |
Solve the programming task below in a Python markdown code block.
Vasilisa the Wise from a far away kingdom got a present from her friend Helga the Wise from a farther away kingdom. The present is a surprise box, yet Vasilisa the Wise doesn't know yet what the surprise actually is because she cannot open the box. She ... |
Solve the programming task below in a Python markdown code block.
Jesse and Walter recently got a into a problem. They need to check if a compound can be converted to the other one.
A compound is decoded into a binary strings of 0s and 1s. They have 2 binary strings. First string contains characters
'0', '1' and '?', ... |
Solve the programming task below in a Python markdown code block.
"RMS Lusitania" was one of the world biggest ship of her time.On the outbreak of the First World War in 1914, she was commandeered by the Admiralty as an armed merchant cruiser. When Lusitania left New York for Liverpool on what would be her final voyag... |
Solve the programming task below in a Python markdown code block.
Marut loves good strings. According to him, good strings are those which contain either all alphabets of uppercase or lowercase.
While he is preparing for his exams, he finds many bad strings in his book and wants to convert them to good strings.
But he... |
Solve the programming task below in a Python markdown code block.
Rahul has set upon the quest for a new logo of his company. He has created the following continuous logo:
/\
/ \
/ /\ \
/ / \ \
/ / /\ \ \
\ \ \/ / /
\ \ / /
\ \/ /
\ /
\/
However, his sister, Rashi, likes the followi... |
Solve the programming task below in a Python markdown code block.
Bangalore City, where peace prevails most of the time. Not everyone is a huge fan of peace, though. Certainly not Mr. XYZ, whose identity is not known to us - yet. Mr. XYZ has somehow managed to bring vampires and zombies to Bangalore City to attack and... |
Solve the programming task below in a Python markdown code block.
We have an H \times W grid, where each square is painted white or black in the initial state. Given are strings A_1, A_2, ..., A_H representing the colors of the squares in the initial state. For each pair (i, j) (1 \leq i \leq H, 1 \leq j \leq W), if t... |
Solve the programming task below in a Python markdown code block.
Given is a rooted tree with N vertices numbered 1 to N. The root is Vertex 1, and the i-th edge (1 \leq i \leq N - 1) connects Vertex a_i and b_i.
Each of the vertices has a counter installed. Initially, the counters on all the vertices have the value ... |
Solve the programming task below in a Python markdown code block.
N tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.
The i-th tile from the left is painted black if the i-th character of S is `0`, and painted white if that character is `1`.
You ... |
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.
Snuke has two boards, each divided into a grid with N rows and N columns. For both of these boards, the square at the i-th row from the top and the j-th column from the left is called Square (i,j).
There is a lowercase English letter written in each sq... |
Solve the programming task below in a Python markdown code block.
Snuke can change a string t of length N into a string t' of length N - 1 under the following rule:
* For each i (1 β€ i β€ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t.
There is a string s consisting of lowerca... |
Solve the programming task below in a Python markdown code block.
A tetromino is a figure formed by joining four squares edge to edge. We will refer to the following seven kinds of tetromino as I-, O-, T-, J-, L-, S- and Z-tetrominos, respectively:
a60bcb8e9e8f22e3af51049eda063392.png
Snuke has many tetrominos. The ... |
Solve the programming task below in a Python markdown code block.
Snuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.
Snuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, that is, it was possible to travers... |
Solve the programming task below in a Python markdown code block.
Create a program that outputs all leap years between the year a and year b.
The leap year conditions are as follows. However, 0 <a β€ b <3,000. If there is no leap year in the given period, output "NA".
* The year is divisible by 4.
* However, a year d... |
Solve the programming task below in a Python markdown code block.
Relative B man came to A child's house. He is 3 years old and loves singing. He is singing the song "Kobutanuki Tsuneko" (written and composed by Naozumi Yamamoto), which he learned from kindergarten. In this song, the four words "kobuta," "raccoon dog,... |
Solve the programming task below in a Python markdown code block.
There are a number of ways to shuffle a deck of cards. Riffle shuffle is one such example. The following is how to perform riffle shuffle.
There is a deck of n cards. First, we divide it into two decks; deck A which consists of the top half of it and d... |
Solve the programming task below in a Python markdown code block.
One of the oddest traditions of the town of Gameston may be that even the town mayor of the next term is chosen according to the result of a game. When the expiration of the term of the mayor approaches, at least three candidates, including the mayor of... |
Solve the programming task below in a Python markdown code block.
Karakuri Doll
Karakuri doll
English text is not available in this practice contest.
After many years of research, Karakuri puppeteer JAG has succeeded in developing a wonderful tea-drawing doll that combines traditional and latest techniques. This te... |
Solve the programming task below in a Python markdown code block.
A tatami mat, a Japanese traditional floor cover, has a rectangular form with aspect ratio 1:2. When spreading tatami mats on a floor, it is prohibited to make a cross with the border of the tatami mats, because it is believed to bring bad luck.
Your t... |
Solve the programming task below in a Python markdown code block.
The Kingdom of Neva is home to two ethnic groups, the Totata and the Tutete. The biggest feature of the Totata tribe is that they eat sweet and sour pork with pineapple. However, the Tutete tribe eats vinegared pork in pineapple. These two peoples could... |
Solve the programming task below in a Python markdown code block.
Palindrome
Problem Statement
Find the number of palindromes closest to the integer n.
Note that the non-negative integer x is the number of palindromes, which means that the character string in which x is expressed in decimal notation and the charact... |
Solve the programming task below in a Python markdown code block.
This year too, the time has come for the National Programming Championships. In the district tournament where the right to participate in the national tournament is bet, 2n teams will face each other in a one-on-one winning tournament system.
Team numb... |
Solve the programming task below in a Python markdown code block.
problem
There are $ N $ propositions, named $ 1, 2, \ cdots, N $, respectively. Also, $ M $ information about the propositions is given. The $ i $ th information is "$ a_i $$". Given in the form "b_i $", which means that $ a_i $ is $ b_i $. ("If" is a ... |
Solve the programming task below in a Python markdown code block.
Find the difference of two sets $A = \\{a_0, a_1, ..., a_{n-1}\\}$ and $B = \\{b_0, b_1, ..., b_{m-1}\\}$, $A - B$.
Constraints
* $1 \leq n, m \leq 200,000$
* $0 \leq a_0 < a_1 < ... < a_{n-1} \leq 10^9$
* $0 \leq b_0 < b_1 < ... < b_{m-1} \leq 10^9$
... |
Solve the programming task below in a Python markdown code block.
A Little Elephant and his friends from the Zoo of Lviv like candies very much.
There are N elephants in the Zoo. The elephant with number K (1 β€ K β€ N) will be happy if he receives at least AK candies. There are C candies in all in the Zoo.
The Zoo st... |
Solve the programming task below in a Python markdown code block.
You are a given a list of integers a_1, a_2, β¦, a_n and s of its segments [l_j; r_j] (where 1 β€ l_j β€ r_j β€ n).
You need to select exactly m segments in such a way that the k-th order statistic of the multiset of a_i, where i is contained in at least o... |
Solve the programming task below in a Python markdown code block.
The only difference between easy and hard versions is the constraints.
Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of n consecutive pictures (with kittens, of course). Vova likes all thes... |
Solve the programming task below in a Python markdown code block.
There is a weighted tree with n nodes and n-1 edges. The nodes are conveniently labeled from 1 to n. The weights are positive integers at most 100. Define the distance between two nodes to be the sum of edges on the unique path between the nodes. You wo... |
Solve the programming task below in a Python markdown code block.
In some social network, there are n users communicating with each other in m groups of friends. Let's analyze the process of distributing some news between users.
Initially, some user x receives the news from some source. Then he or she sends the news ... |
Solve the programming task below in a Python markdown code block.
A company of n friends wants to order exactly two pizzas. It is known that in total there are 9 pizza ingredients in nature, which are denoted by integers from 1 to 9.
Each of the n friends has one or more favorite ingredients: the i-th of friends has ... |
Solve the programming task below in a Python markdown code block.
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string s (a string which consists of zeroes and ones) of length n and he is asking you to find ... |
Solve the programming task below in a Python markdown code block.
You are given a chess board with n rows and n columns. Initially all cells of the board are empty, and you have to put a white or a black knight into each cell of the board.
A knight is a chess piece that can attack a piece in cell (x_2, y_2) from the ... |
Solve the programming task below in a Python markdown code block.
Let a be a matrix of size r Γ c containing positive integers, not necessarily distinct. Rows of the matrix are numbered from 1 to r, columns are numbered from 1 to c. We can construct an array b consisting of r + c integers as follows: for each i β [1, ... |
Solve the programming task below in a Python markdown code block.
This problem is different with hard version only by constraints on total answers length
It is an interactive problem
Venya joined a tour to the madhouse, in which orderlies play with patients the following game. Orderlies pick a string s of length n, ... |
Solve the programming task below in a Python markdown code block.
After a successful year of milk production, Farmer John is rewarding his cows with their favorite treat: tasty grass!
On the field, there is a row of n units of grass, each with a sweetness s_i. Farmer John has m cows, each with a favorite sweetness f_... |
Solve the programming task below in a Python markdown code block.
Drazil likes heap very much. So he created a problem with heap:
There is a max heap with a height h implemented on the array. The details of this heap are the following:
This heap contains exactly 2^h - 1 distinct positive non-zero integers. All integ... |
Solve the programming task below in a Python markdown code block.
A penguin Rocher has n sticks. He has exactly one stick with length i for all 1 β€ i β€ n.
He can connect some sticks. If he connects two sticks that have lengths a and b, he gets one stick with length a + b. Two sticks, that were used in the operation d... |
Solve the programming task below in a Python markdown code block.
Carousel Boutique is busy again! Rarity has decided to visit the pony ball and she surely needs a new dress, because going out in the same dress several times is a sign of bad manners. First of all, she needs a dress pattern, which she is going to cut o... |
Solve the programming task below in a Python markdown code block.
You and your friend are playing the game Mortal Kombat XI. You are trying to pass a challenge tower. There are n bosses in this tower, numbered from 1 to n. The type of the i-th boss is a_i. If the i-th boss is easy then its type is a_i = 0, otherwise t... |
Solve the programming task below in a Python markdown code block.
Sasha likes investigating different math objects, for example, magic squares. But Sasha understands that magic squares have already been studied by hundreds of people, so he sees no sense of studying them further. Instead, he invented his own type of sq... |
Solve the programming task below in a Python markdown code block.
You have n stacks of blocks. The i-th stack contains h_i blocks and it's height is the number of blocks in it. In one move you can take a block from the i-th stack (if there is at least one block) and put it to the i + 1-th stack. Can you make the seque... |
Solve the programming task below in a Python markdown code block.
The tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.
This time, the brothers are dealing with a strange piece of wood marked with their names. This plank of wood ca... |
Solve the programming task below in a Python markdown code block.
Goa'uld Apophis captured Jack O'Neill's team again! Jack himself was able to escape, but by that time Apophis's ship had already jumped to hyperspace. But Jack knows on what planet will Apophis land. In order to save his friends, Jack must repeatedly go... |
Solve the programming task below in a Python markdown code block.
Furlo and Rublo play a game. The table has n piles of coins lying on it, the i-th pile has ai coins. Furlo and Rublo move in turns, Furlo moves first. In one move you are allowed to:
* choose some pile, let's denote the current number of coins in it ... |
Solve the programming task below in a Python markdown code block.
The sequence is called ordered if it is non-decreasing or non-increasing. For example, sequnces [3, 1, 1, 0] and [1, 2, 3, 100] are ordered, but the sequence [1, 3, 3, 1] is not. You are given a sequence of numbers. You are to find it's shortest subsequ... |
Solve the programming task below in a Python markdown code block.
Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as fo... |
Solve the programming task below in a Python markdown code block.
I have an undirected graph consisting of n nodes, numbered 1 through n. Each node has at most two incident edges. For each pair of nodes, there is at most an edge connecting them. No edge connects a node to itself.
I would like to create a new graph in... |
Solve the programming task below in a Python markdown code block.
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.
Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wr... |
Solve the programming task below in a Python markdown code block.
Inna loves digit 9 very much. That's why she asked Dima to write a small number consisting of nines. But Dima must have misunderstood her and he wrote a very large number a, consisting of digits from 1 to 9.
Inna wants to slightly alter the number Dima... |
Solve the programming task below in a Python markdown code block.
DZY loves Physics, and he enjoys calculating density.
Almost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of the graph have some values) as follows:
<image> where v is the sum of the values of t... |
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.
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.
Life in Bertown has become hard. The city has too many roads and the government spends too much to maintain them. There are n junctions and m two way roads, at which one can get from each junction to any other one. The mayor wants to close some roads so... |
Solve the programming task below in a Python markdown code block.
Rikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number is another matter. It is aesthetically pleasing, and it has a number of remarkable properties. Help Rikha... |
Solve the programming task below in a Python markdown code block.
A long time ago (probably even in the first book), Nicholas Flamel, a great alchemist and the creator of the Philosopher's Stone, taught Harry Potter three useful spells. The first one allows you to convert a grams of sand into b grams of lead, the seco... |
Solve the programming task below in a Python markdown code block.
Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters.
There is a filler word ogo in Oleg's speech. All words ... |
Solve the programming task below in a Python markdown code block.
You have n devices that you want to use simultaneously.
The i-th device uses ai units of power per second. This usage is continuous. That is, in λ seconds, the device will use λ·ai units of power. The i-th device currently has bi units of power stored.... |
Solve the programming task below in a Python markdown code block.
Given a positive integer n, find k integers (not necessary distinct) such that all these integers are strictly greater than 1, and their product is equal to n.
Input
The first line contains two integers n and k (2 β€ n β€ 100000, 1 β€ k β€ 20).
Output
I... |
Solve the programming task below in a Python markdown code block.
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is no... |
Solve the programming task below in a Python markdown code block.
Ilya is working for the company that constructs robots. Ilya writes programs for entertainment robots, and his current project is "Bob", a new-generation game robot. Ilya's boss wants to know his progress so far. Especially he is interested if Bob is be... |
Solve the programming task below in a Python markdown code block.
Let's suppose you have an array a, a stack s (initially empty) and an array b (also initially empty).
You may perform the following operations until both a and s are empty:
* Take the first element of a, push it into s and remove it from a (if a is ... |
Solve the programming task below in a Python markdown code block.
Firecrackers scare Nian the monster, but they're wayyyyy too noisy! Maybe fireworks make a nice complement.
Little Tommy is watching a firework show. As circular shapes spread across the sky, a splendid view unfolds on the night of Lunar New Year's eve... |
Solve the programming task below in a Python markdown code block.
It is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.
There are n displays placed along a road, and the i-th of them can display a ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.