formatted_conversations stringlengths 1.13k 138k |
|---|
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a number X and two positions (from right side) in binary representation of X, write a program that swaps N bits at given two pos... |
user: Generate an executable Python 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 with N elements, the task is to find the count of factors of a number X which is product of all array elements.
Exam... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Linköping has a quite complex water transport system. Around Linköping there are several wells from which water is drawn. The water is... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Frustrated by his legendary inability to tear down Lund’s Cathedral, Finn the Giant wants to become better at destroying pillar-borne ... |
user: Generate an executable Python 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 square-shaped chart paper with the side length equal to N. He wants to cut out K \times K squares from this chart paper.
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kawashiro Nitori is a girl who loves competitive programming.
One day she found a string and an integer. As an advanced problem sette... |
user: Generate an executable Python 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 integers, find the length of the longest (strictly) increasing subsequence from the given array.
Example 1:
Input:
N... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Union of two arrays can be defined as the common and distinct elements in the two arrays.
Given two sorted arrays of size n and m resp... |
user: Generate an executable Python 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.Create a string using only lowercase characters from a to z that follows the given rules.
When N is even:
Use N/2 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.The task is to count all the possible paths from top left to bottom right of a m X n matrix with the constraints that from each cell 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.Given a number n, the task is to find all 1 to n bit numbers with no consecutive 1's in their binary representation.
Example 1:
Inp... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Recently, Karan gifted Ayush the latest Copytam Da's keyboard. He also gifted him an array of N distinct numbers.
The keyboard allows... |
user: Generate an executable Python 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 2 arrays W = (W_{1}, W_{2}, .., W_{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 World Chess Championship 2022 is about to start. 14 Classical games will be played between Chef and Carlsen in the championship, 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.The great Equestria Games are coming!
As you know, the Equestria Games is the biggest sports event in Equestria, where ponies from al... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Professor GukiZ has hobby — constructing different arrays. His best student, Nenad, gave him the following task that he just can't man... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Surya and his girl fiend went on a date during this weekend. There is a sequence of numbers from 1 to 1000000 on a table. Surya picked... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Tom is an upcoming senior undergraduate student planning for his courses for the final year. The final year will have two semesters, 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.Eulerian Path is a path in graph that visits every edge exactly once. Eulerian Circuit is an Eulerian Path which starts and ends on 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.Berland State University (BSU) is conducting a programming boot camp. The boot camp will last for n days, and the BSU lecturers are 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.Pritam is a priest in his village. He needs to pay his respects to k shrines which his all ancestors have visited and had asked their ... |
user: Generate an executable Python 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 woods of Lill-Jansskogen, there is a network of trails that are often used by joggers. The trails have been much appreciated, 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.There are $n$ variables and $m$ requirements. Requirements are represented as $\left(x\leq y\right)$, meaning that the $x^{th}$ variab... |
user: Generate an executable Python 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 an easier version of the problem fancy
Oskar really loves onions. Unfortunately, the onions he loves belong to 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.Chubby Trung and skinny Hanh are best friend. They are smart and lovely kids, and they are both very good at math and programming. 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.Bob’s green thumb has recently gotten him a job as a gardener at a local park. Along with caring for all the plants in the garden, he ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.GIven two different arrays A and B of size N and M, the task is to merge the two arrays which are unsorted into another array which is... |
user: Generate an executable Python 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 its factorial. return a list of integers denoting the digits that make up the factorial of N.
Example 1:
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.Read problems statements in [Russian].
Chef has an array A of size N. Chef wants to choose any subsequence of size exactly \lceil \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.Xenny is studying hard for exam and he came across a the trivial question "Match the pairs". The question is given two columns of numb... |
user: Generate an executable Python 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 pair of integers $(a, b)$ and an integer $x$.
You can change the pair in two different ways:
set (assign) $a := |a -... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a string, remove spaces from it.
Example 1:
Input:
S = "geeks for geeks"
Output: geeksforgeeks
Explanation: All the spaces hav... |
user: Generate an executable Python 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, the task is to print K smallest elements from the array but they must be in the same order as they are in a given arra... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In the game of Restricted Pacman, an infinite linear path is given. Pacman has to start at position 0 and eat as many candies as possi... |
user: Generate an executable Python 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 standing in a circle (numbered clockwise 1 to n) waiting to be executed. The counting begins at point 1 in the circ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Animesh and Mohit are playing a game. They have $N$ balls in front of them. All the balls are numbered, not necessarily in any order. ... |
user: Generate an executable Python 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, a tax of rupees 10 is deducted if the total income is strictly greater than rupees 100.
Given that total income is X ru... |
user: Generate an executable Python 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 give it a try! You have a linked list and you have to implement the functionalities push and pop of stack using this given linke... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Geek is learning a new programming language. As data type forms the most fundamental part of a language, Geek is learning them with 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.You have a grid with N rows and M columns. You have two types of tiles — one of dimensions 2 \times 2 and the other of dimensions 1 \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 integer N , Print all binary strings of size N which do not contain consecutive 1s.
A binary string is that string which cont... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Marina plays a new rogue-like game. In this game, there are n different character species and m different classes. The game is played ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.It's your birthday today, right? If it is, then we wish you Happy Birthday and good luck in the contest. But, even if it is not, you 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.Kuldeep and his girlfriend Cristie are both huge math nerds, so for their first anniversary he decides to take her out on a romantic 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.Given a [tree] containing N nodes.
Each node can be coloured using exactly one of the C colours. Find the number of colourings 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 Mandarin Chinese , Russian and Vietnamese as well.
Sergey has made N measurements. Now, he wants to know... |
user: Generate an executable Python 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 boss of ACM (Apples, Cherries, and Mangos), an upstanding company with a single goal of world domination.
ACM have provid... |
user: Generate an executable Python 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. Count the number of digits in N which evenly divides N.
Note :- Evenly divides means whether N is divisible by a dig... |
user: Generate an executable Python 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 airline company offers flights out of $n$ airports. The flight time between any given pair of airports is known, but may differ on ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string $s$, consisting only of characters '0' and '1'.
You have to choose a contiguous substring of $s$ and remove al... |
user: Generate an executable Python 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 p[] of length n used to denote the dimensions of a series of matrices such that dimension of i'th matrix is p[i] * p[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 here
Read problems statements in Russian here
------ Problem Statement ------
One da... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Each item in Chef’s menu is assigned a spice level from 1 to 10. Based on the spice level, the item is categorised as:
MILD: If the sp... |
user: Generate an executable Python 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 is a robot in the cell ... |
user: Generate an executable Python 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 of S as input. Your task is to write a program to remove or delete the minimum number of characters from the string so ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Geek has an array Arr, where Arr[i] (1-based indexing) denotes the number of chocolates corresponding to each station. When he moves from station i to station i+1 he gets 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.Read problems statements in Mandarin Chinese and Russian.
Chef is on a vacation these days, so his friend Chefza is trying to solve... |
user: Generate an executable Python 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 Chinese], [Russian], and [Vietnamese] as well.
Codechef challenges have three divisions. 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.You are given two integer numbers, $n$ and $x$. You may perform several operations with the integer $x$.
Each operation you perform 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.Your friend Edvin loves languages. A personal favourite of his is speaking the Robber Language. For those of you not familiar with it,... |
user: Generate an executable Python 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$ points $1,2,\ldots,n$, each point $i$ has a number $a_i$ on it. You're playing a game on them. Initially, you are at poi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Limak is a brown bear, experienced in organizing programming contests.
Today, his only responsibility is to watch the leaderboard 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.An integer array $a_1, a_2, \ldots, a_n$ is being transformed into an array of lowercase English letters using the following prodecure... |
user: Generate an executable Python 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 positive integers of size N, form groups of two or three such that the sum of all elements in a group is a multiple ... |
user: Generate an executable Python 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 integers and another number. Find all the unique quadruple from the given array that sums up to the given number.
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.You are given an undirected graph consisting of $n$ vertices and $n$ edges, where $n$ is divisible by $6$. Each edge has a weight, 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.Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
Chef is baking a large cake! The cake consists of $N$ ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given four numbers X, Y, Z and N. Find smallest N digit Number that is divisible by all the three numbers X, Y and Z.
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.Given an array A[] of size N. The value of an array is denoted by the bit-wise XOR of all elements it contains. Find the bit-wise XOR ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Simon is a contestant on the new exciting game show, Add ’Em Up! In this show, contestants are given a set of cards with multi-digit 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.Holidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't wan... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In the kingdom of Winterfield, there are several cities and each pair of cities is connected by exactly one old dirt road. The king 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.Alice is playing Air Hockey with Bob. The first person to earn seven points wins the match. Currently, Alice's score is A and Bob's sc... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Pubnite is an epic battle royale game featuring unique gameplay mechanics such as dancing! Every player enjoys dancing in the middle 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.Given an n-digit large number in form of string, check whether it is divisible by 7 or not. Print 1 if divisible by 7, otherwise 0.
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.You are playing the following simple game with a friend:
- The first player picks a positive integer $X$.
- The second player gives ... |
user: Generate an executable Python 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], [Vietnamese], and [Bengali] as well.
Dr. Chef is treating COVID-19 patients.... |
user: Generate an executable Python 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, your task is to complete the function which generates all n-bit grey code sequences, a grey code sequence is a seque... |
user: Generate an executable Python 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 a Mathematician was trapped by military people during a world war with his forty colleagues. The colleagues were without any weap... |
user: Generate an executable Python 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 a very long time, the Chef has a vacation. Chef has planned for two trips during this vacation - one with his family and the 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.Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Zanka finds fun in everyday simple thi... |
user: Generate an executable Python 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 pangram is a string that contains every letter of the alphabet. Given a sentence determine whether it is a pangram in the English 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.When reading programming problems, one can often get some hints regarding the topic of the problem by skimming the problem statement 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.There is a street with $n$ houses in a line, numbered from $1$ to $n$. The house $i$ is initially painted in color $c_i$. The street 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.There are $n$ students numerated from $1$ to $n$. The level of the $i$-th student is $a_i$. You need to split the students into stable... |
user: Generate an executable Python 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.
Given integers $N$ and $M$, find the 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.You have a tree of $n$ vertices. You are going to convert this tree into $n$ rubber bands on infinitely large plane. Conversion rule 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.The sequence $a$ is sent over the network as follows:
sequence $a$ is split into segments (each element of the sequence belongs to 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.You will be given two positive numbers M and N. Your task is to print the greatest common divisor of Fib(M) and Fib(N) where Fib(x) me... |
user: Generate an executable Python 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 valid email address meets the following criteria:
It's composed of a username, domain name, and extension assembled in this forma... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Problem Statement
It is 2042 and we are surrounded by cyborgs everywhere. Geneo is one such cyborg with a human body and an electronic... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a sorted array containing only 0s and 1s, find the transition point.
Example 1:
Input:
N = 5
arr[] = {0,0,0,1,1}
Output: 3
Explanation: index 3 is the transition
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.A post on facebook is said to be more *popular* if the number of likes on the post is strictly greater than the number of likes on som... |
user: Generate an executable Python 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. Find whether a number is a semiprime or not.
Note: A semiprime is a natural number that is a product of t... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.JJ has three integers A, B, and N. He can apply the following operation on A:
Select an integer X such that 1 ≤ X < N and set A := A ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin Chinese and Russian.
N one dimensional kingdoms are represented as intervals of the form [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.Consider a list (list = []). You can perform the following commands:
insert i e: Insert integer $\boldsymbol{\mathrm{~e~}}$ at pos... |
user: Generate an executable Python 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 tree with $N$ node... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef's exam is near. There is a total of M subjects in his syllabus. Each subject consists of several topics. However, the questions 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.Nastia has $2$ positive integers $A$ and $B$. She defines that:
The integer is good if it is divisible by $A \cdot B$;
Otherwise, th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.