question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.
Vladimir went to a flower shop, and he was amazed to see that there are m types of flowers being sold there, and there is unlimite... |
Solve the programming task below in a Python markdown code block.
There are n persons located on a plane. The i-th person is located at the point (x_i, y_i) and initially looks at the point (u_i, v_i).
At the same moment of time, all persons will start to rotate clockwise synchronously with the same angular speed. Th... |
Solve the programming task below in a Python markdown code block.
You are storing an integer array of length m in a database. To maintain internal integrity and protect data, the database stores n copies of this array.
Unfortunately, the recent incident may have altered the stored information in every copy in the dat... |
Solve the programming task below in a Python markdown code block.
This is the easy version of the problem. The only difference between the easy version and the hard version is the constraints on n. You can only make hacks if both versions are solved.
A permutation of 1, 2, β¦, n is a sequence of n integers, where each... |
Solve the programming task below in a Python markdown code block.
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij, and the se... |
Solve the programming task below in a Python markdown code block.
Vasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer.
We all know that programs often store sets of integers. For example, if we have a problem about a we... |
Solve the programming task below in a Python markdown code block.
Furik and Rubik love playing computer games. Furik has recently found a new game that greatly interested Rubik. The game consists of n parts and to complete each part a player may probably need to complete some other ones. We know that the game can be f... |
Solve the programming task below in a Python markdown code block.
One day, liouzhou_101 got a chat record of Freda and Rainbow. Out of curiosity, he wanted to know which sentences were said by Freda, and which were said by Rainbow. According to his experience, he thought that Freda always said "lala." at the end of he... |
Solve the programming task below in a Python markdown code block.
Gerald plays the following game. He has a checkered field of size n Γ n cells, where m various cells are banned. Before the game, he has to put a few chips on some border (but not corner) board cells. Then for n - 1 minutes, Gerald every minute moves ea... |
Solve the programming task below in a Python markdown code block.
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-t... |
Solve the programming task below in a Python markdown code block.
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.
Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). T... |
Solve the programming task below in a Python markdown code block.
Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses ("+") in the line between certain digits in the line so... |
Solve the programming task below in a Python markdown code block.
Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n Γ m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands ar... |
Solve the programming task below in a Python markdown code block.
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 ope... |
Solve the programming task below in a Python markdown code block.
Wilbur the pig is tinkering with arrays again. He has the array a1, a2, ..., an initially consisting of n zeros. At one step, he can choose any index i and either add 1 to all elements ai, ai + 1, ... , an or subtract 1 from all elements ai, ai + 1, ...... |
Solve the programming task below in a Python markdown code block.
There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of only segments parallel to the coo... |
Solve the programming task below in a Python markdown code block.
The main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are numbered from 1 to n - 1 in the order... |
Solve the programming task below in a Python markdown code block.
There are n integers b1, b2, ..., bn written in a row. For all i from 1 to n, values ai are defined by the crows performing the following procedure:
* The crow sets ai initially 0.
* The crow then adds bi to ai, subtracts bi + 1, adds the bi + 2 n... |
Solve the programming task below in a Python markdown code block.
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out an... |
Solve the programming task below in a Python markdown code block.
Vasya came up with his own weather forecasting method. He knows the information about the average air temperature for each of the last n days. Assume that the average air temperature for each day is integral.
Vasya believes that if the average temperat... |
Solve the programming task below in a Python markdown code block.
After the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: "Why on Earth does my program work so slowly?" As he double-checked his code, he said: "My code contains no errors, yet I know how we will improve Search... |
Solve the programming task below in a Python markdown code block.
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts 1 minute.
He was asked t... |
Solve the programming task below in a Python markdown code block.
You are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect.
The interior of the square is considered to be part of the square, i.e. ... |
Solve the programming task below in a Python markdown code block.
Moving ahead, Gudi now enters a room where the floor is divided into N x M square tiles, forming a grid with N rows and M columns.
Each square in the grid contains a number of Magical Orbs that Gudi has to absorb if she steps on it. Each Orb increases ... |
Solve the programming task below in a Python markdown code block.
Little Shino loves to play with coins. In the city she lives, there are 26 different types of coins. Each coin is represented with a lowercase letter a, b, c, ... , y, z. Shino has some number of coins and she placed them in some random sequence, S, on ... |
Solve the programming task below in a Python markdown code block.
Suresh is a strange boy. He neither likes an array in ascending order nor in descending order. Then what does he like?
He likes an array if and only if it is mixed i.e, both ascending and descending. He has got lots of arrays from his friends. But he do... |
Solve the programming task below in a Python markdown code block.
An uppercase or lowercase English letter \alpha will be given as input. If \alpha is uppercase, print `A`; if it is lowercase, print `a`.
Constraints
* \alpha is an uppercase (`A` - `Z`) or lowercase (`a` - `z`) English letter.
Input
Input is given ... |
Solve the programming task below in a Python markdown code block.
We will host a rock-paper-scissors tournament with N people. The participants are called Person 1, Person 2, \ldots, Person N. For any two participants, the result of the match between them is determined in advance. This information is represented by po... |
Solve the programming task below in a Python markdown code block.
There are N dishes, numbered 1, 2, \ldots, N. Initially, for each i (1 \leq i \leq N), Dish i has a_i (1 \leq a_i \leq 3) pieces of sushi on it.
Taro will perform the following operation repeatedly until all the pieces of sushi are eaten:
* Roll a die... |
Solve the programming task below in a Python markdown code block.
You are given integers N, K, and an integer sequence A of length M.
An integer sequence where each element is between 1 and K (inclusive) is said to be colorful when there exists a contiguous subsequence of length K of the sequence that contains one oc... |
Solve the programming task below in a Python markdown code block.
The commonly used bills in Japan are 10000-yen, 5000-yen and 1000-yen bills. Below, the word "bill" refers to only these.
According to Aohashi, he received an otoshidama (New Year money gift) envelope from his grandfather that contained N bills for a t... |
Solve the programming task below in a Python markdown code block.
We have N clocks. The hand of the i-th clock (1β€iβ€N) rotates through 360Β° in exactly T_i seconds.
Initially, the hand of every clock stands still, pointing directly upward.
Now, Dolphin starts all the clocks simultaneously.
In how many seconds will the ... |
Solve the programming task below in a Python markdown code block.
Mountaineers Mr. Takahashi and Mr. Aoki recently trekked across a certain famous mountain range. The mountain range consists of N mountains, extending from west to east in a straight line as Mt. 1, Mt. 2, ..., Mt. N. Mr. Takahashi traversed the range fr... |
Solve the programming task below in a Python markdown code block.
When you enter 8 numbers from 0 to 9, write a program that outputs the difference between the largest integer and the smallest integer that can sort the 8 numbers. The number that can be sorted may start from 0, such as 00135569.
Input
Given multipl... |
Solve the programming task below in a Python markdown code block.
Taro is addicted to a novel. The novel has n volumes in total, and each volume has a different thickness. Taro likes this novel so much that he wants to buy a bookshelf dedicated to it. However, if you put a large bookshelf in the room, it will be quite... |
Solve the programming task below in a Python markdown code block.
Villages were scattered in the Wakamatsu Plain of Aizu. Several settlements are connected by straight roads that allow them to travel to and from each other, and any settlement in the plain can be traced back and forth. Each road has a lengthy maintenan... |
Solve the programming task below in a Python markdown code block.
Modern Mansion
You got lost in a big mansion. This mansion has a structure in which square rooms are arranged in a grid pattern from north, south, east, and west, with M columns in the east-west direction and N rows in the north-south direction, for a ... |
Solve the programming task below in a Python markdown code block.
Karnaugh is a poor farmer who has a very small field. He wants to reclaim wasteland in the kingdom to get a new field. But the king who loves regular shape made a rule that a settler can only get a rectangular land as his field. Thus, Karnaugh should ge... |
Solve the programming task below in a Python markdown code block.
Digits Are Not Just Characters
Mr. Manuel Majorana Minore made a number of files with numbers in their names. He wants to have a list of the files, but the file listing command commonly used lists them in an order different from what he prefers, interp... |
Solve the programming task below in a Python markdown code block.
YAML (YAML Ain't Markup Language) is one of the formats for expressing an object as a character string.
You will be given an object represented by a subset of YAML and a query that specifies the property, so please answer the value of the specified pro... |
Solve the programming task below in a Python markdown code block.
Problem Statement
One day, you found an old scroll with strange texts on it.
You revealed that the text was actually an expression denoting the position of treasure. The expression consists of following three operations:
* From two points, yield a li... |
Solve the programming task below in a Python markdown code block.
Problem statement
N first-year students of the Faculty of Information Science and Technology of R University take the final exam of the lecture called Programming Exercise 1. The test is a perfect score of m. In other words, the score that one student ... |
Solve the programming task below in a Python markdown code block.
Counting sort can be used for sorting elements in an array which each of the n input elements is an integer in the range 0 to k. The idea of counting sort is to determine, for each input element x, the number of elements less than x as C[x]. This inform... |
Solve the programming task below in a Python markdown code block.
Transformation
Write a program which performs a sequence of commands to a given string $str$. The command is one of:
* print a b: print from the a-th character to the b-th character of $str$
* reverse a b: reverse from the a-th character to the b-t... |
Solve the programming task below in a Python markdown code block.
This is an interactive problem.
Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to find something to occupy herself. She couldn't think of any... |
Solve the programming task below in a Python markdown code block.
You are given n segments on a Cartesian plane. Each segment's endpoints have integer coordinates. Segments can intersect with each other. No two segments lie on the same line.
Count the number of distinct points with integer coordinates, which are cove... |
Solve the programming task below in a Python markdown code block.
There is a forest that we model as a plane and live n rare animals. Animal number i has its lair in the point (x_{i}, y_{i}). In order to protect them, a decision to build a nature reserve has been made.
The reserve must have a form of a circle contain... |
Solve the programming task below in a Python markdown code block.
Billy investigates the question of applying greedy algorithm to different spheres of life. At the moment he is studying the application of greedy algorithm to the problem about change. There is an amount of n coins of different face values, and the coin... |
Solve the programming task below in a Python markdown code block.
At the first holiday in spring, the town Shortriver traditionally conducts a flower festival. Townsfolk wear traditional wreaths during these festivals. Each wreath contains exactly k flowers.
The work material for the wreaths for all n citizens of Sho... |
Solve the programming task below in a Python markdown code block.
A company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee A is said to be the superior of another employee B if at least o... |
Solve the programming task below in a Python markdown code block.
You are given a prime number p, n integers a_1, a_2, β¦, a_n, and an integer k.
Find the number of pairs of indexes (i, j) (1 β€ i < j β€ n) for which (a_i + a_j)(a_i^2 + a_j^2) β‘ k mod p.
Input
The first line contains integers n, p, k (2 β€ n β€ 3 β
10^... |
Solve the programming task below in a Python markdown code block.
You are responsible for installing a gas pipeline along a road. Let's consider the road (for simplicity) as a segment [0, n] on OX axis. The road can have several crossroads, but for simplicity, we'll denote each crossroad as an interval (x, x + 1) with... |
Solve the programming task below in a Python markdown code block.
You are given n positive integers a_1, β¦, a_n, and an integer k β₯ 2. Count the number of pairs i, j such that 1 β€ i < j β€ n, and there exists an integer x such that a_i β
a_j = x^k.
Input
The first line contains two integers n and k (2 β€ n β€ 10^5, 2 β€... |
Solve the programming task below in a Python markdown code block.
You are given a tree, which consists of n vertices. Recall that a tree is a connected undirected graph without cycles.
<image> Example of a tree.
Vertices are numbered from 1 to n. All vertices have weights, the weight of the vertex v is a_v.
Recall... |
Solve the programming task below in a Python markdown code block.
Eugene likes working with arrays. And today he needs your help in solving one challenging task.
An array c is a subarray of an array b if c can be obtained from b by deletion of several (possibly, zero or all) elements from the beginning and several (p... |
Solve the programming task below in a Python markdown code block.
You are playing one famous sandbox game with the three-dimensional world. The map of the world can be represented as a matrix of size n Γ m, where the height of the cell (i, j) is a_{i, j}.
You are in the cell (1, 1) right now and want to get in the ce... |
Solve the programming task below in a Python markdown code block.
Let f(x) be the sum of digits of a decimal number x.
Find the smallest non-negative integer x such that f(x) + f(x + 1) + ... + f(x + k) = n.
Input
The first line contains one integer t (1 β€ t β€ 150) β the number of test cases.
Each test case consis... |
Solve the programming task below in a Python markdown code block.
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?
Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't... |
Solve the programming task below in a Python markdown code block.
During her tantrums the princess usually smashes some collectable porcelain. Every furious shriek is accompanied with one item smashed.
The collection of porcelain is arranged neatly on n shelves. Within each shelf the items are placed in one row, so t... |
Solve the programming task below in a Python markdown code block.
You are given a string s consisting of the characters '0', '1', and '?'. You need to replace all the characters with '?' in the string s by '0' or '1' so that the string becomes a palindrome and has exactly a characters '0' and exactly b characters '1'.... |
Solve the programming task below in a Python markdown code block.
The Berland road network consists of n cities and of m bidirectional roads. The cities are numbered from 1 to n, where the main capital city has number n, and the culture capital β number 1. The road network is set up so that it is possible to reach any... |
Solve the programming task below in a Python markdown code block.
Yet another Armageddon is coming! This time the culprit is the Julya tribe calendar.
The beavers in this tribe knew math very well. Smart Beaver, an archaeologist, got a sacred plate with a magic integer on it. The translation from Old Beaverish is as... |
Solve the programming task below in a Python markdown code block.
Valera has array a, consisting of n integers a0, a1, ..., an - 1, and function f(x), taking an integer from 0 to 2n - 1 as its single argument. Value f(x) is calculated by formula <image>, where value bit(i) equals one if the binary representation of nu... |
Solve the programming task below in a Python markdown code block.
Pavel is going to make a game of his dream. However, he knows that he can't make it on his own so he founded a development company and hired n workers of staff. Now he wants to pick n workers from the staff who will be directly responsible for developin... |
Solve the programming task below in a Python markdown code block.
C*++ language is quite similar to C++. The similarity manifests itself in the fact that the programs written in C*++ sometimes behave unpredictably and lead to absolutely unexpected effects. For example, let's imagine an arithmetic expression in C*++ th... |
Solve the programming task below in a Python markdown code block.
The administration of the Tomsk Region firmly believes that it's time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decided to achieve its goal by expanding the boundaries of the city... |
Solve the programming task below in a Python markdown code block.
Bizon the Champion isn't just friendly, he also is a rigorous coder.
Let's define function f(a), where a is a sequence of integers. Function f(a) returns the following sequence: first all divisors of a1 go in the increasing order, then all divisors of ... |
Solve the programming task below in a Python markdown code block.
Today you are to solve the problem even the famous Hercule Poirot can't cope with! That's why this crime has not yet been solved and this story was never included in Agatha Christie's detective story books.
You are not informed on what crime was commi... |
Solve the programming task below in a Python markdown code block.
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... |
Solve the programming task below in a Python markdown code block.
Vitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does his homework on time and passes his exams in time.
During the last lesson the teacher has provided two strings s and t to Vitaly. Th... |
Solve the programming task below in a Python markdown code block.
You are given a string q. A sequence of k strings s1, s2, ..., sk is called beautiful, if the concatenation of these strings is string q (formally, s1 + s2 + ... + sk = q) and the first characters of these strings are distinct.
Find any beautiful seque... |
Solve the programming task below in a Python markdown code block.
Daniel has a string s, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replacement as the following sequence of steps: find a substring ".." (two consecutive periods) in string s, of all occurrenc... |
Solve the programming task below in a Python markdown code block.
Galois is one of the strongest chess players of Byteforces. He has even invented a new variant of chess, which he named Β«PawnChessΒ».
This new game is played on a board consisting of 8 rows and 8 columns. At the beginning of every game some black and wh... |
Solve the programming task below in a Python markdown code block.
Meanwhile, the kingdom of K is getting ready for the marriage of the King's daughter. However, in order not to lose face in front of the relatives, the King should first finish reforms in his kingdom. As the King can not wait for his daughter's marriage... |
Solve the programming task below in a Python markdown code block.
Yash has recently learnt about the Fibonacci sequence and is very excited about it. He calls a sequence Fibonacci-ish if
1. the sequence consists of at least two elements
2. f0 and f1 are arbitrary
3. fn + 2 = fn + 1 + fn for all n β₯ 0.
Yo... |
Solve the programming task below in a Python markdown code block.
Kolya is going to make fresh orange juice. He has n oranges of sizes a1, a2, ..., an. Kolya will put them in the juicer in the fixed order, starting with orange of size a1, then orange of size a2 and so on. To be put in the juicer the orange must have s... |
Solve the programming task below in a Python markdown code block.
Santa Claus has n candies, he dreams to give them as gifts to children.
What is the maximal number of children for whose he can give candies if Santa Claus want each kid should get distinct positive integer number of candies. Santa Class wants to give ... |
Solve the programming task below in a Python markdown code block.
Arkadiy has lots square photos with size a Γ a. He wants to put some of them on a rectangular wall with size h Γ w.
The photos which Arkadiy will put on the wall must form a rectangular grid and the distances between neighboring vertically and horizon... |
Solve the programming task below in a Python markdown code block.
Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. For example,... |
Solve the programming task below in a Python markdown code block.
The capital of Berland looks like a rectangle of size n Γ m of the square blocks of same size.
Fire!
It is known that k + 1 blocks got caught on fire (k + 1 β€ nΒ·m). Those blocks are centers of ignition. Moreover positions of k of these centers are kno... |
Solve the programming task below in a Python markdown code block.
Hands that shed innocent blood!
There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people kill others at the same time. Namely, the i-th person ki... |
Solve the programming task below in a Python markdown code block.
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.
They take turns playing, starting with Conan. In each tur... |
Solve the programming task below in a Python markdown code block.
There are n consecutive seat places in a railway carriage. Each place is either empty or occupied by a passenger.
The university team for the Olympiad consists of a student-programmers and b student-athletes. Determine the largest number of students fr... |
Solve the programming task below in a Python markdown code block.
A very unusual citizen lives in a far away kingdom β Dwarf Gracula. However, his unusual name is not the weirdest thing (besides, everyone long ago got used to calling him simply Dwarf Greg). What is special about Dwarf Greg β he's been living for over ... |
Solve the programming task below in a Python markdown code block.
Raju and Rani and playing games in the school. Raju has recently learned how to draw angles.
He knows how to draw some angles. He also can add/subtract any of the two angles he draws. Rani now wants to test Raju.
Input:
First line contains N and K... |
Solve the programming task below in a Python markdown code block.
February Easy Challenge 2015 is underway. Hackerearth welcomes you all and hope that all you awesome coders have a great time. So without wasting much of the time let's begin the contest.
Prime Numbers have always been one of the favourite topics fo... |
Solve the programming task below in a Python markdown code block.
Monk has to visit a land where strange creatures, known as Pokemons, roam around in the wild. Each Pokemon in the land will attack any visitor. They can only be pacified by feeding them their favorite food.
The Pokemon of type X eats one food item of ... |
Solve the programming task below in a Python markdown code block.
How many multiples of d are there among the integers between L and R (inclusive)?
Constraints
* All values in input are integers.
* 1 \leq L \leq R \leq 100
* 1 \leq d \leq 100
Input
Input is given from Standard Input in the following format:
L R ... |
Solve the programming task below in a Python markdown code block.
Given are simple undirected graphs X, Y, Z, with N vertices each and M_1, M_2, M_3 edges, respectively. The vertices in X, Y, Z are respectively called x_1, x_2, \dots, x_N, y_1, y_2, \dots, y_N, z_1, z_2, \dots, z_N. The edges in X, Y, Z are respective... |
Solve the programming task below in a Python markdown code block.
Requirements
* All inputs are of non-negative integer value.
* T_{\text{max}} = 10000
* 200 \leq |V| \leq 400
* 1.5 |V| \leq |E| \leq 2 |V|
* 1 \leq u_{i}, v_{i} \leq |V| (1 \leq i \leq |E|)
* 1 \leq d_{u_i, v_i} \leq \lceil 4\sqrt{2|V|} \rceil (1 \leq... |
Solve the programming task below in a Python markdown code block.
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows:
* The first term s is given as input.
* Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.
* a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.
... |
Solve the programming task below in a Python markdown code block.
Joisino is working as a receptionist at a theater.
The theater has 100000 seats, numbered from 1 to 100000.
According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inc... |
Solve the programming task below in a Python markdown code block.
E869120 defined a sequence $a$ like this:
* $a_1=a_2=1$, $a_{k+2}=a_{k+1}+a_k \ (k \ge 1)$
He also defined sequences $d_1, d_2, d_3, \dots , d_n$, as the following recurrence relation :
* $d_{1, j} = a_j$
* $d_{i, j} = \sum_{k = 1}^j d_{i - 1, k} ... |
Solve the programming task below in a Python markdown code block.
Your task is to write a program which reads a sequence of integers and prints mode values of the sequence. The mode value is the element which occurs most frequently.
Input
A sequence of integers ai (1 β€ ai β€ 100). The number of integers is less tha... |
Solve the programming task below in a Python markdown code block.
There is BMI (Body Mass Index) as an index showing the degree of obesity. The BMI value is calculated using the following formula.
BMI = weight (kg) / (height (m)) 2
The closer the BMI value is to the standard value, the more "ideal body shape" is con... |
Solve the programming task below in a Python markdown code block.
Akira, the student council president of A High School, decided to investigate which club activities the A High School students belong to. A High School has N students numbered 1 to N and M types of club activities numbered 1 to M. There is no limit to t... |
Solve the programming task below in a Python markdown code block.
At the end of last year, Santa Claus forgot to give Christmas presents to the children in JOI village. Therefore, I decided to deliver the chocolate cake to the children as an apology. The day to deliver is approaching tomorrow, so it's time to come up ... |
Solve the programming task below in a Python markdown code block.
An old document says that a Ninja House in Kanazawa City was in fact a defensive fortress, which was designed like a maze. Its rooms were connected by hidden doors in a complicated manner, so that any invader would become lost. Each room has at least tw... |
Solve the programming task below in a Python markdown code block.
Example
Input
5 3
4
2
5
Output
5
2
4
1
3
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.
You are a treasure hunter traveling around the world. Finally, youβve got an ancient text indicating the place where the treasure was hidden. The ancient text looks like a meaningless string of characters at first glance. Actually, the secret place is e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.