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.Monk and his P-1 friends recently joined a college. He finds that N students have already applied for different courses before him. 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.Have you ever been a part of the exciting game Passing the Parcel ? Sid is on a school picnic with his classmates. The teacher decides... |
user: Generate an executable Python 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 and m queries. For each query delete the K-th occurence of a character x.
Input:
The first line contains the 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.Takahashi loves the number 7 and multiples of K.
Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (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 have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.
You can mak... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road... |
user: Generate an executable Python 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 have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from 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.Mr.X, who the handle name is T, looked at the list which written N handle names, S_1, S_2, ..., S_N.
But he couldn't see some parts 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.In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Create a program that inputs the test result data of the visual acuity test and outputs the number of people who apply to each judgmen... |
user: Generate an executable Python 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 known that each weight of 1 gram, 3 gram, 9 gram, and 27 gram can be weighed from 1 gram to 40 gram in 1 gram increments using 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
A city in Canada where JOI lives is divided into a grid pattern by w roads that extend straight in the north-south direction ... |
user: Generate an executable Python 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 computer is a little old-fashioned. Its CPU is slow, its memory is not enough, and its hard drive is near to running out of space... |
user: Generate an executable Python 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
Nathan O. Davis is a student at the department of integrated systems.
Today's agenda in the class is audio signal ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In the building of Jewelry Art Gallery (JAG), there is a long corridor in the east-west direction. There is a window on the north side... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Write a program which calculates the area and perimeter of a given rectangle.
Constraints
* 1 ≤ a, b ≤ 100
Input
The length a 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.A regular octagon with vertices X1, X2,..., X8 is provided. A frog starts jumping from the vertex X1. It may jump to any of the two ad... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In the University College of JNTUK Vizianagaram external lab examinations were being conducted. Management has decided to strictly pro... |
user: Generate an executable Python 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 description
Nineteen years after the conclusion of events of Harry Potter and the Deathly Hallows, Harry Potter is now a Minis... |
user: Generate an executable Python 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.Let's define a good tree:
It is a tree with k * n nodes labeled from 0 to k * n - 1
Node i and node j are not adjacent, for all 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 Fair Nut is going to travel to the Tree Country, in which there are n cities. Most of the land of this country is covered by fores... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Tokitsukaze and CSL are playing a little game of stones.
In the beginning, there are n piles of stones, the i-th pile of which has 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.Petya and Gena play a very interesting game "Put a Knight!" on a chessboard n × n in size. In this game they take turns to put chess 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.Ania has a large integer S. Its decimal representation has length n and doesn't contain any leading zeroes. Ania is allowed to change ... |
user: Generate an executable Python 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 rectangular matrix of size n × m consisting of integers from 1 to 2 ⋅ 10^5.
In one move, you can:
* choose any ele... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ichihime is the current priestess of the Mahjong Soul Temple. She claims to be human, despite her cat ears.
These days the temple 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.We define x mod y as the remainder of division of x by y (\% operator in C++ or Java, mod operator in Pascal).
Let's call an array 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.Bertown is a city with n buildings in a straight line.
The city's security service discovered that some buildings were mined. A map 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.Baby Ehab is known for his love for a certain operation. He has an array a of length n, and he decided to keep doing the following ope... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You have a nuts and lots of boxes. The boxes have a wonderful feature: if you put x (x ≥ 0) divisors (the spacial bars that can divide... |
user: Generate an executable Python 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 Volodya was at the museum and saw a regular chessboard as a museum piece. And there were only four chess pieces on it: two white ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Devu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a sin... |
user: Generate an executable Python 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 saw the little game Marmot made for Mole's lunch. Now it's Marmot's dinner time and, as we all know, Marmot eats flowers. At every ... |
user: Generate an executable Python 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 written on a piece of paper an array of n positive integers a[1], a[2], ..., a[n] and m good pairs of integers (i1, j1), (i2,... |
user: Generate an executable Python 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 developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunately, they are currently bus... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x 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.Bash got tired on his journey to become the greatest Pokemon master. So he decides to take a break and play with functions.
Bash defi... |
user: Generate an executable Python 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 crazy about round numbers. He especially likes the numbers divisible by 10k.
In the given number of n Polycarp wants to r... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ivan wants to write a letter to his friend. The letter is a string s consisting of lowercase Latin letters.
Unfortunately, when Ivan ... |
user: Generate an executable Python 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 a1, a2, ..., an consisting of n integers, and an integer k. You have to split the array into exactly k non-empt... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Are you going to Scarborough Fair?
Parsley, sage, rosemary and thyme.
Remember me to one who lives there.
He once was the true love... |
user: Generate an executable Python 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 the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comment... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Right now she actually isn't. But she will be, if you don't solve this problem.
You are given integers n, k, A and B. There is a numb... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Nikita likes tasks on order statistics, for example, he can easily find the k-th number in increasing order on a segment of an array. ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Atul opens a book store and soon he recives his first bill form his wholeseller. To see the bill is correct or not he try to cross 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.Raju has a crush on girl of his class. He wanted to become close friend of her so he started trying to impress her. She came to know 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 3 points - middles of the sides of some triangle. Find coordinates of the triangle vertices.
Input
Input has 3 lines 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.You have a long list of tasks that you need to do today. To accomplish task i you need Mi minutes, and the deadline for this task is 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.After Governor's attack on prison, Rick found himself surrounded by walkers. They are coming towards him from all sides. Now, suppose ... |
user: Generate an executable Python 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 Snuke Cats numbered 1, 2, \ldots, N, where N is even.
Each Snuke Cat wears a red scarf, on which his favorite non-negativ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Your friend gave you a dequeue D as a birthday present.
D is a horizontal cylinder that contains a row of N jewels.
The values of 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.There are N slimes lining up in a row. Initially, the i-th slime from the left has a size of a_i.
Taro is trying to combine all 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.In the State of Takahashi in AtCoderian Federation, there are N cities, numbered 1, 2, ..., N. M bidirectional roads connect these cit... |
user: Generate an executable Python 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 railroad running from west to east in Atcoder Kingdom is now complete.
There are N stations on the railroad, numbered 1 through N f... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Snuke loves working out. He is now exercising N times.
Before he starts exercising, his power is 1. After he exercises for the i-th 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.AtCoDeer the deer is seeing a quick report of election results on TV. Two candidates are standing for the election: Takahashi and Aoki... |
user: Generate an executable Python 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 April 2008, Aizuwakamatsu City succeeded in making yakitori with a length of 20 m 85 cm. The chicken used at this time is Aizu loca... |
user: Generate an executable Python 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 educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with 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.Railroad Trip
There are N cities in the JOI country, numbered 1, 2, ..., and N, respectively. In addition, there are N − 1 railroads,... |
user: Generate an executable Python 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 company “ACM Foods” is preparing for opening its chain shop in a certain area, but another company “ICPC Pizza” is also planning 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.Problem F: Farey Sequence
slip likes to look at the numbers. Just looking at the remaining time while downloading the file is enough ... |
user: Generate an executable Python 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 permutation of N numbers from 1 to N A1, A2, ……, AN is given. You can perform the operation reverse (i, j) to reverse the order 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.Problem statement
It was a month ago. Nikunishi, an elementary school student, did not do his summer vacation homework. Therefore, 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.A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on V represented by a set of edg... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Knights' tournaments were quite popular in the Middle Ages. A lot of boys were dreaming of becoming a knight, while a lot of girls wer... |
user: Generate an executable Python 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 Chief loves math. Most of all, he loves equations. He can solve any equation in the whole world. Recently he found one interest... |
user: Generate an executable Python 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 the end of a busy day, The Chef and his assistants play a game together. The game is not just for fun but also used to decide who 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.Vasya has two arrays A and B of lengths n and m, respectively.
He can perform the following operation arbitrary number of times (poss... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Once upon a time there were several little pigs and several wolves on a two-dimensional grid of size n × m. Each cell in this grid was... |
user: Generate an executable Python 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 matrices A and B. Each matrix contains exactly n rows and m columns. Each element of A is either 0 or 1; each elemen... |
user: Generate an executable Python 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 will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only likes 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 planning to buy an apartment in a n-floor building. The floors are numbered from 1 to n from the bottom to the top. At first f... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem:
There are two arr... |
user: Generate an executable Python 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 garland consisting of n lamps. States of the lamps are represented by the string s of length n. The i-th character 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 given an array a consisting of n integers. Indices of the array start from zero (i. e. the first element is a_0, the second 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 2n integers 1, 2, ..., 2n. You have to redistribute these 2n elements into n pairs. After that, you choose x pairs and take 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.The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch f... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.There is a square field of size n × n in which two cells are marked. These cells can be in the same row or column.
You are to mark tw... |
user: Generate an executable Python 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 median in an array with the length of n is an element which occupies position number <image> after we sort the elements in the non-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 boy named Vasya wants to play an old Russian solitaire called "Accordion". In this solitaire, the player must observe the following ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Since most contestants do not read this part, I have to repeat that Bitlandians are quite weird. They have their own jobs, their own 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.Ivan has got an array of n non-negative integers a1, a2, ..., an. Ivan knows that the array is sorted in the non-decreasing order.
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.The Smart Beaver has recently designed and built an innovative nanotechnologic all-purpose beaver mass shaving machine, "Beavershave 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.Pasha has many hamsters and he makes them work out. Today, n hamsters (n is even) came to work out. The hamsters lined up and each ham... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Having endured all the hardships, Lara Croft finally found herself in a room with treasures. To her surprise she didn't find golden mo... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Please note that the memory limit differs from the standard.
You really love to listen to music. During the each of next s days you 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.One day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from 1 to n. Let's assume... |
user: Generate an executable Python 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 their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.
... |
user: Generate an executable Python 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 thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts 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.Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.
A number x is said 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.Polycarp has created his own training plan to prepare for the programming contests. He will train for n days, all days 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.Link to Russian translation of problem
There are N ants staying at the vertices of the N-regular polygon (one ant at one vertex). At ... |
user: Generate an executable Python 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 you will be given a range 'n', and you are supposed to find all composite numbers within that range. Make your program... |
user: Generate an executable Python 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 code monk, high on excitement after solving the rest of the problems , goes on a trek in the mountains .
On his way, he encounter... |
user: Generate an executable Python 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 bought a Ring for Alfi, his girlfriend :p. But Alfi will only accept the Ring if Roy played a game with her and answered her queri... |
user: Generate an executable Python 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 every string given as input, you need to tell us the number of subsequences of it that are palindromes (need not necessarily be di... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Vanya has been studying all day long about sequences and other Complex Mathematical Terms. She thinks she has now become really good 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.M-kun is a brilliant air traffic controller.
On the display of his radar, there are N airplanes numbered 1, 2, ..., N, all flying at ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.