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 string str of length n, find if the string is K-Palindrome or not. A k-palindrome string transforms into a palindrome on remov... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Pussycat Sonya has an array A consisting of N integers (N is even). She can perform operations of two types:
increase value of some el... |
user: Generate an executable Python 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 determine the efficacy of a vaccine against a disease, a clinical trial is needed. Some participants are given the real vaccine, wh... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a sorted array Arr of size N and a number X, you need to find the number of occurrences of X in Arr.
Example 1:
Input:
N = 7, X ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Stan Ford is a typical college graduate student, meaning that one of the most important things on his mind is where his next meal 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.Given a number K and string str of digits denoting a positive integer, build the largest number possible by performing swap operations... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Uneori îmi spun: am să mor
atât de singuratecă-n mijlocul lor;
limba simplă a bucuriilor n-am învâțat;
am să mor ca o pasăre car... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given two arrays of A and B respectively of sizes N_{1} and N_{2}, the task is to calculate the product of the maximum element 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.Given two numbers A and B, find K^{th} digit from right of A^{B}.
Example 1:
Input:
A = 3
B = 3
K = 1
Output:
7
Explanation:
3^{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.Read problems statements in Mandarin Chinese , Russian and Vietnamese as well.
Triangle classification is an important problem in mo... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.These days, many carmakers are developing cars that run on electricity instead of gasoline. The batteries used in these cars are gener... |
user: Generate an executable Python 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 without spaces, a character ch, and an integer count, the task is to find the string after the specified character 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.There is a given list of strings where each string contains only lowercase letters from $a-j$, inclusive. The set of strings is said 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 an array of n integers and q queries. Write a program to find floor value of mean in range l to r for each query in a new 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.Chaos is spreading through the Milky Way Galaxy and dark forces are taking over.
Somewhere in the galaxy there exists the ancient int... |
user: Generate an executable Python 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 and Chefina are playing a game. Chef plays first.
There are N piles where the i^{th} pile contains A_{i} stones.
In his/her tur... |
user: Generate an executable Python 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 required to build some sheets of rectangular shape of Area A. To build a sheet of an Area A of Dimensions L & B. You have two... |
user: Generate an executable Python 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 your boat ran out of fuel in the middle of the ocean, you have been following the currents for 80 days. Today, you finally got y... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Dmitry has an array of $n$ non-negative integers $a_1, a_2, \dots, a_n$.
In one operation, Dmitry can choose any index $j$ ($1 \le 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.Two players, Player 1 and Player 2, are given an integer N to play a game. The rules of the game are as follows :
1. In one turn, a 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.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Consider a sequence $A_{1}, 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 NxN matrix of positive integers. There are only three possible moves from a cell Matrix[r][c].
Matrix [r+1] [c]
Matrix [r+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.BooBoo is a smart baby who likes to travel around cities. And he is on a trip to Europe right now! Smart that he is, he has made a lis... |
user: Generate an executable Python 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 have an array of integers A_{1}, A_{2}, ..., A_{N}. The function F(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.A thermal decomposition reaction is breakdown of a compound into one or more compounds when heated.
For example, P \rightarrow a\cdot... |
user: Generate an executable Python 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 digit string is good if the digits (0-indexed) at even indices are even and digits at odd indices are prime ( 2 , 3 , 5 or 7 ).
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.In a tournament, $n$ players play against each other exactly once. Each game results in exactly one player winning. There are no ties.... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Odd and Even have had their share of fun times playing the good old prime game:
They start with an arbitrary natural number, and 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.There were initially X million people in a town, out of which Y million people left the town and Z million people immigrated to this 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.At the new start-up company Gaggle, we have rejected the oppressive corporate structures of old, with all of their managers and subord... |
user: Generate an executable Python 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 string is a string consisting only of the characters 0 and 1. You are given a binary string $s_1 s_2 \ldots s_n$. It is neces... |
user: Generate an executable Python 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 term “Harvard architecture” applies to a computer that has physically separate memories for instructions and data. The term origin... |
user: Generate an executable Python 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 the maximum sum path from a leaf to root.
Example 1:
Input:
1
/ \
2 3
Output:
4
Expl... |
user: Generate an executable Python 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 string$^\dagger$ $b$ of odd length $m$ is good if $b_i$ is the median$^\ddagger$ of $b[1,i]^\S$ for all odd indices $i$ ($1 \... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a number N, write a program to check whether given number is Adam Number or not.
Adam number is a number when reversed, the squa... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Harsh just loves numbers and loves to have fun with them . Apparently he has two numbers with him , say X and Y . Both of them are int... |
user: Generate an executable Python 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],[Vietnamese], and [Bengali] as well.
Today is Chef's birthday and he is looking forwar... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are the kingpin of a large network of criminal hackers. Legend has it there has never been a richer criminal than you. Not just be... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are playing a computer game. To pass the current level, you have to kill a big horde of monsters. In this horde, there are $n$ mon... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Quido and Hugo are making a chocolate cake. The central ingredient of the cake is a large chocolate bar, lying unwrapped on the kitche... |
user: Generate an executable Python 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 Avi likes the number K. Given a list of N integers, help him find the sum of all distinct numbers repeating exactly K times. Each... |
user: Generate an executable Python 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 non-negative integer N, repeatedly add all its digits until the result has only one digit.
Example 1:
Input:
N = 98
Output:
8
... |
user: Generate an executable Python 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 plan for Final Day attack on the city of Lanka Sugreev decided to steal the map of the city from the Central Library of Lanka. 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.There are N different types of colours numbered from 1 to N. Chef has A_{i} balls having colour i, (1≤ i ≤ N).
Chef will arrange some... |
user: Generate an executable Python 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 is quite simple. You're given a number N and a positive integer K. Tell if N can be represented as a sum of K prime numbe... |
user: Generate an executable Python 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.
Chef has a matrix $A$ with $... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Little Leon lives in the forest. He has recently noticed that some trees near his favourite path are withering, while the other ones 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.Alice and Bob are playing a game. They both agree up on a number M and the score is set to 0 initially. Alice chooses t > 0 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.Given a string S and a character X, the task is to find the last index (0 based indexing) of X in string S. If no index found then 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 array arr of size N, the task is to make strictly increasing and strictly decreasing subsequences from the array such that ea... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Abid aur uske Bis Chor (Abid and his Twenty Thieves) was known for their cruel theft in City of Gold. This small battalion of thieves ... |
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 integers the task is to find maximum size of a subset such that sum of each pair of this subset is not divisible by K.
Example 1:
Input :
arr[] = [3, 7, 2... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are planning your trip to Saint Petersburg. After doing some calculations, you estimated that you will have to spend k rubles each... |
user: Generate an executable Python 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 $n$ be a fixed integer.
A permutation is a bijection from the set $\{1,2,\ldots,n\}$ to itself.
A cycle of length ${k}$ ($k\ge... |
user: Generate an executable Python 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 floating point numbers a and b, find a%b.
Example 1:
Input:
a = 36.5, b = 5.0
Output:
1.5
Explanation:
36.5 % 5.0 = 1.5
Ex... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The integers shop sells $n$ segments. The $i$-th of them contains all integers from $l_i$ to $r_i$ and costs $c_i$ coins.
Tomorrow Va... |
user: Generate an executable Python 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.
Time flies fast, Chef’s sons are getting older, stronger and higher. 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.You are asked to calculate factorials of some small positive integers.
Input
An integer T, denoting the number of testcases, follow... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Note that this is a harder version of the problem pikemaneasy.Programming is an ancient art. Archeologists have made findings which 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.While working at DTL, Ela is very aware of her physical and mental health. She started to practice various sports, such as Archery, 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.Given an array Arr of length N. Determine if there exists an element in the array such that the sum of the elements on its left is equ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given two arrays of length N and M, print the merged array in ascending order containing only unique elements.
Example 1:
Input:
N = 2... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A video player plays a game in which the character competes in a hurdle race. Hurdles are of varying heights, and the characters have... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Nudgémon GO is a game in which players should earn as much experience points (XP) as possible, by catching and evolving Nudgémon. You ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Now it's time for actual battle between Ram and Ravana. Battle field is given in the form of an array of integers. But Ram has no id... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Sam's house has an apple tree and an orange tree that yield an abundance of fruit. Using the information given below, determine 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.You are given an array A = [A_{1}, A_{2}, \ldots, A_{N}] containing N integers.
Consider any subarray [A_{L}, A_{L+1}, \ldots, A_{R}]... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given an integer N, the task is to find out M increasing numbers such that the sum of M numbers is equal to N and the GCD of these M 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.There is a field of size $2 \times 2$. Each cell of this field can either contain grass or be empty. The value $a_{i, j}$ is $1$ if 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 two linked lists, the task is to complete the function findIntersection(), that returns the intersection of two linked lists. Ea... |
user: Generate an executable Python 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
A number is called palindromic if its decimal representation ... |
user: Generate an executable Python 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, the task is to change the complete string to Uppercase or Lowercase depending upon the case for the first character.... |
user: Generate an executable Python 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 sequence of integers A of length N. He creates another sequence B of length 2 \cdot N using sequence A. Initially, B is emp... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Adding two numbers several times is a time-consuming task, so you want to build a robot. The robot should have a string S = S_1 S_2 ..... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Nitin and Sobhagya were playing a game with coins. If Sobhagya has more coins then he is *winning*, otherwise Nitin is winning. Note 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.We are given a N*M grid, print the number of rectangles in it modulo (10^{9}+7).
Example 1:
Input:
N = 2, M = 2
Output:
9
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.Read problems statements in Mandarin Chinese and Russian.
This problem's statement is really a short one.
You are given an integer... |
user: Generate an executable Python 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$ vertices. A number is written on each vertex; the number on vertex $i$ is equal to $a_i$.
Reca... |
user: Generate an executable Python 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 game called "Unique Bid Auction". You can read more about it here:
https://en.wikipedia.org/wiki/Unique_bid_auction
(thou... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You have an array $a_1, a_2, \dots, a_n$ where $a_i = i$.
In one step, you can choose two indices $x$ and $y$ ($x \neq y$) and set $a... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given n-platform and two main running railway tracks for both directions. Trains that need to stop at your station must occupy... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mia is a newly hired administrative assistant. Though Mia was introduced to everyone in the company on her first day, she is forgetful... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.We all know that Gayle likes dealing only in fours and sixes.Therefore the balls he faced can be represented as a sequence of fours 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.Consider the following pseudocode, run on an array $A=[a_0,a_1,...,a_{n-1}]$ of length $n$:
rep := 0
while A not empty:
B := []
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given two strings A and B. Find the characters that are not common in the two strings.
Note :- Return the string in sorted order.
Exa... |
user: Generate an executable Python 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 cafe has N computers. Several customers come to the cafe to use these computers. A customer will be serviced only if there is any un... |
user: Generate an executable Python 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 a high-ranked army officer and he has been given the job to train the army.
The army consists of N soldiers where each soldie... |
user: Generate an executable Python 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, check if it is possible to convert it into a string that is the repetition of a substring with K characters. To conv... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Rhezo likes to play with graphs having N nodes and M edges. Lonewolf is ready to give him such a graph only on one condition. He wants... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Particle colliders are difficult to build and experiments are costly to run. Before running any real experiments it is better to do 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.To improve the participation in the online programming contest, CodeBurst, its organizers have planned a word of mouth advertising cam... |
user: Generate an executable Python 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 only '0's and '1's, find the last index of the '1' present in it.
Example 1:
Input:
S = 00001
Output:
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.This is the easy version of this problem. The difference between easy and hard versions is only the constraints on $a_i$ and on $n$. Y... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two binary strings A and B, each of length N. You can perform the following operation on string A any number of times:
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.Virtually every single book, play, movie, novel, and game has at least one character. Most have more, and some even have thousands! 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.You are given a grid having N rows and M columns. A grid square can either be blocked or empty. Blocked squares are represented by 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.While on summer camp, you are playing a game of hide-and-seek in the forest. You need to designate a “safe zone”, where, if the player... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Brandon Greg Jr. is an art enthusiast who covered the entirety of the walls of his room with works of art. Brandon’s room is in the 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.In Chefland, each chicken has X legs and each duck has Y legs. Chef's farm can have exactly one type of bird.
Given that the birds 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.Learning about all the sinusoidal functions of trigonometry, Rahul has grown fond of numbers, whose digits increase and decrease alter... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.