question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers can reconstruct the book.
After... |
Solve the programming task below in a Python markdown code block.
Students of Winter Informatics School are going to live in a set of houses connected by underground passages. Teachers are also going to live in some of these houses, but they can not be accommodated randomly. For safety reasons, the following must hold... |
Solve the programming task below in a Python markdown code block.
Winters are just damn freezing cold in Nvodsk! That's why a group of n friends prefers to take a taxi, order a pizza and call girls. The phone numbers in the city consist of three pairs of digits (for example, 12-34-56). Each friend has a phonebook of s... |
Solve the programming task below in a Python markdown code block.
A string s of length n (1 β€ n β€ 26) is called alphabetical if it can be obtained using the following algorithm:
* first, write an empty string to s (i.e. perform the assignment s := "");
* then perform the next step n times;
* at the i-th step ... |
Solve the programming task below in a Python markdown code block.
Hamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 β€ i β€ |a|), such that ai β bi, where ai is the i-th symbol of string a, bi is the i-th symbol of string b. For example, the Ha... |
Solve the programming task below in a Python markdown code block.
A coordinate line has n segments, the i-th segment starts at the position li and ends at the position ri. We will denote such a segment as [li, ri].
You have suggested that one of the defined segments covers all others. In other words, there is such se... |
Solve the programming task below in a Python markdown code block.
HAI
I HAS A TUX
GIMMEH TUX
I HAS A FOO ITS 0
I HAS A BAR ITS 0
I HAS A BAZ ITS 0
I HAS A QUZ ITS 1
TUX IS NOW A NUMBR
IM IN YR LOOP NERFIN YR TUX TIL BOTH SAEM TUX AN 0
I HAS A PUR
G... |
Solve the programming task below in a Python markdown code block.
In the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one queue to another.
(Cultural no... |
Solve the programming task below in a Python markdown code block.
Little Chris is very keen on his toy blocks. His teacher, however, wants Chris to solve more problems, so he decided to play a trick on Chris.
There are exactly s blocks in Chris's set, each block has a unique number from 1 to s. Chris's teacher picks ... |
Solve the programming task below in a Python markdown code block.
Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.
Given a group of n non-empty strings. During the game two players build the word together, initially the word is empty. The players move in turns. On his ... |
Solve the programming task below in a Python markdown code block.
User ainta has a permutation p1, p2, ..., pn. As the New Year is coming, he wants to make his permutation as pretty as possible.
Permutation a1, a2, ..., an is prettier than permutation b1, b2, ..., bn, if and only if there exists an integer k (1 β€ k β€... |
Solve the programming task below in a Python markdown code block.
Anya loves to fold and stick. Today she decided to do just that.
Anya has n cubes lying in a line and numbered from 1 to n from left to right, with natural numbers written on them. She also has k stickers with exclamation marks. We know that the number... |
Solve the programming task below in a Python markdown code block.
In Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, ci in row, without visiting other... |
Solve the programming task below in a Python markdown code block.
There are n sharks who grow flowers for Wet Shark. They are all sitting around the table, such that sharks i and i + 1 are neighbours for all i from 1 to n - 1. Sharks n and 1 are neighbours too.
Each shark will grow some number of flowers si. For i-th... |
Solve the programming task below in a Python markdown code block.
On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings β 5 work days and then 2 days off. Your task is to determine the minimum possible and the maximum possible number of days of... |
Solve the programming task below in a Python markdown code block.
You are given a positive decimal number x.
Your task is to convert it to the "simple exponential notation".
Let x = aΒ·10b, where 1 β€ a < 10, then in general case the "simple exponential notation" looks like "aEb". If b equals to zero, the part "Eb" sh... |
Solve the programming task below in a Python markdown code block.
ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) and '<image>' (square root). Initially, the number 2 is displayed on the screen. There are n + 1 levels in the game and ZS the Coder start ... |
Solve the programming task below in a Python markdown code block.
Input
The input contains a single integer a (1 β€ a β€ 30).
Output
Output a single integer.
Example
Input
3
Output
27
The input will be give
Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on ... |
Solve the programming task below in a Python markdown code block.
Arpa is researching the Mexican wave.
There are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0.
* At time 1, the first spectator stands.
* At time 2, the second spectator stands.
* ...
* At time k, t... |
Solve the programming task below in a Python markdown code block.
You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.
Some long and uninteresting story was removed...
The alphabet of Bookland is so large that its letters are denoted by... |
Solve the programming task below in a Python markdown code block.
Vasya writes his own library for building graphical user interface. Vasya called his creation VTK (VasyaToolKit). One of the interesting aspects of this library is that widgets are packed in each other.
A widget is some element of graphical interface.... |
Solve the programming task below in a Python markdown code block.
Dima is a beginner programmer. During his working process, he regularly has to repeat the following operation again and again: to remove every second element from the array. One day he has been bored with easy solutions of this problem, and he has come ... |
Solve the programming task below in a Python markdown code block.
Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:
* if the last digit of the number is non-zero, she decr... |
Solve the programming task below in a Python markdown code block.
For a vector \vec{v} = (x, y), define |v| = β{x^2 + y^2}.
Allen had a bit too much to drink at the bar, which is at the origin. There are n vectors \vec{v_1}, \vec{v_2}, β
β
β
, \vec{v_n}. Allen will make n moves. As Allen's sense of direction is impaired... |
Solve the programming task below in a Python markdown code block.
Today Oz is playing a new game. He has an array arr[] of N distinct integers . In each turn he is will follow two actions -
1) He select a random number from arr[]. Say value of this element is X.
2) He will remove X from arr[]. if X-1 is present in ar... |
Solve the programming task below in a Python markdown code block.
Professor Hatim is researching the sexual behavior of a rare species of lizard. He assumes that they feature two different genders and that they only interact with lizard of the opposite gender. Each lizard has a integer printed on their back.
Given th... |
Solve the programming task below in a Python markdown code block.
There is a street by the name of colorful street in the Pretty Town. The residents of the house have decided that they will paint their houses in either Pink, Orange or Yellow color and not other. They have also decided that no two adjacent houses will ... |
Solve the programming task below in a Python markdown code block.
Xenny had N cubes. Each cube had six faces and each face had a Latin character on each of it's sides.
Xenny's friend Asdoc had an interesting activity in mind. He gave Xenny a string S and asked him to use the cubes to form that string. Xenny being a v... |
Solve the programming task below in a Python markdown code block.
We have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.
We will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers sh... |
Solve the programming task below in a Python markdown code block.
Takahashi is going to set a 3-character password.
How many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?
Constraints
* 1 \leq N \leq 9
* N is an integer.
Input
Input is given from Standard Input... |
Solve the programming task below in a Python markdown code block.
An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.
Given an integer N, determine whether it is a Harshad number.
Constraints
* 1?N?10^8
* N is an integer.
Input
Input... |
Solve the programming task below in a Python markdown code block.
Fennec and Snuke are playing a board game.
On the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeat... |
Solve the programming task below in a Python markdown code block.
Snuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.
He will perform the operation described below zero or more times, so that the values written on the remaining c... |
Solve the programming task below in a Python markdown code block.
Create a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the center of the base is orthogonal to the base. Also, x and ... |
Solve the programming task below in a Python markdown code block.
A project is underway to build a new viewing tower in Bange town called βBange Hills Towerβ whose selling point will be the gorgeous view of the entire main keep of Wakamatsu Castle from top to bottom. Therefore, the view line from the top of the tower ... |
Solve the programming task below in a Python markdown code block.
Once upon a time, there was a traveler.
He plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a program which determines the route for... |
Solve the programming task below in a Python markdown code block.
Given an undirected weighted graph G, you should find one of spanning trees specified as follows.
The graph G is an ordered pair (V, E), where V is a set of vertices {v1, v2, ... , vn} and E is a set of undirected edges {e1, e2, ... , em}. Each edge e ... |
Solve the programming task below in a Python markdown code block.
At University A, there were many mistakes in entering IDs.
Therefore, University A decided to issue a new ID to prevent typos.
There is a way to check if the new ID is correct to prevent typos.
γ» Calculate the sum of all digits.
γ» However, the number... |
Solve the programming task below in a Python markdown code block.
Problem
Ghosts line up in a straight line from left to right with $ N $ people.
At first, the $ i $ th ghost from the left is facing left if $ U_i $ is'L', and facing right if it is'R'.
They are so timid that I don't want to see scary ghosts as much a... |
Solve the programming task below in a Python markdown code block.
For a given polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 β€ i β€ n-1) are sides of g. The line segment connecting pn and p1 is also a side of the polygo... |
Solve the programming task below in a Python markdown code block.
Write a program which reads a sequence of integers $A = \\{a_0, a_1, ..., a_{n-1}\\}$ and rotate specified elements by a list of the following operation:
* rotate($b, m, e$): For each integer $k$ ($0 \leq k < (e - b)$), move element $b + k$ to the plac... |
Solve the programming task below in a Python markdown code block.
You are given two strings s and t. The string s consists of lowercase Latin letters and at most one wildcard character '*', the string t consists only of lowercase Latin letters. The length of the string s equals n, the length of the string t equals m.
... |
Solve the programming task below in a Python markdown code block.
You are playing a strange game with Li Chen. You have a tree with n nodes drawn on a piece of paper. All nodes are unlabeled and distinguishable. Each of you independently labeled the vertices from 1 to n. Neither of you know the other's labelling of th... |
Solve the programming task below in a Python markdown code block.
Ivan unexpectedly saw a present from one of his previous birthdays. It is array of n numbers from 1 to 200. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its neighbours ls not less than it, more for... |
Solve the programming task below in a Python markdown code block.
Arkady invited Anna for a dinner to a sushi restaurant. The restaurant is a bit unusual: it offers n pieces of sushi aligned in a row, and a customer has to choose a continuous subsegment of these sushi to buy.
The pieces of sushi are of two types: eit... |
Solve the programming task below in a Python markdown code block.
You are given a set of points x_1, x_2, ..., x_n on the number line.
Two points i and j can be matched with each other if the following conditions hold:
* neither i nor j is matched with any other point;
* |x_i - x_j| β₯ z.
What is the maximum... |
Solve the programming task below in a Python markdown code block.
You are given two integers b and w. You have a chessboard of size 10^9 Γ 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.
Your task is to find a connected component on this chessboard that contains exactly b black cells and exac... |
Solve the programming task below in a Python markdown code block.
Hanh lives in a shared apartment. There are n people (including Hanh) living there, each has a private fridge.
n fridges are secured by several steel chains. Each steel chain connects two different fridges and is protected by a digital lock. The owner... |
Solve the programming task below in a Python markdown code block.
Polycarp is sad β New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands.
The local store introduced a new service this year, called "Build your own gar... |
Solve the programming task below in a Python markdown code block.
Catherine received an array of integers as a gift for March 8. Eventually she grew bored with it, and she started calculated various useless characteristics for it. She succeeded to do it for each one she came up with. But when she came up with another ... |
Solve the programming task below in a Python markdown code block.
Nastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.
In total, Nastya dropped n grains. Nastya read that each grain weighs some integer number of grams fro... |
Solve the programming task below in a Python markdown code block.
Shubham has an array a of size n, and wants to select exactly x elements from it, such that their sum is odd. These elements do not have to be consecutive. The elements of the array are not guaranteed to be distinct.
Tell him whether he can do so.
Inp... |
Solve the programming task below in a Python markdown code block.
Every year Santa Claus gives gifts to all children. However, each country has its own traditions, and this process takes place in different ways. For example, in Berland you need to solve the New Year's puzzle.
Polycarp got the following problem: given... |
Solve the programming task below in a Python markdown code block.
You have a board represented as a grid with 2 Γ n cells.
The first k_1 cells on the first row and first k_2 cells on the second row are colored in white. All other cells are colored in black.
You have w white dominoes (2 Γ 1 tiles, both cells are colo... |
Solve the programming task below in a Python markdown code block.
This is an interactive problem.
This is a hard version of the problem. The difference from the easy version is that in the hard version 1 β€ t β€ min(n, 10^4) and the total number of queries is limited to 6 β
10^4.
Polycarp is playing a computer game. I... |
Solve the programming task below in a Python markdown code block.
The King of Flatland will organize a knights' tournament! The winner will get half the kingdom and the favor of the princess of legendary beauty and wisdom. The final test of the applicants' courage and strength will be a fencing tournament. The tournam... |
Solve the programming task below in a Python markdown code block.
Let's consider one interesting word game. In this game you should transform one word into another through special operations.
Let's say we have word w, let's split this word into two non-empty parts x and y so, that w = xy. A split operation is transf... |
Solve the programming task below in a Python markdown code block.
You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges between a pair of vertices and loops (edges from the vertex t... |
Solve the programming task below in a Python markdown code block.
One day Ms Swan bought an orange in a shop. The orange consisted of nΒ·k segments, numbered with integers from 1 to nΒ·k.
There were k children waiting for Ms Swan at home. The children have recently learned about the orange and they decided to divide i... |
Solve the programming task below in a Python markdown code block.
Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC.
For that, he asked to give him the st... |
Solve the programming task below in a Python markdown code block.
You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban β an abacus developed in Japan. This phenomen... |
Solve the programming task below in a Python markdown code block.
Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she thinks it would make a good base for her new unique system.... |
Solve the programming task below in a Python markdown code block.
Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler!
However, there is no reason for disappointment, as Valery has found another ruler, its length is l centime... |
Solve the programming task below in a Python markdown code block.
Let's define the sum of two permutations p and q of numbers 0, 1, ..., (n - 1) as permutation <image>, where Perm(x) is the x-th lexicographically permutation of numbers 0, 1, ..., (n - 1) (counting from zero), and Ord(p) is the number of permutation p ... |
Solve the programming task below in a Python markdown code block.
Ford Prefect got a job as a web developer for a small company that makes towels. His current work task is to create a search engine for the website of the company. During the development process, he needs to write a subroutine for comparing strings S an... |
Solve the programming task below in a Python markdown code block.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in this expressi... |
Solve the programming task below in a Python markdown code block.
You are given a sequence of n integers a1, a2, ..., an.
Determine a real number x such that the weakness of the sequence a1 - x, a2 - x, ..., an - x is as small as possible.
The weakness of a sequence is defined as the maximum value of the poorness o... |
Solve the programming task below in a Python markdown code block.
You are given two circles. Find the area of their intersection.
Input
The first line contains three integers x1, y1, r1 ( - 109 β€ x1, y1 β€ 109, 1 β€ r1 β€ 109) β the position of the center and the radius of the first circle.
The second line contains th... |
Solve the programming task below in a Python markdown code block.
One day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture by composing a graph G with the follo... |
Solve the programming task below in a Python markdown code block.
You have recently fallen through a hole and, after several hours of unconsciousness, have realized you are in an underground city. On one of your regular, daily walks through the unknown, you have encountered two unusually looking skeletons called Sanz ... |
Solve the programming task below in a Python markdown code block.
Due to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given the task of buying mouses, and you have to spend as little as possible. After all, the country is in crisis!
The compu... |
Solve the programming task below in a Python markdown code block.
Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale:
"Once upon a time, there lived an emperor. He was very rich and had much grain. One day he ordered to build a huge b... |
Solve the programming task below in a Python markdown code block.
You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal to x / y.
Your favorite rationa... |
Solve the programming task below in a Python markdown code block.
John has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is reachable from any other city. Cities are labeled from 1 to N.... |
Solve the programming task below in a Python markdown code block.
You have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining points are located on one side of the OY axis.
Input
The first line contains a single positive integer n (2 β€ n β€ 105)... |
Solve the programming task below in a Python markdown code block.
Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 β€ i < n) the value a_{i+1} - a_i is the same. For example, the sequences [42], [5, 5, 5], [2, 11, 20, 29] and [3, 2, 1, 0] are a... |
Solve the programming task below in a Python markdown code block.
Statement: Sourav and his friends are in kolkata city and they are
planning for a city tour. So, they booked a TUBER cab
(Stop Giggling). Please help them to find the estimated fare
according to the fare evaluator system of TUBER cabs.
How to evaluate... |
Solve the programming task below in a Python markdown code block.
Mahabir loves matrix and likes to rotate things a lot.
Today he is rotating an array in clock-wise direction. He gives you an array of size N X N and an positive integer Q.
Each Q number of integers contains an angle A (angle is always multiple of 90... |
Solve the programming task below in a Python markdown code block.
Shil got an array of N integers as a present on his birthday. But he didn't liked it. Shil wants to make this array beautiful. Shil considers an array A1,A2,A3 . . . AN beautiful if A1 > AN. Inorder to make it beautiful Shil can swap any two numbers i... |
Solve the programming task below in a Python markdown code block.
The Hound and his brother the Mountain are engaged in a fight against each other in King's Landing. At the end of the fight, one dies and the other wins. They both are given a decimal number each in the 8 bit binary representation A and B. These numbers... |
Solve the programming task below in a Python markdown code block.
Xsquare loves to play with strings a lot. Today, he has two strings S1 and S2 both consisting of lower case alphabets. Xsquare listed all subsequences of string S1 on a paper and all subsequences of string S2 on a separate paper. Xsquare wants to know w... |
Solve the programming task below in a Python markdown code block.
Given is a positive integer N. Consider repeatedly applying the operation below on N:
* First, choose a positive integer z satisfying all of the conditions below:
* z can be represented as z=p^e, where p is a prime number and e is a positive integer;
*... |
Solve the programming task below in a Python markdown code block.
Takahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.
The problem has N test cases, all of which must be passed to get an AC verdict.
Takahashi's submission has passed M cases out of the N test cases.
... |
Solve the programming task below in a Python markdown code block.
There are N gems. The value of the i-th gem is V_i.
You will choose some of these gems, possibly all or none, and get them.
However, you need to pay a cost of C_i to get the i-th gem.
Let X be the sum of the values of the gems obtained, and Y be the ... |
Solve the programming task below in a Python markdown code block.
Three people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicate when the distance between them... |
Solve the programming task below in a Python markdown code block.
You are given two strings s and t consisting of lowercase English letters and an integer L.
We will consider generating a string of length L by concatenating one or more copies of s and t. Here, it is allowed to use the same string more than once.
For... |
Solve the programming task below in a Python markdown code block.
We will call a string that can be obtained by concatenating two equal strings an even string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not.
You are given an even string S consisting of lowercase English letters. Find ... |
Solve the programming task below in a Python markdown code block.
You have an integer variable x. Initially, x=0.
Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=`I`, and decremented the ... |
Solve the programming task below in a Python markdown code block.
Mr. Takahashi has a string s consisting of lowercase English letters. He repeats the following operation on s exactly K times.
* Choose an arbitrary letter on s and change that letter to the next alphabet. Note that the next letter of `z` is `a`.
Fo... |
Solve the programming task below in a Python markdown code block.
<image>
You know the merry-go-round in the amusement park. Vehicles such as horses and carriages are fixed on a large disk, and it is a standard playset that the vehicle swings up and down at the same time as the disk rotates. A merry-go-round in an a... |
Solve the programming task below in a Python markdown code block.
In Square Town, where many people who love squares live, a festival is held to color the town with illuminations that combine square lightning boards. This electric board emits light when electricity is applied, and the plate in contact with the light e... |
Solve the programming task below in a Python markdown code block.
In the advanced algorithm class, n2 students sit in n rows and n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift ... |
Solve the programming task below in a Python markdown code block.
<image>
The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business.
One of the unique features of this contest is the great number of judges that sometimes co... |
Solve the programming task below in a Python markdown code block.
Problem
I started a part-time job at the rental DVD shop "NEO". First of all, I decided to study the fee system of this store.
There are three types of rental DVDs, old, semi-new, and new, and the rental fee for one DVD is a yen, b yen, and c yen, res... |
Solve the programming task below in a Python markdown code block.
Alice wants to send an email to Miku on her mobile phone.
The only buttons that can be used for input on mobile phones are number buttons. Therefore, in order to input characters, the number buttons are pressed several times to input characters. The fo... |
Solve the programming task below in a Python markdown code block.
You are a programmer on the development team for new recording media. This recording medium can be randomly accessed for reading and erasing data. On the other hand, when writing data, access is always performed in order from the beginning, and only the... |
Solve the programming task below in a Python markdown code block.
Example
Input
8
-10 0
-10 5
-5 5
-5 0
10 0
10 -5
5 -5
5 0
Output
50
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... |
Solve the programming task below in a Python markdown code block.
I: Ravage
Santa Claus was caught in the illuminations of the city and broke it.
There are N light bulbs in the illumination, and the $ i $ th light bulb only comes on when the voltage is above $ A_i $ and below $ B_i $.
The voltage should be the same... |
Solve the programming task below in a Python markdown code block.
Write a program which prints the central coordinate ($cx$,$cy$) and the radius $r$ of a incircle of a triangle which is constructed by three points ($x_1$, $y_1$), ($x_2$, $y_2$) and ($x_3$, $y_3$) on the plane surface.
Constraints
* $-10000 \leq x_i,... |
Solve the programming task below in a Python markdown code block.
For a given sequence $A = \\{a_0, a_1, ..., a_{n-1}\\}$ which is sorted by ascending order, find the lower bound for a specific value $k$ given as a query.
* lower bound: the place pointing to the first element greater than or equal to a specific value... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.