question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
It is September 9 in Japan now.
You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?
-----Constraints-----
- 10≤N≤99
-----Input-----
Input is given from Standard Input in the following format:
N
----... |
Solve the programming task below in a Python markdown code block.
You are given two binary strings $a$ and $b$ of the same length. You can perform the following two operations on the string $a$:
Swap any two bits at indices $i$ and $j$ respectively ($1 \le i, j \le n$), the cost of this operation is $|i - j|$, that... |
Solve the programming task below in a Python markdown code block.
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of ev... |
Solve the programming task below in a Python markdown code block.
Santosh has a farm at Byteland. He has a very big family to look after. His life takes a sudden turn and he runs into a financial crisis. After giving all the money he has in his hand, he decides to sell his plots. The speciality of his land is that it... |
Solve the programming task below in a Python markdown code block.
Sheldon, Leonard, Penny, Rajesh and Howard are in the queue for a "Double Cola" drink vending machine; there are no other people in the queue. The first one in the queue (Sheldon) buys a can, drinks it and doubles! The resulting two Sheldons go to the e... |
Solve the programming task below in a Python markdown code block.
Alperen has two strings, $s$ and $t$ which are both initially equal to "a".
He will perform $q$ operations of two types on the given strings:
$1 \;\; k \;\; x$ — Append the string $x$ exactly $k$ times at the end of string $s$. In other words, $s := s... |
Solve the programming task below in a Python markdown code block.
You are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in array A and choose m numbers in array B so that any number chosen in the first array is strictly less than any n... |
Solve the programming task below in a Python markdown code block.
There are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.
You can rearrange these children just one time in any order you like.
When a child who originally occupies the x-th position from the left... |
Solve the programming task below in a Python markdown code block.
A binary search tree can be unbalanced depending on features of data. For example, if we insert $n$ elements into a binary search tree in ascending order, the tree become a list, leading to long search times. One of strategies is to randomly shuffle the... |
Solve the programming task below in a Python markdown code block.
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are ... |
Solve the programming task below in a Python markdown code block.
There are N squares aligned in a row. The i-th square from the left contains an integer a_i.
Initially, all the squares are white. Snuke will perform the following operation some number of times:
* Select K consecutive squares. Then, paint all of them... |
Solve the programming task below in a Python markdown code block.
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of $n$ non-negative integers.
If there ar... |
Solve the programming task below in a Python markdown code block.
The integers 14 and 15, are contiguous (1 the difference between them, obvious) and have the same number of divisors.
```python
14 ----> 1, 2, 7, 14 (4 divisors)
15 ----> 1, 3, 5, 15 (4 divisors)
```
The next pair of contiguous integers with this proper... |
Solve the programming task below in a Python markdown code block.
There is a graph of $n$ rows and $10^6 + 2$ columns, where rows are numbered from $1$ to $n$ and columns from $0$ to $10^6 + 1$:
Let's denote the node in the row $i$ and column $j$ by $(i, j)$.
Initially for each $i$ the $i$-th row has exactly one obs... |
Solve the programming task below in a Python markdown code block.
Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC.
For that, he asked to give him the st... |
Solve the programming task below in a Python markdown code block.
Let's denote a function
$d(x, y) = \left\{\begin{array}{ll}{y - x,} & {\text{if}|x - y|> 1} \\{0,} & {\text{if}|x - y|\leq 1} \end{array} \right.$
You are given an array a consisting of n integers. You have to calculate the sum of d(a_{i}, a_{j}) ove... |
Solve the programming task below in a Python markdown code block.
The Berland University is preparing to celebrate the 256-th anniversary of its founding! A specially appointed Vice Rector for the celebration prepares to decorate the campus. In the center of the campus n ice sculptures were erected. The sculptures are... |
Solve the programming task below in a Python markdown code block.
Iahub got bored, so he invented a game to be played on paper.
He writes n integers a_1, a_2, ..., a_{n}. Each of those integers can be either 0 or 1. He's allowed to do exactly one move: he chooses two indices i and j (1 ≤ i ≤ j ≤ n) and flips all val... |
Solve the programming task below in a Python markdown code block.
Takahashi is drawing a segment on grid paper.
From a certain square, a square that is x squares to the right and y squares above, is denoted as square (x, y).
When Takahashi draws a segment connecting the lower left corner of square (A, B) and the low... |
Solve the programming task below in a Python markdown code block.
In genetics a reading frame is a way to divide a sequence of nucleotides (DNA bases) into a set of consecutive non-overlapping triplets (also called codon). Each of this triplets is translated into an amino-acid during a translation process to create pr... |
Solve the programming task below in a Python markdown code block.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
One day Petya was delivered a str... |
Solve the programming task below in a Python markdown code block.
There are $n$ students in a university. The number of students is even. The $i$-th student has programming skill equal to $a_i$.
The coach wants to form $\frac{n}{2}$ teams. Each team should consist of exactly two students, and each student should bel... |
Solve the programming task below in a Python markdown code block.
Inaka has a disc, the circumference of which is $n$ units. The circumference is equally divided by $n$ points numbered clockwise from $1$ to $n$, such that points $i$ and $i + 1$ ($1 \leq i < n$) are adjacent, and so are points $n$ and $1$.
There are $... |
Solve the programming task below in a Python markdown code block.
You got a box with a combination lock. The lock has a display showing n digits. There are two buttons on the box, each button changes digits on the display. You have quickly discovered that the first button adds 1 to all the digits (all digits 9 become ... |
Solve the programming task below in a Python markdown code block.
A histogram is made of a number of contiguous bars, which have same width.
For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the largest rectangular area.
Constrain... |
Solve the programming task below in a Python markdown code block.
Kitahara Haruki has bought n apples for Touma Kazusa and Ogiso Setsuna. Now he wants to divide all the apples between the friends.
Each apple weights 100 grams or 200 grams. Of course Kitahara Haruki doesn't want to offend any of his friend. Therefore ... |
Solve the programming task below in a Python markdown code block.
# Introduction
Digital Cypher assigns a unique number to each letter of the alphabet:
```
a b c d e f g h i j k l m n o p q r s t u v w x y z
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
```
... |
Solve the programming task below in a Python markdown code block.
There are n walruses sitting in a circle. All of them are numbered in the clockwise order: the walrus number 2 sits to the left of the walrus number 1, the walrus number 3 sits to the left of the walrus number 2, ..., the walrus number 1 sits to the lef... |
Solve the programming task below in a Python markdown code block.
Problem statement
Cards with ranks of $ 2 $ and $ 8 $ are powerful in card game millionaires. Therefore, we call an integer consisting of only the numbers $ 2 $ and $ 8 $ in $ 10 $ decimal notation a good integer. The best integers are listed from the ... |
Solve the programming task below in a Python markdown code block.
Given an array $A_1, A_2, ..., A_N$, count the number of subarrays of array $A$ which are non-decreasing.
A subarray $A[i, j]$, where $1 ≤ i ≤ j ≤ N$ is a sequence of integers $A_i, A_i+1, ..., A_j$.
A subarray $A[i, j]$ is non-decreasing if $A_i ≤ A_i... |
Solve the programming task below in a Python markdown code block.
Monocarp is playing a game "Assimilation IV". In this game he manages a great empire: builds cities and conquers new lands.
Monocarp's empire has $n$ cities. In order to conquer new lands he plans to build one Monument in each city. The game is turn-ba... |
Solve the programming task below in a Python markdown code block.
You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0.
Write the program which finds the number of points in the intersection of two given se... |
Solve the programming task below in a Python markdown code block.
The legendary Farmer John is throwing a huge party, and animals from all over the world are hanging out at his house. His guests are hungry, so he instructs his cow Bessie to bring out the snacks! Moo!
There are $n$ snacks flavors, numbered with intege... |
Solve the programming task below in a Python markdown code block.
problem
AOR Ika is at the $ S $ th bus stop at time $ 0 $ and wants to go from there to the $ G $ th bus stop. The number of bus stops $ N $ and $ M $ routes (*) connecting different bus stops are given. The bus stops are numbered $ 1, \ dots, and N $,... |
Solve the programming task below in a Python markdown code block.
A fraction whose numerator is 1 and whose denominator is a positive integer is called a unit fraction. A representation of a positive rational number p/q as the sum of finitely many unit fractions is called a partition of p/q into unit fractions. For ex... |
Solve the programming task below in a Python markdown code block.
You are given a grid of squares with H horizontal rows and W vertical columns, where each square is painted white or black. HW characters from A_{11} to A_{HW} represent the colors of the squares. A_{ij} is `#` if the square at the i-th row from the top... |
Solve the programming task below in a Python markdown code block.
There are $n$ candies in a row, they are numbered from left to right from $1$ to $n$. The size of the $i$-th candy is $a_i$.
Alice and Bob play an interesting and tasty game: they eat candy. Alice will eat candy from left to right, and Bob — from right... |
Solve the programming task below in a Python markdown code block.
One day Alice visited Byteland to purchase jewels for her upcoming wedding anniversary.
In Byteland, every Jewelry shop has their own discount methods to attract the customers. One discount method called Buy1-Get1 caught Alice's attention. That is, Alic... |
Solve the programming task below in a Python markdown code block.
Ivan has got an array of n non-negative integers a_1, a_2, ..., a_{n}. Ivan knows that the array is sorted in the non-decreasing order.
Ivan wrote out integers 2^{a}_1, 2^{a}_2, ..., 2^{a}_{n} on a piece of paper. Now he wonders, what minimum number o... |
Solve the programming task below in a Python markdown code block.
You are given two integers K and S.
Three variable X, Y and Z takes integer values satisfying 0≤X,Y,Z≤K.
How many different assignments of values to X, Y and Z are there such that X + Y + Z = S?
Constraints
* 2≤K≤2500
* 0≤S≤3K
* K and S are integers.
... |
Solve the programming task below in a Python markdown code block.
You have two integers $l$ and $r$. Find an integer $x$ which satisfies the conditions below:
$l \le x \le r$. All digits of $x$ are different.
If there are multiple answers, print any of them.
-----Input-----
The first line contains two integer... |
Solve the programming task below in a Python markdown code block.
Hierarchical Democracy
The presidential election in Republic of Democratia is carried out through multiple stages as follows.
1. There are exactly two presidential candidates.
2. At the first stage, eligible voters go to the polls of his/her electoral... |
Solve the programming task below in a Python markdown code block.
One important contest will take place on the most famous programming platform (Topforces) very soon!
The authors have a pool of $n$ problems and should choose at most three of them into this contest. The prettiness of the $i$-th problem is $a_i$. The a... |
Solve the programming task below in a Python markdown code block.
Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to $120^{\circ}$. Then he measured the length of its sides, and found that each of them is equal to an integer number of centimeters. Ther... |
Solve the programming task below in a Python markdown code block.
problem
There are n islands in JOI, and each island is numbered from 1 to n. Currently, the JOI country is developing a route network connecting each island.
You work at a ticket center that handles ship tickets. There are many people in JOI who want ... |
Solve the programming task below in a Python markdown code block.
There are N stones, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N), the height of Stone i is h_i.
There is a frog who is initially on Stone 1. He will repeat the following action some number of times to reach Stone N:
* If the frog is currentl... |
Solve the programming task below in a Python markdown code block.
Luckily, Serval got onto the right bus, and he came to the kindergarten on time. After coming to kindergarten, he found the toy bricks very funny.
He has a special interest to create difficult problems for others to solve. This time, with many $1 \time... |
Solve the programming task below in a Python markdown code block.
Sereja and Dima play a game. The rules of the game are very simple. The players have n cards in a row. Each card contains a number, all numbers on the cards are distinct. The players take turns, Sereja moves first. During his turn a player can take one ... |
Solve the programming task below in a Python markdown code block.
This is an easier version of the problem with smaller constraints.
Korney Korneevich dag up an array $a$ of length $n$. Korney Korneevich has recently read about the operation bitwise XOR , so he wished to experiment with it. For this purpose, he decid... |
Solve the programming task below in a Python markdown code block.
Alice became interested in periods of integer numbers. We say positive $X$ integer number is periodic with length $L$ if there exists positive integer number $P$ with $L$ digits such that $X$ can be written as $PPPP…P$. For example:
$X = 123123123$ is ... |
Solve the programming task below in a Python markdown code block.
# Introduction
The first century spans from the **year 1** *up to* and **including the year 100**, **The second** - *from the year 101 up to and including the year 200*, etc.
# Task :
Given a year, return the century it is in.
Read the inputs from s... |
Solve the programming task below in a Python markdown code block.
Given some positive integers, I wish to print the integers such that all take up the same width by adding a minimum number of leading zeroes. No leading zeroes shall be added to the largest integer.
For example, given `1, 23, 2, 17, 102`, I wish to pri... |
Solve the programming task below in a Python markdown code block.
"Contestant who earns a score equal to or greater than the k-th place finisher's score will advance to the next round, as long as the contestant earns a positive score..." — an excerpt from contest rules.
A total of n participants took part in the cont... |
Solve the programming task below in a Python markdown code block.
Everything got unclear to us in a far away constellation Tau Ceti. Specifically, the Taucetians choose names to their children in a very peculiar manner.
Two young parents abac and bbad think what name to give to their first-born child. They decided th... |
Solve the programming task below in a Python markdown code block.
Increasing E869120 (Ninja E869120)
E869120 You are good at alter ego.
Here are $ N $ members of the PA Lab. But some of them may be E869120.
So you asked all the $ N $ members of the PA Lab for their names. As a result, the $ N $ members named themse... |
Solve the programming task below in a Python markdown code block.
You are given a tree (an undirected connected graph without cycles) and an integer s.
Vanya wants to put weights on all edges of the tree so that all weights are non-negative real numbers and their sum is s. At the same time, he wants to make the diame... |
Solve the programming task below in a Python markdown code block.
problem
JOI City will hold a large-scale exposition.
There are two themes for this exposition, and each of the N exhibition facilities in JOI City will exhibit on one of the two themes.
The location of the facility is represented by plane coordinates... |
Solve the programming task below in a Python markdown code block.
In mathematics, a [Diophantine equation](https://en.wikipedia.org/wiki/Diophantine_equation) is a polynomial equation, usually with two or more unknowns, such that only the integer solutions are sought or studied.
In this kata we want to find all integ... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian.
Today is Chef's birthday. His mom gifted him a truly lovable gift, a permutation of first N positive integers.
She placed the permutation on a very long table in front of Chef and left it for... |
Solve the programming task below in a Python markdown code block.
Find the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.
-----Constraints-----
- 1 \leq N \leq 10^9
- N is an integer.
-----Input-----
Input is given from Standard Input... |
Solve the programming task below in a Python markdown code block.
You are given a string $s$ of length $n$ consisting of characters a and/or b.
Let $\operatorname{AB}(s)$ be the number of occurrences of string ab in $s$ as a substring. Analogically, $\operatorname{BA}(s)$ is the number of occurrences of ba in $s$ as ... |
Solve the programming task below in a Python markdown code block.
Patrick likes to play baseball, but sometimes he will spend so many hours hitting home runs that his mind starts to get foggy! Patrick is sure that his scores across $n$ sessions follow the identity permutation (ie. in the first game he scores $1$ point... |
Solve the programming task below in a Python markdown code block.
One day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field is provided by $n$ machines, and the power of the $i$-th machine is $a_i$.... |
Solve the programming task below in a Python markdown code block.
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy i... |
Solve the programming task below in a Python markdown code block.
Happy PMP is freshman and he is learning about algorithmic problems. He enjoys playing algorithmic games a lot.
One of the seniors gave Happy PMP a nice game. He is given two permutations of numbers 1 through n and is asked to convert the first one to ... |
Solve the programming task below in a Python markdown code block.
It’s still hot every day, but September has already come. It’s autumn according to the calendar. Looking around, I see two red dragonflies at rest on the wall in front of me. It’s autumn indeed.
When two red dragonflies’ positional information as measu... |
Solve the programming task below in a Python markdown code block.
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant.
Shop, where Noora is work... |
Solve the programming task below in a Python markdown code block.
Iahub helps his grandfather at the farm. Today he must milk the cows. There are n cows sitting in a row, numbered from 1 to n from left to right. Each cow is either facing to the left or facing to the right. When Iahub milks a cow, all the cows that see... |
Solve the programming task below in a Python markdown code block.
Shichi-Go-San (literally "Seven-Five-Three") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.
Takahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time?
-----... |
Solve the programming task below in a Python markdown code block.
Two students of AtCoder Kindergarten are fighting over candy packs.
There are three candy packs, each of which contains a, b, and c candies, respectively.
Teacher Evi is trying to distribute the packs between the two students so that each student gets t... |
Solve the programming task below in a Python markdown code block.
Карта звёздного неба представляет собой прямоугольное поле, состоящее из n строк по m символов в каждой строке. Каждый символ — это либо «.» (означает пустой участок неба), либо «*» (означает то, что в этом месте на небе есть звезда).
Новое издание ка... |
Solve the programming task below in a Python markdown code block.
Complete the function which returns the weekday according to the input number:
* `1` returns `"Sunday"`
* `2` returns `"Monday"`
* `3` returns `"Tuesday"`
* `4` returns `"Wednesday"`
* `5` returns `"Thursday"`
* `6` returns `"Friday"`
* `7` returns `"S... |
Solve the programming task below in a Python markdown code block.
You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complete the task.
The space station is made up with a number of units, called c... |
Solve the programming task below in a Python markdown code block.
For a given two numbers your mission is to derive a function that evaluates whether two given numbers are **abundant**, **deficient** or **perfect** and whether together they are **amicable**.
### Abundant Numbers
An abundant number or excessive numb... |
Solve the programming task below in a Python markdown code block.
To give credit where credit is due: This problem was taken from the ACMICPC-Northwest Regional Programming Contest. Thank you problem writers.
You are helping an archaeologist decipher some runes. He knows that this ancient society used a Base 10 syste... |
Solve the programming task below in a Python markdown code block.
Obesity is cited as the cause of many adult diseases. In the past, with a few exceptions, it was unrelated to high school students. However, it is no longer unrealistic to suffer from lack of exercise due to excessive studying for entrance exams, or to ... |
Solve the programming task below in a Python markdown code block.
On her way to programming school tiger Dasha faced her first test — a huge staircase! [Image]
The steps were numbered from one to infinity. As we know, tigers are very fond of all striped things, it is possible that it has something to do with their c... |
Solve the programming task below in a Python markdown code block.
Given an integer `n`, find two integers `a` and `b` such that:
```Pearl
A) a >= 0 and b >= 0
B) a + b = n
C) DigitSum(a) + Digitsum(b) is maximum of all possibilities.
```
You will return the digitSum(a) + digitsum(b).
```
For example:
solve(29) = 1... |
Solve the programming task below in a Python markdown code block.
Takahashi is going to set a 3-character password.
How many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?
-----Constraints-----
- 1 \leq N \leq 9
- N is an integer.
-----Input-----
Input is given ... |
Solve the programming task below in a Python markdown code block.
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible ... |
Solve the programming task below in a Python markdown code block.
Given a sequence of numbers a1, a2, a3, ..., an, find the maximum sum of a contiguous subsequence of those numbers. Note that, a subsequence of one element is also a contiquous subsequence.
Input
The input consists of multiple datasets. Each data se... |
Solve the programming task below in a Python markdown code block.
This problem consists of three subproblems: for solving subproblem C1 you will receive 4 points, for solving subproblem C2 you will receive 4 points, and for solving subproblem C3 you will receive 8 points.
Manao decided to pursue a fighter's career. H... |
Solve the programming task below in a Python markdown code block.
Bankopolis is an incredible city in which all the n crossroads are located on a straight line and numbered from 1 to n along it. On each crossroad there is a bank office.
The crossroads are connected with m oriented bicycle lanes (the i-th lane goes fr... |
Solve the programming task below in a Python markdown code block.
Petya has an array $a$ consisting of $n$ integers. He wants to remove duplicate (equal) elements.
Petya wants to leave only the rightmost entry (occurrence) for each element of the array. The relative order of the remaining unique elements should not b... |
Solve the programming task below in a Python markdown code block.
We have A balls with the string S written on each of them and B balls with the string T written on each of them.
From these balls, Takahashi chooses one with the string U written on it and throws it away.
Find the number of balls with the string S and... |
Solve the programming task below in a Python markdown code block.
Create a function that takes a positive integer and returns the next bigger number that can be formed by rearranging its digits. For example:
```
12 ==> 21
513 ==> 531
2017 ==> 2071
```
If the digits can't be rearranged to form a bigger number, return... |
Solve the programming task below in a Python markdown code block.
Alice and Bob have participated to a Rock Off with their bands. A jury of true metalheads rates the two challenges, awarding points to the bands on a scale from 1 to 50 for three categories: Song Heaviness, Originality, and Members' outfits.
For each o... |
Solve the programming task below in a Python markdown code block.
Let \mathrm{popcount}(n) be the number of `1`s in the binary representation of n. For example, \mathrm{popcount}(3) = 2, \mathrm{popcount}(7) = 3, and \mathrm{popcount}(0) = 0.
Let f(n) be the number of times the following operation will be done when w... |
Solve the programming task below in a Python markdown code block.
The developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunately, they are currently busy preparing a contest for you, so you will have to do it for them.
In this problem an image is a rectangular table th... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Russian also.
Chef likes playing with strings. The most interesting game are named "CHEF in string". The move of the game consists of the following: Chef takes a subsequence of string's letters that form the word "CHEF" and ... |
Solve the programming task below in a Python markdown code block.
F: Grid number
problem
Ebi-chan is trying to write exactly one integer from 1 to 2 \ times n in a grid with n columns horizontally and 2 rows vertically.
Only one integer can be written to each cell in the grid.
It's not fun just to write normally, ... |
Solve the programming task below in a Python markdown code block.
There are two main kinds of events in the life of top-model: fashion shows and photo shoots. Participating in any of these events affects the rating of appropriate top-model. After each photo shoot model's rating increases by a and after each fashion sh... |
Solve the programming task below in a Python markdown code block.
The goddess of programming is reviewing a thick logbook, which is a yearly record of visitors to her holy altar of programming. The logbook also records her visits at the altar.
The altar attracts programmers from all over the world because one visitor... |
Solve the programming task below in a Python markdown code block.
Little Vasya had n boxes with balls in the room. The boxes stood in a row and were numbered with numbers from 1 to n from left to right.
Once Vasya chose one of the boxes, let's assume that its number is i, took all balls out from it (it is guaranteed ... |
Solve the programming task below in a Python markdown code block.
Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers $1$, $5$, $10$ and $50$ respectively. The use of other roman digits is not allowed.
Numbers in this system are written as a se... |
Solve the programming task below in a Python markdown code block.
There is a puzzle to complete by combining 14 numbers from 1 to 9. Complete by adding another number to the given 13 numbers.
The conditions for completing the puzzle are
* You must have one combination of the same numbers.
* The remaining 12 numbers ... |
Solve the programming task below in a Python markdown code block.
You are given a positive integer $m$ and two integer sequence: $a=[a_1, a_2, \ldots, a_n]$ and $b=[b_1, b_2, \ldots, b_n]$. Both of these sequence have a length $n$.
Permutation is a sequence of $n$ different positive integers from $1$ to $n$. For exam... |
Solve the programming task below in a Python markdown code block.
Imagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points A and B on the plane are 4-connected if and only if:
* the Euclidean distance between A and B is ... |
Solve the programming task below in a Python markdown code block.
Write a function that takes a positive integer n, sums all the cubed values from 1 to n, and returns that sum.
Assume that the input n will always be a positive integer.
Examples:
```python
sum_cubes(2)
> 9
# sum of the cubes of 1 and 2 is 1 + 8
```... |
Solve the programming task below in a Python markdown code block.
Polycarpus participates in a competition for hacking into a new secure messenger. He's almost won.
Having carefully studied the interaction protocol, Polycarpus came to the conclusion that the secret key can be obtained if he properly cuts the public k... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.