question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code.
The company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set... |
Solve the programming task below in a Python markdown code block.
Bob is about to take a hot bath.
There are two taps to fill the bath: a hot water tap and a cold water tap. The cold water's temperature is t1, and the hot water's temperature is t2. The cold water tap can transmit any integer number of water units pe... |
Solve the programming task below in a Python markdown code block.
Arkady and his friends love playing checkers on an $n \times n$ field. The rows and the columns of the field are enumerated from $1$ to $n$.
The friends have recently won a championship, so Arkady wants to please them with some candies. Remembering an ... |
Solve the programming task below in a Python markdown code block.
You are given a rectangular matrix of size $n \times m$ consisting of integers from $1$ to $2 \cdot 10^5$.
In one move, you can: choose any element of the matrix and change its value to any integer between $1$ and $n \cdot m$, inclusive; take any col... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian.
Aditi recently discovered a new magic trick. First, she gives you an integer N and asks you to think an integer between 1 and N. Then she gives you a bundle of cards each having a sorted list ... |
Solve the programming task below in a Python markdown code block.
You are given an undirected connected weighted graph consisting of $n$ vertices and $m$ edges. Let's denote the length of the shortest path from vertex $1$ to vertex $i$ as $d_i$.
You have to erase some edges of the graph so that at most $k$ edges rem... |
Solve the programming task below in a Python markdown code block.
Peter likes to travel by train. He likes it so much that on the train he falls asleep.
Once in summer Peter was going by train from city A to city B, and as usual, was sleeping. Then he woke up, started to look through the window and noticed that ever... |
Solve the programming task below in a Python markdown code block.
A permutation of size n is an array of size n such that each integer from 1 to n occurs exactly once in this array. An inversion in a permutation p is a pair of indices (i, j) such that i > j and a_{i} < a_{j}. For example, a permutation [4, 1, 3, 2] co... |
Solve the programming task below in a Python markdown code block.
Dima is a beginner programmer. During his working process, he regularly has to repeat the following operation again and again: to remove every second element from the array. One day he has been bored with easy solutions of this problem, and he has come ... |
Solve the programming task below in a Python markdown code block.
A and B are preparing themselves for programming contests.
The University where A and B study is a set of rooms connected by corridors. Overall, the University has n rooms connected by n - 1 corridors so that you can get from any room to any other one ... |
Solve the programming task below in a Python markdown code block.
# How much is the fish! (- Scooter )
The ocean is full of colorful fishes. We as programmers want to know the hexadecimal value of these fishes.
## Task
Take all hexadecimal valid characters (a,b,c,d,e,f) of the given name and XOR them. Return the resu... |
Solve the programming task below in a Python markdown code block.
This is an easy version of the problem. The only difference between an easy and a hard version is in the number of queries.
Polycarp grew a tree from $n$ vertices. We remind you that a tree of $n$ vertices is an undirected connected graph of $n$ vertic... |
Solve the programming task below in a Python markdown code block.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer t_{i}. The bigger this value is, the better the friendship is. No two friend... |
Solve the programming task below in a Python markdown code block.
For a given sequence $A = \\{a_0, a_1, ... a_{n-1}\\}$, the number of pairs $(i, j)$ where $a_i > a_j$ and $i < j$, is called the number of inversions. The number of inversions is equal to the number of swaps of Bubble Sort defined in the following prog... |
Solve the programming task below in a Python markdown code block.
There are $n$ detachments on the surface, numbered from $1$ to $n$, the $i$-th detachment is placed in a point with coordinates $(x_i, y_i)$. All detachments are placed in different points.
Brimstone should visit each detachment at least once. You can ... |
Solve the programming task below in a Python markdown code block.
You are given an array $a$ consisting of $n$ integers $a_1, a_2, \dots, a_n$. You want to split it into exactly $k$ non-empty non-intersecting subsegments such that each subsegment has odd sum (i. e. for each subsegment, the sum of all elements that bel... |
Solve the programming task below in a Python markdown code block.
You've got an array a, consisting of n integers. The array elements are indexed from 1 to n. Let's determine a two step operation like that:
1. First we build by the array a an array s of partial sums, consisting of n elements. Element number i (1 ≤ ... |
Solve the programming task below in a Python markdown code block.
You've just entered a programming contest and have a chance to win a million dollars. This is the last question you have to solve, so your victory (and your vacation) depend on it. Can you guess the function just by looking at the test cases? There are ... |
Solve the programming task below in a Python markdown code block.
You will be given an array of strings. The words in the array should mesh together where one or more letters at the end of one word will have the same letters (in the same order) as the next word in the array. But, there are times when all the words won... |
Solve the programming task below in a Python markdown code block.
A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R.
Takahashi placed a mass of weight A... |
Solve the programming task below in a Python markdown code block.
Each evening Roma plays online poker on his favourite website. The rules of poker on this website are a bit strange: there are always two players in a hand, there are no bets, and the winner takes 1 virtual bourle from the loser.
Last evening Roma star... |
Solve the programming task below in a Python markdown code block.
Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.
The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and numb... |
Solve the programming task below in a Python markdown code block.
Gru has not been in the limelight for a long time and is, therefore, planning something particularly nefarious. Frustrated by his minions' incapability which has kept him away from the limelight, he has built a transmogrifier — a machine which mutates m... |
Solve the programming task below in a Python markdown code block.
Mr. A loves sweets, but recently his wife has told him to go on a diet. One day, when Mr. A went out from his home to the city hall, his wife recommended that he go by bicycle. There, Mr. A reluctantly went out on a bicycle, but Mr. A, who likes sweets,... |
Solve the programming task below in a Python markdown code block.
Given an array $a$ of length $n$, find another array, $b$, of length $n$ such that:
for each $i$ $(1 \le i \le n)$ $MEX(\{b_1$, $b_2$, $\ldots$, $b_i\})=a_i$.
The $MEX$ of a set of integers is the smallest non-negative integer that doesn't belong t... |
Solve the programming task below in a Python markdown code block.
Vlad has $n$ friends, for each of whom he wants to buy one gift for the New Year.
There are $m$ shops in the city, in each of which he can buy a gift for any of his friends. If the $j$-th friend ($1 \le j \le n$) receives a gift bought in the shop with... |
Solve the programming task below in a Python markdown code block.
An `non decreasing` number is one containing no two consecutive digits (left to right), whose the first is higer than the second. For example, 1235 is an non decreasing number, 1229 is too, but 123429 isn't.
Write a function that finds the number of no... |
Solve the programming task below in a Python markdown code block.
There is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. Master Heidi needs to select the Jedi Knights who will go on peacekeeping missions throughout the galaxy. It is well-known that ... |
Solve the programming task below in a Python markdown code block.
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subseq... |
Solve the programming task below in a Python markdown code block.
Fox Ciel is playing a game with numbers now.
Ciel has n positive integers: x_1, x_2, ..., x_{n}. She can do the following operation as many times as needed: select two different indexes i and j such that x_{i} > x_{j} hold, and then apply assignment x... |
Solve the programming task below in a Python markdown code block.
The magic sum of 3s is calculated on an array by summing up odd numbers which include the digit `3`. Write a function `magic_sum` which accepts an array of integers and returns the sum.
*Example:* `[3, 12, 5, 8, 30, 13]` results in `16` (`3` + `13`)
I... |
Solve the programming task below in a Python markdown code block.
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of h_{i} identical blocks. For clarification see picture for the first sample.
Limak will repeat the following ... |
Solve the programming task below in a Python markdown code block.
You are given an integer sequence $1, 2, \dots, n$. You have to divide it into two sets $A$ and $B$ in such a way that each element belongs to exactly one set and $|sum(A) - sum(B)|$ is minimum possible.
The value $|x|$ is the absolute value of $x$ and... |
Solve the programming task below in a Python markdown code block.
Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an elevator in one of its other hotels. The elevator is special — it starts on the top floor, can only move down, and has infinite capacity. Floor... |
Solve the programming task below in a Python markdown code block.
In the wake of the npm's `left-pad` debacle, you decide to write a new super padding method that superceds the functionality of `left-pad`. Your version will provide the same functionality, but will additionally add right, and justified padding of strin... |
Solve the programming task below in a Python markdown code block.
Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.
There are n boys and m girls among his friends. Let's number them from 0 to n - 1 and 0 ... |
Solve the programming task below in a Python markdown code block.
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k... |
Solve the programming task below in a Python markdown code block.
A long time ago (probably even in the first book), Nicholas Flamel, a great alchemist and the creator of the Philosopher's Stone, taught Harry Potter three useful spells. The first one allows you to convert a grams of sand into b grams of lead, the seco... |
Solve the programming task below in a Python markdown code block.
You are given sequences A and B consisting of non-negative integers.
The lengths of both A and B are N, and the sums of the elements in A and B are equal.
The i-th element in A is A_i, and the i-th element in B is B_i.
Tozan and Gezan repeats the follow... |
Solve the programming task below in a Python markdown code block.
Aoki is playing with a sequence of numbers a_{1}, a_{2}, ..., a_{N}. Every second, he performs the following operation :
* Choose a positive integer k. For each element of the sequence v, Aoki may choose to replace v with its remainder when divided by ... |
Solve the programming task below in a Python markdown code block.
Two players A and B have a list of $n$ integers each. They both want to maximize the subtraction between their score and their opponent's score.
In one turn, a player can either add to his score any element from his list (assuming his list is not empt... |
Solve the programming task below in a Python markdown code block.
There are n animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines him, gives prescriptions, appoints tests and may appoint extra examination. Doc knows all the forest animals perfectly well and therefore knows e... |
Solve the programming task below in a Python markdown code block.
Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya has two strings a and b o... |
Solve the programming task below in a Python markdown code block.
Vasya has a string $s$ of length $n$. He decides to make the following modification to the string: Pick an integer $k$, ($1 \leq k \leq n$). For $i$ from $1$ to $n-k+1$, reverse the substring $s[i:i+k-1]$ of $s$. For example, if string $s$ is qwer an... |
Solve the programming task below in a Python markdown code block.
Complete the function that takes a string as an input, and return a list of all the unpaired characters (i.e. they show up an odd number of times in the string), in the order they were encountered as an array.
In case of multiple appearances to choose... |
Solve the programming task below in a Python markdown code block.
The concept of "[smooth number](https://en.wikipedia.org/wiki/Smooth_number)" is applied to all those numbers whose prime factors are lesser than or equal to `7`: `60` is a smooth number (`2 * 2 * 3 * 5`), `111` is not (`3 * 37`).
More specifically, sm... |
Solve the programming task below in a Python markdown code block.
We guessed a permutation $p$ consisting of $n$ integers. The permutation of length $n$ is the array of length $n$ where each element from $1$ to $n$ appears exactly once. This permutation is a secret for you.
For each position $r$ from $2$ to $n$ we ch... |
Solve the programming task below in a Python markdown code block.
You have to create a function named reverseIt.
Write your function so that in the case a string or a number is passed in as the data , you will return the data in reverse order. If the data is any other type, return it as it is.
Examples of inputs an... |
Solve the programming task below in a Python markdown code block.
You have a multiset containing several integers. Initially, it contains $a_1$ elements equal to $1$, $a_2$ elements equal to $2$, ..., $a_n$ elements equal to $n$.
You may apply two types of operations: choose two integers $l$ and $r$ ($l \le r$), the... |
Solve the programming task below in a Python markdown code block.
You're given two arrays $a[1 \dots n]$ and $b[1 \dots n]$, both of the same length $n$.
In order to perform a push operation, you have to choose three integers $l, r, k$ satisfying $1 \le l \le r \le n$ and $k > 0$. Then, you will add $k$ to elements $... |
Solve the programming task below in a Python markdown code block.
You are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N). Your objective is to remove some of the elements in a so that a will be a good sequence.
Here, an sequence b is a good sequence when the following condition holds true... |
Solve the programming task below in a Python markdown code block.
Long ago, Vasily built a good fence at his country house. Vasily calls a fence good, if it is a series of n consecutively fastened vertical boards of centimeter width, the height of each in centimeters is a positive integer. The house owner remembers th... |
Solve the programming task below in a Python markdown code block.
Philip's just turned four and he wants to know how old he will be in various years in the future such as 2090 or 3044. His parents can't keep up calculating this so they've begged you to help them out by writing a programme that can answer Philip's endl... |
Solve the programming task below in a Python markdown code block.
You are given a string $s$, consisting of $n$ lowercase Latin letters.
A substring of string $s$ is a continuous segment of letters from $s$. For example, "defor" is a substring of "codeforces" and "fors" is not.
The length of the substring is the nu... |
Solve the programming task below in a Python markdown code block.
Not so long ago as a result of combat operations the main Berland place of interest — the magic clock — was damaged. The cannon's balls made several holes in the clock, that's why the residents are concerned about the repair. The magic clock can be repr... |
Solve the programming task below in a Python markdown code block.
There are N slimes lining up in a row. Initially, the i-th slime from the left has a size of a_i.
Taro is trying to combine all the slimes into a larger slime. He will perform the following operation repeatedly until there is only one slime:
* Choose ... |
Solve the programming task below in a Python markdown code block.
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each oth... |
Solve the programming task below in a Python markdown code block.
Everybody knows that the Berland citizens are keen on health, especially students. Berland students are so tough that all they drink is orange juice!
Yesterday one student, Vasya and his mates made some barbecue and they drank this healthy drink only. ... |
Solve the programming task below in a Python markdown code block.
You are given two arrays A and B, each of size n. The error, E, between these two arrays is defined $E = \sum_{i = 1}^{n}(a_{i} - b_{i})^{2}$. You have to perform exactly k_1 operations on array A and exactly k_2 operations on array B. In one operation,... |
Solve the programming task below in a Python markdown code block.
Write a simple function that takes polar coordinates (an angle in degrees and a radius) and returns the equivalent cartesian coordinates (rouded to 10 places).
```
For example:
coordinates(90,1)
=> (0.0, 1.0)
coordinates(45, 1)
=> (0.7071067812, 0.70... |
Solve the programming task below in a Python markdown code block.
A binary tree of n nodes is given. Nodes of the tree are numbered from 1 to n and the root is the node 1. Each node can have no child, only one left child, only one right child, or both children. For convenience, let's denote l_u and r_u as the left and... |
Solve the programming task below in a Python markdown code block.
Iahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a1, a2, ..., an in ascending order. He is bored of this so simple algorithm, so he invents his own graph. The graph (let's call it G) initially has n... |
Solve the programming task below in a Python markdown code block.
There is an infinitely large pond, which we consider as a number line.
In this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1.
On the lotus at coordinate i, an integer s_i is written.
You are standing on the lotus at coordin... |
Solve the programming task below in a Python markdown code block.
Vasya has n burles. One bottle of Ber-Cola costs a burles and one Bars bar costs b burles. He can buy any non-negative integer number of bottles of Ber-Cola and any non-negative integer number of Bars bars.
Find out if it's possible to buy some amount ... |
Solve the programming task below in a Python markdown code block.
I decided to do bowling as a recreation of the class. Create a program that inputs the pitching information for each participant and outputs the grade information in descending order of score. If there is a tie, output in ascending order of student ID n... |
Solve the programming task below in a Python markdown code block.
You are given positive integers N and M.
How many sequences a of length N consisting of positive integers satisfy a_1 \times a_2 \times ... \times a_N = M? Find the count modulo 10^9+7.
Here, two sequences a' and a'' are considered different when there ... |
Solve the programming task below in a Python markdown code block.
You are given a huge integer $a$ consisting of $n$ digits ($n$ is between $1$ and $3 \cdot 10^5$, inclusive). It may contain leading zeros.
You can swap two digits on adjacent (neighboring) positions if the swapping digits are of different parity (that... |
Solve the programming task below in a Python markdown code block.
В Берляндском государственном университете локальная сеть между серверами не всегда работает без ошибок. При передаче двух одинаковых сообщений подряд возможна ошибка, в результате которой эти два сообщения сливаются в одно. При таком слиянии конец перв... |
Solve the programming task below in a Python markdown code block.
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single st... |
Solve the programming task below in a Python markdown code block.
You have written N problems to hold programming contests. The i-th problem will have a score of P_i points if used in a contest.
With these problems, you would like to hold as many contests as possible under the following condition:
* A contest has th... |
Solve the programming task below in a Python markdown code block.
# RoboScript #2 - Implement the RS1 Specification
## Disclaimer
The story presented in this Kata Series is purely fictional; any resemblance to actual programming languages, products, organisations or people should be treated as purely coincidental.
... |
Solve the programming task below in a Python markdown code block.
There is a famous olympiad, which has more than a hundred participants. The Olympiad consists of two stages: the elimination stage, and the final stage. At least a hundred participants will advance to the final stage. The elimination stage in turn consi... |
Solve the programming task below in a Python markdown code block.
You are given a string s consisting of |s| small english letters.
In one move you can replace any character of this string to the next character in alphabetical order (a will be replaced with b, s will be replaced with t, etc.). You cannot replace lett... |
Solve the programming task below in a Python markdown code block.
Recently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understands the subject fairly well, and so he began to behave like he already got PhD in that area.
To prove his skills, Ivan decided to demonstrate h... |
Solve the programming task below in a Python markdown code block.
Write a program which performs the following operations to a binary search tree $T$ by adding the find operation to A: Binary Search Tree I.
* insert $k$: Insert a node containing $k$ as key into $T$.
* find $k$: Report whether $T$ has a node containi... |
Solve the programming task below in a Python markdown code block.
Everybody know that you passed to much time awake during night time...
Your task here is to define how much coffee you need to stay awake after your night.
You will have to complete a function that take an array of events in arguments, according to th... |
Solve the programming task below in a Python markdown code block.
While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a_1, a_2, ..., a_{m} of length m, consisting of integers from 1 to n, not necessari... |
Solve the programming task below in a Python markdown code block.
A chess tournament will be held soon, where $n$ chess players will take part. Every participant will play one game against every other participant. Each game ends in either a win for one player and a loss for another player, or a draw for both players.
... |
Solve the programming task below in a Python markdown code block.
— Hey folks, how do you like this problem?
— That'll do it.
BThero is a powerful magician. He has got $n$ piles of candies, the $i$-th pile initially contains $a_i$ candies. BThero can cast a copy-paste spell as follows: He chooses two piles $(i, j... |
Solve the programming task below in a Python markdown code block.
Calendars in widespread use today include the Gregorian calendar, which is the de facto international standard, and is used almost everywhere in the world for civil purposes. The Gregorian reform modified the Julian calendar's scheme of leap years as fo... |
Solve the programming task below in a Python markdown code block.
As many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan.
The other calendar system is era-based calendar, or s... |
Solve the programming task below in a Python markdown code block.
# Task
You are the manager of the famous rescue team: The Knights. Your task is to assign your knights to a rescue missions on an infinite 2D-plane.
Your knights can move only by `n-knight` jumps.
For example, if a knight has n = 2, they can only... |
Solve the programming task below in a Python markdown code block.
There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume that the bottom left corner of the table has coordinates $(0, 0)$, and ... |
Solve the programming task below in a Python markdown code block.
Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: $s$ of length $n$ and $t$ of length $m$.
A sequence $p_1, p_2, \ldots, p_m$, where $1 \leq p_1 < p_2 < \ldots < p_m \leq n$, is called b... |
Solve the programming task below in a Python markdown code block.
You have three piles of candies: red, green and blue candies: the first pile contains only red candies and there are $r$ candies in it, the second pile contains only green candies and there are $g$ candies in it, the third pile contains only blue can... |
Solve the programming task below in a Python markdown code block.
Problem
Given a natural number N less than or equal to 12, find the smallest natural number such that the number of divisors is exactly N.
Constraints
* 1 ≤ N ≤ 12
Input
One natural number N is given in one line.
Output
Output the smallest natura... |
Solve the programming task below in a Python markdown code block.
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are winding paths between each pair of houses. The length of a path... |
Solve the programming task below in a Python markdown code block.
A rabbit is playing a role-playing game. Just before entering the castle, he was ambushed by an enemy!
It was a battle between one hero operated by a rabbit and n enemies. Each character has four stats, health hi, attack power ai, defense power di, and... |
Solve the programming task below in a Python markdown code block.
Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is really difficult even for experienced gamers.
Walter William, the main character of the game, wants to join a gang called Los Hermanos (T... |
Solve the programming task below in a Python markdown code block.
A young boy John is playing with eight triangular panels. These panels are all regular triangles of the same size, each painted in a single color; John is forming various octahedra with them.
While he enjoys his playing, his father is wondering how man... |
Solve the programming task below in a Python markdown code block.
Takahashi has come to a party as a special guest.
There are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.
Takahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness be 0)... |
Solve the programming task below in a Python markdown code block.
There are N persons called Person 1 through Person N.
You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times.
If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is... |
Solve the programming task below in a Python markdown code block.
Nian is a monster which lives deep in the oceans. Once a year, it shows up on the land, devouring livestock and even people. In order to keep the monster away, people fill their villages with red colour, light, and cracking noise, all of which frighten ... |
Solve the programming task below in a Python markdown code block.
Soma is a fashionable girl. She absolutely loves shiny stones that she can put on as jewellery accessories. She has been collecting stones since her childhood - now she has become really good with identifying which ones are fake and which ones are not. ... |
Solve the programming task below in a Python markdown code block.
Профиль горного хребта схематично задан в виде прямоугольной таблицы из символов «.» (пустое пространство) и «*» (часть горы). Каждый столбец таблицы содержит хотя бы одну «звёздочку». Гарантируется, что любой из символов «*» либо находится в нижней стр... |
Solve the programming task below in a Python markdown code block.
# Task
`EvilCode` is a game similar to `Codewars`. You have to solve programming tasks as quickly as possible. However, unlike `Codewars`, `EvilCode` awards you with a medal, depending on the time you took to solve the task.
To get a medal, your time m... |
Solve the programming task below in a Python markdown code block.
Caisa solved the problem with the sugar and now he is on the way back to home.
Caisa is playing a mobile game during his path. There are (n + 1) pylons numbered from 0 to n in this game. The pylon with number 0 has zero height, the pylon with number i... |
Solve the programming task below in a Python markdown code block.
Let's define the following recurrence: $$a_{n+1} = a_{n} + minDigit(a_{n}) \cdot maxDigit(a_{n}).$$
Here $minDigit(x)$ and $maxDigit(x)$ are the minimal and maximal digits in the decimal representation of $x$ without leading zeroes. For examples refer ... |
Solve the programming task below in a Python markdown code block.
Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every vertex and every edge of which has a number written on.
The girl noticed that some of the tree's... |
Solve the programming task below in a Python markdown code block.
You are given a boolean function of three variables which is defined by its truth table. You need to find an expression of minimum length that equals to this function. The expression may consist of: Operation AND ('&', ASCII code 38) Operation OR ('|... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.