question
large_stringlengths
265
13.2k
Solve the programming task below in a Python markdown code block. # Task A ciphertext alphabet is obtained from the plaintext alphabet by means of rearranging some characters. For example "bacdef...xyz" will be a simple ciphertext alphabet where a and b are rearranged. A substitution cipher is a method of encoding ...
Solve the programming task below in a Python markdown code block. Alice and Borys are playing tennis. A tennis match consists of games. In each game, one of the players is serving and the other one is receiving. Players serve in turns: after a game where Alice is serving follows a game where Borys is serving, and vi...
Solve the programming task below in a Python markdown code block. Let's call a sequence of integers $x_1, x_2, \dots, x_k$ MEX-correct if for all $i$ ($1 \le i \le k$) $|x_i - \operatorname{MEX}(x_1, x_2, \dots, x_i)| \le 1$ holds. Where $\operatorname{MEX}(x_1, \dots, x_k)$ is the minimum non-negative integer that do...
Solve the programming task below in a Python markdown code block. Given the string S and m queries. The i-th query is given by the two strings xi and yi. For each query, answer the longest substring of the string S, starting with xi and ending with yi. For the string S, | S | represents the length of S. Also, the fa...
Solve the programming task below in a Python markdown code block. You are given a chess board with $n$ rows and $n$ columns. Initially all cells of the board are empty, and you have to put a white or a black knight into each cell of the board. A knight is a chess piece that can attack a piece in cell ($x_2$, $y_2$) f...
Solve the programming task below in a Python markdown code block. Round any given number to the closest 0.5 step I.E. ``` solution(4.2) = 4 solution(4.3) = 4.5 solution(4.6) = 4.5 solution(4.8) = 5 ``` Round **up** if number is as close to previous and next 0.5 steps. ``` solution(4.75) == 5 ``` Write your solutio...
Solve the programming task below in a Python markdown code block. This is a simplified version of the problem B2. Perhaps you should read the problem B2 before you start solving B1. Paul and Mary have a favorite string $s$ which consists of lowercase letters of the Latin alphabet. They want to paint it using pieces o...
Solve the programming task below in a Python markdown code block. You will be given a string. You need to return an array of three strings by gradually pulling apart the string. You should repeat the following steps until the string length is 1: a) remove the final character from the original string, add to soluti...
Solve the programming task below in a Python markdown code block. Let us consider sets of positive integers less than or equal to n. Note that all elements of a set are different. Also note that the order of elements doesn't matter, that is, both {3, 5, 9} and {5, 9, 3} mean the same set. Specifying the number of set...
Solve the programming task below in a Python markdown code block. Is every value in the array an array? This should only test the second array dimension of the array. The values of the nested arrays don't have to be arrays. Examples: ```python [[1],[2]] => true ['1','2'] => false [{1:1},{2:2}] => false ``` Write ...
Solve the programming task below in a Python markdown code block. Vasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only likes a single integer $p$ (which may be positive, negative, or zero). To combine their tastes, they invented $p$-binary number...
Solve the programming task below in a Python markdown code block. There are N towns located in a line, conveniently numbered 1 through N. Takahashi the merchant is going on a travel from town 1 to town N, buying and selling apples. Takahashi will begin the travel at town 1, with no apple in his possession. The actions...
Solve the programming task below in a Python markdown code block. Haruna is a high school student. She must remember the seating arrangements in her class because she is a class president. It is too difficult task to remember if there are so many students. That is the reason why seating rearrangement is depress task ...
Solve the programming task below in a Python markdown code block. A bracket sequence is a string, containing only characters "(", ")", "[" and "]". A correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original cha...
Solve the programming task below in a Python markdown code block. Not long ago Billy came across such a problem, where there were given three natural numbers A, B and C from the range [1, N], and it was asked to check whether the equation AB = C is correct. Recently Billy studied the concept of a digital root of a num...
Solve the programming task below in a Python markdown code block. You can perfectly predict the price of a certain stock for the next N days. You would like to profit on this knowledge, but only want to transact one share of stock per day. That is, each day you will either buy one share, sell one share, or do nothing....
Solve the programming task below in a Python markdown code block. A monster is attacking the Cyberland! Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (HP), offensive power (ATK) and defensive power (DEF). During the battle, every second the monster's HP d...
Solve the programming task below in a Python markdown code block. # Base64 Numeric Translator Our standard numbering system is (Base 10). That includes 0 through 9. Binary is (Base 2), only 1’s and 0’s. And Hexadecimal is (Base 16) (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F). A hexadecimal “F” has a (Base 10) v...
Solve the programming task below in a Python markdown code block. Petya's friends made him a birthday present — a bracket sequence. Petya was quite disappointed with his gift, because he dreamed of correct bracket sequence, yet he told his friends nothing about his dreams and decided to fix present himself. To make ...
Solve the programming task below in a Python markdown code block. An array of integers $p_1, p_2, \dots, p_n$ is called a permutation if it contains each number from $1$ to $n$ exactly once. For example, the following arrays are permutations: $[3, 1, 2]$, $[1]$, $[1, 2, 3, 4, 5]$ and $[4, 3, 1, 2]$. The following arra...
Solve the programming task below in a Python markdown code block. User ainta has a permutation p_1, p_2, ..., p_{n}. As the New Year is coming, he wants to make his permutation as pretty as possible. Permutation a_1, a_2, ..., a_{n} is prettier than permutation b_1, b_2, ..., b_{n}, if and only if there exists an int...
Solve the programming task below in a Python markdown code block. You are given a string $s$ consisting of $n$ lowercase Latin letters. $n$ is even. For each position $i$ ($1 \le i \le n$) in string $s$ you are required to change the letter on this position either to the previous letter in alphabetic order or to the ...
Solve the programming task below in a Python markdown code block. For the multiset of positive integers s=\\{s_1,s_2,...,s_k\}, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of s as follow: * \gcd(s) is the maximum positive integer x, such that all integers in s are divisible on x. * lc...
Solve the programming task below in a Python markdown code block. Natasha is going to fly to Mars. She needs to build a rocket, which consists of several stages in some order. Each of the stages is defined by a lowercase Latin letter. This way, the rocket can be described by the string — concatenation of letters, whic...
Solve the programming task below in a Python markdown code block. We have a tree with N vertices and N-1 edges, respectively numbered 1, 2,\cdots, N and 1, 2, \cdots, N-1. Edge i connects Vertex u_i and v_i. For integers L, R (1 \leq L \leq R \leq N), let us define a function f(L, R) as follows: - Let S be the set of...
Solve the programming task below in a Python markdown code block. Takahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i. He is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditi...
Solve the programming task below in a Python markdown code block. You will be given an array that contains two strings. Your job is to create a function that will take those two strings and transpose them, so that the strings go from top to bottom instead of left to right. A few things to note: 1. There should be one...
Solve the programming task below in a Python markdown code block. A country decides to build a palace. In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius. There are N places proposed for the place. The elevation of Place i is H_i meters. Among them, Prin...
Solve the programming task below in a Python markdown code block. One day n friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together. Simply speaking, the process of taking photos can be described as follows. On the photo, each photographed friend occupie...
Solve the programming task below in a Python markdown code block. Kattapa, as you all know was one of the greatest warriors of his time. The kingdom of Maahishmati had never lost a battle under him (as army-chief), and the reason for that was their really powerful army, also called as Mahasena. Kattapa was known to b...
Solve the programming task below in a Python markdown code block. Same as [the original](https://www.codewars.com/kata/simple-fun-number-258-is-divisible-by-6) (same rules, really, go there for example and I strongly recommend completing it first), but with more than one asterisk (but always at least one). For exampl...
Solve the programming task below in a Python markdown code block. Neko is playing with his toys on the backyard of Aki's house. Aki decided to play a prank on him, by secretly putting catnip into Neko's toys. Unfortunately, he went overboard and put an entire bag of catnip into the toys... It took Neko an entire day ...
Solve the programming task below in a Python markdown code block. In this Kata, we will calculate the **minumum positive number that is not a possible sum** from a list of positive integers. ``` solve([1,2,8,7]) = 4 => we can get 1, 2, 3 (from 1+2), but we cannot get 4. 4 is the minimum number not possible from the ...
Solve the programming task below in a Python markdown code block. You need count how many valleys you will pass. Start is always from zero level. Every time you go down below 0 level counts as an entry of a valley, and as you go up to 0 level from valley counts as an exit of a valley. One passed valley is equal one...
Solve the programming task below in a Python markdown code block. Simon has a prime number x and an array of non-negative integers a_1, a_2, ..., a_{n}. Simon loves fractions very much. Today he wrote out number $\frac{1}{x^{a} 1} + \frac{1}{x^{a_{2}}} + \ldots + \frac{1}{x^{a_{n}}}$ on a piece of paper. After Simon ...
Solve the programming task below in a Python markdown code block. Like any unknown mathematician, Yuri has favourite numbers: $A$, $B$, $C$, and $D$, where $A \leq B \leq C \leq D$. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides $x$, $y$, and $z$ exist, such that $A...
Solve the programming task below in a Python markdown code block. You are playing a variation of game 2048. Initially you have a multiset $s$ of $n$ integers. Every integer in this multiset is a power of two. You may perform any number (possibly, zero) operations with this multiset. During each operation you choose...
Solve the programming task below in a Python markdown code block. Create a function that checks if a number `n` is divisible by two numbers `x` **AND** `y`. All inputs are positive, non-zero digits. ```JS Examples: 1) n = 3, x = 1, y = 3 => true because 3 is divisible by 1 and 3 2) n = 12, x = 2, y = 6 => true...
Solve the programming task below in a Python markdown code block. Write a program which calculates the area and perimeter of a given rectangle. Constraints * 1 ≤ a, b ≤ 100 Input The length a and breadth b of the rectangle are given in a line separated by a single space. Output Print the area and perimeter of th...
Solve the programming task below in a Python markdown code block. My friend John and I are members of the "Fat to Fit Club (FFC)". John is worried because each month a list with the weights of members is published and each month he is the last on the list which means he is the heaviest. I am the one who establishes ...
Solve the programming task below in a Python markdown code block. You are given two positive integers $a$ and $b$. In one move, you can change $a$ in the following way: Choose any positive odd integer $x$ ($x > 0$) and replace $a$ with $a+x$; choose any positive even integer $y$ ($y > 0$) and replace $a$ with $a-...
Solve the programming task below in a Python markdown code block. Vlad went into his appartment house entrance, now he is on the $1$-th floor. He was going to call the elevator to go up to his apartment. There are only two elevators in his house. Vlad knows for sure that: the first elevator is currently on the floor...
Solve the programming task below in a Python markdown code block. We have a grid with 3 rows and N columns. The cell at the i-th row and j-th column is denoted (i, j). Initially, each cell (i, j) contains the integer i+3j-3. <image> A grid with N=5 columns Snuke can perform the following operation any number of tim...
Solve the programming task below in a Python markdown code block. You are given a rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (x, y) (0 ≤ x ≤ n, 0 ≤ y ≤ m). Your task is to find a maximum sub-rectangle...
Solve the programming task below in a Python markdown code block. Write a function that checks if all the letters in the second string are present in the first one at least once, regardless of how many times they appear: ``` ["ab", "aaa"] => true ["trances", "nectar"] => true ["compadres", "DRAPES"] => true...
Solve the programming task below in a Python markdown code block. La Confiserie d'ABC sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughn...
Solve the programming task below in a Python markdown code block. Innovation technologies are on a victorious march around the planet. They integrate into all spheres of human activity! A restaurant called "Dijkstra's Place" has started thinking about optimizing the booking system. There are n booking requests rece...
Solve the programming task below in a Python markdown code block. You are given a tree with $n$ vertices. You are allowed to modify the structure of the tree through the following multi-step operation: Choose three vertices $a$, $b$, and $c$ such that $b$ is adjacent to both $a$ and $c$. For every vertex $d$ other t...
Solve the programming task below in a Python markdown code block. Read problems statements in Mandarin Chinese and Russian Chef is going to participate in a new quiz show: "Who dares to be a millionaire?" According to the rules of the game, contestants must answer N questions. The quiz being famous for its difficu...
Solve the programming task below in a Python markdown code block. Unary is a minimalistic Brainfuck dialect in which programs are written using only one token. Brainfuck programs use 8 commands: "+", "-", "[", "]", "<", ">", "." and "," (their meaning is not important for the purposes of this problem). Unary program...
Solve the programming task below in a Python markdown code block. ZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it consists of n towns numbered from 1 to n. There are n directed roads in the Udayland. i-th of them goes from town i to some other town a_{i} (a_{i} ≠ i)....
Solve the programming task below in a Python markdown code block. Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell $(x,y)$ of an infinite grid. According to Alice's theory, cat needs to move: exactly $a$ steps left: from $(...
Solve the programming task below in a Python markdown code block. Bizon the Champion isn't just attentive, he also is very hardworking. Bizon the Champion decided to paint his old fence his favorite color, orange. The fence is represented as n vertical planks, put in a row. Adjacent planks have no gap between them. T...
Solve the programming task below in a Python markdown code block. The Chef likes to stay in touch with his staff. So, the Chef, the head server, and the sous-chef all carry two-way transceivers so they can stay in constant contact. Of course, these transceivers have a limited range so if two are too far apart, they ca...
Solve the programming task below in a Python markdown code block. A [Word Square](https://en.wikipedia.org/wiki/Word_square) is a set of words written out in a square grid, such that the same words can be read both horizontally and vertically. The number of words, equal to the number of letters in each word, is known ...
Solve the programming task below in a Python markdown code block. Write a function that will check whether the permutation of an input string is a palindrome. Bonus points for a solution that is efficient and/or that uses _only_ built-in language functions. Deem yourself **brilliant** if you can come up with a version...
Solve the programming task below in a Python markdown code block. Example Input 3 1 3 3 2 1 2 1 3 Output 5 Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
Solve the programming task below in a Python markdown code block. Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n - 1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the tree is the city number 1. Thus...
Solve the programming task below in a Python markdown code block. **Debug** a function called calculate that takes 3 values. The first and third values are numbers. The second value is a character. If the character is "+" , "-", "\*", or "/", the function will return the result of the corresponding mathematical functi...
Solve the programming task below in a Python markdown code block. Let's call beauty of an array b_1, b_2, …, b_n (n > 1) — min_{1 ≤ i < j ≤ n} |b_i - b_j|. You're given an array a_1, a_2, … a_n and a number k. Calculate the sum of beauty over all subsequences of the array of length exactly k. As this number can be ve...
Solve the programming task below in a Python markdown code block. Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules. The game is played on the following field. <image> Players are making moves by t...
Solve the programming task below in a Python markdown code block. A sequence $a = [a_1, a_2, \ldots, a_l]$ of length $l$ has an ascent if there exists a pair of indices $(i, j)$ such that $1 \le i < j \le l$ and $a_i < a_j$. For example, the sequence $[0, 2, 0, 2, 0]$ has an ascent because of the pair $(1, 4)$, but th...
Solve the programming task below in a Python markdown code block. DropCaps means that the first letter of the starting word of the paragraph should be in caps and the remaining lowercase, just like you see in the newspaper. But for a change, let's do that for each and every word of the given String. Your task is to ...
Solve the programming task below in a Python markdown code block. Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides, he can take several exa...
Solve the programming task below in a Python markdown code block. There is a frequency operation in the conversion operation of a finite number sequence. The conversion result of the sequence $ S = \\ {s_1, s_2, ... s_n \\} $ is a sequence of the same length. If the result is $ C = \\ {c_1, c_2, ..., c_n \\} $, then $...
Solve the programming task below in a Python markdown code block. Arseniy is already grown-up and independent. His mother decided to leave him alone for m days and left on a vacation. She have prepared a lot of food, left some money and washed all Arseniy's clothes. Ten minutes before her leave she realized that it ...
Solve the programming task below in a Python markdown code block. Read problems statements in English, Mandarin Chinese and Russian as well. Sherlock is stuck. There is a N X N grid in which some cells are empty (denoted by ‘.’), while some cells have rocks in them (denoted by ‘#’). Sherlock is on the South of the g...
Solve the programming task below in a Python markdown code block. You are given an integer n. You have to apply m operations to it. In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the operation once. ...
Solve the programming task below in a Python markdown code block. There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise. Constr...
Solve the programming task below in a Python markdown code block. A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of ...
Solve the programming task below in a Python markdown code block. Your company was appointed to lay new asphalt on the highway of length $n$. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or skip repairing. Skipping the repair is necessary because...
Solve the programming task below in a Python markdown code block. Monocarp wants to draw four line segments on a sheet of paper. He wants the $i$-th segment to have its length equal to $a_i$ ($1 \le i \le 4$). These segments can intersect with each other, and each segment should be either horizontal or vertical. Mono...
Solve the programming task below in a Python markdown code block. Takahashi is meeting up with Aoki. They have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now. Takahashi will leave his house now and go straight to the place at a speed of S meters per minute. Will he arrive...
Solve the programming task below in a Python markdown code block. ## Your Story "A *piano* in the home meant something." - *Fried Green Tomatoes at the Whistle Stop Cafe* You've just realized a childhood dream by getting a beautiful and beautiful-sounding upright piano from a friend who was leaving the country. You i...
Solve the programming task below in a Python markdown code block. Given a string and an array of integers representing indices, capitalize all letters at the given indices. For example: * `capitalize("abcdef",[1,2,5]) = "aBCdeF"` * `capitalize("abcdef",[1,2,5,100]) = "aBCdeF"`. There is no index 100. The input wil...
Solve the programming task below in a Python markdown code block. Ilya is a very clever lion, he lives in an unusual city ZooVille. In this city all the animals have their rights and obligations. Moreover, they even have their own bank accounts. The state of a bank account is an integer. The state of a bank account ca...
Solve the programming task below in a Python markdown code block. Addition is easy to calculate by hand, but if some numbers are missing, is it easy to fill in the missing numbers? For example, in the following long division, if there is a condition that the numbers 1 to 9 appear only once, how many numbers will fit i...
Solve the programming task below in a Python markdown code block. Example Input 3 3 1 2 4 1 2 2 3 3 1 Output IMPOSSIBLE Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters.
Solve the programming task below in a Python markdown code block. There are $n$ computers in a row, all originally off, and Phoenix wants to turn all of them on. He will manually turn on computers one at a time. At any point, if computer $i-1$ and computer $i+1$ are both on, computer $i$ $(2 \le i \le n-1)$ will turn ...
Solve the programming task below in a Python markdown code block. You are given a tree with N vertices. Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices. The i-th edge (1≤i≤N-1) connects Vertices a_i and b_i, and has a length o...
Solve the programming task below in a Python markdown code block. Japan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gakuen High School as baseball became more popular. In this tournament, a round-robin league match will be held and the ranking...
Solve the programming task below in a Python markdown code block. Johnny drives a truck and must deliver a package from his hometown to the district center. His hometown is located at point 0 on a number line, and the district center is located at the point d. Johnny's truck has a gas tank that holds exactly n liters...
Solve the programming task below in a Python markdown code block. Fast Forwarding Mr. Anderson frequently rents video tapes of his favorite classic films. Watching the films so many times, he has learned the precise start times of his favorite scenes in all such films. He now wants to find how to wind the tape to wat...
Solve the programming task below in a Python markdown code block. When Serezha was three years old, he was given a set of cards with letters for his birthday. They were arranged into words in the way which formed the boy's mother favorite number in binary notation. Serezha started playing with them immediately and shu...
Solve the programming task below in a Python markdown code block. You are given a sequence (P_1,P_2,...,P_N) which is a permutation of the integers from 1 through N. You would like to sort this sequence in ascending order by repeating the following operation: * Choose an element in the sequence and move it to the beg...
Solve the programming task below in a Python markdown code block. On a chessboard with a width of $n$ and a height of $n$, rows are numbered from bottom to top from $1$ to $n$, columns are numbered from left to right from $1$ to $n$. Therefore, for each cell of the chessboard, you can assign the coordinates $(r,c)$, w...
Solve the programming task below in a Python markdown code block. Knights' tournaments were quite popular in the Middle Ages. A lot of boys were dreaming of becoming a knight, while a lot of girls were dreaming of marrying a knight on a white horse. In this problem we consider one of these tournaments. Let's us cal...
Solve the programming task below in a Python markdown code block. A motorcade of n trucks, driving from city «Z» to city «З», has approached a tunnel, known as Tunnel of Horror. Among truck drivers there were rumours about monster DravDe, who hunts for drivers in that tunnel. Some drivers fear to go first, others - to...
Solve the programming task below in a Python markdown code block. # Task Sorting is one of the most basic computational devices used in Computer Science. Given a sequence (length ≤ 1000) of 3 different key values (7, 8, 9), your task is to find the minimum number of exchange operations necessary to make the seque...
Solve the programming task below in a Python markdown code block. Write a program which reads a $ n \times m$ matrix $A$ and a $m \times 1$ vector $b$, and prints their product $Ab$. A column vector with m elements is represented by the following equation. \\[ b = \left( \begin{array}{c} b_1 \\\ b_2 \\\ : \\\ b_m \\...
Solve the programming task below in a Python markdown code block. Bitwise exclusive OR (or bitwise addition modulo two) is a binary operation which is equivalent to applying logical exclusive OR to every pair of bits located on the same positions in binary notation of operands. In other words, a binary digit of the re...
Solve the programming task below in a Python markdown code block. Let's suppose you have an array a, a stack s (initially empty) and an array b (also initially empty). You may perform the following operations until both a and s are empty: Take the first element of a, push it into s and remove it from a (if a is no...
Solve the programming task below in a Python markdown code block. Recall that string $a$ is a subsequence of a string $b$ if $a$ can be obtained from $b$ by deletion of several (possibly zero or all) characters. For example, for the string $a$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wo...
Solve the programming task below in a Python markdown code block. Students of group 199 have written their lectures dismally. Now an exam on Mathematical Analysis is approaching and something has to be done asap (that is, quickly). Let's number the students of the group from 1 to n. Each student i (1 ≤ i ≤ n) has a be...
Solve the programming task below in a Python markdown code block. You are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The points are numbered from 1 to n, in clo...
Solve the programming task below in a Python markdown code block. # Esolang Interpreters #2 - Custom Smallfuck Interpreter ## About this Kata Series "Esolang Interpreters" is a Kata Series that originally began as three separate, independent esolang interpreter Kata authored by [@donaldsebleung](http://codewars.com/...
Solve the programming task below in a Python markdown code block. You are given a string S of length N. Among its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they a...
Solve the programming task below in a Python markdown code block. There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number. Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i a...
Solve the programming task below in a Python markdown code block. The only difference between easy and hard versions is the maximum value of $n$. You are given a positive integer number $n$. You really love good numbers so you want to find the smallest good number greater than or equal to $n$. The positive integer i...
Solve the programming task below in a Python markdown code block. Several days ago you bought a new house and now you are planning to start a renovation. Since winters in your region can be very cold you need to decide how to heat rooms in your house. Your house has $n$ rooms. In the $i$-th room you can install at mo...