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.At University A, there were many mistakes in entering IDs.
Therefore, University A decided to issue a new ID to prevent typos.
There 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.In the Bitwise Kingdom, located somewhere in the universe, there are exactly 2N citizens living and each of them has a unique identifi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Once upon a time, in a fantasy world far, far away, monsters dug caves and dungeons for adventurers. They put some obstacles in their ... |
user: Generate an executable Python 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 polygon g, computes the area of the polygon.
g is represented by a sequence of points p1, p2,..., pn where line segments ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.One day Chini while digging his ancestral farmland found the 2 boxes. He opened the 1st box, it was empty while in the second, there w... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Given three integers x, m and n. Evaluate (1 + x + x^ 2 + .. + x^ m) (mod n)
Input
First line of the input contains a single integ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Haku Kale now wants to loot in a global scale. For that he needs the help of some underground gang leaders. But the problem is, he doe... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Oh, no! Chef’s in trouble. He’s got himself stuck in a cave (we don’t know how) and is looking for a way out. The bigger problem is 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.You are given two strings s and t. The string s consists of lowercase Latin letters and at most one wildcard character '*', the string... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.King Kog got annoyed of the usual laxity of his knights — they can break into his hall without prior notice! Thus, the King decided 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.Arkady invited Anna for a dinner to a sushi restaurant. The restaurant is a bit unusual: it offers n pieces of sushi aligned in a row,... |
user: Generate an executable Python 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 set of points x_1, x_2, ..., x_n on the number line.
Two points i and j can be matched with each other if the followi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Hanh lives in a shared apartment. There are n people (including Hanh) living there, each has a private fridge.
n fridges are secured... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mr. Chanek has an orchard structured as a rooted ternary tree with N vertices numbered from 1 to N. The root of the tree is vertex 1. ... |
user: Generate an executable Python 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 board represented as a grid with 2 × n cells.
The first k_1 cells on the first row and first k_2 cells on the second row a... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts ... |
user: Generate an executable Python 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 know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to f... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are playing the following game. There are n points on a plane. They are the vertices of a regular n-polygon. Points are labeled 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.Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Barney has finally found the one, a beautiful young lady named Lyanna. The problem is, Lyanna and Barney are trapped in Lord Loss' cas... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Due to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale... |
user: Generate an executable Python 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 distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining p... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Apart from plush toys, Imp is a huge fan of little yellow birds!
<image>
To summon birds, Imp needs strong magic. There are n trees ... |
user: Generate an executable Python 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 at a water bowling training. There are l people who play with their left hand, r people, who play with their right hand, and 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.Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≤ i < n) ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Statement: Sourav and his friends are in kolkata city and they are
planning for a city tour. So, they booked a TUBER cab
(Stop Giggli... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Humpty Dumpty lives on a two-dimensional plane. He likes to jump. Currently, he is located in the point (0, 0). He would like to reach... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Aravind has a hexadecimal number H. he is willing to find number of ones and zeros in that number. He needs your help to solve his pro... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Rohan bought new book Puzzleria in which he has to solve the puzzle.
So,now he need your help to solve one of the puzzle were he is gi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Shil got an array of N integers as a present on his birthday. But he didn't liked it. Shil wants to make this array beautiful. Shil 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.The Hound and his brother the Mountain are engaged in a fight against each other in King's Landing. At the end of the fight, one dies ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Xsquare loves to play with strings a lot. Today, he has two strings S1 and S2 both consisting of lower case alphabets. Xsquare listed ... |
user: Generate an executable Python 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 positive integer N. Consider repeatedly applying the operation below on N:
* First, choose a positive integer z satisfying... |
user: Generate an executable Python 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 participating in a programming contest, AXC001. He has just submitted his code to Problem A.
The problem has N test cases... |
user: Generate an executable Python 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 gems. The value of the i-th gem is V_i.
You will choose some of these gems, possibly all or none, and get them.
However,... |
user: Generate an executable Python 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 people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given two strings s and t consisting of lowercase English letters and an integer L.
We will consider generating a string of l... |
user: Generate an executable Python 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 will call a string that can be obtained by concatenating two equal strings an even string. For example, `xyzxyz` and `aaaaaa` are e... |
user: Generate an executable Python 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 integer variable x. Initially, x=0.
Some person gave you a string S of length N, and using the string you performed the f... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mr. Takahashi has a string s consisting of lowercase English letters. He repeats the following operation on s exactly K times.
* Choo... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.<image>
You know the merry-go-round in the amusement park. Vehicles such as horses and carriages are fixed on a large disk, and it 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.In Square Town, where many people who love squares live, a festival is held to color the town with illuminations that combine square l... |
user: Generate an executable Python 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 advanced algorithm class, n2 students sit in n rows and n columns. One day, a professor who teaches this subject comes into 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.<image>
The International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events 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.Alice wants to send an email to Miku on her mobile phone.
The only buttons that can be used for input on mobile phones are number but... |
user: Generate an executable Python 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 a programmer on the development team for new recording media. This recording medium can be randomly accessed for reading and e... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Champernowne constant is an irrational number. Its decimal representation starts with "0.", followed by concatenation of all positive ... |
user: Generate an executable Python 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 currency system in the Kingdom of Yoax-Musty is strange and fairly inefficient. Like other countries, the kingdom has its own curr... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.I: Ravage
Santa Claus was caught in the illuminations of the city and broke it.
There are N light bulbs in the illumination, and 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.For a given sequence $A = \\{a_0, a_1, ..., a_{n-1}\\}$ which is sorted by ascending order, find the lower bound for a specific value ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Dhapu is a school girl who hacks and programs in free time. But right now she has to do her boring school homework. It's a few additio... |
user: Generate an executable Python 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
Clarissa Adele Fray (a.k.a Clary) has found out that she is a shadowhunter, a human with angelic qualities. She ... |
user: Generate an executable Python 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 we all know, F.C. Barcelona is the best soccer team of our era! Their entangling and mesmerizing game style usually translates into... |
user: Generate an executable Python 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 Little Elephant and his friends from the Zoo of Lviv were returning from the party. But suddenly they were stopped by the policema... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Leha is planning his journey from Moscow to Saratov. He hates trains, so he has decided to get from one city to another by car.
The p... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A Thue-Morse-Radecki-Mateusz sequence (Thorse-Radewoosh sequence in short) is an infinite sequence constructed from a finite sequence ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ilya lives in a beautiful city of Chordalsk.
There are n houses on the street Ilya lives, they are numerated from 1 to n from left 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.Given a positive integer m, we say that a sequence x_1, x_2, ..., x_n of positive integers is m-cute if for every index i such that 2 ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Methodius received an email from his friend Polycarp. However, Polycarp's keyboard is broken, so pressing a key on it once may cause 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.The only difference between easy and hard versions is that you should complete all the projects in easy version but this is not necess... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.While doing some spring cleaning, Daniel found an old calculator that he loves so much. However, it seems like it is broken. When he 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.Ashishgup and FastestFinger play a game.
They start with a number n and play in turns. In each turn, a player can make any one 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.A robot is standing at the origin of the infinite two-dimensional plane. Each second the robot moves exactly 1 meter in one of the fou... |
user: Generate an executable Python 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 positive integer k, two arrays are called k-similar if:
* they are strictly increasing;
* they have the same 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.The student council is preparing for the relay race at the sports festival.
The council consists of n members. They will run one afte... |
user: Generate an executable Python 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 segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments cont... |
user: Generate an executable Python 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 an array, consisting of n integers a1, a2, ..., an. Also, you've got m queries, the i-th query is described by two integers... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Iahub wants to meet his girlfriend Iahubina. They both live in Ox axis (the horizontal axis). Iahub lives at point 0 and Iahubina at p... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.n soldiers stand in a circle. For each soldier his height ai is known. A reconnaissance unit can be made of such two neighbouring sold... |
user: Generate an executable Python 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'll define S(n) for positive integer n as follows: the number of the n's digits in the decimal base. For example, S(893) = 3, S(1145... |
user: Generate an executable Python 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 a beautiful garden where wonderful fruit trees grow and yield fantastic harvest every year. But lately thieves started to sn... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collec... |
user: Generate an executable Python 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 a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of the stick. Eac... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers 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.Vasily exited from a store and now he wants to recheck the total price of all purchases in his bill. The bill is a string in which 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.Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1, p2... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Zane the wizard is going to perform a magic show shuffling the cups.
There are n cups, numbered from 1 to n, placed along the x-axis ... |
user: Generate an executable Python 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 a robot which is situated on an infinite grid. Initially the robot is standing in the starting cell (0, 0). The robot can pro... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Petya has n positive integers a1, a2, ..., an.
His friend Vasya decided to joke and replaced all digits in Petya's numbers with a le... |
user: Generate an executable Python 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 team of N people. For a particular task, you can pick any non-empty subset of people. The cost of having x people for the 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.Ehab has an array a of n integers. He likes the [bitwise-xor operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) and he li... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Akash has lots of assignments to submit in his college. In one of the assignment he is given a string S of length N consisting of lowe... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Brio got his house constructed near the National Highway. The Construction and Planning Committee has planned to construct a road near... |
user: Generate an executable Python 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) completed with his studies and became a engineer, now to earn his bread he decided to start a company, being a son 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.There are two kind of bots in the game BOT A and BOT B. Both are designed so as to move only in one direction in a 1-D array. Bot A 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.Adriana was playing with the English alphabet. When she was done playing with the alphabet, she realised that she had jumbled up the p... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mike lost in a coding contest just because he was not aware with the concept of palindrome properly.
So finally he learnt about it 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.All Indian Robotic Challenge (AIRC) is going to be held in NIT Raipur.Ajeet a student of nitrr want to participate in it and win it. 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.Every one is now a days playing games on their smartphones for passing free time. Because of which there are number of game developing... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Turing loves playing board games. Recently he played a game on the internet, that he found interesting.
You are given a square board ... |
user: Generate an executable Python 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, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negativ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Consider sequences \\{A_1,...,A_N\\} of length N consisting of integers between 1 and K (inclusive).
There are K^N such sequences. Fi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.AtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code.
The company has an N-digit lucky number, S. Takahash... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.N of us are going on a trip, by train or taxi.
The train will cost each of us A yen (the currency of Japan).
The taxi will cost us 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.Find the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). 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 three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym form... |
user: Generate an executable Python 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 computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b.
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.Create a program of the square picking method, which is one of the classical random number generation methods. The square harvesting m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.