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.Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Compute:
floor[1*e] + floor[2*e] + floor[3*e] + ... + ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a Binary Tree of size N, your task is to complete the function deletionBT(), that should delete a given node from the tree by making sure that tree shrinks from the bott... |
user: Generate an executable Python 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 work at a clinic. The clinic factors in the waiting time when selecting patients to treat next. This approach was adopted to preve... |
user: Generate an executable Python 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 robot named Micro in a matrix A, of integers of size N \times M, initially placed at the cell (X_1, Y_1). He has to rescue ... |
user: Generate an executable Python 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.
There are $N$ students standi... |
user: Generate an executable Python 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.
The placements/recruitment season is going on in vario... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.MoEngage noticed that some users are not aware of the practice page on CodeChef, and some others are not aware of the rated contests 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.For a permutation P of length N, we define L(P) to be the length of the longest increasing subsequence in P. That is, L(P) is the larg... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Nested quotations are great not only for writing literature with a complex narrative structure, but also in programming languages. Whi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Polycarp started working at a bank. He was assigned to monitor the ATM. The ATM initially contains $s$ rubles.
A queue of $n$ student... |
user: Generate an executable Python 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 here with another matrix A having N rows and M columns,
such that A_{(i,j)} = (i-1)\cdot M+j.
Chef decided to make this ma... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef is given three numbers A, B, and C.
He wants to find whether he can select exactly two numbers out of these such that the produc... |
user: Generate an executable Python 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.
Doraemon has a matrix 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.The technology behind the fridge has changed little over the years. Even so, many of the original owners of the Fred W. Wolf domestic ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Luka parked his truck near the lake. The lake is inhabited by the frog Barica, who jumps acrossplants floating on the lake’s surface. ... |
user: Generate an executable Python 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.
Two players (let's call them ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given $n$ integers $a_1, a_2, \dots, a_n$. You can perform the following operation on them:
select any element $a_i$ ($1 \le i \le 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.Your friend has gotten lost in the woods. He has called and asked for you to come get him, but you are very busy and would rather just... |
user: Generate an executable Python 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.
Winter has finally come to Chefland, so Chef bought 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 an alphanumeric string made up of digits and lower case Latin characters only, find the sum of all the digit characters in the 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.Ron and Hermione are deep in the Forbidden Forest collecting potion ingredients, and they've managed to lose their way. The path out 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.Bijan is new to programming. He learned recently that programmers do not code every bit of their apps from scratch.
For example they ... |
user: Generate an executable Python 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 this problem, we'll use the term "longest common substring" loosely. It refers to substrings differing at some number or fewer cha... |
user: Generate an executable Python 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 of length N.
Find the maximum length of any subarray of A, such that, the [bitwise OR] of all the elements 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.Spotting patterns in seemingly random strings is a problem with many applications. E.g., in our efforts to understand the genome we 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.Martha is interviewing at Subway. One of the rounds of the interview requires her to cut a bread of size $l\times b$ into smaller iden... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Martin has invited everyone he knows to celebrate his 535th birthday, and a whopping $n$ people from all over the world have accepted ... |
user: Generate an executable Python 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, find the number of divisors of N that are divisible by 3.
Example 1:
Input : 6
Output: 2
Explanation: 1, 2, 3, 6... |
user: Generate an executable Python 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 opened up a new restaurant. Like every other restaurant, critics critique this place. The Chef wants to gather as much positi... |
user: Generate an executable Python 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 array of N integers. You should suppo... |
user: Generate an executable Python 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.
Yesterday, puppy Tuzik learned a magically efficient m... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given an integer i. Print the maximum number of nodes on level i of a binary tree.
Example 1:
Input: 5
Output: 16
Example 2:
Input: 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 non-decreasing sequence is a called a Fox sequence, iff the most frequent element in the sequence is unique.
e.g. The sequence 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.Read problems statements in Mandarin Chinese and Russian.
Haku has been newly hired by Chef to clean tables at his restaurant. So 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.Read problem statements in [Bengali], [Russian], [Mandarin] and [Vietnamese] as well.
Chef has X coins worth 1 rupee each and Y coins... |
user: Generate an executable Python 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 matrix $A$ 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.Read problems statements [Mandarin] , [Bengali] , [Hindi] , [Russian] and [Vietnamese] as well.
Chef's brother Chefu is a competitive... |
user: Generate an executable Python 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 $n \times m$ grid. You are standing at cell $(1, 1)$ and your goal is to finish at cell $(n, m)$.
You can move to the neig... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.ACM NIT Surat has given Vinay, Minesweeper Master title for solving that problem in Codejam. In solving that Vinay has given 10 wrong ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You and Fredrick are good friends. Yesterday, Fredrick received $N$ credit cards from ABCD Bank. He wants to verify whether his credit... |
user: Generate an executable Python 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 ants are in a circular race. The length of the race is 1000 meters and ant number i is initially Vi meters far from starting point (... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Reyaan has given you the following problem to solve:
You are given an integer K in base B, represented by an array A of length N such... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Sir Monocarp Hamilton is planning to paint his wall. The wall can be represented as a grid, consisting of $2$ rows and $m$ columns. 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.Polycarp was presented with some sequence of integers $a$ of length $n$ ($1 \le a_i \le n$). A sequence can make Polycarp happy only 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.We’re all familiar with harshad numbers. For this problem, you will ... what’s that? You aren’t familiar with harshad numbers? They’re... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Codeforces separates its users into $4$ divisions by their rating:
For Division 1: $1900 \leq \mathrm{rating}$
For Division 2: $1600... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an integer array $a$ of length $n$.
Does there exist an array $b$ consisting of $n+1$ positive integers such that $a_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.While some participants are busy with their events, some are busy checking out the various Food Stalls. Now, it so happens that some o... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given two integers a and b. Find the sum of two numbers without using arithmetic operators.
Example 1:
Input:
a = 5, b = 3
Output: 8
Explanation :
5 + 3 = 8
Example 2:
Input:
... |
user: Generate an executable Python 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 country Stone Land, there are $N$ stones arranged in a row from left to right. Each stone has some height represented by a positi... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given an array a[ ] of N elements. Consider array as a circular array i.e. element after a_{n} is a_{1}. The task is to find maximum sum of the absolute difference between con... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Your algorithms have become so good at predicting the market that you now know what the share price of Wooden Orange Toothpicks Inc. (... |
user: Generate an executable Python 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’s girlfriend's birthday is near, so he wants to s... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a weighted, undirected and connected graph of V vertices and E edges. The task is to find the sum of weights of the edges 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.Read problems statements in Russian here
Polo, the Penguin, has a lot of tests tomorrow at the university.
He knows that there are 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 local shop in your area getting prepared for the great holiday of Black Friday. There are n items with prices p_1, p_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.Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
Chef is an intern at Zoozle. He has a co-intern named ... |
user: Generate an executable Python 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 of length N. Find the number of pairs of indices (i,j) such that
1 ≤ i < j ≤ N
A_{i} \cdot A_{j} > 0
------ ... |
user: Generate an executable Python 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 choreographing a circus show with various animals. For one act, you are given two kangaroos on a number line ready to jump 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 tennis match involves three people: two players and an umpire. Each of these has to come from a different country. There are $N$ 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.White Collar
Problem Statement:
Jacob’s friend Victor likes to watch soap ‘White Collar’ .An intriguing episode is about to start, 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.Nim is the most famous two-player algorithm game. The basic rules for this game are as follows:
The game starts with a number of pile... |
user: Generate an executable Python 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 time, there will be no unnecessary information in the problem statement.
Given an array(A) of N integers, find the probability 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.Alice and Bob are playing a game. They have a common string S of length N. The players also have their individual strings A (belonging... |
user: Generate an executable Python 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 an array A of length N. Chef wants to select some disjoint, non-empty subarrays from A such that:
The mex of each of the sele... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chief's bot is playing an old DOS based game. There is a row of buildings of different heights arranged at each index along a 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.Consider a square grid with lamps in fixed locations. Each lamp can either illuminate its row or its column, but not both. The illumin... |
user: Generate an executable Python 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 an array A having N elements. Chef wants to make all the elements of the array equal by repeating the following move.
Choose... |
user: Generate an executable Python 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 winter, the inhabitants of the Moscow Zoo are very bored, in particular, it concerns gorillas. You decided to entertain them and br... |
user: Generate an executable Python 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 colleague Elisabeth is lazy, both at work and when going to work. She never wants to do more than necessary, which also applies 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.Madoka finally found the administrator password for her computer. Her father is a well-known popularizer of mathematics, so the passwo... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Roger is a robot. He has n different arms. Currently, his arms are extended out on a 1 dimensional line. The i-th arm is currently ext... |
user: Generate an executable Python 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 sequence of integers $a$, a triplet $(a[i],a[j],a[k])$ is beautiful if:
$i\lt j\lt k$
$a[j]-a[i]=a[k]-a[j]=d$
Given an incre... |
user: Generate an executable Python 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$ of $n$ elements.
Your can perform the following operation no more than $n$ times: Select three indices $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.You are given two positive integers A and B. You need to construct two different binary strings (i.e, they are strings which consist 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 an array A of length N.
Determine the count of subarrays of A which contain their length as an element.
Formally, coun... |
user: Generate an executable Python 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 number is called 2050-number if it is $2050$, $20500$, ..., ($2050 \cdot 10^k$ for integer $k \ge 0$).
Given a number $n$, you are ... |
user: Generate an executable Python 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 Mischievous Troublemakers’ Association (MTA) has hatched a sinister plot for world domination! All through the night, the Troublem... |
user: Generate an executable Python 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 sets of numbers. Your task is to print all numbers from the sets, that both sets don't contain simultaneously.
Inpu... |
user: Generate an executable Python 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 you may know, the frogs are the biggest show-offs of the entire animal kingdom. Some weeks ago, they greatly impressed the other 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.Chef is currently facing the north direction. Each second he rotates exactly 90 degrees in clockwise direction. Find the direction 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.There are N men standing in a row.We can assign one of three color R(Red),G(Green) and Black(B) to each man.
Unfortunately,at the 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.Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese] and [Bengali] as well.
Misha calls a non-empty set 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.Let's define a function $f(x)$ ($x$ is a positive integer) as follows: write all digits of the decimal representation of $x$ backwards... |
user: Generate an executable Python 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 numbers, A1, A2, A3,....,An. There are consecutive subsequence A[i]....A[j], where 1 ≤ i ≤ j ≤ N.
For example N=3, the su... |
user: Generate an executable Python 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 waiting in a queue at ATM. The i^{th} person in the queue has a power level equal to A_{i} (1 ≤ A_{i} ≤ N). 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.Bob has a string (S), which is initially empty. In one operation, he can select a lowercase character (a-z) uniformly at random and 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.Zvonko is playing with digits again, even though his mother has warned him that he is doing too much math and should go outside to pla... |
user: Generate an executable Python 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 made a list for his monthly expenses. The list has N expenses with index 1 to N. The money spent on each expense depends upon... |
user: Generate an executable Python 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 instructor may use curved score to grade a student’s performance. Assume a student’s original score is $x$ out of a total of $100$.... |
user: Generate an executable Python 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 loves Tetris. He keeps on playing Tetris all 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.Samantha and Sam are playing a numbers game. Given a number as a string, no leading zeros, determine the sum of all integer values 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.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
ChefX showed ChefY his new pi... |
user: Generate an executable Python 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 2 trains A and B and N stations in a line from 1 to N in order. There is also an array P of length N-1 such that P_{i} (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.An array is sorted if it has no inversions
A Young Boy
You are given an array of $n$ positive integers $a_1,a_2,\ldots,a_n$.
In 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.The title is a reference to the very first Educational Round from our writers team, Educational Round 18.
There is a bag, containing ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a vector of N positive integers and an integer X. The task is to find the frequency of X in vector.
Example 1:
Input:
N = 5
vector = {1, 1, 1, 1, 1}
X = 1
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.Once upon a time there was a Three-Headed Monkey who had a large stash of banana smoothie on one side of the forest. However, her fami... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kiteretsu goes to his Chemistry Lab to perform the perfect reaction.
In his lab, he found N reagents numbered 1 to N. The i^{th} reage... |
user: Generate an executable Python 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. A binary string is a string consisting of only 0's and 1's.
A binary string is called *good* if it h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.