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.Dexter and Mandark are playing a game. The game consists of N rounds. After each round, the winner (either Dexter or Mandark) will be ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are n lectures and m seminars to be conducted today at the Faculty of Approximate Sciences. The i-th lecture starts at a_i and 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.Now you get Baby Ehab's first words: "Given an integer $n$, find the longest subsequence of $[1,2, \ldots, n-1]$ whose product is $1$ ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A model show rates partakers according to their degree of fieriness. Two different model shows were organized, one for men 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.Comparison Sorting
Quicksort usually has a running time of $n\times log(n)$, but is there an algorithm that can sort even faster? 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.One day Mirko, while he was walking through the high grass, stumbled upon a sequence of $N$ colored marbles. Soon he noticed that if 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.You are given an array arr[ ] of integers having N elements and a non-weighted undirected graph having N nodes and M edges. The detail... |
user: Generate an executable Python 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. Reverse its characters.
Input
The only line of input contains a string between 1 and 100 characters long. 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.You have a permutation: an array $a = [a_1, a_2, \ldots, a_n]$ of distinct integers from $1$ to $n$. The length of the permutation $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 an array of integers and a number K. Find the count of distinct elements in every window of size K in the array.
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.At art shows, it is very common to have booths where children can create their very own sand art. This art is typically made by taking... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Jim enters a candy shop which has N different types of candies, each candy is of the same price. Jim has enough money to buy K candies... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given an array arr[] of size n>3, the task is to check whether the given array can be arranged in the form of a Left or Right position... |
user: Generate an executable Python 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 matrix with n rows and m columns. Your task is to find the length of the longest increasing path in matrix, here increasing pa... |
user: Generate an executable Python 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.
College admissions are starting and Ch... |
user: Generate an executable Python 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 numbers from 1 to N which comprise of digits only from set {1, 2, 3, 4, 5}.
Example 1:
Input:
N = 20
Outpu... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given N friends, each one can remain single or can be paired up with some other friend. Each friend can be paired only once. Find 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.Given a binary number $S$ containing only of 1's and 0's, find two binary numbers $A$ and $B$ such that the sum of the number of 1'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 Hindi,
Mandarin chinese
, Russian and Vietnamese as well. ------
Chef likes to play with cards a 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.Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
There are N chairs placed in circular order. Some 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.Chef is given 3 integers A, B, and C such that A < B < C.
Chef needs to find the value of max(A, B, C) - min(A, B, C).
Here max(A, B... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given a string str containing only lower case alphabets, the task is to sort it in lexicographically-descending order.
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.Given a string S of length N containing only numeric characters, find the number of Nice Pairs.
A Nice Pair is a pair of indices - (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.Barica is an unusual frog. She lives in a pond where $N$ plants float on the surface of the water. The plants are numbered $1$ through... |
user: Generate an executable Python 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 IPL time and as usual RCB are finding it tough to qualify for playoffs. RCB needs a minimum of $X$ more points to qualify for pl... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin Chinese and Russian.
Tanu has got interested in signs and gestures that we use for communicati... |
user: Generate an executable Python 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 teaching his students about properties of inte... |
user: Generate an executable Python 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 and a target key you need to find the level of target key in the given Binary Tree.
Note: The level of the root no... |
user: Generate an executable Python 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 an integer $N$ and 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.Kodi has been bought at the auction in the NIT Premier League. Kodi is a batsman and the runs he makes in each innings depends on 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 and Russian as well.
Mike likes strings. He is also interested in algorithms. A few day... |
user: Generate an executable Python 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, a_2, \dots, a_n$. You can perform operations on the array. In each operation you can choose an integer $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.
Recently Chef has decided to make some changes in our beloved Codechef. 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 a permutation$^\dagger$ $p$ of length $n$.
In one operation, you can choose two indices $1 \le i < j \le n$ and swap $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.In a candy store, there are N different types of candies available and the prices of all the N different types of candies are provided... |
user: Generate an executable Python 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 permutation of integers from 1 to N (very unusual :D). The only thing you should do is to process M queries. Each quer... |
user: Generate an executable Python 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 $S$, a set of integers, find the largest $d$ such that $a + b + c = d$ where $a, b, c$ and $d$ are distinct elements of $S$.
--... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Roy lives in a city that is circular in shape on a $2{D}$ plane that has radius ${r}$. The city center is located at origin $(0,0)$ 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 arr[ ] of size N consisting of only positive integers. Your task is to find the count of special numbers 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.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef and his friend Magda 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.Mirko and Slavko are playing a game. Mirko’s turn is first and he chooses a non-empty set of pairs of numbers between $1$ and $N$ (inc... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Airports are being built on a straight road according to a new construction plan. For convenience, imagine a number line on which at 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.Given $n$ strings, each of length $2$, consisting of lowercase Latin alphabet letters from 'a' to 'k', output the number of pairs of 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.You are given a date in "DD.MM.YYYY" ("day.month.year") format and a number of days shift you have to add to this date. Output the res... |
user: Generate an executable Python 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 and two integers say, x and y, find the number of sub-arrays in which the number of occurrences of x is equal to number... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given two strings X and Y, the task is to find the last index in X at which string Y appears, if Y does not appear then the answer 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.To address the situation of Water Scarcity in Chefland, Chef has started an awareness campaign to motivate people to use greywater for... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Hardutta is planning an inter college football league. He has invited n teams, including our own team from BPHC. Now, one of the organ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Sammy and Simmy love candies and frequently visit the local candy shop. Sammy and Simmy have bought $N$ candy packs. Packet $i$ contai... |
user: Generate an executable Python 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 non-negative integers representing the height of blocks. If width of each block is 1, compute how much water... |
user: Generate an executable Python 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 country of Byteland contains $N$ cities and $N-1$ bidirectional roads. There is a path between any two cities. The roads in Bytela... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.“Never forget what you are, the rest of the world will not. Wear it like armor and it can never be used to hurt you.”
-Tyrion Lannista... |
user: Generate an executable Python 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$. You have to construct a permutation of size $n$.
A permutation is an array where each integer from $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 two strings S1 and S2 . You have to concatenate both the strings and print the concatenated string.
Example 1:
Input:
S1 = "Gee... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.This year IFEST team thought of introducing a new game which is similar to the famous skipping stones game in Takeshi’s castle but 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.We define super digit of an integer $\boldsymbol{x}$ using the following rules:
Given an integer, we need to find the super digit 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 string S, Find all the possible subsequences of the String in lexicographically-sorted order.
Example 1:
Input : str = "abc"
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 the length of rectangle, width of rectangle, base of right angled triangle, perpendicular of right angled triangle and radius 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.Given a string A of length N consisting of lowercase English alphabet letters.
You are allowed to perform the following operation 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 have $r$ red and $b$ blue beans. You'd like to distribute them among several (maybe, one) packets in such a way that each packet:
... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given two positive integers x and y, and an array arr[] of positive integers. We need to find the longest prefix index which contains an equal number of x and y. Print the max... |
user: Generate an executable Python 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.
You are an administrator of a popular ... |
user: Generate an executable Python 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 to Russian translation of problem
You are given positive integer N. How many unordered pairs of integers from 1 to N are coprime... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Gladstone Gander is walking through Duckburg and needs to get to his date with Daisy Duck as soon as possible. If he doesn’t get there... |
user: Generate an executable Python 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 three positive integers $a$, $b$, $c$ ($a < b < c$). You have to find three positive integers $x$, $y$, $z$ such that:
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Pia is a famous bartender at the hip Stockholm night club Supernova. One of her most impressive feats is the mixing a series of drinks... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given an array A[] of size N. Find the number of pairs (i, j) such that
A_{i }XOR A_{j} = 0, and 1 ≤ i < j ≤ N.
Example 1:
ââ¬â¹Input : arr[ ] = {1, 3, 4, 1, 4}
Output : 2
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Johan lives in Stockholm, which means he has to travel a lot by bus and subway. To travel, he needs to pay a number of coupons, depend... |
user: Generate an executable Python 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 doubly linked list of n elements. The task is to reverse the doubly linked list.
Example 1:
Input:
LinkedList: 3 <--> 4 <--> 5... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Tanya has recently learned about Euler's totient function. So she started solving problems on it to clear her concepts.
But she got st... |
user: Generate an executable Python 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 call a number a binary decimal if it's a positive integer and all digits in its decimal notation are either $0$ or $1$. For 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.Welcome to Sevenkplus' perfect math class! In this class we will study an algebraic structure called magma.
A magma is a nonempty se... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ma5termind has decided to give integer ratings ( either positive or negative ) to his friends. He has N friends which are numbered fr... |
user: Generate an executable Python 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 elements that is first strictly increasing and then maybe strictly decreasing, find the maximum element 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 given two arrays A and B which are permutation of first n numbers.
You need to make both arrays magical.Two Arrays A and B ar... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Hossam woke up bored, so he decided to create an interesting array with his friend Hazem.
Now, they have an array $a$ of $n$ positive... |
user: Generate an executable Python 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 the base (in units) of a right-angled isoceles traingle, find the maximum number of 2X2 squares that can fit in the triangle wit... |
user: Generate an executable Python 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 of Nim with a friend. The rules are are follows:
1) Initially, there are N piles of stones. Two players play 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 is playing a videogame, and is getting close to the end. He decides to finish the rest of the game in a single session.
There ar... |
user: Generate an executable Python 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 check whether there is pair of adjacent set bit or not in the binary representation of number.
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.Given a singly linked list of N nodes.
The task is to find the middle of the linked list. For example, if the linked list is
1-> 2->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.You are given a permutation $p$ of length $n$, an array of $m$ distinct integers $a_1, a_2, \ldots, a_m$ ($1 \le a_i \le n$), and an 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.Greg Brandon Sr. is working at a shipping company in Redmond that specializes in shipping Chromium. Redmond contains $n$ intersections... |
user: Generate an executable Python 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 just been hired by Amalgamated, Inc. in the country of Acmania to oversee the transportation of raw materials to the company’... |
user: Generate an executable Python 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 distinct elements. Find the third largest element in it.
Suppose you have A[] = {1, 2, 3, 4, 5, 6, 7}, its output 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.Mastermind is a bright student of his class. To judge his intellegence and speed his teacher has given him a question and he needs 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.Demodogs from the Upside-down have attacked Hawkins again. El wants to reach Mike and also kill as many Demodogs in the way as possibl... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Madoka is going to enroll in "TSUNS PTU". But she stumbled upon a difficult task during the entrance computer science exam:
A number ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an integer, $N$. Your task is to print an alphabet rangoli of size $N$.
(Rangoli is a form of Indian folk art based on 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 and Russian.
Mike takes part in olympiads in informatics. You think he is a rookie? Wro... |
user: Generate an executable Python 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 crab is an undirected graph which has two kinds of vertices: 1 head, and K feet , and exactly K edges which join the head to each 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 are in charge of the cake for a child's birthday. You have decided the cake will have one candle for each year of their total age... |
user: Generate an executable Python 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 and a node data called target. Find the minimum time required to burn the complete binary tree if the target is se... |
user: Generate an executable Python 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 Ivica got himself a summer job at a company that produces computer fonts. The branch of the company where Ivica works at specia... |
user: Generate an executable Python 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.
The Petrozavodsk camp takes 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.Polycarp was recently given a set of $n$ (number $n$ — even) dominoes. Each domino contains two integers from $1$ to $n$.
Can he divi... |
user: Generate an executable Python 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 $s$ and $t$, both of length $n$. Each character in both string is 'a', 'b' or 'c'.
In one move, you can 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.The robot is placed in the top left corner of a grid, consisting of $n$ rows and $m$ columns, in a cell $(1, 1)$.
In one step, it can... |
user: Generate an executable Python 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$ positive integers. Determine if, by rearranging the elements, you can make the array strictly increa... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.During the Steam Summer Sale, Jim's $N-1$ friends have purchased $\mbox{M}$ games, which are numbered from $\mbox{1}$ to $\mbox{M}$. T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.