question_answer_string stringlengths 111 33.1k |
|---|
Question: 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.Find the intersection of two sets $A = \\{a_0, a_1, ..., a_{n-1}\\}$ and $B = \\{b_0, b_1, ..., b_{m-1}\\}$.
Constraints
* $1 \l... |
Question: 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.Mike is a bartender at Rico's bar. At Rico's, they put beer glasses in a special shelf. There are n kinds of beer at Rico's number... |
Question: 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 imagine that you're playing the following simple computer game. The screen displays n lined-up cubes. Each cube is painted o... |
Question: 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 schoolboy named Vasya loves reading books on programming and mathematics. He has recently read an encyclopedia article that desc... |
Question: 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 only difference between easy and hard versions is constraints.
The BerTV channel every day broadcasts one episode of one of t... |
Question: 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 text of single-space separated words, consisting of small and capital Latin letters.
Volume of the word is number... |
Question: 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 Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two stor... |
Question: 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, Masha was presented with a chessboard with a height of n and a width of m.
The rows on the chessboard are numbered from... |
Question: 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 Chef likes to stay in touch with his staff. So, the Chef, the head server, and the sous-chef all carry two-way transceivers so... |
Question: 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.Phoenix is trying to take a photo of his n friends with labels 1, 2, ..., n who are lined up in a row in a special order. But befo... |
Question: 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.This issue is a reactive issue. It is necessary to create a program that derives the correct answer by interactively responding to... |
Question: 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 positive integer n greater or equal to 2. For every pair of integers a and b (2 ≤ |a|, |b| ≤ n), you can transform... |
Question: 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.Akaki, a patissier, can make N kinds of doughnut using only a certain powder called "Okashi no Moto" (literally "material of pastr... |
Question: 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 integers b (b \geq 2) and n (n \geq 1), let the function f(b,n) be defined as follows:
* f(b,n) = n, when n < b
* f(b,n) = f(... |
Question: 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.Vlad likes to eat in cafes very much. During his life, he has visited cafes n times. Unfortunately, Vlad started to feel that his ... |
Question: 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.Squirrel Liss is interested in sequences. She also has preferences of integers. She thinks n integers a1, a2, ..., an are good.
N... |
Question: 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.Jou and Yae are a good couple. Jou is collecting prizes for capsule toy vending machines (Gachapon), and even when they go out tog... |
Question: 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.Tourist walks along the X axis. He can choose either of two directions and any speed not exceeding V. He can also stand without mo... |
Question: 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.Running with barriers on the circle track is very popular in the country where Dasha lives, so no wonder that on her way to classe... |
Question: 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
You are looking for a constellation in a picture of the starry sky. The photo always contains exactly one figure with the... |
Question: 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 to find the remainder when two given numbers are divided.
Input
The first line contains an integer T, total numb... |
Question: 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.One night Mr.X and Mr.Y were playing a game. To test Mr.Y's intelligence Mr.X gives him an interesting problem to solve.
He gives ... |
Question: 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.Archith was a making noise in digital logic class.Sir was very frustrated by the behaviour of Archith. Sir asked archith to meet h... |
Question: 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.Compute A \times B.
Constraints
* 1 \leq A \leq 100
* 1 \leq B \leq 100
* All values in input are integers.
Input
Input is giv... |
Question: 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.Maxim wants to buy an apartment in a new house at Line Avenue of Metropolis. The house has n apartments that are numbered from 1 t... |
Question: 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 square matrix of size n. Rows are indexed 1 to n from top to
bottom and columns are indexed 1 to n
form left to ri... |
Question: 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 lives in a strange world. The year has n months and the i-th month has ai days. Vasya got a New Year present — the clock tha... |
Question: 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.Bangalore City, where peace prevails most of the time. Not everyone is a huge fan of peace, though. Certainly not Mr. XYZ, whose i... |
Question: 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.Jzzhu have n non-negative integers a1, a2, ..., an. We will call a sequence of indexes i1, i2, ..., ik (1 ≤ i1 < i2 < ... < ik ≤ n... |
Question: 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.Lately, a national version of a bingo game has become very popular in Berland. There are n players playing the game, each player h... |
Question: 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're given a row with n chairs. We call a seating of people "maximal" if the two following conditions hold:
1. There are no n... |
Question: 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 a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-... |
Question: 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'll be given an array A of N integers as input. For each element of the array A[i], print A[i]-1.
Input:
There will be N+1 ii... |
Question: 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.Professor GukiZ makes a new robot. The robot are in the point with coordinates (x1, y1) and should go to the point (x2, y2). In a ... |
Question: 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 sky scraper with 1000 floors has been built in the city of N. It has modern superfast elevators to help to travel from one floor... |
Question: 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 a string s which contains lowercase english letters and dot sign (.) (e.g: abc.d.ee.g). Your task is to replace substring ... |
Question: 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.Oranges on Cans
square1001 You put a $ N $ can of aluminum on the table.
E869120 You put $ M $ of oranges on each aluminum can o... |
Question: 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 monster is chasing after Rick and Morty on another planet. They're so frightened that sometimes they scream. More accurately, Ri... |
Question: 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 several latest reforms many tourists are planning to visit Berland, and Berland people understood that it's an opportunity t... |
Question: 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
In the area where Kazakhstan is now located, there used to be a trade route called the "Silk Road".
There are N + 1 citi... |
Question: 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 not less than 1. The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 ... |
Question: 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 fed up with your messy room, so you decided to clean it up.
Your room is a bracket sequence s=s_{1}s_{2}... s_{n} of leng... |
Question: 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.Like most of the girlfriends, Ashima when asks for something, won’t stop until she gets that.
The way she gets that is by keep on ... |
Question: 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.Emma is fond of prime numbers. Emma’s teacher gave her an interesting problem to solve.
The problem is as follows:
The teacher ga... |
Question: 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 number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example
* 1
* ... |
Question: 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.Like other girlfriends Chintu's girlfriend is also very demanding. This time she is demanding for bracelet having atleast k specia... |
Question: 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 locked in a room with a door that has a keypad with 10 keys corresponding to digits from 0 to 9. To escape from the room, ... |
Question: 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 the math lesson a teacher asked each pupil to come up with his own lucky numbers. As a fan of number theory Peter chose prime n... |
Question: 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.With the T20 world cup going on, a list of batsmen was prepared with their country code and their T20I career runs.
The list con... |
Question: 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 bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i ... |
Question: 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 new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described b... |
Question: 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 K nuclear reactor chambers labelled from 0 to K-1. Particles are bombarded onto chamber 0. The particles keep collecting... |
Question: 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.Once upon a time, there was a king who loved beautiful costumes very much. The king had a special cocoon bed to make excellent clo... |
Question: 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 Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.
To make ... |
Question: 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 following problem is well-known: given integers n and m, calculate
<image>,
where 2n = 2·2·...·2 (n factors), and <image> d... |
Question: 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 binary matrix A of size n × n. Let's denote an x-compression of the given matrix as a matrix B of size n/x × n/x s... |
Question: 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.Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones.
On... |
Question: 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.Ram has to pay Shyam R rupees and but the coins which he has got is of limited denomination .Assuming he has a limited knowledge o... |
Question: 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 long time ago (probably even in the first book), Nicholas Flamel, a great alchemist and the creator of the Philosopher's Stone, ... |
Question: 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.Bizon the Champion isn't just a bison. He also is a favorite of the "Bizons" team.
At a competition the "Bizons" got the followin... |
Question: 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.Joffrey Baratheon is the king of all seven kingdoms. His birthday is coming very soon. So he invited all lords, ladies and kings ... |
Question: 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.T is playing a game with his friend, HL.
There are n piles of stones, the i-th pile initially has a_i stones.
T and HL will tak... |
Question: 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.Selection of Participants of an Experiment
Dr. Tsukuba has devised a new method of programming training. In order to evaluate the... |
Question: 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 another Start[c]up finals, and that means there is pizza to order for the onsite contestants. There are only 2 types of pizza... |
Question: 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. Kitayuta has just bought an undirected graph consisting of n vertices and m edges. The vertices of the graph are numbered from... |
Question: 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.Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to ... |
Question: 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 and Roma are playing a game. Rules of the game are quite simple.
Initially there are N piles of stones on the table.
In each ... |
Question: 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 police department of your city has just started its journey. Initially, they don’t have any manpower. So, they started hiring ... |
Question: 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.Lee was cleaning his house for the party when he found a messy string under the carpets. Now he'd like to make it clean accurately... |
Question: 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.Vladik is a competitive programmer. This year he is going to win the International Olympiad in Informatics. But it is not as easy ... |
Question: 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 Turbo C++ Users : Read the following document before attempting the question :
Problem Description
First question is easy ... |
Question: 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 c be some positive integer. Let's call an array a_1, a_2, …, a_n of positive integers c-array, if for all i condition 1 ≤ a_i ... |
Question: 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 l and r (l ≤ r). Your task is to calculate the sum of numbers from l to r (including l and r) such that... |
Question: 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.Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the v... |
Question: 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.An expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have ant... |
Question: 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.Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place o... |
Question: 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 to check whether a triangle is valid or not, when the three angles of the triangle are the inputs. A triangle is ... |
Question: 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 binary string s (recall that a string is binary if each character is either 0 or 1).
Let f(t) be the decimal repr... |
Question: 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.Aoki loves numerical sequences and trees.
One day, Takahashi gave him an integer sequence of length N, a_1, a_2, ..., a_N, which ... |
Question: 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 was once young lass called Mary,
Whose jokes were occasionally scary.
On this April's Fool
Fixed... |
Question: 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.Little Shino loves to play with numbers. She just came to know about Fibonacci Series.
Fibonacci Series is a series of number such... |
Question: 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.Create a program that outputs all leap years between the year a and year b.
The leap year conditions are as follows. However, 0 <... |
Question: 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
Den, the phone number of Ukunikia Co., Ltd., enters a very long phone number into the phone every day.
One day, too tired... |
Question: 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.Wilbur the pig now wants to play with strings. He has found an n by m table consisting only of the digits from 0 to 9 where the ro... |
Question: 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.During the programming classes Vasya was assigned a difficult problem. However, he doesn't know how to code and was unable to find... |
Question: 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.Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinate... |
Question: 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.Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets... |
Question: 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 bear decided to store some raspberry for the winter. He cunningly found out the price for a barrel of honey in kilos of raspbe... |
Question: 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.Misha and Vanya have played several table tennis sets. Each set consists of several serves, each serve is won by one of the player... |
Question: 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.Kevin has a string S consisting of N lowercase English letters.
Kevin wants to split it into 4 pairwise different non-empty par... |
Question: 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 need to shuffle a series of numbers from 1 To T, inclusive. The numbers are in ascending order, you have to shuffle them using... |
Question: 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 Monocarp has just put n dishes into an oven. He knows that the i-th dish has its optimal cooking time equal to t_i minutes.
... |
Question: 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 written on a piece of paper an array of n positive integers a[1], a[2], ..., a[n] and m good pairs of integers (i1, j1), ... |
Question: 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 tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-... |
Question: 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 three integers A_1, A_2, and A_3.
If A_1+A_2+A_3 is greater than or equal to 22, print `bust`; otherwise, print `win`.
... |
Question: 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.Roy bought a Ring for Alfi, his girlfriend :p. But Alfi will only accept the Ring if Roy played a game with her and answered her q... |
Question: 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.4 different points on the plane Read the coordinates of $ A (x_a, y_a) $, $ B (x_b, y_b) $, $ C (x_c, y_c) $, $ D (x_d, y_d) $ and... |
Question: 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.We have an unsolved mystery this time too!
Input:
First line of input contains T – the number of test cases. Each of the next T... |
Question: 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.Big Chandan is a dire lover of Biryani, especially Old Monk's Biryani. Today, he went over to have some of it. To his surprise, th... |
Question: 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.At the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.