Dataset Viewer
Auto-converted to Parquet Duplicate
prob_desc_description
stringlengths
63
3.8k
clean_tags
stringclasses
57 values
labels
stringclasses
57 values
Thanks to the Doctor's help, the rebels managed to steal enough gold to launch a full-scale attack on the Empire! However, Darth Vader is looking for revenge and wants to take back his gold.The rebels have hidden the gold in various bases throughout the galaxy. Darth Vader and the Empire are looking to send out their s...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
Professor Dumbledore is helping Harry destroy the Horcruxes. He went to Gaunt Shack as he suspected a Horcrux to be present there. He saw Marvolo Gaunt's Ring and identified it as a Horcrux. Although he destroyed it, he is still affected by its curse. Professor Snape is helping Dumbledore remove the curse. For this, he...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Is it rated?Here it is. The Ultimate Question of Competitive Programming, Codeforces, and Everything. And you are here to answer it.Another Codeforces round has been conducted. No two participants have the same number of points. For each participant, from the top to the bottom of the standings, their rating before and ...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an elevator in one of its other hotels. The elevator is special β€” it starts on the top floor, can only move down, and has infinite capacity. Floors are numbered from 0 to s and elevator initially starts on floor s...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
You are given two integers $$$n$$$ and $$$k$$$.You should create an array of $$$n$$$ positive integers $$$a_1, a_2, \dots, a_n$$$ such that the sum $$$(a_1 + a_2 + \dots + a_n)$$$ is divisible by $$$k$$$ and maximum element in $$$a$$$ is minimum possible.What is the minimum possible maximum element in $$$a$$$?
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
You are given string $$$s$$$ of length $$$n$$$ consisting of 0-s and 1-s. You build an infinite string $$$t$$$ as a concatenation of an infinite number of strings $$$s$$$, or $$$t = ssss \dots$$$ For example, if $$$s =$$$ 10010, then $$$t =$$$ 100101001010010...Calculate the number of prefixes of $$$t$$$ with balance e...
['math', 'strings']
[0, 0, 0, 1, 0, 0, 1, 0]
Vasya has his favourite number $$$n$$$. He wants to split it to some non-zero digits. It means, that he wants to choose some digits $$$d_1, d_2, \ldots, d_k$$$, such that $$$1 \leq d_i \leq 9$$$ for all $$$i$$$ and $$$d_1 + d_2 + \ldots + d_k = n$$$.Vasya likes beauty in everything, so he wants to find any solution wit...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
Alice has written a program and now tries to improve its readability. One of the ways to improve readability is to give sensible names to the variables, so now Alice wants to rename some variables in her program. In her IDE there is a command called "massive refactoring", which can replace names of many variable in jus...
['strings']
[0, 0, 0, 0, 0, 0, 1, 0]
Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x that a ≀ x ≀ b and x is divisible by k.
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
Berland crossword is a puzzle that is solved on a square grid with $$$n$$$ rows and $$$n$$$ columns. Initially all the cells are white.To solve the puzzle one has to color some cells on the border of the grid black in such a way that: exactly $$$U$$$ cells in the top row are black; exactly $$$R$$$ cells in the right...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other.Help Timofey to color his rectangles in 4 different c...
['geometry']
[0, 1, 0, 0, 0, 0, 0, 0]
Given a cyclic array $$$a$$$ of size $$$n$$$, where $$$a_i$$$ is the value of $$$a$$$ in the $$$i$$$-th position, there may be repeated values. Let us define that a permutation of $$$a$$$ is equal to another permutation of $$$a$$$ if and only if their values are the same for each position $$$i$$$ or we can transform th...
['math', 'number theory', 'probabilities']
[0, 0, 0, 1, 1, 1, 0, 0]
Sam lives in Awesomeburg, its downtown has a triangular shape. Also, the following is true about the triangle: its vertices have integer coordinates, the coordinates of vertices are non-negative, and its vertices are not on a single line. He calls a point on the downtown's border (that is the border of the triangle)...
['geometry']
[0, 1, 0, 0, 0, 0, 0, 0]
Ilya is working for the company that constructs robots. Ilya writes programs for entertainment robots, and his current project is "Bob", a new-generation game robot. Ilya's boss wants to know his progress so far. Especially he is interested if Bob is better at playing different games than the previous model, "Alice". S...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers from 1 to n, not necessarily distinct. Then he picked some sequence f1, f2, ..., fn of length n an...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the swamp is very difficult, so people tramped exactly n - 1 paths. Each of these paths connects some pair of settlements and is bidirectional. Moreover, it is possible to r...
['trees']
[0, 0, 0, 0, 0, 0, 0, 1]
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
['strings']
[0, 0, 0, 0, 0, 0, 1, 0]
You are given an array $$$A$$$, consisting of $$$n$$$ positive integers $$$a_1, a_2, \dots, a_n$$$, and an array $$$B$$$, consisting of $$$m$$$ positive integers $$$b_1, b_2, \dots, b_m$$$. Choose some element $$$a$$$ of $$$A$$$ and some element $$$b$$$ of $$$B$$$ such that $$$a+b$$$ doesn't belong to $$$A$$$ and doesn...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
One drew a closed polyline on a plane, that consisted only of vertical and horizontal segments (parallel to the coordinate axes). The segments alternated between horizontal and vertical ones (a horizontal segment was always followed by a vertical one, and vice versa). The polyline did not contain strict self-intersecti...
['geometry']
[0, 1, 0, 0, 0, 0, 0, 0]
You are given an integer $$$n$$$. You have to construct a permutation of size $$$n$$$.A permutation is an array where each integer from $$$1$$$ to $$$s$$$ (where $$$s$$$ is the size of permutation) occurs exactly once. For example, $$$[2, 1, 4, 3]$$$ is a permutation of size $$$4$$$; $$$[1, 2, 4, 5, 3]$$$ is a permutat...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
You are given a chess board with $$$n$$$ rows and $$$n$$$ columns. Initially all cells of the board are empty, and you have to put a white or a black knight into each cell of the board.A knight is a chess piece that can attack a piece in cell ($$$x_2$$$, $$$y_2$$$) from the cell ($$$x_1$$$, $$$y_1$$$) if one of the fol...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Someone give a strange birthday present to Ivan. It is hedgehogΒ β€” connected undirected graph in which one vertex has degree at least $$$3$$$ (we will call it center) and all other vertices has degree 1. Ivan thought that hedgehog is too boring and decided to make himself $$$k$$$-multihedgehog.Let us define $$$k$$$-mult...
['graphs', 'trees']
[0, 0, 1, 0, 0, 0, 0, 1]
a is an array of n positive integers, all of which are not greater than n.You have to process q queries to this array. Each query is represented by two numbers p and k. Several operations are performed in each query; each operation changes p to p + ap + k. There operations are applied until p becomes greater than n. Th...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≀ si ≀ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
You are given the following concurrent program. There are N processes and the i-th process has the following pseudocode: repeat ni times yi := y y := yi + 1end repeatHere y is a shared variable. Everything else is local for the process. All actions on a given row are atomic, i.e. when the process starts executing...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
One day Jeff got hold of an integer sequence a1, a2, ..., an of length n. The boy immediately decided to analyze the sequence. For that, he needs to find all values of x, for which these conditions hold: x occurs in sequence a. Consider all positions of numbers x in the sequence a (such i, that ai = x). These numbers...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Consider an n × m grid. Initially all the cells of the grid are colored white. Lenny has painted some of the cells (at least one) black. We call a painted grid convex if one can walk from any black cell to any another black cell using a path of side-adjacent black cells changing his direction at most once during the pa...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
You are given a matrix $$$a$$$ of size $$$n \times m$$$ consisting of integers.You can choose no more than $$$\left\lfloor\frac{m}{2}\right\rfloor$$$ elements in each row. Your task is to choose these elements in such a way that their sum is divisible by $$$k$$$ and this sum is the maximum.In other words, you can choos...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
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 , where p is the product of all integers on the given array, s is their sum, and k is a given constant for all s...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
There are $$$n$$$ astronauts working on some space station. An astronaut with the number $$$i$$$ ($$$1 \le i \le n$$$) has power $$$a_i$$$.An evil humanoid has made his way to this space station. The power of this humanoid is equal to $$$h$$$. Also, the humanoid took with him two green serums and one blue serum.In one ...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Let's call an undirected graph of n vertices p-interesting, if the following conditions fulfill: the graph contains exactly 2n + p edges; the graph doesn't contain self-loops and multiple edges; for any integer k (1 ≀ k ≀ n), any subgraph consisting of k vertices contains at most 2k + p edges. A subgraph of a graph...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
Let's call the roundness of the number the number of zeros to which it ends.You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers will be maximum possible.
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
Polycarp analyzes the prices of the new berPhone. At his disposal are the prices for $$$n$$$ last days: $$$a_1, a_2, \dots, a_n$$$, where $$$a_i$$$ is the price of berPhone on the day $$$i$$$.Polycarp considers the price on the day $$$i$$$ to be bad if later (that is, a day with a greater number) berPhone was sold at a...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
You are given an undirected connected graph consisting of n vertices and m edges. There are no loops and no multiple edges in the graph.You are also given two distinct vertices s and t, and two values ds and dt. Your task is to build any spanning tree of the given graph (note that the graph is not weighted), such that ...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.Limak will repeat the following operation till everything is destroyed.Block is called internal if it ha...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
Consider a sequence [a1, a2, ... , an]. Define its prefix product sequence .Now given n, find a permutation of [1, 2, ..., n], such that its prefix product sequence is a permutation of [0, 1, ..., n - 1].
['math', 'number theory']
[0, 0, 0, 1, 1, 0, 0, 0]
The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.Let's enumerate all the houses from left to right, starting with one. A house is considered to be luxurious if the number of floors in it is strictly greater than in all t...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
Polycarp started working at a bank. He was assigned to monitor the ATM. The ATM initially contains $$$s$$$ rubles.A queue of $$$n$$$ students lined up to him. Each student wants to either withdraw a certain amount of money or deposit it into an account. If $$$a_i$$$ is positive, then the student credits that amount of ...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Pavel cooks barbecue. There are n skewers, they lay on a brazier in a row, each on one of n positions. Pavel wants each skewer to be cooked some time in every of n positions in two directions: in the one it was directed originally and in the reversed direction.Pavel has a plan: a permutation p and a sequence b1, b2, .....
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the center of the Universe and the point is calculated by the following formula: . Mu...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
Pay attention: this problem is interactive.Penguin Xoriy came up with a new game recently. He has n icicles numbered from 1 to n. Each icicle has a temperatureΒ β€” an integer from 1 to 109. Exactly two of these icicles are special: their temperature is y, while a temperature of all the others is x ≠ y. You have to find t...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
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 digits 0), and the second button shifts all the digits on the displ...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
There is a square field of size $$$n \times n$$$ in which two cells are marked. These cells can be in the same row or column.You are to mark two more cells so that they are the corners of a rectangle with sides parallel to the coordinate axes.For example, if $$$n=4$$$ and a rectangular field looks like this (there are ...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Polycarp wants to cook a soup. To do it, he needs to buy exactly $$$n$$$ liters of water.There are only two types of water bottles in the nearby shop β€” $$$1$$$-liter bottles and $$$2$$$-liter bottles. There are infinitely many bottles of these two types in the shop.The bottle of the first type costs $$$a$$$ burles and ...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
You are given the strings $$$a$$$ and $$$b$$$, consisting of lowercase Latin letters. You can do any number of the following operations in any order: if $$$|a| > 0$$$ (the length of the string $$$a$$$ is greater than zero), delete the first character of the string $$$a$$$, that is, replace $$$a$$$ with $$$a_2 a_3 ...
['strings']
[0, 0, 0, 0, 0, 0, 1, 0]
Alice lives on a flat planet that can be modeled as a square grid of size $$$n \times n$$$, with rows and columns enumerated from $$$1$$$ to $$$n$$$. We represent the cell at the intersection of row $$$r$$$ and column $$$c$$$ with ordered pair $$$(r, c)$$$. Each cell in the grid is either land or water. An example pla...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Caisa is now at home and his son has a simple task for him.Given a rooted tree with n vertices, numbered from 1 to n (vertex 1 is the root). Each vertex of the tree has a value. You should answer q queries. Each query is one of the following: Format of the query is "1 v". Let's write out the sequence of vertices along...
['math', 'number theory', 'trees']
[0, 0, 0, 1, 1, 0, 0, 1]
One unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of $$$n$$$ passwords β€” strings, consists of small Latin letters.Hacker went home and started preparin...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
You are given an array a consisting of n positive integers. You pick two integer numbers l and r from 1 to n, inclusive (numbers are picked randomly, equiprobably and independently). If l > r, then you swap values of l and r. You have to calculate the expected value of the number of unique elements in segment of the...
['math', 'probabilities']
[0, 0, 0, 1, 0, 1, 0, 0]
Parsa has a humongous tree on $$$n$$$ vertices.On each vertex $$$v$$$ he has written two integers $$$l_v$$$ and $$$r_v$$$.To make Parsa's tree look even more majestic, Nima wants to assign a number $$$a_v$$$ ($$$l_v \le a_v \le r_v$$$) to each vertex $$$v$$$ such that the beauty of Parsa's tree is maximized.Nima's sens...
['graphs', 'trees']
[0, 0, 1, 0, 0, 0, 0, 1]
A basketball competition is held where the number of players in a team does not have a maximum or minimum limit (not necessarily $$$5$$$ players in one team for each match). There are $$$N$$$ candidate players in the competition that will be trained by Pak Chanek, the best basketball coach on earth. The $$$i$$$-th cand...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
$$$n$$$ students attended the first meeting of the Berland SU programming course ($$$n$$$ is even). All students will be divided into two groups. Each group will be attending exactly one lesson each week during one of the five working days (Monday, Tuesday, Wednesday, Thursday and Friday), and the days chosen for the g...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Sereja has a bracket sequence s1, s2, ..., sn, or, in other words, a string s of length n, consisting of characters "(" and ")".Sereja needs to answer m queries, each of them is described by two integers li, ri (1 ≀ li ≀ ri ≀ n). The answer to the i-th query is the length of the maximum correct bracket subsequence of s...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
You are given a matrix f with 4 rows and n columns. Each element of the matrix is either an asterisk (*) or a dot (.).You may perform the following operation arbitrary number of times: choose a square submatrix of f with size k × k (where 1 ≀ k ≀ 4) and replace each element of the chosen submatrix with a dot. Choosing ...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
You are given a string, consisting of lowercase Latin letters.A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $$$(1, 2)$$$ β€” "ab" and $$$(2, 3)$$$ β€” "ba". Letters 'a' and 'z' aren't considere...
['strings']
[0, 0, 0, 0, 0, 0, 1, 0]
You are given an integer $$$n$$$ and an integer $$$k$$$.In one step you can do one of the following moves: decrease $$$n$$$ by $$$1$$$; divide $$$n$$$ by $$$k$$$ if $$$n$$$ is divisible by $$$k$$$. For example, if $$$n = 27$$$ and $$$k = 3$$$ you can do the following steps: $$$27 \rightarrow 26 \rightarrow 25 \right...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
By the age of three Smart Beaver mastered all arithmetic operations and got this summer homework from the amazed teacher:You are given a sequence of integers a1, a2, ..., an. Your task is to perform on it m consecutive operations of the following type: For given numbers xi and vi assign value vi to element axi. For g...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem:There are two arrays of integers $$$a$$$ and $$$b$$$ of length $$$n$$$. It turned out that array $$$a$$$ contains only elements from the set $$$\{-1, 0, 1\}$$$.Anton can perform the following sequence of o...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Two integer sequences existed initially β€” one of them was strictly increasing, and the other one β€” strictly decreasing.Strictly increasing sequence is a sequence of integers $$$[x_1 < x_2 < \dots < x_k]$$$. And strictly decreasing sequence is a sequence of integers $$$[y_1 > y_2 > \dots > y_l]$$$. Not...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Andrew loves the sea. That's why, at the height of the summer season, he decided to go to the beach, taking a sunbed with him to sunbathe.The beach is a rectangular field with $$$n$$$ rows and $$$m$$$ columns. Some cells of the beach are free, some have roads, stones, shops and other non-movable objects. Some of two ad...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two ele...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
This is the hard version of the problem. The only difference is that in this version $$$n \leq 200000$$$. You can make hacks only if both versions of the problem are solved.There are $$$n$$$ potions in a line, with potion $$$1$$$ on the far left and potion $$$n$$$ on the far right. Each potion will increase your health...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
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 statistics in the multiset is the $$$k$$$-th element in t...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Today we will be playing a red and white colouring game (no, this is not the Russian Civil War; these are just the colours of the Canadian flag).You are given an $$$n \times m$$$ grid of "R", "W", and "." characters. "R" is red, "W" is white and "." is blank. The neighbours of a cell are those that share an edge with i...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Note that the memory limit in this problem is lower than in others.You have a vertical strip with $$$n$$$ cells, numbered consecutively from $$$1$$$ to $$$n$$$ from top to bottom.You also have a token that is initially placed in cell $$$n$$$. You will move the token up until it arrives at cell $$$1$$$.Let the token be ...
['math', 'number theory']
[0, 0, 0, 1, 1, 0, 0, 0]
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
['strings']
[0, 0, 0, 0, 0, 0, 1, 0]
Diana loves playing with numbers. She's got $$$n$$$ cards with positive integer numbers $$$a_i$$$ written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards and multiplies all the numbers $$$a_i$$$ written on them.Diana is happy when the product of the numb...
['math', 'number theory']
[0, 0, 0, 1, 1, 0, 0, 0]
You are given an unweighted tree with n vertices. Then n - 1 following operations are applied to the tree. A single operation consists of the following steps: choose two leaves; add the length of the simple path between them to the answer; remove one of the chosen leaves from the tree. Initial answer (before applyi...
['graphs', 'trees']
[0, 0, 1, 0, 0, 0, 0, 1]
Frodo was caught by Saruman. He tore a pouch from Frodo's neck, shook out its contentsΒ β€”there was a pile of different rings: gold and silver..."How am I to tell which is the One?!" the mage howled."Throw them one by one into the Cracks of Doom and watch when Mordor falls!" Somewhere in a parallel Middle-earth, when Sa...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
The Kingdom of Kremland is a tree (a connected undirected graph without cycles) consisting of $$$n$$$ vertices. Each vertex $$$i$$$ has its own value $$$a_i$$$. All vertices are connected in series by edges. Formally, for every $$$1 \leq i < n$$$ there is an edge between the vertices of $$$i$$$ and $$$i+1$$$.Denote ...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
Treeland is a country in which there are n towns connected by n - 1 two-way road such that it's possible to get from any town to any other town. In Treeland there are 2k universities which are located in different towns. Recently, the president signed the decree to connect universities by high-speed network.The Ministr...
['graphs', 'trees']
[0, 0, 1, 0, 0, 0, 0, 1]
Vasya has become interested in wrestling. In wrestling wrestlers use techniques for which they are awarded points by judges. The wrestler who gets the most points wins.When the numbers of points of both wrestlers are equal, the wrestler whose sequence of points is lexicographically greater, wins.If the sequences of the...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
This is an interactive problem.There exists a matrix $$$a$$$ of size $$$n \times m$$$ ($$$n$$$ rows and $$$m$$$ columns), you know only numbers $$$n$$$ and $$$m$$$. The rows of the matrix are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and columns of the matrix are numbered from $$$1$$$ to $$$m$$$ from left to...
['number theory']
[0, 0, 0, 0, 1, 0, 0, 0]
This is an interactive problem!Nastia has a hidden permutation $$$p$$$ of length $$$n$$$ consisting of integers from $$$1$$$ to $$$n$$$. You, for some reason, want to figure out the permutation. To do that, you can give her an integer $$$t$$$ ($$$1 \le t \le 2$$$), two different indices $$$i$$$ and $$$j$$$ ($$$1 \le i,...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without visiting other cities between them, a great disaster awaits him. Overall there ar...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $$$0$$$ are not allowed).Let's cons...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Eshag has an array $$$a$$$ consisting of $$$n$$$ integers.Eshag can perform the following operation any number of times: choose some subsequence of $$$a$$$ and delete every element from it which is strictly larger than $$$AVG$$$, where $$$AVG$$$ is the average of the numbers in the chosen subsequence.For example, if $$...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
Xenia the horse breeder has n (n > 1) horses that stand in a row. Each horse has its own unique number. Initially, the i-th left horse has number i. That is, the sequence of numbers of horses in a row looks as follows (from left to right): 1, 2, 3, ..., n.Xenia trains horses before the performance. During the practi...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Bob wants to put a new bargaining table in his office. To do so he measured the office room thoroughly and drew its plan: Bob's office room is a rectangular room n × m meters. Each square meter of the room is either occupied by some furniture, or free. A bargaining table is rectangular, and should be placed so, that it...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
It's another Start[c]up finals, and that means there is pizza to order for the onsite contestants. There are only 2 types of pizza (obviously not, but let's just pretend for the sake of the problem), and all pizzas contain exactly S slices.It is known that the i-th contestant will eat si slices of pizza, and gain ai ha...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
You are given a positive integer $$$n$$$ greater or equal to $$$2$$$. For every pair of integers $$$a$$$ and $$$b$$$ ($$$2 \le |a|, |b| \le n$$$), you can transform $$$a$$$ into $$$b$$$ if and only if there exists an integer $$$x$$$ such that $$$1 < |x|$$$ and ($$$a \cdot x = b$$$ or $$$b \cdot x = a$$$), where $$$|...
['graphs', 'math']
[0, 0, 1, 1, 0, 0, 0, 0]
Let's call an array $$$a$$$ of $$$m$$$ integers $$$a_1, a_2, \ldots, a_m$$$ Decinc if $$$a$$$ can be made increasing by removing a decreasing subsequence (possibly empty) from it. For example, if $$$a = [3, 2, 4, 1, 5]$$$, we can remove the decreasing subsequence $$$[a_1, a_4]$$$ from $$$a$$$ and obtain $$$a = [2, 4, 5...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Young boy Artem tries to paint a picture, and he asks his mother Medina to help him. Medina is very busy, that's why she asked for your help.Artem wants to paint an $$$n \times m$$$ board. Each cell of the board should be colored in white or black. Lets $$$B$$$ be the number of black cells that have at least one white ...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
The Central Company has an office with a sophisticated security system. There are $$$10^6$$$ employees, numbered from $$$1$$$ to $$$10^6$$$.The security system logs entrances and departures. The entrance of the $$$i$$$-th employee is denoted by the integer $$$i$$$, while the departure of the $$$i$$$-th employee is deno...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
There is a trampoline park with $$$n$$$ trampolines in a line. The $$$i$$$-th of which has strength $$$S_i$$$.Pekora can jump on trampolines in multiple passes. She starts the pass by jumping on any trampoline of her choice. If at the moment Pekora jumps on trampoline $$$i$$$, the trampoline will launch her to position...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Everybody knows that the $$$m$$$-coder Tournament will happen soon. $$$m$$$ schools participate in the tournament, and only one student from each school participates.There are a total of $$$n$$$ students in those schools. Before the tournament, all students put their names and the names of their schools into the Techno...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovna gave him a new one, that is much harder.Let's denote a flip operation of an integer as follows: number is considered i...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
Your favorite music streaming platform has formed a perfectly balanced playlist exclusively for you. The playlist consists of $$$n$$$ tracks numbered from $$$1$$$ to $$$n$$$. The playlist is automatic and cyclic: whenever track $$$i$$$ finishes playing, track $$$i+1$$$ starts playing automatically; after track $$$n$$$ ...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Oh no, on the first exam Madoka got this hard problem:Given integer $$$n$$$ and $$$m$$$ pairs of integers ($$$v_i, u_i$$$). Also there is an array $$$b_1, b_2, \ldots, b_n$$$, initially filled with zeros.Then for each index $$$i$$$, where $$$1 \leq i \leq m$$$, perform either $$$b_{v_i} := b_{v_i} - 1$$$ and $$$b_{u_i}...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
You are given a string $$$s$$$ consisting only of first $$$20$$$ lowercase Latin letters ('a', 'b', ..., 't').Recall that the substring $$$s[l; r]$$$ of the string $$$s$$$ is the string $$$s_l s_{l + 1} \dots s_r$$$. For example, the substrings of "codeforces" are "code", "force", "f", "for", but not "coder" and "top"....
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Gildong recently learned how to find the longest increasing subsequence (LIS) in $$$O(n\log{n})$$$ time for a sequence of length $$$n$$$. He wants to test himself if he can implement it correctly, but he couldn't find any online judges that would do it (even though there are actually many of them). So instead he's goin...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
Yash has recently learnt about the Fibonacci sequence and is very excited about it. He calls a sequence Fibonacci-ish if the sequence consists of at least two elements f0 and f1 are arbitrary fn + 2 = fn + 1 + fn for all n β‰₯ 0. You are given some sequence of integers a1, a2, ..., an. Your task is rearrange elements...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
You are given a functional graph. It is a directed graph, in which from each vertex goes exactly one arc. The vertices are numerated from 0 to n - 1.Graph is given as the array f0, f1, ..., fn - 1, where fi β€” the number of vertex to which goes the only arc from the vertex i. Besides you are given array with weights of ...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder).Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that.You have to answer $$...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
You are given an array $$$a$$$ of $$$n$$$ positive integers. Let $$$\text{LIS}(a)$$$ denote the length of longest strictly increasing subsequence of $$$a$$$. For example, $$$\text{LIS}([2, \underline{1}, 1, \underline{3}])$$$ = $$$2$$$. $$$\text{LIS}([\underline{3}, \underline{5}, \underline{10}, \underline{20}])$$$ ...
['math']
[0, 0, 0, 1, 0, 0, 0, 0]
There is a robot in a warehouse and $$$n$$$ packages he wants to collect. The warehouse can be represented as a coordinate grid. Initially, the robot stays at the point $$$(0, 0)$$$. The $$$i$$$-th package is at the point $$$(x_i, y_i)$$$. It is guaranteed that there are no two packages at the same point. It is also gu...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
Polycarp was recently given a set of $$$n$$$ (number $$$n$$$Β β€” even) dominoes. Each domino contains two integers from $$$1$$$ to $$$n$$$.Can he divide all the dominoes into two sets so that all the numbers on the dominoes of each set are different? Each domino must go into exactly one of the two sets.For example, if he...
['graphs']
[0, 0, 1, 0, 0, 0, 0, 0]
Everybody knows what an arithmetic progression is. Let us remind you just in case that an arithmetic progression is such sequence of numbers a1, a2, ..., an of length n, that the following condition fulfills: a2 - a1 = a3 - a2 = a4 - a3 = ... = ai + 1 - ai = ... = an - an - 1.For example, sequences [1, 5], [10], [5, 4,...
[]
[0, 0, 0, 0, 0, 0, 0, 0]
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
2