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.You are given two binary strings a and b of the same length. You can perform the following two operations on the string a:
* Swap 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.Chouti is working on a strange math problem.
There was a sequence of n positive integers x_1, x_2, …, x_n, where n is even. 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.You are given an integer x of n digits a_1, a_2, …, a_n, which make up its decimal notation in order from left to right.
Also, you 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.Many years ago Berland was a small country where only n people lived. Each person had some savings: the i-th one had a_i burles.
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 a bracket sequence s of length n, where n is even (divisible by two). The string s consists of n/2 opening brackets '(' ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.T is playing a game with his friend, HL.
There are n piles of stones, the i-th pile initially has a_i stones.
T and HL will take al... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A lighthouse keeper Peter commands an army of n battle lemmings. He ordered his army to stand in a line and numbered the lemmings 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've probably heard about the twelve labors of Heracles, but do you have any idea about the thirteenth? It is commonly assumed it 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.Farmer John has a farm that consists of n pastures connected by one-directional roads. Each road has a weight, representing the time 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.Farmer John is hosting a tennis tournament with his n cows. Each cow has a skill level si, and no two cows having the same skill level... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Thumbelina has had an accident. She has found herself on a little island in the middle of a swamp and wants to get to the shore very 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.Hamed has recently found a string t and suddenly became quite fond of it. He spent several days trying to find all occurrences of t 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.Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two 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.A remote island chain contains n islands, labeled 1 through n. Bidirectional bridges connect the islands to form a simple cycle — a br... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Fangy collects cookies. Once he decided to take a box and put cookies into it in some way. If we take a square k × k in size, divided ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Polycarp is a beginner programmer. He is studying how to use a command line.
Polycarp faced the following problem. There are n files ... |
user: Generate an executable Python 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's workday lasts exactly n minutes. He loves chocolate bars and can eat one bar in one minute. Today Polycarp has k bars at 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.Recently Luba learned about a special kind of numbers that she calls beautiful numbers. The number is called beautiful iff its binary ... |
user: Generate an executable Python 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 s of n non-negative integers.
A 5-tuple of integers (a, b, c, d, e) is said to be valid if it satisfies the fo... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A bracket sequence is a string containing only characters "(" and ")".
A regular bracket sequence is a bracket sequence that can be 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.Anshal and his friends love watching TV series together,but Anshal has a habit of giving spoilers.In order to tackle this his friends ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.After setting up the area and his toys. Chandu is up for playing his very first game. His first game is played on a N X N board with ... |
user: Generate an executable Python 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 Dipu is a small kid and like all the other kids, he likes to play, but he plays with numbers (He is extraordinary you know). 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.As of now you have registered for IndiaHacks 2016 which is about to begin and you want to go to the venue to participate and the map 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.View Russian Translation
Tom works in a public library in his town. Today, a completely new set of N books is arriving to the library... |
user: Generate an executable Python 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 Monk is an extremely miser person. He hates spending money on things, be it for his own good or bad. But this time his friends ... |
user: Generate an executable Python 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 has a wooden log (tree trunk) of length L units.
Since the log is too heavy for him to lift, he wants to cut it into pieces.
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.Tim likes Math. He likes it so much that he always brings his tablets with him and reads math e-books everywhere, even during parties.... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There are three airports A, B and C, and flights between each pair of airports in both directions.
A one-way flight between airports ... |
user: Generate an executable Python 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 university student, Takahashi, has to take N examinations and pass all of them. Currently, his readiness for the i-th examination 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.There are N islands lining up from west to east, connected by N-1 bridges.
The i-th bridge connects the i-th island from the west and... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an integer sequence of length N, a_1,a_2,...,a_N.
For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 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.<image>
There is a container that is bifurcated as shown in the figure. Drop 10 balls numbered from 1 to 10 through the opening A 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.The fact that any positive integer has a representation as the sum of at most four positive squares (i.e. squares of 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.Problem
There is a dial-type padlock. This Nanjing lock has five dials and an enter button.
Rotate the five dials to create a five-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.F: 最短距離を伸ばすえびちゃん (Ebi-chan Lengthens Shortest Paths)
Problem
Ebi-chan loves directed graphs. One day, a directed graph with N vertic... |
user: Generate an executable Python 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 obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar,... |
user: Generate an executable Python 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 programming languages like C/C++, a goto statement provides an unconditional jump from the "goto" to a labeled statement. For examp... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.How many ways are there to place a black and a white knight on an N * M chessboard such that they do not attack each other? The knight... |
user: Generate an executable Python 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 might know, cooking is the process of taking a food item and subjecting it to various processes(like heating, roasting, baking ... |
user: Generate an executable Python 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
Chef studies combinatorics. He tries to group objects by their rang (a positive integer associated with each object)... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Okay. Before we begin, a hint : This one's taken from somewhere. Word to word. Google comes to mind, doesn't it? Here goes:
For 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.Tuzik and his master Vanka are playing some unusual game. Initially there are two stacks of nuts. The first stack contains A nuts 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.There are n cities along the road, which can be represented as a straight line. The i-th city is situated at the distance of a_i kilom... |
user: Generate an executable Python 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 Petya loves looking for numbers' divisors. One day Petya came across the following problem:
You are given n queries in the 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.Vasya's birthday is approaching and Lena decided to sew a patterned handkerchief to him as a present. Lena chose digits from 0 to n 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.You are given a sequence of integers a_1, a_2, ..., a_n. You need to paint elements in colors, so that:
* If we consider any color... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.[Æsir - CHAOS](https://soundcloud.com/kivawu/aesir-chaos)
[Æsir - V.](https://soundcloud.com/kivawu/aesir-v)
"Everything has been 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.You are given an array a_1, a_2, ..., a_n. You can perform the following operation any number of times:
* Choose a pair of two neig... |
user: Generate an executable Python 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 play a game. The game consists of several sets, and each set consists of several rounds. Each round is won either by Ali... |
user: Generate an executable Python 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 matrix of size n × m is called nice, if all rows and columns of the matrix are palindromes. A sequence of integers (a_1, a_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.You are given four integers n, c_0, c_1 and h and a binary string s of length n.
A binary string is a string consisting of characters... |
user: Generate an executable Python 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 integers a_1, a_2, ..., a_n. Let us call an index j (2 ≤ j ≤ {{n-1}}) a hill if a_j > a_{{j+1}} and a_j ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Baby Badawy's first words were "AND 0 SUM BIG", so he decided to solve the following problem. Given two integers n and k, count the nu... |
user: Generate an executable Python 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, ..., a_n consisting of n distinct integers. Count the number of pairs of indices (i, j) such that 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.Petya and Vasya are brothers. Today is a special day for them as their parents left them home alone and commissioned them to do n chor... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Petya and Vasya are playing a game. Petya's got n non-transparent glasses, standing in a row. The glasses' positions are indexed with ... |
user: Generate an executable Python 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 king Copa often has been reported about the Codeforces site, which is rapidly getting more and more popular among the brightest 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.Berland amusement park shooting gallery is rightly acknowledged as one of the best in the world. Every day the country's best shooters... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev decided to build a house of 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.In this problem is used an extremely simplified version of HTML table markup. Please use the statement as a formal document and read 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.Two bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are different. ... |
user: Generate an executable Python 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 very long integers a, b (leading zeroes are allowed). You should check what number a or b is greater or determine 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.Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b 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.Arseniy is already grown-up and independent. His mother decided to leave him alone for m days and left on a vacation. She have prepare... |
user: Generate an executable Python 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 found a mysterious function f. The function takes two strings s1 and s2. These strings must consist only of lowercase English lett... |
user: Generate an executable Python 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 tree T consisting of n vertices. A number is written on each vertex; the number written on vertex i is ai. Let's denot... |
user: Generate an executable Python 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 incoming messages for Vasya. The i-th message is going to be received after ti minutes. Each message has a cost, which equ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Archith was a making noise in digital logic class.Sir was very frustrated by the behaviour of Archith. Sir asked archith to meet him 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.Chang loves solving mathematical puzzles. One day he was solving a puzzle. According to the problem statement of the puzzle: "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.The evil mastermind, Moriarty, strikes again! He sent Sherlock an image of a wall, with N integers painted on it. Sherlock is asked 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.Let there be a set of size N.
Power set of a set S, denoted by P(S) is the set of all subsets of S, including the empty set and the 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.Given a number N, find the sum of all products x*y such that N/x = y (Integer Division).
Since, the sum can be very large, please outp... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Hansa loves dancing and so do her friends. But she has some pretty weird friends. Like this one friend of hers, Jack, jumps forward wh... |
user: Generate an executable Python 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 integers a and b. Determine if a+b=15 or a\times b=15 or neither holds.
Note that a+b=15 and a\times b=15 do not ho... |
user: Generate an executable Python 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 white balls arranged in a row, numbered 1,2,..,N from left to right. AtCoDeer the deer is thinking of painting some of the... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.University A will hold a programming contest this year as well. As a member of the writing team, you will be responsible for creating ... |
user: Generate an executable Python 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
JOI decided to make a signboard for the store.
There are N old signboards with letters written at equal intervals. JOI makes... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ms. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine.
For example, to measure 200mg of 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.problem
AOR Ika-chan, who loves feasts, defined "the number of feasts". A feast number is a natural number that includes "$ 51-3 $" 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.Problem
Let $ f (x) $ be the sum of each digit when the non-negative integer $ x $ is expressed in binary.
Given a positive 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.Your task is to implement a double linked list.
Write a program which performs the following operations:
* insert x: insert an eleme... |
user: Generate an executable Python 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 task is to perform a simple table calculation.
Write a program which reads the number of rows r, columns c and a table of r × 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.WonderKing himself is a very genius in mathematics. One day when he was thinking, king got a wonderful idea – circular prime. A circul... |
user: Generate an executable Python 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 finally summer in Chefland! So our chef is looking forward to prepare some of the best "beat-the-heat" dishes to attract more cus... |
user: Generate an executable Python 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 Turbo C++ Users : Read the following document before attempting the question :
Problem Description
First question is easy to 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.In every contest there should be an easy problem about matrices. December Cook-Off is not an exception.
Given a matrix A which consist... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Some of the secret doors contain a very interesting word puzzle. The team of
archaeologists has to solve it to open that doors. Becau... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Lena is playing with matches. The natural question arising in the head of any child playing with matches is whether it's possible to 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.The only difference between easy and hard versions is the size of the input.
You are given a string s consisting of n characters, 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.Authors have come up with the string s consisting of n lowercase Latin letters.
You are given two permutations of its indices (not ne... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Consider a tunnel on a one-way road. During a particular day, n cars numbered from 1 to n entered and exited the tunnel exactly once. ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Bob watches TV every day. He always sets the volume of his TV to b. However, today he is angry to find out someone has changed the vol... |
user: Generate an executable Python 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 the following experiment. You have a deck of m cards, and exactly one card is a joker. n times, you do the following: shuffle... |
user: Generate an executable Python 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 bracketed sequence is called correct (regular) if by inserting "+" and "1" you can get a well-formed mathematical expression from 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.You are playing the game "Arranging The Sheep". The goal of this game is to make the sheep line up. The level in the game is described... |
user: Generate an executable Python 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 offered a job in a company developing a large social network. Your first task is connected with searching profiles 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.To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Once Bob took a paper stripe of n squares (the height of the stripe is 1 square). In each square he wrote an integer number, possibly ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.