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.Your parents decided that it would be “fun” to spend the entire Sunday walking near the Mookerheide close to Nijmegen.
Although you 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.Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a string s with length n. You should fin... |
user: Generate an executable Python 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 recorded a video explaining his favorite recipe. However, the size of the video is too large to upload on the internet. He wants ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Russian] and [Mandarin Chinese].
You are given two integers A, B. You have to choose an integer X 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.CodeChef admins went on shopping at a shopping mall.
There are N shops in the mall where the i^{th} shop has a capacity of A_{i} peo... |
user: Generate an executable Python 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 two integers A and B (A ≤ B).
Chef can choose any non-negative integer X and add them to both A and B. Find whether it is p... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The ugliness of a sequence of size N is defined as the number of pairs of neighboring elements which are not equal to each other. Form... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Every day Kotlin heroes analyze the statistics of their website. For n days, they wrote out n numbers a_1, a_2, ..., a_n, where a_i 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.Biologists have discovered a strange DNA molecule, best described as a sequence of $N$ characters from the set $\{ A, B\} $. An unlike... |
user: Generate an executable Python 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 Head Chef has opened N new restaurants across the city. But he is exhausted since he has to travel so much when he has to go from ... |
user: Generate an executable Python 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 been hired by Addictive Coin Machines to help design the next hit in their line of eye-catching, coin-guzzling, just-one-more... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a grid with $n$ rows and $m$ columns, where each cell has a positive integer written on it. Let's call a grid good, if i... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements [Mandarin] , [Bengali] , [Hindi] , [Russian] and [Vietnamese] as well.
Arya has a chessboard with $N$ rows (... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Everybody in MIT knows Krishna Sundar is a cool, young and energetic DP programmer, whereas Vaidyanathan Pk is a young and romantic pr... |
user: Generate an executable Python 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 love array, don't you?
You are given two integer N and M, along with an array B of length N containing pairwise distinct integers... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Cesar and Raul like betting and good food, in no particular order. They want to try out a new fancy restaurant and they decided to mak... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ema built a quantum computer! Help her test its capabilities by solving the problem below.
Given a grid of size $n\times m$, each cel... |
user: Generate an executable Python 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 found $n$ segments on the street. A segment with the index $i$ is described by two integers $l_i$ and $r_i$ — coordinates 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.You might have heard about the friendly interactive shell - fish. It’s terminal based, but a bit friendlier to new users who can’t rem... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are a game designer and want to make an obstacle course. The player will walk from left to right. You have $n$ heights of mountain... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Babidi has summoned Majin Vegeta. He orders him to kill Supreme Kai. But Vegeta wants to get out of his control.
Babidi has laid out ... |
user: Generate an executable Python 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 NumPy (Numeric Python) package helps us manipulate large arrays and matrices of numeric data.
To use the NumPy module, we need 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.You have been given an integer array A of size N. You must report the number of ordered pairs (i,j) such that A[i] & A[j] is zero.
Her... |
user: Generate an executable Python 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 discovered that his secret recipe has been stolen. He immediately informs the police of the theft.
It is known that the policema... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mirko received an $N \times N$ table for his birthday, where a non-negative integer is written in each field of the table. Unfortunate... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.DNA is a nucleic acid present in the bodies of living things. Each piece of DNA contains a number of genes, some of which are benefici... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Shivani likes digits very much. She thinks some digits are lucky digits. She also calls numbers consisting ALL the lucky digits at lea... |
user: Generate an executable Python 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.
In one operation, you can pick an index i (1≤ i < |S|) and swap the characters S_{i} and S_{(i+1)}.... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a positive integer $x$. Check whether the number $x$ is representable as the sum of the cubes of two positive integers.
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Once upon a time, there was a hero and an old saint. And like in any story with a hero and an old saint, the old saint asked the hero ... |
user: Generate an executable Python 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 building an old-school back-to-basics computer game. It’s a very simple text based adventure game where you walk around and try ... |
user: Generate an executable Python 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 loves bitwise operations. So, he creates the following problem but needs your help to solve it.
Chef calls a sequence of integer... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Given a binary string $S$ consisting 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.In all schools in Buryatia, in the $1$ class, everyone is told the theory of Fibonacci strings.
"A block is a subsegment of a string ... |
user: Generate an executable Python 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 doctor prescribed Chef to take a multivitamin tablet 3 times a day for the next X days.
Chef already has Y multivitamin tablets.... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Russian] and [Mandarin Chinese].
Chef goes to a candy store that sells N different candies. For each cand... |
user: Generate an executable Python 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 $N$ followed by $N$ email addresses. Your task is to print a list containing only valid email addresses in le... |
user: Generate an executable Python 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 sequence A=(A_{1}, A_{2},\dots, A_{N}) of length N and an integer M such that 0 ≤ M < \sum\limits_{i=1}^N A_{... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef has fallen in love with Cheffina, and wants to buy N gifts for her. On reaching the gift shop, Chef got to know the following two... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kim likes building Lego pyramids and now wants to build one of height $H$. How many more bricks are needed if Kim already has $N$ bric... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.There is a villa which has N rooms placed one after the other , numbered from 1 to N. There are two types of rooms - normal rooms and exit rooms.
The rooms are connected by K... |
user: Generate an executable Python 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 the sum of all prime numbers between 1 and N(inclusive).
Example 1:
Input: N = 5
Output: 10
Explana... |
user: Generate an executable Python 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$ cars (numbered ... |
user: Generate an executable Python 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.
"All the pain in the world will not 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.Tanya likes cartoons. She knows that n new cartoons will be released in his favorite cinema: the i-th of them will be airing from the ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given the chessboard dimensions. Find out the number of ways we can place a black and a white Knight on this chessboard such that they cannot attack each other.
Note:
The knig... |
user: Generate an executable Python 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 [Hindi] , [Vietnamese] , [Mandarin Chinese] , [Russian] and [Bengali] as well.
We have a rectangular piece 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 a Directed Graph with V vertices (Numbered from 0 to V-1) and E edges, check whether it contains any cycle or not.
Example 1:
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.You are given an integer $N$. Consider set $S=\{0,\:1,\ldots,\:2^N-1\}$. How many subsets $A\subset S$ with $\bigoplus_{x\in A}x=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.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef recently visited ShareCh... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chotu being over confident about his programming skills is challenging everyone that he can solve any problem. Seeing chotu's over 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.You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of ope... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Arun has an integer N. His friend likes the number 1, so Arun wants to reduce N to 1.
To do so, he can perform the following move sev... |
user: Generate an executable Python 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 has given you an array A consisting of N positive integers.
You should perform Q queries of the following two types:
1 i X ... |
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 arr[] of n numbers. The task is to print only those numbers whose digits are from set {1,2,3}.
Example 1:
Input:
n = 3
arr[] = {4,6,7}
Output: -1
Explanation: N... |
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 arr of size N and an integer K. The task is to find the pair of integers in the array such that their sum is maximum but less than K.
Note:Out of every possible... |
user: Generate an executable Python 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
You are given a binary string... |
user: Generate an executable Python 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 can make a lot by playing such games.”*
Every player has to play a game of Ddakji with the recruiter in order to enter the squi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Priya loves bitwise AND, but she hates programming. Help her solve this problem.
Given an array $A$ of size $N$, let $B_{ij}$ denote... |
user: Generate an executable Python 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$ consisting of $n$ integers. You want to distribute these $n$ integers into two groups $s_1$ and $s_2$ (grou... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Three infinite lines define a triangle, unless they meet at a common point or some of them are parallel.
Given a collection of infini... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.For an array A of N integers, define
* An array P of length N, where P_{i} is the number of distinct elements in the subarray A[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.There are initially X people in a room.
You are given an array A of length N which describes the following events:
If A_{i} ≥ 0, the... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a string consisting of some numbers, not separated by any separator. The numbers are positive integers and the sequence increases by one at each number except the missin... |
user: Generate an executable Python 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: How can it be?
Rabbit: Trust me Alice. It always takes the same time. When I go from my home up the road to Queen of Hearts’ ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A binary string is called *alternating* if no two adjacent characters of the string are equal. Formally, a binary string T of length 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.You are given two strings A and B of length N consisting of lowercase English letters. Your objective is to make both the strings equa... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Suppose we have an n-dimensional supercomputer with an infinite number of processors. Every processor has a vector of $n$ integers as ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In ordinary chess, the pieces are only of two colors, black and white. In our version of chess, we are including new pieces with uniqu... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Rhymes are complicated. The extent to which one word rhymes with another depends on how similar they sound; but if they are too simila... |
user: Generate an executable Python 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.
In a rooted tree, the (or LCA for short) of two vertices u and v is defined as the lo... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kundu is true tree lover. Tree is a connected graph having N vertices and N-1 edges. Today when he got a tree, he colored each edge 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.Trouble has come to the remote group of islands known as Insumulia. Due to an unfortunate combination of over-consumption, natural cli... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.King Richard is leading a troop of $N^2$ knights into battle! Being very organized, he labels his knights $K_0,K_1,\ldots,K_{N^2-1}$ a... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Sherlock is stuck while solving a problem: Given an array $A=\{a_1,a_2,\cdots,a_N\}$, he wants to know if there exists a subset $\mbox... |
user: Generate an executable Python 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 playing a variant of Blackjack, where 3 numbers are drawn and each number lies between 1 and 10 (with both 1 and 10 inclusive)... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Summer in Texas can be very hot. But Texans are tough, and in a weird way some of them enjoy the heat; for even the heat is bigger 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.Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Chef and his friend John have not see each other for 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.Barry Allen and Jay Garrick are arch-rivals. To prove himself superior than Barry, Jay takes Barry to a Lighthouse, consisting 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.Your fancy debugger will not help you in this matter. There are many ways in which code can produce different behavior between debug 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.A new town is being built far out in the country, and currently there are $N$ houses. People have already started moving in. However, ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef has a sequence of N integers A = [A_{1}, A_{2},\dots,A_{N}]. He can perform the following operation any number of times (possibly... |
user: Generate an executable Python 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 playing badminton today. The service rules of this singles game of badminton are as follows:
1. The player who starts the game... |
user: Generate an executable Python 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$ integers. Count the number of pairs of indices $(i, j)$ such that $i < j$ and $a_j - a_i = j - i$.
... |
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 integer N. You need to convert all zeroes of N to 5.
Example 1:
Input:
N = 1004
Output: 1554
Explanation: There are two zeroes in 1004
on replacing all zeroe... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Monocarp has been collecting rare magazines for quite a while, and now he has decided to sell them. He distributed the magazines betwe... |
user: Generate an executable Python 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 [Bengali] as well.
A programming competition will be held in Chef's ci... |
user: Generate an executable Python 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 soon to graduate from the mathemagician school of Hagworts, and you’re quite content with yourself; all the hard work and elbo... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Find the minimum number with the given sum of digits $s$ such that all digits in it are distinct (i.e. all digits are unique).
For 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.Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a binary tree with $N$ vertices numbered... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a postfix expression. Your task is to complete the method constructTree(). The output of the program will print the infix expression of the given postfix expression.
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.Given a value V and array coins[] of size M, the task is to make the change for V cents, given that you have an infinite supply of eac... |
user: Generate an executable Python 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 need to hire some people to paint a fence. The fence is composed of $10000$ contiguous sections, numbered from $1$ to $10000$.
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.For the grand opening of the algorithmic games in NlogNsglow, a row of tower blocks is set to be demolished in a grand demonstration o... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
Chef is so good at programming that he won almost all ... |
user: Generate an executable Python 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 a stack which supports two types of operations:
* Push a given number on the stack.
* Pop two numbers ... |
user: Generate an executable Python 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 has a standard deck of 52 cards. She wants to play a card game with K-1 of her friends. This particular game requires each perso... |
user: Generate an executable Python 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 permutation $A = (a_1, a_2, \dots , a_ N)$ of the integers $1, 2, \dots , N$, we define the greedily increasing subsequence (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.Polycarp recently signed up to a new social network Berstagram. He immediately published n posts there. He assigned numbers from 1 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.A tea manufacturer decided to conduct a massive tea tasting. $n$ sorts of tea will be tasted by $n$ tasters. Both the sorts of tea and... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.