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.Given a number N.Check if it is tidy or not.
A tidy number is a number whose digits are in non-decreasing order.
Example 1:
Input:
12... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Aaron is struggling with trigonometric functions, so his teacher gave him extra homework. Given an integer, $n$, he must answer the fo... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.This Question is Simple and Straight Forward . You are given a number ,
you have to find the next prime number.
Input
First line co... |
user: Generate an executable Python 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 leading a kayaking trip with a mixed group of participants in the Stockholm archipelago, but as you are about to begin your fi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Cities on a map are connected by a number of roads. The number of roads between each city is in an array and city ${0}$ is the starti... |
user: Generate an executable Python 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 is attending math classe... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Russian] and [Mandarin Chinese]
Chef is playing Need For Speed. Currently, his car is running on a straig... |
user: Generate an executable Python 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 mom always said life was like a box of chocolates. You never know what you’re gonna get."
Forrest Gump is a young boy who goes 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 natural number n, calculate sum of all its proper divisors. A proper divisor of a natural number is the divisor that is strict... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a set of n numbers. The task is to count all the subsets of the given set which only have even numbers and all are distinct.
Note: By the property of sets, if two subset... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mary loves binary strings.
Given a binary string S, she defines the *beauty* of the string as the [bitwise XOR] of decimal 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.Young Luka is about to enter a house with the evil witch Marica inside. As soon as he enters the house, she asks him questions about 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.John Doe wants to transport his possessions from one bank of Lake Michigan to the other. His possessions consist of $W$ wolves, $S$ sh... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alice and Bob dream about future summer vacations where travel is unconstrained by pandemics, budgetary constraints, or other mundane ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Anthony is just now learning basic math, how exciting! He first learns about addition\[ a+n=a+\underbrace{1+1+\cdots +1}_ n, \]
then ... |
user: Generate an executable Python 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 standing at point $(0,0)$ on an infinite plane. In one step, you can move from some point $(x_f,y_f)$ to any point $(x_t,y_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.There are n squirrel(s) waiting below the feet of m chestnut tree(s). The first chestnut of the i-th tree will fall right after T_{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 rod of length N inches and an array of prices, price[]. price[i] denotes the value of a piece of length i. Determine the maxim... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are a usual chat user on the most famous streaming platform. Of course, there are some moments when you just want to chill and spa... |
user: Generate an executable Python 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.
Recently Chef bought a bunch of robot-waiters. And now he needs to know 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.A sequence of $n$ integers is called a permutation if it contains all integers from $1$ to $n$ exactly once.
Given two integers $n$ 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 sorted array of N integers, find the number of distinct absolute values among the elements of the array.
Example 1:
Input:
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.Given a number, in the form of an array Num[] of size N containing digits from 1 to 9(inclusive). The task is to find the next smalles... |
user: Generate an executable Python 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 such that it may contain many continuous digits. Find the number of ways to spell the number.
For example, consider ... |
user: Generate an executable Python 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 the prices of three presents. Also there are three sisters. It is known that the most valuable present is for the eldest... |
user: Generate an executable Python 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 graph with N vertices (numbered 1 to N) and M bidirectional edges, which doesn't contain multiple edges or self-loops ... |
user: Generate an executable Python 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 taking a tough examination. The question paper consists of N objective problems and each problem has 4 options A, B, C, and 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.Shohag has an integer sequence $a_1, a_2, \ldots, a_n$. He can perform the following operation any number of times (possibly, zero):
... |
user: Generate an executable Python 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 large number N in the form of a string, you have to check whether it is divisible by 999 without dividing or finding 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.There is a hacker named "Vijay" who has developed a method to check whether an id at some social networking site is fake or real using... |
user: Generate an executable Python 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.
This year CodeChef is organizing the SnackUp cooking 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.Susan is making high-speed videos of falling coffee mugs. When analyzing the videos she wants to know how big the mugs are, but unfort... |
user: Generate an executable Python 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 array $[b_1, b_2, \ldots, b_m]$ define its number of inversions as the number of pairs $(i, j)$ of integers such that $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.Madoka is a very strange girl, and therefore she suddenly wondered how many pairs of integers $(a, b)$ exist, where $1 \leq a, b \leq ... |
user: Generate an executable Python 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.
One day, Chef's friend gave him a wrong 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.Find the number of days required to reach the top of the staircase of Q stairs if one moves R stairs upwards during daytime and S stai... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Stanley defines the beauty of an array $a$ of length $n$, which contains non-negative integers, as follows: $$\sum\limits_{i = 1}^{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 class of students got bored wearing the same pair of shoes every day, so they decided to shuffle their shoes among themselves. In 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.Hannah recently discovered her passion for baking pizzas, and decided to open a pizzeria in downtown Stockholm. She did this with the ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given an sorted array A of size N. Find number of elements which are less than or equal to given element X.
Example 1:
Input:
N = 6
A[] = {1, 2, 4, 5, 8, 10}
X = 9
Output:
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.Given an array of size n which contains all elements occurring in multiples of K, except one element which doesn't occur in multiple o... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given N students sitting in a circle, distribute M candies to these students. The i_{th} student can take only i candies. If i_{th} student does not get the required amount 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.Given a sorted array Arr[](0-index based) consisting of N distinct integers and an integer k, the task is to find the index of k, if i... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given array A of size n. You need to find the maximum-sum sub-array with the condition that you are allowed to skip at most on... |
user: Generate an executable Python 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.
There are N students living in the dormitory of Berlan... |
user: Generate an executable Python 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 jet's speed is changed after every mile covered on it's runway. It follows a specific pattern for the speed. Starting from 1 it 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.Read problems statements in Mandarin Chinese and Russian as well.
Given a sequence of n distinct numbers a[1..n], we want to sort 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 a permutation $a$ of size $n$ and you should perform $n$ operations on it. In the $i$-th operation, you can choose a non... |
user: Generate an executable Python 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 even integer N, output a *permutation* P of length N, such that:
The value of P_{i} + P_{N+1-i} is distinct for all 1 ≤ i ≤ \... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Like all other good drivers, you like to curse, swear and honk your horn at your fellow automobile drivers. Today you’re at the rear 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.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef lent some money to Chefe... |
user: Generate an executable Python 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.
One day, Saeed was teaching 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, Russian and Vietnamese as well.
Today, Chef was trying to solve a problem he found pre... |
user: Generate an executable Python 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 and Daniel are friends. Both of them like letters, especially uppercase ones.
They are cutting uppercase letters from newspaper... |
user: Generate an executable Python 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 $\mbox{1}$ friendly number and $n$ unfriendly numbers, determine how many numbers are divisors of the friendly number but not 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 graph which consists of several edges connecting its nodes, find a subgraph of the given graph with 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.Andy is going holiday shopping and needs to buy several Christmas trees. At the store, there is a row of Christmas trees of various 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.Chef is looking to buy a TV and has shortlisted two models. The first one costs A rupees, while the second one costs B rupees.
Since ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Gohan has found his way into Dr. Gero's lab. There, he finds a circuit. He starts to toy with it. He finds the inverse transverse func... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Energy resources were getting depleted on the planet Kepler and Xenny was the head of the Energy Saving Committee.
Xenny was in-charg... |
user: Generate an executable Python 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, chef Ciel often hears about lucky numbers.
Everybody knows that lucky numbers are positive integers
whose decimal 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.You know that 1 kg of pulp can be used to make 1000 pages and 1 notebook consists of 100 pages.
Suppose a notebook factory receives ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Sarthak and Anuradha are very good friends and are eager to participate in an event called *Equinox*. It is a game of words. In this g... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given an integer sequence $A$ with length $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.As a Swede, you hold a deep love for the traditional Thursday lunch of pea soup and pancakes. You love it so much, in fact, that you 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.Xsquare loves to play with the strings very much. This time, he has two strings named as S1 and S2 along with the M pairs of integers... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Consider an undirected graph where each edge weighs 6 units. Each of the nodes is labeled consecutively from 1 to n.
You will be giv... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Pitsy needs help with the given task by her teacher. The task is to divide an array into two sub-array (left and right) containing n/2 elements each and do the sum of the suba... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Beppa and her circle of geek friends keep up to date on a group chat in the instant messaging app SwerChat$^{\text{TM}}$.
The group 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.Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence $A_{1}, A_{2}, \dots, A_{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.The local zoo has acquired a large open garden in which animals may freely move as in their natural habitats and entertain visitors wi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.To satisfy his love of matching socks, Phoenix has brought his $n$ socks ($n$ is even) to the sock store. Each of his socks has a colo... |
user: Generate an executable Python 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 on his way to become the new big bull of the stock market but is a bit weak at calculating whether he made a profit or a loss ... |
user: Generate an executable Python 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 loves perfect squares and hates perfect cubes.
For any natural number N,
F(N) = \texttt{number of perfect squares smaller ... |
user: Generate an executable Python 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 recently converted all the positive integers from 1 to 2^{N} - 1 (both inclusive) into binary strings and stored them in an arra... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each the array element between tw... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.When users post an update on social media,such as a URL, image, status update etc., other users in their network are able to view this... |
user: Generate an executable Python 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 Frog Regent has arranged his $N$ frog servants in a circle, with each frog facing the back of the next one. Each frog is assigned ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Akshat has X rupees to spend in the current month. His daily expenditure is Y rupees, i.e., he spends Y rupees each day.
Given 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.UpCoder is looking to assign their best employees to a team tasked with designing their new and improved website, and they’re looking ... |
user: Generate an executable Python 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 is gifted with a Divine array $a$ consisting of $n$ ($1 \le n \le 2000$) integers. Each position in $a$ has an initial value. Af... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin Chinese and Russian as well.
Today is Devu's birthday. He has obtained few colored balloons 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.For a binary string A, let f(A) denote its *badness*, defined to be the difference between the number of zeros and number of ones pres... |
user: Generate an executable Python 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 a New York City coffee house called Central Perk, we're introduced to six friends: chef Monica Geller, data controller Chandler Bin... |
user: Generate an executable Python 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 received a cake for her birthday! Her cake can be described by a convex polygon with $n$ vertices. No three vertices are colline... |
user: Generate an executable Python 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 got another sequence as ... |
user: Generate an executable Python 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 the upcoming semester, the admins of your university decided to keep a total of X seats for the MATH-1 course. A student interest ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A string is called square if it is some string written twice in a row. For example, the strings "aa", "abcabc", "abab" and "baabaa" ar... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given an integer n, we need to find a range of positive integers such that all the number in that range are composite and length of that range is n. You may return anyone rang... |
user: Generate an executable Python 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 distance between two integers is defined as the sum of the absolute result of subtracting their digits. For example, the distance ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A binary tree is a tree which is characterized by one of the following properties:
It can be empty (null).
It contains a root node on... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.With the college fest approaching soon, Manasa is following a strict dieting regime . Today, she just cannot resist her temptation 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.You are given the sequence of Nucleotides of one strand of DNA through a string S of length N. S contains the character A, T, C, and 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.Amanda Air has routes between many different airports, and has asked their most important frequent flyers, members of the AA Frequent ... |
user: Generate an executable Python 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 the human eye, primary colours are red, green, and blue.
Combining 1 drop each of any two primary colours produces a new type 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.Given an array A of length N, your task is to find the element which repeats in A maximum number of times as well as the corresponding... |
user: Generate an executable Python 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 current rating is X, and he wants to improve it. It is generally recommended that a person with rating X should solve problems ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.min
The tool min returns the minimum value along a given axis.
import numpy
my_array = numpy.array([[2, 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.Read problems statements in Mandarin Chinese and Russian.
You are given an array A of N integers. You are to fulfill M queries. Eac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.