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.Luka is bored in chemistry class yet again. This time, he’s playing with intelligent bacteria. He has arranged his $K$ bacteria on a 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.After playing the game of stones and board chandu decide to put all the games in the boxes and sleep. But, he is afraid that you will ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.My friend has just got his seperate room. He decided to paint a wall of the room with multiple colors.
For this purpose he has divided... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Transforming data into some other data is typical of a programming job. This problem is about a particular kind of transformation whic... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Joi has an array $a$ of $n$ positive integers. Koxia wants you to determine whether there exists a positive integer $x > 0$ such that ... |
user: Generate an executable Python 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 binary string S of size N. Chef can perform the following operation on the string:
Select any substring of size 3 and rever... |
user: Generate an executable Python 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, Count no. of all subsequences of string S1 that are equal to string S2.
Example 1:
Input:
S1 = geeksforg... |
user: Generate an executable Python 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.
Today is chef's friend's birthday. He wants to give a gift to his friend.... |
user: Generate an executable Python 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 an input year N, find whether the year is a leap or not.
Example 1:
Input:
N = 4
Output:
1
Explanation:
4 is not divisible by 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.Marek loves dancing and he has danced a lot in the last couple of years. He has actually danced so much that he became too good in 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.The working hours of Chef’s kitchen are from X pm to Y pm (1 ≤ X < Y ≤ 12).
Find the number of hours Chef works.
------ Input Forma... |
user: Generate an executable Python 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 the workload of the semester is ramping up you get the task of refilling the fridge in the lab with soda. The fridge has $s$ slots,... |
user: Generate an executable Python 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.
You are given a sequence A_{1}, A_{2}, \ldots,... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ram loves those numbers which are square of any number. To check his love for these numbers one day Sham gives him two numbers a and 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.You have an array $a$ of length $n$. You can exactly once select an integer $len$ between $1$ and $n - 1$ inclusively, and then sort 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.Bomberman lives in a rectangular grid. Each cell in the grid either contains a bomb or nothing at all.
Each bomb can be planted in an... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given an array A of n integers, find the sum of f(a[i], a[j]) of all pairs (i, j) such that (1 <= i < j <= n).
f(a[i], a[j]): if abs(a[j]-a[i]) > 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.Given an unsorted array of size N, use selection sort to sort arr[] in increasing order.
Example 1:
Input:
N = 5
arr[] = {4, 1, 3, 9, ... |
user: Generate an executable Python 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 loosing two wickets in two balls, the match between India and Bangladesh has turned into last ball thriller. Bangladesh need 2 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.One night, Mark realized that there is an essay due tomorrow. He hasn't written anything yet, so Mark decided to randomly copy-paste 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 an array A[ ] your task is to complete the function max_val which finds the maximum value of abs(i – j) * min(arr[i], arr[j]) wh... |
user: Generate an executable Python 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 IP address, remove leading zeros from the IP address. Note that our IP address here can be a little different. It can have nu... |
user: Generate an executable Python 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.
Chef is a well-known chef, and everyone wishes to tast... |
user: Generate an executable Python 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 length N, find the lowest number which has both the maximum and minimum of the array as it's divisor.
Exampl... |
user: Generate an executable Python 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 all are aware of Gaurav and his love for "weird" recurrences.
Recently, he came up with another of his wierd recurrence namely 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.Robert Hood, a less famous sibling of the Robin Hood, is fed up. Despite him being a young, talented archer he never seems to reach qu... |
user: Generate an executable Python 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 provided a matrix of size N*N with source position at (0,0) and
destination at (N-1,N-1) in a 2D array. Some of the positions ... |
user: Generate an executable Python 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 and an integer X. You are allowed to perform the following operation on the array:
Select two distinct indice... |
user: Generate an executable Python 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 size N that has elements ranging from 0 to N-1. All elements may not be present in the array. If the element is not ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Pasha has been very sick. His platelets went way down. Being a paranoid person, he consulted N doctors about the optimal range in which Platelet Count should lie. The i-th doc... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Arun has a rooted tree of N vertices rooted at vertex 1. Each vertex can either be coloured black or white.
Initially, the vertices 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 3 numbers A, B, and C.
Determine whether the average of A and B is strictly greater than C or not?
NOTE: Average of A ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Description
In a given word, one can say that there exist a consonant cluster if there are two or more consonant letters in the word ... |
user: Generate an executable Python 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.
Chef has a number D containing only digits 0's and 1'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.Read problems statements in mandarin chinese, russian and vietnamese as well.
You are given a multi-set S of N integers, and an inte... |
user: Generate an executable Python 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. Construct a permutation A of length N which is attractive.
A permutation is called attractive if the [bit... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.My friend generated a series 1 4 8 9 12 17 25 28 .... . Each element of this series is known as "Dory". Your task is to find out wheth... |
user: Generate an executable Python 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 Prof. Slim decided to leave the kingdom of the GUC to join the kingdom of the GIU. He was given an easy online assessment to 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.Geek is organizing a birthday party, so his friends brought a cake for him. The cake consists of N chunks, whose individual sweetness ... |
user: Generate an executable Python 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 electronics shop sells red and blue lamps. A red lamp costs X rupees and a blue lamp costs Y rupees.
Chef is going to buy exactly ... |
user: Generate an executable Python 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.
Alice and Bob, both have to drink water. But they both don't want to 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.Given an array A of size N. Find the maximum subset-sum of elements that you can make from the given array such that for every two con... |
user: Generate an executable Python 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 square matrices Grid1 and Grid2 with the same dimensions(NxN).Check whether they are identical or not.
Example 1:
Input:
N=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.Geek is getting really fat. He wants to lose his weight but can't get the motivation to workout. Seeing this, his friend Heisenberg 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 two integers $l$ and $r$, where $l < r$. We will add $1$ to $l$ until the result is equal to $r$. Thus, there will be ex... |
user: Generate an executable Python 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 ordering food online (instead of cooking) and the bill comes out to be Rs. X. Chef can use one of the following two coupons to... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two integers $n$ and $m$. Find the $\operatorname{MEX}$ of the sequence $n \oplus 0, n \oplus 1, \ldots, n \oplus m$. He... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A Krishnamurthy number is a number whose sum of the factorial of digits is equal to the number itself. Given a number N as input. Prin... |
user: Generate an executable Python 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 given two arrays A and B of length N each.
In one operation Chef can choose one element of A and one element of B and increas... |
user: Generate an executable Python 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 ACM (Association for the Country of Mububa), an upstanding company with a single goal of world domination.
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 heights h[] of N towers, the task is to bring every tower to the same height by either adding or removing blocks in a tower. Eve... |
user: Generate an executable Python 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 integers 1, 2, 3, \ldots N are placed on a circle in clockwise order such that i and (i+1) are adjacent for all 1 ≤ i ≤ N - 1, and 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.You are given a rooted tree consisting of $n$ vertices. The vertices are numbered from $1$ to $n$, and the root is the vertex $1$. 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.Alice and Bob invented the following silly game:
The game starts with an integer, $n$, that's used to build a $\boldsymbol{set}$ 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.Chef has a new customer and he wants to prepare his order as soon as possible. While preparing, he sees that the mint sauce is finishe... |
user: Generate an executable Python 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 at the last mission in one very old and very popular strategy game Dune II: Battle For Arrakis. The map of the mission can be 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.Polycarp recently became an employee of the company "Double Permutation Inc." Now he is a fan of permutations and is looking for them ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The only difference between this problem and D1 is the bound on the size of the tree.
You are given an unrooted tree with $n$ vertice... |
user: Generate an executable Python 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 simplest encryption techniques. To transform the original message into encrypted one using key k, one has ... |
user: Generate an executable Python 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 three sorted arrays P, Q, and R of size X, Y and Z respectively. Find total number of triplets (P[i],Q[j],R[k]) such that 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.It is holi festival, festival of colors. Devu is having fun playing holi and is throwing balloons with his girlfriend Glynis. Police 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 string S and another string patt. Find the character in patt that is present at the minimum index in S.
Example 1:
Input: S ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a matrix of dimensions n x m. The task is to perform boundary traversal on the matrix in a clockwise manner.
Example 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.Chef is currently working for a secret research group called NEXTGEN.
While the rest of the world is still in search of a way to utili... |
user: Generate an executable Python 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. Can you find the least positive integer X made up of only 9's and 0's, such that, X is a multiple of N?
U... |
user: Generate an executable Python 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 given a tree with N nodes and a positive integer K. Each node is assigned a value A_{i}.
Chef has to divide the tree into 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.Calculate the product of all the elements in an array.
Example 1:
Input:
5
1 2 3 4 5
Output:
120
Example 2:
Input:
10
5 5 5 5 5 5 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.Pizzahub has started Home Delivery scheme in one of his restaurants. As the scheme is new , the Manager appoints only one employee 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.A sequence of brackets is called balanced if one can turn it into a valid math expression by adding characters '+' and '1'. For exampl... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.RB is a basketball coach and he has several teams of exceptionally skilled basketball players, who dominate basketball leagues all ove... |
user: Generate an executable Python 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 lives in a multi-story building. Everyday he has to get from the N^{th} floor to the ground floor. He has three options to come 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 tree with n nodes and edge connection between them . The tree is rooted at node 1. Your task is to remove minimum number of ed... |
user: Generate an executable Python 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 N chocolates. You want to buy boxes to fill the N chocolates you have.
There are boxes from size between 1 to N inclusive ava... |
user: Generate an executable Python 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 list of N words. Count the number of words that appear exactly twice in the list.
Example 1:
Input:
N = 3
list = {Geeks, 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 a character array tasks of size N, representing the tasks a CPU needs to do, where each letter represents a different task. 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.Once, two trees forgot their place and started to grow into each other. One of the trees grew from the left, and the other from the ri... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.See Russian Translator
Elaine is in charge of assigning classrooms for her new school. She has n different grades, each with k distin... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Lucy is making her road bike ready for the season. All parts have been checked for wear and tear and washed clean and she is ready 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.Bob has an account in the Bobby Bank. His current account balance is W rupees.
Each month, the office in which Bob works deposits 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 have a binary string S of length N. In one operation you can select a substring of S and reverse it. For example, on reversing 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 2D binary matrix A of dimensions NxM, determine the row that contains a minimum number of 1's.
Note-The matrix contains only 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.Sam is a kindergartener, and there are $n$ children in his group. He decided to create a team with some of his children to play "brawl... |
user: Generate an executable Python 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 (the string that contains only 0's and 1's). Find the minimum number of palindromic subsequences that are need... |
user: Generate an executable Python 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 thinks that array A is beautiful if
It contains N positive integers.
It doesn't contain any bad numbers.
There doesn't exist 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.Given two strings string1 and string2, remove those characters from first string(string1) which are present in second string(string2).... |
user: Generate an executable Python 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 permutation: an array $a = [a_1, a_2, \ldots, a_n]$ of distinct integers from $1$ to $n$. The length of the permutation $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.A new strain of flu has broken out. Fortunately, a vaccine was developed very quickly and is now being administered to the public. 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.As Lord Rama's army is approaching Lanka they have to pass one last hurdle and that is the ocean in between. They have decided to cons... |
user: Generate an executable Python 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, write a program to find the one’s complement of the integer.
Example 1:
Input:
N = 5
Output:
2
Explanation:
bina... |
user: Generate an executable Python 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 $W$, a set of $N$ words that are anagrams of each other. There are no duplicate letters in any word. A set of words $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.Manipulating numbers is at the core of a programmer's job. To test how well you know their properties, you are asked to solve the foll... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You and your friend decide to play a game using a stack consisting of N bricks. In this game, you can alternatively remove 1, 2 or 3 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.Given a positive integer n. Find the sum of product of x and y such that floor(n/x) = y .
Example 1:
Input: n = 5
Output: 21
Explana... |
user: Generate an executable Python 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 of our older Mars Rovers has nearly completed its tour of duty and is awaiting instructions for one last mission to explore the Ma... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.View Russian Translation
From the beginning Benny was a very harsh pig.
She lives in a huge city. City can be determined as a grid 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 three integers n, k, target, and an array of coins of size n. Find if it is possible to make a change of target cents by using 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.Anica is having peculiar dream. She is dreaming about an infinite board. On that board, an infinite table consisting of infinite rows ... |
user: Generate an executable Python 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 arrays a[] and b[] of same size.Your task is to find minimum sum of two elements such that they belong to different arrays 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.Read problems statements in Mandarin Chinese and Russian
Chef is sitting in a very boring lecture, waiting for it to end. He has 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.My dear friend Anil has a quiet long name. One day he wrote a code which would automatically write his name whenever he wanted. Space ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.