sample_id stringlengths 6 12 | problem stringlengths 90 14k | starter_code stringlengths 0 952 | test_spec_json stringlengths 39 74M | difficulty stringclasses 5
values | llama31_8b_solve_rate float64 0 1 | llama31_8b_mean_test_pass_rate float64 0 1 |
|---|---|---|---|---|---|---|
apps_4736 | How many bees are in the beehive?
* bees can be facing UP, DOWN, LEFT, or RIGHT
* bees can share parts of other bees
Examples
Ex1
```
bee.bee
.e..e..
.b..eeb
```
*Answer: 5*
Ex2
```
bee.bee
e.e.e.e
eeb.eeb
```
*Answer: 8*
# Notes
* The hive may be empty or null/None/nil/...
* Python: the hive is passe... |
def how_many_bees(hive):
| {"fn_name": "how_many_bees", "inputs": [[null]], "outputs": [[0]]} | introductory | 0.953125 | 0.953125 |
apps_4234 | Consider a pyramid made up of blocks. Each layer of the pyramid is a rectangle of blocks, and the dimensions of these rectangles increment as you descend the pyramid. So, if a layer is a `3x6` rectangle of blocks, then the next layer will be a `4x7` rectangle of blocks. A `1x10` layer will be on top of a `2x11` layer o... |
def num_blocks(w, l, h):
| {"fn_name": "num_blocks", "inputs": [[1, 1, 2], [2, 4, 3], [1, 10, 10], [20, 30, 40]], "outputs": [[5], [47], [880], [83540]]} | introductory | 0.671875 | 0.683594 |
apps_3731 | This is simple version of harder [Square Sums](/kata/square-sums).
# Square sums
Write function `square_sums_row` (or `squareSumsRow`/`SquareSumsRow` depending on language rules) that, given integer number `N` (in range `2..43`), returns array of integers `1..N` arranged in a way, so sum of each 2 consecutive numbers... |
def square_sums_row(n):
| {"fn_name": "square_sums_row", "inputs": [[5], [24]], "outputs": [[false], [false]]} | introductory | 0.4375 | 0.453125 |
taco_1019253 | Given a string s and an array of integers cost where cost[i] is the cost of deleting the ith character in s.
Return the minimum cost of deletions such that there are no two identical letters next to each other.
Notice that you will delete the chosen characters at the same time, in other words, after deleting a characte... | class Solution:
def minCost(self, s: str, cost: List[int]) -> int:
| {"fn_name": "minCost", "inputs": [["\"abaac\"", [1, 2, 3, 4, 5]]], "outputs": [4]} | MEDIUM | 0.015625 | 0.015625 |
taco_1007074 | The Little Elephant loves playing with arrays. He has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai.
Additionally the Little Elephant has m queries to the array, each query is characterised by a pair of integers lj and rj (1 ≤ lj ≤ rj ≤ n). For each query ... | {"inputs": ["6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 6\n", "1 2\n1\n1 1\n1 1\n", "1 1\n1000000000\n1 1\n", "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 3\n", "6 6\n1 2 2 3 2 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 6\n", "6 6\n1 2 2 3 3 3\n1 2\n2 2\n2 3\n2 4\n4 6\n1 3\n", "1 1\n1100000000\n1 1\n", "7 2\n3 1 2 2 3 6 7\n1 7\n... | MEDIUM_HARD | 0.015625 | 0.088848 | |
taco_1019167 | A population of bears consists of black bears, brown bears, and white bears.
The input is an array of two elements.
Determine whether the offspring of the two bears will return `'black'`, `'brown'`, `'white'`, `'dark brown'`, `'grey'`, `'light brown'`, or `'unknown'`.
Elements in the the array will always be a stri... | def bear_fur(bears):
| {"fn_name": "bear_fur", "inputs": [[["black", "black"]], [["white", "white"]], [["brown", "brown"]], [["black", "brown"]], [["black", "white"]], [["white", "brown"]], [["pink", "black"]]], "outputs": [["black"], ["white"], ["brown"], ["dark brown"], ["grey"], ["light brown"], ["unknown"]]} | EASY | 0.296875 | 0.607143 |
apps_250 | There are N workers. The i-th worker has a quality[i] and a minimum wage expectation wage[i].
Now we want to hire exactly K workers to form a paid group. When hiring a group of K workers, we must pay them according to the following rules:
Every worker in the paid group should be paid in the ratio of their quality co... |
class Solution:
def mincostToHireWorkers(self, quality: List[int], wage: List[int], K: int) -> float:
| {"fn_name": "mincostToHireWorkers", "inputs": [[[10, 20, 5], [70, 50, 30], 2]], "outputs": [105.0]} | interview | 0.046875 | 0.046875 |
taco_1011416 | Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
Consider the following algorithm, which generates a (not necessarily uniformly) random permutation of numbers $1$ through $N$:
P := [1, 2, ..., N]
for i in 1..N do
j := rand(1, N)
swap(P[i], P[j])
Here, rand(1, N) ... | {"inputs": ["2"], "outputs": ["1 2\n2 1"]} | MEDIUM_HARD | 0.375 | 0.375 | |
taco_1009938 | # Definition (Primorial Of a Number)
*Is similar to factorial of a number*, **_In primorial_**, not all the natural numbers get multiplied, **_only prime numbers are multiplied to calculate the primorial of a number_**. It's denoted with **_P_****_#_** and it is the product of the first n prime numbers.
___
# Task
... | def num_primorial(n):
| {"fn_name": "num_primorial", "inputs": [[3], [4], [5], [8], [9]], "outputs": [[30], [210], [2310], [9699690], [223092870]]} | EASY | 0.921875 | 0.921875 |
taco_1006840 | Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Eidi gifts are a tradition in which children receive money from elder relatives during the Eid celebration.
Chef has three children (numbered $1, 2, 3$) and he wants to give them Eidi gifts. The oldest child, Chefu... | {"inputs": ["5\n5 7 10 10 20 50\n5 5 5 20 10 20\n10 1 17 5 10 15\n3 6 3 8 10 9\n8 5 5 50 10 10"], "outputs": ["FAIR\nNOT FAIR\nNOT FAIR\nNOT FAIR\nFAIR"]} | EASY | 0.046875 | 0.046875 | |
taco_1010256 | You have n dices each one having s sides numbered from 1 to s.
How many outcomes add up to a specified number k?
For example if we roll four normal six-sided dices we
have four outcomes that add up to 5.
(1, 1, 1, 2)
(1, 1, 2, 1)
(1, 2, 1, 1)
(2, 1, 1, 1) | def outcome(n, s, k):
| {"fn_name": "outcome", "inputs": [[1, 6, 0], [1, 0, 1], [0, 6, 1], [1, 6, 1], [1, 6, 2], [1, 6, 3], [1, 6, 4], [1, 6, 5], [1, 6, 6], [1, 6, 7], [2, 6, 1], [2, 6, 2], [2, 6, 3], [2, 6, 4], [2, 6, 5], [2, 6, 6], [2, 6, 7], [2, 6, 8], [2, 6, 9], [2, 6, 10], [2, 6, 11], [2, 6, 12], [2, 6, 13], [3, 6, 6], [3, 6, 9], [3, 6, ... | EASY | 0.265625 | 0.386719 |
taco_1008753 | You have N balls and K boxes. You want to divide the N balls into K boxes such that:
Each box contains ≥ 1 balls.
No two boxes contain the same number of balls.
Determine if it is possible to do so.
------ Input Format ------
- The first line contains a single integer T — the number of test cases. Then the test ca... | {"inputs": ["4\n3 4\n30 3\n2 2\n1 1\n"], "outputs": ["NO\nYES\nNO\nYES\n"]} | EASY | 0.328125 | 0.328125 | |
taco_1008323 | Given an array A of non-negative integers, return the maximum sum of elements in two non-overlapping (contiguous) subarrays, which have lengths L and M. (For clarification, the L-length subarray could occur before or after the M-length subarray.)
Formally, return the largest V for which V = (A[i] + A[i+1] + ... + A[i+... | class Solution:
def maxSumTwoNoOverlap(self, A: List[int], L: int, M: int) -> int:
| {"fn_name": "maxSumTwoNoOverlap", "inputs": [[[0, 6, 5, 2, 2, 5, 1, 9, 4], 1, 2]], "outputs": [20]} | MEDIUM | 0.203125 | 0.203125 |
taco_1020571 | People in Chefland have three different eye colors, namely brown, blue, and green. green is the rarest of the eye colors whereas brown is most common.
The eye color of the child of two people is most likely to be the most common eye color between them.
You are given two characters denoting the eye colors of two peop... | {"inputs": ["R B\n", "B B\n", "G B\n"], "outputs": ["R", "B", "B"]} | EASY | 0.5 | 0.697917 | |
taco_1010637 | There is a right triangle ABC with ∠ABC=90°.
Given the lengths of the three sides, |AB|,|BC| and |CA|, find the area of the right triangle ABC.
It is guaranteed that the area of the triangle ABC is an integer.
-----Constraints-----
- 1 \leq |AB|,|BC|,|CA| \leq 100
- All values in input are integers.
- The area of t... | {"inputs": ["3 4 5\n", "5 12 13\n", "45 28 53\n", "12 16 20\n", "24 10 26\n", "6 8 10\n", "35 84 91\n", "24 7 25\n", "28 96 100\n", "13 84 85\n", "8 15 17\n", "28 45 53\n", "77 36 85\n", "3 3 5", "45 38 53", "5 18 13", "0 3 5", "45 30 53", "5 24 13", "45 49 53", "5 13 13", "18 49 53", "1 10 1", "1 6 13", "18 97 37", "3... | EASY | 0.109375 | 0.391164 | |
taco_1014723 | ChefTown is the biggest city and the capital of ChefLand. There are N beautiful buildings: restaurants, museums, living houses with large kitchens and so on. Every building has its height. For every i (1≤i≤N) there is exactly one building with height i. The buildings are located in a single line from left to right. The... | {"inputs": ["2 1\n2 1", "4 2\n1 2 3 4"], "outputs": ["2", "3"]} | MEDIUM_HARD | 0.125 | 0.203125 | |
taco_1009522 | # Task
Given array of integers, for each position i, search among the previous positions for the last (from the left) position that contains a smaller value. Store this value at position i in the answer. If no such value can be found, store `-1` instead.
# Example
For `items = [3, 5, 2, 4, 5]`, the output should be... | def array_previous_less(arr):
| {"fn_name": "array_previous_less", "inputs": [[[3, 5, 2, 4, 5]], [[2, 2, 1, 3, 4, 5, 5, 3]], [[3, 2, 1]]], "outputs": [[[-1, 3, -1, 2, 4]], [[-1, -1, -1, 1, 3, 4, 4, 1]], [[-1, -1, -1]]]} | EASY | 0.375 | 0.494792 |
taco_1024979 | You can perform the following operations on the string, $a$:
Capitalize zero or more of $a$'s lowercase letters.
Delete all of the remaining lowercase letters in $a$.
Given two strings, $a$ and $\boldsymbol{b}$, determine if it's possible to make $a$ equal to $\boldsymbol{b}$ as described. If so, print YES on a new... | {"inputs": ["1\ndaBcd\nABC\n"], "outputs": ["YES\n"]} | MEDIUM | 0.0625 | 0.0625 | |
apps_4514 | In this Kata you must convert integers numbers from and to a negative-base binary system.
Negative-base systems can accommodate all the same numbers as standard place-value systems, but both positive and negative numbers are represented without the use of a minus sign (or, in computer representation, a sign bit); this... |
def int_to_negabinary(i):
| {"fn_name": "int_to_negabinary", "inputs": [[0], [6], [-6], [45], [-45], [4587], [-4587], [65535], [65536], [-65536], [2147483648], [-2147483648]], "outputs": [["0"], ["11010"], ["1110"], ["1111101"], ["11010111"], ["1011000111111"], ["11001000010101"], ["10000000000000011"], ["10000000000000000"], ["110000000000000000... | introductory | 0.296875 | 0.352865 |
taco_1025368 | Professor GukiZ likes programming contests. He especially likes to rate his students on the contests he prepares. Now, he has decided to prepare a new contest.
In total, n students will attend, and before the start, every one of them has some positive integer rating. Students are indexed from 1 to n. Let's denote the... | {"inputs": ["8\n153 100 87 14 10 8 6 5\n", "70\n11 54 37 62 1 46 13 17 38 47 28 15 63 5 61 34 49 66 32 59 3 41 58 28 23 62 41 64 20 5 14 41 10 37 51 32 65 46 61 8 15 19 16 44 31 42 19 46 66 25 26 58 60 5 19 18 69 53 20 40 45 27 24 41 32 23 57 56 62 10\n", "11\n5 6 4 2 9 7 6 6 6 6 7\n", "2\n2000 2000\n", "3\n500 501 502... | EASY | 0.078125 | 0.174107 | |
taco_1019122 | #Detail
[Countdown](https://en.wikipedia.org/wiki/Countdown_(game_show) is a British game show with number and word puzzles. The letters round consists of the contestant picking 9 shuffled letters - either picking from the vowel pile or the consonant pile. The contestants are given 30 seconds to try to come up with th... | def longest_word(letters):
| {"fn_name": "longest_word", "inputs": [[""], ["MKMKMKMKM"], ["IIIWUGEZI"]], "outputs": [[null], [null], [null]]} | EASY | 0.3125 | 0.34375 |
apps_1375 | -----Problem description.-----
This problem deals with the I/O methods used in codechef.
You are supposed to print the integer in its reverse form , or in simple words, print the reverse of the given integer . For instance , reverse of 120 is 21 (not 021) .
-----Input-----
- The first line of each test case contai... | {"inputs": [["3", "1234", "4567", "1"]], "outputs": [["4321", "7654", "1"]]} | interview | 0.984375 | 0.984375 | |
apps_1548 | “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 stack in Gray Matter Technologies, a company which he deserved half a credit, for peanuts. Now this company is worth a billion dollar company. Walter wants to get it's shares to have his Em... | {"inputs": [["2", "5", "6 5 5 5 2", "5", "1 2 3 4 5"]], "outputs": [["6 5 4 3 2", "1 2 3 4 5"]]} | interview | 0.328125 | 0.328125 | |
taco_1013124 | You have N items and a bag of strength W.
The i-th item has a weight of w_i and a value of v_i.
You will select some of the items and put them in the bag.
Here, the total weight of the selected items needs to be at most W.
Your objective is to maximize the total value of the selected items.
-----Constraints-----
- 1 ... | {"inputs": ["4 6\n2 1\n3 4\n4 10\n3 4\n", "4 6\n2 1\n3 7\n4 10\n3 6\n", "4 10\n1 100\n1 100\n1 100\n1 100\n", "4 1\n10 100\n10 100\n10 100\n10 100\n"], "outputs": ["11\n", "13\n", "400\n", "0\n"]} | MEDIUM_HARD | 0.609375 | 0.734375 | |
apps_1200 | Two sisters, A and B, play the piano every day. During the day, they can play in any order. That is, A might play first and then B, or it could be B first and then A. But each one of them plays the piano exactly once per day. They maintain a common log, in which they write their name whenever they play.
You are given t... | {"inputs": [["4", "AB", "ABBA", "ABAABB", "AA"]], "outputs": [["yes", "yes", "no", "no"]]} | interview | 0.078125 | 0.078125 | |
apps_1325 | Teacher brought a fruit basket for three students. The basket contains only Apples, Mangoes and Oranges. Student A knows a value $a$, the total number of Apples and Mangoes in the Basket, B knows a value $b$, the total number of Mangoes and Oranges in the basket and Student C knows a value $c$, the total number of Oran... | {"inputs": [["2", "7 9 8 12", "3 8 7 9"]], "outputs": [["3 4 5", "1 2 6"]]} | interview | 0.078125 | 0.078125 | |
taco_1013203 | Yaroslav has an array that consists of n integers. In one second Yaroslav can swap two neighboring array elements. Now Yaroslav is wondering if he can obtain an array where any two neighboring elements would be distinct in a finite time.
Help Yaroslav.
-----Input-----
The first line contains integer n (1 ≤ n ≤ 100)... | {"inputs": ["1\n1\n", "3\n1 1 2\n", "4\n7 7 7 7\n", "4\n479 170 465 146\n", "5\n996 437 605 996 293\n", "6\n727 539 896 668 36 896\n", "7\n674 712 674 674 674 674 674\n", "8\n742 742 742 742 742 289 742 742\n", "9\n730 351 806 806 806 630 85 757 967\n", "10\n324 539 83 440 834 640 440 440 440 440\n", "7\n925 830 925 98... | EASY | 0.09375 | 0.555159 | |
taco_1022175 | In this Kata, you will be given an array of arrays and your task will be to return the number of unique arrays that can be formed by picking exactly one element from each subarray.
For example: `solve([[1,2],[4],[5,6]]) = 4`, because it results in only `4` possiblites. They are `[1,4,5],[1,4,6],[2,4,5],[2,4,6]`.
``... | def solve(arr):
| {"fn_name": "solve", "inputs": [[[[1, 2], [4], [5, 6]]], [[[1, 2], [4, 4], [5, 6, 6]]], [[[1, 2], [3, 4], [5, 6]]], [[[1, 2, 3], [3, 4, 6, 6, 7], [8, 9, 10, 12, 5, 6]]]], "outputs": [[4], [4], [8], [72]]} | EASY | 0.625 | 0.691406 |
taco_1018200 | An array is defined to be `odd-heavy` if it contains at least one odd element and every element whose value is `odd` is greater than
every even-valued element.
eg.
```
Array [11,4,9,2,8] is odd-heavy
because:- its odd elements [11,9] are greater than all the even elements [4,2,8]
Array [11,4,9,2,3,10] is not odd-h... | def is_odd_heavy(arr):
| {"fn_name": "is_odd_heavy", "inputs": [[[0, 2, 19, 4, 4]], [[1, -2, -1, 2]], [[-3, 2, 1, 3, -1, -2]], [[3, 4, -2, -3, -2]], [[-1, 1, -2, 2, -2, -2, -4, 4]], [[-1, -2, 21]], [[0, 0, 0, 0]], [[0, -1, 1]], [[0, 2, 3]], [[0]], [[]], [[1]], [[0, 1, 2, 3, 4, 0, -2, -1, -4, -3]], [[1, -1, 3, -1]], [[1, -1, 2, -2, 3, -3, 0]], ... | EASY | 0.46875 | 0.883681 |
apps_3373 | Write a function that accepts two square (`NxN`) matrices (two dimensional arrays), and returns the product of the two. Only square matrices will be given.
How to multiply two square matrices:
We are given two matrices, A and B, of size 2x2 (note: tests are not limited to 2x2). Matrix C, the solution, will be equal ... |
def matrix_mult(a, b):
| {"fn_name": "matrix_mult", "inputs": [[[[1, 2], [3, 2]], [[3, 2], [1, 1]]], [[[9, 7], [0, 1]], [[1, 1], [4, 12]]], [[[1, 2, 3], [3, 2, 1], [2, 1, 3]], [[4, 5, 6], [6, 5, 4], [4, 6, 5]]]], "outputs": [[[[5, 4], [11, 8]]], [[[37, 93], [4, 12]]], [[[28, 33, 29], [28, 31, 31], [26, 33, 31]]]]} | introductory | 0.828125 | 0.838542 |
taco_1014222 | Two deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest.
In this game, an honest player always tells the truth, and an dishonest player always tell lies.
You are given two characters a and b as the input. Each of them is either H or D, and carries the following information:
If a=H, AtCoDeer is h... | {"inputs": ["H H\n", "D H\n", "D D\n", "H I", "E H", "I H", "F H", "G H", "J H", "H J", "H G", "H K", "H F", "H L", "H E", "K H", "H D", "C H", "H M", "L H", "H C", "B H", "M H", "H B", "A H", "N H", "O H", "H A", "H N", "H O", "H P", "@ H", "? H", "P H", "H @", "H Q", "H ?", "H >", "> H", "H =", "H R", "Q H", "H <", "... | EASY | 0.484375 | 0.543632 | |
apps_2889 | Bob has ladder. He wants to climb this ladder, but being a precocious child, he wonders about exactly how many ways he could to climb this `n` size ladder using jumps of up to distance `k`.
Consider this example...
n = 5\
k = 3
Here, Bob has ladder of length 5, and with each jump, he can ascend up to 3 steps (he can... |
def count_ways(n, k):
| {"fn_name": "count_ways", "inputs": [[1, 3], [3, 3], [2, 3], [5, 3], [4, 3], [10, 6], [14, 7]], "outputs": [[1], [4], [2], [13], [7], [492], [7936]]} | introductory | 0.609375 | 0.669643 |
apps_3551 | # Task
Given array of integers, for each position i, search among the previous positions for the last (from the left) position that contains a smaller value. Store this value at position i in the answer. If no such value can be found, store `-1` instead.
# Example
For `items = [3, 5, 2, 4, 5]`, the output should be... |
def array_previous_less(arr):
| {"fn_name": "array_previous_less", "inputs": [[[3, 5, 2, 4, 5]], [[2, 2, 1, 3, 4, 5, 5, 3]], [[3, 2, 1]]], "outputs": [[[-1, 3, -1, 2, 4]], [[-1, -1, -1, 1, 3, 4, 4, 1]], [[-1, -1, -1]]]} | introductory | 0.40625 | 0.5 |
apps_3461 | # Two samurai generals are discussing dinner plans after a battle, but they can't seem to agree.
The discussion gets heated and you are cannot risk favoring either of them as this might damage your political standing with either of the two clans the samurai generals belong to. Thus, the only thing left to do is find w... |
def common_ground(s1,s2):
| {"fn_name": "common_ground", "inputs": [["eat chicken", "eat chicken and rice"], ["eat a burger and drink a coke", "drink a coke"], ["i like turtles", "what are you talking about"], ["aa bb", "aa bb cc"], ["aa bb cc", "bb cc"], ["aa bb cc", "bb cc bb aa"], ["aa bb", "cc dd"], ["aa bb", ""], ["", "cc dd"], ["", ""]], "o... | introductory | 0.328125 | 0.826563 |
apps_436 | There are n oranges in the kitchen and you decided to eat some of these oranges every day as follows:
Eat one orange.
If the number of remaining oranges (n) is divisible by 2 then you can eat n/2 oranges.
If the number of remaining oranges (n) is divisible by 3 then you can eat 2*(n/3) oranges.
You can only choose ... |
class Solution:
def minDays(self, n: int) -> int:
| {"fn_name": "minDays", "inputs": [[10]], "outputs": [4]} | interview | 0.15625 | 0.15625 |
apps_1116 | -----Problem Statement-----
We have an integer sequence $A$, whose length is $N$.
Find the number of the non-empty contiguous subsequences of $A$ whose sum is $0$. Note that we are counting the ways to take out subsequences. That is, even if the contents of some two subsequences are the same, they are counted individua... | {"inputs": [["6", "1 3 -4 2 2 -2"]], "outputs": [["3"]]} | interview | 0.03125 | 0.03125 | |
taco_1002472 | Today Vasya visited a widely known site and learned that the continuation of his favourite game Codecraft II will appear after exactly k months. He looked at the calendar and learned that at the moment is the month number s. Vasya immediately got interested in what month Codecraft III will appear. Help him understand t... | {"inputs": ["June\n97\n", "August\n0\n", "July\n33\n", "January\n0\n", "July\n4\n", "December\n1\n", "November\n47\n", "May\n44\n", "July\n77\n", "July\n2\n", "January\n11\n", "June\n1\n", "December\n49\n", "April\n0\n", "February\n22\n", "September\n3\n", "August\n24\n", "December\n0\n", "February\n11\n", "March\n100\... | EASY | 0.75 | 0.805339 | |
taco_1005073 | Chef gives an array A with N elements to Babla. Babla's task is to find the maximum non-negative integer X such that:
No element in the array belongs to the range [-X, X]. In other words, for all (1≤ i ≤ N), either A_{i} < -X or A_{i} > X.
Help Babla to find the maximum non-negative integer X for which the given cond... | {"inputs": ["3\n5\n8 4 2 5 2\n6\n7 9 -10 8 12 17\n4\n0 -3 -1 -10\n"], "outputs": ["1\n6\n-1\n"]} | EASY | 0.015625 | 0.015625 | |
apps_1487 | Chef has $N$ boxes arranged in a line.Each box has some candies in it,say $C[i]$. Chef wants to distribute all the candies between of his friends: $A$ and $B$, in the following way:
$A$ starts eating candies kept in the leftmost box(box at $1$st place) and $B$ starts eating candies kept in the rightmost box(box at $N$... | {"inputs": [["1", "5", "2 8 8 2 9", "2"]], "outputs": [["4 1"]]} | interview | 0.03125 | 0.03125 | |
taco_1015688 | A string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.
Given a string S, determine whether it is coffee-like.
-----Constraints-----
- S is a string of length 6 consisting of lowercas... | {"inputs": ["sippuu\n", "iphone\n", "coffee\n", "dceett\n", "otjjmm\n", "zkrrcc\n", "mdihxy\n", "xuquqw\n", "ilvegx\n", "tcdrzv\n", "abccde\n", "abcdee\n", "abcccc\n", "cofgee", "sjppvv", "uuppis", "ephoni", "cofgef", "uvppis", "eohoni", "fegfoc", "sippvu", "inohoe", "fegeoc", "uvppjs", "innhoe", "feoegc", "sjppvu", "i... | EASY | 1 | 1 | |
taco_1016414 | Chef is given two arrays A and B of length N each.
In one operation Chef can choose one element of A and one element of B and increase them by 1.
More formally:
Chef can pick two integers i, j (1≤ i, j ≤ N) and increment A_{i} and B_{j} by 1.
Determine the minimum number of operations required to make A and B equal.... | {"inputs": ["3\n2\n1 2\n2 1\n3\n1 1 2\n2 2 1\n3\n4 6 8\n5 7 6\n"], "outputs": ["1\n-1\n2\n"]} | EASY | 0.015625 | 0.015625 | |
taco_1004695 | Students of group 199 have written their lectures dismally. Now an exam on Mathematical Analysis is approaching and something has to be done asap (that is, quickly). Let's number the students of the group from 1 to n. Each student i (1 ≤ i ≤ n) has a best friend p[i] (1 ≤ p[i] ≤ n). In fact, each student is a best frie... | {"inputs": ["3\n1 2 3\n2 1 3\n", "10\n9 10 6 8 5 3 1 7 4 2\n7 6 2 9 5 10 8 4 1 3\n", "3\n2 3 1\n1 2 3\n", "10\n2 9 1 7 6 8 5 4 10 3\n6 8 5 1 9 10 2 3 4 7\n", "2\n1 2\n1 2\n", "5\n4 1 2 5 3\n2 3 5 1 4\n", "1\n1\n1\n", "4\n1 2 3 4\n2 1 4 3\n", "10\n5 9 7 1 4 10 3 6 2 8\n8 3 9 10 6 5 2 1 7 4\n", "3\n1 2 3\n1 2 3\n", "4\n2... | EASY | 0.84375 | 0.895433 | |
taco_1012174 | On a table are N cards, with a positive integer printed on the front and back of each card (possibly different).
We flip any number of cards, and after we choose one card.
If the number X on the back of the chosen card is not on the front of any card, then this number X is good.
What is the smallest number that is goo... | class Solution:
def flipgame(self, fronts: List[int], backs: List[int]) -> int:
| {"fn_name": "flipgame", "inputs": [[[1, 2, 4, 4, 7], [1, 3, 4, 1, 3]]], "outputs": [2]} | MEDIUM | 0.75 | 0.75 |
taco_1011670 | Permutation p is an ordered set of integers p_1, p_2, ..., p_{n}, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as p_{i}. We'll call number n the size or the length of permutation p_1, p_2, ..., p_{n}.
You have a sequence of integers a_1... | {"inputs": ["2\n3 0\n", "3\n-1 -1 2\n", "5\n-3 5 -3 3 3\n", "10\n9 6 -2 4 1 1 1 9 6 2\n", "9\n2 0 0 6 5 4 1 9 3\n", "100\n-77 57 -95 -23 53 -28 82 -83 38 -73 85 28 25 6 -43 4 -10 -30 -9 -92 14 34 -93 61 36 -100 90 -68 28 16 100 -3 97 30 36 -55 62 -62 53 74 -50 -23 67 11 22 -30 -19 83 7 84 43 90 -65 -75 -15 97 90 15 66 ... | EASY | 0.40625 | 0.450753 | |
apps_2608 | =====Problem Statement=====
You are given a string s consisting only of digits 0-9, commas ,, and dots .
Your task is to complete the regex_pattern defined below, which will be used to re.split() all of the , and . symbols in s.
It’s guaranteed that every comma and every dot in s is preceeded and followed by a digit. |
regex_pattern = r"" # Do not delete 'r'.
import re
print("\n".join(re.split(regex_pattern, input()))) | {"inputs": ["100,000,000.000\n"], "outputs": ["100\n000\n000\n000\n"]} | introductory | 0.96875 | 0.96875 |
taco_1013069 | Gunnar and Emma play a lot of board games at home, so they own many dice that are not normal $6$-sided dice. For example they own a die that has $10$ sides with numbers $47, 48, \ldots , 56$ on it.
There has been a big storm in Stockholm, so Gunnar and Emma have been stuck at home without electricity for a couple of h... | {"inputs": ["1 4 1 4\n1 6 1 6\n", "1 8 1 8\n1 10 2 5\n", "2 5 2 7\n1 5 2 5\n"], "outputs": ["Emma\n", "Tie\n", "Gunnar\n"]} | EASY | 0.015625 | 0.333333 | |
taco_1023819 | ###Task:
You have to write a function `pattern` which creates the following pattern (see examples) up to the desired number of rows.
* If the Argument is 0 or a Negative Integer then it should return "" i.e. empty string.
* If any even number is passed as argument then the pattern should last upto the largest odd nu... | def pattern(n):
| {"fn_name": "pattern", "inputs": [[4], [1], [5], [0], [-25]], "outputs": [["1\n333"], ["1"], ["1\n333\n55555"], [""], [""]]} | EASY | 0.09375 | 0.559375 |
apps_160 | Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones piles[i].
The objective of the game is to end with the most stones. The total number of stones is odd, so there are no ties.
Alex and Lee take turns, with Alex star... |
class Solution:
def stoneGame(self, piles: List[int]) -> bool:
| {"fn_name": "stoneGame", "inputs": [[[5, 3, 4, 5]]], "outputs": [true]} | interview | 0.625 | 0.625 |
taco_1014056 | Mario's bullet moves at X pixels per frame. He wishes to shoot a goomba standing Y pixels away from him. The goomba does not move.
Find the minimum time (in seconds) after which Mario should shoot the bullet, such that it hits the goomba after at least Z seconds from now.
------ Input Format ------
- The first lin... | {"inputs": ["3\n3 3 5\n2 4 1\n3 12 8"], "outputs": ["4\n0\n4"]} | EASY | 0.078125 | 0.078125 | |
taco_1015150 | A string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:
- S is a palindrome.
- Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.
- The string consisting of the (N+3)/2-st through N-th chara... | {"inputs": ["akasaka\n", "level\n", "atcoder\n", "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\n", "ddd\n", "asdfghjkkjhgfdsawasdfghjkkjhgfdsw\n", "abcdefghijklmnnmlkjihgfedcbazabcdefghijklmonmlkjihgfedcba\n", "gvg\n", "xgpuamkkmaupgxxxgpuamkkmaupgx\n", "kszhkbpphy... | EASY | 0.203125 | 0.950625 | |
taco_1018293 | You drop a ball from a given height. After each bounce, the ball returns to some fixed proportion of its previous height. If the ball bounces to height 1 or less, we consider it to have stopped bouncing. Return the number of bounces it takes for the ball to stop moving.
```
bouncingBall(initialHeight, bouncingProporti... | def bouncing_ball(initial, proportion):
| {"fn_name": "bouncing_ball", "inputs": [[2, 0.5], [4, 0.5], [10, 0.1], [100, 0.1], [9, 0.3], [30, 0.3]], "outputs": [[1], [2], [1], [2], [2], [3]]} | EASY | 0.171875 | 0.299479 |
apps_3132 | Write a function
```python
alternate_sort(l)
```
that combines the elements of an array by sorting the elements ascending by their **absolute value** and outputs negative and non-negative integers alternatingly (starting with the negative value, if any).
E.g.
```python
alternate_sort([5, -42, 2, -3, -4, 8, -9,]) == [-... |
def alternate_sort(l):
| {"fn_name": "alternate_sort", "inputs": [[[5, 2, -3, -9, -4, 8]], [[5, -42, 2, -3, -4, 8, 9]], [[5, -42, 8, 2, -3, -4, 9]], [[5, -42, -8, 2, -3, -4, -9]], [[5, 2, 3, 4, 8, 9]], [[-5, -2, -3, -4, -8, -9]], [[-5, -2, 3, 4, -8, 0, -9]], [[-5, -2, 3, 9, 4, -2, -8, 0, 9, -9]]], "outputs": [[[-3, 2, -4, 5, -9, 8]], [[-3, 2, ... | introductory | 0.734375 | 0.808594 |
taco_1019268 | Problem Statement:
Tom is collecting money for his birthday party, he is having 'a' coins today and his father gives him 'k' coins each day.
Since his birthday is on 'nth' day, he wants to know the amount of money he will have on his birthday.
Tom is weak at maths, help him calculate the number of coins he will hav... | {"inputs": ["100\n84 87 78\n16 94 36\n87 93 50\n22 63 28\n91 60 64\n27 41 27\n73 37 12\n69 68 30\n83 31 63\n24 68 36\n30 3 23\n59 70 68\n94 57 12\n43 30 74\n22 20 85\n38 99 25\n16 71 14\n27 92 81\n57 74 63\n71 97 82\n6 26 85\n28 37 6\n47 30 14\n58 25 96\n83 46 15\n68 35 65\n44 51 88\n9 77 79\n89 85 4\n52 55 100\n33 61 ... | EASY | 0.984375 | 0.984375 | |
taco_1006752 | A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly n pixels.
Your task is to determine the size of the rectangular display — the number of lines (rows) of pixels a and the number of columns of pixels b, so that:
there are exactly n pixels on the dis... | {"inputs": ["8\n", "64\n", "5\n", "999999\n", "716539\n", "1\n", "2\n", "3\n", "4\n", "6\n", "7\n", "9\n", "10\n", "11\n", "12\n", "15\n", "100\n", "101\n", "169\n", "179\n", "190\n", "1000\n", "10000\n", "10001\n", "100000\n", "100001\n", "1000000\n", "999983\n", "524288\n", "954493\n", "966289\n", "944663\n", "912673... | EASY | 0.046875 | 0.164651 | |
apps_4241 | Your task is to make function, which returns the sum of a sequence of integers.
The sequence is defined by 3 non-negative values: **begin**, **end**, **step**.
If **begin** value is greater than the **end**, function should returns **0**
*Examples*
~~~if-not:nasm
~~~
This is the first kata in the series:
1) Sum ... |
def sequence_sum(begin_number, end_number, step):
| {"fn_name": "sequence_sum", "inputs": [[2, 6, 2], [1, 5, 1], [1, 5, 3], [0, 15, 3], [16, 15, 3], [2, 24, 22], [2, 2, 2], [2, 2, 1], [1, 15, 3], [15, 1, 3]], "outputs": [[12], [15], [5], [45], [0], [26], [2], [2], [35], [0]]} | introductory | 0.640625 | 0.8375 |
apps_3889 | You've got a bunch of textual data with embedded phone numbers. Write a function `area_code()` that finds and returns just the area code portion of the phone number.
```python
>>> message = "The supplier's phone number is (555) 867-5309"
>>> area_code(message)
'555'
```
The returned area code should be a string, not a ... |
def area_code(text):
| {"fn_name": "area_code", "inputs": [["The supplier's phone number is (555) 867-5309"], ["Grae's cell number used to be (123) 456-7890"], ["The 102nd district court's fax line is (124) 816-3264"]], "outputs": [["555"], ["123"], ["124"]]} | introductory | 0.9375 | 0.947917 |
taco_1021939 | We'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≤ li ≤ ri ≤ n) meaning that value <image> should be equal to qi.
Your task is to find any interesting array of n elements or state that su... | {"inputs": ["1 2\n1 1 10\n1 1 5\n", "3 2\n1 2 536870912\n2 3 536870911\n", "1 1\n1 1 10\n", "1 2\n1 1 1\n1 1 3\n", "3 2\n1 2 536870912\n2 3 942984520\n", "2 2\n1 1 1\n1 1 3\n", "6 1\n1 3 3\n", "6 1\n1 6 3\n", "6 1\n1 6 6\n", "6 1\n1 6 1\n", "3 2\n1 2 840355017\n2 3 942984520\n", "4 1\n1 3 3\n", "6 1\n1 6 4\n", "3 2\n1 ... | MEDIUM_HARD | 0 | 0.286058 | |
taco_1001602 | Lucy had recently learned the game, called Natural Numbers.
The rules of the game are really simple. There are N players. At the same time, every player says one natural number. Let's call the number said by the i-th player Ai. The person with the smallest unique number (that is, the smallest number that was not said b... | {"inputs": [["2", "5", "Kouta 1", "Yuka 1", "Mayu 3", "Lucy 2", "Nana 5", "2", "Lucy 2", "Nana 2", "", ""], "2\n5\nKouta 1\nYuka 1\nMayu 3\nyucL 2\nNana 5\n2\nLucy 2\nNana 2", "2\n5\nKouta 1\nYuka 0\nMayu 3\nyucL 2\nNana 5\n2\nLucy 2\nNana 2", "2\n5\nKouta 2\nakuY 0\nMayu 3\nyucL 2\nNana 5\n2\nLucy 2\nNana 2", "2\n5\nK... | MEDIUM | 0.0625 | 0.254442 | |
taco_1010558 | Consider a convex polygon with $N$ vertices, with the additional property that no three diagonals intersect in a single point. Find the number of intersections between pairs of diagonals in such a polygon.
The figure below shows one such polygon with 6 vertices.
Note that a polygon is convex if all of its interior an... | {"inputs": ["3\n", "4\n", "6\n"], "outputs": ["0\n", "1\n", "15\n"]} | EASY | 0 | 0.322917 | |
apps_1414 | The auditorium of Stanford University is made up of L*R matrix (assume each coordinate has a chair). On the occasion of an event Chef was called as a chief guest. The auditorium was filled with males (M) and females (F), occupying one chair each. Our Chef is very curious guy, so he asks the gatekeeper some queries. The... | {"inputs": [["4 3 3", "MMF", "MMM", "FFM", "FFM", "2 F", "3 M", "1 M"]], "outputs": [["yes", "no", "yes"]]} | interview | 0.28125 | 0.28125 | |
taco_1008062 | Black Friday is the Friday following Thanksgiving Day in the United States (the fourth Thursday of November). Since the early 2000s, it has been regarded as the beginning of the Christmas shopping season in the US, and most major retailers open very early and offer promotional sales. (Source: Wikipedia)
You work in th... | {"inputs": ["8\n1 1 1 5 3 4 6 6\n", "3\n4 4 4\n"], "outputs": ["4\n", "none\n"]} | EASY | 0.21875 | 0.515625 | |
apps_316 | A string is called a happy prefix if is a non-empty prefix which is also a suffix (excluding itself).
Given a string s. Return the longest happy prefix of s .
Return an empty string if no such prefix exists.
Example 1:
Input: s = "level"
Output: "l"
Explanation: s contains 4 prefix excluding itself ("l", "le", "lev",... |
class Solution:
def longestPrefix(self, s: str) -> str:
| {"fn_name": "longestPrefix", "inputs": [["\"level\""]], "outputs": ["\""]} | interview | 0.4375 | 0.4375 |
taco_1012126 | In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters.
Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are sorted... | class Solution:
def isAlienSorted(self, words: List[str], order: str) -> bool:
| {"fn_name": "isAlienSorted", "inputs": [[["\"hello\"", "\"leetcode\""], "\"hlabcdefgijkmnopqrstuvwxyz\""]], "outputs": [true]} | EASY | 0.828125 | 0.828125 |
taco_1001881 | You were strolling outside the restaurant at the end of the universe. On a metaspiral path you stumble upon a weird device which takes a three-digit number as input and processes it. The Hitchhiker's guide to the galaxy explains that it processes the input in the following manner:
- Multiplies it with 13, followed by ... | {"inputs": [["1", "123 5"]], "outputs": [["27"]]} | MEDIUM_HARD | 0.046875 | 0.046875 | |
apps_939 | Chef loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Let F(X) equals to the number of lucky digits in decimal representation of X. Chef wants to know the ... | {"inputs": [["4", "1 100", "1 10000", "1 100000", "4444 4447", "", ""]], "outputs": [["0", "16", "640", "2"]]} | interview | 0.015625 | 0.015625 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 14