question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Nowadays, most of the internet advertisements are not statically linked to a web page. Instead, what will be shown to the person opening a web page is determined within 100 milliseconds after the web page is opened. Usually, multiple companies compete f... |
Solve the programming task below in a Python markdown code block.
Demiurges Shambambukli and Mazukta love to watch the games of ordinary people. Today, they noticed two men who play the following game.
There is a rooted tree on n nodes, m of which are leaves (a leaf is a nodes that does not have any children), edges ... |
Solve the programming task below in a Python markdown code block.
As you must know, the maximum clique problem in an arbitrary graph is NP-hard. Nevertheless, for some graphs of specific kinds it can be solved effectively.
Just in case, let us remind you that a clique in a non-directed graph is a subset of the vertic... |
Solve the programming task below in a Python markdown code block.
Duff is addicted to meat! Malek wants to keep her happy for n days. In order to be happy in i-th day, she needs to eat exactly ai kilograms of meat.
<image>
There is a big shop uptown and Malek wants to buy meat for her from there. In i-th day, they s... |
Solve the programming task below in a Python markdown code block.
The city park of IT City contains n east to west paths and n north to south paths. Each east to west path crosses each north to south path, so there are n2 intersections.
The city funded purchase of five benches. To make it seems that there are many be... |
Solve the programming task below in a Python markdown code block.
Kolya is developing an economy simulator game. His most favourite part of the development process is in-game testing. Once he was entertained by the testing so much, that he found out his game-coin score become equal to 0.
Kolya remembers that at the b... |
Solve the programming task below in a Python markdown code block.
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applicat... |
Solve the programming task below in a Python markdown code block.
Alice and Bonnie are sisters, but they don't like each other very much. So when some old family photos were found in the attic, they started to argue about who should receive which photos. In the end, they decided that they would take turns picking phot... |
Solve the programming task below in a Python markdown code block.
Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go.
Dr. Evil is interested in sets, He has a set of n integers. Dr. Evil call... |
Solve the programming task below in a Python markdown code block.
Valentina is looking for a new game to play with her friends.
She asks her mom Marcia for an idea.
After a moment Marcia described to girls the following simple game.
Girls are divided into n teams, indexed 1 through n.
Each girl chooses a lowercase le... |
Solve the programming task below in a Python markdown code block.
Julius Cipher is a type of cipher which relates all the lowercase alphabets to their numerical position in the alphabet, i.e., value of a is 1, value of b is 2, value of z is 26 and similarly for the rest of them.
Little Chandan is obsessed with this ... |
Solve the programming task below in a Python markdown code block.
Let us define the FizzBuzz sequence a_1,a_2,... as follows:
* If both 3 and 5 divides i, a_i=\mbox{FizzBuzz}.
* If the above does not hold but 3 divides i, a_i=\mbox{Fizz}.
* If none of the above holds but 5 divides i, a_i=\mbox{Buzz}.
* If none of the... |
Solve the programming task below in a Python markdown code block.
In this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019.
Integers M_1, D_1, M_2, and D_2 will be given as input.
It is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1.
Determine whether the date 2019-M_1-D_1 i... |
Solve the programming task below in a Python markdown code block.
There is a very long bench. The bench is divided into M sections, where M is a very large integer.
Initially, the bench is vacant. Then, M people come to the bench one by one, and perform the following action:
* We call a section comfortable if the se... |
Solve the programming task below in a Python markdown code block.
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 not... |
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.
Rng is going to a festival.
The name of the festival is given to you as a string S, which ends with `FESTIVAL`, from input. Answer the question: "Rng is going to a festival of what?" Output the answer.
Here, assume that the name of "a festival of s" i... |
Solve the programming task below in a Python markdown code block.
There are N persons, conveniently numbered 1 through N. They will take 3y3s Challenge for N-1 seconds.
During the challenge, each person must look at each of the N-1 other persons for 1 seconds, in some order.
If any two persons look at each other dur... |
Solve the programming task below in a Python markdown code block.
Write a program which computes the digit number of sum of two integers a and b.
Constraints
* 0 ≤ a, b ≤ 1,000,000
* The number of datasets ≤ 200
Input
There are several test cases. Each test case consists of two non-negative integers a and b which ... |
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.
There is a game called Packet Monster. A game that catches, raises, fights and exchanges monsters, and is very popular all over Japan. Of course, in my class. That's why I also raise monsters so that I can play with everyone in this game, but sadly ther... |
Solve the programming task below in a Python markdown code block.
problem
Information I want to paint a rectangular veneer board to make a signboard for the promotion of the Olympic Games. Some rectangular masking tapes are pre-attached to the veneer board where I do not want to paint. We decided to paint each area w... |
Solve the programming task below in a Python markdown code block.
People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (= 172), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-credit coins,... |
Solve the programming task below in a Python markdown code block.
An open-top box having a square bottom is placed on the floor. You see a number of needles vertically planted on its bottom.
You want to place a largest possible spheric balloon touching the box bottom, interfering with none of the side walls nor the n... |
Solve the programming task below in a Python markdown code block.
Masa Kita, who entered the University of Tokyo, joined a circle called TSG (University of Tokyo Super Gamers).
This circle exhibits games at the Komaba Festival every year, and Masa Kita decided to create and display the games as well.
The game create... |
Solve the programming task below in a Python markdown code block.
Example
Input
2 3 1 3 1 0
Output
2
The input will be give
Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the sample inputs). Enclose your code within ```python delimiters. |
Solve the programming task below in a Python markdown code block.
Problem Statement
A magician lives in a country which consists of N islands and M bridges. Some of the bridges are magical bridges, which are created by the magician. Her magic can change all the lengths of the magical bridges to the same non-negative ... |
Solve the programming task below in a Python markdown code block.
Falling Block Puzzle
Block drop
You are playing a falling block puzzle. As shown in the figure below, the field of this puzzle has a shape in which cubic cells are arranged in 2 squares x 2 squares in each row, and the rows are infinitely arranged on ... |
Solve the programming task below in a Python markdown code block.
Given a tree T with non-negative weight, find the height of each node of the tree. For each node, the height is the distance to the most distant leaf from the node.
Constraints
* 1 ≤ n ≤ 10,000
* 0 ≤ wi ≤ 1,000
Input
n
s1 t1 w1
s2 t2 w2
:
sn-1 tn-1... |
Solve the programming task below in a Python markdown code block.
You are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that as many as possible integers will become on a place where a smaller integer used to stand. Help Vasya find the maximal number of such integers.
... |
Solve the programming task below in a Python markdown code block.
When preparing a tournament, Codeforces coordinators try treir best to make the first problem as easy as possible. This time the coordinator had chosen some problem and asked n people about their opinions. Each person answered whether this problem is ea... |
Solve the programming task below in a Python markdown code block.
You are given a range of positive integers from l to r.
Find such a pair of integers (x, y) that l ≤ x, y ≤ r, x ≠y and x divides y.
If there are multiple answers, print any of them.
You are also asked to answer T independent queries.
Input
The fi... |
Solve the programming task below in a Python markdown code block.
There are n emotes in very popular digital collectible card game (the game is pretty famous so we won't say its name). The i-th emote increases the opponent's happiness by a_i units (we all know that emotes in this game are used to make opponents happy)... |
Solve the programming task below in a Python markdown code block.
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n â‹… k cities. The cities are numerated from 1 to n â‹… k, the distance between the neighboring cities is exactly 1 km.
Sergey does not like beetles, he loves... |
Solve the programming task below in a Python markdown code block.
This problem is same as the previous one, but has larger constraints.
It was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). After arriving at the power stati... |
Solve the programming task below in a Python markdown code block.
After learning about polynomial hashing, Heidi decided to learn about shift-xor hashing. In particular, she came across this interesting problem.
Given a bitstring y ∈ \{0,1\}^n find out the number of different k (0 ≤ k < n) such that there exists x ∈ ... |
Solve the programming task below in a Python markdown code block.
Alan decided to get in shape for the summer, so he created a precise workout plan to follow. His plan is to go to a different gym every day during the next N days and lift X[i] grams on day i. In order to improve his workout performance at the gym, he c... |
Solve the programming task below in a Python markdown code block.
Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a description of a graph.
It is an undirected weighted graph on... |
Solve the programming task below in a Python markdown code block.
On the well-known testing system MathForces, a draw of n rating units is arranged. The rating will be distributed according to the following algorithm: if k participants take part in this event, then the n rating is evenly distributed between them and r... |
Solve the programming task below in a Python markdown code block.
Being tired of participating in too many Codeforces rounds, Gildong decided to take some rest in a park. He sat down on a bench, and soon he found two rabbits hopping around. One of the rabbits was taller than the other.
He noticed that the two rabbits... |
Solve the programming task below in a Python markdown code block.
For the given integer n (n > 2) let's write down all the strings of length n which contain n-2 letters 'a' and two letters 'b' in lexicographical (alphabetical) order.
Recall that the string s of length n is lexicographically less than string t of leng... |
Solve the programming task below in a Python markdown code block.
You are standing on the OX-axis at point 0 and you want to move to an integer point x > 0.
You can make several jumps. Suppose you're currently at point y (y may be negative) and jump for the k-th time. You can:
* either jump to the point y + k
... |
Solve the programming task below in a Python markdown code block.
You are given a number k and a string s of length n, consisting of the characters '.' and '*'. You want to replace some of the '*' characters with 'x' characters so that the following conditions are met:
* The first character '*' in the original str... |
Solve the programming task below in a Python markdown code block.
A boy Valera registered on site Codeforces as Valera, and wrote his first Codeforces Round #300. He boasted to a friend Arkady about winning as much as x points for his first contest. But Arkady did not believe his friend's words and decided to check wh... |
Solve the programming task below in a Python markdown code block.
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of <image> for all pairs of integers a and b (l ≤ a ≤ b ≤ r). Your task is to find the maximum value among a... |
Solve the programming task below in a Python markdown code block.
Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Ciel's cards is... |
Solve the programming task below in a Python markdown code block.
A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, sequence [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] are not.
A fixed point of a function i... |
Solve the programming task below in a Python markdown code block.
Mashmokh works in a factory. At the end of each day he must turn off all of the lights.
The lights on the factory are indexed from 1 to n. There are n buttons in Mashmokh's room indexed from 1 to n as well. If Mashmokh pushes button with index i, then... |
Solve the programming task below in a Python markdown code block.
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometime... |
Solve the programming task below in a Python markdown code block.
Tavas is a strange creature. Usually "zzz" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead.
<image>
Today Tavas fell asleep in Malekas' place. While he was sleeping, Malekas did a little process... |
Solve the programming task below in a Python markdown code block.
A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sausage and cheese sandwiches, but first, he needs to buy a sausage and some cheese.
The town where Laurenty lives in is not ... |
Solve the programming task below in a Python markdown code block.
There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance bi inclu... |
Solve the programming task below in a Python markdown code block.
Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!
The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the 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.
You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the given array.
A subarray is the sequence of consecutive elements of the array. Subarray is called increasing if each element of this s... |
Solve the programming task below in a Python markdown code block.
You are given a table consisting of n rows and m columns.
Numbers in each row form a permutation of integers from 1 to m.
You are allowed to pick two elements in one row and swap them, but no more than once for each row. Also, no more than once you ar... |
Solve the programming task below in a Python markdown code block.
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the... |
Solve the programming task below in a Python markdown code block.
Woken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city where he lives, are closed due to ro... |
Solve the programming task below in a Python markdown code block.
Winter is here at the North and the White Walkers are close. John Snow has an army consisting of n soldiers. While the rest of the world is fighting for the Iron Throne, he is going to get ready for the attack of the White Walkers.
He has created a met... |
Solve the programming task below in a Python markdown code block.
n evenly spaced points have been marked around the edge of a circle. There is a number written at each point. You choose a positive real number k. Then you may repeatedly select a set of 2 or more points which are evenly spaced, and either increase all ... |
Solve the programming task below in a Python markdown code block.
A string a of length m is called antipalindromic iff m is even, and for each i (1 ≤ i ≤ m) ai ≠am - i + 1.
Ivan has a string s consisting of n lowercase Latin letters; n is even. He wants to form some string t that will be an antipalindromic permutati... |
Solve the programming task below in a Python markdown code block.
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, an... |
Solve the programming task below in a Python markdown code block.
One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by terrorists, but he rarely won... |
Solve the programming task below in a Python markdown code block.
The Kraken lives!
Tragedy has struck the trade world since news has spread of the rise of the Kraken that terrorizes the Mediterranean Sea. Any ship that attempts to cross this strait is torn apart by the mighty tentacles of the beast and all its occup... |
Solve the programming task below in a Python markdown code block.
Joseph studies at SKIT.He is a fresher he has been given a task and he wants help from you for performing the task.The task is an interesting one.
The tasks is:-
He is provided with a value N, he has to make change for N cents, and he have infinite su... |
Solve the programming task below in a Python markdown code block.
You are given two numbers N and K and a set X.
X = { x : x is a natural number ≤ N }
You have to find the total number of pairs of elements X[i] and X[j] belonging to the given set, such that, i < j and their sum is divisible by K.
Input Format:
A... |
Solve the programming task below in a Python markdown code block.
The grandest stage of all, Wrestlemania XXX recently happened. And with it, happened one of the biggest heartbreaks for the WWE fans around the world. The Undertaker's undefeated streak was finally over.
Now as an Undertaker fan, you're disappointed,... |
Solve the programming task below in a Python markdown code block.
Pandey needs your help. As you know, he is on the quest to save the princess. After traveling for a number of days, he has finally reached the palace, but one last battle remains to be fought. However he has only one unit of energy left in him. To win t... |
Solve the programming task below in a Python markdown code block.
Takahashi is meeting up with Aoki.
They have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.
Takahashi will leave his house now and go straight to the place at a speed of S meters per minute.
Will he arr... |
Solve the programming task below in a Python markdown code block.
You drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.
How many kinds of items did you get?
Constraints
* 1 \leq N \leq 2\times 10^5
* S_i consists of lowercase English letters and has a length between 1 ... |
Solve the programming task below in a Python markdown code block.
Given are strings s and t of length N each, both consisting of lowercase English letters.
Let us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second ch... |
Solve the programming task below in a Python markdown code block.
You have decided to give an allowance to your child depending on the outcome of the game that he will play now.
The game is played as follows:
* There are three "integer panels", each with a digit between 1 and 9 (inclusive) printed on it, and one "op... |
Solve the programming task below in a Python markdown code block.
There are N sightseeing spots on the x-axis, numbered 1, 2, ..., N. Spot i is at the point with coordinate A_i. It costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.
You... |
Solve the programming task below in a Python markdown code block.
In the year 2168, AtCoder Inc., which is much larger than now, is starting a limited express train service called AtCoder Express.
In the plan developed by the president Takahashi, the trains will run as follows:
* A train will run for (t_1 + t_2 + t_... |
Solve the programming task below in a Python markdown code block.
There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array. Find the K-th smallest integer in the array after the N ope... |
Solve the programming task below in a Python markdown code block.
In the speed skating badge test, grades are awarded when the time specified for two distances is exceeded. For example, to reach Class A, 500 M requires less than 40.0 seconds and 1000 M requires less than 1 minute and 23 seconds.
Create a program that... |
Solve the programming task below in a Python markdown code block.
Shinya watched a program on TV called "Maya's Great Prophecy! Will the World End in 2012?" After all, I wasn't sure if the world would end, but I was interested in Maya's "long-term calendar," which was introduced in the program. The program explained a... |
Solve the programming task below in a Python markdown code block.
problem
Mobiles are widely known as moving works of art. The IOI Japan Committee has decided to create mobiles to publicize JOI. JOI public relations mobiles are sticks, strings, and weights. It is constructed as follows using the three types of elemen... |
Solve the programming task below in a Python markdown code block.
A crop circle suddenly appeared on the vast agricultural land of Argentina. A total of n crop circles were confirmed, including overlapping, popping, large, and small ones.
When a mystery hunter tried to capture the whole picture of a crop circle from ... |
Solve the programming task below in a Python markdown code block.
Bridge Removal
ICPC islands once had been a popular tourist destination. For nature preservation, however, the government decided to prohibit entrance to the islands, and to remove all the man-made structures there. The hardest part of the project is t... |
Solve the programming task below in a Python markdown code block.
In sliding block puzzles, we repeatedly slide pieces (blocks) to open spaces within a frame to establish a goal placement of pieces.
A puzzle creator has designed a new puzzle by combining the ideas of sliding block puzzles and mazes. The puzzle is pla... |
Solve the programming task below in a Python markdown code block.
Convex polygon pillar industrial city
The Industrial Convex Pillar City (ICPC) is a city of buildings in the shape of several convex polygonal columns. You are about to walk through this city from your current location S to your destination T. The sun ... |
Solve the programming task below in a Python markdown code block.
F: Grid number
problem
Ebi-chan is trying to write exactly one integer from 1 to 2 \ times n in a grid with n columns horizontally and 2 rows vertically.
Only one integer can be written to each cell in the grid.
It's not fun just to write normally, ... |
Solve the programming task below in a Python markdown code block.
Earthquakes
E869120 You are not good at earthquakes.
Specifically, if an earthquake with a seismic intensity of $ p $ occurs while you are doing a task, the performance of that task will be reduced by $ 10 \ times p $ percent.
Yesterday, there were $... |
Solve the programming task below in a Python markdown code block.
For a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).
Constraints
* 1 ≤ |V| ≤ 100000
* 0 ≤ di ≤ 10000
* 0 ≤ |E| ≤ 500000
* There are no parallel edges
* The... |
Solve the programming task below in a Python markdown code block.
Recently, Chef got obsessed with piano. He is a just a rookie in this stuff and can not move his fingers from one key to other fast enough. He discovered that the best way to train finger speed is to play scales.
There are different kinds of scales whic... |
Solve the programming task below in a Python markdown code block.
Alice got an array of length n as a birthday present once again! This is the third year in a row!
And what is more disappointing, it is overwhelmengly boring, filled entirely with zeros. Bob decided to apply some changes to the array to cheer up Alice... |
Solve the programming task below in a Python markdown code block.
Vova has taken his summer practice this year and now he should write a report on how it went.
Vova has already drawn all the tables and wrote down all the formulas. Moreover, he has already decided that the report will consist of exactly n pages and th... |
Solve the programming task below in a Python markdown code block.
<image>
Input
The input contains a single integer a (0 ≤ a ≤ 15).
Output
Output a single integer.
Example
Input
3
Output
13
The input will be give
Read the inputs from stdin solve the problem and write the answer to stdout (do not directly... |
Solve the programming task below in a Python markdown code block.
Tom loves vowels, and he likes long words with many vowels. His favorite words are vowelly words. We say a word of length k is vowelly if there are positive integers n and m such that nâ‹… m = k and when the word is written by using n rows and m columns (... |
Solve the programming task below in a Python markdown code block.
The only difference between easy and hard versions is the length of the string.
You are given a string s and a string t, both consisting only of lowercase Latin letters. It is guaranteed that t can be obtained from s by removing some (possibly, zero) n... |
Solve the programming task below in a Python markdown code block.
Sasha grew up and went to first grade. To celebrate this event her mother bought her a multiplication table M with n rows and n columns such that M_{ij}=a_i â‹… a_j where a_1, ..., a_n is some sequence of positive integers.
Of course, the girl decided to... |
Solve the programming task below in a Python markdown code block.
Kuroni is very angry at the other setters for using him as a theme! As a punishment, he forced them to solve the following problem:
You have an array a consisting of n positive integers. An operation consists of choosing an element and either adding 1 ... |
Solve the programming task below in a Python markdown code block.
A lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands "T" ("turn around") and "F" ("move 1 unit forward").
You are given a list of commands that will be give... |
Solve the programming task below in a Python markdown code block.
You are given a sequence of positive integers a1, a2, ..., an. Find all such indices i, that the i-th element equals the arithmetic mean of all other elements (that is all elements except for this one).
Input
The first line contains the integer n (2 ≤... |
Solve the programming task below in a Python markdown code block.
Let's consider all integers in the range from 1 to n (inclusive).
Among all pairs of distinct integers in this range, find the maximum possible greatest common divisor of integers in pair. Formally, find the maximum value of gcd(a, b), where 1 ≤ a < b ... |
Solve the programming task below in a Python markdown code block.
Omkar is standing at the foot of Celeste mountain. The summit is n meters away from him, and he can see all of the mountains up to the summit, so for all 1 ≤ j ≤ n he knows that the height of the mountain at the point j meters away from himself is h_j m... |
Solve the programming task below in a Python markdown code block.
You are a mayor of Berlyatov. There are n districts and m two-way roads between them. The i-th road connects districts x_i and y_i. The cost of travelling along this road is w_i. There is some path between each pair of districts, so the city is connecte... |
Solve the programming task below in a Python markdown code block.
Kilani and Abd are neighbors for 3000 years, but then the day came and Kilani decided to move to another house. As a farewell gift, Kilani is going to challenge Abd with a problem written by their other neighbor with the same name Abd.
<image>
The pro... |
Solve the programming task below in a Python markdown code block.
Four players participate in the playoff tournament. The tournament is held according to the following scheme: the first player will play with the second, and the third player with the fourth, then the winners of the pairs will play in the finals of the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.