formatted_conversations stringlengths 1.13k 138k |
|---|
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Zeke loves to spend time with Penny and likes her. Penny is having an issue to solve a mathematics problem and is confused. She seeks ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given are a sequence of N positive integers A_1, A_2, \ldots, A_N and another positive integer S.
For a non-empty subset T of the set ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given is a permutation P_1, \ldots, P_N of 1, \ldots, N. Find the number of integers i (1 \leq i \leq N) that satisfy the following co... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Today is August 24, one of the five Product Days in a year.
A date m-d (m is the month, d is the date) is called a Product Day when d... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.
You can perform the following operation on this integer se... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string s. Among the different substrings of s, print the K-th lexicographically smallest one.
A substring of s is a s... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N towns on a line running east-west. The towns are numbered 1 through N, in order from west to east. Each point on the line ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Internet search engines, such as Google, automatically sort and categorize web pages around the world to create a huge database. It al... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mr. Matsudaira is always careful about eco-friendliness in his life. Last month's water charge was 4280 yen, which exceeded the usual ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.It’s still hot every day, but September has already come. It’s autumn according to the calendar. Looking around, I see two red dragonf... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.On a clear night, a boy, Campanella looked up at the sky, there were many stars which have different colors such as red, yellow, green... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The amount of information on the World Wide Web is growing quite rapidly. In this information explosion age, we must survive by access... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.For given a circle $c$ and a line $l$, print the coordinates of the cross points of them.
Constraints
* $p1$ and $p2$ are different
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.For a set $S$ of integers, perform a sequence of the following operations. Note that each value in $S$ must be unique.
* insert($x$):... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Zombies zombies everywhere!!
In a parallel world of zombies, there are N zombies. There are infinite number of unused cars, each of s... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Jagjit Singh (Jaggi) is among the few fastest athletes of Thapar. Just before the Thapar Olympics he thought of a new way to practice.... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alice's school is planning to take some students from her class on a field trip. Alice is really excited about it. There are a total o... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the luck... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Natasha travels around Mars in the Mars rover. But suddenly it broke down, namely — the logical scheme inside it. The scheme is an und... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In Disgaea as in most role-playing games, characters have skills that determine the character's ability to use certain weapons or spel... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Arkady coordinates rounds on some not really famous competitive programming platform. Each round features n problems of distinct diffi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an array a consisting of 500000 integers (numbered from 1 to 500000). Initially all elements of a are zero.
You have to... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given n k-digit integers. You have to rearrange the digits in the integers so that the difference between the largest and the ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two positive integers a and b.
In one move, you can change a in the following way:
* Choose any positive odd integer... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string s such that each its character is either 1, 2, or 3. You have to choose the shortest contiguous substring of s ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a chessboard consisting of n rows and n columns. Rows are numbered from bottom to top from 1 to n. Columns are numbered ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given n strings s_1, s_2, …, s_n consisting of lowercase Latin letters.
In one operation you can remove a character from a st... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Argus was charged with guarding Io, which is not an ordinary cow. Io is quite an explorer, and she wanders off rather frequently, maki... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a number n (divisible by 3) and an array a[1 ... n]. In one move, you can increase any of the array elements by one. For... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Polycarpus got hold of a family relationship tree. The tree describes family relationships of n people, numbered 1 through n. Each per... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Scientists say a lot about the problems of global warming and cooling of the Earth. Indeed, such natural phenomena strongly influence ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Farmer John has just given the cows a program to play with! The program contains two integer variables, x and y, and performs the foll... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Two players are playing a game. First each of them writes an integer from 1 to 6, and then a dice is thrown. The player whose written ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Vasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.
The queen is ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Anya has bought a new smartphone that uses Berdroid operating system. The smartphone menu has exactly n applications, each application... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Programmers working on a large project have just received a task to write exactly m lines of code. There are n programmers working on ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Vector Willman and Array Bolt are the two most famous athletes of Byteforces. They are going to compete in a race with a distance of L... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.As you know, the game of "Nim" is played with n piles of stones, where the i-th pile initially contains ai stones. Two players alterna... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty substring of s and ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Stepan has a set of n strings. Also, he has a favorite string s.
Stepan wants to do the following. He will take some strings of his ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an undirected graph with weighted edges. The length of some path between two vertices is the bitwise xor of weights of a... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Attention: we lost all the test cases for this problem, so instead of solving the problem, we need you to generate test cases. We're g... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Bash likes playing with arrays. He has an array a1, a2, ... an of n integers. He likes to guess the greatest common divisor (gcd) of d... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The weather is fine today and hence it's high time to climb the nearby pine and enjoy the landscape.
The pine's trunk includes severa... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an array of positive integers. While there are at least two equal elements, we will perform the following operation. We ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chandler and Joey
Joey and Chandler got bored of playing foosball, so they thought of trying something new.As Joey is very intelligen... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given the time in numerals we may convert it into words, as shown below:
5:00→ five o' clock
5:01→ one minute past five
5:10→ ten m... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The Monk wants to buy some cities. To buy two cities, he needs to buy the road connecting those two cities. Now, you are given a list ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Maggu has just joined play school. His teacher taught him A,a,B,b,C,c. He is much fascinated with these letters and now he is looking... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Today is Vasya's birthday. On this special occasion, he has organized a party for all of his friends. These friends are enumerated by ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Let f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:
* 1 \leq x,y,z
* x^2 + y^2 + z^2... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.10^9 contestants, numbered 1 to 10^9, will compete in a competition. There will be two contests in this competition.
The organizer pr... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are N pieces of sushi. Each piece has two parameters: "kind of topping" t_i and "deliciousness" d_i. You are choosing K among th... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You have three tasks, all of which need to be completed.
First, you can complete any one task at cost 0.
Then, just after completing... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Write a program that extracts n different numbers from the numbers 0 to 9 and outputs the number of combinations that add up to s. Eac... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.problem
At the JOI pasta shop, the recommended pasta for lunch and the set menu of freshly squeezed juice are popular. When ordering ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.After having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ashore on a foggy island. Though ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.B: 階層的計算機 (Hierarchical Calculator)
Problem
Ebi-chan has N formulae: y = a_i x for i =1, ..., N (inclusive). Now she considers a sub... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Problem
Gaccho is trying to play the piano. The piano on the right side produces a higher note. Gaccho has a certain score and plays ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the foll... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Draw a rectangle which has a height of H cm and a width of W cm. Draw a 1-cm square by single '#'.
Constraints
* 1 ≤ H ≤ 300
* 1 ≤ W... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kattapa, as you all know was one of the greatest warriors of his time. The kingdom of Maahishmati had never lost a battle under him (a... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A DNA sequence can be represented by a string of letters T, A, C, and G representing four different amino acids. DNA sequences are oft... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.N one dimensional kingdoms are represented as intervals of the form [ai , bi] on the real line.
A kingdom of the form [L, R] can be de... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Cyael is a teacher at a very famous school in Byteland and she is known by her students for being very polite to them and also to enco... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an array a, consisting of n positive integers.
Let's call a concatenation of numbers x and y the number that is obtaine... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two positive integers a and b. There are two possible operations:
1. multiply one of the numbers by some prime p;
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through n ⋅ k cities. The cities are numerate... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are n products in the shop. The price of the i-th product is a_i. The owner of the shop wants to equalize the prices of all prod... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Amugae is in a very large round corridor. The corridor consists of two areas. The inner area is equally divided by n sectors, and the ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.While roaming the mystic areas of Stonefalls, in order to drop legendary loot, an adventurer was given a quest as follows. He was give... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are n Christmas trees on an infinite number line. The i-th tree grows at the position x_i. All x_i are guaranteed to be distinct... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two integers n and k. Your task is to find if n can be represented as a sum of k distinct positive odd (not divisible by... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Leo has developed a new programming language C+=. In C+=, integer variables can only be changed with a "+=" operation that adds the ri... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Let's call left cyclic shift of some string t_1 t_2 t_3 ... t_{n - 1} t_n as string t_2 t_3 ... t_{n - 1} t_n t_1.
Analogically, let'... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a binary string a of length n. In one operation, you can select any prefix of a with an equal number of 0 and 1 symbols. Then... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Parsa has a humongous tree on n vertices.
On each vertex v he has written two integers l_v and r_v.
To make Parsa's tree look even m... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Lenny is playing a game on a 3 × 3 grid of lights. In the beginning of the game all lights are switched on. Pressing any of the lights... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.'Jeopardy!' is an intellectual game where players answer questions and earn points. Company Q conducts a simplified 'Jeopardy!' tourna... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Appleman has n cards. Each card has an uppercase letter written on it. Toastman must choose k cards from Appleman's cards. Then Applem... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.For a positive integer n let's define a function f:
f(n) = - 1 + 2 - 3 + .. + ( - 1)nn
Your task is to calculate f(n) for a given in... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The on-board computer on Polycarp's car measured that the car speed at the beginning of some section of the path equals v1 meters per ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A tourist wants to visit country Zeydabad for Zbazi (a local game in Zeydabad).
The country Zeydabad is a rectangular table consistin... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Consider a linear function f(x) = Ax + B. Let's define g(0)(x) = x and g(n)(x) = f(g(n - 1)(x)) for n > 0. For the given integer value... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alice wants to send an important message to Bob. Message a = (a1, ..., an) is a sequence of positive integers (characters).
To compre... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition."Night gathers, and now my watch begins. It shall not end until my death. I shall take no wife, hold no lands, father no children. I s... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Bear Limak prepares problems for a programming competition. Of course, it would be unprofessional to mention the sponsor name in the s... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Consider a [billiard table](https://en.wikipedia.org/wiki/Billiard_table) of rectangular size n × m with four pockets. Let's introduce... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ashima's mid term exams are just over. Since, its raining heavily outside, she can't go shopping.
So, she and her best friend Aishwary... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ben was playing with the Omnitrix in free time. He screwed up once again. Not knowing what he was doing, he accessed the DNA analysis ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Rufus wants to go to the Lily's birthday party to surprise Lily. But Lily's party invitation has a unique code on it which is in the f... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.On Unix computers, data is stored in directories. There is one root directory, and this might have several directories contained insid... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Jack stays in a n-storey hostel. His dorm room is on the jth floor. Every morning, he is in so much hurry for classes that he cannot n... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Micro's midsem exams are finally over. When they were going on, instead of studying he would spend time making list of things that he ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Let us define an easy Sorting Algorithm called SoftSort. SoftSort Sorting algorithm involves use of IF and ELSE decision statements o... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A palindrome is a string that is the same whether it is read from left to right or from right to left. Chota Bheem likes palindromes a... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi the Jumbo will practice golf.
His objective is to get a carry distance that is a multiple of K, while he can only make a ca... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given is a tree T with N vertices. The i-th edge connects Vertex A_i and B_i (1 \leq A_i,B_i \leq N).
Now, each vertex is painted bla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.