question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Bizon the Champion is called the Champion for a reason.
Bizon the Champion has recently got a present — a new glass cupboard with n shelves and he decided to put all his presents there. All the presents can be divided into two types: medals and cups. ... |
Solve the programming task below in a Python markdown code block.
Two foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the origina... |
Solve the programming task below in a Python markdown code block.
Find the minimum prime number greater than or equal to X.
-----Notes-----
A prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.
For example, 2, 3, and 5 are prime numbers, while 4 and 6 a... |
Solve the programming task below in a Python markdown code block.
Calculate the value of the sum: n mod 1 + n mod 2 + n mod 3 + ... + n mod m. As the result can be very large, you should print the value modulo 10^9 + 7 (the remainder when divided by 10^9 + 7).
The modulo operator a mod b stands for the remainder afte... |
Solve the programming task below in a Python markdown code block.
Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk.
Unfortunately, internet is not that fast in the city of Ekaterinozavods... |
Solve the programming task below in a Python markdown code block.
There are two popular keyboard layouts in Berland, they differ only in letters positions. All the other keys are the same. In Berland they use alphabet with 26 letters which coincides with English alphabet.
You are given two strings consisting of 26 di... |
Solve the programming task below in a Python markdown code block.
Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks.
There is only one shower and there are multiple students who wish to have a shower in the morning. That's why eve... |
Solve the programming task below in a Python markdown code block.
Let's solve the puzzle by programming.
The numbers n x n are arranged in a grid pattern. Some of the numbers are circled and we will call them the starting point. The rules of the puzzle are as follows:
* Draw one line that goes vertically and horizon... |
Solve the programming task below in a Python markdown code block.
In this Kata, you will check if it is possible to convert a string to a palindrome by changing one character.
For instance:
```Haskell
solve ("abbx") = True, because we can convert 'x' to 'a' and get a palindrome.
solve ("abba") = False, because we c... |
Solve the programming task below in a Python markdown code block.
Sasha and Ira are two best friends. But they aren’t just friends, they are software engineers and experts in artificial intelligence. They are developing an algorithm for two bots playing a two-player game. The game is cooperative and turn based. In eac... |
Solve the programming task below in a Python markdown code block.
# Let's watch a parade!
## Brief
You're going to watch a parade, but you only care about one of the groups marching. The parade passes through the street where your house is. Your house is at number `location` of the street. Write a function `parade_tim... |
Solve the programming task below in a Python markdown code block.
Transpose means is to interchange rows and columns of a two-dimensional array matrix.
[A^(T)]ij=[A]ji
ie:
Formally, the i th row, j th column element of AT is the j th row, i th column element of A:
Example :
```
[[1,2,3],[4,5,6]].transpose() //sh... |
Solve the programming task below in a Python markdown code block.
As most of you might know already, a prime number is an integer `n` with the following properties:
* it must be greater than 1
* it must be divisible only by itself and 1
And that's it: -15 or 8 are not primes, 5 or 97 are; pretty easy, isn't it?
Wel... |
Solve the programming task below in a Python markdown code block.
In this Kata, you will count the number of times the first string occurs in the second.
```Haskell
solve("zaz","zazapulz") = 4 because they are ZAZapulz, ZAzapulZ, ZazApulZ, zaZApulZ
```
More examples in test cases.
Good luck!
Please also try [Sim... |
Solve the programming task below in a Python markdown code block.
It's finally summer in Chefland! So our chef is looking forward to prepare some of the best "beat-the-heat" dishes to attract more customers. He summons the Wizard of Dessert to help him with one such dish.
The wizard provides the chef with a sequence o... |
Solve the programming task below in a Python markdown code block.
There is an Amidakuji that consists of w vertical bars and has a height (the number of steps to which horizontal bars can be added) of h. w is an even number. Of the candidates for the place to add the horizontal bar of this Amidakuji, the ath from the ... |
Solve the programming task below in a Python markdown code block.
You are given two arithmetic progressions: a_1k + b_1 and a_2l + b_2. Find the number of integers x such that L ≤ x ≤ R and x = a_1k' + b_1 = a_2l' + b_2, for some integers k', l' ≥ 0.
-----Input-----
The only line contains six integers a_1, b_1, a_2... |
Solve the programming task below in a Python markdown code block.
You are given a sequence $a_1, a_2, \dots, a_n$, consisting of integers.
You can apply the following operation to this sequence: choose some integer $x$ and move all elements equal to $x$ either to the beginning, or to the end of $a$. Note that you hav... |
Solve the programming task below in a Python markdown code block.
IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will be not only... |
Solve the programming task below in a Python markdown code block.
Ronald's uncle left him 3 fertile chickens in his will. When life gives you chickens, you start a business selling chicken eggs which is exactly what Ronald decided to do.
A chicken lays 300 eggs in its first year. However, each chicken's egg producti... |
Solve the programming task below in a Python markdown code block.
Screen resolution of Polycarp's monitor is $a \times b$ pixels. Unfortunately, there is one dead pixel at his screen. It has coordinates $(x, y)$ ($0 \le x < a, 0 \le y < b$). You can consider columns of pixels to be numbered from $0$ to $a-1$, and rows... |
Solve the programming task below in a Python markdown code block.
Brief
=====
Sometimes we need information about the list/arrays we're dealing with. You'll have to write such a function in this kata. Your function must provide the following informations:
* Length of the array
* Number of integer items in the array... |
Solve the programming task below in a Python markdown code block.
You are given a tree (an undirected connected acyclic graph) consisting of $n$ vertices and $n - 1$ edges. A number is written on each edge, each number is either $0$ (let's call such edges $0$-edges) or $1$ (those are $1$-edges).
Let's call an ordered... |
Solve the programming task below in a Python markdown code block.
Andrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds. In each round, Andrew and Jerry draw randomly without replacement from a jar containing n balls, each labeled with a distinct positive integer. Without... |
Solve the programming task below in a Python markdown code block.
You are given a prime number p, n integers a_1, a_2, …, a_n, and an integer k.
Find the number of pairs of indexes (i, j) (1 ≤ i < j ≤ n) for which (a_i + a_j)(a_i^2 + a_j^2) ≡ k mod p.
Input
The first line contains integers n, p, k (2 ≤ n ≤ 3 ⋅ 10^... |
Solve the programming task below in a Python markdown code block.
The goal is to write a pair of functions the first of which will take a string of binary along with a specification of bits, which will return a numeric, signed complement in two's complement format. The second will do the reverse. It will take in an in... |
Solve the programming task below in a Python markdown code block.
The fearless Ikta has finally hunted down the infamous Count Big Bridge! Count Bigbridge is now trapped in a rectangular room w meters wide and h meters deep, waiting for his end.
If you select a corner of the room and take the coordinate system so tha... |
Solve the programming task below in a Python markdown code block.
# Background
My TV remote control has arrow buttons and an `OK` button.
I can use these to move a "cursor" on a logical screen keyboard to type "words"...
The screen "keyboard" layout looks like this
#tvkb {
width : 300px;
border: 5px sol... |
Solve the programming task below in a Python markdown code block.
The circle line of the Roflanpolis subway has $n$ stations.
There are two parallel routes in the subway. The first one visits stations in order $1 \to 2 \to \ldots \to n \to 1 \to 2 \to \ldots$ (so the next stop after station $x$ is equal to $(x+1)$ if... |
Solve the programming task below in a Python markdown code block.
Orac is studying number theory, and he is interested in the properties of divisors.
For two positive integers $a$ and $b$, $a$ is a divisor of $b$ if and only if there exists an integer $c$, such that $a\cdot c=b$.
For $n \ge 2$, we will denote as $f(... |
Solve the programming task below in a Python markdown code block.
<image>
You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)
Input
The only line of the input is a string (between 1 and 50 characters l... |
Solve the programming task below in a Python markdown code block.
# Task
You are given integer `n` determining set S = {1, 2, ..., n}. Determine if the number of k-element subsets of S is `ODD` or `EVEN` for given integer k.
# Example
For `n = 3, k = 2`, the result should be `"ODD"`
In this case, we have 3 2-el... |
Solve the programming task below in a Python markdown code block.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a... |
Solve the programming task below in a Python markdown code block.
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some ... |
Solve the programming task below in a Python markdown code block.
Nastya received one more array on her birthday, this array can be used to play a traditional Byteland game on it. However, to play the game the players should first select such a subsegment of the array that $\frac{p}{s} = k$, where p is the product of ... |
Solve the programming task below in a Python markdown code block.
Tonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at least one brain, so she can anal... |
Solve the programming task below in a Python markdown code block.
The administration of the Tomsk Region firmly believes that it's time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decided to achieve its goal by expanding the boundaries of the city... |
Solve the programming task below in a Python markdown code block.
Since most contestants do not read this part, I have to repeat that Bitlandians are quite weird. They have their own jobs, their own working method, their own lives, their own sausages and their own games!
Since you are so curious about Bitland, I'll g... |
Solve the programming task below in a Python markdown code block.
# RoboScript #1 - Implement Syntax Highlighting
## 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.
Lеt's create function to play cards. Our rules:
We have the preloaded `deck`:
```
deck = ['joker','2♣','3♣','4♣','5♣','6♣','7♣','8♣','9♣','10♣','J♣','Q♣','K♣','A♣',
'2♦','3♦','4♦','5♦','6♦','7♦','8♦','9♦','10♦','J♦','Q♦','K♦','A♦',
... |
Solve the programming task below in a Python markdown code block.
A non-empty string is called palindrome, if it reads the same from the left to the right and from the right to the left. For example, "abcba", "a", and "abba" are palindromes, while "abab" and "xy" are not.
A string is called a substring of another str... |
Solve the programming task below in a Python markdown code block.
This is the performance version of [this kata](https://www.codewars.com/kata/59afff65f1c8274f270020f5).
---
Imagine two rings with numbers on them. The inner ring spins clockwise and the outer ring spins anti-clockwise. We start with both rings aligne... |
Solve the programming task below in a Python markdown code block.
Consider a 32-bit real type with 7 bits from the right as the decimal part, the following 24 bits as the integer part, and the leftmost 1 bit as the sign part as shown below (b1, ..., b32). Represents 0 or 1).
<image>
To translate this format into a ... |
Solve the programming task below in a Python markdown code block.
Once a Mathematician was trapped by military people during a world war with his forty colleagues. The colleagues were without any weapons, only the mathematician had a knife. And with no weapons they were not able to fight with the military, so they dec... |
Solve the programming task below in a Python markdown code block.
Example
Input
3
()(()((
))()()(()
)())(())
Output
Yes
Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters. |
Solve the programming task below in a Python markdown code block.
You are given a number $n$ (divisible by $3$) and an array $a[1 \dots n]$. In one move, you can increase any of the array elements by one. Formally, you choose the index $i$ ($1 \le i \le n$) and replace $a_i$ with $a_i + 1$. You can choose the same ind... |
Solve the programming task below in a Python markdown code block.
Have a look at the following numbers.
```
n | score
---+-------
1 | 50
2 | 150
3 | 300
4 | 500
5 | 750
```
Can you find a pattern in it? If so, then write a function `getScore(n)`/`get_score(n)`/`GetScore(n)` which returns the score for any... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese and Russian as well.
An equation is an equality containing one or more variables. Solving the equation consists of determining which values of the variables make the equality true. In this situation, variab... |
Solve the programming task below in a Python markdown code block.
There is a very long bench. The bench is divided into M sections, where M is a very large integer.
Initially, the bench is vacant. Then, M people come to the bench one by one, and perform the following action:
* We call a section comfortable if the se... |
Solve the programming task below in a Python markdown code block.
# Task
**_Given_** *an array of N integers, you have to find* **_how many times_** *you have to* **_add up the smallest numbers_** *in the array until* **_their Sum_** *becomes greater or equal to* **_K_**.
___
# Notes:
* **_List size_** is *at l... |
Solve the programming task below in a Python markdown code block.
[Chopsticks (singular: chopstick) are short, frequently tapered sticks used in pairs of equal length, which are used as the traditional eating utensils of China, Japan, Korea and Vietnam. Originated in ancient China, they can also be found in some areas... |
Solve the programming task below in a Python markdown code block.
After defeating a Blacklist Rival, you get a chance to draw $1$ reward slip out of $x$ hidden valid slips. Initially, $x=3$ and these hidden valid slips are Cash Slip, Impound Strike Release Marker and Pink Slip of Rival's Car. Initially, the probabilit... |
Solve the programming task below in a Python markdown code block.
Problem statement
There is a tree consisting of $ N $ vertices $ N-1 $ edges, and the $ i $ th edge connects the $ u_i $ and $ v_i $ vertices.
Each vertex has a button, and the button at the $ i $ th vertex is called the button $ i $.
First, the beau... |
Solve the programming task below in a Python markdown code block.
*SCHEDULE YOUR DA(RRA)Y*
The best way to have a productive day is to plan out your work schedule. Given the following three inputs, please create an an array of time alloted to work, broken up with time alloted with breaks:
Input 1: Ho... |
Solve the programming task below in a Python markdown code block.
You are given array a with n elements and the number m. Consider some subsequence of a and the value of least common multiple (LCM) of its elements. Denote LCM as l. Find any longest subsequence of a with the value l ≤ m.
A subsequence of a is an array... |
Solve the programming task below in a Python markdown code block.
Denis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally... Denis asks her to be together, but ... Nastya doesn't g... |
Solve the programming task below in a Python markdown code block.
Consider a long corridor which can be divided into $n$ square cells of size $1 \times 1$. These cells are numbered from $1$ to $n$ from left to right.
There are two people in this corridor, a hooligan and a security guard. Initially, the hooligan is in... |
Solve the programming task below in a Python markdown code block.
It is well known that Berland has n cities, which form the Silver ring — cities i and i + 1 (1 ≤ i < n) are connected by a road, as well as the cities n and 1. The goverment have decided to build m new roads. The list of the roads to build was prepared.... |
Solve the programming task below in a Python markdown code block.
Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a_1 × b_1 rectangle, th... |
Solve the programming task below in a Python markdown code block.
На тренировку по подготовке к соревнованиям по программированию пришли n команд. Тренер для каждой команды подобрал тренировку, комплект задач для i-й команды занимает a_{i} страниц. В распоряжении тренера есть x листов бумаги, у которых обе стороны чис... |
Solve the programming task below in a Python markdown code block.
Takahashi is playing with N cards.
The i-th card has an integer X_i on it.
Takahashi is trying to create as many pairs of cards as possible satisfying one of the following conditions:
* The integers on the two cards are the same.
* The sum of the int... |
Solve the programming task below in a Python markdown code block.
Your task is to ___Reverse and Combine Words___. It's not too difficult, but there are some things you have to consider...
### So what to do?
Input: String containing different "words" separated by spaces
```
1. More than one word? Reverse each word... |
Solve the programming task below in a Python markdown code block.
Given are an N \times N matrix and an integer K. The entry in the i-th row and j-th column of this matrix is denoted as a_{i, j}. This matrix contains each of 1, 2, \dots, N^2 exactly once.
Sigma can repeat the following two kinds of operation arbitrari... |
Solve the programming task below in a Python markdown code block.
There are $n$ block towers in a row, where tower $i$ has a height of $a_i$. You're part of a building crew, and you want to make the buildings look as nice as possible. In a single day, you can perform the following operation:
Choose two indices $i$ an... |
Solve the programming task below in a Python markdown code block.
There is a complete graph of m vertices. Initially, the edges of the complete graph are uncolored. Sunuke did the following for each i (1 ≤ i ≤ n): Select ai vertices from the complete graph and color all edges connecting the selected vertices with colo... |
Solve the programming task below in a Python markdown code block.
Given are two strings S and T.
Let us change some of the characters in S so that T will be a substring of S.
At least how many characters do we need to change?
Here, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but... |
Solve the programming task below in a Python markdown code block.
You are given three integers, A, B and C.
Among them, two are the same, but the remaining one is different from the rest.
For example, when A=5,B=7,C=5, A and C are the same, but B is different.
Find the one that is different from the rest among the ... |
Solve the programming task below in a Python markdown code block.
You are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b.
The i-th operation is as follows:
1. Append a_i to the end of b.
2. Reverse the order of the elements in b.
... |
Solve the programming task below in a Python markdown code block.
Find the number of integers between 1 and K (inclusive) satisfying the following condition, modulo 10^9 + 7:
* The sum of the digits in base ten is a multiple of D.
Constraints
* All values in input are integers.
* 1 \leq K < 10^{10000}
* 1 \leq D \l... |
Solve the programming task below in a Python markdown code block.
In Dwango Co., Ltd., there is a content distribution system named 'Dwango Media Cluster', and it is called 'DMC' for short.
The name 'DMC' sounds cool for Niwango-kun, so he starts to define DMC-ness of a string.
Given a string S of length N and an int... |
Solve the programming task below in a Python markdown code block.
# Task
Let's say that `"g" is happy` in the given string, if there is another "g" immediately to the right or to the left of it.
Find out if all "g"s in the given string are happy.
# Example
For `str = "gg0gg3gg0gg"`, the output should be `true`.
... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese here
------ Problem Statement ------
Maxim likes dividers of the numbers. Also Maxim is fond of lucky numbers of small elephant from Lviv city.
If you remember, lucky numbers are positive integers whose... |
Solve the programming task below in a Python markdown code block.
A complete binary tree is a binary tree in which every internal node has two children and all leaves have the same depth. A binary tree in which if last level is not completely filled but all nodes (leaves) are pushed across to the left, is also (nearly... |
Solve the programming task below in a Python markdown code block.
She is an extraordinary girl. She works for a library. Since she is young and cute, she is forced to do a lot of laborious jobs. The most annoying job for her is to put returned books into shelves, carrying them by a cart. The cart is large enough to ca... |
Solve the programming task below in a Python markdown code block.
Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.
Filya is given an array of non-negative integers a_1, a_2, ..., a_{n}. First, he pick an integer x and then ... |
Solve the programming task below in a Python markdown code block.
AtCoder Mart sells 1000000 of each of the six items below:
* Riceballs, priced at 100 yen (the currency of Japan) each
* Sandwiches, priced at 101 yen each
* Cookies, priced at 102 yen each
* Cakes, priced at 103 yen each
* Candies, priced at 104 yen e... |
Solve the programming task below in a Python markdown code block.
Forgotten languages (also known as extinct languages) are languages that are no longer in use. Such languages were, probably, widely used before and no one could have ever imagined that they will become extinct at some point. Unfortunately, that is what... |
Solve the programming task below in a Python markdown code block.
It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following moves. During each move, either Al... |
Solve the programming task below in a Python markdown code block.
Real stupidity beats artificial intelligence every time.
— Terry Pratchett, Hogfather, Discworld
You are given a string $s$ of length $n$ and a number $k$. Let's denote by $rev(s)$ the reversed string $s$ (i.e. $rev(s) = s_n s_{n-1} ... s_1$). You can... |
Solve the programming task below in a Python markdown code block.
The "Russian Peasant Method" is an old algorithm used by Russian peasants (and before them ancient Egyptians) to perform multiplication. Consider that X and Y are two numbers. X can be any number but Y must be a positive integer. To multiply X and Y:
... |
Solve the programming task below in a Python markdown code block.
Vasya had three strings $a$, $b$ and $s$, which consist of lowercase English letters. The lengths of strings $a$ and $b$ are equal to $n$, the length of the string $s$ is equal to $m$.
Vasya decided to choose a substring of the string $a$, then choose... |
Solve the programming task below in a Python markdown code block.
Mad scientist Mike is building a time machine in his spare time. To finish the work, he needs a resistor with a certain resistance value.
However, all Mike has is lots of identical resistors with unit resistance R_0 = 1. Elements with other resistance ... |
Solve the programming task below in a Python markdown code block.
Petya has n positive integers a_1, a_2, ..., a_{n}.
His friend Vasya decided to joke and replaced all digits in Petya's numbers with a letters. He used the lowercase letters of the Latin alphabet from 'a' to 'j' and replaced all digits 0 with one lett... |
Solve the programming task below in a Python markdown code block.
You are given two integers $a$ and $b$.
In one move, you can choose some integer $k$ from $1$ to $10$ and add it to $a$ or subtract it from $a$. In other words, you choose an integer $k \in [1; 10]$ and perform $a := a + k$ or $a := a - k$. You may use... |
Solve the programming task below in a Python markdown code block.
Tom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode laptop consumes P1 watt per minute. T1 minutes after Tom moved the mouse or touched the keyboard for the last time, a screensaver starts and power... |
Solve the programming task below in a Python markdown code block.
This problem is same as the next one, but has smaller constraints.
It was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). After arriving at the power station,... |
Solve the programming task below in a Python markdown code block.
In the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one queue to another.
(Cultural no... |
Solve the programming task below in a Python markdown code block.
Takahashi is organizing a party.
At the party, each guest will receive one or more snack pieces.
Takahashi predicts that the number of guests at this party will be A or B.
Find the minimum number of pieces that can be evenly distributed to the guests in... |
Solve the programming task below in a Python markdown code block.
A widely known among some people Belarusian sport programmer Yura possesses lots of information about cars. That is why he has been invited to participate in a game show called "Guess That Car!".
The game show takes place on a giant parking lot, which ... |
Solve the programming task below in a Python markdown code block.
There are $n$ cities in Berland and some pairs of them are connected by two-way roads. It is guaranteed that you can pass from any city to any other, moving along the roads. Cities are numerated from $1$ to $n$.
Two fairs are currently taking place in ... |
Solve the programming task below in a Python markdown code block.
Constanze is the smartest girl in her village but she has bad eyesight.
One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if you pronounce 'c', 'o', 'd'... |
Solve the programming task below in a Python markdown code block.
Lengths are measures in Baden in inches and feet. To a length from centimeters it is enough to know that an inch equals three centimeters in Baden and one foot contains 12 inches.
You are given a length equal to n centimeters. Your task is to convert i... |
Solve the programming task below in a Python markdown code block.
Very soon there will be a parade of victory over alien invaders in Berland. Unfortunately, all soldiers died in the war and now the army consists of entirely new recruits, many of whom do not even know from which leg they should begin to march. The civi... |
Solve the programming task below in a Python markdown code block.
ICPC Ranking
Your mission in this problem is to write a program which, given the submission log of an ICPC (International Collegiate Programming Contest), determines team rankings.
The log is a sequence of records of program submission in the order of... |
Solve the programming task below in a Python markdown code block.
Polycarp has a favorite sequence $a[1 \dots n]$ consisting of $n$ integers. He wrote it out on the whiteboard as follows:
he wrote the number $a_1$ to the left side (at the beginning of the whiteboard);
he wrote the number $a_2$ to the right side (at ... |
Solve the programming task below in a Python markdown code block.
In this Kata, you will create a function that converts a string with letters and numbers to the inverse of that string (with regards to Alpha and Numeric characters). So, e.g. the letter `a` will become `1` and number `1` will become `a`; `z` will becom... |
Solve the programming task below in a Python markdown code block.
A bracketed sequence is called correct (regular) if by inserting "+" and "1" you can get a well-formed mathematical expression from it. For example, sequences "(())()", "()" and "(()(()))" are correct, while ")(", "(()" and "(()))(" are not.
The teache... |
Solve the programming task below in a Python markdown code block.
A mischievous notice has arrived from the primitive slow-life organization "Akaruda". Akaruda is famous for mischief such as throwing a pie at the face of a VIP, but recently it has become more radical, such as using gunpowder to sprinkle rat fireworks ... |
Solve the programming task below in a Python markdown code block.
You are given a tree with n nodes, numerated from 0 to n-1. For each k between 0 and n, inclusive, you have to count the number of unordered pairs (u,v), u ≠ v, such that the MEX of all the node labels in the shortest path from u to v (including end poi... |
Solve the programming task below in a Python markdown code block.
In this Kata, you will be given a ```number```, two indexes (```index1``` and ```index2```) and a ```digit``` to look for. Your task will be to check if the ```digit``` exists in the ```number```, within the ```indexes``` given.
Be careful, the ```inde... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.