question_answer_string stringlengths 111 33.1k |
|---|
Question: Generate an executable Python 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 ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for th... |
Question: Generate an executable Python 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 wi... |
Question: Generate an executable Python 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 children, numbered 1, 2, \ldots, N.
They have decided to share K candies among themselves. Here, for each i (1 \leq i... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch the... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.DZY loves Fast Fourier Transformation, and he enjoys using it.
Fast Fourier Transformation is an algorithm used to calculate conv... |
Question: Generate an executable Python 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... |
Question: Generate an executable Python 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 2 numbers n1 and n2, following operations can be performed:
1) Decrement n1 by 1(if n1>1)
2) Decrement n2 by 1(if n2>1)
3) I... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.D: Indecision-Indecision-
problem
Ebi-chan has been addicted to gal games lately, and her goal now is to capture two heroines at... |
Question: Generate an executable Python 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 events have started and one of them is Void fnx, the most anticipated Coding Event of the college. This year, one question has... |
Question: Generate an executable Python 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 consider a triangle of numbers in which a number appears in the first line, two numbers appear in the second line, three in ... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Arjit has his own printing press, Bainik Dhaskar (BD). He feels that words on their own simply aren't beautiful enough. So, he wis... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectan... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Sereja has an undirected graph on N vertices. There are edges between all but M pairs of vertices.
A permutation p on the vertice... |
Question: Generate an executable Python 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 had constructed 2 buildings - one of height N and another of height M.
He was unhappy, and wanted both buildings to be of the... |
Question: Generate an executable Python 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 new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite num... |
Question: Generate an executable Python 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 arrays a, b and c. Each of them consists of n integers. SmallY wants to find three integers u, v, w (0 ≤ u, v, w ≤... |
Question: Generate an executable Python 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 works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to... |
Question: Generate an executable Python 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 frie... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Professor Bajtocy is conducting experiments on alien DNA. He has discovered that it is subject to repetitive mutations — each muta... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugen... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Dima has a hamsters farm. Soon N hamsters will grow up on it and Dima will sell them in a city nearby.
Hamsters should be transpo... |
Question: Generate an executable Python 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 want to go on a trip with a friend. However, friends who have a habit of spending money cannot easily save travel expenses. I ... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ringo is giving a present to Snuke.
Ringo has found out that Snuke loves yakiniku (a Japanese term meaning grilled meat. yaki: gr... |
Question: Generate an executable Python 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 list of names. Your task is to find all the distinct names in the list and after that
find the frequency count of ... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mathematician Shikhar has invented a new type of fibonacci series in which
fib(1)=a
fib(2)=b
fib(n)=(fib(n-1)+fib(n-2))%10000... |
Question: Generate an executable Python 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 has A untasty cookies containing antidotes, B tasty cookies containing antidotes and C tasty cookies containing poison.
... |
Question: Generate an executable Python 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 don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following ta... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Professor just has checked all the N students tests. Everything was fine but then he realised that none of the students had signe... |
Question: Generate an executable Python 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... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Amidakuji is a traditional method of lottery in Japan.
To make an amidakuji, we first draw W parallel vertical lines, and then dr... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Gudi enters the castle, and moves along the main path. Suddenly, a block in the ground opens and she falls into it! Gudi slides d... |
Question: Generate an executable Python 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 star map in Berland is a checked field n × m squares. In each square there is or there is not a star. The favourite constellatio... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two strings s and t both of length n and both consisting of lowercase Latin letters.
In one move, you can choose an... |
Question: Generate an executable Python 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 com... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Good evening, contestants.
If a and d are relatively prime positive integers, the arithmetic sequence beginning with a and increa... |
Question: Generate an executable Python 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 all know that every positive integer can be represented as the sum of one or more odd integers.
For eg: 4 = 1 + 1 + 1 + 1. Now... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You have been given a String S. You need to find and print whether this string is a palindrome or not. If yes, print "YES" (withou... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one.
GukiZ has strings... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Iahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a1, a2, ..., an in ascendi... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Geeko is in worry now because exam is coming up and he has to know
what rank he can get in exams. So he go back into the school... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Arkady decides to observe a river for n consecutive days. The river's water level on each day is equal to some real value.
Arkady... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.PowerShell had N natural numbers. He wanted to test Xenny's speed in finding the sum and difference of several numbers.
He decide... |
Question: Generate an executable Python 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.
In one move, you can choose two indices 1 ≤ i, j ≤ n such that i ≠ j and set a... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Aditi recently discovered a new magic trick. First, she gives you an integer N and asks you to think an integer between 1 and N. T... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right.
Now Alexandra wants to split it into som... |
Question: Generate an executable Python 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 social network for dogs called DH (DogHouse) has k special servers to recompress uploaded videos of cute cats. After each video ... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Reversed number is a number written in arabic numerals but the order of digits is reversed.
The first digit becomes last and vice... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ayush, Ashish and Vivek are busy preparing a new problem for the next Codeforces round and need help checking if their test cases ... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Do the following for a four-digit number N consisting of numbers 0-9.
1. Let L be the number obtained as a result of arranging th... |
Question: Generate an executable Python 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 infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the following... |
Question: Generate an executable Python 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 given tree consist of n vertices. Select a vertex as root vertex that satisfies the condition below.
* For all vertice... |
Question: Generate an executable Python 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 hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?
Constraints
* 1≤M≤23
* M is an integ... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Lunar New Year is approaching, and Bob decides to take a wander in a nearby park.
The park can be represented as a connected grap... |
Question: Generate an executable Python 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 I... |
Question: Generate an executable Python 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 Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a × b squares, and ... |
Question: Generate an executable Python 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 electrical resistance is the opposition to the passage of electric current. If two resistors with resistance R1 and R2 are con... |
Question: Generate an executable Python 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 spending long long time, you had gotten tired of computer programming. Instead you were inter- ested in electronic construct... |
Question: Generate an executable Python 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 very much likes computers. Recently he has received a new "Ternatron IV" as a gift from his mother. Unlike other mode... |
Question: Generate an executable Python 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 reads $n$ dices constructed in the same way as Dice I, and determines whether they are all different. For th... |
Question: Generate an executable Python 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 Mishka is a great traveller and she visited many countries. After thinking about where to travel this time, she chose XXX —... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Aaryan went to school like any usual day, The teacher asked his crush the following question.
Given an array of numbers, First sh... |
Question: Generate an executable Python 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 a serious bug has been found in the FOS code. The head of the F company wants to find the culprit and punish him. For tha... |
Question: Generate an executable Python 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 ... |
Question: Generate an executable Python 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 rooted tree with n vertices. The vertices are numbered from 1 to n, the root is the vertex number 1.
Each vertex ... |
Question: Generate an executable Python 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 town of Aalam-Aara (meaning the Light of the Earth), previously there was no crime, no criminals but as the time progressed... |
Question: Generate an executable Python 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 going to participate in the contest. It starts at h_1:m_1 and ends at h_2:m_2. It is guaranteed that the contest lasts... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are labeled from 1 to k. Balls of... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Level 1
Sometimes what happens during SBG slot booking is we forgot to book our slot and mess up. But few clubs
are generous enou... |
Question: Generate an executable Python 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 o... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of can... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Stick n circular stickers with a radius of 1 on a square origami paper with a side length of 10. The stickers can be stacked. Crea... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Japan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gaku... |
Question: Generate an executable Python 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 balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of th... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.For an array a of integers let's denote its maximal element as max(a), and minimal as min(a). We will call an array a of k integer... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes.
<image>
Initially, each hole ha... |
Question: Generate an executable Python 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 given integers m and n, compute mn (mod 1,000,000,007). Here, A (mod M) is the remainder when A is divided by M.
Constraints
... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Everyone knows that chotu likes palindromic strings. One day, he found 2 ordinary strings s1 and s2. Now he wonders if he could ma... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Subly is a very naughty kid. His father gave a set of numbers to him. In the set no number is repeated and the set has N elements.... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Arithmancy is Draco Malfoy's favorite subject, but what spoils it for him is that Hermione Granger is in his class, and she is bet... |
Question: Generate an executable Python 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 identifies the number of combinations of three integers which satisfy the following conditions:
* You shoul... |
Question: Generate an executable Python 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 became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences, so he invented a new... |
Question: Generate an executable Python 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 sisters Alice and Betty. You have n candies. You want to distribute these n candies between two sisters in such a wa... |
Question: Generate an executable Python 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 held two competitions: Coding Contest and Robot Maneuver.
In each competition, the contestants taking the 3-rd, 2-nd, and 1-st... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef has a box full of infinite number of identical coins. One day while playing, he made N piles each containing equal number of ... |
Question: Generate an executable Python 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 smelt fishing tournament was held at Lake Hibara. It seems that catch and release is recommended this time.
Create a program th... |
Question: Generate an executable Python 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 always knew they were coming back.
Species on Earth always had faced the problems came from outer space. We call them Alien , b... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.
Let we represent their bas... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English a... |
Question: Generate an executable Python 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
We can describe detailed direction by repeating the directional names: north, south, east and west. For example... |
Question: Generate an executable Python 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 given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that
... |
Question: Generate an executable Python 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 had a string s consisting of n lowercase Latin letters. We made k copies of this string, thus obtaining k identical strings s1,... |
Question: Generate an executable Python 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 postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen `-`, and the other characters are ... |
Question: Generate an executable Python 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 snake exhibition, there are n rooms (numbered 0 to n - 1) arranged in a circle, with a snake in each room. The rooms are co... |
Question: Generate an executable Python 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 quite ordinary day Valera went to school (there's nowhere else he should go on a week day). In a maths lesson his favorite tea... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Qwerty the Ranger took up a government job and arrived on planet Mars. He should stay in the secret lab and conduct some experimen... |
Question: Generate an executable Python 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 and Doctor Who hopped out of the TARDIS and found themselves at EPFL in 2018. They were surrounded by stormtroopers and Dart... |
Question: Generate an executable Python 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 loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the... |
Question: Generate an executable Python 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 wi... |
Question: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a string $t$ and a set $S$ of $N$ different strings. You need to separate $t$ such that each part is included in $S$... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.