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.Summer in Berland lasts n days, the price of one portion of ice cream on the i-th day is c_i. Over the summer, Tanya wants to eat exac... |
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.Integer sequence $\boldsymbol{a}$ having length $2n+2$ is defined as follows:
$a_{0}=0$
$a_{1}=C$
$a_{i+2}=(a_{i+1}+a_i)\ \text{\% 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.Consider an array, $\mbox{A}$, of $n$ integers ($A=a_0,a_1,...,a_{n-1}$).
We take all consecutive subsequences of integers from the 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.As a huge fan of the popular collectible card game Numinous Wilds: the Elven Reign Chronicles (NWERC), you have a large collection of ... |
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 is the Indian version of the famous heist “The Italian Job”. N robbers have already broken into the National Museum and are just ab... |
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 array arr of size N, the task is to remove or delete the minimum number of elements from the array so that when the remaining... |
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.Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
Given an integer A that contains n > 1 digits. You are... |
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 a garden containing N cells. The i-th cell has R_{i} red flowers and B_{i} blue flowers. Chef can collect only one type of fl... |
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.Angela is a new PhD student and she is nervous about the upcoming paper submission deadline of this year’s research conference. She ha... |
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.JJ loves playing with medians. He has an array A of length N (N is odd). He wants to partition the array A into two non-empty subsets ... |
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 asked by iPhone map service to help diagnose iPhone maps location diagrams to identify instances of MULTIPATH in a map. The fo... |
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 war and ashu needs hog riders for the fight. The area on which hog riders live is a N X N square matrix. If A[i][j] = 1 it me... |
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.Lysias loves his full-rigged ship and takes it out to his island castle as often as possible. On his way back to the castle one day, 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.You are given $n$ integers $a_1, a_2, \ldots, a_n$. Is it possible to arrange them on a circle so that each number is strictly greater... |
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 r rows and c cols matrix grid representing a field of chocolates where grid[i][j] represents the number of chocolates... |
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 Matrix mat of N*N size, the task is to complete the function constructLinkedMatrix(), that constructs a 2D linked list represe... |
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.Theta has been learning about powers of $2$ in school. She notices that some numbers when written out contain powers of $2$ in their 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.Given a string S, you have to check if we can split it into four strings such that each string is non-empty and distinct from each oth... |
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 evil forest is guarded by vicious mandragoras. Garnet and her pet must make a journey through. She starts with $1$ health point (... |
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.Gold Leaf is a very thin layer of gold, with a paper backing. If the paper gets folded and then unfolded, the gold leaf will stick 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.Given two strings S and W. Find the number of times W appears as a subsequence of string S where every character of string S can be 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.Given a string A and a dictionary of n words B, find out if A can be segmented into a space-separated sequence of dictionary words.
E... |
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 identical eggs and you have access to a K-floored building from 1 to K.
There exists a floor f where 0 <= f <= K such ... |
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 number N, the task is to express N as a summation of 4 positive primes.
Example 1:
Input: N = 8
Output: 2 2 2 2
Explanation:... |
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 cake on a line. The $i$-th piece of cake has weight $a_i$ ($1 \leq i \leq n$).
The tastiness of the cake is 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.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian] and [Vietnamese] as well.
OWCA has fallen and now, L.O.V... |
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.Read problems statements in Mandarin Chinese and Russian as well.
You are given a transparent three-dimensional table, the height eq... |
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 number theory very much. Now it is time to solve a new kind of problem.
There is given a natural number N. Chef has to answ... |
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.AquaMoon has two binary sequences $a$ and $b$, which contain only $0$ and $1$. AquaMoon can perform the following two operations any 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.Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after whi... |
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.An airline called Divided Airlines has recently made the news due to their tendency to overbook their flights rather aggressively. 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.A palindromic prime (sometimes called a palprime) is a prime number that is also a palindromic number.Given a number n, output the cou... |
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.Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
As New Year is approaching, Salik is studying function... |
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.Raju remembers his childhood days and it reminds him of his favourite game 'Find the pattern'. He memorizes that there is a problem pa... |
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.Chotu is a student of IIIT-A and as its a tradition here he wants to copy his assignment on the last day, but to his horror it was a v... |
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
Utkarsh loves binary sequences. Once he was playing with his favorite binary sequence of length N. But somehow he 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 19th century German mathematician Hermann Minkowski investigated a non-Euclidian geometry, called the taxicab geometry. In taxicab... |
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 game in which you try not to repeat a word while your opponent tries to see if you have repeated one.
"THE RAIN IN SPAIN" ... |
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 an infinite chessboard and a special knight whose move types can change given power-ups. The knight is trying to reach square... |
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.Ishaan has bought a new gun. He is practicing his shooting, but he has to reload his gun again and again.
You are given his shooting 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.Given a number N.Find the minimum Lucky number, the sum of whose digits is equal to N.
Note:-Lucky numbers are the positive integers 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.Given a binary string S consisting of 0s and 1s. The task is to find the maximum difference of the number of 0s and the number of 1s (... |
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 integer N.
Find a permutation P = [P_{1}, P_{2}, \ldots, P_{N}] of the integers \{1, 2, \ldots, N\} such that sum of... |
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 mathematics, binomial coefficients are a family of positive integers that occur as coefficients in the binomial theorem.
$\left(\... |
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 Dengklek will open a new restaurant in the city. The restaurant will be open for N days. He can cook M different types of dish. 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.On his birthday, John’s parents made him a huge birthday cake! Everyone had a wonderful dinner, and now it’s time to eat the cake. 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.Given a permutation P of size N, an array A of size N can be generated using the following method:
If P_{i}> P_{j} for all (1 ≤ j < i... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a sorted array arr containing n elements with possibly duplicate elements, the task is to find indexes of first and last occurrences of an element x in the given array.
... |
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 non-empty strings $s$ and $t$, consisting of Latin letters.
In one move, you can choose an occurrence of the string... |
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 number N find the product of all unique prime factors of that number.
Example 1:
Input:
N = 5
Output:
5
Explanation:
5 has 1... |
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.Geek is very fond of patterns. Once, his teacher gave him a pattern to solve. He gave Geek an integer n and asked him to build a patte... |
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 and Bob are studying for their class test together. The topic of the test is Prime Numbers. The preparation is getting too borin... |
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 string str, find the length of the longest repeating subsequence such that it can be found twice in the given string.
The two 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.You are given two integers X and Y. You need to construct two different strings S_{1} and S_{2} consisting of only the characters ‘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.DugDug has an infinite coin supply of denomination 1,2,4,8,16,32,.. upto 2^64.He was challenged by his friend TukTuk.
TukTuk wants Du... |
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.Polycarp found under the Christmas tree an array $a$ of $n$ elements and instructions for playing with it:
At first, choose index $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.Joey is a food lover, but Monica is concerned about his health and thus refuses to give him any more food. But on Joey's request, she ... |
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 solving some Graph Theory related problems KBG challenged Sameer to solve the following problem.
There is an undirected graph 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.Given a directed weighted graph and two vertices $s$, $t$, the goal is to find a subset $U$ of the vertices such that $s \in U$, $t \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.Many pharmacies in the United States fill prescriptions strictly on a first-come, first-served basis, even preferring prescriptions su... |
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.Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
While vacationing in Egypt, Chef found a recipe of 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.Given two integers L, R, and digit X.Find the number of occurrences of X in all the numbers in the range (L, R) Excluding L and R.
Exa... |
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.Edward Elric is chasing after Scar. To stop Edward, Scar creates $N$ barriers in the way, numbered from $1$ to $N$.
Each barrier Scar... |
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 tree is a connected graph without cycles. A rooted tree has a special vertex called the root. The parent of a vertex $v$ (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.You are given numbers a and b. Calculate the sum of a and reverse of b. A reverse of a number is a number which contains the same digi... |
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, containing special characters and all the alphabets, reverse the string without
affecting the positions of the speci... |
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 array of positive integers. Find the maximum length of Bitonic subsequence.
A subsequence of array is called Bitonic if it 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.Shil is your new boss and he likes lucky strings very much. A string is called lucky if and only if each character from first half 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.You have a grid G containing R rows (numbered from 1 to R, top to bottom) and C columns (numbered from 1 to C, left to right) of upper... |
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 array of N integers, find the sum of xor of all pairs of numbers in the array.
Example 1:
ââ¬â¹Input : arr[ ] = {7, 3, 5}
... |
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.Find the number of pairs of non negative integers(n,m),such that 1 ≤ n<m ≤ k, where 2 ≤ k ≤ 1000000 and n|m^2 - 1 and m|n^2 - 1 ?
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.Suraj a software engineer from Mumbai just got placed in a software company in New Delhi. As, he have to relocate from Mumbai to Delhi... |
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 four distinct integers $a$, $b$, $c$, $d$.
Timur and three other people are running a marathon. The value $a$ is the 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.Read problems statements in Mandarin Chinese and Russian.
Chef Anup is making dishes. Each dish consists of N ingredients, and quan... |
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 considers a permutation P of \{1, 2, 3, \dots, N\} End Sorted if and only if P_{1} = 1 and P_{N} = N.
Chef is given a permutatio... |
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 Array of Integers Arr of length N, you have to count number of elements of the array that can be counted as pair of equal ele... |
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 say that a positive integer $n$ is $k$-good for some positive integer $k$ if $n$ can be expressed as a sum of $k$ positive integers... |
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.Read problems statements in [Mandarin Chinese], [Russian], and [Bengali] as well.
Given the rating R of a person, tell which division... |
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 playing a game on a $n \times m$ grid, in which the computer has selected some cell $(x, y)$ of the grid, and you have to dete... |
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 number N. You have to check whether every bit in the binary representation of the given number is set or not.
Example 1:
Input... |
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 two strings S1 and S2 of lower alphabet characters of length N1 and N2, we need to find the number of ways to insert a character... |
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.Jake is learning how to play the card game Dominion. In Dominion, you can buy a variety of treasure, action, and victory point cards –... |
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 cities in the country of Numbata, numbered from 1 to N. Currently, there is no road connecting them. Therefore, each of 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.Rock-paper-scissors is a popular two-player game. In the game, each of the players uses their hand to show one of three symbols: rock,... |
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 everyone is talking about big data. As a renowned data provider in the area, you now have $N$ precious pieces of data. You want ... |
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 unsigned integer N. The task is to swap all odd bits with even bits. For example, if the given number is 23 (00010111), it sh... |
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.Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.
Chef is taking a cooking exa... |
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.Connell Sequence is the sequence formed with the first odd number, i.e 1 as its first term. The subsequent terms of the sequence are 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.Chef and Chefina are competing against each other in a programming contest. They were both able to solve all the problems in the conte... |
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 N, find a permutation P = P_{1}, P_{2}, \ldots, P_{N} of length N that satisfies the following two conditions:
P_{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.Jim likes to play with laser beams.
Jim stays at point $(0,0)$.
There is a mirror at point $(X_m,Y_m)$ and a wall between points $... |
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 struggling to pass a certain college course.
The test has a total of N questions, each question carries 3 marks for a correct... |
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 matrix having n rows and m columns. The special property of this matrix is that some of the cells of this matrix are 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.Read problem statements in [Russian] and [Mandarin Chinese].
Find the minimum integer K such that sum of bits present on odd position... |
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 array arr of size N, the goal is to find out the smallest number that is repeated exactly ‘K’ times.
Example 1:
Input:
N=5,... |
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 binary string A is called *good* if it can be sorted (in non-decreasing order) using the following operation:
Select an i (1 ≤ 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.The problem is to count all the possible paths from top left to bottom right of a MxN matrix with the constraints that from each cell ... |
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.Yraglac has been a bit bored with Calgary lately and decided to move to the United States. After arriving in the strange land, he disc... |
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 two positive numbers A and B. The task is to divide A by B and calculate the number of digits after decimal.
Example 1:
Input: 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.In Geekland, there lives a very rich girl Siri. For her undergraduation studies she joins an engineering college GIT, Geekland Institu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.