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.Polycarp has n coins, the value of the i-th coin is a_i. It is guaranteed that all the values are integer powers of 2 (i.e. a_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.We just discovered a new data structure in our research group: a suffix three!
It's very useful for natural language processing. ... |
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 integers a and b. Print a+b.
Input
The first line contains an integer t (1 ≤ t ≤ 10^4) — the number of test ca... |
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 playing a variation of game 2048. Initially you have a multiset s of n integers. Every integer in this multiset is a power... |
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.Snuke is giving cookies to his three goats.
He has two cookie tins. One contains A cookies, and the other contains B cookies. He ... |
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.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... |
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.Lengths are measures in Baden in inches and feet. To a length from centimeters it is enough to know that an inch equals three cent... |
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.On his free time, Chouti likes doing some housework. He has got one new task, paint some bricks in the yard.
There are n bricks l... |
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 of length 2n. Consider a partition of array a into two subsequences p and q of length n each (each elemen... |
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.Malek has recently found a treasure map. While he was looking for a treasure he found a locked door. There was a string s written ... |
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.Emuskald is an avid horticulturist and owns the world's longest greenhouse — it is effectively infinite in length.
Over the years... |
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 two positive integers a and b.
You can perform two kinds of operations:
* a = ⌊ a/b ⌋ (replace a with the integer par... |
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.Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the ar... |
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 have A balls with the string S written on each of them and B balls with the string T written on each of them.
From these balls,... |
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 likes playing with strings. The most interesting game are named "CHEF in string". The move of the game consists of the follow... |
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
Given the sequence $ A $ of length $ N $. Find the maximum value of $ \ sum B_i $, where $ B $ is one of the longest incr... |
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.Polycarpus has an array, consisting of n integers a1, a2, ..., an. Polycarpus likes it when numbers in an array match. That's why ... |
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.Sara and Tara were two young girls who had a really bad handwriting.So they decided to write down a word. Being highly passionate ... |
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 Aizuwakamatsu Village, which is located far north of Aizuwakamatsu City, a bridge called "Yabashi" is the only way to move to 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.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 di... |
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.Andrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famous Sto... |
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 penguin Rocher has n sticks. He has exactly one stick with length i for all 1 ≤ i ≤ n.
He can connect some sticks. If he connec... |
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.Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower h... |
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.Sasha reaches the work by car. It takes exactly k minutes. On his way he listens to music. All songs in his playlist go one by one... |
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.Long time ago, there was a great kingdom and it was being ruled by The Great Arya and Pari The Great. These two had some problems ... |
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.Welcome to PC Koshien, players. Physical condition management is important to participate in the event. It is said that at the tur... |
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 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 che... |
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.New Year is coming, and Jaehyun decided to read many books during 2015, unlike this year. He has n books numbered by integers from... |
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 rectangles. The lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides ... |
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 Smart Beaver from ABBYY decided to have a day off. But doing nothing the whole day turned out to be too boring, and he decided... |
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.Each of you probably has your personal experience of riding public transportation and buying tickets. After a person buys a ticket... |
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.Jack is a great mathematician. He loves to solve series. Now Stuart gave a
series to Jack and said you have to solve the problem 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.An established group of scientists are working on finding solution to NP hard problems. They claim Subset Sum as an NP-hard probl... |
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.Akhil gives Ramesh an array A of length N. Then he asks him to determine if there exists an element in the array such that the sum... |
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 developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunately, they are currently... |
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 has got two number: a and b. However, Vasya finds number a too short. So he decided to repeat the operation of lengthening n... |
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.Archith loves to play with number series. Archith asked his girlfriend to a date. But she was busy in solving the homework on tria... |
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.This is a simple game you must have played around with during your school days, calculating FLAMES of you and your crush! Given 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.This is yet another problem dealing with regular bracket sequences.
We should remind you that a bracket sequence is called regula... |
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.Each army fighting the world war Z is denoted with a word consisting any combination of 26 alphabets. An army is a match for his/h... |
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 integer n (n ≥ 0) represented with k digits in base (radix) b. So,
$$$n = a_1 ⋅ b^{k-1} + a_2 ⋅ b^{k-2} + … a_{k... |
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 a given array a consisting of n integers and a given integer m find if it is possible to reorder elements of the array a in su... |
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.Andrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary... |
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 kids, Jack and Evan like playing their favorite game Glass-and-Stone. Today they want to play something new and came across... |
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 cookies, and Aoki has B cookies. Takahashi will do the following action K times:
* If Takahashi has one or more c... |
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 got into number sequences. Now he's got sequence a1, a2, ..., an, consisting of n positive integers. Also, Dima has got a fun... |
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 s consisting of the characters 0, 1, and ?.
Let's call a string unstable if it consists of the characters ... |
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.Polycarpus develops an interesting theory about the interrelation of arithmetic progressions with just everything in the world. Hi... |
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.Two players play a game.
Initially there are n integers a_1, a_2, …, a_n written on the board. Each turn a player selects one 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.Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly disc... |
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.Today, Mezo is playing a game. Zoma, a character in that game, is initially at position x = 0. Mezo starts sending n commands to Z... |
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.To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks -... |
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 king of ghosts is really disappointed when he sees that all the human beings on Planet Earth have stopped fearing the ghost ra... |
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 students and M checkpoints on the xy-plane.
The coordinates of the i-th student (1 \leq i \leq N) is (a_i,b_i), and 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 have sticks numbered 1, \cdots, N. The length of Stick i (1 \leq i \leq N) is L_i.
In how many ways can we choose three 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.Palindrome
Problem Statement
Find the number of palindromes closest to the integer n.
Note that the non-negative integer x is 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.Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations:
1. 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.Polycarp is a regular customer at the restaurant "Ber Patio". He likes having lunches there.
"Ber Patio" has special discount pro... |
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.Vivek was roaming around in the electronics shop, where he saw a box called as BlackBox. He was intrigued by its function, so he 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.You have two friends. You want to present each of them several positive integers. You want to present cnt1 numbers to the first fr... |
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 you have noticed, there are lovely girls in Arpa’s land.
People in Arpa's land are numbered from 1 to n. Everyone has exactly ... |
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.Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome world, where everything is... |
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 have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.
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.Garfield the cat likes candies A LOT. He always keeps a huge stock of it at his home. Today John, his owner, brought home three ty... |
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.Dreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS:
You are given two 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.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... |
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 sequence A_1, A_2, ..., A_N and an integer K.
Print the maximum possible length of a sequence B that satisfies 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.You survived several months of exam wars and were able to enter ICPC University on a sunny day. On the day of admission, there was... |
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.Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's 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.Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string ar... |
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.Saxie is a programming enthusiast. He has always been amazed by the beauty of strings. He always dreams of going to Byteland and p... |
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 magician in town. His trick is known as "Find the Ring".
He puts 3 glasses at 3 spots on the table, labeling them ... |
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 delivery of clothing has arrived today to the clothing store. This delivery consists of a ties, b scarves, c vests and d jac... |
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 have a sequence of length N, a = (a_1, a_2, ..., a_N). Each a_i is a positive integer.
Snuke's objective is to permute the ele... |
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 studies divisibility rules at school. Here are some of them:
* Divisibility by 2. A number is divisible by 2 if and only ... |
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 decided to relax on his weekend and visited to the performance of famous ropewalkers: Agafon, Boniface and Konrad.
The r... |
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 us denote by d(n) the sum of all divisors of the number n, i.e. d(n) = ∑_{k | n} k.
For example, d(1) = 1, d(4) = 1+2+4=7, 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.Polycarpus has a hobby — he develops an unusual social network. His work is almost completed, and there is only one more module 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.Snuke lives in another world, where slimes are real creatures and kept by some people. Slimes come in N colors. Those colors are c... |
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 S consisting of lowercase English letters. Determine whether all the characters in S are different.
Constr... |
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 arrays of integers a_1,…,a_n and b_1,…,b_m.
Your task is to find a non-empty array c_1,…,c_k that is a subseque... |
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.This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious either — although he played perfect... |
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 square grid of size n × n. Some cells are colored in black, all others are colored in white. In one operation you can s... |
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 Vasechkin is studying evolution of worms. Recently he put forward hypotheses that all worms evolve by division. There ar... |
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.An integer is said to be a palindrome if it is equal to its
reverse. For example, 79197 and 324423 are palindromes. In this task
... |
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 Berland each high school student is characterized by academic performance — integer value between 1 and 5.
In high school 0xFF... |
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.Yaroslav has n points that lie on the Ox axis. The coordinate of the first point is x1, the coordinate of the second point is x2, ... |
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.Valery is very interested in magic. Magic attracts him so much that he sees it everywhere. He explains any strange and weird pheno... |
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 very large numbers made up of 1 or 0 only. You have to find the digit by digit XOR of the two numbers, i.e., 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.Problem description.
“Murphy’s Law doesn’t meant that something bad will happen. It means that whatever can happen, will happen... |
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 has array a = a1, a2, ..., an, consisting of n integers. Each integer ai equals to -1, or to 1. Also, he has m queries:
... |
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 is stuck in a two dimensional maze having N rows and M columns. He needs to get out of the maze as soon as possible and arriv... |
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 cities in Berland and some pairs of them are connected by two-way roads. It is guaranteed that you can pass from any c... |
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.Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with max... |
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.Tokitsukaze is one of the characters in the game "Kantai Collection". In this game, every character has a common attribute — healt... |
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 people standing in a queue from west to east.
Given is a string S of length N representing the directions of the peop... |
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 school in Byteland is now in the process of renewing some classrooms with new, stronger and better chairs, so that the stude... |
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 N number of trophies. All trophies look similar. However, one of them is defective. All trophies except the defectiv... |
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 Zoo in the Grid Kingdom is represented by an infinite grid. The Zoo has n observation binoculars located at the OX axis. For e... |
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.Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.
Valera has... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.