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.You are given a matrix grid of n x m size consisting of values 0 and 1. A value of 1 means that you can enter that cell and 0 implies... |
user: Generate an executable Python 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 and B are good friend and programmers. They are always in a healthy competition with each other. They decide to judge the best among... |
user: Generate an executable Python 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 linked list sorted in ascending order and an integer called data, insert data in the linked list such that the list remains so... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Watson gives an integer $N$ to Sherlock and asks him: What is the number of divisors of $N$ that are divisible by 2?.
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.Several surveys indicate that the taller you are, the higher you can climb the corporate ladder. At TALL Enterprises Inc., this “de fa... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Polly, the programming parrot, has escaped. As Johan is in desperate need for some programming skill, he wants to find her. The only 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.The First Universal Bank of Denview has just been robbed! You want to catch the robbers before they leave the state.
The state of 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.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef wants to give a gift 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.Pushpa has entered Chefland and wants to establish Pushpa-Raj here too.
Chefland has N towers where the height of the i^{th} tower 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.Read problems statements in Mandarin Chinese and Russian.
Chef doesn't love math anymore. He loves Sasha. Sashen'ka is cute.
Chef... |
user: Generate an executable Python 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 hard version of the problem. The only difference is that in this version $1 \le n \le 300$.
In the cinema seats can be repr... |
user: Generate an executable Python 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 has developed an effective vaccine for Corona virus and he wants each of the N houses in Geek Land to have access to it. Given 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 Linked list, rearrange it such that converted list should be of the form a < b > c < d > e < f .. where a, b, c are consecutiv... |
user: Generate an executable Python 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 was reading a book. He decided to highlight all 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.For several years now, the Nordic Conference on Partitions and Combinatorics, NCPC, has had a growing number of participants. This yea... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.It’s Christmas time and JW’s $1$-dimensional shop is selling Christmas trees. However, the demand for trees is much higher than the 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.Engineers have taken over the university’s English department! As part of their plan to dominate the university, they have employed yo... |
user: Generate an executable Python 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 of $n$ binary integers (i.e., $1$'s and $1$'s) defined as $A=[a_0,a_1,...,a_{n-1}]$.
Let $f(i,j)$ be the bitwise XO... |
user: Generate an executable Python 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 [Russian], [Vietnamese], [Hindi], [Mandarin chinese] and [Bengali] as well.
Chef is interested in the his... |
user: Generate an executable Python 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 a real estate broker in ancient Knossos. You have $m$ unsold houses, and each house $j$ has an area, $x_j$, and a minimum pric... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alex has two arrays defined as $A=[a_0,a_1,...,a_{n-1}]$ and $B=[b_0,b_1,\ldots,b_{m-1}]$. He created an $n\times m$ matrix, $\mbox{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.Each Halloween, the $N$ witches of Sweden all gather high up in the air with their brooms to perform a magical dance. The dance consis... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kitty and Katty have $N$ plastic blocks. They label the blocks with sequential numbers from $\mbox{1}$ to $N$ and begin playing a game... |
user: Generate an executable Python 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 Bipartite Graph is an undirected graph whose vertices can be partitioned into $2$ sets such that, for each edge $(u, v)$, $u$ and $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.A driver is driving on the freeway. The check engine light of his vehicle is on, and the driver wants to get service immediately. Luck... |
user: Generate an executable Python 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 your friends are playing a game of Exploding Kittens. On a player’s turn, she must perform the following actions in order:
- Dr... |
user: Generate an executable Python 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 total numbers, less than or equal to n which have at-least one common factor with n other than 1.
Example... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are esse... |
user: Generate an executable Python 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 programmer. He owns a brand new 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 binary string, that is it contains only 0s and 1s. We need to make this string a sequence of alternate characters by flipping ... |
user: Generate an executable Python 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
You are given a function f: WxW → W, where W represents the set of whole numbers.
The following data is given to you:
f(4... |
user: Generate an executable Python 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 Russian also.
Chef plays with the sequence of N numbers. During a single move Chef is able to choose a no... |
user: Generate an executable Python 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 , print the reverse of the string as output.
Example 1:
Input: S = "GeeksforGeeks"
Output: "skeeGrofskeeG"
Explanati... |
user: Generate an executable Python 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, calculate the prime numbers up to N using Sieve of Eratosthenes.
Example 1:
Input:
N = 10
Output:
2 3 5 7
Explanat... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.AmShZ has traveled to Italy from Iran for the Thom Yorke concert. There are $n$ cities in Italy indexed from $1$ to $n$ and $m$ direct... |
user: Generate an executable Python 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 once had a deep epiphany... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Skyline Real Estate Developers is planning to demolish a number of old, unoccupied buildings and construct a shopping mall in their pl... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ishwar has got proposals from N girls. Each girl gives him a rose with a number written on it where the number represents the populari... |
user: Generate an executable Python 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 statement looms below, filling you with determination.
Consider a grid in which some cells are empty and some cells are 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.You are given a rectangular table containing words. Each of its columns has its own name. You are also given the list of rules of sort... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.As White Walkers have attacked Winterfell, Cersei has to send her army to Winterfell but through tunnels.
Unwilling to do so, she wants to delay as much as she can so she take... |
user: Generate an executable Python 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.
Little Elephant from Zoo of Lviv likes to watch movies.
There are N differ... |
user: Generate an executable Python 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 such that array elements are distinct and in the range from 1 to n. The task is to count minimum number... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Prayatna decoration work is going on at full swing. In order to decorate the MIT road, Don has an infinite supply of streamers of leng... |
user: Generate an executable Python 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 N positive integers, find the smallest positive integer S such that S cannot be represented as sum of elements... |
user: Generate an executable Python 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 positive integers, find GCD of all the array elements.
Example 1:
Input: N = 3, arr[] = {2, 4, 6}
Output: 2
Explan... |
user: Generate an executable Python 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 big fan of soccer! He loves soccer so much, ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Akash loves going to school, but not on weekends.
A week consists of 7 days (Monday to Sunday). Akash takes a leave every Saturday.... |
user: Generate an executable Python 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 14th of March was the international day of mathematics, because of number π = 3.1415926...
In the occasion of this day Goofy Neph... |
user: Generate an executable Python 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.
You are given an array $A$ with $N$ integers. An ar... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Let us denote $A_{i,j}$ as the element from matrix $A$ located in the $i$-th row and $j$-th column. We say that the matrix $A$ is cool... |
user: Generate an executable Python 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 consisting of $n$ rows and $m$ columns. Each cell of this matrix contains $0$ or $1$.
Let's call a square of 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.John Watson knows of an operation called a right circular rotation on an array of integers. One rotation operation moves the last 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.Chef went shopping and bought items worth X rupees (1 ≤ X ≤ 100). Unfortunately, Chef only has a single 100 rupees note.
Since Chef 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 length n, count the number of strings of length n that can be made using ‘a’, ‘b’ and ‘c’ with at-most one ‘b’ and two ‘c’s al... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Let's consider a permutation P = {$p_{1}$,$ p_{2}$, ..., $p_{N}$} of the set of N = {1, 2, 3, ..., N} elements .
P is called a magi... |
user: Generate an executable Python 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 of integers of size n where n being even.. You have to calculate the number of dominate pairs (i,j) . Where a 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.Black Vienna is a puzzle game where players try to deduce the secret identities of the three spies. There are $26$ suspects, represent... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Dr. Zora built an algorithm to set the destructive or danger year, his algorithm contains a pattern of years which were set by Hydra ... |
user: Generate an executable Python 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 stream arr[] of n integers. Find the K^{th} largest element (not K^{th} largest unique element) for each element in 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 number N. Your task is to check whether it is fascinating or not.
Fascinating Number: When a number(should contain 3 digits or... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Archimedes is the name of a new 2D video game, which is very simple: the player hits start, at which point their avatar moves along 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.A Sphenic Number is a positive integer N which is product of exactly three distinct primes. The first few sphenic numbers are 30, 42, ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mr Lavit is teacher for physical education at a school.
Today he is in bad mood, so he is taking it out on the students of his class.
... |
user: Generate an executable Python 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. Print the minimum positive integer by which it should be divided so that the result is an odd number.
Example 1:
Inp... |
user: Generate an executable Python 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, your task is to find the number of patterns of form 1[0]1 where [0] represents any number of zeroes (minimum require... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alperen has two strings, $s$ and $t$ which are both initially equal to "a".
He will perform $q$ operations of two types on the given ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Near the great desert of Byteland lies a technologically advanced kingdom of hamsters. In the year 2020, to protect better their terri... |
user: Generate an executable Python 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. Check if it is a Kaprekar number or not.
Note:- A Kaprekar number is a number whose square when divided into two par... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.IPL 2021 Finals are here and it is between the most successful team of the IPL Mumbai Indians and the team striving to garb their firs... |
user: Generate an executable Python 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, sort the array according to frequency of elements. That is elements that have higher frequency come first.... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.James found a love letter that his friend Harry has written to his girlfriend. James is a prankster, so he decides to meddle with 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 number N. Find the length of the longest consecutive 1s in its binary representation.
Example 1:
Input: N = 14
Output: 3
Expla... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Two bicycle courier services have been competing in Metro City for many years, stealing customers back and forth from one another. Rec... |
user: Generate an executable Python 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 sum of all the numbers between the range l and r. Here each number is represented by the sum of its distinct prime factors.
... |
user: Generate an executable Python 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 playing a game, defined below:
There is an undirected tree graph with $n$ nodes that has the following properties: ... |
user: Generate an executable Python 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 the most important skills a programmer needs to learn early on is the ability to pose a problem in an abstract way. This skill ... |
user: Generate an executable Python 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 nxn matrix .In the given matrix, you have to find the boundary elements of the matrix.
Example 1:
Input: [[1, 2, 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.Given a month with arbitrary number of days, N, and an integer K representing the day with which it starts. ie- 1 for Monday, 2 for Tu... |
user: Generate an executable Python 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 first k digits after the decimal in the value of 1/n and return it as a string.
Note: Your program 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.A special compression mechanism can arbitrarily delete 0 or more characters and replace them with the deleted character count.
Given 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.Given a String. Reverse each word in it where the words are separated by dots.
Example 1:
Input:
S = "i.like.this.program.very.much"
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.Mr. Anant Asankhya is the manager at the INFINITE hotel. The hotel has an infinite amount of rooms.
One fine day, a finite number 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.You are given an array of size n containing initial values a1, a2, ........, an. You've to perform k step modification to the given ar... |
user: Generate an executable Python 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's phone shows a Battery Low notification if the battery level is 15 \% or less.
Given that the battery level of Chef's phone is ... |
user: Generate an executable Python 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 containing N integers.Find out how many elements should be added such that all elements between the maximum and minim... |
user: Generate an executable Python 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 grand museum has just announced a large exhibit on jewelry from around the world. In the hopes of his potential future prosperity,... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Nina received an odd New Year's present from a student: a set of $n$ unbreakable sticks. Each stick has a length, $\boldsymbol{l}$, 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.At one of the many climate protests, Skylar fell in love with a fellow environmental activist. Unfortunately, the two young lovers liv... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Background:
Verma was very afraid of his maths test to be held at school, the next day. So, he dreamt of one of the hardest questions ... |
user: Generate an executable Python 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 sweltering summer has arrived, but Chotu still has classes to
attend. The map of Chotu's college is given in the form of a graph ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Petya has an array of integers $a_1, a_2, \ldots, a_n$. He only likes sorted arrays. Unfortunately, the given array could be arbitrary... |
user: Generate an executable Python 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 National Egg Co-ordination Committee (NECC) has been able to come up with a few variants of chicken egg that is stronger than 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 three integers P,R and T, denoting Principal, Rate of Interest and Time period respectively.Compute the simple Interest.
Example... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Andrew likes meatballs very much.
He has N plates of meatballs, here the i^{th} plate contains P_{i} meatballs. You need to find the 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.Given a string S as input. Delete the characters at odd indices of the string.
Example 1:
Input: S = "Geeks"
Output: "Ges"
Explanatio... |
user: Generate an executable Python 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 lowercase english alphabet characters. The task is to calculate the number of distinct strings that can 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.Given a number N, find the product of all the divisors of N (including N).
Example 1:
Input :
N = 6
Output:
36
Explanation:
Divisor... |
user: Generate an executable Python 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 $n \times m$ checkerboard. On each cell of the checkerboard, place a positive integer. The values in each column of the ch... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Will the galaxy see peace at last? All the warlords have gathered to divide all of space between themselves. The negotiations have com... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.