question
large_stringlengths
265
13.2k
Solve the programming task below in a Python markdown code block. Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left. There were $n$ classes of that subject during the ...
Solve the programming task below in a Python markdown code block. Alice and Bob are playing a fun game of tree tag. The game is played on a tree of n vertices numbered from 1 to n. Recall that a tree on n vertices is an undirected, connected graph with n-1 edges. Initially, Alice is located at vertex a, and Bob at v...
Solve the programming task below in a Python markdown code block. During their New Year holidays, Alice and Bob play the following game using an array $a$ of $n$ integers: Players take turns, Alice moves first. Each turn a player chooses any element and removes it from the array. If Alice chooses even value, then s...
Solve the programming task below in a Python markdown code block. problem AOR Ika wants to create a strong password that consists only of lowercase letters. AOR Ika-chan, who was given an example of $ N $ of dangerous passwords by a friend, decided to create a password that meets all of the following conditions. 1. ...
Solve the programming task below in a Python markdown code block. A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce b thimbles each day. The factory intends to choose a k-day period to do maintenance and ...
Solve the programming task below in a Python markdown code block. Let's play the game using a bag containing several cards with integers written on it. In each game, participants first declare one of their favorite number n. Then, take out an appropriate number of cards from the bag at a time, and if the sum of the nu...
Solve the programming task below in a Python markdown code block. Three friends are going to meet each other. Initially, the first friend stays at the position $x = a$, the second friend stays at the position $x = b$ and the third friend stays at the position $x = c$ on the coordinate axis $Ox$. In one minute each fr...
Solve the programming task below in a Python markdown code block. The only difference between easy and hard versions is constraints. The BerTV channel every day broadcasts one episode of one of the $k$ TV shows. You know the schedule for the next $n$ days: a sequence of integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le...
Solve the programming task below in a Python markdown code block. Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document. In the beginning of the round the contestants are divided into rooms. Each room contains exactly n participants. Dur...
Solve the programming task below in a Python markdown code block. # Scenario *Now that the competition gets tough it will* **_Sort out the men from the boys_** . **_Men_** are the **_Even numbers_** and **_Boys_** are the **_odd_** ![!alt](https://i.imgur.com/mdX8dJP.png) ![!alt](https://i.imgur.com/mdX8dJP.png)...
Solve the programming task below in a Python markdown code block. Vasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer. We all know that programs often store sets of integers. For example, if we have a problem about a we...
Solve the programming task below in a Python markdown code block. Polycarpus adores TV series. Right now he is ready to finish watching a season of a popular sitcom "Graph Theory". In total, the season has n episodes, numbered with integers from 1 to n. Polycarpus watches episodes not one by one but in a random order...
Solve the programming task below in a Python markdown code block. Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be n players participating, and the tournament will follow knockout rules from the very first game. That means, that if someone lose...
Solve the programming task below in a Python markdown code block. Did you know that there are over 40,000 varieties of Rice in the world ? There are so many dishes that can be prepared with Rice too. A famous chef from Mumbai, Tid Gusto prepared a new dish and named it 'Tid Rice'. He posted the recipe in his newly des...
Solve the programming task below in a Python markdown code block. Amicable numbers are two different numbers so related that the sum of the proper divisors of each is equal to the other number. (A proper divisor of a number is a positive factor of that number other than the number itself. For example, the proper divis...
Solve the programming task below in a Python markdown code block. One day Vasya decided to have a look at the results of Berland 1910 Football Championship’s finals. Unfortunately he didn't find the overall score of the match; however, he got hold of a profound description of the match's process. On the whole there ar...
Solve the programming task below in a Python markdown code block. Your friend has invited you to a party, and tells you to meet them in the line to get in. The one problem is it's a masked party. Everyone in line is wearing a colored mask, including your friend. Find which people in line could be your friend. Your fr...
Solve the programming task below in a Python markdown code block. Monocarp wrote down two numbers on a whiteboard. Both numbers follow a specific format: a positive integer $x$ with $p$ zeros appended to its end. Now Monocarp asks you to compare these two numbers. Can you help him? -----Input----- The first line c...
Solve the programming task below in a Python markdown code block. There are N points on the 2D plane, i-th of which is located on (x_i, y_i). There can be multiple points that share the same coordinate. What is the maximum possible Manhattan distance between two distinct points? Here, the Manhattan distance between tw...
Solve the programming task below in a Python markdown code block. Twilight Sparkle once got a crystal from the Crystal Mine. A crystal of size n (n is odd; n > 1) is an n Γ— n matrix with a diamond inscribed into it. You are given an odd integer n. You need to draw a crystal of size n. The diamond cells of the matrix ...
Solve the programming task below in a Python markdown code block. Take an input string and return a string that is made up of the number of occurences of each english letter in the input followed by that letter, sorted alphabetically. The output string shouldn't contain chars missing from input (chars with 0 occurence...
Solve the programming task below in a Python markdown code block. Sagheer is walking in the street when he comes to an intersection of two roads. Each road can be represented as two parts where each part has 3 lanes getting into the intersection (one for each direction) and 3 lanes getting out of the intersection, so ...
Solve the programming task below in a Python markdown code block. Mobile Display Keystrokes Do you remember the old mobile display keyboards? Do you also remember how inconvenient it was to write on it? Well, here you have to calculate how much keystrokes you have to do for a specific word. This is the layout: Re...
Solve the programming task below in a Python markdown code block. A prime number n (11, 19, 23, etc.) that divides by 4 and has 3 has an interesting property. The results of calculating the remainder of the square of a natural number (1, 2, ..., n -1) of 1 or more and less than n divided by n are the same, so they are...
Solve the programming task below in a Python markdown code block. At a geometry lesson Bob learnt that a triangle is called right-angled if it is nondegenerate and one of its angles is right. Bob decided to draw such a triangle immediately: on a sheet of paper he drew three points with integer coordinates, and joined ...
Solve the programming task below in a Python markdown code block. AquaMoon and Cirno are playing an interesting game with arrays. Cirno has prepared two arrays $a$ and $b$, both consist of $n$ non-negative integers. AquaMoon can perform the following operation an arbitrary number of times (possibly zero): She chooses...
Solve the programming task below in a Python markdown code block. Tanya has $n$ candies numbered from $1$ to $n$. The $i$-th candy has the weight $a_i$. She plans to eat exactly $n-1$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day. ...
Solve the programming task below in a Python markdown code block. Description overhauled by V --- I've invited some kids for my son's birthday, during which I will give to each kid some amount of candies. Every kid hates receiving less amount of candies than any other kids, and I don't want to have any candies left...
Solve the programming task below in a Python markdown code block. Ilya lives in a beautiful city of Chordalsk. There are $n$ houses on the street Ilya lives, they are numerated from $1$ to $n$ from left to right; the distance between every two neighboring houses is equal to $1$ unit. The neighboring houses are $1$ an...
Solve the programming task below in a Python markdown code block. The bear has a string s = s_1s_2... s_{|}s| (record |s| is the string's length), consisting of lowercase English letters. The bear wants to count the number of such pairs of indices i, j (1 ≀ i ≀ j ≀ |s|), that string x(i, j) = s_{i}s_{i} + 1... s_{j} c...
Solve the programming task below in a Python markdown code block. In 2937, DISCO creates a new universe called DISCOSMOS to celebrate its 1000-th anniversary. DISCOSMOS can be described as an H \times W grid. Let (i, j) (1 \leq i \leq H, 1 \leq j \leq W) denote the square at the i-th row from the top and the j-th col...
Solve the programming task below in a Python markdown code block. Kamil likes streaming the competitive programming videos. His MeTube channel has recently reached 100 million subscribers. In order to celebrate this, he posted a video with an interesting problem he couldn't solve yet. Can you help him? You're given a...
Solve the programming task below in a Python markdown code block. Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string. Pasha didn't like his present ve...
Solve the programming task below in a Python markdown code block. FizzBuzz is a game in which integers of 1 or more are spoken in order according to the following rules. * "Fizz" when divisible by 3 * "Buzz" when divisible by 5 * "FizzBuzz" when divisible by both 3 and 5 * At other times, that number An exampl...
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. Iahub and Sorin are the best competitive programmers in their town. However, they can't both qualify to an important contest. The selection will be made with the help of a single problem. Blatnatalag, a friend of Iahub, managed to get hold of the proble...
Solve the programming task below in a Python markdown code block. Taro had his own personal computer and set a password for login. However, Taro inadvertently forgot the password. Then, remembering that there was a piece of paper with the password written down, Taro found the paper and was surprised to see it. The pap...
Solve the programming task below in a Python markdown code block. There is one card each with the numbers from "1" to "10", for a total of 10 cards. This card has numbers on the front and nothing on the back. Using this card, you and your opponent will play the game according to the following rules. 1. You and your o...
Solve the programming task below in a Python markdown code block. The map of Bertown can be represented as a set of $n$ intersections, numbered from $1$ to $n$ and connected by $m$ one-way roads. It is possible to move along the roads from any intersection to any other intersection. The length of some path from one in...
Solve the programming task below in a Python markdown code block. For a given array $a_1, a_2, a_3, ... , a_N$ of $N$ elements and $Q$ integers $x_i$ as queries, for each query, print the number of combinations of two integers $(l, r)$ which satisfies the condition: $1 \leq l \leq r \leq N$ and $a_l + a_{l+1} + ... + ...
Solve the programming task below in a Python markdown code block. Currently, XXOC's rap is a string consisting of zeroes, ones, and question marks. Unfortunately, haters gonna hate. They will write $x$ angry comments for every occurrence of subsequence 01 and $y$ angry comments for every occurrence of subsequence 10. ...
Solve the programming task below in a Python markdown code block. Pasha has many hamsters and he makes them work out. Today, n hamsters (n is even) came to work out. The hamsters lined up and each hamster either sat down or stood up. For another exercise, Pasha needs exactly $\frac{n}{2}$ hamsters to stand up and the...
Solve the programming task below in a Python markdown code block. During the quarantine, Sicromoft has more free time to create the new functions in "Celex-2021". The developers made a new function GAZ-GIZ, which infinitely fills an infinite table to the right and down from the upper left corner as follows: [Image] ...
Solve the programming task below in a Python markdown code block. Peter has a sequence of integers a_1, a_2, ..., a_{n}. Peter wants all numbers in the sequence to equal h. He can perform the operation of "adding one on the segment [l, r]": add one to all elements of the sequence with indices from l to r (inclusive). ...
Solve the programming task below in a Python markdown code block. Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japa...
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. One day Petya encountered a tree ...
Solve the programming task below in a Python markdown code block. Pig is visiting a friend. Pig's house is located at point 0, and his friend's house is located at point m on an axis. Pig can use teleports to move along the axis. To use a teleport, Pig should come to a certain point (where the teleport is located) ...
Solve the programming task below in a Python markdown code block. In graph theory, a graph is a collection of nodes with connections between them. Any node can be connected to any other node exactly once, and can be connected to no nodes, to some nodes, or to every other node. Nodes cannot be connected to themselves A...
Solve the programming task below in a Python markdown code block. The weather is fine today and hence it's high time to climb the nearby pine and enjoy the landscape. The pine's trunk includes several branches, located one above another and numbered from 2 to y. Some of them (more precise, from 2 to p) are occupied b...
Solve the programming task below in a Python markdown code block. Ivan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string s. Ivan preferred making a new string to finding the old one. Ivan knows some information about the string s. Namely, he rem...
Solve the programming task below in a Python markdown code block. Kolya is developing an economy simulator game. His most favourite part of the development process is in-game testing. Once he was entertained by the testing so much, that he found out his game-coin score become equal to 0. Kolya remembers that at the b...
Solve the programming task below in a Python markdown code block. There are N cities and M roads. The i-th road (1≀i≀M) connects two cities a_i and b_i (1≀a_i,b_i≀N) bidirectionally. There may be more than one road that connects the same pair of two cities. For each city, how many roads are connected to the city? ---...
Solve the programming task below in a Python markdown code block. Naturally, the magical girl is very good at performing magic. She recently met her master wizard Devu, who gifted her R potions of red liquid, B potions of blue liquid, and G potions of green liquid. - The red liquid potions have liquid amounts given...
Solve the programming task below in a Python markdown code block. There are N towns numbered 1, 2, \cdots, N. Some roads are planned to be built so that each of them connects two distinct towns bidirectionally. Currently, there are no roads connecting towns. In the planning of construction, each town chooses one tow...
Solve the programming task below in a Python markdown code block. Nastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task. Two matrices $A$ and $B$ are given, each of them has size $n \times m$. Nastya can perform the following operation to matri...
Solve the programming task below in a Python markdown code block. For an array of non-negative integers $a$ of size $n$, we construct another array $d$ as follows: $d_1 = a_1$, $d_i = |a_i - a_{i - 1}|$ for $2 \le i \le n$. Your task is to restore the array $a$ from a given array $d$, or to report that there are mult...
Solve the programming task below in a Python markdown code block. Given an integer a as input, print the value a + a^2 + a^3. -----Constraints----- - 1 \leq a \leq 10 - a is an integer. -----Input----- Input is given from Standard Input in the following format: a -----Output----- Print the value a + a^2 + a^3 as ...
Solve the programming task below in a Python markdown code block. The only difference between easy and hard versions is the size of the input. You are given a string $s$ consisting of $n$ characters, each character is 'R', 'G' or 'B'. You are also given an integer $k$. Your task is to change the minimum number of ch...
Solve the programming task below in a Python markdown code block. Nearly each project of the F company has a whole team of developers working on it. They often are in different rooms of the office in different cities and even countries. To keep in touch and track the results of the project, the F company conducts shar...
Solve the programming task below in a Python markdown code block. Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings contain only digits zero and one. She uses the definition of Hamming distance: We will define the distance between two strings s an...
Solve the programming task below in a Python markdown code block. Section numbers are strings of dot-separated integers. The highest level sections (chapters) are numbered 1, 2, 3, etc. Second level sections are numbered 1.1, 1.2, 1.3, 2.1, 2.2, 2.3, etc. Next level sections are numbered 1.1.1, 1.1.2, 1.1.2, 1.2.1, 1....
Solve the programming task below in a Python markdown code block. You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous...
Solve the programming task below in a Python markdown code block. For a non-negative integer K, we define a fractal of level K as follows: * A fractal of level 0 is a grid with just one white square. * When K > 0, a fractal of level K is a 3^K \times 3^K grid. If we divide this grid into nine 3^{K-1} \times 3^{K-1} s...
Solve the programming task below in a Python markdown code block. We saw the little game Marmot made for Mole's lunch. Now it's Marmot's dinner time and, as we all know, Marmot eats flowers. At every dinner he eats some red and white flowers. Therefore a dinner can be represented as a sequence of several flowers, some...
Solve the programming task below in a Python markdown code block. ## Task: You have to create a function `isPronic` to check whether the argument passed is a Pronic Number and return true if it is & false otherwise. ### Description: `Pronic Number` -A pronic number, oblong number, rectangular number or heteromecic n...
Solve the programming task below in a Python markdown code block. What are you doing at the end of the world? Are you busy? Will you save us? <image> Nephren is playing a game with little leprechauns. She gives them an infinite array of strings, f0... ∞. f0 is "What are you doing at the end of the world? Are you b...
Solve the programming task below in a Python markdown code block. A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are: 2332 110011 54322345 You'll be given 2 numbers as arguments: ```(num,s)```. Write a function wh...
Solve the programming task below in a Python markdown code block. < PREVIOUS KATA NEXT KATA > ###Task: You have to write a function `pattern` which returns the following Pattern(See Examples) upto (3n-2) rows, where n is parameter. * Note:`Returning` the pattern is not the same as `Printing` the pattern. ####Rule...
Solve the programming task below in a Python markdown code block. The cows have just learned what a primitive root is! Given a prime p, a primitive root $\operatorname{mod} p$ is an integer x (1 ≀ x < p) such that none of integers x - 1, x^2 - 1, ..., x^{p} - 2 - 1 are divisible by p, but x^{p} - 1 - 1 is. Unfortuna...
Solve the programming task below in a Python markdown code block. Problem Statement In the headquarter building of ICPC (International Company of Plugs & Connectors), there are $M$ light bulbs and they are controlled by $N$ switches. Each light bulb can be turned on or off by exactly one switch. Each switch may contr...
Solve the programming task below in a Python markdown code block. Polycarp wants to train before another programming competition. During the first day of his training he should solve exactly $1$ problem, during the second day β€” exactly $2$ problems, during the third day β€” exactly $3$ problems, and so on. During the $k...
Solve the programming task below in a Python markdown code block. We have a string S consisting of lowercase English letters. If the length of S is at most K, print S without change. If the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result. -----Constraint...
Solve the programming task below in a Python markdown code block. You want to build a fence that will consist of $n$ equal sections. All sections have a width equal to $1$ and height equal to $k$. You will place all sections in one line side by side. Unfortunately, the ground beneath the fence is not flat. For simpli...
Solve the programming task below in a Python markdown code block. ## Task To charge your mobile phone battery, do you know how much time it takes from 0% to 100%? It depends on your cell phone battery capacity and the power of the charger. A rough calculation method is: ``` 0% --> 85% (fast charge) (battery capacity...
Solve the programming task below in a Python markdown code block. Kavi has 2n points lying on the OX axis, i-th of which is located at x = i. Kavi considers all ways to split these 2n points into n pairs. Among those, he is interested in good pairings, which are defined as follows: Consider n segments with ends at t...
Solve the programming task below in a Python markdown code block. You are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that as many as possible integers will become on a place where a smaller integer used to stand. Help Vasya find the maximal number of such integers. ...
Solve the programming task below in a Python markdown code block. Have you ever tasted Martian food? Well, you should. Their signature dish is served on a completely black plate with the radius of R, flat as a pancake. First, they put a perfectly circular portion of the Golden Honduras on the plate. It has the radiu...
Solve the programming task below in a Python markdown code block. Appleman has a tree with n vertices. Some of the vertices (at least one) are colored black and other vertices are colored white. Consider a set consisting of k (0 ≀ k < n) edges of Appleman's tree. If Appleman deletes these edges from the tree, then it...
Solve the programming task below in a Python markdown code block. You are a given an array $a$ of length $n$. Find a subarray $a[l..r]$ with length at least $k$ with the largest median. A median in an array of length $n$ is an element which occupies position number $\lfloor \frac{n + 1}{2} \rfloor$ after we sort the ...
Solve the programming task below in a Python markdown code block. Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer ...
Solve the programming task below in a Python markdown code block. ### What is simplifying a square root? If you have a number, like 80, for example, you would start by finding the greatest perfect square divisible by 80. In this case, that's 16. Find the square root of 16, and multiply it by 80 / 16. Answer = 4 √5. ...
Solve the programming task below in a Python markdown code block. Simple transposition is a basic and simple cryptography technique. We make 2 rows and put first a letter in the Row 1, the second in the Row 2, third in Row 1 and so on until the end. Then we put the text from Row 2 next to the Row 1 text and thats it. ...
Solve the programming task below in a Python markdown code block. You have received data from a Bubble bot. You know your task is to make factory facilities, but before you even start, you need to know how big the factory is and how many rooms it has. When you look at the data you see that you have the dimensions of t...
Solve the programming task below in a Python markdown code block. Example Input 2 2 2 1 0 0 0 Output 24 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
Solve the programming task below in a Python markdown code block. Recently Vova found $n$ candy wrappers. He remembers that he bought $x$ candies during the first day, $2x$ candies during the second day, $4x$ candies during the third day, $\dots$, $2^{k-1} x$ candies during the $k$-th day. But there is an issue: Vova ...
Solve the programming task below in a Python markdown code block. You are given a string of length N. Calculate the number of distinct substrings of S. Constraints * 1 \leq N \leq 500,000 * S consists of lowercase English letters. Input Input is given from Standard Input in the following format: S Output Prin...
Solve the programming task below in a Python markdown code block. Snuke has decided to use a robot to clean his room. There are N pieces of trash on a number line. The i-th piece from the left is at position x_i. We would like to put all of them in a trash bin at position 0. For the positions of the pieces of trash,...
Solve the programming task below in a Python markdown code block. The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if t...
Solve the programming task below in a Python markdown code block. Problem statement 2D, who is good at cooking, is trying to make lunch. Cooking requires all N ingredients a_ {0}, a_ {1},…, a_ {Nβˆ’1}. Now, 2D's refrigerator doesn't contain any ingredients, so I have to go to the supermarket to buy it. At the supermar...
Solve the programming task below in a Python markdown code block. Your friend gave you a dequeue D as a birthday present. D is a horizontal cylinder that contains a row of N jewels. The values of the jewels are V_1, V_2, ..., V_N from left to right. There may be jewels with negative values. In the beginning, you have ...
Solve the programming task below in a Python markdown code block. A permutation p of size n is an array such that every integer from 1 to n occurs exactly once in this array. Let's call a permutation an almost identity permutation iff there exist at least n - k indices i (1 ≀ i ≀ n) such that p_{i} = i. Your task is...
Solve the programming task below in a Python markdown code block. problem You are a traveler traveling on the JOI Highway. The JOI Highway is a road that extends straight from east to west, and there are n post towns on the JOI Highway. Numbered. The westernmost post town on the JOI highway is post town 1, and the ea...
Solve the programming task below in a Python markdown code block. Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya calls a mask of a positiv...
Solve the programming task below in a Python markdown code block. You are given a string S of length N and another string T of length M. These strings consist of lowercase English letters. A string X is called a good string when the following conditions are all met: * Let L be the length of X. L is divisible by both...
Solve the programming task below in a Python markdown code block. # Task You are given a string consisting of `"D", "P" and "C"`. A positive integer N is called DPC of this string if it satisfies the following properties: ``` For each i = 1, 2, ... , size of the string: If i-th character is "D", then N can be ...
Solve the programming task below in a Python markdown code block. Kilani is playing a game with his friends. This game can be represented as a grid of size $n \times m$, where each cell is either empty or blocked, and every player has one or more castles in some cells (there are no two castles in one cell). The game ...
Solve the programming task below in a Python markdown code block. Our master carpenter is designing a condominium called Bange Hills Mansion. The condominium is constructed by stacking up floors of the same height. The height of each floor is designed so that the total height of the stacked floors coincides with the p...
Solve the programming task below in a Python markdown code block. Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips: Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already li...
Solve the programming task below in a Python markdown code block. The Smart Beaver from ABBYY decided to have a day off. But doing nothing the whole day turned out to be too boring, and he decided to play a game with pebbles. Initially, the Beaver has n pebbles. He arranges them in a equal rows, each row has b pebbles...
Solve the programming task below in a Python markdown code block. Our world is one-dimensional, and ruled by two empires called Empire A and Empire B. The capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y. One day, Empire A becomes inclined to put the cities at coordinates...