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.Chef loves triangles. But the chef is poor at maths. Given three random lengths Chef wants to find if the three sides form a right-ang... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Increasing COVID cases have created panic amongst the people of Chefland, so the government is starting to push for production of a va... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.“Jesse, you asked me if I was in the meth business, or the money business… Neither. I’m in the empire business.”
Walter’s sold his sta... |
user: Generate an executable Python 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 Fibonacci sequence is defined as F(n) = F(n-1) + F(n-2). You have developed two sequences of numbers. The first sequence that uses... |
user: Generate an executable Python 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 don't have any fancy quotes." - vijju123
Chef was reading some quotes by great people. Now, he is interested in classifying all 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.Chef has two piles of stones with him, one has n1 stones and the other has n2 stones. Fired up by boredom, he invented a game 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.The GoC Timber Mafia is notorious for its deforestation
activities in the forests near Siruseri. These activities have
increased multi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Meliodas and Ban are fighting over chocolates. Meliodas has $X$ chocolates, while Ban has $Y$. Whoever has lesser number of chocolates... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef is interested to solve series problems. Chef wants to solve a series problem but he can't
solve it till now.Can you help Chef 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.Chef usually likes to play cricket, but now, he is bored of playing it too much, so he is trying new games with strings. Chef's friend... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Anas is playing an amazing game on a grid with $N$ rows and $M$ columns. The rows are numbered $1$ through $N$ from top to bottom 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.Scheme? - Too loudly said. Just a new idea. Now Chef is expanding his business. He wants to make some new restaurants in the big city ... |
user: Generate an executable Python 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 an array A consisting of N integers. He also has an intger K.
Chef wants you to find out number of different arrays he can ob... |
user: Generate an executable Python 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 Tobby asked Bhuvan to brush up his knowledge of statistics for a test. While studying some distributions, Bhuvan learns the fact ... |
user: Generate an executable Python 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'm a fan of anything that tries to replace actual human contact." - Sheldon.
After years of hard work, Sheldon was finally able to d... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.A reversed arabic no is one whose digits have been written in the reversed order. However in this any trailing zeroes are omitted. 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.Sergey recently learned about country codes - two letter strings, denoting countries. For example, BY stands for Belarus and IN stands... |
user: Generate an executable Python 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 matrix B (consisting of integers) of dimension N × N is said to be good if there exists an array A (consisting of integers) such tha... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Ashley likes playing with strings.
She gives Mojo a fun problem to solve. In her imaginary string world, a string of even length is c... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Dhote and Shweta went on a tour by plane for the first time.Dhote was surprised by the conveyor belt at the airport.As Shweta was get... |
user: Generate an executable Python 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 is placing the laddus on the large square plat. The plat has the side of length N. Each laddu takes unit sq.unit area. Cheffi... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef is making polygon cakes in his kitchen today!
Since the judge panel is very strict, Chef's cakes must be beautiful and have shar... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Indian National Olympiad in Informatics 2016
Boing Inc, has N employees, numbered 1 ... N. Every employee other than Mr. Hojo (the he... |
user: Generate an executable Python 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 tennis tournament is about to take place with $N$ players participating in it.
Every player plays with every other player exactly 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.You like tracking airplane flights a lot. Specifically, you maintain history of an airplane’s flight at several instants and record th... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You must have tried to solve the Rubik’s cube. You might even have succeeded at it. Rubik’s cube is a 3x3x3 cube which has 6 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.Given an alphanumeric string made up of digits and lower case Latin characters only, find the sum of all the digit characters in the 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.You are given an integer sequence $A_1, A_2, \ldots, A_N$. For any pair of integers $(l, r)$ such that $1 \le l \le r \le N$, let's de... |
user: Generate an executable Python 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 this problem the input will consist of a number of lines of English text consisting of the letters of the English alphabet, the pun... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Kajaria has an empty bag and 2 types of tiles -
tiles of type $1$ have the number $X$ written and those of type $2$ have the 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.Devu loves to play with his dear mouse Jerry. One day they play a game on 2 dimensional grid of dimensions n * n (n ≥ 2). Jerry is cu... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.-----Problem Statement-----
You all must have played the game candy crush. So here is a bomb which works much the fruit bomb in candy ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Chef is now a corporate person. He has to attend office regularly. But chef does not want to go to office, rather he wants to stay hom... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Indian National Olympiad in Informatics 2012
You are given a table with 2 rows and N columns. Each cell has an integer in it. The scor... |
user: Generate an executable Python 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 problems on geometry a lot. Please help him to solve one such problem.
Find all possible triangles with integer sides which... |
user: Generate an executable Python 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 that reads numbers until -1 is not given.
The program finds how many of the given numbers are more than 30, $N$.
It 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.Mance Rayder, the King-Beyond-the-Wall, has always wanted to lead the largest army the North has ever seen against the NIght’s Watch. ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Master Oogway has forseen that a panda named Po will be the dragon warrior, and the master of Chi. But he did not tell anyone about 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.Chef is in need of money, so he decided to play a game with Ramsay. In this game, there are $N$ rows of coins (numbered $1$ through $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.Consider a currency system in which there are notes of six denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100.
If 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.After fixing the mercury leak, Kim has arrived in the planning room, where he finds a square map of a field, with $N$ rows and $N$ col... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Nobody outside the cooking community knows that Chef is a big fan of Chefgram™ — a social network where chefs and cooks upload their 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.During quarantine chef’s friend invented a game. In this game there are two players, player 1 and Player 2. In center of garden there ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Mr. Das is a teacher teaching for several years in a school. He is not computer savvy. Due to lockdown, now he has to take classes onl... |
user: Generate an executable Python 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 and his mother are going travelling. Chef's world consists of $N$ cities (numbered $1$ through $N$) connected by $N-1$ bidirectio... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Shivam owns a gambling house, which has a special wheel called The Wheel of Fortune.
This wheel is meant for giving free coins to peo... |
user: Generate an executable Python 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 girl named ''Akansha''. She is very fond of eating chocolates but she has a weak immune system due to which she gets cold a... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a function that accepts a square matrix (`N x N` 2D array) and returns the determinant of the matrix.
How to take the determinant of a matrix -- it is simplest to start... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a function called `sumIntervals`/`sum_intervals()` that accepts an array of intervals, and returns the sum of all the interval lengths. Overlapping intervals should only... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
You are given integer `n` determining set S = {1, 2, ..., n}. Determine if the number of k-element subsets of S is `ODD` or `EVEN` for given integer k.
# Example
Fo... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.We are given a certain number ```n``` and we do the product partitions of it.
```[59, 3, 2, 2, 2]``` is a product partition of ```1416``` because:
```
59 * 3 * 2 * 2 * 2 = 141... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Complete the solution so that it strips all text that follows any of a set of comment markers passed in. Any whitespace at the end of the line should also be stripped out.
*... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Connect Four
Take a look at wiki description of Connect Four game:
[Wiki Connect Four](https://en.wikipedia.org/wiki/Connect_Four)
The grid is 6 row by 7 columns, those b... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.### Lyrics...
Pyramids are amazing! Both in architectural and mathematical sense. If you have a computer, you can mess with pyramids even if you are not in Egypt at the time.... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In this kata we want to convert a string into an integer. The strings simply represent the numbers in words.
Examples:
* "one" => 1
* "twenty" => 20
* "two hundred forty-six... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create a function that differentiates a polynomial for a given value of `x`.
Your function will receive 2 arguments: a polynomial as a string, and a point to evaluate the equ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.My little sister came back home from school with the following task:
given a squared sheet of paper she has to cut it in pieces
which, when assembled, give squares the sides o... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.This kata generalizes [Twice Linear](https://www.codewars.com/kata/5672682212c8ecf83e000050). You may want to attempt that kata first.
## Sequence
Consider an integer sequen... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a function that counts how many different ways you can make change for an amount of money, given an array of coin denominations. For example, there are 3 ways to give ch... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The number ```89``` is the first positive integer that has a particular, curious property:
The square of ```89``` is ```7921```; ```89² = 7921```
The reverse of ```7921``` i... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Consider the following array:
```
[1, 12, 123, 1234, 12345, 123456, 1234567, 12345678, 123456789, 12345678910, 1234567891011...]
```
If we join these blocks of numbers, we c... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Sorting is one of the most basic computational devices used in Computer Science.
Given a sequence (length ≤ 1000) of 3 different key values (7, 8, 9), your task is... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Story:
In the realm of numbers, the apocalypse has arrived. Hordes of zombie numbers have infiltrated and are ready to turn everything into undead. The properties of zombies a... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Snail Sort
Given an `n x n` array, return the array elements arranged from outermost elements to the middle element, traveling clockwise.
```
array = [[1,2,3],
[... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given two numbers: 'left' and 'right' (1 <= 'left' <= 'right' <= 200000000000000)
return sum of all '1' occurencies in binary representations of numbers between 'left' and 'ri... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Let's define `increasing` numbers as the numbers whose digits, read from left to right, are never less than the previous ones: 234559 is an example of increasing number.
Conv... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
You are given a string `s`. Every letter in `s` appears once.
Consider all strings formed by rearranging the letters in `s`. After ordering these strings in dictio... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A product-sum number is a natural number N which can be expressed as both the product and the sum of the same set of numbers.
N = a1 × a2 × ... × ak = a1 + a2 + ... + ak
For... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Longest Palindromic Substring (Linear)
A palindrome is a word, phrase, or sequence that reads the same backward as forward, e.g.,
'madam' or 'racecar'. Even the letter 'x' ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.We have three numbers: ```123489, 5, and 67```.
With these numbers we form the list from their digits in this order ```[1, 5, 6, 2, 7, 3, 4, 8, 9]```. It shouldn't take you l... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given two strings s1 and s2, we want to visualize how different the two strings are.
We will only take into account the *lowercase* letters (a to z).
First let us count the fr... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# The Kata
Your task is to transform an input nested list into an hypercube list, which is a special kind of nested list where each level must have the very same size,
This Ka... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Task
Given a positive integer, `n`, return the number of possible ways such that `k` positive integers multiply to `n`. Order matters.
**Examples**
```
n = 24
k = 2
(1, 2... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are given 2 numbers is `n` and `k`. You need to find the number of integers between 1 and n (inclusive) that contains exactly `k` non-zero digit.
Example1
`
almost_ever... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The task is simply stated. Given an integer n (3 < n < 10^(9)), find the length of the smallest list of [*perfect squares*](https://en.wikipedia.org/wiki/Square_number) which ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.This is a very simply formulated task. Let's call an integer number `N` 'green' if `N²` ends with all of the digits of `N`. Some examples:
`5` is green, because `5² = 25` and... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create a function that takes a positive integer and returns the next bigger number that can be formed by rearranging its digits. For example:
```
12 ==> 21
513 ==> 531
2017 =... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.This is the performance version of [this kata](https://www.codewars.com/kata/59afff65f1c8274f270020f5).
---
Imagine two rings with numbers on them. The inner ring spins cloc... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.We want to generate all the numbers of three digits where:
- the sum of their digits is equal to 10.
- their digits are in increasing order (the numbers may have two or more... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A format for expressing an ordered list of integers is to use a comma separated list of either
* individual integers
* or a range of integers denoted by the starting integer ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Your task in order to complete this Kata is to write a function which formats a duration, given as a number of seconds, in a human-friendly way.
The function must accept a no... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.To give credit where credit is due: This problem was taken from the ACMICPC-Northwest Regional Programming Contest. Thank you problem writers.
You are helping an archaeologis... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.With your birthday coming up soon, your eccentric friend sent you a message to say "happy birthday":
hhhappyyyy biirrrrrthddaaaayyyyyyy to youuuu
hhapppyyyy biirtttth... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.This kata is blatantly copied from inspired by This Kata
Welcome
this is the second in the series of the string iterations kata!
Here we go!
-----------------------------... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.When we attended middle school were asked to simplify mathematical expressions like "3x-yx+2xy-x" (or usually bigger), and that was easy-peasy ("2x+xy"). But tell that to your... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are given a binary tree:
```python
class Node:
def __init__(self, L, R, n):
self.left = L
self.right = R
self.value = n
```
Your task is to r... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In this Kata we focus on finding a sum S(n) which is the total number of divisors taken for all natural numbers less or equal to n. More formally, we investigate the sum of n ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Complete the function/method (depending on the language) to return `true`/`True` when its argument is an array that has the same nesting structures and same corresponding leng... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Description
Given an array X of positive integers, its elements are to be transformed by running the following operation on them as many times as required:
```if X[i] > X... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Unflatten a list (Harder than easy)
This is the harder version of Unflatten a list (Easy)
So you have again to build a method, that creates new arrays, that can be flatten... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Alice has a hand of cards, given as an array of integers.
Now she wants to rearrange the cards into groups so that each group is size W, and consists of W consecutive cards.
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.Andre has very specific tastes. Recently he started falling in love with arrays.
Andre calls an nonempty array $b$ good, if sum of 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.per nextum in unam tum XI conscribementis fac sic
vestibulo perlegementum da varo.
morde varo.
seqis cumula varum.
cis... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a square grid of integers arr, a falling path with non-zero shifts is a choice of exactly one element from each row of arr, such that no two elements chosen in adjacent ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.You are given a set of points in the 2D plane. You start at the point with the least X and greatest Y value, and end at the point with... |
user: Generate an executable Python 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 found a new game and now he wants you to help him to get as much points as possible.
Rules of the game: There are 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.Indian National Olympiad in Informatics 2015
In this problem you are given two lists of N integers, a1, a2, ..., aN and b1, b2, ... bN... |
user: Generate an executable Python 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 two integer sequences $A_1, A_2, \ldots, A_N$ and $B_1, B_2, \ldots, B_M$. You should choose $N+M-1$ pairs, each in the form ... |
user: Generate an executable Python function generated from the given prompt. The function should take stdin as input and print the output. Simply call the function after the definition.Raavan gave a problem to his son, Indrajeet, and asked him to solve the problem to prove his intelligence and power. The Problem was 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.-----Description-----
The Antique Comedians of India prefer comedies to tragedies. Unfortunately, most of the ancient plays are traged... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.