question
large_stringlengths
265
13.2k
Solve the programming task below in a Python markdown code block. The Happy Farm 5 creators decided to invent the mechanism of cow grazing. The cows in the game are very slow and they move very slowly, it can even be considered that they stand still. However, carnivores should always be chased off them. For that a y...
Solve the programming task below in a Python markdown code block. In Berland a bus travels along the main street of the capital. The street begins from the main square and looks like a very long segment. There are n bus stops located along the street, the i-th of them is located at the distance ai from the central squ...
Solve the programming task below in a Python markdown code block. In the spirit of the holidays, Saitama has given Genos two grid paths of length n (a weird gift even by Saitama's standards). A grid path is an ordered sequence of neighbouring squares in an infinite grid. Two squares are neighbouring if they share a si...
Solve the programming task below in a Python markdown code block. Famil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to have as many friends celebrating...
Solve the programming task below in a Python markdown code block. The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: * ti < ti + 1 for each odd i < n; * ti > ti + 1 for each even i < n. For example, sequences (2, 8), (1...
Solve the programming task below in a Python markdown code block. This is an interactive problem. In the output section below you will see the information about flushing the output. Bear Limak thinks of some hidden number β€” an integer from interval [2, 100]. Your task is to say if the hidden number is prime or compos...
Solve the programming task below in a Python markdown code block. Vasya has the square chessboard of size n Γ— n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is under rook's attack, if there is at least one rook located in t...
Solve the programming task below in a Python markdown code block. Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to m, but he does...
Solve the programming task below in a Python markdown code block. Hongcow likes solving puzzles. One day, Hongcow finds two identical puzzle pieces, with the instructions "make a rectangle" next to them. The pieces can be described by an n by m grid of characters, where the character 'X' denotes a part of the puzzle ...
Solve the programming task below in a Python markdown code block. Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb bein...
Solve the programming task below in a Python markdown code block. A positive integer number n is written on a blackboard. It consists of not more than 105 digits. You have to transform it into a beautiful number by erasing some of the digits, and you want to erase as few digits as possible. The number is called beaut...
Solve the programming task below in a Python markdown code block. Sagheer is playing a game with his best friend Soliman. He brought a tree with n nodes numbered from 1 to n and rooted at node 1. The i-th node has ai apples. This tree has a special property: the lengths of all paths from the root to any leaf have the ...
Solve the programming task below in a Python markdown code block. Your security guard friend recently got a new job at a new security company. The company requires him to patrol an area of the city encompassing exactly N city blocks, but they let him choose which blocks. That is, your friend must walk the perimeter of...
Solve the programming task below in a Python markdown code block. Recently Luba bought a very interesting book. She knows that it will take t seconds to read the book. Luba wants to finish reading as fast as she can. But she has some work to do in each of n next days. The number of seconds that Luba has to spend work...
Solve the programming task below in a Python markdown code block. Carol is currently curling. She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100. She then will slide the disks towards the line y = 0 one by one in order from 1 to n. When she slides the i...
Solve the programming task below in a Python markdown code block. Little walrus Fangy loves math very much. That's why when he is bored he plays with a number performing some operations. Fangy takes some positive integer x and wants to get a number one from it. While x is not equal to 1, Fangy repeats the following a...
Solve the programming task below in a Python markdown code block. Consider a new order of english alphabets (a to z), that we are not aware of. What we have though, dictionary of words, ordered according to the new order. Our task is to give each alphabet a rank, ordered list of words. The rank of an alphabet is the ...
Solve the programming task below in a Python markdown code block. Flip the world is a game. In this game a matrix of size N*M is given, which consists of numbers. Each number can be 1 or 0 only. The rows are numbered from 1 to N, and the columns are numbered from 1 to M. Following steps can be called as a single move...
Solve the programming task below in a Python markdown code block. Mike has a huge guitar collection which the whole band is jealous of. Brad, the lead guitarist of the band, gave Mike a challenge so that he can't use all his guitars. The band is on a world tour and Brad told Mike to assign numbers to all his guitars. ...
Solve the programming task below in a Python markdown code block. Given are integers A, B, and N. Find the maximum possible value of floor(Ax/B) - A Γ— floor(x/B) for a non-negative integer x not greater than N. Here floor(t) denotes the greatest integer not greater than the real number t. Constraints * 1 ≀ A ≀ 10^...
Solve the programming task below in a Python markdown code block. Let us consider a grid of squares with N rows and N columns. You want to put some domino pieces on this grid. Each domino piece covers two squares that have a common side. Each square can be covered by at most one piece. For each row of the grid, let's...
Solve the programming task below in a Python markdown code block. Given are two strings s and t consisting of lowercase English letters. Determine if the number of non-negative integers i satisfying the following condition is finite, and find the maximum value of such i if the number is finite. * There exists a non-n...
Solve the programming task below in a Python markdown code block. Kurohashi has never participated in AtCoder Beginner Contest (ABC). The next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same. What is the earliest...
Solve the programming task below in a Python markdown code block. In Finite Encyclopedia of Integer Sequences (FEIS), all integer sequences of lengths between 1 and N (inclusive) consisting of integers between 1 and K (inclusive) are listed. Let the total number of sequences listed in FEIS be X. Among those sequences...
Solve the programming task below in a Python markdown code block. Mr. Tanaka died leaving the orchard of HW Earl. The orchard is divided into H x W plots in the north, south, east, and west directions, and apples, oysters, and oranges are planted in each plot. Mr. Tanaka left such a will. Divide the orchard into as m...
Solve the programming task below in a Python markdown code block. Welcome to PC Koshien, players. This year marks the 10th anniversary of Computer Koshien, but the number of questions and the total score will vary from year to year. Scores are set for each question according to the difficulty level. When the number of...
Solve the programming task below in a Python markdown code block. Dr .: Peter, do you know "Yes, I have a number"? Peter: I used to do it on TV the other day. You remember something by the number of characters in each word contained in a sentence. "Yes, I have a number", so it means "the number 3.14" and is a keyword...
Solve the programming task below in a Python markdown code block. Jim is planning to visit one of his best friends in a town in the mountain area. First, he leaves his hometown and goes to the destination town. This is called the go phase. Then, he comes back to his hometown. This is called the return phase. You are e...
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 darts as much as programming. Yu-kun was addicted to darts recently, but he got tir...
Solve the programming task below in a Python markdown code block. In the International System of Units (SI), various physical quantities are expressed in the form of "numerical value + prefix + unit" using prefixes such as kilo, mega, and giga. For example, "3.5 kilometers", "5.1 milligrams", and so on. On the other ...
Solve the programming task below in a Python markdown code block. H - RLE Replacement Problem Statement In JAG Kingdom, ICPC (Intentionally Compressible Programming Code) is one of the common programming languages. Programs in this language only contain uppercase English letters and the same letters often appear rep...
Solve the programming task below in a Python markdown code block. A: four tea problem Tea is indispensable for programming contests. Tea has the effect of relieving constant tension [citation needed] There are N players participating in the contest, so I would like to prepare tea for this number of people. There ar...
Solve the programming task below in a Python markdown code block. Gag Segtree has $ N $ of "gags", each with a value of $ V_i $. Segtree decided to publish all the gags in any order. Here, the "joy" you get when you publish the $ i $ th gag to the $ j $ th is expressed as $ V_i --j $. Find the maximum sum of the "...
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. You are given a set of n segments on the axis Ox, each segment has integer endpoints between 1 and m inclusive. Segments may intersect, overlap or even coincide with each other. Each segment is characterized by two integers l_i and r_i (1 ≀ l_i ≀ r_i ≀ ...
Solve the programming task below in a Python markdown code block. You are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. A sequence of blocks is called valid if the touching endpoints of neighboring blocks have the same color. ...
Solve the programming task below in a Python markdown code block. You have unlimited number of coins with values 1, 2, …, n. You want to select some set of coins having the total value of S. It is allowed to have multiple coins with the same value in the set. What is the minimum number of coins required to get sum S...
Solve the programming task below in a Python markdown code block. Petya has a simple graph (that is, a graph without loops or multiple edges) consisting of n vertices and m edges. The weight of the i-th vertex is a_i. The weight of the i-th edge is w_i. A subgraph of a graph is some set of the graph vertices and so...
Solve the programming task below in a Python markdown code block. You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way that: * Each element of the array should be colored in some color; * For each i from 1 to k there should be at least one element col...
Solve the programming task below in a Python markdown code block. Sasha and Dima want to buy two n-tier cakes. Each cake should consist of n different tiers: from the size of 1 to the size of n. Tiers should go in order from the smallest to the biggest (from top to bottom). They live on the same street, there are 2 β‹…...
Solve the programming task below in a Python markdown code block. Bertown has n junctions and m bidirectional roads. We know that one can get from any junction to any other one by the existing roads. As there were more and more cars in the city, traffic jams started to pose real problems. To deal with them the gover...
Solve the programming task below in a Python markdown code block. The legendary Farmer John is throwing a huge party, and animals from all over the world are hanging out at his house. His guests are hungry, so he instructs his cow Bessie to bring out the snacks! Moo! There are n snacks flavors, numbered with integers...
Solve the programming task below in a Python markdown code block. Let's introduce some definitions that will be needed later. Let prime(x) be the set of prime divisors of x. For example, prime(140) = \{ 2, 5, 7 \}, prime(169) = \{ 13 \}. Let g(x, p) be the maximum possible integer p^k where k is an integer such that...
Solve the programming task below in a Python markdown code block. [Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY) A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, there is a staircase connecting them. It's lunchtime for our...
Solve the programming task below in a Python markdown code block. Tired of boring office work, Denis decided to open a fast food restaurant. On the first day he made a portions of dumplings, b portions of cranberry juice and c pancakes with condensed milk. The peculiarity of Denis's restaurant is the procedure of or...
Solve the programming task below in a Python markdown code block. The only difference between easy and hard versions is constraints. You are given a sequence a consisting of n positive integers. Let's define a three blocks palindrome as the sequence, consisting of at most two distinct elements (let these elements ar...
Solve the programming task below in a Python markdown code block. Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance. The park is a ...
Solve the programming task below in a Python markdown code block. You have n gifts and you want to give all of them to children. Of course, you don't want to offend anyone, so all gifts should be equal between each other. The i-th gift consists of a_i candies and b_i oranges. During one move, you can choose some gift...
Solve the programming task below in a Python markdown code block. Some time ago Lesha found an entertaining string s consisting of lowercase English letters. Lesha immediately developed an unique algorithm for this string and shared it with you. The algorithm is as follows. Lesha chooses an arbitrary (possibly zero) ...
Solve the programming task below in a Python markdown code block. This is the hard version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem. You are given a binary table of size n Γ— m...
Solve the programming task below in a Python markdown code block. This is the easy version of the problem. The only difference is that in this version q = 1. You can make hacks only if both versions of the problem are solved. There is a process that takes place on arrays a and b of length n and length n-1 respectivel...
Solve the programming task below in a Python markdown code block. In one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platforms from point 0, with each jump ...
Solve the programming task below in a Python markdown code block. You've got table a, consisting of n rows, numbered from 1 to n. The i-th line of table a contains ci cells, at that for all i (1 < i ≀ n) holds ci ≀ ci - 1. Let's denote s as the total number of cells of table a, that is, <image>. We know that each ce...
Solve the programming task below in a Python markdown code block. Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'll call number n the size or the length of permutation p1, p...
Solve the programming task below in a Python markdown code block. Vasya’s elder brother Petya loves playing computer games. In one of his favourite computer games Petya reached the final level where a fight with the boss take place. While playing the game Petya found spell scrolls and now he is about to use them. Let...
Solve the programming task below in a Python markdown code block. There always is something to choose from! And now, instead of "Noughts and Crosses", Inna choose a very unusual upgrade of this game. The rules of the game are given below: There is one person playing the game. Before the beginning of the game he puts ...
Solve the programming task below in a Python markdown code block. The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city. For this reason, he made the n prisoners to stand in a line, with a num...
Solve the programming task below in a Python markdown code block. One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that. For example, there is a statement called the "Goldbach's conjecture". It says: "eac...
Solve the programming task below in a Python markdown code block. Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar. <image> So, if height of Xaniar is h1 and height of A...
Solve the programming task below in a Python markdown code block. One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment. Vitaly sees a building of n floors and 2...
Solve the programming task below in a Python markdown code block. You are given an undirected graph that consists of n vertices and m edges. Initially, each edge is colored either red or blue. Each turn a player picks a single vertex and switches the color of all edges incident to it. That is, all red edges with an en...
Solve the programming task below in a Python markdown code block. Recently, Mike was very busy with studying for exams and contests. Now he is going to chill a bit by doing some sight seeing in the city. City consists of n intersections numbered from 1 to n. Mike starts walking from his house located at the intersect...
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. After the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and decided to continue their competitions in peaceful game of Credit Cards. Rules of this game are simple: each player bring his favourite n-di...
Solve the programming task below in a Python markdown code block. Erelong Leha was bored by calculating of the greatest common divisor of two factorials. Therefore he decided to solve some crosswords. It's well known that it is a very interesting occupation though it can be very difficult from time to time. In the cou...
Solve the programming task below in a Python markdown code block. Even if the world is full of counterfeits, I still regard it as wonderful. Pile up herbs and incense, and arise again from the flames and ashes of its predecessor β€” as is known to many, the phoenix does it like this. The phoenix has a rather long life...
Solve the programming task below in a Python markdown code block. Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order a pizza. In this problem pizza is a circle of some radius. The pizza was delivered already cut into n pieces. The i-th piece is a se...
Solve the programming task below in a Python markdown code block. Jamie is preparing a Codeforces round. He has got an idea for a problem, but does not know how to solve it. Help him write a solution to the following problem: Find k integers such that the sum of two to the power of each number equals to the number n ...
Solve the programming task below in a Python markdown code block. In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n...
Solve the programming task below in a Python markdown code block. Vasya is a regular participant at programming contests and is already experienced in finding important sentences in long statements. Of course, numbers constraints are important β€” factorization of a number less than 1000000 is easier than of a number le...
Solve the programming task below in a Python markdown code block. Little Arihant has always wanted to be the best Pokemon trainer in this world. And he thinks he has achieved his goal, so he wants to quickly go and meet Professor Oak and verify this fact. But like all Pokemon trainers, he has a weird habit, too. He ca...
Solve the programming task below in a Python markdown code block. After minting loads of money from innocent people by using the psychic powers (As we saw in the previous question!) - little Jhool managed to woo his girlfriend big Jhool! And now, he's in love - madly, madly in love with his girlfriend. But the road ...
Solve the programming task below in a Python markdown code block. See Russian Translation It's a fine sunny afternoon today in California. Looking at the pleasant weather, Sumit is all ready to go out and play with his friend Rohil. Unfortunately, Rohil is down with fever. Seeing that his friend is ill, Sumit decides...
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 an integer. Examples Inp...
Solve the programming task below in a Python markdown code block. We have a tree G with N vertices numbered 1 to N. The i-th edge of G connects Vertex a_i and Vertex b_i. Consider adding zero or more edges in G, and let H be the graph resulted. Find the number of graphs H that satisfy the following conditions, modul...
Solve the programming task below in a Python markdown code block. There are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S. Adjacen...
Solve the programming task below in a Python markdown code block. Snuke found a random number generator. It generates an integer between 0 and 2^N-1 (inclusive). An integer sequence A_0, A_1, \cdots, A_{2^N-1} represents the probability that each of these integers is generated. The integer i (0 \leq i \leq 2^N-1) is g...
Solve the programming task below in a Python markdown code block. Kenkoooo is planning a trip in Republic of Snuke. In this country, there are n cities and m trains running. The cities are numbered 1 through n, and the i-th train connects City u_i and v_i bidirectionally. Any city can be reached from any city by chang...
Solve the programming task below in a Python markdown code block. We have N sticks with negligible thickness. The length of the i-th stick is A_i. Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of t...
Solve the programming task below in a Python markdown code block. Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i. Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus ...
Solve the programming task below in a Python markdown code block. There are N rabbits on a number line. The rabbits are conveniently numbered 1 through N. The coordinate of the initial position of rabbit i is x_i. The rabbits will now take exercise on the number line, by performing sets described below. A set consist...
Solve the programming task below in a Python markdown code block. There is a puzzle to complete by combining 14 numbers from 1 to 9. Complete by adding another number to the given 13 numbers. The conditions for completing the puzzle are * You must have one combination of the same numbers. * The remaining 12 numbers ...
Solve the programming task below in a Python markdown code block. Decimal numbers are a common notation system currently in use and use ten symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 to represent all numbers. Binary numbers are a popular notation in the computer world and use two symbols, 0 and 1, to represent all numb...
Solve the programming task below in a Python markdown code block. The appearance of the sun is called "sunrise" and the hiding is called "sunset". What is the exact time when the sun is on the horizon? As shown in the figure below, we will represent the sun as a circle and the horizon as a straight line. At this time...
Solve the programming task below in a Python markdown code block. As the first step in algebra, students learn quadratic formulas and their factorization. Often, the factorization is a severe burden for them. A large number of students cannot master the factorization; such students cannot be aware of the elegance of a...
Solve the programming task below in a Python markdown code block. Professor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For establishing his hypotheses, he has been developing software agents, which automatically traverse hyperlinks and analyze the structure of the Web...
Solve the programming task below in a Python markdown code block. Look for the Winner! The citizens of TKB City are famous for their deep love in elections and vote counting. Today they hold an election for the next chairperson of the electoral commission. Now the voting has just been closed and the counting is going...
Solve the programming task below in a Python markdown code block. International Car Production Company (ICPC), one of the largest automobile manufacturers in the world, is now developing a new vehicle called "Two-Wheel Buggy". As its name suggests, the vehicle has only two wheels. Quite simply, "Two-Wheel Buggy" is ma...
Solve the programming task below in a Python markdown code block. The University of Aizu Elementary School (Aizu University and Small) is famous as one of Japan's leading competition programmer training schools. Of course, it is essential to practice the algorithm even when attending an athletic meet. Of course you, t...
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. jfen There is a one-person game to play on the H Γ— W board. This game is a game to move 0 or 1 balls in each cell. You were playing this game and found it difficult to move the ball accurately from cell to cell because the ball is so round. So you deci...
Solve the programming task below in a Python markdown code block. Generalized leap year Normally, whether or not the year x is a leap year is defined as follows. 1. If x is a multiple of 400, it is a leap year. 2. Otherwise, if x is a multiple of 100, it is not a leap year. 3. Otherwise, if x is a multiple of 4, it ...
Solve the programming task below in a Python markdown code block. Problem There are $ N $ streetlights on a two-dimensional square of $ W \ times H $. Gaccho wants to start with $ (1,1) $ and go to $ (W, H) $. Gaccho is afraid of dark places, so he only wants to walk in the squares that are brightened by the streetli...
Solve the programming task below in a Python markdown code block. Write a program which reads an integer and prints sum of its digits. Input The input consists of multiple datasets. For each dataset, an integer x is given in a line. The number of digits in x does not exceed 1000. The input ends with a line includ...
Solve the programming task below in a Python markdown code block. Lira is now very keen on compiler development. :) She knows that one of the most important components of a compiler, is its parser. A parser is, in simple terms, a software component that processes text, and checks it's semantic correctness, or, if you...
Solve the programming task below in a Python markdown code block. There is a beautiful garden of stones in Innopolis. Its most beautiful place is the n piles with stones numbered from 1 to n. EJOI participants have visited this place twice. When they first visited it, the number of stones in piles was x_1, x_2, …,...
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 Γ— m matrix, where c_{i,j} = a_i β‹… b_j. You need to find a subrectangle of the matrix c such that the sum of its elements is at most x, and its are...
Solve the programming task below in a Python markdown code block. Vasya is reading a e-book. The file of the book consists of n pages, numbered from 1 to n. The screen is currently displaying the contents of page x, and Vasya wants to read the page y. There are two buttons on the book which allow Vasya to scroll d pag...
Solve the programming task below in a Python markdown code block. There are n segments [l_i, r_i] for 1 ≀ i ≀ n. You should divide all segments into two non-empty groups in such way that there is no pair of segments from different groups which have at least one common point, or say that it's impossible to do it. Each ...
Solve the programming task below in a Python markdown code block. Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters' case does not matte...