question
large_stringlengths
265
13.2k
Solve the programming task below in a Python markdown code block. problem To the west of the Australian continent is the wide Indian Ocean. Marine researcher JOI is studying the properties of N species of fish in the Indian Ocean. For each type of fish, a rectangular parallelepiped habitat range is determined in the...
Solve the programming task below in a Python markdown code block. There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds. Initially, no candles are burning. Snuke decides to light K of the N candles. Now, he is at coordinate 0. He can m...
Solve the programming task below in a Python markdown code block. Toad Ivan has $m$ pairs of integers, each integer is between $1$ and $n$, inclusive. The pairs are $(a_1, b_1), (a_2, b_2), \ldots, (a_m, b_m)$. He asks you to check if there exist two integers $x$ and $y$ ($1 \leq x < y \leq n$) such that in each giv...
Solve the programming task below in a Python markdown code block. You are given $n$ strings. Each string consists of lowercase English letters. Rearrange (reorder) the given strings in such a way that for every string, all strings that are placed before it are its substrings. String $a$ is a substring of string $b$ i...
Solve the programming task below in a Python markdown code block. It is Professor R's last class of his teaching career. Every time Professor R taught a class, he gave a special problem for the students to solve. You being his favourite student, put your heart into solving it one last time. You are given two polynomi...
Solve the programming task below in a Python markdown code block. Mishka wants to buy some food in the nearby shop. Initially, he has $s$ burles on his card. Mishka can perform the following operation any number of times (possibly, zero): choose some positive integer number $1 \le x \le s$, buy food that costs exact...
Solve the programming task below in a Python markdown code block. You are given an array $A$, consisting of $n$ positive integers $a_1, a_2, \dots, a_n$, and an array $B$, consisting of $m$ positive integers $b_1, b_2, \dots, b_m$. Choose some element $a$ of $A$ and some element $b$ of $B$ such that $a+b$ doesn't be...
Solve the programming task below in a Python markdown code block. The police department of your city has just started its journey. Initially, they don’t have any manpower. So, they started hiring new recruits in groups. Meanwhile, crimes keeps occurring within the city. One member of the police force can investigate ...
Solve the programming task below in a Python markdown code block. Vasya has a pile, that consists of some number of stones. $n$ times he either took one stone from the pile or added one stone to the pile. The pile was non-empty before each operation of taking one stone from the pile. You are given $n$ operations whic...
Solve the programming task below in a Python markdown code block. It is known that each weight of 1 gram, 3 gram, 9 gram, and 27 gram can be weighed from 1 gram to 40 gram in 1 gram increments using a balance. For example, if you put a weight of 3 grams and a weight you want to weigh on one plate of the balance and a ...
Solve the programming task below in a Python markdown code block. Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems. You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any 2 distinct ...
Solve the programming task below in a Python markdown code block. The number ```89``` is the first integer with more than one digit that fulfills the property partially introduced in the title of this kata. What's the use of saying "Eureka"? Because this sum gives the same number. In effect: ```89 = 8^1 + 9^2``` T...
Solve the programming task below in a Python markdown code block. Mishka started participating in a programming contest. There are $n$ problems in the contest. Mishka's problem-solving skill is equal to $k$. Mishka arranges all problems from the contest into a list. Because of his weird principles, Mishka only solves...
Solve the programming task below in a Python markdown code block. You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order). -----Input----- The only line of input contains a string s of length between 1 and 10^...
Solve the programming task below in a Python markdown code block. The King of Flatland will organize a knights' tournament! The winner will get half the kingdom and the favor of the princess of legendary beauty and wisdom. The final test of the applicants' courage and strength will be a fencing tournament. The tournam...
Solve the programming task below in a Python markdown code block. You are given n numbers a_1, a_2, ..., a_{n}. You can perform at most k operations. For each operation you can multiply one of the numbers by x. We want to make [Image] as large as possible, where $1$ denotes the bitwise OR. Find the maximum possible ...
Solve the programming task below in a Python markdown code block. Space Coconut Crab Space coconut crab English text is not available in this practice contest. Ken Marine Blue is a space hunter who travels through the entire galaxy in search of space coconut crabs. The space coconut crab is the largest crustacean i...
Solve the programming task below in a Python markdown code block. You are given a tree (connected graph without cycles) consisting of $n$ vertices. The tree is unrooted — it is just a connected undirected graph without cycles. In one move, you can choose exactly $k$ leaves (leaf is such a vertex that is connected to ...
Solve the programming task below in a Python markdown code block. Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it. Given a sequence a consisting of n integers. The player can make several steps. In a single ste...
Solve the programming task below in a Python markdown code block. Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordi...
Solve the programming task below in a Python markdown code block. You have an array $a$ of length $n$. For every positive integer $x$ you are going to perform the following operation during the $x$-th second: Select some distinct indices $i_{1}, i_{2}, \ldots, i_{k}$ which are between $1$ and $n$ inclusive, and add...
Solve the programming task below in a Python markdown code block. ```if-not:ruby Create a function, that accepts an arbitrary number of arrays and returns a single array generated by alternately appending elements from the passed in arguments. If one of them is shorter than the others, the result should be padded with...
Solve the programming task below in a Python markdown code block. The Little Elephant enjoys recursive functions. This time he enjoys the sorting function. Let a is a permutation of an integers from 1 to n, inclusive, and ai denotes the i-th element of the permutation. The Little Elephant's recursive function f(x), t...
Solve the programming task below in a Python markdown code block. A group of n merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In other words, the drink's volume in each of...
Solve the programming task below in a Python markdown code block. Find the number of palindromic numbers among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. -----Constraints...
Solve the programming task below in a Python markdown code block. While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. [Image] He is not sure if this is his own bac...
Solve the programming task below in a Python markdown code block. Vasya likes everything infinite. Now he is studying the properties of a sequence s, such that its first element is equal to a (s_1 = a), and the difference between any two neighbouring elements is equal to c (s_{i} - s_{i} - 1 = c). In particular, Vasya...
Solve the programming task below in a Python markdown code block. Dr .: Peter. I did. Peter: See you again? What kind of silly invention is this time? Dr .: You invented the detector for that phantom elementary particle axion. Peter: Speaking of Axion, researchers such as the European Organization for Nuclear Resea...
Solve the programming task below in a Python markdown code block. Given is a positive integer N. Find the number of pairs (A, B) of positive integers not greater than N that satisfy the following condition: - When A and B are written in base ten without leading zeros, the last digit of A is equal to the first digit ...
Solve the programming task below in a Python markdown code block. You are given two strings $a$ and $b$ consisting of lowercase English letters, both of length $n$. The characters of both strings have indices from $1$ to $n$, inclusive. You are allowed to do the following changes: Choose any index $i$ ($1 \le i \l...
Solve the programming task below in a Python markdown code block. You are given a tree that consists of $n$ nodes. You should label each of its $n-1$ edges with an integer in such way that satisfies the following conditions: each integer must be greater than $0$; the product of all $n-1$ numbers should be equal to ...
Solve the programming task below in a Python markdown code block. Yelisey has an array $a$ of $n$ integers. If $a$ has length strictly greater than $1$, then Yelisei can apply an operation called minimum extraction to it: First, Yelisei finds the minimal number $m$ in the array. If there are several identical minima...
Solve the programming task below in a Python markdown code block. The only difference between easy and hard versions is constraints. The BerTV channel every day broadcasts one episode of one of the $k$ TV shows. You know the schedule for the next $n$ days: a sequence of integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le...
Solve the programming task below in a Python markdown code block. # Background My TV remote control has arrow buttons and an `OK` button. I can use these to move a "cursor" on a logical screen keyboard to type words... # Keyboard The screen "keyboard" layout looks like this #tvkb { width : 400px; borde...
Solve the programming task below in a Python markdown code block. Write a function named sumDigits which takes a number as input and returns the sum of the absolute value of each of the number's decimal digits. For example: ```python sum_digits(10) # Returns 1 sum_digits(99) # Returns 18 sum_digits(-32) # Re...
Solve the programming task below in a Python markdown code block. Create a function that accepts 3 inputs, a string, a starting location, and a length. The function needs to simulate the string endlessly repeating in both directions and return a substring beginning at the starting location and continues for length. ...
Solve the programming task below in a Python markdown code block. You're continuing to enjoy your new piano, as described in Piano Kata, Part 1. You're also continuing the exercise where you start on the very first (leftmost, lowest in pitch) key on the 88-key keyboard, which (as shown below) is the note A, with the l...
Solve the programming task below in a Python markdown code block. Maxim loves to fill in a matrix in a special manner. Here is a pseudocode of filling in a matrix of size (m + 1) × (m + 1): [Image] Maxim asks you to count, how many numbers m (1 ≤ m ≤ n) are there, such that the sum of values in the cells in the row ...
Solve the programming task below in a Python markdown code block. Dreamoon has a string s and a pattern string p. He first removes exactly x characters from s obtaining string s' as a result. Then he calculates <image> that is defined as the maximal number of non-overlapping substrings equal to p that can be found in ...
Solve the programming task below in a Python markdown code block. A magic number is a number formed by concatenation of numbers 1, 14 and 144. We can use each of these numbers any number of times. Therefore 14144, 141414 and 1411 are magic numbers but 1444, 514 and 414 are not. You're given a number. Determine if it ...
Solve the programming task below in a Python markdown code block. Jack and Jill are playing a game. They have balls numbered from `0` to `n - 1`. Jack looks the other way and asks Jill to reverse the position of the balls, for instance, to change the order from say, `0,1,2,3` to `3,2,1,0`. He further asks Jill to reve...
Solve the programming task below in a Python markdown code block. We have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell. However, she cannot enter the cells in the intersectio...
Solve the programming task below in a Python markdown code block. Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed h and the processor smashes k centimeters of potato each second. If there are less than k centimeters remaining, than duri...
Solve the programming task below in a Python markdown code block. Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate. The path consists of n consecutive tiles, numbered from 1 to n. Ujan will paint each tile in some color. He ...
Solve the programming task below in a Python markdown code block. <image> One morning the Cereal Guy found out that all his cereal flakes were gone. He found a note instead of them. It turned out that his smart roommate hid the flakes in one of n boxes. The boxes stand in one row, they are numbered from 1 to n from t...
Solve the programming task below in a Python markdown code block. You are given a permutation of natural integers from 1 to N, inclusive. Initially, the permutation is 1, 2, 3, ..., N. You are also given M pairs of integers, where the i-th is (Li Ri). In a single turn you can choose any of these pairs (let's say with ...
Solve the programming task below in a Python markdown code block. The Bitlandians are quite weird people. They have very peculiar customs. As is customary, Uncle J. wants to have n eggs painted for Bitruz (an ancient Bitland festival). He has asked G. and A. to do the work. The kids are excited because just as is cu...
Solve the programming task below in a Python markdown code block. # Task Your task is to write a function for calculating the score of a 10 pin bowling game. The input for the function is a list of pins knocked down per roll for one player. Output is the player's total score. # Rules ## General rules Rules of bowli...
Solve the programming task below in a Python markdown code block. # Story Due to lack of maintenance the minute-hand has fallen off Town Hall clock face. And because the local council has lost most of our tax money to a Nigerian email scam there are no funds to fix the clock properly. Instead, they are asking for ...
Solve the programming task below in a Python markdown code block. You are given a permutation $p_1, p_2, \dots, p_n$. Recall that sequence of $n$ integers is called a permutation if it contains all integers from $1$ to $n$ exactly once. Find three indices $i$, $j$ and $k$ such that: $1 \le i < j < k \le n$; $p_i <...
Solve the programming task below in a Python markdown code block. Write a function that rearranges an integer into its largest possible value. ```python super_size(123456) # 654321 super_size(105) # 510 super_size(12) # 21 ``` ``` haskell superSize 123456 `shouldBe` 654321 superSize 105 `shouldBe` 510 s...
Solve the programming task below in a Python markdown code block. Hint * One grid may be filled more than once * Even if it can be represented by one line segment such as '1', it may be represented by two or more line segments. Sample Input 1 Formula for Sample Input 1. Sample Input 2 Sample Input 2 formula. Anot...
Solve the programming task below in a Python markdown code block. There are N towers in the town where Ikta lives. Each tower is given a different number from 0 to N-1, and the tower with number i is called tower i. Curious Ikta was interested in the height of the N towers and decided to make a table T showing the mag...
Solve the programming task below in a Python markdown code block. $n$ students are taking an exam. The highest possible score at this exam is $m$. Let $a_{i}$ be the score of the $i$-th student. You have access to the school database which stores the results of all students. You can change each student's score as lon...
Solve the programming task below in a Python markdown code block. We have a string S of length N consisting of R, G, and B. Find the number of triples (i,~j,~k)~(1 \leq i < j < k \leq N) that satisfy both of the following conditions: - S_i \neq S_j, S_i \neq S_k, and S_j \neq S_k. - j - i \neq k - j. -----Constrain...
Solve the programming task below in a Python markdown code block. Igor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain "some real funny stuff about swine influenza". The antivi...
Solve the programming task below in a Python markdown code block. There are N piles of stones. The i-th pile has A_i stones. Aoki and Takahashi are about to use them to play the following game: - Starting with Aoki, the two players alternately do the following operation: - Operation: Choose one pile of stones, and r...
Solve the programming task below in a Python markdown code block. You are given a sequence a consisting of n integers. You may partition this sequence into two sequences b and c in such a way that every element belongs exactly to one of these sequences. Let B be the sum of elements belonging to b, and C be the sum o...
Solve the programming task below in a Python markdown code block. Do the following for a four-digit number N consisting of numbers 0-9. 1. Let L be the number obtained as a result of arranging the numerical values ​​of each of the N digits in descending order. 2. Let S be the number obtained as a result of arranging ...
Solve the programming task below in a Python markdown code block. Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: * a1 = p, where p is som...
Solve the programming task below in a Python markdown code block. The T9 typing predictor helps with suggestions for possible word combinations on an old-style numeric keypad phone. Each digit in the keypad (2-9) represents a group of 3-4 letters. To type a letter, press once the key which corresponds to the letter gr...
Solve the programming task below in a Python markdown code block. Ilya is working for the company that constructs robots. Ilya writes programs for entertainment robots, and his current project is "Bob", a new-generation game robot. Ilya's boss wants to know his progress so far. Especially he is interested if Bob is be...
Solve the programming task below in a Python markdown code block. 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. You are given an integer N. For two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B. For example, F(3,11) = 2 sin...
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. We call a positive integer number fair if it is divisible by each of its nonzero digits. For example, $102$ is fair (because it is divisible by $1$ and $2$), but $282$ is not, because it isn't divisible by $8$. Given a positive integer $n$. Find the min...
Solve the programming task below in a Python markdown code block. Writing light novels is the most important thing in Linova's life. Last night, Linova dreamed about a fantastic kingdom. She began to write a light novel for the kingdom as soon as she woke up, and of course, she is the queen of it. <image> There are ...
Solve the programming task below in a Python markdown code block. You have decided to write a book introducing good restaurants. There are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point sc...
Solve the programming task below in a Python markdown code block. Vladik was bored on his way home and decided to play the following game. He took n cards and put them in a row in front of himself. Every card has a positive integer number not exceeding 8 written on it. He decided to find the longest subsequence of car...
Solve the programming task below in a Python markdown code block. Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it. Valera has written n correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote m wr...
Solve the programming task below in a Python markdown code block. Alexandra has a paper strip with n numbers on it. Let's call them a_{i} from left to right. Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: Each piece should contain at least l numbers. The...
Solve the programming task below in a Python markdown code block. **Story** On some island lives a chameleon population. Chameleons here can be of only one of three colors - red, green and blue. Whenever two chameleons of different colors meet, they can change their colors to a third one (i.e. when red and blue cham...
Solve the programming task below in a Python markdown code block. Imp is watching a documentary about cave painting. [Image] Some numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of a number n by all integers i from 1 to k. U...
Solve the programming task below in a Python markdown code block. You are given a graph with $n$ nodes and $m$ directed edges. One lowercase letter is assigned to each node. We define a path's value as the number of the most frequently occurring letter. For example, if letters on a path are "abaca", then the value of ...
Solve the programming task below in a Python markdown code block. William has two arrays $a$ and $b$, each consisting of $n$ items. For some segments $l..r$ of these arrays William wants to know if it is possible to equalize the values of items in these segments using a balancing operation. Formally, the values are e...
Solve the programming task below in a Python markdown code block. Baby Ehab is known for his love for a certain operation. He has an array $a$ of length $n$, and he decided to keep doing the following operation on it: he picks $2$ adjacent elements; he then removes them and places a single integer in their place: the...
Solve the programming task below in a Python markdown code block. problem Do you know Just Odd Inventions? The business of this company is to "just odd inventions". Here we call it JOI for short. JOI has two offices, each of which has square rooms of the same size arranged in a grid pattern. All the rooms that are i...
Solve the programming task below in a Python markdown code block. There is data of up to 100 characters per line, consisting of half-width alphabetic character strings. Some lines are symmetric (same whether read from the left edge or the right edge). Create a program that reads this data and outputs the number of sym...
Solve the programming task below in a Python markdown code block. Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in...
Solve the programming task below in a Python markdown code block. Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to ...
Solve the programming task below in a Python markdown code block. Mountaineers Mr. Takahashi and Mr. Aoki recently trekked across a certain famous mountain range. The mountain range consists of N mountains, extending from west to east in a straight line as Mt. 1, Mt. 2, ..., Mt. N. Mr. Takahashi traversed the range fr...
Solve the programming task below in a Python markdown code block. At a break Vanya came to the class and saw an array of $n$ $k$-bit integers $a_1, a_2, \ldots, a_n$ on the board. An integer $x$ is called a $k$-bit integer if $0 \leq x \leq 2^k - 1$. Of course, Vanya was not able to resist and started changing the n...
Solve the programming task below in a Python markdown code block. You are going to be given a word. Your job will be to make sure that each character in that word has the exact same number of occurrences. You will return `true` if it is valid, or `false` if it is not. For example: `"abcabc"` is a valid word because ...
Solve the programming task below in a Python markdown code block. You are given a set $T$, which is a subset of $U$. The set $U$ consists of $0, 1, ... n-1$. Print all sets, each of which is a subset of $U$ and includes $T$ as a subset. Note that we represent $0, 1, ... n-1$ as 00...0001, 00...0010, 00...0100, ..., 10...
Solve the programming task below in a Python markdown code block. You have a string $s$ — a sequence of commands for your toy robot. The robot is placed in some cell of a rectangular grid. He can perform four commands: 'W' — move one cell up; 'S' — move one cell down; 'A' — move one cell left; 'D' — move one cell ...
Solve the programming task below in a Python markdown code block. There are N blocks arranged in a row, numbered 1 to N from left to right. Each block has a weight, and the weight of Block i is A_i. Snuke will perform the following operation on these blocks N times: * Choose one block that is still not removed, and r...
Solve the programming task below in a Python markdown code block. In this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of the equator and any meridian is considered to be exactly 40 000 kilometers. Thus, travelling from North Pole to South Pole or vice versa ta...
Solve the programming task below in a Python markdown code block. Much cooler than your run-of-the-mill Fibonacci numbers, the Triple Shiftian are so defined: `T[n] = 4 * T[n-1] - 5 * T[n-2] + 3 * T[n-3]`. You are asked to create a function which accept a base with the first 3 numbers and then returns the nth element...
Solve the programming task below in a Python markdown code block. #### Task: Your job here is to implement a function `factors`, which takes a number `n`, and outputs an array of arrays comprised of two parts, `sq` and `cb`. The part `sq` will contain all the numbers that, when squared, yield a number which is a fact...
Solve the programming task below in a Python markdown code block. Does \sqrt{a} + \sqrt{b} < \sqrt{c} hold? Constraints * 1 \leq a, b, c \leq 10^9 * All values in input are integers. Input Input is given from Standard Input in the following format: a \ b \ c Output If \sqrt{a} + \sqrt{b} < \sqrt{c}, print `Ye...
Solve the programming task below in a Python markdown code block. You have a Petri dish with bacteria and you are preparing to dive into the harsh micro-world. But, unfortunately, you don't have any microscope nearby, so you can't watch them. You know that you have $n$ bacteria in the Petri dish and size of the $i$-t...
Solve the programming task below in a Python markdown code block. Your friend has been out shopping for puppies (what a time to be alive!)... He arrives back with multiple dogs, and you simply do not know how to respond! By repairing the function provided, you will find out exactly how you should respond, depending o...
Solve the programming task below in a Python markdown code block. You are responsible for installing a gas pipeline along a road. Let's consider the road (for simplicity) as a segment $[0, n]$ on $OX$ axis. The road can have several crossroads, but for simplicity, we'll denote each crossroad as an interval $(x, x + 1)...
Solve the programming task below in a Python markdown code block. Polycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all over the world can try his level. All levels in this game have two stats to them: the number of plays and the number of clears....
Solve the programming task below in a Python markdown code block. Doubly linked list is one of the fundamental data structures. A doubly linked list is a sequence of elements, each containing information about the previous and the next elements of the list. In this problem all lists have linear structure. I.e. each el...
Solve the programming task below in a Python markdown code block. Let's call the following process a transformation of a sequence of length $n$. If the sequence is empty, the process ends. Otherwise, append the greatest common divisor (GCD) of all the elements of the sequence to the result and remove one arbitrary el...
Solve the programming task below in a Python markdown code block. We have a point $A$ with coordinate $x = n$ on $OX$-axis. We'd like to find an integer point $B$ (also on $OX$-axis), such that the absolute difference between the distance from $O$ to $B$ and the distance from $A$ to $B$ is equal to $k$. [Image] The de...
Solve the programming task below in a Python markdown code block. G: Working Kou decided to do the same number of jobs every day for the next $ N $. $ A_i $ jobs are added on the $ i $ day of the $ N $ day. Mr. Kou has no work to do now, and he doesn't have to finish all the work by the $ N $ day. How many jobs ca...
Solve the programming task below in a Python markdown code block. Everyone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup regulations: * the final tournam...
Solve the programming task below in a Python markdown code block. In Group C of the 3rd year, we decided to use the "class flag" used at the sports festival on November 10, 2007 at future class reunions. So, in order to decide which students to keep the "class flag", I decided to play the following game using a large ...