question
large_stringlengths
265
13.2k
Solve the programming task below in a Python markdown code block. Overlooking the captivating blend of myriads of vernal hues, Arkady the painter lays out a long, long canvas. Arkady has a sufficiently large amount of paint of three colours: cyan, magenta, and yellow. On the one-dimensional canvas split into n consec...
Solve the programming task below in a Python markdown code block. You're given a row with n chairs. We call a seating of people "maximal" if the two following conditions hold: 1. There are no neighbors adjacent to anyone seated. 2. It's impossible to seat one more person without violating the first rule. The...
Solve the programming task below in a Python markdown code block. Mehta is a forever alone and desperate guy. He has a crush on N girls of his society. He wants to impress them all and so he needs to do their task collectively.All the girls give him a number which he stores in an array named A of size N. To do their t...
Solve the programming task below in a Python markdown code block. You are given an undirected graph with N vertices and 0 edges. Process Q queries of the following types. * `0 u v`: Add an edge (u, v). * `1 u v`: Print 1 if u and v are in the same connected component, 0 otherwise. Constraints * 1 \leq N \leq 200,00...
Solve the programming task below in a Python markdown code block. There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when it...
Solve the programming task below in a Python markdown code block. Takahashi has A cookies, and Aoki has B cookies. Takahashi will do the following action K times: * If Takahashi has one or more cookies, eat one of his cookies. * Otherwise, if Aoki has one or more cookies, eat one of Aoki's cookies. * If they both hav...
Solve the programming task below in a Python markdown code block. Given is a string S consisting of `L` and `R`. Let N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left. The character written on the leftmost squa...
Solve the programming task below in a Python markdown code block. You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions: * The graph is simple and connected. * There exists an integer S such that, for every vertex, the sum of the indices ...
Solve the programming task below in a Python markdown code block. Print all the integers that satisfies the following in ascending order: * Among the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers. Constraints * 1 \leq A \leq B \leq 10^9 * 1 \leq K...
Solve the programming task below in a Python markdown code block. We have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i. Two people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a c...
Solve the programming task below in a Python markdown code block. Nuske has a grid with N rows and M columns of squares. The rows are numbered 1 through N from top to bottom, and the columns are numbered 1 through M from left to right. Each square in the grid is painted in either blue or white. If S_{i,j} is 1, the sq...
Solve the programming task below in a Python markdown code block. You are given nonnegative integers a and b (a ≤ b), and a positive integer x. Among the integers between a and b, inclusive, how many are divisible by x? Constraints * 0 ≤ a ≤ b ≤ 10^{18} * 1 ≤ x ≤ 10^{18} Input The input is given from Standard Inpu...
Solve the programming task below in a Python markdown code block. 12:17 (UTC): The sample input 1 and 2 were swapped. The error is now fixed. We are very sorry for your inconvenience. There are N children in AtCoder Kindergarten, conveniently numbered 1 through N. Mr. Evi will distribute C indistinguishable candies t...
Solve the programming task below in a Python markdown code block. The problem of hiding a part of a formula and searching for the hidden number is called verbal arithmetic. This time, I'm dealing with an expression in which some numbers in the expression are hidden by X. Enter the following formula and create a progra...
Solve the programming task below in a Python markdown code block. Takeshi, who loves hot springs, is planning a trip to a hot spring resort on his next long vacation. I would like to travel by connecting to a long-distance bus and reach my destination with as little money as possible. Takeshi, who has savings but is u...
Solve the programming task below in a Python markdown code block. Let's solve the puzzle by programming. The numbers n x n are arranged in a grid pattern. Some of the numbers are circled and we will call them the starting point. The rules of the puzzle are as follows: * Draw one line that goes vertically and horizon...
Solve the programming task below in a Python markdown code block. There is a chain consisting of multiple circles on a plane. The first (last) circle of the chain only intersects with the next (previous) circle, and each intermediate circle intersects only with the two neighboring circles. Your task is to find the sh...
Solve the programming task below in a Python markdown code block. The committee members of the Kitoshima programming contest had decided to use crypto-graphic software for their secret communication. They had asked a company, Kodai Software, to develop cryptographic software that employed a cipher based on highly soph...
Solve the programming task below in a Python markdown code block. Background The kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves lowercase letters as much as programming. Yu-kun decided to write a scoring program...
Solve the programming task below in a Python markdown code block. Maki is a house cat. One day she fortunately came at a wonderful-looking dried fish. Since she felt not hungry on that day, she put it up in her bed. However there was a problem; a rat was living in her house, and he was watching for a chance to steal h...
Solve the programming task below in a Python markdown code block. Problem Statement Mr. Takatsuki, who is planning to participate in the Aizu training camp, has a poor house and always tries to save as much paper as possible. She decided to play a ghost leg with other participants to decide the team for the Aizu trai...
Solve the programming task below in a Python markdown code block. B: Hokkaido University Hard Note Please note that the question settings are the same as question A, except for the constraints. story Homura-chan, who passed Hokkaido University and is excited about the beginning of a new life. But in front of her, ...
Solve the programming task below in a Python markdown code block. Write a program which manipulates a sequence A = {a1, a2, . . . , an} with the following operations: * add(s, t, x): add x to as, as+1, ..., at. * get(i): output the value of ai. Note that the initial values of ai (i = 1, 2, . . . , n) are 0. Const...
Solve the programming task below in a Python markdown code block. Vasya has got an undirected graph consisting of n vertices and m edges. This graph doesn't contain any self-loops or multiple edges. Self-loop is an edge connecting a vertex to itself. Multiple edges are a pair of edges such that they connect the same p...
Solve the programming task below in a Python markdown code block. Lunar New Year is approaching, and Bob received a gift from his friend recently — a recursive sequence! He loves this sequence very much and wants to play with it. Let f_1, f_2, …, f_i, … be an infinite sequence of positive integers. Bob knows that for...
Solve the programming task below in a Python markdown code block. There is a robot staying at X=0 on the Ox axis. He has to walk to X=n. You are controlling this robot and controlling how he goes. The robot has a battery and an accumulator with a solar panel. The i-th segment of the path (from X=i-1 to X=i) can be ex...
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, ... , 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 example, fr...
Solve the programming task below in a Python markdown code block. Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated? There are n students living in a building, and for ...
Solve the programming task below in a Python markdown code block. You are given a system of pipes. It consists of two rows, each row consists of n pipes. The top left pipe has the coordinates (1, 1) and the bottom right — (2, n). There are six types of pipes: two types of straight pipes and four types of curved pipes...
Solve the programming task below in a Python markdown code block. The Central Company has an office with a sophisticated security system. There are 10^6 employees, numbered from 1 to 10^6. The security system logs entrances and departures. The entrance of the i-th employee is denoted by the integer i, while the depar...
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 intersecti...
Solve the programming task below in a Python markdown code block. Consider the infinite sequence s of positive integers, created by repeating the following steps: 1. Find the lexicographically smallest triple of positive integers (a, b, c) such that * a ⊕ b ⊕ c = 0, where ⊕ denotes the [bitwise XOR operation](...
Solve the programming task below in a Python markdown code block. Today Johnny wants to increase his contribution. His plan assumes writing n blogs. One blog covers one topic, but one topic can be covered by many blogs. Moreover, some blogs have references to each other. Each pair of blogs that are connected by a refe...
Solve the programming task below in a Python markdown code block. You are given an array a_1, a_2, ..., a_n where all a_i are integers and greater than 0. In one operation, you can choose two different indices i and j (1 ≤ i, j ≤ n). If gcd(a_i, a_j) is equal to the minimum element of the whole array a, you can swap ...
Solve the programming task below in a Python markdown code block. You have a knapsack with the capacity of W. There are also n items, the i-th one has weight w_i. You want to put some of these items into the knapsack in such a way that their total weight C is at least half of its size, but (obviously) does not excee...
Solve the programming task below in a Python markdown code block. Petya organized a strange birthday party. He invited n friends and assigned an integer k_i to the i-th of them. Now Petya would like to give a present to each of them. In the nearby shop there are m unique presents available, the j-th present costs c_j ...
Solve the programming task below in a Python markdown code block. You are given a multiset S initially consisting of n distinct non-negative integers. A multiset is a set, that can contain some elements multiple times. You will perform the following operation k times: * Add the element ⌈(a+b)/(2)⌉ (rounded up) in...
Solve the programming task below in a Python markdown code block. There are n points on an infinite plane. The i-th point has coordinates (x_i, y_i) such that x_i > 0 and y_i > 0. The coordinates are not necessarily integer. In one move you perform the following operations: * choose two points a and b (a ≠ b); ...
Solve the programming task below in a Python markdown code block. Lolek and Bolek are about to travel abroad by plane. The local airport has a special "Choose Your Plane" offer. The offer's conditions are as follows: * it is up to a passenger to choose a plane to fly on; * if the chosen plane has x (x > 0) empty...
Solve the programming task below in a Python markdown code block. Sereja has a sequence that consists of n positive integers, a1, a2, ..., an. First Sereja took a piece of squared paper and wrote all distinct non-empty non-decreasing subsequences of sequence a. Then for each sequence written on the squared paper, Se...
Solve the programming task below in a Python markdown code block. Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the swamp is very difficult, so people tramped exactly n - 1 paths. Each of these paths connects some pair...
Solve the programming task below in a Python markdown code block. Iahub wants to enhance his multitasking abilities. In order to do this, he wants to sort n arrays simultaneously, each array consisting of m integers. Iahub can choose a pair of distinct indices i and j (1 ≤ i, j ≤ m, i ≠ j). Then in each array the val...
Solve the programming task below in a Python markdown code block. Little Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, since it has the ability to change gravity. There are n columns of toy cubes in the box arranged in a line. The i-th co...
Solve the programming task below in a Python markdown code block. Consider a football tournament where n teams participate. Each team has two football kits: for home games, and for away games. The kit for home games of the i-th team has color xi and the kit for away games of this team has color yi (xi ≠ yi). In the t...
Solve the programming task below in a Python markdown code block. Dreamoon likes to play with sets, integers and <image>. <image> is defined as the largest positive integer that divides both a and b. Let S be a set of exactly four distinct integers greater than 0. Define S to be of rank k if and only if for all pairs...
Solve the programming task below in a Python markdown code block. A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of site regist...
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. A tree of size n is an undirected connected graph consisting of n vertices without cycles. Consider some tree with n vertices. We call a tree invariant relative to permutation p = p1p2... pn, if for any two vertices of the tree u and v the condition ho...
Solve the programming task below in a Python markdown code block. Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of course, the best way to know it is fortune telling. There are many ways of telling fortune, but Marina has picked the easiest one. She takes in her hand one or several camomiles and...
Solve the programming task below in a Python markdown code block. Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset. Artem wants to create a basic multiset of in...
Solve the programming task below in a Python markdown code block. Recently, on a programming lesson little Petya showed how quickly he can create files and folders on the computer. But he got soon fed up with this activity, and he decided to do a much more useful thing. He decided to calculate what folder contains mos...
Solve the programming task below in a Python markdown code block. n hobbits are planning to spend the night at Frodo's house. Frodo has n beds standing in a row and m pillows (n ≤ m). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as possible. Of course, it's not alwa...
Solve the programming task below in a Python markdown code block. Little Vasya likes very much to play with sets consisting of positive integers. To make the game more interesting, Vasya chose n non-empty sets in such a way, that no two of them have common elements. One day he wanted to show his friends just how inte...
Solve the programming task below in a Python markdown code block. Vasya has an array of integers of length n. Vasya performs the following operations on the array: on each step he finds the longest segment of consecutive equal integers (the leftmost, if there are several such segments) and removes it. For example, if...
Solve the programming task below in a Python markdown code block. It is winter now, and Max decided it's about time he watered the garden. The garden can be represented as n consecutive garden beds, numbered from 1 to n. k beds contain water taps (i-th tap is located in the bed xi), which, if turned on, start deliver...
Solve the programming task below in a Python markdown code block. You are given a sequence of n positive integers d1, d2, ..., dn (d1 < d2 < ... < dn). Your task is to construct an undirected graph such that: * there are exactly dn + 1 vertices; * there are no self-loops; * there are no multiple edges; * t...
Solve the programming task below in a Python markdown code block. Allen wants to enter a fan zone that occupies a round square and has n entrances. There already is a queue of a_i people in front of the i-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute. Allen uses the ...
Solve the programming task below in a Python markdown code block. A square pyramid of balls consists of square layers of balls stacked on top of each other. The i th (1-based indexing )layer from the top consists of exactly i^2 balls. Image You have received one such beautiful square pyramid on your birthday, with ea...
Solve the programming task below in a Python markdown code block. Xenny had N numbers and he loved equal triplets (An equal triplet is group of 3 numbers that are equal). He defined a K-equal-triplet as a triplet in which all 3 integers were equal to K. Given an integer K, he wanted to find out the probability of gett...
Solve the programming task below in a Python markdown code block. We have a rooted binary tree with N vertices, where the vertices are numbered 1 to N. Vertex 1 is the root, and the parent of Vertex i (i \geq 2) is Vertex \left[ \frac{i}{2} \right]. Each vertex has one item in it. The item in Vertex i has a value of ...
Solve the programming task below in a Python markdown code block. We have A balls with the string S written on each of them and B balls with the string T written on each of them. From these balls, Takahashi chooses one with the string U written on it and throws it away. Find the number of balls with the string S and b...
Solve the programming task below in a Python markdown code block. Takahashi is going to buy N items one by one. The price of the i-th item he buys is A_i yen (the currency of Japan). He has M discount tickets, and he can use any number of them when buying an item. If Y tickets are used when buying an item priced X ...
Solve the programming task below in a Python markdown code block. Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes: * Red boxes, each containing R red balls * Green boxes, each containing G green balls * Blue boxes, each containing B blue balls Snuke w...
Solve the programming task below in a Python markdown code block. You are given an integer sequence of length N: A_1,A_2,...,A_N. Let us perform Q operations in order. The i-th operation is described by two integers X_i and Y_i. In this operation, we will choose one of the following two actions and perform it: * Swap...
Solve the programming task below in a Python markdown code block. Takahashi and Aoki love calculating things, so they will play with numbers now. First, they came up with one positive integer each. Takahashi came up with X, and Aoki came up with Y. Then, they will enjoy themselves by repeating the following operation...
Solve the programming task below in a Python markdown code block. Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whethe...
Solve the programming task below in a Python markdown code block. Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print `ABC` if Smeke will participate in AB...
Solve the programming task below in a Python markdown code block. Taro Aizu's company has a boss who hates being indivisible. When Taro goes out to eat with his boss, he pays by splitting the bill, but when the payment amount is not divisible by the number of participants, his boss always pays for it. One day, Taro b...
Solve the programming task below in a Python markdown code block. A plurality of trampolines are arranged in a line at 10 m intervals. Each trampoline has its own maximum horizontal distance within which the jumper can jump safely. Starting from the left-most trampoline, the jumper jumps to another trampoline within t...
Solve the programming task below in a Python markdown code block. The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by o...
Solve the programming task below in a Python markdown code block. Here is a very simple variation of the game backgammon, named “Minimal Backgammon”. The game is played by only one player, using only one of the dice and only one checker (the token used by the player). The game board is a line of (N + 1) squares label...
Solve the programming task below in a Python markdown code block. <!-- Problem C --> Balance Scale You, an experimental chemist, have a balance scale and a kit of weights for measuring weights of powder chemicals. For work efficiency, a single use of the balance scale should be enough for measurement of each amou...
Solve the programming task below in a Python markdown code block. Miki is a high school student. She has a part time job, so she cannot take enough sleep on weekdays. She wants to take good sleep on holidays, but she doesn't know the best length of sleeping time for her. She is now trying to figure that out with the f...
Solve the programming task below in a Python markdown code block. B: Periodic Sequence- problem Dr. Period, a professor at H University, is studying a property called the cycle that is supposed to be hidden in all things. As a generally known basic cycle, a cycle hidden in a sequence may be considered. That is, if t...
Solve the programming task below in a Python markdown code block. For given two segments s1 and s2, print "1" if they are intersect, "0" otherwise. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 * -10000 ≤ xpi, ypi ≤ 10000 * p0 ≠ p1 and p2 ≠ p3. Input Th...
Solve the programming task below in a Python markdown code block. For a given sequence of integers $A = \\{a_0, a_1, ..., a_{n-1}\\}$, perform the following operations. * count($b, e, k$): print the number of the specific values $k$ in $a_b, a_{b+1}, ..., a_{e-1}$. Constraints * $1 \leq n \leq 1,000$ * $-1,000,000,...
Solve the programming task below in a Python markdown code block. One of Arkady's friends works at a huge radio telescope. A few decades ago the telescope has sent a signal s towards a faraway galaxy. Recently they've received a response t which they believe to be a response from aliens! The scientists now want to che...
Solve the programming task below in a Python markdown code block. The German University in Cairo (GUC) dorm houses are numbered from 1 to n. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and diameter (which characteriz...
Solve the programming task below in a Python markdown code block. Inaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 ≤ i < n) are adjacent, and so are points n and 1. There are m straight segments on...
Solve the programming task below in a Python markdown code block. Toad Pimple has an array of integers a_1, a_2, …, a_n. We say that y is reachable from x if x<y and there exists an integer array p such that x = p_1 < p_2 < … < p_k=y, and a_{p_i} \& a_{p_{i+1}} > 0 for all integers i such that 1 ≤ i < k. Here \& d...
Solve the programming task below in a Python markdown code block. You are given two strings of equal length s and t consisting of lowercase Latin letters. You may perform any number (possibly, zero) operations on these strings. During each operation you choose two adjacent characters in any string and assign the valu...
Solve the programming task below in a Python markdown code block. There are n seats in the train's car and there is exactly one passenger occupying every seat. The seats are numbered from 1 to n from left to right. The trip is long, so each passenger will become hungry at some moment of time and will go to take boiled...
Solve the programming task below in a Python markdown code block. Daisy is a senior software engineer at RainyDay, LLC. She has just implemented three new features in their product: the first feature makes their product work, the second one makes their product fast, and the third one makes their product correct. The c...
Solve the programming task below in a Python markdown code block. Polycarp is a frequent user of the very popular messenger. He's chatting with his friends all the time. He has n friends, numbered from 1 to n. Recall that a permutation of size n is an array of size n such that each integer from 1 to n occurs exactly ...
Solve the programming task below in a Python markdown code block. You are given two positive integers n and k. Print the k-th positive integer that is not divisible by n. For example, if n=3, and k=7, then all numbers that are not divisible by 3 are: 1, 2, 4, 5, 7, 8, 10, 11, 13 .... The 7-th number among them is 10....
Solve the programming task below in a Python markdown code block. A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large). Killjoy's account is already infected and has a rating equal to ...
Solve the programming task below in a Python markdown code block. Chef Monocarp has just put n dishes into an oven. He knows that the i-th dish has its optimal cooking time equal to t_i minutes. At any positive integer minute T Monocarp can put no more than one dish out of the oven. If the i-th dish is put out at som...
Solve the programming task below in a Python markdown code block. Polycarp has a favorite sequence a[1 ... n] consisting of n integers. He wrote it out on the whiteboard as follows: * he wrote the number a_1 to the left side (at the beginning of the whiteboard); * he wrote the number a_2 to the right side (at th...
Solve the programming task below in a Python markdown code block. Suppose you are living with two cats: A and B. There are n napping spots where both cats usually sleep. Your cats like to sleep and also like all these spots, so they change napping spot each hour cyclically: * Cat A changes its napping place in or...
Solve the programming task below in a Python markdown code block. The Smart Beaver from ABBYY came up with another splendid problem for the ABBYY Cup participants! This time the Beaver invites the contest participants to check out a problem on sorting documents by their subjects. Let's describe the problem: You've go...
Solve the programming task below in a Python markdown code block. Victor and Peter are playing hide-and-seek. Peter has hidden, and Victor is to find him. In the room where they are playing, there is only one non-transparent wall and one double-sided mirror. Victor and Peter are points with coordinates (xv, yv) and (x...
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. There is a game called "I Wanna Be the Guy", consisting of n levels. Little X and his friend Little Y are addicted to the game. Each of them wants to pass the whole game. Little X can pass only p levels of the game. And Little Y can pass only q levels ...
Solve the programming task below in a Python markdown code block. Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he can move in a unit distance in horizontal or vertical direc...
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 schoolboy named Vasya loves reading books on programming and mathematics. He has recently read an encyclopedia article that described the method of median smoothing (or median filter) and its many applications in science and engineering. Vasya liked t...
Solve the programming task below in a Python markdown code block. You are given an array a with n elements. Each element of a is either 0 or 1. Let's denote the length of the longest subsegment of consecutive elements in a, consisting of only numbers one, as f(a). You can change no more than k zeroes to ones to maxim...
Solve the programming task below in a Python markdown code block. Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead. As you may know, the coolest photos are on the film (...
Solve the programming task below in a Python markdown code block. Mike has n strings s1, s2, ..., sn each consisting of lowercase English letters. In one move he can choose a string si, erase the first character and append it to the end of the string. For example, if he has the string "coolmike", in one move he can tr...
Solve the programming task below in a Python markdown code block. A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediatel...