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 two integers, LL and RR, find the maximal value of AA xor BB, where AA and BB satisfy the following condition:
L≤A≤B≤RL≤A≤B≤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.Slavko decided to challenge Mirko! He gave him a real number $P$ and a bag full of pieces of paper with exactly one number between $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 [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.
Chef went to the store in or... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a string S of '$'s and '.'s. '$' are planks on the bridge and '.'s are the broken sections of the bridge. You can jump up to onl... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Borys likes to travel.
Now he has a vacation and wants to visit beautiful city Treebourg.
The city consists of n junctions and n-1 roa... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Anuj has challenged Arun to climb N stairs but at only in powers of P and Q. Now Arun being a lazy guy wants to do this in minimum num... |
user: Generate an executable Python 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 starting set consisting of all integers from 1 to 1000, inclusive. You are also given several sets which need to be 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.Read problem statements in [Mandarin], [Russian], and [Vietnamese] as well.
Chef prepared a problem. The admin has rated this problem... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Little Mirko spends his free time painting. For this hobby, he likes to use brushes and a palette containing $K$ colors overall. His f... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Quido plans to send a New Year greeting to his friend Hugo. He has recently acquired access to an advanced high-precision plotter and ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a rectangular grid with $n$ rows and $m$ columns. The cell located on the $i$-th row from the top and the $j$-th column ... |
user: Generate an executable Python 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.
Alexey is trying to develop a program for a very simpl... |
user: Generate an executable Python 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 street by the name of colourful street in Cape Town. The residents of the place have decided that they will paint their 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.You are given the string S . Compress the string when lower and upper cases are the same. In compressed string characters should be 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.Per is repairing roads. The job is concentrated on roads with one lane in each direction. Thus, when Per closes down the lane in one 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.HackerLand University has the following grading policy:
Every student receives a $\textit{grade}$ in the inclusive range from $0$ 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.Alice and Bob are playing a game. They choose some subset of integers from A to B (including A and B). Let us call this subset T. 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.You are given an array $a$ with $n$ integers. You can perform the following operation at most $k$ times:
Choose two indices $i$ and $... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In the ACM kingdom, there are $N$ cities connected by $M$ two-way roads. These cities are connected, i.e., one can reach from any city... |
user: Generate an executable Python 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[ ] denoting the time taken to complete N tasks, determine the minimum amount of time required to finish the tasks 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.Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.
[Flappy Bird] is on a screen... |
user: Generate an executable Python 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 positive integers N and M, let S denote the set of all the arrays of size N such that each element of the array lies in the ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are playing a game. At each level of the game, you have to choose one of the roads to go to the next level. Initially, you have 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 grasshopper is in a flower field. The field contains $N \cdot N$ flowers arranged in $N$ rows and $N$ columns. For each flower 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.There are N rooms in a straight line in Geekland State University's hostel, you are given a binary string S of length N where S[i] = '... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in mandarin chinese, russian and vietnamese as well.
You are given N integers: A_{1}, A_{2}, ..., A_{N}. 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.There are N integers given in an array arr. You have to determine if it is possible to divide them in at most K groups, such that any ... |
user: Generate an executable Python 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 statement in Mandarin chinese and Vietnamese.
Suzumo has a chessboard with $N$ rows and $M$ columns. In one step, he ca... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Watson gives a circle and a triangle in a 2-dimensional plane to Sherlock. Sherlock has to tell if they intersect/touch each other.
... |
user: Generate an executable Python 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 array arr of size N and an integer target, return the number of non-empty subarrays with a sum equal to target.
Note : ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Vasya has a grid with $2$ rows and $n$ columns. He colours each cell red, green, or blue.
Vasya is colourblind and can't distinguish ... |
user: Generate an executable Python 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. Find the element that appears only once in the array. All other elements appear exactly twice.
... |
user: Generate an executable Python 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 only difference between the two versions is that in this version $n \leq 1000$ and the sum of $n$ over all test cases does not exc... |
user: Generate an executable Python 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 is choosing three problems for creating a programming test. Totally he has n problems in his list. The complexity of the i-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.Chef has planned that he will drink exactly X liters of tea daily. He has an empty jar having a capacity of Y liters.
Chef can visit ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition."One does not simply walk into Mordor.
Its black gates are guarded by more than just Orcs.
There is evil there that does not sleep.
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a number N, find whether N can be expressed as sum of two or more consecutive positive numbers.
Example 1:
Input:
N = 10
Outp... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ela loves reading a lot, just like her new co-workers in DTL! On her first day after becoming an engineer in DTL, she is challenged by... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Doug James is an up-and-coming DJ from Graphland who’s had a tough time making it big. This all changed with the release of his latest... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Casting spells is the least understood technique of dealing with real life. Actually, people find it quite hard to distinguish between... |
user: Generate an executable Python 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 one meeting room in a firm. There are N meetings in the form of (S[i], F[i]) where S[i] is the start time of meeting i and F[... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ankita is a maths whiz. Powers of large numbers have fascinated her for a long time. She loves them so much that when she sees two num... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a positive integer n. The task is to find the n^{th} telephone number. The telephone numbers or the involution numbers are a seq... |
user: Generate an executable Python 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 interested in bits 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 an array with $n$ $64$-bit integers: $d[0],d[1],\ldots,d[n-1].$.
BIT(x, i) = (x >> i) & 1, where $B(x,i)$ is the $i^{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.Vera is an astronomer studying locality of nearby star systems. The star systems can be thought of as 3D points in space. Vera would l... |
user: Generate an executable Python 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’ve heard of acid rain but have you heard of antimatter rain? Antimatter rain is so potent that when it comes into contact with ano... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are given an array of size N. You need to find elements which appear prime number of times in the array with minimum K frequency (frequency >= K).
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.Ticket to Ride1 is a board game for up to $5$ players. The goal of the game is to set up train lines (and to thwart the opponents’ att... |
user: Generate an executable Python 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 directed graph of V vertices and E edges is given in the form of an adjacency list adj. Each node of the graph is labelled with a di... |
user: Generate an executable Python 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 the binary representation S of a number X with him. He can modify the number by applying the following operation exactly once... |
user: Generate an executable Python 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 here
------ Problem Statement ------
Lira is a little girl form Bytenicut, a small 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.You are given an array A = [1, 2, 3, ..., n]:
How many sequences ($S_{1}$) can you get after exact k adjacent swaps on A?
How ... |
user: Generate an executable Python 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.
Dr.D is now fond of matrices.... |
user: Generate an executable Python 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. The task is to find subtree with maximum sum in the tree and return its sum.
Example 1:
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.Given a list of characters, merge all of them into a string.
Example 1:
Input:
N = 13
Char array = g e e k s f o r g e e k s
Output: 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 here
City of Byteland can be described as a $2D$ grid of cells. Each cell may or may not... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Maggu is the most brilliant student in his class .He has given some maths assignment by his maths teacher. But, today he has to go 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.It is well known that a set of six unit squares that are attached together in a “cross” can be folded into a cube.
But what about oth... |
user: Generate an executable Python 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 comprising of N non-zero, positive integers and an integer X, find the bitwise OR of all such elements in the array 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.Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Chef Watson uses a social network called ChefBook, 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.You are visiting a farm that has a single row of fruit trees arranged from left to right.The trees are represented by an integer array... |
user: Generate an executable Python 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 distinct integers. Sort the array into a wave-like array(In Place).
In other words, arrange the elements... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef has recently moved into an apartment. It takes 30 minutes for Chef to reach office from the apartment.
Chef left for the office... |
user: Generate an executable Python 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 has a combination lock 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.Given an array arr[] of N integers which may contain duplicate elements, the index of an element of this array is given to us, the tas... |
user: Generate an executable Python 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 has $N$ vases in a row (... |
user: Generate an executable Python 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 create a string with the first letter of every word in the string.
Example 1:
Input:
S = "geeks 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.Read problem statements in [Russian] and [Mandarin Chinese].
Given the time control of a chess match as a + b, determine which format... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In the computer world, a train of the length N can be represented as an array A of the same length.
Such an array A contains integer 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.Martian scientists explore Ganymede, one of Jupiter's numerous moons. Recently, they have found ruins of an ancient civilization. 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 Mandarin Chinese, Russian and Vietnamese as well.
Chef cooks nice receipes in the cafeteria of his compa... |
user: Generate an executable Python 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 and you have to tell whether the array is perfect or not. An array is said to be perfect if its reverse array... |
user: Generate an executable Python 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.
There are N+1 lights. Lights are placed at (0, 0), (1, 0), (2, 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.The mayor of your city has decided to throw a party to gather the favour of his people in different regions of the city.
There are 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.It is Friday the 13th today, and even though you're a modern well-educated person, you can't help feeling a bit nervous about it. 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.Find out the maximum sub-array of non negative numbers from an array.
The sub-array should be contiguous i.e., a sub-array created by ... |
user: Generate an executable Python 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 lunch break just started! Your mother gave you one litre of pink lemonade. You do not like pink lemonade and want blue lemonade 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.Tim likes Math. He likes it so much that he always brings his tablets with him and reads math e-books everywhere, even during parties.... |
user: Generate an executable Python 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 citizens of Fictitia have had enough! The city keeps getting bigger and bigger, and all the more boring. Fictitia consists of hori... |
user: Generate an executable Python 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 party, there are 4 dress codes i.e. one can either wear Red(R) or Blue(B) or Green(G) or Yellow(Y). Photographer needs the most 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.You are playing yet another game where you kill monsters using magic spells. There are $n$ cells in the row, numbered from $1$ to $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.Chef is making a dish that consists of exactly two ingredients. He has four ingredients A, B, C and D with tastiness a, b, c, and d 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.Pawan plays a famous computer game. A player is responsible for a whole country and he can travel there freely, complete quests and 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.Young ruler Mirko has declared himself king of dwarves. Upon hearing this, Slavko felt threatened and soon declared himself king of 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..union()
The .union() operator returns the union of a set and the set of elements in an iterable.
Sometimes, the | operator is used... |
user: Generate an executable Python 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 array arr[] of size n which contains only 1 and 0. Your task is to make the array perfect. An array is said to be per... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Nimbus, techfest of NIT Hamipur is going on and Team.exe (departmental team of CSE) is organizing an event called codeswap. Codeswap i... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Leha is playing a very interesting game. The game 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.A unicyclic graph is a graph with exactly one cycle. A spanning subgraph of a graph $G$ is a subgraph that has one component and inclu... |
user: Generate an executable Python 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 integers A[] and B[] of size N and M, the task is to check if a pair of values (one value from each array) exists ... |
user: Generate an executable Python 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 five integers $n$, $i$, $j$, $x$, and $y$. Find the number of bitonic permutations $B$, of the numbers $1$ to $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.Stanley and Megan decided to shop in the "Crossmarket" grocery store, which can be represented as a matrix with $n$ rows and $m$ colum... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Maria plays college basketball and wants to go pro. Each season she maintains a record of her play. She tabulates the number of time... |
user: Generate an executable Python 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 size N. The array contains integers and is of even length. The elements of the array represent N coin of v... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a natural number N, the task is to find the sum of the divisors of all the divisors of N.
Example 1:
Input:
N = 54
Output:
232
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 problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef is going on a road trip and needs... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a positive integer N. You have to find N^{th} natural number after removing all the numbers containing digit 9.
Example 1:
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.Amit works at a data recovery company. Every day he is sent broken-down laptops from which he has to recover the hard disk data.
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.In 1978 AD the great Sir Isaac Newton, whilst proving that $\mathcal{P}$ is a strict superset of $\mathcal{NP}$, defined the Beta Alph... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.