question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Monocarp has been collecting rare magazines for quite a while, and now he has decided to sell them. He distributed the magazines between $n$ boxes, arranged in a row. The $i$-th box contains $a_i$ magazines. Some of the boxes are covered with lids, othe... |
Solve the programming task below in a Python markdown code block.
Analyzing the mistakes people make while typing search queries is a complex and an interesting work. As there is no guaranteed way to determine what the user originally meant by typing some query, we have to use different sorts of heuristics.
Polycarp ... |
Solve the programming task below in a Python markdown code block.
You are given integer n. You have to arrange numbers from 1 to 2n, using each of them exactly once, on the circle, so that the following condition would be satisfied:
For every n consecutive numbers on the circle write their sum on the blackboard. Then... |
Solve the programming task below in a Python markdown code block.
There is a city that can be represented as a square grid with corner points in $(0, 0)$ and $(10^6, 10^6)$.
The city has $n$ vertical and $m$ horizontal streets that goes across the whole city, i. e. the $i$-th vertical streets goes from $(x_i, 0)$ to ... |
Solve the programming task below in a Python markdown code block.
Everybody knows that opposites attract. That is the key principle of the "Perfect Matching" dating agency. The "Perfect Matching" matchmakers have classified each registered customer by his interests and assigned to the i-th client number ti ( - 10 β€ ti... |
Solve the programming task below in a Python markdown code block.
There is a blackboard on which all integers from -10^{18} through 10^{18} are written, each of them appearing once. Takahashi will repeat the following sequence of operations any number of times he likes, possibly zero:
* Choose an integer between 1 an... |
Solve the programming task below in a Python markdown code block.
Given are integers N and K.
How many quadruples of integers (a,b,c,d) satisfy both of the following conditions?
- 1 \leq a,b,c,d \leq N
- a+b-c-d=K
-----Constraints-----
- 1 \leq N \leq 10^5
- -2(N-1) \leq K \leq 2(N-1)
- All numbers in input are ... |
Solve the programming task below in a Python markdown code block.
In this Kata, you will be given an array of integers and your task is to return the number of arithmetic progressions of size `3` that are possible from that list. In each progression, the differences between the elements must be the same.
```
[1, 2, 3... |
Solve the programming task below in a Python markdown code block.
Find the minimum number with the given sum of digits $s$ such that all digits in it are distinct (i.e. all digits are unique).
For example, if $s=20$, then the answer is $389$. This is the minimum number in which all digits are different and the sum of... |
Solve the programming task below in a Python markdown code block.
In Summer Informatics School, if a student doesn't behave well, teachers make a hole in his badge. And today one of the teachers caught a group of $n$ students doing yet another trick.
Let's assume that all these students are numbered from $1$ to $n$.... |
Solve the programming task below in a Python markdown code block.
# Task
After a long night (work, play, study) you find yourself sleeping on a bench in a park. As you wake up and try to figure out what happened you start counting trees.
You notice there are different tree sizes but there's always one size which is u... |
Solve the programming task below in a Python markdown code block.
The only difference between easy and hard versions is constraints.
A session has begun at Beland State University. Many students are taking exams.
Polygraph Poligrafovich is going to examine a group of $n$ students. Students will take the exam one-by-... |
Solve the programming task below in a Python markdown code block.
Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the vertical line... |
Solve the programming task below in a Python markdown code block.
Being tired of participating in too many Codeforces rounds, Gildong decided to take some rest in a park. He sat down on a bench, and soon he found two rabbits hopping around. One of the rabbits was taller than the other.
He noticed that the two rabbits... |
Solve the programming task below in a Python markdown code block.
There are some rabbits in Singapore Zoo. To feed them, Zookeeper bought $n$ carrots with lengths $a_1, a_2, a_3, \ldots, a_n$. However, rabbits are very fertile and multiply very quickly. Zookeeper now has $k$ rabbits and does not have enough carrots to... |
Solve the programming task below in a Python markdown code block.
Consider all binary strings of length $m$ ($1 \le m \le 60$). A binary string is a string that consists of the characters 0 and 1 only. For example, 0110 is a binary string, and 012aba is not. Obviously, there are exactly $2^m$ such strings in total.
T... |
Solve the programming task below in a Python markdown code block.
In some countries of former Soviet Union there was a belief about lucky tickets. A transport ticket of any sort was believed to posess luck if sum of digits on the left half of its number was equal to the sum of digits on the right half. Here are exampl... |
Solve the programming task below in a Python markdown code block.
In the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this reason it was excluded from the contest. This mistake have been fixed and the current given problem statement and model solut... |
Solve the programming task below in a Python markdown code block.
For given $n$ segments which are parallel to X-axis or Y-axis, find the number of intersections of them.
Constraints
* $1 \leq n \leq 100,000$
* $ -1,000,000,000 \leq x_1, y_1, x_2, y_2 \leq 1,000,000,000$
* Two parallel segments never overlap or touc... |
Solve the programming task below in a Python markdown code block.
You are given a prime number $p$, $n$ integers $a_1, a_2, \ldots, a_n$, and an integer $k$.
Find the number of pairs of indexes $(i, j)$ ($1 \le i < j \le n$) for which $(a_i + a_j)(a_i^2 + a_j^2) \equiv k \bmod p$.
-----Input-----
The first line c... |
Solve the programming task below in a Python markdown code block.
We have two desks: A and B. Desk A has a vertical stack of N books on it, and Desk B similarly has M books on it.
It takes us A_i minutes to read the i-th book from the top on Desk A (1 \leq i \leq N), and B_i minutes to read the i-th book from the top ... |
Solve the programming task below in a Python markdown code block.
A soldier wants to buy w bananas in the shop. He has to pay k dollars for the first banana, 2k dollars for the second one and so on (in other words, he has to pay iΒ·k dollars for the i-th banana).
He has n dollars. How many dollars does he have to bor... |
Solve the programming task below in a Python markdown code block.
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his office to change every day. That's why he ordered bo... |
Solve the programming task below in a Python markdown code block.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Ciel's cards is... |
Solve the programming task below in a Python markdown code block.
# Task
Some children are playing rope skipping game. Children skip the rope at roughly the same speed: `once per second`. If the child fails during the jump, he needs to tidy up the rope and continue. This will take `3 seconds`.
You are given an array ... |
Solve the programming task below in a Python markdown code block.
In Russia regular bus tickets usually consist of 6 digits. The ticket is called lucky when the sum of the first three digits equals to the sum of the last three digits. Write a function to find out whether the ticket is lucky or not. Return true if so, ... |
Solve the programming task below in a Python markdown code block.
While dad was at work, a little girl Tanya decided to play with dad's password to his secret database. Dad's password is a string consisting of n + 2 characters. She has written all the possible n three-letter continuous substrings of the password on pi... |
Solve the programming task below in a Python markdown code block.
You are given two strings $s$ and $t$. In a single move, you can choose any of two strings and delete the first (that is, the leftmost) character. After a move, the length of the string decreases by $1$. You can't choose a string if it is empty.
For ex... |
Solve the programming task below in a Python markdown code block.
The only difference between easy and hard versions is the size of the input.
You are given a string $s$ consisting of $n$ characters, each character is 'R', 'G' or 'B'.
You are also given an integer $k$. Your task is to change the minimum number of ch... |
Solve the programming task below in a Python markdown code block.
You are given an array $a$ consisting of $500000$ integers (numbered from $1$ to $500000$). Initially all elements of $a$ are zero.
You have to process two types of queries to this array: $1$ $x$ $y$Β β increase $a_x$ by $y$; $2$ $x$ $y$Β β compute $\s... |
Solve the programming task below in a Python markdown code block.
A ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \leq i \leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.
How many times will the ball make a bounce where the coordi... |
Solve the programming task below in a Python markdown code block.
There is a building consisting of $10~000$ apartments numbered from $1$ to $10~000$, inclusive.
Call an apartment boring, if its number consists of the same digit. Examples of boring apartments are $11, 2, 777, 9999$ and so on.
Our character is a trou... |
Solve the programming task below in a Python markdown code block.
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disappeared while writing the string. That's because this ... |
Solve the programming task below in a Python markdown code block.
Create a function that interprets code in the esoteric language **Poohbear**
## The Language
Poohbear is a stack-based language largely inspired by Brainfuck. It has a maximum integer value of 255, and 30,000 cells. The original intention of Poohbear ... |
Solve the programming task below in a Python markdown code block.
If this challenge is too easy for you, check out:
https://www.codewars.com/kata/5cc89c182777b00001b3e6a2
___
Upside-Down Pyramid Addition is the process of taking a list of numbers and consecutively adding them together until you reach one number.
W... |
Solve the programming task below in a Python markdown code block.
ATM machines allow 4 or 6 digit PIN codes and PIN codes cannot contain anything but **exactly** 4 digits or exactly 6 digits.
If the function is passed a valid PIN string, return `true`, else return `false`.
## Examples
```
"1234" --> true
"12345... |
Solve the programming task below in a Python markdown code block.
In this Kata, you will be given an integer `n` and your task will be to return `the largest integer that is <= n and has the highest digit sum`.
For example:
```
solve(100) = 99. Digit Sum for 99 = 9 + 9 = 18. No other number <= 100 has a higher digit ... |
Solve the programming task below in a Python markdown code block.
Bertown is a city with $n$ buildings in a straight line.
The city's security service discovered that some buildings were mined. A map was compiled, which is a string of length $n$, where the $i$-th character is "1" if there is a mine under the building... |
Solve the programming task below in a Python markdown code block.
There are n beacons located at distinct positions on a number line. The i-th beacon has position a_{i} and power level b_{i}. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance b_... |
Solve the programming task below in a Python markdown code block.
Polycarp is playing a new computer game. This game has $n$ stones in a row. The stone on the position $i$ has integer power $a_i$. The powers of all stones are distinct.
Each turn Polycarp can destroy either stone on the first position or stone on the ... |
Solve the programming task below in a Python markdown code block.
Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale:
"Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to build a huge b... |
Solve the programming task below in a Python markdown code block.
There are N people living on a number line.
The i-th person lives at coordinate X_i.
You are going to hold a meeting that all N people have to attend.
The meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, ... |
Solve the programming task below in a Python markdown code block.
We have sticks numbered 1, \cdots, N. The length of Stick i (1 \leq i \leq N) is L_i.
In how many ways can we choose three of the sticks with different lengths that can form a triangle?
That is, find the number of triples of integers (i, j, k) (1 \leq i... |
Solve the programming task below in a Python markdown code block.
You are given four integers $n$, $c_0$, $c_1$ and $h$ and a binary string $s$ of length $n$.
A binary string is a string consisting of characters $0$ and $1$.
You can change any character of the string $s$ (the string should be still binary after the ... |
Solve the programming task below in a Python markdown code block.
You are given an array a of length n.
Let's define the eversion operation. Let x = a_n. Then array a is partitioned into two parts: left and right. The left part contains the elements of a that are not greater than x (β€ x). The right part contains the ... |
Solve the programming task below in a Python markdown code block.
You've got an array, consisting of n integers a_1, a_2, ..., a_{n}. Also, you've got m queries, the i-th query is described by two integers l_{i}, r_{i}. Numbers l_{i}, r_{i} define a subsegment of the original array, that is, the sequence of numbers a_... |
Solve the programming task below in a Python markdown code block.
Problem
Given the string S, which consists of lowercase letters and numbers. Follow the steps below to compress the length of string S.
1. Change the order of the characters in the character string to any order.
Example: "0ig3he12fz99"-> "efghiz012399... |
Solve the programming task below in a Python markdown code block.
Based on [this kata, Connect Four.](https://www.codewars.com/kata/connect-four-1)
In this kata we play a modified game of connect four. It's connect X, and there can be multiple players.
Write the function ```whoIsWinner(moves,connect,size)```.
```2 ... |
Solve the programming task below in a Python markdown code block.
Vasya owns three big integers β $a, l, r$. Let's define a partition of $x$ such a sequence of strings $s_1, s_2, \dots, s_k$ that $s_1 + s_2 + \dots + s_k = x$, where $+$ is a concatanation of strings. $s_i$ is the $i$-th element of the partition. For e... |
Solve the programming task below in a Python markdown code block.
Memory and his friend Lexa are competing to get higher score in one popular computer game. Memory starts with score a and Lexa starts with score b. In a single turn, both Memory and Lexa get some integer in the range [ - k;k] (i.e. one integer among - ... |
Solve the programming task below in a Python markdown code block.
Chef likes strings a lot but he likes palindromic strings more. Today, Chef has two strings A and B, each consisting of lower case alphabets.
Chef is eager to know whether it is possible to choose some non empty strings s1 and s2 where s1 is a substrin... |
Solve the programming task below in a Python markdown code block.
# Task
John was in math class and got bored, so he decided to fold some origami from a rectangular `a Γ b` sheet of paper (`a > b`). His first step is to make a square piece of paper from the initial rectangular piece of paper by folding the sheet along... |
Solve the programming task below in a Python markdown code block.
You are given a string S consisting of a,b and c. Find the number of strings that can be possibly obtained by repeatedly performing the following operation zero or more times, modulo 998244353:
- Choose an integer i such that 1\leq i\leq |S|-1 and the ... |
Solve the programming task below in a Python markdown code block.
problem
Given the sequence $ A $ of length $ N $. The $ i $ item in $ A $ is $ A_i $. You can do the following for this sequence:
* $ 1 \ leq i \ leq N --Choose the integer i that is 1 $. Swap the value of $ A_i $ with the value of $ A_ {i + 1} $.
... |
Solve the programming task below in a Python markdown code block.
Given a string of integers, return the number of odd-numbered substrings that can be formed.
For example, in the case of `"1341"`, they are `1, 1, 3, 13, 41, 341, 1341`, a total of `7` numbers.
`solve("1341") = 7`. See test cases for more examples.... |
Solve the programming task below in a Python markdown code block.
Amr doesn't like Maths as he finds it really boring, so he usually sleeps in Maths lectures. But one day the teacher suspected that Amr is sleeping and asked him a question to make sure he wasn't.
First he gave Amr two positive integers n and k. Then h... |
Solve the programming task below in a Python markdown code block.
There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered ... |
Solve the programming task below in a Python markdown code block.
There are n people taking dancing lessons. Every person is characterized by his/her dancing skill ai. At the beginning of the lesson they line up from left to right. While there is at least one couple of a boy and a girl in the line, the following proce... |
Solve the programming task below in a Python markdown code block.
You are given an undirected graph consisting of $n$ vertices. A number is written on each vertex; the number on vertex $i$ is $a_i$. Initially there are no edges in the graph.
You may add some edges to this graph, but you have to pay for them. The cost... |
Solve the programming task below in a Python markdown code block.
Nathan O. Davis has been running an electronic bulletin board system named JAG-channel. He is now having hard time to add a new feature there --- threaded view.
Like many other bulletin board systems, JAG-channel is thread-based. Here a thread (also ca... |
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.
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.
Problem
There are N villages. Each village is numbered from 1 to N. Due to the recent merger boom, several villages have been merged. Two or more merged villages will become one new city, and villages that are not merged with any village will remain vi... |
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
```
Read the inputs fr... |
Solve the programming task below in a Python markdown code block.
You are given an integer m.
Let M = 2^{m} - 1.
You are also given a set of n integers denoted as the set T. The integers will be provided in base 2 as n binary strings of length m.
A set of integers S is called "good" if the following hold. If $a \... |
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 are playing the following game with Joisino.
- Initially, you have a blank sheet of paper.
- Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process i... |
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.
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.
Ivan is playing a strange game.
He has a matrix a with n rows and m columns. Each element of the matrix is equal to either 0 or 1. Rows and columns are 1-indexed. Ivan can replace any number of ones in this matrix with zeroes. After that, his score in ... |
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.
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.
Fox Ciel starts to learn programming. The first task is drawing a fox! However, that turns out to be too hard for a beginner, so she decides to draw a snake instead.
A snake is a pattern on a n by m table. Denote c-th cell of r-th row as (r, c). The ta... |
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.
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.
We will define the median of a sequence b of length M, as follows:
- Let b' be the sequence obtained by sorting b in non-decreasing order. Then, the value of the (M / 2 + 1)-th element of b' is the median of b. Here, / is integer division, rounding dow... |
Solve the programming task below in a Python markdown code block.
Dawid has four bags of candies. The $i$-th of them contains $a_i$ candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in such a way that each friend receives the same amount of... |
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.
You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains m cells. Each cell either is free or is occupied by an obstacle. The starting cell is in the row r and column c. In one step you can m... |
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.
You've probably heard about the twelve labors of Heracles, but do you have any idea about the thirteenth? It is commonly assumed it took him a dozen years to complete the twelve feats, so on average, a year to accomplish every one of them. As time flows... |
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.
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.
You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number t of tables can be decorated if we know num... |
Solve the programming task below in a Python markdown code block.
There is a board with a grid consisting of n rows and m columns, the rows are numbered from 1 from top to bottom and the columns are numbered from 1 from left to right. In this grid we will denote the cell that lies on row number i and column number j a... |
Solve the programming task below in a Python markdown code block.
You are given two strings A and B representing essays of two students who are suspected cheaters. For any two strings C, D we define their similarity score S(C,D) as 4β
LCS(C,D) - |C| - |D|, where LCS(C,D) denotes the length of the Longest Common Subseq... |
Solve the programming task below in a Python markdown code block.
In a long narrow forest stretching east-west, there are N beasts. Below, we will call the point that is p meters from the west end Point p. The i-th beast from the west (1 β€ i β€ N) is at Point x_i, and can be sold for s_i yen (the currency of Japan) if ... |
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.
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.