question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
A string $s$ of length $n$ can be encrypted by the following algorithm: iterate over all divisors of $n$ in decreasing order (i.e. from $n$ to $1$), for each divisor $d$, reverse the substring $s[1 \dots d]$ (i.e. the substring which starts at positio... |
Solve the programming task below in a Python markdown code block.
Chef Palin, as his name suggests, is always very interested in palindromic strings. Recently, he made a pretty interesting discovery on palindromes and that made him feel really Lucky. He came across something known as Lucky Palindromes. He defines a st... |
Solve the programming task below in a Python markdown code block.
William has an array of $n$ integers $a_1, a_2, \dots, a_n$. In one move he can swap two neighboring items. Two items $a_i$ and $a_j$ are considered neighboring if the condition $|i - j| = 1$ is satisfied.
William wants you to calculate the minimal num... |
Solve the programming task below in a Python markdown code block.
Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be n players participating, and the tournament will follow knockout rules from the very first game. That means, that if someone lose... |
Solve the programming task below in a Python markdown code block.
There are N students in a school.
We will divide these students into some groups, and in each group they will discuss some themes.
You think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many ... |
Solve the programming task below in a Python markdown code block.
Does the card fit in a snack? (Are Cards Snacks?)
square1001 You have $ N $ cards.
Each of these cards has an integer written on it, and the integer on the $ i $ th card is $ A_i $.
square1001 Your random number today is $ K $. square1001 You want to... |
Solve the programming task below in a Python markdown code block.
Have you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.
In Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.
Du will chat in the group for n days... |
Solve the programming task below in a Python markdown code block.
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).
You are given a sequence $a$ consisting of $n$ integers.
You are making a sequence of moves. During eac... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Russian here
Polo, the Penguin, has a lot of tests tomorrow at the university.
He knows that there are N different questions that will be on the tests. For each question i (i = 1..N), he knows C[i] - the number of tests that... |
Solve the programming task below in a Python markdown code block.
There are famous Russian nesting dolls named matryoshkas sold in one of the souvenir stores nearby, and you'd like to buy several of them. The store has $n$ different matryoshkas. Any matryoshka is a figure of volume $out_i$ with an empty space inside o... |
Solve the programming task below in a Python markdown code block.
There are N computers and N sockets in a one-dimensional world. The coordinate of the i-th computer is a_i, and the coordinate of the i-th socket is b_i. It is guaranteed that these 2N coordinates are pairwise distinct.
Snuke wants to connect each comp... |
Solve the programming task below in a Python markdown code block.
You love coffee and want to know what beans you can afford to buy it.
The first argument to your search function will be a number which represents your budget.
The second argument will be an array of coffee bean prices.
Your 'search' function should ... |
Solve the programming task below in a Python markdown code block.
For a positive integer n
* If n is even, divide by 2.
* If n is odd, multiply by 3 and add 1.
If you repeat the above operation, the result will be 1. A problem called "Colatz conjecture" is that repeating this operation for any positive integer n w... |
Solve the programming task below in a Python markdown code block.
Your task is to find the first element of an array that is not consecutive.
By not consecutive we mean not exactly 1 larger than the previous element of the array.
E.g. If we have an array `[1,2,3,4,6,7,8]` then `1` then `2` then `3` then `4` are all ... |
Solve the programming task below in a Python markdown code block.
Baby is getting his frst tooth. This means more sleepless nights, but with the fun of feeling round his gums and trying to guess which will be first out!
Probably best have a sweepstake with your friends - because you have the best chance of knowing. ... |
Solve the programming task below in a Python markdown code block.
Let's define $p_i(n)$ as the following permutation: $[i, 1, 2, \dots, i - 1, i + 1, \dots, n]$. This means that the $i$-th permutation is almost identity (i.e. which maps every element to itself) permutation but the element $i$ is on the first position.... |
Solve the programming task below in a Python markdown code block.
Aizuwakamatsu City is known as the "City of History". About 400 years ago, the skeleton of the castle town was created by Gamo Ujisato, but after that, it became the central city of the Aizu clan 230,000 stones, whose ancestor was Hoshina Masayuki, the ... |
Solve the programming task below in a Python markdown code block.
Takahashi is practicing shiritori alone again today.
Shiritori is a game as follows:
- In the first turn, a player announces any one word.
- In the subsequent turns, a player announces a word that satisfies the following conditions:
- That word is no... |
Solve the programming task below in a Python markdown code block.
The Little Elephant very much loves sums on intervals.
This time he has a pair of integers l and r (l ≤ r). The Little Elephant has to find the number of such integers x (l ≤ x ≤ r), that the first digit of integer x equals the last one (in decimal not... |
Solve the programming task below in a Python markdown code block.
Chef has N subordinates. In order to complete a very important order he will choose exactly K of them. He can't choose less than K since it will be not enough to complete the order in time. On the other hand if he chooses more than K subordinates he can... |
Solve the programming task below in a Python markdown code block.
Complete the function which takes two arguments and returns all numbers which are divisible by the given divisor. First argument is an array of `numbers` and the second is the `divisor`.
## Example
```python
divisible_by([1, 2, 3, 4, 5, 6], 2) == [2, ... |
Solve the programming task below in a Python markdown code block.
For a set $S$ of integers, perform a sequence of the following operations. Note that each value in $S$ must be unique.
* insert($x$): Insert $x$ to $S$ and report the number of elements in $S$ after the operation.
* find($x$): Report the number of $x$ ... |
Solve the programming task below in a Python markdown code block.
George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.
Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have g... |
Solve the programming task below in a Python markdown code block.
We need a function (for commercial purposes) that may perform integer partitions with some constraints.
The function should select how many elements each partition should have.
The function should discard some "forbidden" values in each partition.
So, c... |
Solve the programming task below in a Python markdown code block.
You are given a permutation P_1 ... P_N of the set {1, 2, ..., N}.
You can apply the following operation to this permutation, any number of times (possibly zero):
* Choose two indices i,j (1 ≦ i < j ≦ N), such that j - i ≧ K and |P_i - P_j| = 1. Then,... |
Solve the programming task below in a Python markdown code block.
Bob is a competitive programmer. He wants to become red, and for that he needs a strict training regime. He went to the annual meeting of grandmasters and asked $n$ of them how much effort they needed to reach red.
"Oh, I just spent $x_i$ hours solving... |
Solve the programming task below in a Python markdown code block.
Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of b consecutive cells. No cell can be part of two ships, however, the ships can touch each other.
Galya doesn't know t... |
Solve the programming task below in a Python markdown code block.
Takahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.
The bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)
Assuming that nothing other than the interest affects Takahashi... |
Solve the programming task below in a Python markdown code block.
Create a program that will return whether an input value is a str, int, float, or bool. Return the name of the value.
### Examples
- Input = 23 --> Output = int
- Input = 2.3 --> Output = float
- Input = "Hello" --> Output = str
- Input = True --> Outp... |
Solve the programming task below in a Python markdown code block.
It is known that there are k fish species in the polar ocean, numbered from 1 to k. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the i-th type of fish be w_{i}, then 0 < w_1 ≤ w_2 ≤ ... ≤ w_{k} h... |
Solve the programming task below in a Python markdown code block.
~~~if-not:java
You have to code a function **getAllPrimeFactors** wich take an integer as parameter and return an array containing its prime decomposition by ascending factors, if a factors appears multiple time in the decomposition it should appear as ... |
Solve the programming task below in a Python markdown code block.
Given are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ).
Consider a sequence A satisfying the following conditions:
- A is a sequence of N positive integers.
- 1 \leq A_1 \leq A_2 \le \cdots \leq A_N \leq M.
Let us ... |
Solve the programming task below in a Python markdown code block.
There is a sequence of colorful stones. The color of each stone is one of red, green, or blue. You are given a string s. The i-th (1-based) character of s represents the color of the i-th stone. If the character is "R", "G", or "B", the color of the cor... |
Solve the programming task below in a Python markdown code block.
Polycarpus is a system administrator. There are two servers under his strict guidance — a and b. To stay informed about the servers' performance, Polycarpus executes commands "ping a" and "ping b". Each ping command sends exactly ten packets to the serv... |
Solve the programming task below in a Python markdown code block.
*This kata is inspired by [Project Euler Problem #387](https://projecteuler.net/problem=387)*
---
A [Harshad number](https://en.wikipedia.org/wiki/Harshad_number) (or Niven number) is a number that is divisible by the sum of its digits. A *right trunc... |
Solve the programming task below in a Python markdown code block.
DZY has a hash table with p buckets, numbered from 0 to p - 1. He wants to insert n numbers, in the order they are given, into the hash table. For the i-th number x_{i}, DZY will put it into the bucket numbered h(x_{i}), where h(x) is the hash function.... |
Solve the programming task below in a Python markdown code block.
Problem
A graph is given in which N vertices, each numbered from 1 to N, are connected by N-1 undirected edges. For each vertex, output the shortest number of steps to start from that vertex and visit all vertices.
However, one step is to follow one s... |
Solve the programming task below in a Python markdown code block.
A number is called 2050-number if it is $2050$, $20500$, ..., ($2050 \cdot 10^k$ for integer $k \ge 0$).
Given a number $n$, you are asked to represent $n$ as the sum of some (not necessarily distinct) 2050-numbers. Compute the minimum number of 2050-n... |
Solve the programming task below in a Python markdown code block.
You've got table a, consisting of n rows, numbered from 1 to n. The i-th line of table a contains ci cells, at that for all i (1 < i ≤ n) holds ci ≤ ci - 1.
Let's denote s as the total number of cells of table a, that is, <image>. We know that each ce... |
Solve the programming task below in a Python markdown code block.
Permutation p is an ordered set of integers p_1, p_2, ..., p_{n}, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as p_{i}. We'll call number n the size or the length of permut... |
Solve the programming task below in a Python markdown code block.
Ikta loves fast programs. Recently, I'm trying to speed up the division program. However, it doesn't get much faster, so I thought it would be better to make it faster only for "common sense and typical" inputs. The problem Ikta is trying to solve is as... |
Solve the programming task below in a Python markdown code block.
Tokitsukaze and CSL are playing a little game of stones.
In the beginning, there are n piles of stones, the i-th pile of which has a_i stones. The two players take turns making moves. Tokitsukaze moves first. On each turn the player chooses a nonempty ... |
Solve the programming task below in a Python markdown code block.
The marmots need to prepare k problems for HC^2 over n days. Each problem, once prepared, also has to be printed.
The preparation of a problem on day i (at most one per day) costs a_{i} CHF, and the printing of a problem on day i (also at most one per ... |
Solve the programming task below in a Python markdown code block.
Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of $360$ degrees and a pointer which i... |
Solve the programming task below in a Python markdown code block.
Xenia the beginner programmer has a sequence a, consisting of 2^{n} non-negative integers: a_1, a_2, ..., a_2^{n}. Xenia is currently studying bit operations. To better understand how they work, Xenia decided to calculate some value v for a.
Namely, it... |
Solve the programming task below in a Python markdown code block.
You are given an array of integers $b_1, b_2, \ldots, b_n$.
An array $a_1, a_2, \ldots, a_n$ of integers is hybrid if for each $i$ ($1 \leq i \leq n$) at least one of these conditions is true:
$b_i = a_i$, or
$b_i = \sum_{j=1}^{i} a_j$.
Find the num... |
Solve the programming task below in a Python markdown code block.
There is a box containing N balls. The i-th ball has the integer A_i written on it. Snuke can perform the following operation any number of times:
* Take out two balls from the box. Then, return them to the box along with a new ball, on which the absol... |
Solve the programming task below in a Python markdown code block.
It's March and you just can't seem to get your mind off brackets. However, it is not due to basketball. You need to extract statements within strings that are contained within brackets.
You have to write a function that returns a list of statements tha... |
Solve the programming task below in a Python markdown code block.
Let's define a function $f(x)$ ($x$ is a positive integer) as follows: write all digits of the decimal representation of $x$ backwards, then get rid of the leading zeroes. For example, $f(321) = 123$, $f(120) = 21$, $f(1000000) = 1$, $f(111) = 111$.
Le... |
Solve the programming task below in a Python markdown code block.
You are playing another computer game, and now you have to slay $n$ monsters. These monsters are standing in a circle, numbered clockwise from $1$ to $n$. Initially, the $i$-th monster has $a_i$ health.
You may shoot the monsters to kill them. Each sho... |
Solve the programming task below in a Python markdown code block.
There is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region.
The front and back sides of these cards can be distinguished, a... |
Solve the programming task below in a Python markdown code block.
Sergey is testing a next-generation processor. Instead of bytes the processor works with memory cells consisting of n bits. These bits are numbered from 1 to n. An integer is stored in the cell in the following way: the least significant bit is stored i... |
Solve the programming task below in a Python markdown code block.
Vasilisa the Wise from a far away kingdom got a present from her friend Helga the Wise from a farther away kingdom. The present is a surprise box, yet Vasilisa the Wise doesn't know yet what the surprise actually is because she cannot open the box. She ... |
Solve the programming task below in a Python markdown code block.
You are given a positive integer L in base two.
How many pairs of non-negative integers (a, b) satisfy the following conditions?
- a + b \leq L
- a + b = a \mbox{ XOR } b
Since there can be extremely many such pairs, print the count modulo 10^9 + 7.
... |
Solve the programming task below in a Python markdown code block.
You are required to create a simple calculator that returns the result of addition, subtraction, multiplication or division of two numbers.
Your function will accept three arguments:
The first and second argument should be numbers.
The third argument s... |
Solve the programming task below in a Python markdown code block.
## Task
In this kata you'll be given a string of English digits "collapsed" together, like this:
`zeronineoneoneeighttwoseventhreesixfourtwofive`
Your task is to split the string back to digits:
`zero nine one one eight two seven three six four two f... |
Solve the programming task below in a Python markdown code block.
You are given two strings $s$ and $t$ both of length $2$ and both consisting only of characters 'a', 'b' and 'c'.
Possible examples of strings $s$ and $t$: "ab", "ca", "bb".
You have to find a string $res$ consisting of $3n$ characters, $n$ characters... |
Solve the programming task below in a Python markdown code block.
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y)... |
Solve the programming task below in a Python markdown code block.
Anna is a girl so brave that she is loved by everyone in the city and citizens love her cookies. She is planning to hold a party with cookies. Now she has $a$ vanilla cookies and $b$ chocolate cookies for the party.
She invited $n$ guests of the first ... |
Solve the programming task below in a Python markdown code block.
First-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most talented students in this university. The education is not easy because you need to have fundamental knowledge in different areas, which someti... |
Solve the programming task below in a Python markdown code block.
Mr. Chanek The Ninja is one day tasked with a mission to handle mad snakes that are attacking a site. Now, Mr. Chanek already arrived at the hills where the destination is right below these hills. The mission area can be divided into a grid of size 1000... |
Solve the programming task below in a Python markdown code block.
Given is an integer N. Find the minimum possible positive integer k such that (1+2+\cdots+k) is a multiple of N. It can be proved that such a positive integer k always exists.
Constraints
* 1 \leq N \leq 10^{15}
* All values in input are integers.
In... |
Solve the programming task below in a Python markdown code block.
Bishwock is a chess figure that consists of three squares resembling an "L-bar". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states:
XX XX .X X.
X. .X XX XX
Bishwocks don't attack any squares a... |
Solve the programming task below in a Python markdown code block.
This is the harder version of the problem. In this version, $1 \le n \le 10^6$ and $0 \leq a_i \leq 10^6$. You can hack this problem if you locked it. But you can hack the previous problem only if you locked both problems
Christmas is coming, and our p... |
Solve the programming task below in a Python markdown code block.
There are N people. The name of the i-th person is S_i.
We would like to choose three people so that the following conditions are met:
- The name of every chosen person begins with M, A, R, C or H.
- There are no multiple people whose names begin with... |
Solve the programming task below in a Python markdown code block.
There are many caves deep in mountains found in the countryside. In legend, each cave has a treasure hidden within the farthest room from the cave's entrance. The Shogun has ordered his Samurais to explore these caves with Karakuri dolls (robots) and to... |
Solve the programming task below in a Python markdown code block.
Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph.
There are n vertices in the tree, each of them is painted black or white. Anton doesn't like multicolored trees, so he wants to change the tree... |
Solve the programming task below in a Python markdown code block.
This is the hard version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.
You are given a binary table of size n × m... |
Solve the programming task below in a Python markdown code block.
A flowerbed has many flowers and two fountains.
You can adjust the water pressure and set any values r_1(r_1 ≥ 0) and r_2(r_2 ≥ 0), giving the distances at which the water is spread from the first and second fountain respectively. You have to set such ... |
Solve the programming task below in a Python markdown code block.
I conducted an exit poll of the shopping amount at a department store. Create a program that takes the shopping amount data as input, calculates the average shopping amount per person, and outputs it. The number of people surveyed shall be 100,000 or le... |
Solve the programming task below in a Python markdown code block.
Description
In English we often use "neutral vowel sounds" such as "umm", "err", "ahh" as fillers in conversations to help them run smoothly.
Bob always finds himself saying "err". Infact he adds an "err" to every single word he says that ends in a co... |
Solve the programming task below in a Python markdown code block.
Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.
Let the current time be time 0. Kizahashi has N jobs numbered 1 to N.
It takes A_i units of time ... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Chef and his little brother are playing with sticks. They have total N sticks. Length of i-th stick is A_{i}.
Chef asks his brother to choose any four sticks and to make a ... |
Solve the programming task below in a Python markdown code block.
The number 81 has a special property, a certain power of the sum of its digits is equal to 81 (nine squared). Eighty one (81), is the first number in having this property (not considering numbers of one digit).
The next one, is 512.
Let's see both case... |
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... |
Solve the programming task below in a Python markdown code block.
Summer vacation ended at last and the second semester has begun. You, a Kyoto University student, came to university and heard a rumor that somebody will barricade the entrance of your classroom. The barricade will be built just before the start of the ... |
Solve the programming task below in a Python markdown code block.
Takahashi has N blue cards and M red cards.
A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i.
Takahashi will now announce a string, and then check every card. Each time... |
Solve the programming task below in a Python markdown code block.
Theofanis started playing the new online game called "Among them". However, he always plays with Cypriot players, and they all have the same name: "Andreas" (the most common name in Cyprus).
In each game, Theofanis plays with $n$ other players. Since t... |
Solve the programming task below in a Python markdown code block.
Xenia the programmer has a tree consisting of n nodes. We will consider the tree nodes indexed from 1 to n. We will also consider the first node to be initially painted red, and the other nodes — to be painted blue.
The distance between two tree nodes ... |
Solve the programming task below in a Python markdown code block.
Problem
One day, Kawabayashi is about to have lunch at the school cafeteria. There are three types of daily lunch menus for school cafeterias: A lunch, B lunch, and C lunch.
Kawabayashi is a glutton, so I would like to eat all three types of daily lunc... |
Solve the programming task below in a Python markdown code block.
The neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and people who enter the platform can use the chairs freely.
The Ba... |
Solve the programming task below in a Python markdown code block.
Problem
You decide to play a weird game with your friend A, who loves gathering.
Given a set S of non-negative integers consisting of n elements that can be duplicated. Each element contained in the set S is a non-negative pi-ary number. With Steps 1 ... |
Solve the programming task below in a Python markdown code block.
Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond to weekdays, and cells contain dates. For example, a calenda... |
Solve the programming task below in a Python markdown code block.
Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being made of a very large number of bricks, numbered 1, 2, 3 and so on.
Iahub has the following scheme of... |
Solve the programming task below in a Python markdown code block.
Zibi is a competitive programming coach. There are $n$ competitors who want to be prepared well. The training contests are quite unusual – there are two people in a team, two problems, and each competitor will code exactly one of them. Of course, people... |
Solve the programming task below in a Python markdown code block.
Write a program that extracts n different numbers from the numbers 0 to 9 and outputs the number of combinations that add up to s. Each n number is from 0 to 9, and the same number cannot be used in one combination. For example, if n is 3 and s is 6, th... |
Solve the programming task below in a Python markdown code block.
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway network of n stations, enumerated from 1 through n. The train occupies one station at a time and travels around the network of stations in a circular manner. M... |
Solve the programming task below in a Python markdown code block.
Given an integer N, Chef wants to find the smallest positive integer M such that the bitwise XOR of M and M+1 is N. If no such M exists output -1.
-----Input-----
The first line of input contain an integer T denoting the number of test cases. Each of t... |
Solve the programming task below in a Python markdown code block.
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.
He looks at the first two students and gives more toffees to the student ... |
Solve the programming task below in a Python markdown code block.
Read problems statements in Mandarin Chinese , Russian and Vietnamese
Churu is taking the course called “Introduction to Data Structures”. Yesterday, he learned how to use a stack to check is a given parentheses expression is balanced or not. He find... |
Solve the programming task below in a Python markdown code block.
We have N switches with "on" and "off" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.
Bulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that... |
Solve the programming task below in a Python markdown code block.
Chef loves to play with arrays by himself. Today, he has an array A consisting of N distinct integers. He wants to perform the following operation on his array A.
- Select a pair of adjacent integers and remove the larger one of these two. This decreas... |
Solve the programming task below in a Python markdown code block.
For he knew every Who down in Whoville beneath, Was busy now, hanging a mistletoe wreath. "And they're hanging their stockings!" he snarled with a sneer, "Tomorrow is Christmas! It's practically here!"
Dr. Suess, How The Grinch Stole Christmas
Christm... |
Solve the programming task below in a Python markdown code block.
A group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are $\frac{n \cdot(n - 1)}{2}$ roads in total. It takes exactly y seconds to traverse any single road.
A spanning tree is a set o... |
Solve the programming task below in a Python markdown code block.
Dima overslept the alarm clock, which was supposed to raise him to school.
Dima wonders if he will have time to come to the first lesson. To do this, he needs to know the minimum time it will take him to get from home to school.
The city where Dima li... |
Solve the programming task below in a Python markdown code block.
Note that the memory limit is unusual.
You are given a multiset consisting of n integers. You have to process queries of two types:
* add integer k into the multiset;
* find the k-th order statistics in the multiset and remove it.
k-th order ... |
Solve the programming task below in a Python markdown code block.
SIHanatsuka - EMber SIHanatsuka - ATONEMENT
Back in time, the seven-year-old Nora used to play lots of games with her creation ROBO_Head-02, both to have fun and enhance his abilities.
One day, Nora's adoptive father, Phoenix Wyle, brought Nora $n$ bo... |
Solve the programming task below in a Python markdown code block.
While surfing in web I found interesting math problem called "Always perfect". That means if you add 1 to the product of four consecutive numbers the answer is ALWAYS a perfect square.
For example we have: 1,2,3,4 and the product will be 1X2X3X4=24. If ... |
Solve the programming task below in a Python markdown code block.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters... |
Solve the programming task below in a Python markdown code block.
Write a method that returns true if a given parameter is a power of 4, and false if it's not. If parameter is not an Integer (eg String, Array) method should return false as well.
(In C# Integer means all integer Types like Int16,Int32,.....)
### Exam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.