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.There is a directed graph on n vertices numbered 1 through n where each vertex (except n) has two outgoing arcs, red and blue. At any ... |
user: Generate an executable Python 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. Calculate the number of pairs of arrays (a, b) such that:
* the length of both arrays is equal ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Everyone knows that agents in Valorant decide, who will play as attackers, and who will play as defenders. To do that Raze and Breach ... |
user: Generate an executable Python 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 got a job as a marketer in a pet shop, and your current task is to boost sales of cat food. One of the strategies is to sell cans ... |
user: Generate an executable Python 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 recent years John has very successfully settled at his new job at the office. But John doesn't like to idly sit around while his 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.One day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya ne... |
user: Generate an executable Python 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 rectangle grid. That grid's size is n × m. Let's denote the coordinate system on the grid. So, each point on the grid ... |
user: Generate an executable Python 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 fleas in Berland can jump only vertically and horizontally, and the length of the jump is always equal to s centimete... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Jeff got 2n real numbers a1, a2, ..., a2n as a birthday present. The boy hates non-integer numbers, so he decided to slightly "adjust"... |
user: Generate an executable Python 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 matrix consisting of digits zero and one, its size is n × m. You are allowed to rearrange its rows. What is the maximu... |
user: Generate an executable Python 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 assume that
* v(n) is the largest prime number, that does not exceed n;
* u(n) is the smallest prime number strictly great... |
user: Generate an executable Python 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 a recent research Berland scientists found out that there were n cities in Ancient Berland, joined by two-way paths. Any two ci... |
user: Generate an executable Python 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 army of n droids is lined up in one row. Each droid is described by m integers a1, a2, ..., am, where ai is the number of details o... |
user: Generate an executable Python 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 infinite sequence consisting of all positive integers in the increasing order: p = {1, 2, 3, ...}. We performed n swap ope... |
user: Generate an executable Python 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 Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorit... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.BerOilGasDiamondBank has branches in n cities, at that n is an even number. The bank management wants to publish a calendar with the 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.Author has gone out of the stories about Vasiliy, so here is just a formal task description.
You are given q queries and a multiset 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.A stowaway and a controller play the following game.
The train is represented by n wagons which are numbered with positive 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.You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out o... |
user: Generate an executable Python 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 Masha came home and noticed n mice in the corridor of her flat. Of course, she shouted loudly, so scared mice started to run 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.n children are standing in a circle and playing a game. Children's numbers in clockwise order form a permutation a1, a2, ..., an of 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.A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise 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 given n strings. Each string consists of lowercase English letters. Rearrange (reorder) the given strings in such a way that 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.Given an array a of N integers a1, a2, a3, ... aN you have to find the longest alternating sub-sequence of this array .
An alternat... |
user: Generate an executable Python 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 list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Dee Dee went to market to buy some eggs. There are 2 type of egg cartons available in the shop. One type contains 6 eggs and the other... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Thomson is very weak in set theory. Recently, he came across the following problem:
Given a set X with N distinct elements, in how man... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Monk has a very good friend, Puchi. As weird as his name, are the games he plays.
One fine day, they decided to play a game to test ho... |
user: Generate an executable Python 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 professor Ka has given a string task to Oz and RK. He has given a string STR consisting only of characters '(' and ')' and asked... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Roy is going to organize Finals of Coding Contest in his college's computer labs. According to the rules of contest, problem statement... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a list of names. Your task is to find all the distinct names in the list and after that
find the frequency count of 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.Utkarsh is going to Cherrapunji to visit his brother Saharsh. Cherrapunji faces one of largest rainfall in the country. So, Saharsh 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.You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.
The current tempera... |
user: Generate an executable Python 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 circular pond with a perimeter of K meters, and N houses around them.
The i-th house is built at a distance of A_i meters ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.E869120 has A 1-yen coins and infinitely many 500-yen coins.
Determine if he can pay exactly N yen using only these coins.
Constraint... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.We have a grid with N rows and M columns of squares. Initially, all the squares are white.
There is a button attached to each row 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."Fukusekiken" is a popular ramen shop where you can line up. But recently, I've heard some customers say, "I can't afford to have vaca... |
user: Generate an executable Python 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
You decide to invite your friends of the school and your friends of a friend to the Christmas party. The number of students 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.The surveyor starship Hakodate-maru is famous for her two fuel containers with unbounded capacities. They hold the same type of atomic... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Dr. Keith Miller is a researcher who studies the history of Island of Constitutional People’s Country (ICPC). Many studies by him 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.You are an employee of Automatic Cleaning Machine (ACM) and a member of the development team of Intelligent Circular Perfect Cleaner (... |
user: Generate an executable Python 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 the two dices constructed in the same way as Dice I, and determines whether these two dices are identical.... |
user: Generate an executable Python 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's younger brother is in town. He's a big football fan and has a very important match to watch tonight. But the Chef wants to watc... |
user: Generate an executable Python 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 any positive integer, we define a digit rotation as either moving the first digit
to the end of the number (left digit rotation), ... |
user: Generate an executable Python 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 planet of XANDOR was famous in the intergalactic empire for being home to the Carden - a race of super-intelligent computer scient... |
user: Generate an executable Python 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 string of letters in the input, return a string in the output with each words written in reverse order. Spaces and punctuation... |
user: Generate an executable Python 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, you bought a brand new smart lamp with programming features. At first, you set up a schedule to the lamp. Every day it will ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entir... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the luc... |
user: Generate an executable Python 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 final match of the Berland Football Cup has been held recently. The referee has shown n yellow cards throughout the match. At 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 given a binary string of length n (i. e. a string consisting of n characters '0' and '1').
In one move you can swap two adjac... |
user: Generate an executable Python 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 spring is coming and it means that a lot of fruits appear on the counters. One sunny day little boy Valera decided to go shopping.... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Wu got hungry after an intense training session, and came to a nearby store to buy his favourite instant noodles. After Wu paid for hi... |
user: Generate an executable Python 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 connected undirected graph with n vertices and an integer k, you have to either:
* either find an independent set that 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.You are given an array of integers a_1,a_2,…,a_n. Find the maximum possible value of a_ia_ja_ka_la_t among all five indices (i, j, k, ... |
user: Generate an executable Python 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 paparazzi working in Manhattan.
Manhattan has r south-to-north streets, denoted by numbers 1, 2,…, r in order from west 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.In the 2022 year, Mike found two binary integers a and b of length n (both of them are written only by digits 0 and 1) that can have 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.Ilya plays a card game by the following rules.
A player has several cards. Each card contains two non-negative integers inscribed, 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.The Little Elephant loves playing with arrays. He has array a, consisting of n positive integers, indexed from 1 to n. Let's denote 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.Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream 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.Parmida is a clever girl and she wants to participate in Olympiads this year. Of course she wants her partner to be clever too (althou... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors 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.The Shuseki Islands are an archipelago of 30001 small islands in the Yutampo Sea. The islands are evenly spaced along a line, numbered... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Many years have passed, and n friends met at a party again. Technologies have leaped forward since the last meeting, cameras with 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.Kefa decided to celebrate his first big salary by going to the restaurant.
He lives by an unusual park. The park is a rooted tree 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.When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equili... |
user: Generate an executable Python 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 problems prepared for the next Codeforces round. They are arranged in ascending order by their difficulty, and no two prob... |
user: Generate an executable Python 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 girl Alyona is in a shop to buy some copybooks for school. She study four subjects so she wants to have equal number of copyboo... |
user: Generate an executable Python 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 his birthday party, Timofey went to his favorite tree alley in a park. He wants to feed there his favorite birds — crows.
It'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.Since the giant heads have appeared in the sky all humanity is in danger, so all Ricks and Mortys from all parallel universes are gath... |
user: Generate an executable Python 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 kingdom lived the King, the Prince, the Shoemaker, the Dressmaker and many other citizens. They lived happily until grea... |
user: Generate an executable Python 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 problem is about a little pig named Benny. Benny was given an array of N integers and another separate integer X. Benny has to 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.A string is said to be complete if it contains all the characters from a to z. Given a string, check if it complete or not.
Input
Fir... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ikshu and his machine gun
To celebrate his new year Ikshu went to play "beyond to beyond" (abbreviated as BOB) with his friends.
BOB ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Rahul likes to play with mathematics and geometry and when it comes for 2D geometry, he just can’t stop himself doing experiments. Whi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Guri and Prary are good friends and are chocolate lovers. They win a lottery and get a chance to visit ChocoLand for few minutes.
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.Rachel works at a big Raf Laurens. There is a big event coming up and she has to select dresses for an exhibition.
She has N dresses 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.Given a sequence A1 , A2 , A3 .. AN of length N . Find total number of wave subsequences having length greater than 1.
Wave subsequen... |
user: Generate an executable Python 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 string S of length N. Initially, all characters in S are `1`s.
You will perform queries Q times. In the i-th query, you 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.You start with the number 0 and you want to reach the number N.
You can change the number, paying a certain amount of coins, with 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.We have N cards numbered 1, 2, ..., N. Card i (1 \leq i \leq N) has an integer A_i written in red ink on one side and an integer B_i 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.There are two buttons, one of size A and one of size B.
When you press a button of size X, you get X coins and the size of that butto... |
user: Generate an executable Python 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. Among the divisors of N! (= 1 \times 2 \times ... \times N), how many Shichi-Go numbers (literally "Seven-... |
user: Generate an executable Python 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 found a record of a tree with N vertices in ancient ruins. The findings are as follows:
* The vertices of the tree were numbere... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Takayuki and Kazuyuki are good twins, but their behavior is exactly the opposite. For example, if Takayuki goes west, Kazuyuki goes 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.Problem
You decide to play a weird game with your friend A, who loves gathering.
Given a set S of non-negative integers consisting o... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Square Route
Square root
English text is not available in this practice contest.
Millionaire Shinada, who has decided to build a ne... |
user: Generate an executable Python 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 space-time unified dimension sugoroku tournament. You are representing the Earth in the 21st century in the tournament, which deci... |
user: Generate an executable Python 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 issue is a reactive issue. It is necessary to create a program that derives the correct answer by interactively responding to 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.C: Divisor Game
problem
tsutaj is trying to play about a few games.
In a divisor game, a natural number N of 2 or more is given fir... |
user: Generate an executable Python 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
A mysterious $ X $ [cm] plant grows in one place. This plant has the following mysterious properties.
* Say "nobiro" to this... |
user: Generate an executable Python 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 edit distance between given two words s1 and s2.
The disntace is the minimum number of single-character edits required to 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.Today is the reunion of all chefs in the world. Our Chef wants to make this moment more happier. He arranged a mass wedding in this re... |
user: Generate an executable Python 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 A and B of the same length. Each string contains N Lower case Latin character (from 'a' to 'z'). A shift ope... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Natasha is planning an expedition to Mars for n people. One of the important tasks is to provide food for each participant.
The wareh... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Student Andrey has been skipping physical education lessons for the whole term, and now he must somehow get a passing grade on this su... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Not long ago Billy came across such a problem, where there were given three natural numbers A, B and C from the range [1, N], and it 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.Mike decided to teach programming to children in an elementary school. He knows that it is not an easy task to interest children 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.Linear Kingdom has exactly one tram line. It has n stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.