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.In a coordinate system,There are 3 chocolate which will be placed at three random position (x1,y1),(x2,y2) and (x3,y3).Ramesh loves Ch... |
user: Generate an executable Python 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 Valentines Day was approaching, some couples on the campus are upto some mischief and are sneaking around in the Campus Building. B... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.My good friend Guruji once submitting his code on forum mistakenly forgot to check language option. His code got pasted in general edi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Solve the Mystery.
Input :
First line contains T - No. of Test cases.
Each Test case consists of 2 lines.
First line contains K.
Se... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ted: Robin, get me my legal pad. It's Pros and Cons Time!
There is a long list of n girls in front of Barney, and he is to calculate ... |
user: Generate an executable Python 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, you have been given the task of handling the entire Taxi Network of Berland City. Berland city has a huge number of taxi travel... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Max feels lonely after shifting to a new locality, as he does not have any friend there. So his parents bought him a new number 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.You are given a string S of length N consisting of lowercase English letters.
Process Q queries of the following two types:
* Type 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.N friends of Takahashi has come to a theme park.
To ride the most popular roller coaster in the park, you must be at least K centimet... |
user: Generate an executable Python 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 an infinitely long street that runs west to east, which we consider as a number line.
There are N roadworks scheduled on thi... |
user: Generate an executable Python 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 men and N women, both numbered 1, 2, \ldots, N.
For each i, j (1 \leq i, j \leq N), the compatibility of Man i and Woman ... |
user: Generate an executable Python 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 say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.
You are given Q queries.
In the i-th query, 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.Snuke, who loves animals, built a zoo.
There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in 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.AtCoDeer the deer and his friend TopCoDeer is playing a game. The game consists of N turns. In each turn, each player plays one of 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.It is known that even numbers greater than or equal to 4 can be represented by the sum of two prime numbers. This is called the Goldba... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Fair Chocolate-Cutting
You are given a flat piece of chocolate of convex polygon shape. You are to cut it into two pieces of precisel... |
user: Generate an executable Python 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 G: Water clock
An unusually shaped water clock was discovered from the bottom of Lake Biwa.
The water clock is placed on a 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.A: Isono, let's do that! --Sendame -
story
Nakajima "Isono ~, let's do that!"
Isono "What is that, Nakajima"
Nakajima "Look, 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.E: Balanced Edge Deletion
problem
Given a weighted simple undirected graph G of N vertices and M edges. The vertices are numbered fr... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Problem
Given a sequence of length $ N $ $ A = $ {$ a_ {1}, a_ {2}, a_ {3}, ..., a_ {n} $}.
It is assumed that $ a_ {i} $ ($ i = 1,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.A rooted binary tree is a tree with a root node in which every node has at most two children.
Your task is to write a program which r... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.The Chef has prepared the appetizers in the shapes of letters to spell a special message for the guests. There are n appetizers number... |
user: Generate an executable Python 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 getting bored of the monotonous routine of college, Chahak wants go back to the golden days of her life ‘Her Childhood’ when 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.Asmany strings are strings of '0's and '1's that have as many 00 as 11. A string such as 00110001 consists of 3 "00" and
1 "11". Of 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.In a far away dystopian world, the measure of the quality of a person’s life is the numbers of likes he gets for an article about thei... |
user: Generate an executable Python 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 start from some definitions.
Strings A and B are called anagrams if it's possible to rearrange the letters of string A using 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.You have a set of n weights. You know that their masses are a_1, a_2, ..., a_n grams, but you don't know which of them has which mass.... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Bob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them ... |
user: Generate an executable Python 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 a string s. She really likes the letter "a". She calls a string good if strictly more than half of the characters in that st... |
user: Generate an executable Python 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 telephone number is a sequence of exactly 11 digits, where the first digit is 8. For example, the sequence 80011223388 is a telephon... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mislove had an array a_1, a_2, ⋅⋅⋅, a_n of n positive integers, but he has lost it. He only remembers the following facts about 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.Bob is a competitive programmer. He wants to become red, and for that he needs a strict training regime. He went to the annual meeting... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Bessie the cow has just intercepted a text that Farmer John sent to Burger Queen! However, Bessie is sure that there is a secret messa... |
user: Generate an executable Python 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 year in Equestria was a year of plenty, so Applejack has decided to build some new apple storages. According to the advice of 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.You are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft k torches. One torch can be craf... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the 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.Sensation, sensation in the two-dimensional kingdom! The police have caught a highly dangerous outlaw, member of the notorious "Pihter... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.«Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, 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.There are n cities in Berland. Each city has its index — an integer number from 1 to n. The capital has index r1. All the roads in Ber... |
user: Generate an executable Python 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 festival will be held in a town's main street. There are n sections in the main street. The sections are numbered 1 through n from 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.DZY loves chessboard, and he enjoys playing with it.
He has a chessboard of n rows and m columns. Some cells of the chessboard are ba... |
user: Generate an executable Python 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 you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game «Call of Soldi... |
user: Generate an executable Python 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 a little frog whose name was Vasya decided to travel around his home swamp. Overall there are n mounds on the swamp, ... |
user: Generate an executable Python 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 has n cities, the capital is located in city s, and the historic home town of the President is in city t (s ≠ t). The cities 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.Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensional coordinate system on 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.Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integer... |
user: Generate an executable Python 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 quasi-palindromic number be such number that adding some leading zeros (possible none) to it produces a palindromic string.
Stri... |
user: Generate an executable Python 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, and additionally an integer m. You have to choose some sequence of indices b1, b2, ... |
user: Generate an executable Python 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 took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of pur... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.DG (Departmental Gathering) is coming….
As one of the most famous girls in the college everybody is smitten with Harshada and wants t... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Problem :
The Starks(S),Lannisters(L) and the Baratheons(B) are fighting for the
Iron Throne. These three houses are fighting from ag... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition."IT can do almost everything using codes", a Arjun(a CS Student) says to his mathematics' teacher. Mathematics teacher gives a very si... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Karan performed poorly in the Capillary Java Hiring Challenge because he did not know the concept of trees. After the contest, he asks... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Heisenberg is very fond of mixing various strings together. But he has storage problem.
He wants that his strings use as less space 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.It is vacation time and Panda is in his hometown Pandaland. Panda is very bored so he started studying some interesting properties 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.Karan has decided to give stickers to all the attendees of the last day of Google Week. The stickers will be given such that the last ... |
user: Generate an executable Python 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 Omar has assignment problems from his math professor. Yes, Omar has infinite number of questions that he must solve today. 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.We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items.... |
user: Generate an executable Python 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 representing the day of the week today.
S is `SUN`, `MON`, `TUE`, `WED`, `THU`, `FRI`, or `SAT`, for Sunday, Mond... |
user: Generate an executable Python 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 mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.
Between 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.Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all lov... |
user: Generate an executable Python 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 integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a 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 an integer N.
Find a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.
If there are multiple sol... |
user: Generate an executable Python 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 Brown loves games. Today, they will play the following game.
In this game, there are two piles initially consisting of X 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.Write a program which reads an integer n and identifies the number of combinations of a, b, c and d (0 ≤ a, b, c, d ≤ 9) which meet 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 is a bus route as shown in Figure 1. There are 10 stops, each numbered 0-9. The bus turns back at stop 0, but the other side 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.Aiz Onsen has a bathhouse and a pool. To use the bathhouse, you need to buy a bathing ticket, and to use the pool, you need to buy a 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.William Robinson was completely puzzled in the music room; he could not find his triangle in his bag. He was sure that he had prepared... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kitamasa is studying various transformations at university. Recently, the transformations that Kitamasa is interested in are as follow... |
user: Generate an executable Python 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 browser-based puzzle game called "Bubble Puzzle" is now popular on the Internet.
The puzzle is played on a 4 × 4 grid, and initiall... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.G: Toss Cut Tree
Problem Statement
You are given two trees T, U. Each tree has N vertices that are numbered 1 through N. The i-th ed... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.POINTS - 30
Given an integer N, output the number of zeroes at the end of N! (factorial).
Input
The first line of the input 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.Chef Po has given an online advertisement to provide Event organizing services. Chef got a huge response for his advertisement. He got... |
user: Generate an executable Python 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 loves arrays. But he really loves a specific kind of them - Rainbow Arrays.
The array is a Rainbow Array if it has such a struct... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Damon was captured by almighty Ni’klaus.
Ni’klaus was 1000 years old and have spent his life hunting innocents, so he didn’t had time... |
user: Generate an executable Python 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 in the scientific lyceum of the Kingdom of Kremland, there was a biology lesson. The topic of the lesson was the genomes. Let's ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Let's call a binary string s awesome, if it has at least 1 symbol 1 and length of the string is divisible by the number of 1 in it. 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.[THE SxPLAY & KIVΛ - 漂流](https://soundcloud.com/kivawu/hyouryu)
[KIVΛ & Nikki Simmons - Perspectives](https://soundcloud.com/kivawu/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.You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out 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.Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, 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.You have a deck of n cards, and you'd like to reorder it to a new one.
Each card has a value between 1 and n equal to p_i. All p_i ar... |
user: Generate an executable Python 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 burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are m containers, in 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.Rubik is very keen on number permutations.
A permutation a with length n is a sequence, consisting of n different numbers from 1 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.You desperately need to build some string t. For that you've got n more strings s1, s2, ..., sn. To build string t, you are allowed 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.Gerald has n younger brothers and their number happens to be even. One day he bought n2 candy bags. One bag has one candy, one bag has... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.At the beginning of the school year Berland State University starts two city school programming groups, for beginners and for intermed... |
user: Generate an executable Python 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 a big rectangular chocolate bar that consists of n × m unit squares. He wants to cut this bar exactly k times. Each cut must... |
user: Generate an executable Python 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 an easy way to obtain a new task from an old one called "Inverse the problem": we give an output of the original task, and 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.Vasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some pos... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Limak is a grizzly bear who desires power and adoration. He wants to win in upcoming elections and rule over the Bearland.
There are ... |
user: Generate an executable Python 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 elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is locat... |
user: Generate an executable Python 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 big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a mes... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ayush is a cashier at the shopping center. Recently his department has started a ''click and collect" service which allows users to sh... |
user: Generate an executable Python 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 wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([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.ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty 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.Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation!
Every day 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.Adieu l'ami.
Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School b... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.At the Byteland State University marks are strings of the same length. Mark x is considered better than y if string y is lexicographic... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.k people want to split n candies between them. Each candy should be given to exactly one of them or be thrown away.
The people are nu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.