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.IndiaHacks-2016 is going on and Tom and Jerry also came to participate in the contest. Tom and Jerry started fighting in the contest 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 [Mandarin], [Bengali], [Russian], and [Vietnamese] as well.
Chef is very adventurous, so he asked Bob to 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.Given a matrix M of n*n size, the task is to complete the function which prints its elements in a diagonal pattern as depicted below.
... |
user: Generate an executable Python 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 sorted and rotated array A of N elements which is rotated at some point, and may contain duplicates and given an element key. ... |
user: Generate an executable Python 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 string S is called *Chef's favourite* if every substring chef in S must have a substring code before it.
You are given a string S 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.Adam like points a lot. Adam’s father presented him with n points lying on the horizontal axis X on his birthday. Adam is a noob. So 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.Once a Mathematician was trapped by military people during a world war with his forty colleagues. The colleagues were without any weap... |
user: Generate an executable Python 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 tree of N nodes, where each node is uniquely numbered in between [1, N]. Each node also has a value which is initially 0. You ... |
user: Generate an executable Python 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 is a very simple problem. You are given $N$ points. Some points may be repeated. The weight (distance) between two points is give... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef recently created a new Tiling Window Manager called ChefWM. He wants to find out the maximum number of columns of windows he can ... |
user: Generate an executable Python 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.
Chef had a sequence $S_{0}, 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.Swapnil is playing a game with his friend.This game is about the bubbles.There are many sticky bubbles
kept in a container A.Near tha... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Our web developer Gori is having this huge crush on a girl of his batch. But he is very afraid of proposing her. He does not know whet... |
user: Generate an executable Python 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 Infinite People Standing in a row, indexed from 1.
A person having index 'i' has strength of (i*i).
You have Strength 'P'. 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.Read problems statements in [Hindi], [Mandarin Chinese], [Vietnamese], and [Bengali] as well.
There are $K$ problems in a contest wit... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Serialization is to store a tree in an array so that it can be later restored and Deserialization is reading tree back from the 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.Chef categorises an instagram account as *spam*, if, the *following* count of the account is more than 10 times the count of *follower... |
user: Generate an executable Python 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 cost[] of positive integers of size N and an integer W, cost[i] represents the cost of i kg packet of oranges, the task... |
user: Generate an executable Python 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 of length N.
Your task is to delete a [subsequence] of maximum length from the string, such that, after conc... |
user: Generate an executable Python 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 seen the applications of union, intersection, difference and symmetric difference operations, but these operations do not make... |
user: Generate an executable Python 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.
This problem has no story, 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.ââ¬â¹Given a number x, your task is to find if this number is Deficient number or not. A number x is said to be Deficient Number 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.The director of the famous dance show plans a tour. It is already decided that the tour will consist of up to m concerts.
There are 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.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has to cook many dishes ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Our chef has opened a delivery agency. His prime moto is "earn money". He
is very strict on excessive consumption of petrol by his age... |
user: Generate an executable Python 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. You are allowed to perform the following operation at most once:
Pick some [substring] of S
Flip all ... |
user: Generate an executable Python 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 here
------ Problem Statement ------
Little Elephant from Zoo of Lviv likes bamboo 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.Given a number N, count total number of divisors of N!.
Example 1:
Input : N = 4
Output: 8
Explaination: 4! is 24. Divisors of 24 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.Given a series of numbers 2, 10, 30, 68, 130.., Identify the pattern in the series. You are given an integer X you need to find out 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.Read problems statements in [Mandarin Chinese], [Russian], [Vietnamese] and [Bengali] as well.
Chef is playing a game where he has 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.Times Square in the capital city of NY has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary,... |
user: Generate an executable Python 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 gear ratio designers ate BikeCo need your help! They have designed a new set of gear ratios $n_1/d_1, n_2/d_2, \cdots , n_{12}/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.A geyser has a capacity of X litres of water and a bucket has a capacity of Y litres of water.
One person requires exactly 2 buckets ... |
user: Generate an executable Python 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 watched pot never boils”, as the saying goes. Chef Edward has been cooking for ages, and empirically the saying seems to be true 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.Chef considers an array *good* if it has no subarray of size less than N such that the [GCD] of all the elements of the subarray is 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.You like the card board game "Set". Each card contains $k$ features, each of which is equal to a value from the set $\{0, 1, 2\}$. 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.Sleazy Bob has happened upon a vending machine. After watching enough people buy tasty snacks, Bob has realized that the vending machi... |
user: Generate an executable Python 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 n integers, task is to print the array in the order – smallest number, largest number, 2nd smallest number, 2nd ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Splendid matrices are square matrices with dimensions 2^n X 2^n filled in a particular manner. Splendid matrices for n=1, n=2 and n=3 ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Marc loves cupcakes, but he also likes to stay fit. Each cupcake has a calorie count, and Marc can walk a distance to expend those cal... |
user: Generate an executable Python 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 and a sum B, find all unique combinations in the array where the sum is equal to B. The same number may be ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two positive integers $n$ and $s$. Find the maximum possible median of an array of $n$ non-negative integers (not necess... |
user: Generate an executable Python 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 positive integer n that represents dimensions of a 4n x 4n matrix with values from 1 to 4*n*4*n filled from left to right and ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The English word “mile” derives from the Latin “mille passus”, meaning “a thousand paces”. A Roman mile was the distance a soldier wou... |
user: Generate an executable Python 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 elements and L and R, print the number of sub-arrays such that the value of the maximum array element in that suba... |
user: Generate an executable Python 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 an array A of length N. In one operation, Chef can:
Choose any subarray [L, R] (1 ≤ L ≤ R ≤ N);
Add 1 to A_{L}, subtract 1 f... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Andi is a mathematician, a computer scientist, and a songwriter. After spending so much time writing songs, he finally writes a catchy... |
user: Generate an executable Python 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 in its binary form find if the given binary number is a multiple of 3. It is recommended to finish the task using one 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 just bought an “artistic” aquarium tank that has an interesting shape, and you poured $L$ litres of water into the tank. How high ... |
user: Generate an executable Python 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 10 \times 10 grid with rows numbered 1 to 10 from top to bottom, and columns 1 to 10 from left to right. Each cell is ident... |
user: Generate an executable Python 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 started developing interest in playing chess, and was learning how the [Queen] moves.
Chef has an empty N \times N chessboa... |
user: Generate an executable Python 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 rooted tree of $2^n - 1$ vertices. Every vertex of this tree has either $0$ children, or $2$ children. All leaves of 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.Every year, Pumpkin Pete comes up with a couple of different Jack-O’-Lantern ideas for his annual Halloween special. He stacks them up... |
user: Generate an executable Python 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 local library needs your help! Given the expected and actual return dates for a library book, create a program that calculates 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.Given an integer N, let us consider a triangle of numbers of N lines in which a number a_{11} appears in the first line, two numbers 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 an array arr[] of N Numbers. A Perfect Piece is defined as a subarray such that the difference between the minimum and the maxim... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Seven Wonders is a card drafting game in which players build structures to earn points. The player who ends with the most points wins.... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Pell numbers are numbers that are similar to the Fibonacci numbers and are generated by below formula
P_{n} = 2*P_{n-1} + P_{n-2}
with... |
user: Generate an executable Python 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 permutation P of length N.
You can perform the following operation on P:
Select two distinct indices i and j (1≤ i, j... |
user: Generate an executable Python 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 has an array A consisting of N distinct integers. Bob takes exactly N - 1 elements from this array and adds a positive integer X... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef has an integer N. He repeats the following operation until N becomes 1.
- Chef chooses an integer X such that X > 1 and X is a 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.As an enterprising owner of a world-renowned ski resort in the US, you would like to increase your sales by stocking snack stands at k... |
user: Generate an executable Python 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.
Sergey has an uppercase Latin letter string S, which 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.Chirag wanted to prepare a Programmin round. He's already got one problem and he wants to set a time limit (TL) on it.
Chirag has wri... |
user: Generate an executable Python 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 the boss of Wi Know, an upstanding company in information theory, especially in message encryption.
The counter-counter-intel... |
user: Generate an executable Python 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 day, a flock of hungry birds find a huge tree of elderberries. They want to eat all berries of this tree. These birds quickly alig... |
user: Generate an executable Python 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 events were over and the participants were roaming about in the Nirma Campus when they reached the Nirma Lake. It is a Lar... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.IIIT Hyderabad is planning to install Wifi Routers in the campus to make it fully Wifi-enabled.
Now each Wifi Router can only transmi... |
user: Generate an executable Python 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 input A , print the data type of the input A.
eg:-Sequence of digits -- int
Sequence of digits with a dot -- float
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.YouKn0wWho has an integer sequence $a_1, a_2, \ldots a_n$. Now he will split the sequence $a$ into one or more consecutive subarrays s... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You have a large rectangular board which is divided into $n \times m$ cells (the board has $n$ rows and $m$ columns). Each cell is eit... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Implement a modified Fibonacci sequence using the following definition:
Given terms $t\left[i\right]$ and $t[i+1]$ where $i\in(1,\inf... |
user: Generate an executable Python 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 N persons sitting on a round table. Any person can do a handshake with any other person.
1
2 3
4
Handshake ... |
user: Generate an executable Python 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 attending a arcade basketball competition, where the objective is to score as many points as possible until the time runs out. ... |
user: Generate an executable Python 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 jumpy ball. You throw it up from the ground up to a height of H. The ball is jumpy, so when it comes back to the ground, 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.Given a number N. Find the last two digits of the Nth fibonacci number.
Note: If the last two digits are 02, return 2.
Example 1:
Inpu... |
user: Generate an executable Python 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 factors for a given integer N.
Example 1:
Input:
N = 5
Output:
2
Explanation:
5 has 2 factors 1 and 5
Example 2:
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Christy is interning at HackerRank. One day she has to distribute some chocolates to her colleagues. She is biased towards her friends... |
user: Generate an executable Python 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 numbers A and B along with an integer X. In one operation you can do one of the following:
Set A = A + X and B = 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.There is a long electrical wire of length $\ell $ centimetres between two poles where birds like to sit. After a long day at work you ... |
user: Generate an executable Python 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.
For positive integer x let define function F(x) = 1 * (1! + x) + 2 * (2! ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You have an infinite number of 4 types of lego blocks of sizes given as (depth x height x width):
d h w
1 1 1
1 1 2
1 1 3
1 1 4
Usin... |
user: Generate an executable Python 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 positive integer N, print count of set bits in it.
Example 1:
Input:
N = 6
Output:
2
Explanation:
Binary representation is '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.$N$ points are placed in the coordinate plane.
Write a program that calculates how many ways we can choose three points so that they ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.How many non decreasing sequences are there of length ${K}$, with the condition that numbers in sequence can take values only from $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.Sherlock Holmes suspects his archenemy Professor Moriarty is once again plotting something diabolical. Sherlock's companion, Dr. Watso... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.For a positive integer M, MoEngage defines \texttt{digitSum(M)} as the sum of digits of the number M (when written in decimal).
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.Given an integer N, find the absolute difference between sum of the squares of first N natural numbers and square of sum of first N na... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Instead of writing,$a \times (b+c) = a \times b + a \times c$, Joe by mistakenly swapped the $\times$ and + signs on the left hand sid... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ma5termind is having his birthday this weekend. Yeah !! You all are invited . Ma5termind wants to send an invitation to those groups 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 are given a positive integer $n$. You have to find $4$ positive integers $a, b, c, d$ such that
$a + b + c + d = n$, and
$\gcd(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 an array consisting of n integers which denote the position of a stall. You are also given an integer k which denotes 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.Ivan on his birthday was presented with array of non-negative integers a_1, a_2, …, a_n. He immediately noted that all a_i satisfy 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.MoEngage has a bundle of N sticks. The i^{th} stick has a length L_{i} meters.
Find the minimum number of sticks (of any length) you... |
user: Generate an executable Python 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 rooted tree with N nodes and the root of the tree, R, is also given. Each node of the tree contains a value, that is 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.Given a number N. The task is to check whether it is sparse or not. A number is said to be a sparse number if no two or more consecuti... |
user: Generate an executable Python 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], [Vietnamese], and [Bengali] as well.
Chef's son Chefu found some matches 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.Given a string S, find the length of the longest substring with all distinct characters.
Example 1:
Input:
S = "geeksforgeeks"
Output... |
user: Generate an executable Python 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 sorted array of size N. Count the number of distinct absolute values present in the array.
Example 1:
Input:
N = 6
Arr[] = {... |
user: Generate an executable Python 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 permutation $a_1, a_2, \ldots, a_n$ of size $n$, where each integer from $1$ to $n$ appears exactly once.
You can do ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.