question
large_stringlengths
265
13.2k
Solve the programming task below in a Python markdown code block. Positive integer $x$ is called divisor of positive integer $y$, if $y$ is divisible by $x$ without remainder. For example, $1$ is a divisor of $7$ and $3$ is not divisor of $8$. We gave you an integer $d$ and asked you to find the smallest positive int...
Solve the programming task below in a Python markdown code block. For the New Year, Polycarp decided to send postcards to all his $n$ friends. He wants to make postcards with his own hands. For this purpose, he has a sheet of paper of size $w \times h$, which can be cut into pieces. Polycarp can cut any sheet of pape...
Solve the programming task below in a Python markdown code block. There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region. The front and back sides of these cards can be distinguished, a...
Solve the programming task below in a Python markdown code block. Problem "Ritsumeikan University Competitive Programming Camp" will be held this year as well. I am very much looking forward to this annual training camp. However, I couldn't stand my desires and splurged before the training camp, so I couldn't afford ...
Solve the programming task below in a Python markdown code block. Sereja has two sequences a and b and number p. Sequence a consists of n integers a1, a2, ..., an. Similarly, sequence b consists of m integers b1, b2, ..., bm. As usual, Sereja studies the sequences he has. Today he wants to find the number of positions...
Solve the programming task below in a Python markdown code block. Little Vlad is fond of popular computer game Bota-2. Recently, the developers announced the new add-on named Bota-3. Of course, Vlad immediately bought only to find out his computer is too old for the new game and needs to be updated. There are n video...
Solve the programming task below in a Python markdown code block. Gregor is learning about RSA cryptography, and although he doesn't understand how RSA works, he is now fascinated with prime numbers and factoring them. Gregor's favorite prime number is $P$. Gregor wants to find two bases of $P$. Formally, Gregor is l...
Solve the programming task below in a Python markdown code block. This is a hard version of the problem. The actual problems are different, but the easy version is almost a subtask of the hard version. Note that the constraints and the output format are different. You are given a string $s$ consisting of $n$ lowercas...
Solve the programming task below in a Python markdown code block. Bleatrix Trotter the sheep has devised a strategy that helps her fall asleep faster. First, she picks a number N. Then she starts naming N, 2 × N, 3 × N, and so on. Whenever she names a number, she thinks about all of the digits in that number. She keep...
Solve the programming task below in a Python markdown code block. Let's define a split of $n$ as a nonincreasing sequence of positive integers, the sum of which is $n$. For example, the following sequences are splits of $8$: $[4, 4]$, $[3, 3, 2]$, $[2, 2, 1, 1, 1, 1]$, $[5, 2, 1]$. The following sequences aren't sp...
Solve the programming task below in a Python markdown code block. In this Kata, you will be given two numbers, n and k and your task will be to return the k-digit array that sums to n and has the maximum possible GCD. For example, given `n = 12, k = 3`, there are a number of possible `3-digit` arrays that sum to `12`...
Solve the programming task below in a Python markdown code block. We have two indistinguishable pieces placed on a number line. Both pieces are initially at coordinate 0. (They can occupy the same position.) We can do the following two kinds of operations: * Choose a piece and move it to the right (the positive dire...
Solve the programming task below in a Python markdown code block. Recently Anton found a box with digits in his room. There are k_2 digits 2, k_3 digits 3, k_5 digits 5 and k_6 digits 6. Anton's favorite integers are 32 and 256. He decided to compose this integers from digits he has. He wants to make the sum of these...
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. In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i). T...
Solve the programming task below in a Python markdown code block. International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pick an abbrev...
Solve the programming task below in a Python markdown code block. Andrew skipped lessons on the subject 'Algorithms and Data Structures' for the entire term. When he came to the final test, the teacher decided to give him a difficult task as a punishment. The teacher gave Andrew an array of n numbers a_1, ..., a_{n}....
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. In mathematics, a **pandigital number** is a number that in a given base has among its significant digits each digit used in the base at least once. For example, 1234567890 is a pandigital number in base 10. For simplification, in this kata, we will co...
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. Write a program to check whether a triangle is valid or not, when the three angles of the triangle are the inputs. A triangle is valid if the sum of all the three angles is equal to 180 degrees. -----Input----- The first line contains an integer T, th...
Solve the programming task below in a Python markdown code block. Boboniu likes bit operations. He wants to play a game with you. Boboniu gives you two sequences of non-negative integers $a_1,a_2,\ldots,a_n$ and $b_1,b_2,\ldots,b_m$. For each $i$ ($1\le i\le n$), you're asked to choose a $j$ ($1\le j\le m$) and let ...
Solve the programming task below in a Python markdown code block. You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D. -----Constraints----- - 1\leq A\leq B\leq 10^{18} - 1\leq C,D\leq 10^9 - All values in input are integ...
Solve the programming task below in a Python markdown code block. Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applicat...
Solve the programming task below in a Python markdown code block. Berland State University has received a new update for the operating system. Initially it is installed only on the $1$-st computer. Update files should be copied to all $n$ computers. The computers are not connected to the internet, so the only way to ...
Solve the programming task below in a Python markdown code block. Long long ago, there was a thief. Looking for treasures, he was running about all over the world. One day, he heard a rumor that there were islands that had large amount of treasures, so he decided to head for there. Finally he found n islands that had...
Solve the programming task below in a Python markdown code block. You are given two arrays $a$ and $b$ of positive integers, with length $n$ and $m$ respectively. Let $c$ be an $n \times m$ matrix, where $c_{i,j} = a_i \cdot b_j$. You need to find a subrectangle of the matrix $c$ such that the sum of its elements ...
Solve the programming task below in a Python markdown code block. The stardate is 1977 and the science and art of detecting Death Stars is in its infancy. Princess Heidi has received information about the stars in the nearby solar system from the Rebel spies and now, to help her identify the exact location of the Deat...
Solve the programming task below in a Python markdown code block. Vasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to n. Entrance n and entrance 1 are adjacent. Today Vasya got bored and decided to take a walk in the yard. Vasya lives in entrance a and he decided that duri...
Solve the programming task below in a Python markdown code block. Two deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest. In this game, an honest player always tells the truth, and an dishonest player always tell lies. You are given two characters a and b as the input. Each of them is either H...
Solve the programming task below in a Python markdown code block. If we write out the digits of "60" as English words we get "sixzero"; the number of letters in "sixzero" is seven. The number of letters in "seven" is five. The number of letters in "five" is four. The number of letters in "four" is four: we have reache...
Solve the programming task below in a Python markdown code block. You are given N non-negative integers A_1, A_2, ..., A_N and another non-negative integer K. For a integer X between 0 and K (inclusive), let f(X) = (X XOR A_1) + (X XOR A_2) + ... + (X XOR A_N). Here, for non-negative integers a and b, a XOR b denotes ...
Solve the programming task below in a Python markdown code block. You are given an array $a$ consisting of $n$ integers $a_1, a_2, \dots , a_n$. In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For exa...
Solve the programming task below in a Python markdown code block. Two players play a simple game. Each player is provided with a box with balls. First player's box contains exactly n_1 balls and second player's box contains exactly n_2 balls. In one move first player can take from 1 to k_1 balls from his box and throw...
Solve the programming task below in a Python markdown code block. There is a robot in a warehouse and $n$ packages he wants to collect. The warehouse can be represented as a coordinate grid. Initially, the robot stays at the point $(0, 0)$. The $i$-th package is at the point $(x_i, y_i)$. It is guaranteed that there a...
Solve the programming task below in a Python markdown code block. On the competitive programming platform CodeCook, every person has a rating graph described by an array of integers $a$ of length $n$. You are now updating the infrastructure, so you've created a program to compress these graphs. The program works as f...
Solve the programming task below in a Python markdown code block. ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of...
Solve the programming task below in a Python markdown code block. Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it. Another Codeforces round has been conducted. No two participants have the same number of points. For each participant...
Solve the programming task below in a Python markdown code block. ##Overview Write a helper function that takes in a Time object and converts it to a more human-readable format. You need only go up to '_ weeks ago'. ```python to_pretty(0) => "just now" to_pretty(40000) => "11 hours ago" ``` ##Specifics - The output...
Solve the programming task below in a Python markdown code block. Mikhail walks on a Cartesian plane. He starts at the point $(0, 0)$, and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point $(0, 0)$, he can go to any of the following points in one move: $(1, 0)$;...
Solve the programming task below in a Python markdown code block. Let $s$ be some string consisting of symbols "0" or "1". Let's call a string $t$ a substring of string $s$, if there exists such number $1 \leq l \leq |s| - |t| + 1$ that $t = s_l s_{l+1} \ldots s_{l + |t| - 1}$. Let's call a substring $t$ of string $s$...
Solve the programming task below in a Python markdown code block. You are creating a level for a video game. The level consists of $n$ rooms placed in a circle. The rooms are numbered $1$ through $n$. Each room contains exactly one exit: completing the $j$-th room allows you to go the $(j+1)$-th room (and completing t...
Solve the programming task below in a Python markdown code block. Ayoub thinks that he is a very smart person, so he created a function $f(s)$, where $s$ is a binary string (a string which contains only symbols "0" and "1"). The function $f(s)$ is equal to the number of substrings in the string $s$ that contains at le...
Solve the programming task below in a Python markdown code block. A and B are preparing themselves for programming contests. To train their logical thinking and solve problems better, A and B decided to play chess. During the game A wondered whose position is now stronger. For each chess piece we know its weight: ...
Solve the programming task below in a Python markdown code block. We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operatio...
Solve the programming task below in a Python markdown code block. Theater stage is a rectangular field of size n × m. The director gave you the stage's plan which actors will follow. For each cell it is stated in the plan if there would be an actor in this cell or not. You are to place a spotlight on the stage in som...
Solve the programming task below in a Python markdown code block. One day, little Vasya found himself in a maze consisting of (n + 1) rooms, numbered from 1 to (n + 1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the (n + 1)-th one. The maze is organized as follows. Each room ...
Solve the programming task below in a Python markdown code block. Tarly has two different type of items, food boxes and wine barrels. There are f food boxes and w wine barrels. Tarly stores them in various stacks and each stack can consist of either food boxes or wine barrels but not both. The stacks are placed in a l...
Solve the programming task below in a Python markdown code block. Read problems statements in Russian here Chef has a special affection for sets of binary strings of equal length which have same numbers of 1's. Given three integers n, k and m, your task is to find the the lexicographically m^{th} smallest string amo...
Solve the programming task below in a Python markdown code block. You and your $n - 1$ friends have found an array of integers $a_1, a_2, \dots, a_n$. You have decided to share it in the following way: All $n$ of you stand in a line in a particular order. Each minute, the person at the front of the line chooses either...
Solve the programming task below in a Python markdown code block. Consider an infinite sequence a_1, a_2, … Initially, the values of all the terms are 0, and from this state we will sequentially perform Q operations. The i-th operation (1 ≤ i ≤ Q) is as follows: * For every positive integer j, add x_i to the value of...
Solve the programming task below in a Python markdown code block. The store sells $n$ items, the price of the $i$-th item is $p_i$. The store's management is going to hold a promotion: if a customer purchases at least $x$ items, $y$ cheapest of them are free. The management has not yet decided on the exact values of ...
Solve the programming task below in a Python markdown code block. Alena has successfully passed the entrance exams to the university and is now looking forward to start studying. One two-hour lesson at the Russian university is traditionally called a pair, it lasts for two academic hours (an academic hour is equal to...
Solve the programming task below in a Python markdown code block. Given is an integer sequence A_1, ..., A_N of length N. We will choose exactly \left\lfloor \frac{N}{2} \right\rfloor elements from this sequence so that no two adjacent elements are chosen. Find the maximum possible sum of the chosen elements. Here \lf...
Solve the programming task below in a Python markdown code block. There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. ...
Solve the programming task below in a Python markdown code block. Emuskald is an avid horticulturist and owns the world's longest greenhouse — it is effectively infinite in length. Over the years Emuskald has cultivated n plants in his greenhouse, of m different plant species numbered from 1 to m. His greenhouse is v...
Solve the programming task below in a Python markdown code block. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Little Egor is a huge movie fan. He likes watching different kinds of movies: from drama movies to comedy movies, from teen movies to horror movies. He is planning to visit ...
Solve the programming task below in a Python markdown code block. Yukiya, the owner of Aizuyama Ski Resort, has prepared a course for advanced skiers with obstacles and jumping hills. There are various ways to slide on the course, and users who can slide in all patterns during the season will be given a gift. Let's c...
Solve the programming task below in a Python markdown code block. There are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it. You can take and complete at most one of these jobs in a day. However, you cannot retake a job that you ...
Solve the programming task below in a Python markdown code block. You are given two positive integers $a$ and $b$. In one move you can increase $a$ by $1$ (replace $a$ with $a+1$). Your task is to find the minimum number of moves you need to do in order to make $a$ divisible by $b$. It is possible, that you have to ma...
Solve the programming task below in a Python markdown code block. Dr. Hedro is astonished. According to his theory, we can make sludge that can dissolve almost everything on the earth. Now he's trying to produce the sludge to verify his theory. The sludge is produced in a rectangular solid shaped tank whose size is N...
Solve the programming task below in a Python markdown code block. Ujan has a lot of numbers in his boxes. He likes order and balance, so he decided to reorder the numbers. There are $k$ boxes numbered from $1$ to $k$. The $i$-th box contains $n_i$ integer numbers. The integers can be negative. All of the integers are...
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...
Solve the programming task below in a Python markdown code block. Anastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she began to collect Uzhlyandian pebbles. At first, she decided to collect all the pebbles she could find in the park. She has only two pock...
Solve the programming task below in a Python markdown code block. There are N blocks arranged in a row. Let us paint these blocks. We will consider two ways to paint the blocks different if and only if there is a block painted in different colors in those two ways. Find the number of ways to paint the blocks under the...
Solve the programming task below in a Python markdown code block. Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon. The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and numb...
Solve the programming task below in a Python markdown code block. You will be given a string S of length 3 representing the weather forecast for three days in the past. The i-th character (1 \leq i \leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively. You ...
Solve the programming task below in a Python markdown code block. This is the easy version of this problem. The only difference is the constraint on $k$ — the number of gifts in the offer. In this version: $k=2$. Vasya came to the store to buy goods for his friends for the New Year. It turned out that he was very luc...
Solve the programming task below in a Python markdown code block. Polycarp is a beginner programmer. He is studying how to use a command line. Polycarp faced the following problem. There are n files in a directory and he needs to delete some of them. Polycarp wants to run a single delete command with filename pattern...
Solve the programming task below in a Python markdown code block. You are given a string S of length 3 consisting of a, b and c. Determine if S can be obtained by permuting abc. -----Constraints----- - |S|=3 - S consists of a, b and c. -----Input----- Input is given from Standard Input in the following format: S ...
Solve the programming task below in a Python markdown code block. Statistics claims that students sleep no more than three hours a day. But even in the world of their dreams, while they are snoring peacefully, the sense of impending doom is still upon them. A poor student is dreaming that he is sitting the mathematic...
Solve the programming task below in a Python markdown code block. Kate and Michael want to buy a pizza and share it. Depending on the price of the pizza, they are going to divide the costs: * If the pizza is less than €5,- Michael invites Kate, so Michael pays the full price. * Otherwise Kate will contribute 1/3 of t...
Solve the programming task below in a Python markdown code block. Numbers $1, 2, 3, \dots n$ (each integer from $1$ to $n$ once) are written on a board. In one operation you can erase any two numbers $a$ and $b$ from the board and write one integer $\frac{a + b}{2}$ rounded up instead. You should perform the given op...
Solve the programming task below in a Python markdown code block. You are given a rectangular field of n × m cells. Each cell is either empty or impassable (contains an obstacle). Empty cells are marked with '.', impassable cells are marked with '*'. Let's call two empty cells adjacent if they share a side. Let's cal...
Solve the programming task below in a Python markdown code block. Input The only line of input contains three integers a1, a2, a3 (1 ≤ a1, a2, a3 ≤ 20), separated by spaces. Output Output a single integer. Examples Input 2 3 2 Output 5 Input 13 14 1 Output 14 Input 14 5 9 Output 464 Input 17 18...
Solve the programming task below in a Python markdown code block. Leha somehow found an array consisting of n integers. Looking at it, he came up with a task. Two players play the game on the array. Players move one by one. The first player can choose for his move a subsegment of non-zero length with an odd sum of num...
Solve the programming task below in a Python markdown code block. There are $n$ consecutive seat places in a railway carriage. Each place is either empty or occupied by a passenger. The university team for the Olympiad consists of $a$ student-programmers and $b$ student-athletes. Determine the largest number of stude...
Solve the programming task below in a Python markdown code block. A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon. A performer holding the rod low is represente...
Solve the programming task below in a Python markdown code block. You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence. We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|. Stri...
Solve the programming task below in a Python markdown code block. A string $s$ of length $n$ ($1 \le n \le 26$) is called alphabetical if it can be obtained using the following algorithm: first, write an empty string to $s$ (i.e. perform the assignment $s$ := ""); then perform the next step $n$ times; at the $i$-th...
Solve the programming task below in a Python markdown code block. Write a function ```javascript tripledouble(num1,num2) ``` ```python triple_double(num1, num2) ``` which takes numbers `num1` and `num2` and returns `1` if there is a straight triple of a number at any place in `num1` and also a straight double of the...
Solve the programming task below in a Python markdown code block. There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has n characters. The characters are labeled from 1 to n. Every pair of two characters c...
Solve the programming task below in a Python markdown code block. You are given a sequence of integers $a_1, a_2, \dots, a_n$. You need to paint elements in colors, so that: If we consider any color, all elements of this color must be divisible by the minimal element of this color. The number of used colors must be...
Solve the programming task below in a Python markdown code block. International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pick an abbrev...
Solve the programming task below in a Python markdown code block. You are given a garland consisting of $n$ lamps. States of the lamps are represented by the string $s$ of length $n$. The $i$-th character of the string $s_i$ equals '0' if the $i$-th lamp is turned off or '1' if the $i$-th lamp is turned on. You are al...
Solve the programming task below in a Python markdown code block. Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle. More formally, there are 3n gnomes sitting in a circle. Each gnome can have from 1 to...
Solve the programming task below in a Python markdown code block. You are given a problemset consisting of $n$ problems. The difficulty of the $i$-th problem is $a_i$. It is guaranteed that all difficulties are distinct and are given in the increasing order. You have to assemble the contest which consists of some pro...
Solve the programming task below in a Python markdown code block. One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each possible gr...
Solve the programming task below in a Python markdown code block. You are given an integer $n$ and an integer $k$. In one step you can do one of the following moves: decrease $n$ by $1$; divide $n$ by $k$ if $n$ is divisible by $k$. For example, if $n = 27$ and $k = 3$ you can do the following steps: $27 \righta...
Solve the programming task below in a Python markdown code block. # Task N lamps are placed in a line, some are switched on and some are off. What is the smallest number of lamps that need to be switched so that on and off lamps will alternate with each other? You are given an array `a` of zeros and ones - `1` mean ...
Solve the programming task below in a Python markdown code block. Given a string, capitalize the letters that occupy even indexes and odd indexes separately, and return as shown below. Index `0` will be considered even. For example, `capitalize("abcdef") = ['AbCdEf', 'aBcDeF']`. See test cases for more examples. The...
Solve the programming task below in a Python markdown code block. Dr. Sato, a botanist, invented a number of special fertilizers for seedlings. When you give the fertilizer to the seedlings, the size of the seedlings changes in a blink of an eye. However, it was found that fertilizer has the following side effects. *...
Solve the programming task below in a Python markdown code block. Ayush is a cashier at the shopping center. Recently his department has started a ''click and collect" service which allows users to shop online. The store contains k items. n customers have already used the above service. Each user paid for m items. L...
Solve the programming task below in a Python markdown code block. Consider an array containing cats and dogs. Each dog can catch only one cat, but cannot catch a cat that is more than `n` elements away. Your task will be to return the maximum number of cats that can be caught. For example: ```Haskell solve(['D','C','...
Solve the programming task below in a Python markdown code block. There are n animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines him, gives prescriptions, appoints tests and may appoint extra examination. Doc knows all the forest animals perfectly well and therefore knows e...
Solve the programming task below in a Python markdown code block. You are given n segments on the coordinate axis Ox and the number k. The point is satisfied if it belongs to at least k segments. Find the smallest (by the number of segments) set of segments on the coordinate axis Ox which contains all satisfied points...
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. There is enough money available on ATM in nominal value 10, 20, 50, 100, 200 and 500 dollars. You are given money in nominal value of `n` with `1<=n<=1500`. Try to find minimal number of notes that must be used to repay in dollars, or output -1 if it ...
Solve the programming task below in a Python markdown code block. Mr. Bender has a digital table of size n × n, each cell can be switched on or off. He wants the field to have at least c switched on squares. When this condition is fulfilled, Mr Bender will be happy. We'll consider the table rows numbered from top to ...
Solve the programming task below in a Python markdown code block. You are given an array $a$ consisting of $n$ integers. Let's denote monotonic renumeration of array $a$ as an array $b$ consisting of $n$ integers such that all of the following conditions are met: $b_1 = 0$; for every pair of indices $i$ and $j$ su...