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.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
In Chefland, each citizen 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.Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are the owner of a big company. Yo... |
user: Generate an executable Python 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$ distinct positive integers.
Let's consider an infinite integer set $S$ which contains 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.Read problems statements in Mandarin Chinese and Russian.
Chef passed all the exams. This month was really tiring. So, he decided 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.Read problems statements in [Mandarin Chinese], [Russian], [Vietnamese] and [Bengali] as well.
You have taken an eating challenge fro... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given an array A of N integers and an integer K. Find the number of (possibly empty) [subsequences] of A such that no two elem... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Eric has four integers $a$, ${b}$, ${c}$, and ${d}$.
Instantly, he wondered how many pairs of integers, $(x,y)$, satisfy 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.You are given an integer $k$ and a string $s$ that consists only of characters 'a' (a lowercase Latin letter) and '*' (an asterisk).
... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin Chinese and Russian.
Chef has an array containing N integers. You have to make M queries. Each... |
user: Generate an executable Python 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 integer $n$, there is a tower built from $3^{n}$ blocks stacked vertically. Each of these blocks can be colored in $3$ dif... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin Chinese and Russian.
Churu is working as a data scientist in Coderpur. He works on a lot of da... |
user: Generate an executable Python 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.
Consider the following definitions:
*Prefix xor array* of an array A is defined ... |
user: Generate an executable Python 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 has a sequence of N integers A_{1}, A_{2},\dots, A_{N}. He defines a function f(i, j) as follows:
f(i, j) = A_{i} + max(A_{i}, 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.Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer N. Consider 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.Read problems statements in Mandarin Chinese .
In this problem you will have to implement a simple editor. The editor maintains 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.There are n+1 (0 < n ≤ 10^{9}, indexed 0..n) houses lying on a straight street. One day, they are bombed by an enemy. CodeChef is desi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Stack has a positive integer P(P > 1).
He starts a game where his initial score is 0.
In the i^{th} turn, with a probability of \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.A batch of $n$ goods ($n$ — an even number) is brought to the store, $i$-th of which has weight $a_i$. Before selling the goods, they ... |
user: Generate an executable Python 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 fast-food chain menu is selling a burger, a can of soda, and a combo meal containing a burger and a can of soda, at prices known 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.Monocarp had a sequence $a$ consisting of $n + m$ integers $a_1, a_2, \dots, a_{n + m}$. He painted the elements into two colors, red ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.------Read problems statements in Mandarin chinese
, Russian and Vietnamese as well. ------
It's well known that our friend Balsa 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.Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given N *distinct* points 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.Chef likes to spend his summer vacation playing with strings. Chef likes alternating patterns, but he only likes the characters \textt... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Faizal is very sad after finding out that he is responsible for Sardar's death. He tries to drown his sorrows in alcohol and gets very... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
JJ has a magical sequence $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.We define a $hackonacci$ series as follows:
$hackonacci(n)=1\cdot hackonacci(n-1)+2\cdot hackon acesi(n-2)+3\cdot hackon aci(n-3)$ ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Shashank is a newbie to mathematics, and he is very excited after knowing that a given l of cardinality N has (2^{N} - 1) non-empty 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.Suppose you have an integer $v$. In one operation, you can:
either set $v = (v + 1) mod 32768$
or set $v = (2 \cdot v) mod 32768$.
... |
user: Generate an executable Python 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 chits, out of which, A chits have 1 written on them and B (A+B = N) chits have 0 written on them.
Chef and Chefina are ta... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Matryoshka is a wooden toy in the form of a painted doll, inside which you can put a similar doll of a smaller size.
A set of nesting... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chinese Version
Russian Version
Define a 3-D Matrix in which each block contains 0 initially. The first block is defined by the coor... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.With the help of the tessaract, the Chitauri army is ready to attack planet Earth. It's finally time when the Avengers must get togeth... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Sardar Khan has finally decided to attack Ramadhir - he will bomb one of Ramadhir's businesses in Wasseypur. Sardar Khan knows that Ra... |
user: Generate an executable Python 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 permutation of length $n$ is an array consisting of $n$ distinct integers from $1$ to $n$ in arbitrary order. For example, $[2,3,1,5... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
There are $N$ frogs (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.Chef prepared two dishes yesterday. Chef had assigned the \textbf{tastiness} T_{1} and T_{2} to the first and to the second dish respe... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Mandarin Chinese] and [Bengali].
There are N positions in a queue. Given a *binary string* S of length 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._"I hide in plain sight, just as you"_.
Gus Fring has earned a huge profit from Los Pollos Hermanos and he wishes to celebrate. He lo... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a sequence whose $n^{\text{th}}$ term is
$T_n=n^K\times R^n$
You have to evaluate the series
$S_n=T_1+T_2+T_3+\cdots+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.Rohit dreams he is in a shop with an infinite amount of marbles. He is allowed to select n marbles. \
There are marbles of k different... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
When Chef was visiting a fair ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Shashank is very excited after learning about the linked list. He learned about how to merge two linked lists. When we merge two linke... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in mandarin chinese, russian and vietnamese as well.
There are n courses in a university being offered. 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.Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well.
Every time Rami comes up wit... |
user: Generate an executable Python 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 was a string $s$ which was supposed to be encrypted. For this reason, all $26$ lowercase English letters were arranged in a circ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an array A consisting 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.Read problems statements in Mandarin Chinese and Russian.
This time Chef does not want to bother you with long story, so the problem... |
user: Generate an executable Python 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 Ashish is doing internship at multiple places. Instead of giving parties to his friends he decided to donate candies to childre... |
user: Generate an executable Python 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 friends who decided to play the game of musical chairs one day.
Initially they decide a number K and with each passing ro... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
.
Chef offers delicious food 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.Sansa has an array. She wants to find the value obtained by XOR-ing the contiguous subarrays, followed by XOR-ing the values thus obta... |
user: Generate an executable Python 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 binary square matrices $a$ and $b$ of size $n \times n$. A matrix is called binary if each of its elements 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.There are $2\times N$ nodes in an undirected graph, and a number of edges connecting some nodes. In each edge, the first value will 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.There are N tasks waiting in line to be executed. The execution time for the i^{th} task is A_{i} seconds.
Chef has two processors 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.Read problem statements in [Russian], [Bengali], and [Mandarin Chinese] as well.
Ann is going to take part in a race. At the start, 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.A rectangle with its opposite corners in $(0, 0)$ and $(w, h)$ and sides parallel to the axes is drawn on a plane.
You are given a 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.Read problems statements in English, Mandarin Chinese and Russian as well.
Richard Winters: We're not lost, Private... we're in Norm... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given $N$ points (num... |
user: Generate an executable Python 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 consider two sequences of integers, $a_0,a_1,\ldots,a_{n-1}$ and $b_0,b_1,\ldots,b_{n-1}$, to be similar if there exists a polynomi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.British mathematician John Littlewood once said about Indian mathematician Srinivasa Ramanujan that "every positive integer was one 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.Mark is an undergraduate student and he is interested in rotation. A conveyor belt competition is going on in the town which Mark want... |
user: Generate an executable Python 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. Let K be a divisor of N of your choice such that K > 1, and let M = \frac{N}{K}. You need to find the smal... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Random number generator
There is an ideal random number generator, which given a positive integer M can generate any real number betw... |
user: Generate an executable Python 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 arrays A and B of length N each. Determine the number of *good* pairs.
A pair (i,j) (1≤ i,j ≤ N) is said to be *good* 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.Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
Chef recently discovered a function $XOR()$, which com... |
user: Generate an executable Python 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 call a sequence of $n$ non-negative integers, ${A}$, awesome if there exists some positive integer $x>1$ such that each element $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.Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef found a matrix $A$ with $N$ rows ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin Chinese and Russian.
Sereja had an non-negative integer A in the range [0, 10^{100}].
One day,... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Russian here
Little Chef is trying to learn exponents. He is especially interested in a number raised 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.The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second 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.You have two positive integers $a$ and $b$.
You can perform two kinds of operations:
$a = \lfloor \frac{a}{b} \rfloor$ (replace $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.Devendra loves the XOR operation very much which is denoted by $\land\operatorname$ sign in most of the programming languages. He 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.Read problems statements in Mandarin Chinese , Russian and Vietnamese as well.
Read problems statements in Mandarin Chinese , Russi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Chef is stuck in a two dimensional maze having N rows ... |
user: Generate an executable Python 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 is playing a computer game. Now he wants to complete the first level of this game.
A level is a rectangular grid of $2$ rows... |
user: Generate an executable Python 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 another integer X (X > N) such that the following conditions are satisfied :
1. X is not a multiple ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Alice and Bob are given an array of length of N. They decide to play a game with it.
Initially, Alice randomly shuffles the array, 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.Read problems statements in [Mandarin Chinese], [Russian], [Vietnamese] and [Bengali] as well.
Deep wants to become a 7-star coder 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.Read problem statements in [Mandarin Chinese], [Russian], and [Vietnamese] as well.
In a Chess match "a + b", each player has a clock... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Finally, progress reached the Madoka 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.The Olympic Games have just started and Federico is eager to watch the marathon race.
There will be $n$ athletes, numbered from $1$ 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.Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef has no work to do 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.Let there be a K-dimensional Hyperrectangle, where each dimension has a length of n_{1},n_{2},...n_{k}.
Each of the Hyperrectangle'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.Luigi has an array A of N positive integers. He wants to make all elements of the array equal.
In one move, he can:
Choose an index ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a [tree] with N nodes rooted at node 1.
The i^{th} node of the tree has a value A_{i} assigned to it.
For the i^{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.$n$ distinct integers $x_1,x_2,\ldots,x_n$ are written on the board. Nezzar can perform the following operation multiple times.
Selec... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Vlad came home and found out that someone had reconfigured the old thermostat to the temperature of $a$.
The thermostat can only be 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.Polycarp takes part in a math show. He is given *n* tasks, each consists of *k* subtasks, numbered 1 through *k*. It takes him *t**j* ... |
user: Generate an executable Python 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 consider a positive integer perfect, if and only if the sum of its digits is exactly $10$. Given a positive integer $k$, your task ... |
user: Generate an executable Python 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 at the lesson Vitya learned a very interesting function — mex. Mex of a sequence of numbers is the minimum non-negative number 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.One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the bet... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Polycarpus has an array, consisting of *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Polycarpus likes it when numbers in an array match. 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.*n* hobbits are planning to spend the night at Frodo's house. Frodo has *n* beds standing in a row and *m* pillows (*n*<=≤<=*m*). Each... |
user: Generate an executable Python 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're given a tree with $n$ vertices.
Your task is to determine the maximum possible number of edges that can be removed in such 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.Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The 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.There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. *n* particles will be 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.A + B is often used as an example of the easiest problem possible to show some contest platform. However, some scientists have observe... |
user: Generate an executable Python 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 directed graph with *n* nodes and *m* edges, with all edges having a certain weight.
There might be multiple edges 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.One day, ZS the Coder wrote down an array of integers *a*<=with elements *a*1,<=<=*a*2,<=<=...,<=<=*a**n*.
A subarray of the array *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.The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.