formatted_conversations stringlengths 1.13k 138k |
|---|
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an array a consisting of n integers. Each a_i is one of the six following numbers: 4, 8, 15, 16, 23, 42.
Your task is 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.Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia.
For the tournament, Alya puts cand... |
user: Generate an executable Python 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 Latin letters and q queries for this string.
Recall that the substring s[l; r] 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 positive integers a_1, a_2, ..., a_n. For the one move you can choose any even value c and divide by two all elements 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.HQ9+ is a joke programming language which has only four one-character instructions:
* "H" prints "Hello, World!",
* "Q" prints 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.Let us call two integers x and y adjacent if (lcm(x, y))/(gcd(x, y)) is a perfect square. For example, 3 and 12 are adjacent, but 6 an... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alice and Bob play a game. Alice has got n treasure chests (the i-th of which contains a_i coins) and m keys (the j-th of which she ca... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You've got two numbers. As long as they are both larger than zero, they go through the same operation: subtract the lesser number from... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to pla... |
user: Generate an executable Python 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 an array a[1], a[2], ..., a[n], containing distinct integers from 1 to n. Your task is to sort this array in increasing order... |
user: Generate an executable Python 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 evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks 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.Today, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum possible even (div... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.According to rules of the Berland fashion, a jacket should be fastened by all the buttons except only one, but not necessarily it shou... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.ZS the Coder is coding on a crazy computer. If you don't type in a word for a c consecutive seconds, everything you typed disappear!
... |
user: Generate an executable Python 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 Berland Kingdom is a set of n cities connected with each other with n - 1 railways. Each road connects exactly two different citie... |
user: Generate an executable Python 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 presidential election is coming in Bearland next year! Everybody is so excited about this!
So far, there are three candidates, Al... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Recently n students from city S moved to city P to attend a programming camp.
They moved there by train. In the evening, all students... |
user: Generate an executable Python 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 Bandu of the Hackers' community had a very urgent job to do. He needs to diffuse all the bombs placed by Poker. Poker is extremely... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Fatland is a town with N cities numbered 1, 2, ..., N, connected with 2-way roads. Vincent is a villian who wants to set the entire to... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.An extraterrestrial visit!
Remember your childhood friend JAADU from outer space?? Well, he is back again to our mighty Planet Earth.
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Protection of the Indian border and safe transport of items from one point to another along the border are the paramount jobs for the ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Navi is a famous mathematician. He is working on Division, Multiplication and Addition. He is in need of some hidden patterns to disco... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Aditya is a professor in Engilsh loves to play with words. Today he asks his assistant Abishek to perform an experiment where he wants... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Xenny had N boxes with an integer printed on each of the boxes.
He wanted to find out how many distinct pairs of boxes that were at 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.Given is a string S. Replace every character in S with `x` and print the result.
Constraints
* S is a string consisting of lowercase... |
user: Generate an executable Python 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 is a string S of length N.
Find the maximum length of a non-empty string that occurs twice or more in S as contiguous substring... |
user: Generate an executable Python 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 has N strings. The i-th string is s_i.
Let us concatenate these strings into one string after arranging them in some order. Fin... |
user: Generate an executable Python 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. Find the largest value among A+B, A-B and A \times B.
Constraints
* -1000 \leq A,B \leq 1000
* 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.Snuke has N sticks. The length of the i-th stick is l_i.
Snuke is making a snake toy by joining K of the sticks together.
The length... |
user: Generate an executable Python 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 has decided to construct a string that starts with `A` and ends with `Z`, by taking out a substring of a string s (that is, a co... |
user: Generate an executable Python 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 plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an exam... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines ... |
user: Generate an executable Python 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 constructing a triangular pyramid with a sheet of craft paper with grid lines. Its base and sides are all of triangular shape.... |
user: Generate an executable Python 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 f(x) = a0 + a1x + a2x2 + ... + adxd be the function where each ai (0 ≤ i ≤ d) is a constant integer (and ad is non-zero) and x 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.D: Complex Oracle --Complex Oracle-
problem
* This problem is a reactive problem. In other words, it is necessary to create a progra... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Compare given two sequence $A = \\{a_0, a_1, ..., a_{n-1}\\}$ and $B = \\{b_0, b_1, ..., b_{m-1}$ lexicographically.
Constraints
* $... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Prof. R.K.Vats of NIT Hamirpur has given a problem to the whole class and has imposed a condition that he won't give attendance to tho... |
user: Generate an executable Python 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.
One day Toretto wanted to make some extra money. We all know his obsession with cars so all he could manage to ge... |
user: Generate an executable Python 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 n songs on his phone. The size of the i-th song is a_i bytes. Ivan also has a flash drive which can hold at most m bytes in 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.You are given an integer array a_1, a_2, …, a_n.
The array b is called to be a subsequence of a if it is possible to remove some elem... |
user: Generate an executable Python 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 exactly n characters, and each character is either '0', '1' or '2'. Such strings are called ter... |
user: Generate an executable Python 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 harder version of the problem. The difference is only in constraints.
You are given a rectangular n × m matrix a. In one 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.You have n × n square grid and an integer k. Put an integer in each cell while satisfying the conditions below.
* All numbers in 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.[3R2 as DJ Mashiro - Happiness Breeze](https://open.spotify.com/track/2qGqK8GRS65Wlf20qUBEak)
[Ice - DJ Mashiro is dead or alive](htt... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.During the quarantine, Sicromoft has more free time to create the new functions in "Celex-2021". The developers made a new function GA... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool.
It tak... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Phoenix is playing with a new puzzle, which consists of n identical puzzle pieces. Each puzzle piece is a right isosceles triangle as ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a multiset (i. e. a set that can contain multiple equal integers) containing 2n integers. Determine if you can split it ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.According to a new ISO standard, a flag of every country should have a chequered field n × m, each square should be of one of 10 colou... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A 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.Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's income... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows 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.Police headquarter is monitoring signal on different frequency levels. They have got two suspiciously encoded strings s1 and s2 from 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.Jzzhu has invented a kind of sequences, they meet the following property:
<image>
You are given x and y, please calculate fn modulo ... |
user: Generate an executable Python 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 way to make a new task is to make it nondeterministic or probabilistic. For example, the hard task of Topcoder SRM 595, Constellatio... |
user: Generate an executable Python 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 word or a sentence in some language is called a pangram if all the characters of the alphabet of this language appear in it at least... |
user: Generate an executable Python 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 celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Buses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus 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.Mike and !Mike are old childhood rivals, they are opposite in everything they do, except programming. Today they have a problem they 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.Recently a dog was bought for Polycarp. The dog's name is Cormen. Now Polycarp has a lot of troubles. For example, Cormen likes going ... |
user: Generate an executable Python 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 is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the worl... |
user: Generate an executable Python 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 Pavlopolis University where Noora studies it was decided to hold beauty contest "Miss Pavlopolis University". Let's describe the pr... |
user: Generate an executable Python 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 Berland's capital has the form of a rectangle with sizes n × m quarters. All quarters are divided into three types:
* regular (... |
user: Generate an executable Python 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 was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Arkady is playing Battleship. The rules of this game aren't really important.
There is a field of n × n cells. There should be exactl... |
user: Generate an executable Python 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 on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so she solved all the tasks... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Darshak (Dark) likes to get fruits from trees a lot,he always like to eat those natural fruits directly from the tree.
Today he 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.Kuldeep is tired from all the fun he's having with Christie, so now all he needs is a good night's sleep to get some rest.
Being a 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.Given a word w, rearrange the letters of w to construct another word s in such a way that s is lexicographic-ally greater than w. In 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.Little Jhool is still out of his mind - exploring all his happy childhood memories. And one of his favorite memory is when he found 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.Ashima has brought home n cats. Now, being a cat lover, she is taking care of the cats and has asked me to bring cat food for them. Be... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In the Mathematical world of Dr. Ramanujam, every new student must have to pass a exam to take the classes of Advance mathematics from... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Samu is in super market and in a mood to do a lot of shopping. She needs to buy shirts, pants and shoes for herself and her family. 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 string is said to be "SUPER STRING" if the number of times the character appeared in the string is equal to its ASCII value. Given 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.You are given a string, which contains entirely of decimal digits (0-9). Each digit is made of a certain number of dashes, as shown in... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takahashi has many red balls and blue balls. Now, he will place them in a row.
Initially, there is no ball placed.
Takahashi, who 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.Takahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wi... |
user: Generate an executable Python 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 positive integer N. Find the minimum positive integer divisible by both 2 and N.
Constraints
* 1 \leq N \leq 10^9
* ... |
user: Generate an executable Python 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 received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.... |
user: Generate an executable Python 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 calculates and outputs the surface distance by inputting the north latitude and east longitude of two cities 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.In Aizu prefecture, we decided to create a new town to increase the population. To that end, we decided to cultivate a new rectangular... |
user: Generate an executable Python 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
Five students, Taro, Jiro, Saburo, Shiro, and Hanako, participated in the JOI High School class.
In this class, a final exam... |
user: Generate an executable Python 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 17th century, Fermat wrote that he proved for any integer $n \geq 3$, there exist no positive integers $x$, $y$, $z$ such 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.Let’s try a dice puzzle. The rules of this puzzle are as follows.
1. Dice with six faces as shown in Figure 1 are used in the puzzle.... |
user: Generate an executable Python 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's archaeologist was excavating the ruins. One day he found a large number of slate engraved with a series of dubious symbo... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.King Mercer is the king of ACM kingdom. There are one capital and some cities in his kingdom. Amazingly, there are no roads in the kin... |
user: Generate an executable Python 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 $ N $ a pair of non-negative integers $ (a_i, b_i) $ and non-negative integers $ A $, $ B $.
I want to do as many 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.Write a program which finds a pattern $p$ in a ring shaped text $s$.
<image>
Constraints
* $1 \leq $ length of $p \leq $ length 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.A cricket team consists of 11 players and some are good at batting, others are good at bowling and some of them are good at both batti... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.So, as you all know free WiFis are being
installed in our institute.
These are a special
type of WiFi and they start to interfere wh... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef is the head of commercial logging industry that recently bought a farm containing N trees. You are given initial height of the i-... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Problem Statement
You have a number N and you want to calculate how many divisors of N are special.
A number is said to be special ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Andy and Bob are the only two delivery men of Pizza-chef store. Today, the store received N orders.
It's known that the amount of tips... |
user: Generate an executable Python 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 get more and more news about DDoS-attacks of popular websites.
Arseny is an admin and he thinks that a website is under a DDoS-att... |
user: Generate an executable Python 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 is having a party soon, and he has decided to invite his n friends.
He wants to make invitations in the form of origami. For ea... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a tree (an undirected connected acyclic graph) consisting of n vertices. You are playing a game on this tree.
Initially... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.BerPhone X is almost ready for release with n applications being preinstalled on the phone. A category of an application characterizes... |
user: Generate an executable Python 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 has got addicted to a game called Sirtet recently.
In Sirtet, player is given an n × m grid. Initially a_{i,j} cubes are stacke... |
user: Generate an executable Python 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 n and m. You have to construct the array a of length n consisting of non-negative integers (i.e. integers g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.