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.The School №0 of the capital of Berland has n children studying in it. All the children in this school are gifted: some of them are go... |
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.Luke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting di... |
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.Living in Byteland was good enough to begin with, but the good king decided to please his subjects and to introduce a national languag... |
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 has recently learned to type and log on to the Internet. He immediately entered a chat room and decided to say hello to everybod... |
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.They say "years are like dominoes, tumbling one after the other". But would a year fit into a grid? I don't think so.
Limak is a litt... |
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 legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chan... |
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.Petya recieved a gift of a string s with length up to 105 characters for his birthday. He took two more empty strings t and u and deci... |
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 integers. You have to process q queries to this array; each query is given as four numbers 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.You are given two arrays A and B, each of size n. The error, E, between these two arrays is defined <image>. You have to perform exact... |
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.Petr likes to come up with problems about randomly generated data. This time problem is about random permutation. He decided to genera... |
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.Little Jhool considers Jaadu to be a very close friend of his. But, he ends up having some misunderstanding with him a lot of times, b... |
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.Caesar Cipher is one of the earliest and simplest encryption technique.
To encrypt a message, we shift the alphabets of the message 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.Tyrion, son of Tywin was released from the dungeons of vale after his champion Bronn defeated Ser Vardis in the trial by combat.
As 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."Bless us and splash us , precious . Thats a meaty mouthful . " said Gollum on seeing
Bilbo Baggins . Poor Bilbo Baggins is lost in t... |
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" White Walkers are positioned in a circle from "1" to "N". First (No. 1) White Walker has a dragonglass . He kills the next Whit... |
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.Suppose we have a sequence of non-negative integers, Namely a_1, a_2, ... ,a_n. At each time we can choose one term a_i with 0 < i < 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.Its vacation time and Panda with two of his best friends Agham and Rishi is in his hometown, Pandaland. One day Panda came across a ve... |
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.Most of the time when rounding a given number, it is customary to round to some multiple of a power of 10. However, there is no reason... |
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.Kevin has a string S consisting of N lowercase English letters.
Kevin wants to split it into 4 pairwise different non-empty parts. ... |
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. S consists of several words separated by one or more spaces. Word consists of Latin letters as well as other... |
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 positive integer N.
We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until... |
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.We held two competitions: Coding Contest and Robot Maneuver.
In each competition, the contestants taking the 3-rd, 2-nd, and 1-st pla... |
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 made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represente... |
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 four towns, numbered 1,2,3 and 4. Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectio... |
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 has decided to give a string to his mother.
The value of a string T is the length of the longest common subsequence of T an... |
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 triangle formed by three points $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$ on a plain.
Write a program which prints "YES" if... |
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 the Internet, data is divided into packets, and each packet is transferred to a destination via a relay device called a router. 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.A programming contest is held every year at White Tiger University. When the total number of teams is N, each team is assigned a team ... |
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
Do you know Just Odd Inventions? The business of this company is to "just odd inventions". Here we call it JOI for short.
JO... |
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
There is an arithmetic progression A with the number of terms N, the first term a, and the tolerance d. Since M statements 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 are deeply disappointed with the real world, so you have decided to live the rest of your life in the world of MMORPG (Massively 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.Description
F, who likes to dance, decided to practice a hardcore dance called JUMP STYLE at a certain dance hall.
The floor is tile... |
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.Optimal Binary Search Tree is a binary search tree constructed from $n$ keys and $n+1$ dummy keys so as to minimize the expected 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.Your task is to calculate the distance between two $n$ dimensional vectors $x = \\{x_1, x_2, ..., x_n\\}$ and $y = \\{y_1, y_2, ..., y... |
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 a string S consisting of only 1s and 0s, find the number of substrings which start and end both in 1.
In this problem, a substri... |
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 is very fond of horses. He enjoys watching them race. As expected, he has a stable full of horses. He, along with his friends, go... |
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 to play with arrays by himself. Today, he has an array A consisting of N distinct integers. He wants to perform the followi... |
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 electrical resistance is the opposition to the passage of electric current. If two resistors with resistance R1 and R2 are connect... |
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 Chef's house there are N apples lying in a row on the floor. These apples are numbered from 1 (left most one) to N (right most one)... |
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 the war, the supersonic rocket became the most common public transportation.
Each supersonic rocket consists of two "engines". ... |
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.Monocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV ... |
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.Masha has three sticks of length a, b and c centimeters respectively. In one minute Masha can pick one arbitrary stick and increase it... |
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 some array c, let's denote a greedy subsequence as a sequence of indices p_1, p_2, ..., p_l such that 1 ≤ p_1 < p_2 < ... < p_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.You are given a function f written in some basic language. The function accepts an integer value, which is immediately written into so... |
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 a list of numbers from 1 to n written from left to right on the blackboard.
You perform an algorithm consisting of several 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.Anadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every a and b such that 1 ≤ a ≤ b ≤ 6, ... |
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 integers.
In one move, you can choose two indices 1 ≤ i, j ≤ n such that i ≠ j and set a_i :... |
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.wHAT DO WE NEED cAPS LOCK FOR?
Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capita... |
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 athletes in front of you. Athletes are numbered from 1 to n from left to right. You know the strength of each athlete — 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.There are n programmers that you want to split into several non-empty teams. The skill of the i-th programmer is a_i. You want to asse... |
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 the following process. You have a binary string (a string where each character is either 0 or 1) w of length n and an 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.Reforms have started in Berland again! At this time, the Parliament is discussing the reform of the calendar. To make the lives of cit... |
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.They say that Berland has exactly two problems, fools and roads. Besides, Berland has n cities, populated by the fools and connected b... |
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 know that the Martians use a number system with base k. Digit b (0 ≤ b < k) is considered lucky, as the first contact between 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.Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (... |
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.Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occup... |
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.Little penguin Polo adores strings. But most of all he adores strings of length n.
One day he wanted to find a string that meets 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.Once upon a time, when the world was more beautiful, the sun shone brighter, the grass was greener and the sausages tasted better Arla... |
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 plays the sleuth with his friends. The rules of the game are as follows: those who play for the first time, that is Vasya is 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.A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys 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.The Hedgehog likes to give presents to his friend, but no less he likes to receive them.
Having received another present today, the H... |
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.Valerian was captured by Shapur. The victory was such a great one that Shapur decided to carve a scene of Valerian's defeat on a mount... |
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 "Bulls and Cows" game needs two people to play. The thinker thinks of a number and the guesser tries to guess it.
The thinker 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.Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact 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."The zombies are lurking outside. Waiting. Moaning. And when they come..."
"When they come?"
"I hope the Wall is high enough."
Zomb... |
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 n, l and r find the number of distinct geometrical progression, each of which contains n distinct integers not less than l 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.You are given positive integer number n. You should create such strictly increasing sequence of k positive numbers a1, a2, ..., ak, 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.In a small restaurant there are a tables for one person and b tables for two persons.
It it known that n groups of people come today... |
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 an integer x. Your task is to find out how many positive integers n (1 ≤ n ≤ x) satisfy $$$n ⋅ a^n ≡ b (mod\;p), where a, b, 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.Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some cla... |
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.Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes.
<image>
Initially, each hole has 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.The BITians are furious that their lift stops working frequently .Adding to this, there are 7 floors in BIT which becomes r... |
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.Everyone knows that chotu likes palindromic strings. One day, he found 2 ordinary strings s1 and s2. Now he wonders if he could make 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.If
the given input positive integer is equal to the sum of its proper positive divisors then it will form a triangular array of numbe... |
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.All living beings on this extra-ordinary planet have some goodness value that tells their worth.
Rajat and Shreya are a couple on 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.Solve the mystery.
Input:
First line contains a single integer denoting number of test cases(T).
Next T lines have one test case per 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.Level 1
Sometimes what happens during SBG slot booking is we forgot to book our slot and mess up. But few clubs
are generous enough t... |
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.Xavier asks his friend to perform a particular task.The task is to find out the ASCII value of each character of a given STRING and 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.There are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.
Takahashi says: "there are X an... |
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.We have an integer sequence of length N: A_0,A_1,\cdots,A_{N-1}.
Find the following sum (\mathrm{lcm}(a, b) denotes the least common ... |
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 function f(x), which is initially a constant function f(x) = 0.
We will ask you to process Q queries in order. There are t... |
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 tree with N vertices, numbered 1, 2, \ldots, N. For each i (1 \leq i \leq N - 1), the i-th edge connects Vertex x_i and y_i... |
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.To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one opera... |
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 strings s and t, consisting of lowercase English letters. You will create a string s' by freely rearranging the characte... |
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.Dolphin is planning to generate a small amount of a certain chemical substance C.
In order to generate the substance C, he must prepar... |
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 strings of lowercase alphabet only. The i-th string is S_i. Every string is unique.
Provide answers for the Q queries bel... |
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 data of up to 100 characters per line, consisting of half-width alphabetic character strings. Some lines are symmetric (same ... |
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 Aizuwakamatsu City, there is a first city called "Tokaichi" on January 10th every year. This Tokaichi has a history of about 600 ye... |
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 large chess board, there are N ants, each numbered from 1 to N. As shown in the figure, the chess board is a rectangle consisting... |
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. Frugal bought a new house. He feels deeply in love with his new house because it has a comfortable living room in which he can put... |
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 positive integer may be expressed as a sum of different prime numbers (primes), in one way or another. Given two positive integers 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.Playoff by all the teams
The Minato Mirai Football Association hosts its annual championship as a single round-robin tournament, in 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.π (spelled pi in English) is a mathematical constant representing the circumference of a circle whose di- ameter is one unit length. T... |
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
Given the formula $ S $ of length $ N $. The formula is in the format shown in BNF below.
<expr> :: = <number> | <expr> <op... |
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
There are $ N $ islands and $ N-1 $ bridges in Aiz, and each island is assigned a number from $ 1 $ to $ N $. The $ i $ th br... |
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 statement
A lazy guy in UVCE is designing a robot that could collect all useful things from different places and put them 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.Did you hear about the Nibiru collision ? It is a supposed disastrous encounter between the earth and a large planetary object. Astron... |
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 has just finished the construction of his new garden. He has sown the garden with patches of the most beautiful carpet grass he c... |
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 Little Elephant from the Zoo of Lviv likes lucky numbers very much. Everybody knows that the lucky numbers are positive integers who... |
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.Little chef has just been introduced to the world of numbers! While experimenting with addition and multiplication operations, the lit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.