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.John likes simple ciphers. He had been using the “Caesar” cipher to encrypt his diary until recently, when he learned a hard lesson ab... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef has two binary strings A and B, each of length N. He can perform the following operation on A any number of times:
Choose L 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.Oostende Beach is a very long beach located in the north of Belgium. On this beach, there are $n$ huts located along a straight line. ... |
user: Generate an executable Python 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 received $n$ candies from their parents. Each candy weighs either 1 gram or 2 grams. Now they want to divide all candies... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.After the nationalization of the oil industry, Dr. Mosaddegh wants to dig some oil wells to extract all the oil in Persian Gulf. But 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.Little bear has got a big string S as his birthday present. Also, he personally loves all those strings that start with T1 and end 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.Recently, Greg got a grid with n rows and m columns. Rows are indexed from 1 to n and columns are indexed from 1 to m. The cell $ ( 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
, Russian and Vietnamese as well. ------
Maybe Fulu is not so good at writing cod... |
user: Generate an executable Python 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 Utopian Tree goes through 2 cycles of growth every year. Each spring, it doubles in height. Each summer, its height increases 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.You are given a grid with $n$ rows and $m$ columns. Rows and columns are numbered from $1$ to $n$, and from $1$ to $m$. The intersecti... |
user: Generate an executable Python 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 array, $\mbox{A}$, is defined as follows:
$A_0=0$
$A_x=A_{x-1}\oplus x$ for $x>0$, where $\oplus$ is the symbol for XOR
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.Two players are playing a game of Tower Breakers! Player $1$ always moves first, and both players always play optimally.The rules 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..intersection()
The .intersection() operator returns the intersection of a set and the set of elements in an iterable.
Sometimes, ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Jack the Lumberjack used to love chopping down trees. Jack is getting older and is becoming tired of this activity he used to love. 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.“Weeeee,” says the fox after breaking in to the roost and killing all the chickens. Then he realizes that he has killed way more chick... |
user: Generate an executable Python 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 integers a, b and c. Calculate ab modulo c.
Input
Input data contains numbers a, b and c, one number per line. Each 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.Some scientists are working on protein recombination, and during their research, they have found a remarkable fact: there are 4 protei... |
user: Generate an executable Python 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 and Bob are the best friends of each other.They both are good programmers as well,They like to do programming together so that 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.Jonas asked Martha to stand at point $(x_{1},y_{1})$ on an infinite cartesian plane. He gave her a string $S$ which consists of operat... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Bidhan studies at the University of Dhaka. Recently he noticed that, some of the university students are speaking a strange language. ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.$\textit{ABC}$ is a right triangle, $90^{\circ}$ at $\mbox{B}$.
Therefore, $\angle ABC=90°$.
Point $\mbox{M}$ is the midpoint of hyp... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In the mysterious country of Byteland, everything is quite different from what you'd
normally expect. In most places, if you were ap... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a string of length N of lowercase alphabet characters. The task is to complete the function countDistinctSubstring(), which returns the count of total number of distinct... |
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 of size N containing positive integers n and a number k,The absolute difference between values at indices i and j is |a[i] a[j]|. There are n*(n-1)/2 such pairs... |
user: Generate an executable Python 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 A and B. Find the minimum number of steps required to transform string A into string B. The only allowed operation 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.Nicholas Neverson was a student at Northlings Neverland Academy. As with any daydreaming student, Nicholas was playing around with a 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.Chef wants to store some important numerical data on his personal computer. He is using a new data type that can store values only fro... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kattapa, as you all know was one of the greatest warriors of his time. The kingdom of Maahishmati had never lost a battle under him (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.Little Frane is already in tenth grade, but is still struggling with Pascal in computer class. For homework, his teacher wrote the fol... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Hangman is a (somewhat macabre) word-guessing game that can be played by two people. Player $1$ thinks of a word consisting of $n$ let... |
user: Generate an executable Python 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 tree consisting of N nodes, each node i has a value a[i] (0 ≤ a[i] ≤ 1) associated with it.
We call a set S of tree 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.Vlad went into his appartment house entrance, now he is on the $1$-th floor. He was going to call the elevator to go up to his apartme... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given an unsorted array arr of size N, rearrange the elements of array such that number at the odd index is greater than the number at the previous even index. The task is to ... |
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 size N. The elements of the array consist of positive integers. You have to find the largest element with minimum frequency.
Example 1:
Input:
5
2 2 5 50... |
user: Generate an executable Python 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 was driving on a highway at a speed of X km/hour.
To avoid accidents, there are fine imposed on overspeeding as follows:
No fine... |
user: Generate an executable Python 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 want to type the string $s$, consisting of $n$ lowercase Latin letters, using your favorite text editor Notepad#.
Notepad# suppor... |
user: Generate an executable Python 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 dinner time. Ashish is very hungry and wants to eat something. He has X rupees in his pocket. Since Ashish is very picky, he only... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Since ACTA has entered into force, Slavko has been spending his time offline, solving crosswords. Having solved almost all that he cou... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.
You are a warrior and you ha... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A truncatable prime is a prime number which contains no zeros in decimal notation and all its suffixes are primes. 1 is considered 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.Julius Caesar protected his confidential information by encrypting it using a cipher. Caesar's cipher shifts each letter by a number 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.A sequence $a = [a_1, a_2, \ldots, a_l]$ of length $l$ has an ascent if there exists a pair of indices $(i, j)$ such that $1 \le 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.You are at your grandparents' house and you are playing an old video game on a strange console. Your controller has only two buttons 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 the string $s$ of decimal digits (0-9) of length $n$.
A substring is a sequence of consecutive characters of a string. The subs... |
user: Generate an executable Python 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.
On a sunny day, Akbar and Bir... |
user: Generate an executable Python 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 English, Mandarin Chinese and Russian as well.
Sherlock is stuck. There is a N X N grid in which some ce... |
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 size n. The task is to find the largest element in it.
Example 1:
Input:
n = 5
A[] = {1, 8, 7, 56, 90}
Output:
90
Explanation:
The largest element of 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.Kulyash stays in room that has a single bulb and N buttons. The bulb is initially on.
The initial states of the buttons are stored 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.A bulb company claims that the average lifetime of its bulbs is at least X units.
The company ran a test on N bulbs. You are given 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 representing number of vertices. Find out how many undirected graphs (not necessarily connected) can be constructed... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Monocarp wants to draw four line segments on a sheet of paper. He wants the $i$-th segment to have its length equal to $a_i$ ($1 \le 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.Ichigo is receiving special training from Kisuke Urahara to beat Aizen. This time, Kisuke took (P * Q * R) identical cubes and made th... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an array A containing N positive integers. Find the number of pairs (i,j) such that 1 ≤ i < j ≤ N and:
A_{i} + A_{j} ≥ 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 string S consisting of the characters 0, 1 and 2. Your task is to find the length of the smallest substring of string S that c... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are given an array arr[], you have to re-construct an array arr[].
The values in arr[] are obtained by doing OR(bitwise or) of consecutive elements in the array.
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.A modified Kaprekar number is a positive whole number with a special property. If you square it, then split the number into two integ... |
user: Generate an executable Python 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 scored X marks in her test and Bob has scored Y marks in the same test. Alice is happy if she scored at least twice the mark... |
user: Generate an executable Python 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 standard 8 \times 8 chessboard which has exactly 2 rooks on it and no other pieces. The rows are numbered 1 to 8 from ... |
user: Generate an executable Python 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 two integers $A$ and $B$. He can perform 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.Utkarsh has recently started taking English-language classes to improve his reading and writing skills. However, he is still strugglin... |
user: Generate an executable Python 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 with a binary string S of length N and an empty string T.
They both take turns and Alice plays 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.There is a field divided into $n$ rows and $m$ columns. Some cells are empty (denoted as E), other cells contain robots (denoted as 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.You have a total of 3N balls of colours Red, Blue and Green. There are exactly N balls of each colour.
These 3N balls are now distrib... |
user: Generate an executable Python 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 of length N. You are allowed to perform the following types of operations on string S:
Delete any one ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Boating season is over for this year, and Theseus has parked his boat on land. Of course, the boat looks nothing like it did as of 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.Alice and Bob are playing a game of table tennis where irrespective of the point scored, every player makes 2 consecutive serves befor... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Ishaan has a craving for sticks. He has N sticks. He observes that some of his sticks are of the same length, and thus he can make squares out of those.
He wants to know how 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.Tony is an employee at a mall. His job is to label each vehicle entering into the parking with a unique number. He starts labelling 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 a Binary Tree, find vertical sum of the nodes that are in same vertical line. Print all sums through different vertical lines st... |
user: Generate an executable Python 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 stacks of pizzas such that each contains 10 pizzas of varying radii. Geek can only eat a pizza from a stack if it is also pr... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Fidget spinners are so 2017; this year’s rage are fidget cubes. A fidget cube is a cube with unit side lengths, which you hold in your... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.During the class Professor asked Mukesh to look after the class as he was busy doing some work. He asked him not to allow anyone 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.Daylight Saving Time (DST) is the practice of advancing clocks forward during the summer time, usually by one hour, to gain an extra 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.Let's consider a two-dimensional binary table A of N rows and M columns.
Let A_{i, j} denote a bit in the i-th row and j-th column.
Ro... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Lena is preparing for an important coding competition that is preceded by a number of sequential preliminary contests. Initially, her ... |
user: Generate an executable Python 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 stick of length N.
He can break the stick into 2 or more parts such that the [parity] of length of each part is same. 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.Tech Families are an integral part of life @ VNIT. Dewang has quiet a few tech sons and daughters. His tech family is such that every ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Emma is really fond of integers and loves playing with them. Her friends were jealous, and to test her, one of them gave her a problem... |
user: Generate an executable Python 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 containing N integers. Find if it is possible to choose exactly M elements from the array such that the MEX 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 on an $n \times m$ grid where each square on the grid has a digit on it. From a given square that has digit $k$ on it, a Move ... |
user: Generate an executable Python 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.
You are given a tree with $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.John lives in HackerLand, a country with $N$ cities and $\mbox{M}$ bidirectional roads. Each of the roads has a distinct length, and e... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alice, Bob, and Charlie are contributing to buy a Netflix subscription. However, Netfix allows only two users to share a subscription.... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.On a certain train, Chef-the ticket collector, collects a fine of Rs. X if a passenger is travelling without a ticket. It is known 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.We say that a sequence of $2K$ elements is interesting if neither the sum of the first $K$ elements, nor the sum of the last $K$ eleme... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are $N$ people working in a building, and each one works in a separate cabin. Chef’s employees are numbered by integers 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.Every year the three friendly teachers at the kindergarten let their classes’ kids change classes to form three new ones. Some kids, 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 name of a month. Output the season of the year to which it belongs (based on Northern hemisphere).
Input
The input 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.N candidates (numbered from 1 to N) join Chef's firm. The first 5 candidates join on the first day, and then, on every subsequent day,... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Michael is accused of violating the social distancing rules and creating a risk of spreading coronavirus. He is now sent to prison. Lu... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Somu went to the gym today. He decided to do X sets of squats. Each set consists of 15 squats. Determine the total number of squats 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.Alice thinks of a non-decreasing sequence of non-negative integers and wants Bob to guess it by providing him the set of all its K-sum... |
user: Generate an executable Python 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 and Akhil are playing a game. They have $N$ balls numbered from $0$ to $N-1$. Akhil asks Akash to reverse the position of the ba... |
user: Generate an executable Python 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.
You are given two positive integers – A and B. You have to check whether ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Akshay loves to play with numbers and arrays. He took an array of size " 2n " where n is any positive integer chose by him. He tries 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.The brave Knight came to the King and asked permission to marry the princess. The King knew that the Knight was brave, but he also wan... |
user: Generate an executable Python 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 new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite 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.A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the rema... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Russian], [Mandarin Chinese], [Bengali], and [Vietnamese] as well.
Chef's school semester lasts for n day... |
user: Generate an executable Python 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 Sangtani is very excited with his holiday plans and was thinking about what to pack in his bag. As he likes namkeen ver... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.