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 (as string) and two integers a and b, divide the string in two non-empty parts such that the first part is divisible by... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Ishaan wants to intern at GeeksForGeeks but for that he has to go through a test. There are n candidates applying for the internship including Ishaan and only one is to be sel... |
user: Generate an executable Python 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 you are a car driver and you have to drive a car on a track divided into "N" number of sub-tracks. You are also given the valu... |
user: Generate an executable Python 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 was a very long wall outside a kingdom. There were many gates in the wall. Each gate is labelled with any alphabet characters 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.Businessman Divan loves chocolate! Today he came to a store to buy some chocolate. Like all businessmen, Divan knows the value of mone... |
user: Generate an executable Python 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 smallest different sequence (SDS) is a sequence of positive integers created as follows: $A_1=r \geq 1$. For $n>1$, $A_ n=A_{n-1}+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.As you know, a kayaking competition is going on as we speak. Unfortunately strong winds have damaged a few kayaks, and the race starts... |
user: Generate an executable Python 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 you are given two integers, $m$ and $n$. You are also given a list of $n$ distinct integers $x_1, x_2, \ldots , x_ n$, with $0... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The Antique Comedians of Malidinesia prefer comedies to tragedies. Unfortunately, most of the
ancient plays are tragedies. Therefore 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.The Nordic Company of Passing Carriages is losing money at an alarming rate because most of their trains are empty. However, on some l... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an array A of length N.
A pair (i, j) (1≤ i< j ≤ N) is said to be *good* if gcd(A_{i}, A_{j}) = lcm(A_{i}, A_{j}). 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.Problem Statement
Any 2 dimensional space can be tiled (covered using tiles) using a fractal pattern called Rauzy Fractal. This is a v... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Chef and his little brother are playing with sticks. T... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.------Read problems statements in Hindi,
Mandarin chinese
, Russian and Vietnamese as well. ------
At ShareChat, there are are plent... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alice and Bob have invented a new game. They have a rooted tree having N nodes (rooted at node 1), and the i^{th} node has the value 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 problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given a strictly increasing 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.You are given a binary string S of length N. Your task is to check if there exists a [substring] of S which is the binary representati... |
user: Generate an executable Python 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 wants to split a team of new chef into two teams to play a game. In 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 and Russian as well.
Captain Dehatti from Bawanian village is making strategy to win 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.Given two integers N and K, the task is to count the number of ways to divide N into groups of positive integers. Such that each group... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Samwell laid out N bowls in a straight line and put a few marbles randomly in each bowl, i^{th} bowl has A[i] marbles. A bowl can neve... |
user: Generate an executable Python 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 at a Code Expo where many coders are present 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.In C++ division with positive integers always rounds down. Because of this, sometimes when two integers are divided by the same diviso... |
user: Generate an executable Python 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.
The Baratheons have been ruling in the Seven Kingdoms for many years. They... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.JJ found a balanced parenthesis sequence. He does not like balanced parentheses so he will make the parenthesis sequence unbalanced by... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alice and Bob are playing the game of Nim with $n$ piles of stones with sizes $p_0,p_1,\ldots,p_{n-1}$. If Alice plays first, she lose... |
user: Generate an executable Python 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.
There are two types of vaccines availa... |
user: Generate an executable Python 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 Berland initially has N isolated cities, the i-th city has a significance of A_{i}. The President of Berland wants to 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 [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.
In Chefland, each person has... |
user: Generate an executable Python 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 two problems in a contest.
Problem A is worth 500 points at the start of the contest.
Problem B is worth 1000 points at the ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.One day Jay, on getting his first salary, decides to distribute apples among the poverty-stricken persons. He gave each person 1kg of apples. People are coming in a queue 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.Watson asks Sherlock:
Given a string S of N 0's and M 1's, how many unique permutations of this string start with 1?
Help Sherlo... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Sort the given Linked List using quicksort. which takes O(n^2) time in worst case and O(nLogn) in average and best cases, otherwise you may get TLE.
Input:
In this problem, 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.Given a weighted, directed and connected graph of V vertices and E edges, Find the shortest distance of all the vertex's from the sour... |
user: Generate an executable Python 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=[a_1,a_2,\dots,a_n]$ of $n$ positive integers, you can do operations of two types on it:
Add $1$ to every element 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.MoEngage helps the Chef send email reminders about rated contests to the participants.
There are a total of N participants on Chef’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.Consider two non-negative long integers, $a$ and $\boldsymbol{b}$, where $a\leq b$. The bitwise AND of all long integers in the inclus... |
user: Generate an executable Python 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.
Andy and Bob are the only two delivery men of Pizza-chef store. Today, 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.Ravanan was the protagonist of Ramayanan.Agreed! But he was also the brightest man of that era. One of his special ingenuities was tha... |
user: Generate an executable Python 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 set of frogs have accidentally fallen to the bottom of a large pit. Their only means of escaping the pit is to jump out of it. Each ... |
user: Generate an executable Python 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.
Chef is making $N$ atomic sou... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.It is 1815 and the politicians in Lund have just decided to build a tram line in Lund. Oh, sorry. That was wrong, let’s start over. 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.Mark is asked to take a group photo of $2n$ people. The $i$-th person has height $h_i$ units.
To do so, he ordered these people into ... |
user: Generate an executable Python 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 3 numbers A, B and C.
Chef wonders if it is possible to choose *exactly* two numbers out of the three numbers such that 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.
Chef had a hard day and want to play little bit. The game is called "Chai... |
user: Generate an executable Python 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], [Bengali], [Russian], and [Vietnamese] as well.
You are given an integer N. Consider the 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.The chef has a recipe he wishes to use for his guests,
but the recipe will make far more food than he can serve to the guests.
The che... |
user: Generate an executable Python 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 sequence of N integer numbers A. Calculate the sum of A_{i} AND A_{j} for all the pairs (i, j) where i < j.
The AND 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 coordinates of 2 points on a cartesian plane, find the distance between them rounded up to nearest integer.
Example 1:
Input: 0... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an array nums of size n and q queries. Now for each query of the form l, r and k, output the kth smallest number in sub-... |
user: Generate an executable Python 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 string is called a palindrome if it may be read the same way in either direction. For example, “12321” is a palindrome, but “12341” ... |
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 a number N. You need to print the pattern for the given value of N.
For N = 2 the pattern will be
2 2 1 1
2 1
For N = 3 the pattern will be
3 3 3 2 2 2 1 1 1
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.-----Input-----
The first line of input consists of two integers $N$ and $Q$, where $1 \le N \le 1000000$ is the number of elements 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.Given a sequence of matrices, find the most efficient way to multiply these matrices together. The efficient way is the one that invol... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chessboard is a board of n × n squares arranged in two alternating colors (black and white). Top left square is white. You are given 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.Chef considers a string consisting of lowercase English alphabets *beautiful* if all the characters of the string are vowels.
Chef 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.Little Stuart is a smart guy, and he loves mathematics. Today his math teacher taught his class about common factors. After finishing... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Yraglac is running a daycare service for dogs. He has $N$ dogs and he would like to take them on a walk. However, before he can walk 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 array of integers, arr[] and a number, K.You can pair two numbers of the array if the difference between them is strictly les... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Although we imagine interplanetary probes to be very sophisticated pieces of technology, their information systems are quite archaic. ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.GIven two positive integers N and K. You have to find the Kth smallest factor of N. A factor of N is a positive integer which divides ... |
user: Generate an executable Python 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 T (an undirected connected graph containing no cycles) of N nodes rooted at node number 1. Each node is painted either... |
user: Generate an executable Python 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 an array $a$ of length $n$ with elements numbered from $1$ to $n$. It is possible to remove the $i$-th element of $a$ if $gcd... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Archeologists recently found the remains of Greco-Roman architecture. The location can be modeled as a grid of $R \cdot C$ square cell... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Design a data-structure SpecialStack that supports all the stack operations like push(), pop(), isEmpty(), isFull() and an additional operation getMin() which should return mi... |
user: Generate an executable Python 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 and two integers l and r, the task is to sort the given array in non - decreasing order in the index rang... |
user: Generate an executable Python 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$, which is sorted in non-descending order. You decided to perform the following steps 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.An English text needs to be encrypted using the following encryption scheme.
First, the spaces are removed from the text. Let $L$ 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.Link to Russian translation of problem
The statement of this problem is very simple: you are given a non-negative integer X. Whether ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Michael works in a bakery. At the end of his shift, his boss wants the breads sorted in a certain order. She can’t seem to decide on 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 campus is abuzz with synapse fever and the synapse committee is planning a new game this year.The rules are simple enough and 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.Our new contest submission system keeps a chronological log of all submissions made by each team during the contest. With each entry, ... |
user: Generate an executable Python 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 is the easy version of the problem. The only difference is that in this version $q = 1$.
You are given an array of integers $a_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.There is a strange game played in ChefLand.
The game starts with N white balls, the i-th of which has a power of S_{i}. It is known ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Adrian, Bruno and Goran wanted to join the bird lovers’ club. However, they did not know that all applicants must pass an entrance exa... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kamar-taj is a place where "The Ancient One" trains people to protect earth from other dimensions.
The earth is protected by N sanctum... |
user: Generate an executable Python 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 cricket match is going to be held. The field is represented by a 1D plane. A cricketer, Mr. X has $N$ favorite shots. Each shot has ... |
user: Generate an executable Python 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 middle earth is in danger as Sauron has prepared an army of Orcs to destroy the men. To kill Sauron and save the world we need 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.Sliding Blocks is an interesting puzzle game which can be played on most mobile devices. In this game, you are given an $N \times M$ 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 Binary Tree of size N, extract all its leaf nodes to form a Doubly Link List starting from the left most leaf. Modify the orig... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ranjeet has recently learned how to calculate power of base x to y . Now people being jealous of him all sat together and framed a tou... |
user: Generate an executable Python 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 at home and about to drive to work. The road you will take is a straight line with no speed limit. There are, however, traffic... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Amazin’ Inc, an up-and-coming company in e-commerce, has recently optimized its operations to make the most out of its workers. Thanks... |
user: Generate an executable Python 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 of length 2\cdot N.
A partition of string S into strings P and Q is said to be *valid* if:
Both P 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.Alice and Bob are meeting after a long time. As usual they love to play some math games. This times Alice takes the call and decides 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.One day you and GTmac walk into a classroom and see a mysterious expression on the blackboard:\[ (1^b + 2^b + \cdots + a^b)~ \mathrm{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 integer numbers, the base a and the index b. You have to find the last digit of a^{b}.
Example 1:
Input:
a = "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 an array A of length 2\cdot N.
You also have an empty array B. You are asked to do the following operation exactly N ti... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Check Tutorial tab to know how to to solve.
The included code stub will read an integer, $n$, from STDIN.
Without using any 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.Talia has just bought an abandoned house in the outskirt of Jakarta. The house has a nice and long yard which can be represented as 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.It is a nice winter Sunday morning and AltF4, our hero, decides to play a new video game. The game is called Appearism. There are a 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.This problem is a reverse case of the problem “Help Me With The Game”. You are given the output from that problem, and your task is to... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alice is playing a game with permutations of size N.
She selects a random *permutation* P of size N and a random index i (1≤ i ≤ 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 MEX (minimum excluded) of an array is the smallest non-negative integer that does not belong to the array. For instance:
The MEX ... |
user: Generate an executable Python 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 benevolent ruler of Rankhacker Castle, and today you're distributing bread. Your subjects are in a line, and some of them... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given $n$ distinct points on a plane. The coordinates of the $i$-th point are $(x_i, y_i)$.
For each point $i$, find the near... |
user: Generate an executable Python 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.
You are given a multiset of N integers. Please find such a nonempty subse... |
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 integers. Find three numbers such that sum of two elements equals the third element and return the triplet in a container result, if no such triplet is fou... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Jealous of Mirko’s position as head of the village, Borko stormed into his tent and tried to demonstrate Mirko’s incompetence for lead... |
user: Generate an executable Python 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 organizing a party at his house. For the party, he needs exactly N donuts for the guests. Geek decides to order the donuts fro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.