question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Problem Statement:
You are one of the organizers of Pragyan.Having worked so hard to ensure
success of the event, you are able to spot the word "pragyan" in any text.
You are given a stream of character strings and you need to output them
till you find... |
Solve the programming task below in a Python markdown code block.
Navi got a task at school to collect N stones. Each day he can collect only one stone. As N can be a very large number so it could take many days to complete the task, but then he remembers that his mother gave him a magic that can double anything (i.... |
Solve the programming task below in a Python markdown code block.
A binary string of length N is a string of N characters, where each character is either 0 or 1.
Wet Shark makes a list binStrings, consisting of all 2^N N-digit binary strings. For each string X in binStrings, Wet Shark runs a function ZeroShark(X), d... |
Solve the programming task below in a Python markdown code block.
For a string S consisting of the uppercase English letters `P` and `D`, let the doctoral and postdoctoral quotient of S be the total number of occurrences of `D` and `PD` in S as contiguous substrings. For example, if S = `PPDDP`, it contains two occurr... |
Solve the programming task below in a Python markdown code block.
You are given a polynomial of degree N with integer coefficients: f(x)=a_Nx^N+a_{N-1}x^{N-1}+...+a_0. Find all prime numbers p that divide f(x) for every integer x.
Constraints
* 0 \leq N \leq 10^4
* |a_i| \leq 10^9(0\leq i\leq N)
* a_N \neq 0
* All v... |
Solve the programming task below in a Python markdown code block.
In some other world, today is Christmas Eve.
There are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \leq i \leq N) is h_i meters.
He decides to choose K trees from these trees and decorate them with electric lights. To make t... |
Solve the programming task below in a Python markdown code block.
Alice, Bob and Charlie are playing Card Game for Three, as below:
* At first, each of the three players has a deck consisting of some number of cards. Each card has a letter `a`, `b` or `c` written on it. The orders of the cards in the decks cannot be ... |
Solve the programming task below in a Python markdown code block.
In 1862, the lord of Aizu was ordered to serve as a guardian of Kyoto. The Kyoto Shugoshoku is an important role to protect Kyoto at the end of the Edo period when security has deteriorated. You have to patrol the city by sharing it with the shogunate a... |
Solve the programming task below in a Python markdown code block.
At Aizu Shingakujuku, students are divided into classes by conducting a proficiency test when they enter the cram school. The test consists of three subjects: Mathematics, English, and Japanese, and students are divided into A, B, and C classes. The lev... |
Solve the programming task below in a Python markdown code block.
We have had record hot temperatures this summer. To avoid heat stroke, you decided to buy a quantity of drinking water at the nearby supermarket. Two types of bottled water, 1 and 0.5 liter, are on sale at respective prices there. You have a definite qu... |
Solve the programming task below in a Python markdown code block.
[0, 0]
[0, 1] [1, 1]
[0, 2] [1, 2] [2, 2]
[0, 3] [1, 3] [2, 3] [3, 3]
[0, 4] [1, 4] [2, 4] [3, 4] [4, 4]
[0, 5] [1, 5] [2, 5] [3, 5] [4, 5] [5, 5]
[0, 6] [1, 6] [2, 6] [3, 6] [4, 6] [5, 6] [6, 6]
Consider the standard set of 28 we... |
Solve the programming task below in a Python markdown code block.
The postal system in the area where Masa lives has changed a bit. In this area, each post office is numbered consecutively from 1 to a different number, and mail delivered to a post office is intended from that post office via several post offices. Deli... |
Solve the programming task below in a Python markdown code block.
Problem C: Earn Big
A group of N people is trying to challenge the following game to earn big money.
First, N participants are isolated from each other. From this point, they are not allowed to contact each other, or to leave any information for other... |
Solve the programming task below in a Python markdown code block.
Sunuke received a d-dimensional hypercube with a side length of l1 Γ ... Γ ld as a birthday present. Sunuke placed this rectangular parallelepiped so that the range of the i-th coordinate was 0 or more and li or less, and ate the part that satisfied x1 ... |
Solve the programming task below in a Python markdown code block.
Problem
There are $ M $ type characters. Use them to create a string of length $ N $. How many strings are used that have $ K $ or more? Find too much divided by $ 998244353 $.
Here, the difference between two strings of length $ N $ is defined as fol... |
Solve the programming task below in a Python markdown code block.
Find the tangent lines between a point $p$ and a circle $c$.
Constraints
* $-1,000 \leq px, py, cx, cy \leq 1,000$
* $1 \leq r \leq 1,000$
* Distance between $p$ and the center of $c$ is greater than the radius of $c$.
Input
The input is given in th... |
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 multiple elements can have equivalent values in $S$.
* insert($x$): Insert $x$ to $S$ and report the number of elements in $S$ after the operation.
* find($x$): Report... |
Solve the programming task below in a Python markdown code block.
Childan is making up a legendary story and trying to sell his forgery β a necklace with a strong sense of "Wu" to the Kasouras. But Mr. Kasoura is challenging the truth of Childan's story. So he is going to ask a few questions about Childan's so-called ... |
Solve the programming task below in a Python markdown code block.
There was an electronic store heist last night.
All keyboards which were in the store yesterday were numbered in ascending order from some integer number x. For example, if x = 4 and there were 3 keyboards in the store, then the devices had indices 4, ... |
Solve the programming task below in a Python markdown code block.
Ayoub had an array a of integers of size n and this array had two interesting properties:
* All the integers in the array were between l and r (inclusive).
* The sum of all the elements was divisible by 3.
Unfortunately, Ayoub has lost his ar... |
Solve the programming task below in a Python markdown code block.
Luckily, Serval got onto the right bus, and he came to the kindergarten on time. After coming to kindergarten, he found the toy bricks very funny.
He has a special interest to create difficult problems for others to solve. This time, with many 1 Γ 1 Γ ... |
Solve the programming task below in a Python markdown code block.
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 β 26 β 25 β 24 β 8... |
Solve the programming task below in a Python markdown code block.
In this problem, a n Γ m rectangular matrix a is called increasing if, for each row of i, when go from left to right, the values strictly increase (that is, a_{i,1}<a_{i,2}<...<a_{i,m}) and for each column j, when go from top to bottom, the values stric... |
Solve the programming task below in a Python markdown code block.
You are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 β€ i - a_i) or to the position i + a_i (if i + a_i β€ n).
For each position i from 1 to n you want to know the minimum the numb... |
Solve the programming task below in a Python markdown code block.
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared n problems; and since the platform is very popular, 998244351 coder from all over the world is going to solve them.
For each problem... |
Solve the programming task below in a Python markdown code block.
Find the minimum area of a square land on which you can place two identical rectangular a Γ b houses. The sides of the houses should be parallel to the sides of the desired square land.
Formally,
* You are given two identical rectangles with side l... |
Solve the programming task below in a Python markdown code block.
Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string s = s_1 s_2 ... s_{n} of length n where each letter is either R, S or P.
While initializing, the bot is choosing... |
Solve the programming task below in a Python markdown code block.
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. ... |
Solve the programming task below in a Python markdown code block.
The pandemic is upon us, and the world is in shortage of the most important resource: toilet paper. As one of the best prepared nations for this crisis, BubbleLand promised to help all other world nations with this valuable resource. To do that, the cou... |
Solve the programming task below in a Python markdown code block.
In the 2050 Conference, some people from the competitive programming community meet together and are going to take a photo. The n people form a line. They are numbered from 1 to n from left to right. Each of them either holds a cardboard with the letter... |
Solve the programming task below in a Python markdown code block.
There is a bus stop near the university. The lessons are over, and n students come to the stop. The i-th student will appear at the bus stop at time ti (all ti's are distinct).
We shall assume that the stop is located on the coordinate axis Ox, at poin... |
Solve the programming task below in a Python markdown code block.
In the capital city of Berland, Bertown, demonstrations are against the recent election of the King of Berland. Berland opposition, led by Mr. Ovalny, believes that the elections were not fair enough and wants to organize a demonstration at one of the s... |
Solve the programming task below in a Python markdown code block.
Paw the Spider is making a web. Web-making is a real art, Paw has been learning to do it his whole life. Let's consider the structure of the web.
<image>
There are n main threads going from the center of the web. All main threads are located in one pl... |
Solve the programming task below in a Python markdown code block.
Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.
Now Liss is on the root of the tree with th... |
Solve the programming task below in a Python markdown code block.
Little penguin Polo has an n Γ m matrix, consisting of integers. Let's index the matrix rows from 1 to n from top to bottom and let's index the columns from 1 to m from left to right. Let's represent the matrix element on the intersection of row i and c... |
Solve the programming task below in a Python markdown code block.
Let's introduce the designation <image>, where x is a string, n is a positive integer and operation " + " is the string concatenation operation. For example, [abc, 2] = abcabc.
We'll say that string s can be obtained from string t, if we can remove som... |
Solve the programming task below in a Python markdown code block.
Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix a with n lines and m columns. Let number a[i][j] represents the calories burned by performing workout at the ce... |
Solve the programming task below in a Python markdown code block.
Twilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing. Having returned to the castle, Twilight Sparkle became interested in the dice that were used in the game.
The dice has m faces: the first ... |
Solve the programming task below in a Python markdown code block.
The determinant of a matrix 2 Γ 2 is defined as follows:
<image>
A matrix is called degenerate if its determinant is equal to zero.
The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements.
You are given a matrix <ima... |
Solve the programming task below in a Python markdown code block.
It's now 260 AD. Shapur, being extremely smart, became the King of Persia. He is now called Shapur, His majesty King of kings of Iran and Aniran.
Recently the Romans declared war on Persia. They dreamed to occupy Armenia. In the recent war, the Romans ... |
Solve the programming task below in a Python markdown code block.
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume th... |
Solve the programming task below in a Python markdown code block.
Group of Berland scientists, with whom you have a close business relationship, makes a research in the area of peaceful nuclear energy. In particular, they found that a group of four nanobots, placed on a surface of a plate, can run a powerful chain rea... |
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 a1, a2, ..., an. First, he pick an integer x and then he ad... |
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.
You are given the array of integer numbers a0, a1, ..., an - 1. For each element find the distance to the nearest zero (to the element which equals to zero). There is at least one zero element in the given array.
Input
The first line contains integer ... |
Solve the programming task below in a Python markdown code block.
Vasya has several phone books, in which he recorded the telephone numbers of his friends. Each of his friends can have one or several phone numbers.
Vasya decided to organize information about the phone numbers of friends. You will be given n strings β... |
Solve the programming task below in a Python markdown code block.
You are given a graph with n nodes and m directed edges. One lowercase letter is assigned to each node. We define a path's value as the number of the most frequently occurring letter. For example, if letters on a path are "abaca", then the value of that... |
Solve the programming task below in a Python markdown code block.
You are given a string s consisting of |s| small english letters.
In one move you can replace any character of this string to the next character in alphabetical order (a will be replaced with b, s will be replaced with t, etc.). You cannot replace lett... |
Solve the programming task below in a Python markdown code block.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x ... |
Solve the programming task below in a Python markdown code block.
Bubli and shivani are in lab. Bubli wants to send a message to shivani. But he can't send it directly. Bubli is on 1st computer and shivani is on the nth computer. Now the computer's are connected in a chain. 1st is connected to 2nd, 2nd is connected to... |
Solve the programming task below in a Python markdown code block.
James has decided to take a break from his work. He makes a plan to visit India for a few days with his family. He knows a lot about India, and also about the various cities he could visit. He decides to write down all the cities on a paper. Let the num... |
Solve the programming task below in a Python markdown code block.
There is a building with n rooms, numbered 1 to n.
We can move from any room to any other room in the building.
Let us call the following event a move: a person in some room i goes to another room j~ (i \neq j).
Initially, there was one person in eac... |
Solve the programming task below in a Python markdown code block.
We have a grid of squares with N rows and M columns. Let (i, j) denote the square at the i-th row from the top and j-th column from the left. We will choose K of the squares and put a piece on each of them.
If we place the K pieces on squares (x_1, y_1... |
Solve the programming task below in a Python markdown code block.
There are N rabbits, numbered 1, 2, \ldots, N.
For each i, j (1 \leq i, j \leq N), the compatibility of Rabbit i and j is described by an integer a_{i, j}. Here, a_{i, i} = 0 for each i (1 \leq i \leq N), and a_{i, j} = a_{j, i} for each i and j (1 \le... |
Solve the programming task below in a Python markdown code block.
In some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.
It had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we... |
Solve the programming task below in a Python markdown code block.
Takahashi has decided to make a Christmas Tree for the Christmas party in AtCoder, Inc.
A Christmas Tree is a tree with N vertices numbered 1 through N and N-1 edges, whose i-th edge (1\leq i\leq N-1) connects Vertex a_i and b_i.
He would like to make... |
Solve the programming task below in a Python markdown code block.
We have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller. (The operation is the same as the one in Problem D.)
* D... |
Solve the programming task below in a Python markdown code block.
You are given an undirected unweighted graph with N vertices and M edges that contains neither self-loops nor double edges.
Here, a self-loop is an edge where a_i = b_i (1β€iβ€M), and double edges are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,... |
Solve the programming task below in a Python markdown code block.
N people are waiting in a single line in front of the Takahashi Store. The cash on hand of the i-th person from the front of the line is a positive integer A_i.
Mr. Takahashi, the shop owner, has decided on the following scheme: He picks a product, set... |
Solve the programming task below in a Python markdown code block.
Consider creating the following number pattern.
4 8 2 3 1 0 8 3 7 6
2 0 5 4 1 8 1 0 3
2 5 9 5 9 9 1 3
7 4 4 4 8 0 4
1 8 8 2 8 4
9 6 0 0 2
5 6 0 2
1 6 2
7 8
Five
This pattern follows the rules below.
A B
C
In the sequence of numbers, C is the one... |
Solve the programming task below in a Python markdown code block.
Convenience store Deven Eleven is planning to open its first store in Aizuwakamatsu City to expand its business. There are already many other convenience stores in Aizuwakamatsu, so the place to open a new store is likely to be the key to success. Under... |
Solve the programming task below in a Python markdown code block.
problem
President K decided to make a flag for IOI 2016 in Russia. Chairman K first took out the old flag from the warehouse. This flag is divided into squares of N rows and M columns, and each square is painted in one of white, blue, and red.
Chairma... |
Solve the programming task below in a Python markdown code block.
You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complete the task.
The space station is made up with a number of units, called c... |
Solve the programming task below in a Python markdown code block.
Fast Forwarding
Mr. Anderson frequently rents video tapes of his favorite classic films. Watching the films so many times, he has learned the precise start times of his favorite scenes in all such films. He now wants to find how to wind the tape to wat... |
Solve the programming task below in a Python markdown code block.
Skyscraper "MinatoHarukas"
Mr. Port plans to start a new business renting one or more floors of the new skyscraper with one giga floors, MinatoHarukas. He wants to rent as many vertically adjacent floors as possible, because he wants to show advertisem... |
Solve the programming task below in a Python markdown code block.
Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.
Today's training is to gain dexterity that never mistypes by carefully stacking blocks. Since there are many building bl... |
Solve the programming task below in a Python markdown code block.
The unlucky Ikta-kun has rewritten the important character string T that he had to a different character string T'by the virus. It is known that the virus has rewritten one letter of T to a different letter. That is, T and T'are different by exactly one... |
Solve the programming task below in a Python markdown code block.
problem
Given the sequence $ A $ of length $ N $. The $ i $ item in $ A $ is $ A_i $. You can do the following for this sequence:
* $ 1 \ leq i \ leq N --Choose the integer i that is 1 $. Swap the value of $ A_i $ with the value of $ A_ {i + 1} $.
... |
Solve the programming task below in a Python markdown code block.
Problem
Here is a list of strings. Let's take a break and play with shiritori. Shiritori is performed according to the following rules.
1. First of all, select one of your favorite strings from the list and exclude that string from the list.
2. Next, ... |
Solve the programming task below in a Python markdown code block.
A binary search tree can be unbalanced depending on features of data. For example, if we insert $n$ elements into a binary search tree in ascending order, the tree become a list, leading to long search times. One of strategies is to randomly shuffle the... |
Solve the programming task below in a Python markdown code block.
For a dynamic list $L$ of integers, perform a sequence of the following operations. $L$ has a special element called END at the end of the list and an element of $L$ is indicated by a cursor.
* insert($x$): Insert $x$ before the element indicated by th... |
Solve the programming task below in a Python markdown code block.
Chef loves palindromes. Chef initially has odd number of charachters. Chef wants to create a palindrome of maximum even length using these characters.
For this Chef needs to discard one character. Help Chef find the character which needs to be discarded... |
Solve the programming task below in a Python markdown code block.
You are given an array d_1, d_2, ..., d_n consisting of n integer numbers.
Your task is to split this array into three parts (some of which may be empty) in such a way that each element of the array belongs to exactly one of the three parts, and each o... |
Solve the programming task below in a Python markdown code block.
Having watched the last Harry Potter film, little Gerald also decided to practice magic. He found in his father's magical book a spell that turns any number in the sum of its digits. At the moment Gerald learned that, he came across a number n. How many... |
Solve the programming task below in a Python markdown code block.
You are given a set of all integers from l to r inclusive, l < r, (r - l + 1) β€ 3 β
10^5 and (r - l) is always odd.
You want to split these numbers into exactly (r - l + 1)/(2) pairs in such a way that for each pair (i, j) the greatest common divisor o... |
Solve the programming task below in a Python markdown code block.
Vasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell (0, 0). Robot can perform the following four kinds of operations:
* U β move from (x, y) to (x, y + 1);
* D β move from (x, y) to (x, y - 1);
* L β m... |
Solve the programming task below in a Python markdown code block.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k for all k s... |
Solve the programming task below in a Python markdown code block.
The three friends, Kuro, Shiro, and Katie, met up again! It's time for a party...
What the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, they invited all their friends. Now n cats are at the party... |
Solve the programming task below in a Python markdown code block.
One important contest will take place on the most famous programming platform (Topforces) very soon!
The authors have a pool of n problems and should choose at most three of them into this contest. The prettiness of the i-th problem is a_i. The authors... |
Solve the programming task below in a Python markdown code block.
A class of students wrote a multiple-choice test.
There are n students in the class. The test had m questions, each of them had 5 possible answers (A, B, C, D or E). There is exactly one correct answer for each question. The correct answer for question... |
Solve the programming task below in a Python markdown code block.
Ujan decided to make a new wooden roof for the house. He has n rectangular planks numbered from 1 to n. The i-th plank has size a_i Γ 1 (that is, the width is 1 and the height is a_i).
Now, Ujan wants to make a square roof. He will first choose some of... |
Solve the programming task below in a Python markdown code block.
You are given an integer array a_1, a_2, ..., a_n, where a_i represents the number of blocks at the i-th position. It is guaranteed that 1 β€ a_i β€ n.
In one operation you can choose a subset of indices of the given array and remove one block in each o... |
Solve the programming task below in a Python markdown code block.
A sequence a = [a_1, a_2, β¦, a_l] of length l has an ascent if there exists a pair of indices (i, j) such that 1 β€ i < j β€ l and a_i < a_j. For example, the sequence [0, 2, 0, 2, 0] has an ascent because of the pair (1, 4), but the sequence [4, 3, 3, 3,... |
Solve the programming task below in a Python markdown code block.
You have a bag of size n. Also you have m boxes. The size of i-th box is a_i, where each a_i is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if n = 10 an... |
Solve the programming task below in a Python markdown code block.
You wrote down all integers from 0 to 10^n - 1, padding them with leading zeroes so their lengths are exactly n. For example, if n = 3 then you wrote out 000, 001, ..., 998, 999.
A block in an integer x is a consecutive segment of equal digits that can... |
Solve the programming task below in a Python markdown code block.
Arthur owns a ski resort on a mountain. There are n landing spots on the mountain numbered from 1 to n from the top to the foot of the mountain. The spots are connected with one-directional ski tracks. All tracks go towards the foot of the mountain, so ... |
Solve the programming task below in a Python markdown code block.
As Gerald sets the table, Alexander sends the greeting cards, and Sergey and his twins create an army of clone snowmen, Gennady writes a New Year contest.
The New Year contest begins at 18:00 (6.00 P.M.) on December 31 and ends at 6:00 (6.00 A.M.) on J... |
Solve the programming task below in a Python markdown code block.
Nezzar's favorite digit among 1,β¦,9 is d. He calls a positive integer lucky if d occurs at least once in its decimal representation.
Given q integers a_1,a_2,β¦,a_q, for each 1 β€ i β€ q Nezzar would like to know if a_i can be equal to a sum of several (... |
Solve the programming task below in a Python markdown code block.
A mouse encountered a nice big cake and decided to take a walk across it, eating the berries on top of the cake on its way. The cake is rectangular, neatly divided into squares; some of the squares have a berry in them, and some don't.
The mouse is in ... |
Solve the programming task below in a Python markdown code block.
Nick is interested in prime numbers. Once he read about Goldbach problem. It states that every even integer greater than 2 can be expressed as the sum of two primes. That got Nick's attention and he decided to invent a problem of his own and call it Nol... |
Solve the programming task below in a Python markdown code block.
A widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make and carry out a Super Rated Match (SRM) on the site Torcoder.com. But there's a problem β a... |
Solve the programming task below in a Python markdown code block.
Trouble came from the overseas lands: a three-headed dragon Gorynych arrived. The dragon settled at point C and began to terrorize the residents of the surrounding villages.
A brave hero decided to put an end to the dragon. He moved from point A to fig... |
Solve the programming task below in a Python markdown code block.
Two villages are separated by a river that flows from the north to the south. The villagers want to build a bridge across the river to make it easier to move across the villages.
The river banks can be assumed to be vertical straight lines x = a and x ... |
Solve the programming task below in a Python markdown code block.
Luyi has n circles on the plane. The i-th circle is centered at (xi, yi). At the time zero circles start to grow simultaneously. In other words, the radius of each circle at time t (t > 0) is equal to t. The circles are drawn as black discs on an infini... |
Solve the programming task below in a Python markdown code block.
Ksusha the Squirrel is standing at the beginning of a straight road, divided into n sectors. The sectors are numbered 1 to n, from left to right. Initially, Ksusha stands in sector 1.
Ksusha wants to walk to the end of the road, that is, get to sector... |
Solve the programming task below in a Python markdown code block.
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.
Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n... |
Solve the programming task below in a Python markdown code block.
The next "Data Structures and Algorithms" lesson will be about Longest Increasing Subsequence (LIS for short) of a sequence. For better understanding, Nam decided to learn it a few days before the lesson.
Nam created a sequence a consisting of n (1 β€ n... |
Solve the programming task below in a Python markdown code block.
The commanding officers decided to drop a nuclear bomb on the enemy's forces. You are ordered to determine the power of the warhead that needs to be used.
The enemy has N strategically important objects. Their positions are known due to the intelligenc... |
Solve the programming task below in a Python markdown code block.
A flea is sitting at one of the n hassocks, arranged in a circle, at the moment. After minute number k the flea jumps through k - 1 hassoΡks (clockwise). For example, after the first minute the flea jumps to the neighboring hassock. You should answer: w... |
Solve the programming task below in a Python markdown code block.
In the game Lizard Era: Beginning the protagonist will travel with three companions: Lynn, Meliana and Worrigan. Overall the game has n mandatory quests. To perform each of them, you need to take exactly two companions.
The attitude of each of the comp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.