info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"tests": "{\"inputs\": [[5], [6], [7], [8], [9], [10], [20], [30], [40], [50], [100], [200], [300], [400], [500], [1000], [2000], [3000], [4000], [5000], [25000]], \"outputs\": [[10], [10], [17], [17], [17], [17], [77], [129], [197], [328], [1060], [4227], [8275], [13887], [21536], [76127], [277050], [593823], [101350... | # Summation Of Primes
The sum of the primes below or equal to 10 is **2 + 3 + 5 + 7 = 17**. Find the sum of all the primes **_below or equal to the number passed in_**.
From Project Euler's [Problem #10](https://projecteuler.net/problem=10 "Project Euler - Problem 10").
Write your solution by modifying this code:
`... | 0 |
{"tests": "{\"inputs\": [\"1111\\n00001\\n0110\\n01011\\n0010\\n01111\\n0010\\n01011\\n0111\", \"1111\\n00001\\n0110\\n01011\\n0010\\n01111\\n1010\\n01011\\n0111\", \"1111\\n00001\\n0110\\n01111\\n0010\\n00011\\n1010\\n01011\\n0111\", \"1111\\n00001\\n0110\\n01111\\n1010\\n00011\\n1010\\n01011\\n0111\", \"1111\\n00001\... | Seen from above, there is a grid-like square shaped like Figure 1. The presence or absence of "walls" on each side of this grid is represented by a sequence of 0s and 1s. Create a program that stands at point A, puts your right hand on the wall, keeps walking in the direction of the arrow, and outputs the route to retu... | 0 |
{"tests": "{\"inputs\": [\"5\\n2 2 1\\nBB\\n1 1 1\\nAB\\n3 2 8\\nAABBBBAABB\\n5 3 4\\nBBBBB\\n2 1 1\\nABABAB\\n\", \"5\\n2 1 1\\nBB\\n1 1 1\\nAB\\n3 2 8\\nAABBBBAABB\\n5 3 4\\nBBBBB\\n2 1 1\\nABABAB\\n\", \"5\\n2 1 1\\nBB\\n1 1 1\\nAB\\n3 0 8\\nAABBBBAABB\\n5 3 4\\nBBBBB\\n2 1 1\\nABABAB\\n\", \"5\\n3 1 0\\nBB\\n1 1 2\... | After a long party Petya decided to return home, but he turned out to be at the opposite end of the town from his home. There are $n$ crossroads in the line in the town, and there is either the bus or the tram station at each crossroad.
The crossroads are represented as a string $s$ of length $n$, where $s_i = \texttt... | 0.625 |
{"tests": "{\"inputs\": [\"6\\nonetwo2\\n-\\nonetwo1\\nonetwo2\\n-\\nonetwo1\\n7\\nv\\ntopbottom2\\nonetwo2\\n-\\nonetwo1\\ntopbottom1\\n-\\n6\\nbaz2\\nfoo2\\nbaz1v\\nbar1\\nfoo1\\nbar1\\n0\", \"6\\nonetwo2\\n-\\nonetwo1\\nonetwo1\\n-\\nonetwo1\\n7\\nv\\ntopbottom2\\nonetwo2\\n-\\nonetwo1\\ntopbottom1\\n-\\n6\\nbaz2\\n... | Taro, a junior high school student, is working on his homework. Today's homework is to read Chinese classic texts.
As you know, Japanese language shares the (mostly) same Chinese characters but the order of words is a bit different. Therefore the notation called "returning marks" was invented in order to read Chinese ... | 0 |
{"tests": "{\"inputs\": [\"bbbgggbgbbgbbgggbgbgggggbbbbgggbgbbgbbgggbgbgggggbbbbgggbgbbgbbgggbgbgggggbbbbgggbgbbgbbgggbgbggggggggggbgbgggbbgbbgbgggbbbbgggggbgbgggbbgbbgbgggbbbbgggggbgbgggbbgbbgbgggbbbbgggggbgbgggbbgbbgbgggbbbbbbgggbgbbgbbgggbgbgggggbbbbgggbgbbgbbgggbgbgggggbbbbgggbgbbgbbgggbgbgggggbbbbgggbgbbgbbgggbgbg... | Reading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: "Many are my names in many countries. Mithrandir among the Elves, Tharkûn to the Dwarves, Olórin I was in my youth in the West that is forgotten, in t... | 0.5 |
{"tests": "{\"inputs\": [\"3\\n6 6 3\\n19 7 4\\n21 8 1\\n6\\n5 4 2 11\\n12 4 2 11\\n11 9 2 11\\n14 3 22 5\\n17 9 20 5\\n20 10 20 5\\n0\", \"3\\n6 6 3\\n19 7 6\\n42 8 1\\n6\\n5 4 2 11\\n12 4 2 11\\n11 9 1 11\\n14 3 22 5\\n17 9 20 5\\n20 10 20 5\\n0\", \"3\\n6 6 3\\n19 7 6\\n42 8 1\\n6\\n5 4 2 11\\n12 4 2 15\\n11 9 1 11\... | Taro is not good at hide-and-seek. As soon as you hide, you will find it, and it will be difficult to find the hidden child. My father, who couldn't see it, made an ultra-high performance location search system. You can use it to know exactly where your friends are, including your own. Once you become a demon, you can ... | 0 |
{"tests": "{\"inputs\": [\"2\", \"1\", \"0\", \"6\", \"8\", \"3\", \"7\", \"5\", \"-1\", \"6\", \"8\", \"7\", \"2\", \"3\", \"5\", \"0\", \"-1\", \"1\", \"4\"], \"outputs\": [\"0:\\n1: 0\\n2: 1\\n3: 0 1\\n\", \"0:\\n1: 0\\n\", \"0:\\n\", \"0:\\n1: 0\\n2: 1\\n3: 0 1\\n4: 2\\n5: 0 2\\n6: 1 2\\n7: 0 1 2\\n8: 3\\n9: 0 3\\n... | Print all subsets of a set $S$, which contains $0, 1, ... n-1$ as elements. Note that we represent $0, 1, ... n-1$ as 00...0001, 00...0010, 00...0100, ..., 10...0000 in binary respectively and the integer representation of a subset is calculated by bitwise OR of existing elements.
Constraints
* $1 \leq n \leq 18$
In... | 0 |
{"tests": "{\"inputs\": [[[43, 23, 40, 13], 4], [[18, 15], 2], [[43, 23, 40, 13], 3], [[33, 8, 16, 47, 30, 30, 46], 5], [[6, 24, 6, 8, 28, 8, 23, 47, 17, 29, 37, 18, 40, 49], 2], [[50, 50], 2], [[50, 50, 25, 50, 24], 3], [[50, 51, 25, 50, 25], 3], [[50, 100, 25, 50, 26], 3], [[100], 2], [[50, 50], 3], [[50, 51], 3]], \... | # A History Lesson
The Pony Express was a mail service operating in the US in 1859-60.
It reduced the time for messages to travel between the Atlantic and Pacific coasts to about 10 days, before it was made obsolete by the transcontinental telegraph.
# How it worked
There were a number of *stations*, where:
*... | 0 |
{"tests": "{\"inputs\": [\"6 3 1 1\\n\", \"6 1 2 2\\n\", \"7 12 2 2\\n\", \"3 1 1 1\\n\", \"8 664 100 100\\n\", \"10 189 44 100\\n\", \"7 4 1 2\\n\", \"5 4 3 2\\n\", \"5 2 1 1\\n\", \"3 2 3 1\\n\", \"48 512559680 100 100\\n\", \"5 1 2 2\\n\", \"8 7 1 1\\n\", \"6 54 23 32\\n\", \"3 1 1 6\\n\", \"50 0 100 100\\n\", \"50 ... | Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
... | 0 |
{"tests": "{\"inputs\": [[1, 2, 3, 1, 2], [1, 1], [1, 0], [\"a\", \"b\"], [\"a\", \"b\", \"a\"], [1, 2, 42, 3, 4, 5, 42], [\"a\", \"b\", \"c\", \"d\"], [\"a\", \"b\", \"c\", \"c\"], [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"f\", \"b\"]], \"outputs\": [[true], [true], [false], [false], [true], [true], [false], [true]... | Complete the solution so that it returns true if it contains any duplicate argument values. Any number of arguments may be passed into the function.
The array values passed in will only be strings or numbers. The only valid return values are `true` and `false`.
Examples:
```
solution(1, 2, 3) --> false
s... | 0 |
{"tests": "{\"inputs\": [[\"mmm\"], [\"apple\"], [\"super\"], [\"orange\"], [\"grapes\"], [\"supercalifragilisticexpialidocious\"], [\"123456\"], [\"crIssUm\"], [\"Implied\"], [\"rIc\"], [\"UNDISARMED\"], [\"bialy\"], [\"stumpknocker\"], [\"narboonnee\"], [\"carlstadt\"], [\"ephodee\"], [\"spicery\"], [\"oftenness\"], ... | We want to know the index of the vowels in a given word, for example, there are two vowels in the word super (the second and fourth letters).
So given a string "super", we should return a list of [2, 4].
Some examples:
Mmmm => []
Super => [2,4]
Apple => [1,5]
YoMama -> [1,2,4... | 0 |
{"tests": "{\"inputs\": [\"3\\n3\\n2 2 2\\n3\\n2 2 3\\n5\\n0 0 0 2 2\\n\", \"4\\n5\\n4 1 3 1 3\\n4\\n1 0 1 6\\n1\\n0\\n2\\n5 4\\n\", \"3\\n3\\n2 2 0\\n3\\n2 2 3\\n5\\n0 0 0 2 2\\n\", \"3\\n3\\n4 2 0\\n3\\n2 2 3\\n5\\n0 0 0 2 2\\n\", \"3\\n3\\n4 2 0\\n3\\n2 2 4\\n5\\n0 0 0 2 2\\n\", \"4\\n5\\n4 1 5 1 3\\n4\\n1 0 1 6\\n1... | Koa the Koala and her best friend want to play a game.
The game starts with an array a of length n consisting of non-negative integers. Koa and her best friend move in turns and each have initially a score equal to 0. Koa starts.
Let's describe a move in the game:
* During his move, a player chooses any element of... | 0 |
{"tests": "{\"inputs\": [\"6\\n8\\n1 1 2 2 3 2 1 1\\n3\\n1 3 3\\n4\\n1 10 10 1\\n1\\n26\\n2\\n2 1\\n3\\n1 1 1\\n\", \"6\\n8\\n1 1 2 2 3 2 1 1\\n3\\n1 3 3\\n4\\n1 10 10 1\\n1\\n26\\n2\\n2 2\\n3\\n1 1 1\\n\", \"6\\n8\\n1 1 2 2 3 2 1 1\\n3\\n1 3 2\\n4\\n1 10 10 1\\n1\\n26\\n2\\n2 1\\n3\\n1 1 1\\n\", \"6\\n8\\n1 1 2 2 1 2 ... | The only difference between easy and hard versions is constraints.
You are given a sequence $a$ consisting of $n$ positive integers.
Let's define a three blocks palindrome as the sequence, consisting of at most two distinct elements (let these elements are $a$ and $b$, $a$ can be equal $b$) and is as follows: $[\unde... | 0.125 |
{"tests": "{\"inputs\": [[1], [2], [3], [4], [5]], \"outputs\": [[[1]], [[1, 2]], [[1, 2, 3]], [[1, 2, 3, 4]], [[1, 2, 3, 4, 5]]]}", "source": "primeintellect"} | This is the first step to understanding FizzBuzz.
Your inputs:
a positive integer, n, greater than or equal to one.
n is provided, you have NO CONTROL over its value.
Your expected output is an array of positive integers from 1 to n (inclusive).
Your job is to write an algorithm that gets you from the input to the... | 0 |
{"tests": "{\"inputs\": [[18], [60], [54], [37], [61]], \"outputs\": [[[3, [2, 3, 3]]], [[10, [2, 2, 3, 5]]], [[6, [2, 3, 3, 3]]], [[0, []]], [[0, []]]]}", "source": "primeintellect"} | Given a natural number n, we want to know in how many ways we may express these numbers as product of other numbers.
For example the number
```python
18 = 2 x 9 = 3 x 6 = 2 x 3 x 3 # (we do not consider the product 18 x 1), (3 ways)
```
See this example a bit more complicated,
```python
60 = 2 x 30 = 3 x 20 = 4 x ... | 0 |
{"tests": "{\"inputs\": [\"963276084 698548036 1000000000\\n\", \"18036 47899 1000000000\\n\", \"200 10 979220166595737684\\n\", \"740 251 930540301905511549\\n\", \"1000 1000 1000000000000000000\\n\", \"9999999999 33333 1000000000\\n\", \"121 395 621154158314692955\\n\", \"20958318104 46685 253251869\\n\", \"3950 7386... | Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.
During cooking, Julia goes to the kitchen every d minutes and turns on the stove if it is turned off. While the cooker is turned off, it stays warm. The s... | 0 |
{"tests": "{\"inputs\": [\"14 6\\n256 465 759 589 242 824 638 985 506 128 809 105 301 827\\n\", \"1 20\\n784\\n\", \"102 99\\n73 348 420 956 955 436 69 714 87 480 102 555 933 215 452 167 157 593 863 816 337 471 371 574 862 967 581 543 330 348 221 640 378 250 500 428 866 379 1 723 880 992 9 419 0 163 800 96 16 25 19 513... | It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | 0.625 |
{"tests": "{\"inputs\": [[\"LF5(RF3)(RF3R)F7\"], [\"(L(F5(RF3))(((R(F3R)F7))))\"], [\"F4L(F4RF4RF4LF4L)2F4RF4RF4\"], [\"F4L((F4R)2(F4L)2)2(F4R)2F4\"], [\"F2LF3L(F2)2LF5L(F3)2LF7L((F2)2)2L(F3)3L(F5)2\"], [\"F2LF3L(F2)2LF5L(F3)2LF7L(F4)2L((F3)1)3L(F5)2\"], [\"(F5RF5R(F3R)2)3\"], [\"((F5R)2(F3R)2)3\"], [\"((F3LF3R)2FRF6L)... | # RoboScript #3 - Implement the RS2 Specification
## Disclaimer
The story presented in this Kata Series is purely fictional; any resemblance to actual programming languages, products, organisations or people should be treated as purely coincidental.
## About this Kata Series
This Kata Series is based on a fictional... | 0 |
{"tests": "{\"inputs\": [\"1\\n1 1 9\\n\", \"2\\n2 3 20\\n2 4 40\\n\", \"2\\n1 2 5\\n2 3 5\\n\", \"2\\n1 2 5\\n2 3 10\\n\", \"2\\n2 2 20\\n2 4 40\\n\", \"2\\n2 2 20\\n2 7 16\\n\", \"1\\n1 1 8\\n\", \"2\\n2 2 5\\n2 -1 10\\n\", \"2\\n1 2 5\\n2 0 10\\n\", \"2\\n2 2 20\\n2 7 40\\n\", \"2\\n1 2 5\\n2 1 10\\n\", \"2\\n1 2 5\... | A rectangle with sides $A$ and $B$ is cut into rectangles with cuts parallel to its sides. For example, if $p$ horizontal and $q$ vertical cuts were made, $(p + 1) \cdot (q + 1)$ rectangles were left after the cutting. After the cutting, rectangles were of $n$ different types. Two rectangles are different if at least o... | 0 |
{"tests": "{\"inputs\": [\"5 5\\n2 2 3\\n2 4 5\\n1 5\\n0\\n0\\n1\\n\", \"5 5\\n1 2\\n2 3 4\\n0\\n1 5\\n1 3\\n1\\n\", \"5 5\\n2 2 3\\n1 4\\n0\\n1 5\\n1 4\\n2\\n\", \"11 20\\n1 2\\n2 7 6\\n1 7\\n4 10 9 3 2\\n2 9 2\\n1 3\\n0\\n0\\n3 1 6 7\\n4 11 7 5 6\\n2 2 8\\n4\\n\", \"3 3\\n1 2\\n2 1 3\\n0\\n1\\n\", \"5 5\\n1 2\\n1 3\\... | Petya and Vasya arranged a game. The game runs by the following rules. Players have a directed graph consisting of n vertices and m edges. One of the vertices contains a chip. Initially the chip is located at vertex s. Players take turns moving the chip along some edge of the graph. Petya goes first. Player who can't m... | 0 |
{"tests": "{\"inputs\": [\"100\\n85 50 17 89 65 89 5 20 86 26 16 21 85 14 44 31 87 31 6 2 48 67 8 80 79 1 48 36 97 1 5 30 79 50 78 12 2 55 76 100 54 40 26 81 97 96 68 56 87 14 51 17 54 37 52 33 69 62 38 63 74 15 62 78 9 19 67 2 60 58 93 60 18 96 55 48 34 7 79 82 32 58 90 67 20 50 27 15 7 89 98 10 11 15 99 49 4 51 77 52... | Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chores (for example, water the flowers).
The key in football is to divide into teams fairly before the ... | 0 |
{"tests": "{\"inputs\": [\"0\", \"4\", \"1\", \"2\", \"000\", \"001\", \"2\", \"0\", \"1\", \"4\", \"001\", \"000\", \"3\"], \"outputs\": [\"0\\n\", \"4\\n1 2\\n1 3\\n2 4\\n3 4\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"0\\n\", \"4\\n1 2\\n1 3\\n2 4\\n3 4\\n\", \"0\\n\", \"0\\n\", \"2\\n1 3\\n2... | You are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:
* The graph is simple and connected.
* There exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.
It can be proved t... | 0 |
{"tests": "{\"inputs\": [\"6\\n1 3\\n2 3\\n3 4\\n4 5\\n4 6\\n\", \"4\\n1 2\\n2 3\\n3 4\\n\", \"3\\n1 3\\n2 3\\n\", \"14\\n1 2\\n2 3\\n3 4\\n4 5\\n5 6\\n6 7\\n7 8\\n8 9\\n5 10\\n10 11\\n10 12\\n10 13\\n10 14\\n\", \"28\\n2 24\\n2 4\\n2 3\\n1 2\\n1 17\\n1 21\\n1 22\\n10 22\\n22 23\\n22 26\\n25 26\\n16 25\\n7 26\\n5 7\\n5... | You have a tree of $n$ vertices. You are going to convert this tree into $n$ rubber bands on infinitely large plane. Conversion rule follows:
For every pair of vertices $a$ and $b$, rubber bands $a$ and $b$ should intersect if and only if there is an edge exists between $a$ and $b$ in the tree.
Shape of rubber bands ... | 0 |
{"tests": "{\"inputs\": [[\"Bryan Joubert\"], [\"Jesse Cox, !Selena Gomez\"], [\"!Eleena Daru, Obi-Wan Kenobi, Eleena Daru, Jar-Jar Binks\"], [\"Digital Daggers, !Kiny Nimaj, Rack Istley, Digital Daggers, Digital Daggers\"], [\"Albert Einstein, !Sarah Connor, Marilyn Monroe, Abraham Lincoln, Sarah Connor, Sean Connery,... | _A mad sociopath scientist just came out with a brilliant invention! He extracted his own memories to forget all the people he hates! Now there's a lot of information in there, so he needs your talent as a developer to automatize that task for him._
> You are given the memories as a string containing people's surname ... | 0 |
{"tests": "{\"inputs\": [\"10\\n10 71 113 33 6 47 23 25 52 64\", \"7\\n1 2 3 1100000000 4 5 6\", \"5\\n3 2 4 2 2\", \"10\\n10 102 113 33 6 47 23 25 52 64\", \"7\\n1 2 3 1100000000 4 5 2\", \"10\\n10 102 113 60 6 47 23 25 52 64\", \"5\\n5 2 4 2 1\", \"10\\n10 102 113 60 6 47 23 25 52 118\", \"7\\n1 2 3 1100000000 1 20 2... | Snuke has an integer sequence A of length N.
He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen.
Let P,Q,R,S be the sums of the elements in B,C,D,E, respectively. Snuke is happier when the absolute difference of the ma... | 0.75 |
{"tests": "{\"inputs\": [[8, 2, 4], [12, -3, 4], [8, 3, 4], [48, 2, -5], [-100, -25, 10], [10000, 5, -3], [4, 4, 2], [5, 2, 3], [-96, 25, 17], [33, 1, 33]], \"outputs\": [[true], [true], [false], [false], [true], [false], [true], [false], [false], [true]]}", "source": "primeintellect"} | Your task is to create function```isDivideBy``` (or ```is_divide_by```) to check if an integer number is divisible by each out of two arguments.
A few cases:
```
(-12, 2, -6) -> true
(-12, 2, -5) -> false
(45, 1, 6) -> false
(45, 5, 15) -> true
(4, 1, 4) -> true
(15, -5, 3) -> true
```
Write y... | 0 |
{"tests": "{\"inputs\": [[\"X\"], [\"X\\n.\"], [\".X\\n..\"], [\"..\\n.X\"], [\"..\\nX.\"], [\".......\\nX.......\"], [\"..........\\n..........\\n.......X..\\n..........\\n..........\"], [\"..........\\n..........\\n..........\\n........X.\\n..........\"], [\"........................\"], [\"\\n\\n\\n\\n\"]], \"outputs... | Late last night in the Tanner household, ALF was repairing his spaceship so he might get back to Melmac. Unfortunately for him, he forgot to put on the parking brake, and the spaceship took off during repair. Now it's hovering in space.
ALF has the technology to bring the spaceship home if he can lock on to its locati... | 0 |
{"tests": "{\"inputs\": [[\"\"], [\"a\"], [\"ab\"], [\"abc\"], [\"abab\"], [\"abcde\"], [\"aaaaaaaaaaaaaa\"], [\"abaabaaab\"], [\"dbdbebedbddbedededeeddbbdeddbeddeebdeddeebbbb\"], [\"vttussvutvuvvtustsvsvtvu\"]], \"outputs\": [[\"\"], [\"a\"], [\"a\"], [\"aba\"], [\"a\"], [\"aecea\"], [\"a\"], [\"aba\"], [\"deededebdde... | # Task
Christmas is coming. In the [previous kata](https://www.codewars.com/kata/5a405ba4e1ce0e1d7800012e), we build a custom Christmas tree with the specified characters and the specified height.
Now, we are interested in the center of the Christmas tree.
Please imagine that we build a Christmas tree with `chars =... | 0 |
{"tests": "{\"inputs\": [[[4, 5, 7, 5, 4, 8]], [[9, 10, 19, 13, 19, 13]], [[16, 0, 11, 4, 8, 16, 0, 11]], [[5, 17, 18, 11, 13, 18, 11, 13]], [[5, 10, 19, 13, 10, 13]]], \"outputs\": [[15], [19], [12], [22], [24]]}", "source": "primeintellect"} | In this Kata, you will be given an array of numbers in which two numbers occur once and the rest occur only twice. Your task will be to return the sum of the numbers that occur only once.
For example, `repeats([4,5,7,5,4,8]) = 15` because only the numbers `7` and `8` occur once, and their sum is `15`.
More examples ... | 0 |
{"tests": "{\"inputs\": [\"1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1...1\\n\", \",...,,...,,...,,...,,...,,...,,... | Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. For example, number sequence written like "1,2 ,3,..., 10" will be corrected to... | 0.125 |
{"tests": "{\"inputs\": [\"4\\n6 4 2\\n4 7 3\\n7 10 3\\n13 3 1\\n4\\n7 4 2\\n4 7 3\\n7 10 3\\n11 6 3\\n0\", \"4\\n6 4 2\\n4 7 3\\n7 10 3\\n13 3 1\\n4\\n7 4 2\\n4 7 3\\n6 10 3\\n11 6 3\\n0\", \"4\\n3 4 2\\n4 7 3\\n7 10 3\\n13 3 1\\n4\\n7 4 2\\n4 7 3\\n6 10 3\\n11 6 3\\n0\", \"4\\n3 4 2\\n4 7 3\\n7 14 3\\n13 3 1\\n4\\n7 ... | A crop circle suddenly appeared on the vast agricultural land of Argentina. A total of n crop circles were confirmed, including overlapping, popping, large, and small ones.
When a mystery hunter tried to capture the whole picture of a crop circle from the air, he found it difficult to show the beautiful pattern in the... | 0 |
{"tests": "{\"inputs\": [\"3\\n\\n5 0\\n0 0 1\\n0 1 4\\n1 0 2\\n1 1 3\\n2 2 9\\n\\n5 2\\n0 0 1\\n0 1 4\\n1 0 2\\n1 1 3\\n2 2 9\\n\\n6 1\\n1 -1 3\\n0 -1 9\\n0 1 7\\n-1 0 1\\n-1 1 9\\n-1 -1 7\\n\", \"3\\n\\n5 0\\n0 0 1\\n0 1 4\\n1 0 2\\n1 1 3\\n2 2 9\\n\\n5 2\\n0 0 1\\n0 1 4\\n1 0 2\\n1 1 3\\n2 2 9\\n\\n6 1\\n1 -1 3\\n0 ... | Polycarp is very fond of playing the game Minesweeper. Recently he found a similar game and there are such rules.
There are mines on the field, for each the coordinates of its location are known ($x_i, y_i$). Each mine has a lifetime in seconds, after which it will explode. After the explosion, the mine also detonates... | 0 |
{"tests": "{\"inputs\": [[30], [3], [98], [65], [23], [15], [4], [2], [45], [90], [21], [7], [6], [10003823], [41535], [712], [985], [164523]], \"outputs\": [[\"BangBoom\"], [\"Bang\"], [\"Miss\"], [\"Boom\"], [\"Miss\"], [\"BangBoom\"], [\"Miss\"], [\"Miss\"], [\"BangBoom\"], [\"BangBoom\"], [\"Bang\"], [\"Miss\"], [\... | Make a program that takes a value (x) and returns "Bang" if the number is divisible by 3, "Boom" if it is divisible by 5, "BangBoom" if it divisible by 3 and 5, and "Miss" if it isn't divisible by any of them.
Note: Your program should only return one value
Ex: Input: 105 --> Output: "BangBoom"
Ex: Input: 9 --> Output... | 0 |
{"tests": "{\"inputs\": [\"10 100\\n2\\n10\\n35\\n42\\n54\\n69\\n89\\n91\\n93\\n99\", \"4 8\\n1\\n5\\n5\\n6\", \"10 100\\n2\\n10\\n35\\n42\\n54\\n69\\n87\\n91\\n93\\n99\", \"4 8\\n1\\n2\\n5\\n6\", \"4 8\\n1\\n2\\n5\\n5\", \"4 8\\n1\\n3\\n5\\n5\", \"4 15\\n1\\n3\\n5\\n5\", \"3 4\\n0\\n0\\n3\", \"10 100\\n2\\n11\\n40\\n4... | Given are N points on the circumference of a circle centered at (0,0) in an xy-plane. The coordinates of the i-th point are (\cos(\frac{2\pi T_i}{L}),\sin(\frac{2\pi T_i}{L})).
Three distinct points will be chosen uniformly at random from these N points. Find the expected x- and y-coordinates of the center of the circ... | 0.75 |
{"tests": "{\"inputs\": [[1], [12], [24], [25], [101101291], [12345676], [1251562], [625], [9801], [30858025]], \"outputs\": [[1], [8], [11], [3], [5], [68], [41], [5], [23], [63]]}", "source": "primeintellect"} | A pair of numbers has a unique LCM but a single number can be the LCM of more than one possible
pairs. For example `12` is the LCM of `(1, 12), (2, 12), (3,4)` etc. For a given positive integer N, the number of different integer pairs with LCM is equal to N can be called the LCM cardinality of that number N. In this ka... | 0 |
{"tests": "{\"inputs\": [\"7\\n1\\n2\\n3\\n4\\n5\\n100\\n2000000\\n\", \"3\\n1234567\\n1268501\\n1268499\\n\", \"3\\n1234567\\n1268501\\n1268499\\n\", \"3\\n60615\\n1268501\\n1268499\\n\", \"7\\n1\\n2\\n3\\n4\\n5\\n110\\n2000000\\n\", \"3\\n89610\\n1268501\\n1268499\\n\", \"7\\n2\\n2\\n5\\n4\\n5\\n110\\n2000000\\n\", \... | Lee tried so hard to make a good div.2 D problem to balance his recent contest, but it still doesn't feel good at all. Lee invented it so tediously slow that he managed to develop a phobia about div.2 D problem setting instead. And now he is hiding behind the bushes...
Let's define a Rooted Dead Bush (RDB) of level $n... | 0 |
{"tests": "{\"inputs\": [\"4 2\\n1 2\\n2 2\\n\", \"6 2\\n2 3\\n4 1\\n\", \"3 2\\n1 1\\n2 2\\n\", \"1 1\\n1 1\\n\", \"25 2\\n1 23\\n3 1\\n\", \"300 4\\n1 200\\n2 200\\n50 100\\n70 100\\n\", \"1000 1\\n1 1000\\n\", \"1001 1\\n60 10001\\n\", \"999999999 1\\n100 1000000000\\n\", \"1000000000 1\\n1 1000000000\\n\", \"999999... | A famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, devised a game to help them:
All of them take a sit at their round table, some of them with the golde... | 0 |
{"tests": "{\"inputs\": [\"200\\nNESENEESEESWWWNWWSWSWNWNNWNNESWSWNNWNWNENESENNESSWSESWWSSSEEEESSENNNESSWWSSSSESWSWWNNEESSWWNNWSWSSWWNWNNEENNENWWNESSSENWNESWNESWNESEESSWNESSSSSESESSWNNENENESSWWNNWWSWWNESEENWWWWNWWNWWNENESESSWWSWWSES\\nNWNESESSENNNESWNWWSWWWNWSESSSWWNWWNNWSENWSWNENNNWWSWWSWNNNESWWWSSESSWWWSSENWSENWWNENE... | In the spirit of the holidays, Saitama has given Genos two grid paths of length n (a weird gift even by Saitama's standards). A grid path is an ordered sequence of neighbouring squares in an infinite grid. Two squares are neighbouring if they share a side.
One example of a grid path is (0, 0) → (0, 1) → (0, 2) → (1, 2... | 0 |
{"tests": "{\"inputs\": [\"70 100 340 4 200\\n1 1 4\\n70 100 340 4 200\\n0 1 3\\n70 100 340 6 200\\n1 1 2\\n0 0 0 0 0\", \"135 100 340 4 200\\n1 1 4\\n70 100 340 4 200\\n0 1 3\\n70 100 340 6 200\\n1 1 2\\n0 0 0 0 0\", \"135 100 340 4 200\\n1 1 4\\n70 100 351 5 200\\n0 1 3\\n70 100 340 6 288\\n1 1 2\\n0 0 0 0 0\", \"70 ... | Problem
I started a part-time job at the rental DVD shop "NEO". First of all, I decided to study the fee system of this store.
There are three types of rental DVDs, old, semi-new, and new, and the rental fee for one DVD is a yen, b yen, and c yen, respectively. The set rental shown below can be applied multiple times... | 0 |
{"tests": "{\"inputs\": [[\"The quick brown fox jumps over the lazy dog.\"], [\"apple\"], [\"a b c d\"], [\"double spaced words\"], [\"stressed desserts\"], [\"hello hello\"]], \"outputs\": [[\"ehT kciuq nworb xof spmuj revo eht yzal .god\"], [\"elppa\"], [\"a b c d\"], [\"elbuod decaps sdrow\"], [\"desserts stress... | Complete the function that accepts a string parameter, and reverses each word in the string. **All** spaces in the string should be retained.
## Examples
```
"This is an example!" ==> "sihT si na !elpmaxe"
"double spaces" ==> "elbuod secaps"
```
Write your solution by modifying this code:
```python
def revers... | 0 |
{"tests": "{\"inputs\": [\"3 15\\n4 1\\n3 1\\n4 1\", \"6 4\\n1 1\\n0 1\\n1 1\\n1 1\\n1 1\\n1 1\", \"20 987654321\\n129662684 2\\n162021979 1\\n458437539 1\\n258406183 2\\n202863355 1\\n112218745 1\\n348732033 1\\n323036578 1\\n382398703 1\\n55854389 1\\n283445191 1\\n151300613 1\\n693338042 2\\n191178308 2\\n386707193 ... | There is a railroad in Takahashi Kingdom. The railroad consists of N sections, numbered 1, 2, ..., N, and N+1 stations, numbered 0, 1, ..., N. Section i directly connects the stations i-1 and i. A train takes exactly A_i minutes to run through section i, regardless of direction. Each of the N sections is either single-... | 0 |
{"tests": "{\"inputs\": [\"6\\n2\\n1 3\\n3\\n1 2 3\\n4\\n6 2 3 9\\n4\\n6 8 4 5\\n7\\n1 2 4 6 7 7 3\\n8\\n8 6 5 1 2 2 3 6\\n\", \"6\\n2\\n1 3\\n3\\n1 2 3\\n4\\n2 2 3 9\\n4\\n6 8 4 5\\n7\\n1 2 4 6 7 7 3\\n8\\n8 6 5 1 2 2 3 6\\n\", \"6\\n2\\n1 3\\n3\\n1 2 3\\n4\\n2 2 3 14\\n4\\n6 8 4 5\\n7\\n1 2 4 6 7 7 3\\n8\\n8 6 5 1 2 ... | You are given $n$ lengths of segments that need to be placed on an infinite axis with coordinates.
The first segment is placed on the axis so that one of its endpoints lies at the point with coordinate $0$. Let's call this endpoint the "start" of the first segment and let's call its "end" as that endpoint that is not ... | 0 |
{"tests": "{\"inputs\": [\"6 6\\n1 2 3 4 5 6\\n8 6 9 1 2 0\\n3 1 4 1 5 9\\n2 6 5 3 5 8\\n1 4 1 4 2 1\\n2 10 1 8 2 8\", \"3 3\\n1 0 5\\n1 2 3\\n4 2 4\", \"6 6\\n1 2 3 4 5 6\\n8 6 9 1 2 0\\n1 1 4 1 5 9\\n2 6 5 3 5 8\\n1 4 1 4 2 1\\n2 10 1 8 2 8\", \"3 3\\n1 0 5\\n1 2 3\\n4 2 5\", \"6 6\\n1 2 3 4 5 6\\n8 8 9 0 2 0\\n1 1 4... | Input
The input is given from standard input in the following format.
> $H \ W$ $a_{1, 1} \ a_{1, 2} \ \cdots \ a_{1, W}$ $a_{2, 1} \ a_{2, 2} \ \cdots \ a_{2, W}$ $\vdots \ \ \ \ \ \ \ \ \ \ \vdots \ \ \ \ \ \ \ \ \ \ \vdots$ $a_{H, 1} \ a_{H, 2} \ \cdots \ a_{H, W}$
Output
* Print the maximum number of souvenirs... | 0 |
{"tests": "{\"inputs\": [\"101\\n\", \"1110\\n\", \"11011111101010010\\n\", \"1\\n\", \"1111111111111111111111111111111011111111111101101110111011111111010011111111111110111111111101011111\\n\"], \"outputs\": [\"12\\n\", \"780\\n\", \"141427753\\n\", \"0\\n\", \"148758249\\n\"]}", "source": "primeintellect"} | You are given a positive integer $n$. Since $n$ may be very large, you are given its binary representation.
You should compute the number of triples $(a,b,c)$ with $0 \leq a,b,c \leq n$ such that $a \oplus b$, $b \oplus c$, and $a \oplus c$ are the sides of a non-degenerate triangle.
Here, $\oplus$ denotes the bitwis... | 0 |
{"tests": "{\"inputs\": [\"5\\n\", \"4\\n\", \"2\\n\", \"3\\n\", \"1\\n\"], \"outputs\": [\"1\", \"2\", \"3\", \"1\", \"2\"]}", "source": "primeintellect"} | "This problem is rubbish! There is not statement, and there are only 5 test cases. The problemsetter took liberties with this problem!" — people complained in the comments to one round on Codeforces. And even more... No, wait, the checker for the problem was alright, that's a mercy.
Input
The only line of the input c... | 0 |
{"tests": "{\"inputs\": [\"1000000000 2 999999998\\n0 1\\n\", \"1000000000 1 77000000\\n0\\n\", \"3000000 20 642518\\n1 0 0 1 0 1 1 1 1 1 0 0 0 1 0 1 0 1 0 1\\n\", \"100000 16 79154\\n1 1 1 0 0 0 0 0 1 1 0 1 0 1 0 1\\n\", \"10000000 22 8115129\\n1 0 1 0 0 0 0 0 0 1 1 0 1 0 0 0 0 1 1 0 0 1\\n\", \"1000000000 1 999999999... | This is an interactive problem.
Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to find something to occupy herself. She couldn't think of anything better to do than to calculate the distance to the red planet... | 0 |
{"tests": "{\"inputs\": [[\"dime penny dollar\"], [\"dime penny nickel\"], [\"quarter quarter\"], [\"dollar penny dollar\"], [\"dollar dollar dollar dollar dollar dollar dollar dollar dollar dollar penny\"]], \"outputs\": [[\"$1.11\"], [\"$0.16\"], [\"$0.50\"], [\"$2.01\"], [\"$10.01\"]]}", "source": "primeintellect"} | You've been collecting change all day, and it's starting to pile up in your pocket, but you're too lazy to see how much you've found.
Good thing you can code!
Create ```change_count()``` to return a dollar amount of how much change you have!
Valid types of change include:
```
penny: 0.01
nickel: 0.05
dime: 0.10
quar... | 0 |
{"tests": "{\"inputs\": [[\"attitude\"], [\"friends\"], [\"family\"], [\"selfness\"], [\"knowledge\"]], \"outputs\": [[100], [75], [66], [99], [96]]}", "source": "primeintellect"} | If `a = 1, b = 2, c = 3 ... z = 26`
Then `l + o + v + e = 54`
and `f + r + i + e + n + d + s + h + i + p = 108`
So `friendship` is twice stronger than `love` :-)
The input will always be in lowercase and never be empty.
Write your solution by modifying this code:
```python
def words_to_marks(s):
```
Your solut... | 0 |
{"tests": "{\"inputs\": [\"16\\n10 8\\n2 2\\n2 5\\n2 7\\n3 3\\n3 8\\n4 2\\n4 5\\n4 8\\n6 4\\n6 7\\n7 5\\n7 8\\n8 1\\n8 4\\n9 6\\n10 3\\n4 3\\n8\\n6 4\\n1 2\\n2 1\\n2 4\\n3 4\\n4 2\\n5 3\\n6 1\\n3 2\\n3 2\\n0\", \"16\\n10 8\\n2 2\\n2 5\\n2 7\\n3 3\\n3 8\\n4 2\\n4 5\\n4 8\\n6 4\\n6 7\\n7 5\\n7 8\\n8 1\\n8 4\\n9 6\\n10 3\... | Seiji Hayashi had been a professor of the Nisshinkan Samurai School in the domain of Aizu for a long time in the 18th century. In order to reward him for his meritorious career in education, Katanobu Matsudaira, the lord of the domain of Aizu, had decided to grant him a rectangular estate within a large field in the Ai... | 0 |
{"tests": "{\"inputs\": [[\"int main(int argc, char *argv[]) { return 0; }\"], [\" Yo - What's Good?! \"], [\" df af asd \"], [\"global hash\"], [\"section .text\"], [\"hash:\"], [\" xor eax, eax\"], [\" ret\"], [\"; -----> end of hash <-----\"], [\"int hash(const char *str);\"], [\"\"], [\" \"], [\" \"], [\" ... | Implement a function which takes a string, and returns its hash value.
Algorithm steps:
* `a` := sum of the ascii values of the input characters
* `b` := sum of every difference between the consecutive characters of the input (second char minus first char, third minus second, ...)
* `c` := (`a` OR `b`) AND ((NOT `a`)... | 0 |
{"tests": "{\"inputs\": [[100, 0.1, 1], [100, 0.1, 2], [100, 0.1, 10], [100, 0, 10], [0, 0.1, 10], [100, 0.1, 0]], \"outputs\": [[[110, 110]], [[120, 121]], [[200, 259]], [[100, 100]], [[0, 0]], [[100, 100]]]}", "source": "primeintellect"} | Simple interest on a loan is calculated by simply taking the initial amount (the principal, p) and multiplying it by a rate of interest (r) and the number of time periods (n).
Compound interest is calculated by adding the interest after each time period to the amount owed, then calculating the next interest payment b... | 0 |
{"tests": "{\"inputs\": [[\"SanD\"], [\"sunshine\"], [\"sunsunsunsun\"], [\"123FISH321\"], [\"weoqipurpoqwuirpousandiupqwoieurioweuwateruierqpoiweurpouifiShqowieuqpwoeuisUn\"], [\"sAnDsandwaTerwatErfishFishsunsunsandwater\"], [\"joifjepiojfoiejfoajoijawoeifjowejfjoiwaefjiaowefjaofjwoj fawojef \"], [\"jwefjwjfsandsandwa... | Beaches are filled with sand, water, fish, and sun. Given a string, calculate how many times the words `"Sand"`, `"Water"`, `"Fish"`, and `"Sun"` appear without overlapping (regardless of the case).
## Examples
```python
sum_of_a_beach("WAtErSlIde") ==> 1
sum_of_a_beach("GolDeNSanDyWateRyBeaChSuNN... | 0 |
{"tests": "{\"inputs\": [\"1\\n1000000000\\n\", \"2\\n5 8\\n\", \"5\\n52 67 72 25 79\\n\", \"2\\n8 8\", \"1\\n1000010000\", \"5\\n20 67 72 25 79\", \"2\\n8 6\", \"1\\n1000000010\", \"5\\n2 67 72 25 79\", \"1\\n1000000110\", \"5\\n2 67 72 25 55\", \"2\\n11 0\", \"1\\n1000000111\", \"5\\n2 67 16 25 55\", \"1\\n1000000101... | For two sequences S and T of length N consisting of 0 and 1, let us define f(S, T) as follows:
- Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations.
- Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \time... | 0 |
{"tests": "{\"inputs\": [[2], [3], [14], [15], [26], [27]], \"outputs\": [[true], [false], [true], [false], [true], [false]]}", "source": "primeintellect"} | Is the number even?
If the numbers is even return `true`. If it's odd, return `false`.
Oh yeah... the following symbols/commands have been disabled!
use of ```%```
use of ```.even?``` in Ruby
use of ```mod``` in Python
Write your solution by modifying this code:
```python
def is_even(n):
```
Your solution ... | 0 |
{"tests": "{\"inputs\": [\"50\", \"99\", \"26\", \"9\", \"2\"], \"outputs\": [\"YES\", \"NO\", \"NO\", \"NO\", \"YES\"]}", "source": "primeintellect"} | From the divine land of heaven came to earth a fruit known as Magic fruit.Unfortunately the fruit was found by two friends X and Y.
After lot of fighting,they came to the conclusion that they will share the fruit if and only if when they can divide it into two even weighing parts without wasting any part of fruit. Give... | 0 |
{"tests": "{\"inputs\": [\"6000 5000 20 2 400 300\", \"6000 5000 20 2 400 204\", \"6000 5000 20 2 499 204\", \"274 5000 28 1 499 204\", \"274 4268 28 0 499 209\", \"274 8140 32 0 499 209\", \"274 14753 32 0 499 132\", \"6000 5000 20 10 400 575\", \"16 16 8 8 8 8\", \"16 18 8 8 8 8\", \"6000 5000 20 2 400 228\", \"6000 ... | Problem
You brought a flat, holeless donut with a $ W $ horizontal $ H $ vertical $ H $ rectangle for ACPC.
Place this donut on the $ 2 $ dimension plane coordinate $ (0,0) $ with the center of the donut so that the side of length H and the $ y $ axis are parallel.
On the ACPC $ 1 $ day you ate a donut that was in t... | 0 |
{"tests": "{\"inputs\": [\"1 1 1\\n1 1\\n\", \"5 10 30\\n5 3\\n5 5\\n5 10\\n1 2\\n5 7\\n1 8\\n4 9\\n2 3\\n4 10\\n3 1\\n4 5\\n3 8\\n1 7\\n2 2\\n1 5\\n2 3\\n3 2\\n3 10\\n3 2\\n2 7\\n2 4\\n1 4\\n4 8\\n2 6\\n4 1\\n5 3\\n4 6\\n5 8\\n4 5\\n1 1\\n\", \"3 3 10\\n1 2\\n1 3\\n2 2\\n2 2\\n2 2\\n3 2\\n2 2\\n3 2\\n2 3\\n3 1\\n\", \... | You are given a matrix, consisting of n rows and m columns. The rows are numbered top to bottom, the columns are numbered left to right.
Each cell of the matrix can be either free or locked.
Let's call a path in the matrix a staircase if it:
* starts and ends in the free cell;
* visits only free cells;
* ha... | 0 |
{"tests": "{\"inputs\": [\"3\\n11\\nantontrygub\\n15\\nbestcoordinator\\n19\\ntrywatchinggurabruh\\n\", \"1\\n119\\nbyeaeksdkrmobuhcmvyzaqhsftfcthmsmxrwfajcygnmgqprvaclcswjxvaxdqcsfrolvrdxpnfsnbbhohqoppvikmiojnlaoehawsnafxdsomcaydrentk\\n\", \"1\\n200\\nrgygrbbbrrbbuuggbburgybrtuybubtrbryrtutuuutrrgtbbgtggrggtttbgtbuub... | A string $b$ is a subsequence of a string $a$ if $b$ can be obtained from $a$ by deletion of several (possibly, zero or all) characters. For example, "xy" is a subsequence of "xzyw" and "xy", but not "yx".
You are given a string $a$. Your task is to reorder the characters of $a$ so that "trygub" is not a subsequence o... | 0 |
{"tests": "{\"inputs\": [\"1 3\\n1 -1 0\\n0 0 5\\n1 0 0\", \"3 5\\n0 0 1\\n0 1 2\\n0 2 3\\n1 0 2\\n1 1 4\", \"1 3\\n1 -1 0\\n0 0 9\\n1 0 0\", \"3 5\\n0 0 1\\n0 2 2\\n0 2 3\\n1 0 2\\n1 1 2\", \"1 3\\n1 -1 0\\n0 0 5\\n0 0 0\", \"1 3\\n1 -1 0\\n0 0 15\\n1 0 0\", \"3 5\\n0 0 1\\n0 2 2\\n0 2 3\\n1 0 2\\n0 1 2\", \"3 5\\n0 0... | Write a program which manipulates a sequence A = {a0, a1, . . . , an-1} with the following operations:
* find(s, t): report the minimum element in as, as+1, . . . ,at.
* update(i, x): change ai to x.
Note that the initial values of ai (i = 0, 1, . . . , n−1) are 231-1.
Constraints
* 1 ≤ n ≤ 100000
* 1 ≤ q ≤ 10000... | 0 |
{"tests": "{\"inputs\": [[\"Did it work?\"], [\"I really hope it works this time...\"], [\"Reverse this string, please!\"], [\"Have a beer\"], [\" \"], [\"This is not a test \"], [\"This is a test \"]], \"outputs\": [[\"Did ti work?\"], [\"I yllaer hope ti works siht time...\"], [\"Reverse siht string, !esaelp... | Reverse every other word in a given string, then return the string. Throw away any leading or trailing whitespace, while ensuring there is exactly one space between each word. Punctuation marks should be treated as if they are a part of the word in this kata.
Write your solution by modifying this code:
```python
def ... | 0 |
{"tests": "{\"inputs\": [[\"1123\"], [\"1\"], [\"11\"], [\"a\"], [\"a123\"], [\"21\"], [\"1211\"], [\"12322212223443\"], [\"\"], [\"123a\"]], \"outputs\": [[\"211213\"], [\"11\"], [\"21\"], [\"\"], [\"\"], [\"1211\"], [\"111221\"], [\"111213321132132413\"], [\"\"], [\"\"]]}", "source": "primeintellect"} | Given a string of integers, count how many times that integer repeats itself, then return a string showing the count and the integer.
Example: `countMe('1123')` (`count_me` in Ruby)
- Here 1 comes twice so `` will be `"21"`
- then 2 comes once so `` will be `"12"`
- then 3 comes once so `` will be `"13"`
hence outp... | 0 |
{"tests": "{\"inputs\": [[[0, 0, 0], 0], [[3, 2, 10, 4, 1, 6, 9], 15], [[2, 10, 4, 1, 6, 9], 15], [[3, 2, 10, 4, 1, 6], 15], [[1, 1, 8, 3, 1, 1], 15], [[1, 1, 8, 3, 1, 1], 11], [[1, 1, 8, 3, 1, 1], 13], [[9, 0, 6], 0], [[], 25], [[25], 25], [[25, 26, 23, 24], 0], [[2, 1, 2], 0], [[1, 1, 15, -1, -1], 15], [[1, 1, 15, -1... | An array is called `centered-N` if some `consecutive sequence` of elements of the array sum to `N` and this sequence is preceded and followed by the same number of elements.
Example:
```
[3,2,10,4,1,6,9] is centered-15
because the sequence 10,4,1 sums to 15 and the sequence
is preceded by two elements [3,2] and foll... | 0 |
{"tests": "{\"inputs\": [[\"Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated.\"], [\"Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules.\"], [\"Although prac... | You have a collection of lovely poems. Unfortuantely they aren't formatted very well. They're all on one line, like this:
```
Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated.
```
What you want is to present each sentence on a new line, ... | 0 |
{"tests": "{\"inputs\": [\"2 4\\n\", \"2 9999999\\n\", \"10000000 2\\n\", \"6407688 3000816\\n\", \"861392 6200826\\n\", \"999999 92321\\n\", \"4108931 211273\\n\", \"999999 999999\\n\", \"1507925 5483803\\n\", \"4 1\\n\", \"1001 1500126\\n\", \"1 10000000\\n\", \"9900111 1082917\\n\", \"31623 10000000\\n\", \"191919 1... | Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if <image> and <image>, where k is some integer number in range [1, a].
By <image> we denote the quotient of integer division of... | 0 |
{"tests": "{\"inputs\": [\"8\\n0 0 0 2 2 2 0 0\\n1 1 1 1 1 0 0 0\\n4\\n1 1 2 2\\n0 0 2 2\\n0\", \"8\\n0 0 0 2 2 2 0 0\\n1 1 1 1 1 0 0 0\\n2\\n1 1 2 2\\n0 0 2 2\\n0\", \"8\\n0 0 0 2 2 2 0 0\\n0 1 1 1 1 0 0 0\\n2\\n1 1 2 2\\n0 0 2 2\\n0\", \"8\\n0 0 0 2 2 2 0 1\\n1 1 1 1 0 0 0 0\\n4\\n1 1 2 2\\n0 0 2 2\\n0\", \"8\\n0 0 0... | Ninja Atsushi guards the town from the roof of the Ninja Building from early morning to late night every day. This Ninja Building is two adjacent buildings of the same floor, and Atsushi's daily routine is to jump between buildings and head to the rooftop for security.
Because these two buildings are cleaned frequentl... | 0 |
{"tests": "{\"inputs\": [\"5 5\\n%#... ...#%\\n.#.#. .#.#.\\n.#.#. .#.#.\\n.#.#. .#.#.\\n...#L R#...\\n3 2\\n.L. .R#\\n%.. .&.\\n4 1\\nL.%. %..R\\n0 0\", \"5 5\\n%#... .%.#.\\n.#.#. .#.#.\\n.#.#. .#.#.\\n.#.#. .#.#.\\n...#L R#...\\n3 2\\n.L. .R#\\n%.. .&.\\n4 1\\nL.%. %..R\\n0 0\", \"5 5\\n%#... ...#%\\n.#.#. .#.#.\\n.... | Twin adventurers Rin and Len are searching for treasure in the Mirror Cave. The cave has two pairs of rooms, the Hall of Mirrors, and an expensive treasure lies behind the door of the room.
For convenience, each of the two rooms is considered to have W × H cells arranged in a grid pattern. The outside of the room is s... | 0 |
{"tests": "{\"inputs\": [\"3\\n5 3\\n1 2 3 4 5\\n3 2 5\\n4 3\\n4 3 2 1\\n4 3 1\\n7 4\\n1 4 7 3 6 2 5\\n3 2 4 5\\n\", \"6\\n2 1\\n2 1\\n1\\n3 2\\n1 3 2\\n1 3\\n4 2\\n4 1 3 2\\n1 2\\n5 3\\n4 3 2 5 1\\n1 4 5\\n6 3\\n2 4 5 6 1 3\\n2 4 5\\n7 3\\n7 6 4 3 2 1 5\\n1 2 6\\n\", \"6\\n2 1\\n2 1\\n1\\n3 2\\n1 3 2\\n1 3\\n4 2\\n4 1... | We start with a permutation $a_1, a_2, \ldots, a_n$ and with an empty array $b$. We apply the following operation $k$ times.
On the $i$-th iteration, we select an index $t_i$ ($1 \le t_i \le n-i+1$), remove $a_{t_i}$ from the array, and append one of the numbers $a_{t_i-1}$ or $a_{t_i+1}$ (if $t_i-1$ or $t_i+1$ are wi... | 0 |
{"tests": "{\"inputs\": [[87], [1], [88], [89], [10]], \"outputs\": [[4], [0], [0], [24], [1]]}", "source": "primeintellect"} | Number is a palindrome if it is equal to the number with digits in reversed order.
For example, 5, 44, 171, 4884 are palindromes and 43, 194, 4773 are not palindromes.
Write a method `palindrome_chain_length` which takes a positive number and returns the number of special steps needed to obtain a palindrome. The speci... | 0 |
{"tests": "{\"inputs\": [\"3 5\\n123\\n52\\n82\\n84\\n70\\n2 4\\n10\\n30\\n40\\n60\\n0 0\", \"3 5\\n123\\n52\\n82\\n84\\n124\\n2 4\\n18\\n30\\n40\\n60\\n0 0\", \"1 5\\n90\\n52\\n82\\n84\\n70\\n2 4\\n10\\n30\\n40\\n60\\n0 0\", \"1 5\\n90\\n52\\n82\\n84\\n70\\n2 4\\n10\\n43\\n22\\n60\\n0 0\", \"3 5\\n123\\n52\\n82\\n87\\... | There are various parking lots such as three-dimensional type and tower type in the city to improve the utilization efficiency of the parking lot. In some parking lots, a "two-stage parking device" as shown in the figure is installed in one parking space to secure a parking space for two cars. This two-stage parking de... | 0 |
{"tests": "{\"inputs\": [\"4\\n2 5\\n10 10\\n2 5\\n3 3\\n4 5\\n5 2 4 9\\n8 8\\n5 3 3 6 10 100 9 15\\n\", \"1\\n10 243864180\\n886547706 549473499 522487623 522487623 522487623 694839856 347419928 5067 79578125 636625000\\n\", \"1\\n2 1000000000\\n1000000000 1000000000\\n\", \"3\\n2 1000000000\\n5 5\\n2 1000000000\\n4 7... | You are given an array $a$ of $n$ ($n \geq 2$) positive integers and an integer $p$. Consider an undirected weighted graph of $n$ vertices numbered from $1$ to $n$ for which the edges between the vertices $i$ and $j$ ($i<j$) are added in the following manner:
If $gcd(a_i, a_{i+1}, a_{i+2}, \dots, a_{j}) = min(a_i, a_{... | 0 |
{"tests": "{\"inputs\": [[\"din\"], [\"recede\"], [\"Success\"], [\"CodeWarrior\"], [\"Supralapsarian\"], [\"iiiiii\"], [\"(( @\"], [\" ( ( )\"]], \"outputs\": [[\"(((\"], [\"()()()\"], [\")())())\"], [\"()(((())())\"], [\")()))()))))()(\"], [\"))))))\"], [\"))((\"], [\")))))(\"]]}", "source": "primeintellect"} | The goal of this exercise is to convert a string to a new string where each character in the new string is `"("` if that character appears only once in the original string, or `")"` if that character appears more than once in the original string. Ignore capitalization when determining if a character is a duplicate.
##... | 0 |
{"tests": "{\"inputs\": [[[[2, 2, 2], [4, 2, 6], [8, 8, 2]]], [[[7, 2, 2], [4, 2, 6], [1, 8, 1]]], [[[1, 2, 3], [4, 5, 6], [7, 8, 9]]], [[[1, 2, 2, 5, 1], [4, 1, 6, 1, 1], [1, 8, 5, 6, 2], [1, 5, 2, 1, 2], [1, 8, 2, 6, 1]]], [[[88, 2, 2, 5, 1, 1, 2, 2, 5, 1], [4, 1, 6, 1, 1, 1, 2, 2, 7, 1], [1, 8, 1, 6, 2, 1, 2, 1, 5, ... | **Principal Diagonal** -- The principal diagonal in a matrix identifies those elements of the matrix running from North-West to South-East.
**Secondary Diagonal** -- the secondary diagonal of a matrix identifies those elements of the matrix running from North-East to South-West.
For example:
```
matrix: [... | 0 |
{"tests": "{\"inputs\": [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20]], \"outputs\": [[1], [2], [6], [12], [60], [60], [420], [840], [2520], [2520], [27720], [27720], [360360], [360360], [360360], [720720], [12252240], [12252240], [232792560], [232792560]... | 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
Task:
Write
```
smallest(n)
```
that will find the smallest positive number that is evenly divisible by all of the numbers from 1 to n (n <= 40).
E.g
```python
smallest(5) == 60 # 1 to 5 can all divide evenly int... | 0 |
{"tests": "{\"inputs\": [\"1 0\\n1 1 100 100\\n\", \"11 8\\n9 1 11 5\\n2 2 8 12\\n3 8 23 10\\n2 1 10 5\\n7 1 19 5\\n1 8 3 10\\n1 5 3 9\\n1 2 3 4\\n1 2 3 4\\n4 2 12 16\\n8 5 12 9\\n\", \"1 0\\n1 1 1000000000 1000000000\\n\", \"2 1\\n1 1 1000000000 1000000000\\n100 200 200 300\\n\", \"1 0\\n1 1 4 4\\n\", \"2 1\\n1 1 1000... | Edo has got a collection of n refrigerator magnets!
He decided to buy a refrigerator and hang the magnets on the door. The shop can make the refrigerator with any size of the door that meets the following restrictions: the refrigerator door must be rectangle, and both the length and the width of the door must be posit... | 0 |
{"tests": "{\"inputs\": [\"6\\n8\\n7 2 8 2 7 1\\n5 1\\n8\\n2 2 1 2 2 1\\n5 5\\n8\\n2 2 1 2 2 1\\n6 6\\n8\\n1 1 1 2 2 1\\n5 5\\n8\\n2 2 1 2 2 1\\n8 8\\n8\\n8 8 8 7 7 8\\n4 8\\n\", \"3\\n100000\\n100000 100000 99999 100000 100000 99999\\n69 100000\\n100000\\n2 100000 1 99999 1 100000\\n100000 9\\n100000\\n2 3 3 2 3 3\\n6... | Ela likes Chess a lot. During breaks, she usually challenges her co-worker in DTL to some chess games. She's not an expert at classic chess, but she's very interested in Chess variants, where she has to adapt to new rules and test her tactical mindset to win the game.
The problem, which involves a non-standard chess p... | 0 |
{"tests": "{\"inputs\": [\"3 20\\n2 80\\n5 120\\n16 1\", \"3 20\\n2 1\\n9 120\\n16 1\", \"3 20\\n0 80\\n9 1\\n16 120\", \"1 100100000000000\\n50000000000000 1\", \"15 10000000000\\n400000000 1000000000\\n800000000 1000000000\\n1900000000 1000000000\\n2400000000 1000000000\\n2900000000 1000000000\\n3300000000 1000000000... | "Teishi-zushi", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.
Nakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on... | 0 |
{"tests": "{\"inputs\": [[[2, 3], 1, 3], [[1, 3, 5], 1, 1], [[1, 3, 5], 1, 10], [[], 1, 10], [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 1, 10], [[10, 9, 8, 7, 6, 5, 4, 3, 2, 1], 1, 10], [[5, 4, 7, 8, 9, 6, 3, 2, 10, 1], 1, 10], [[-2], -1, 3], [[-2, 2], -1, 3], [[-2, 3], -1, 3], [[2, -3], -1, 3], [[2, 4, 7], -100, 100], [[2, 4, ... | Write a function `sumTimesTables` which sums the result of the sums of the elements specified in `tables` multiplied by all the numbers in between `min` and `max` including themselves.
For example, for `sumTimesTables([2,5],1,3)` the result should be the same as
```
2*1 + 2*2 + 2*3 +
5*1 + 5*2 + 5*3
```
i.e. the table... | 0 |
{"tests": "{\"inputs\": [\"50 50\\n+ 14\\n+ 4\\n+ 20\\n+ 37\\n+ 50\\n+ 46\\n+ 19\\n- 20\\n+ 25\\n+ 47\\n+ 10\\n+ 6\\n+ 34\\n+ 12\\n+ 41\\n- 47\\n+ 9\\n+ 22\\n+ 28\\n- 41\\n- 34\\n+ 47\\n+ 40\\n- 12\\n+ 42\\n- 9\\n- 4\\n+ 15\\n- 15\\n+ 27\\n+ 8\\n+ 38\\n+ 9\\n+ 4\\n+ 17\\n- 8\\n+ 13\\n- 47\\n+ 7\\n- 9\\n- 38\\n+ 30\\n+ ... | By 2312 there were n Large Hadron Colliders in the inhabited part of the universe. Each of them corresponded to a single natural number from 1 to n. However, scientists did not know what activating several colliders simultaneously could cause, so the colliders were deactivated.
In 2312 there was a startling discovery:... | 0 |
{"tests": "{\"inputs\": [[\"5457 6238 9823 4311\"], [\"8895 6238 9323 4311\"], [\"5457 6238 5568 4311\"], [\"5457 6238 9323 4311\"], [\"2222 2222 2222 2224\"], [\"5457 1125 9323 4311\"], [\"1252 6238 9323 4311\"], [\"9999 9999 9999 9995\"], [\"0000 0300 0000 0000\"], [\"4444 4444 4444 4448\"], [\"5457 6238 9323 1252\"]... | # Description
Write a function that checks whether a credit card number is correct or not, using the Luhn algorithm.
The algorithm is as follows:
* From the rightmost digit, which is the check digit, moving left, double the value of every second digit; if the product of this doubling operation is greater than 9 (e.g.... | 0 |
{"tests": "{\"inputs\": [[\"5*4+6\"], [\"5+4*6\"], [\"3*8+6*5\"], [\"5*8+6*3*2\"], [\"5.4*4.0+6.2+8.0\"], [\"0.5*1.2*56+9.6*5*81+1\"], [\"1\"], [\"1.333333333*1.23456789+0.003*0.002\"]], \"outputs\": [[\"2.60000e+01\"], [\"2.90000e+01\"], [\"5.40000e+01\"], [\"7.60000e+01\"], [\"3.58000e+01\"], [\"3.92260e+03\"], [\"1.... | Write a function that solves an algebraic expression given as a string.
* The expression can include only sums and products.
* The numbers in the expression are in standard notation (NOT scientific).
* In contrast, the function should return a string with the calculated value given in scientific notation with 5 de... | 0 |
{"tests": "{\"inputs\": [[15], [18], [19], [false], [\"wow doge\"], [0.0435]], \"outputs\": [[8], [6], [18], [0], [0], [0]]}", "source": "primeintellect"} | In number theory, Euler's totient is an arithmetic function, introduced in 1763 by Euler, that counts the positive integers less than or equal to `n` that are relatively prime to `n`. Thus, if `n` is a positive integer, then `φ(n)`, notation introduced by Gauss in 1801, is the number of positive integers `k ≤ n` for wh... | 0 |
{"tests": "{\"inputs\": [[[1, 2], [2, 1]], [[1, -2], [2, 1]], [[7, 8], [7, -6]], [[-13, -26], [-8, 4]], [[1, 2, 3], [0, -3, 2]], [[3, 4, 5], [6, 7, -8]], [[3, -4, -5], [-4, -3, 0]], [[1, -2, 3, -4], [-4, 3, 2, -1]], [[2, 4, 5, 6, 7], [-14, -12, 0, 8, 4]], [[5, 10, 1, 20, 2], [-2, -20, -1, 10, 5]]], \"outputs\": [[false... | Suppose I have two vectors: `(a1, a2, a3, ..., aN)` and `(b1, b2, b3, ..., bN)`. The dot product between these two vectors is defined as:
```
a1*b1 + a2*b2 + a3*b3 + ... + aN*bN
```
The vectors are classified as orthogonal if the dot product equals zero.
Complete the function that accepts two sequences as inputs an... | 0 |
{"tests": "{\"inputs\": [\"5 5\\n0 0\\n1 1\\n3 0\\n3 2\\n0 2\\n1 2\\n3 3\\n2 4\\n3 4\\n1 5\", \"7 6\\n0 2\\n3 0\\n2 2\\n1 0\\n4 1\\n2 3\\n3 4\\n1 3\\n2 4\\n2 3\\n3 5\\n3 7\\n6 7\", \"7 6\\n0 2\\n3 0\\n2 2\\n1 0\\n4 1\\n2 3\\n2 4\\n1 3\\n2 4\\n2 3\\n3 5\\n3 7\\n6 7\", \"7 6\\n-1 2\\n3 0\\n2 2\\n1 0\\n4 1\\n2 3\\n2 4\\n1... | Villages were scattered in the Wakamatsu Plain of Aizu. Several settlements are connected by straight roads that allow them to travel to and from each other, and any settlement in the plain can be traced back and forth. Each road has a lengthy maintenance fee, but all the settlements funded the road to maintain it.
At... | 0 |
{"tests": "{\"inputs\": [\"[[r-i]-[m-e]]\\ne 0\\nr 1\\ni 1\\nn 2\", \"[[m-y]-[a-o]]\\nn 0\\na 1\\ny 2\\nm 0\", \"[[r-i]-[m-e]]\\nd 0\\nr 1\\ni 1\\nn 2\", \"[[r-i]-[m-e]]\\nd 0\\nr 1\\ni 1\\nn 3\", \"[[r-i]-[m-e]]\\nd 0\\nr 1\\nh 1\\nn 3\", \"[[r-i]-[m-e]]\\nd 0\\nr 1\\ng 1\\nn 3\", \"[[r-i]-[m-e]]\\nd 0\\nr 1\\ng 1\\nm... | In 21XX, an annual programming contest, Japan Algorithmist GrandPrix (JAG) has become one of the most popular mind sports events.
JAG is conducted as a knockout tournament. This year, $N$ contestants will compete in JAG. A tournament chart is represented as a string. '[[a-b]-[c-d]]' is an easy example. In this case, t... | 0.25 |
{"tests": "{\"inputs\": [\"25\\n\", \"27\\n\", \"1\\n\", \"97\\n\", \"98\\n\", \"94\\n\", \"21\\n\", \"97\\n\", \"19\\n\", \"3\\n\", \"28\\n\", \"2\\n\", \"8\\n\", \"12\\n\", \"15\\n\", \"91\\n\", \"4\\n\", \"9\\n\", \"23\\n\", \"29\\n\", \"22\\n\", \"96\\n\", \"30\\n\", \"7\\n\", \"100\\n\", \"16\\n\", \"100\\n\", \"9... | We all know the problem about the number of ways one can tile a 2 × n field by 1 × 2 dominoes. You probably remember that it goes down to Fibonacci numbers. We will talk about some other problem below, there you also are going to deal with tiling a rectangular field with dominoes.
You are given a 4 × n rectangular fie... | 0 |
{"tests": "{\"inputs\": [\"AIZV\", \"W\\\\AG\", \"[VIA\", \"BEW]\", \"VZIA\", \"V[IA\", \"W[IA\", \"AI[W\", \"AH[W\", \"HA[W\", \"HA[V\", \"GA[V\", \"GA\\\\V\", \"GA\\\\W\", \"W\\\\BG\", \"W\\\\BF\", \"FB\\\\W\", \"GB\\\\W\", \"WFB\\\\\", \"WF\\\\B\", \"B\\\\FW\", \"A\\\\FW\", \"A[FW\", \"AIZT\", \"AHZV\", \"VAI[\", \"... | A: A-Z-
problem
There is a circular board of 26 squares, each square with one capital letter of the alphabet written clockwise in alphabetical order. That is, the clockwise side of the'A'square is the'B' square, the next side of the'B'square is the'C'square, and ..., the clockwise side of the'Z'square is the'A'. It's... | 0 |
{"tests": "{\"inputs\": [\"4\\n6\\n1 1 1 2 2 1 2 1 2 1 1 2\\n2\\n1 2 1 2\\n3\\n1 1 1 1 1 1\\n2\\n2 1 1 1\\n\", \"4\\n6\\n1 1 1 1 2 1 2 1 2 1 1 2\\n2\\n1 2 1 2\\n3\\n1 1 1 1 1 1\\n2\\n2 1 1 1\\n\", \"4\\n6\\n1 1 1 1 2 1 2 1 2 1 1 2\\n2\\n2 2 1 2\\n3\\n1 1 1 1 1 1\\n2\\n2 1 1 1\\n\", \"4\\n6\\n1 1 1 1 2 1 2 1 2 1 1 2\\n2... | Karlsson has recently discovered a huge stock of berry jam jars in the basement of the house. More specifically, there were $2n$ jars of strawberry and blueberry jam.
All the $2n$ jars are arranged in a row. The stairs to the basement are exactly in the middle of that row. So when Karlsson enters the basement, he sees... | 0 |
{"tests": "{\"inputs\": [\"5 5\\n-38 -71 -293 75 1\\n-158 -38 -405 66 1\\n-236 -303 157 266 1\\n316 26 411 190 1\\n207 -312 -27 196 1\\n-50 292 -375 -401 389 -389\\n460 278 409 -329 -303 411\\n215 -220 -200 309 -474 300\\n310 -494 -87 -300 123 -463\\n386 378 486 -443 -64 299\", \"5 1\\n0 10 0 5 2\\n0 20 0 6 12\\n0 30 0... | In 20XX AD, a school competition was held. The tournament has finally left only the final competition. You are one of the athletes in the competition.
The competition you participate in is to compete for the time it takes to destroy all the blue objects placed in the space. Athletes are allowed to bring in competition... | 0 |
{"tests": "{\"inputs\": [\"5\\n3 10\\n6 4\\n1 9\\n5 8\\n2 7\\n\", \"2\\n1 2\\n3 4\\n\", \"3\\n1 2\\n3 6\\n4 5\\n\", \"1\\n1 2\\n\", \"3\\n3 5\\n4 1\\n2 6\\n\", \"4\\n5 4\\n6 2\\n7 1\\n8 3\\n\", \"5\\n8 5\\n10 3\\n4 7\\n6 9\\n1 2\\n\", \"6\\n9 8\\n10 7\\n4 6\\n12 11\\n5 3\\n2 1\\n\", \"10\\n11 16\\n15 14\\n7 5\\n13 9\\n... | There is a deck of $n$ cards. The $i$-th card has a number $a_i$ on the front and a number $b_i$ on the back. Every integer between $1$ and $2n$ appears exactly once on the cards.
A deck is called sorted if the front values are in increasing order and the back values are in decreasing order. That is, if $a_i< a_{i+1}$... | 0 |
{"tests": "{\"inputs\": [\"249727\\n\", \"2023\\n\", \"2152\\n\", \"968951\\n\", \"230003\\n\", \"58997\\n\", \"8\\n\", \"10\\n\", \"1898\\n\", \"52382\\n\", \"696457\\n\", \"331741\\n\", \"6\\n\", \"454507\\n\", \"29\\n\", \"17\\n\", \"930454\\n\", \"28\\n\", \"26\\n\", \"3\\n\", \"3493\\n\", \"343121\\n\", \"20\\n\",... | Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post is fake, using some secret phrase hidden in the post as a subsequence. To make this method foolproof, she... | 0 |
{"tests": "{\"inputs\": [[\"man i need a taxi up to ubud\"], [\"what time are we climbing up the volcano\"], [\"take me to semynak\"], [\"massage yes massage yes massage\"], [\"take two bintang and a dance please\"]], \"outputs\": [[\"taxi\"], [\"volcano\"], [\"semynak\"], [\"massage\"], [\"bintang\"]]}", "source": "pr... | Given a string of words, you need to find the highest scoring word.
Each letter of a word scores points according to its position in the alphabet: `a = 1, b = 2, c = 3` etc.
You need to return the highest scoring word as a string.
If two words score the same, return the word that appears earliest in the original str... | 0 |
{"tests": "{\"inputs\": [\"6\\n0 0\\n3 4\\n9 12\\n17 6\\n21 0\\n33 0\\n5\\n0 0\\n10 0\\n20 0\\n30 0\\n40 0\\n10\\n0 0\\n1 2\\n3 0\\n6 3\\n9 0\\n11 2\\n13 0\\n15 2\\n16 2\\n18 0\\n7\\n0 0\\n150 997\\n300 1\\n450 999\\n600 2\\n750 998\\n900 0\\n0\", \"6\\n0 -1\\n3 4\\n9 12\\n17 6\\n21 9\\n33 0\\n5\\n0 0\\n10 0\\n20 0\\n3... | Two experienced climbers are planning a first-ever attempt: they start at two points of the equal altitudes on a mountain range, move back and forth on a single route keeping their altitudes equal, and finally meet with each other at a point on the route. A wise man told them that if a route has no point lower than the... | 0 |
{"tests": "{\"inputs\": [\"2 3 1 4 0 1 1 1\\n4 2 3 2 2 2 1 1\", \"2 3 1 2 0 1 1 1\\n4 2 3 2 2 2 1 1\", \"0 3 1 3 0 0 -1 2\\n1 1 5 2 -1 3 0 0\", \"0 3 1 1 0 1 -1 2\\n1 1 5 2 -1 3 0 0\", \"0 3 1 1 0 -1 -1 2\\n1 1 5 3 -1 3 0 -1\", \"0 2 0 1 0 -1 -1 2\\n1 1 5 3 -1 3 0 -1\", \"0 2 1 1 0 -1 -1 2\\n1 1 5 3 -1 0 0 -1\", \"0 4 ... | <image>
You know the merry-go-round in the amusement park. Vehicles such as horses and carriages are fixed on a large disk, and it is a standard playset that the vehicle swings up and down at the same time as the disk rotates. A merry-go-round in an amusement park has two four-seater carriages, two two-seater cars, f... | 0 |
{"tests": "{\"inputs\": [\"5 10 3\\n3 9\\n2 8\\n2 1\", \"8 10 1\\n6 6\", \"5 10 3\\n3 9\\n2 8\\n1 1\", \"10 10 3\\n3 9\\n2 8\\n1 1\", \"5 10 3\\n1 9\\n2 8\\n5 1\", \"10 10 1\\n6 2\", \"13 10 3\\n3 9\\n2 6\\n1 1\", \"5 19 3\\n2 9\\n2 8\\n1 1\", \"26 10 3\\n3 9\\n2 6\\n1 1\", \"10 19 3\\n1 9\\n0 4\\n1 1\", \"24 4 1\\n6 2... | Problem
There are $ N $ streetlights on a two-dimensional square of $ W \ times H $.
Gaccho wants to start with $ (1,1) $ and go to $ (W, H) $.
Gaccho is afraid of dark places, so he only wants to walk in the squares that are brightened by the streetlights.
Initially, all streetlights only brighten the squares with th... | 0 |
{"tests": "{\"inputs\": [\"1 1000000000 1 1000000000 49\\n\", \"4 7 4 7 2\\n\", \"47 95 18 147 4\\n\", \"1 1000 1 1000 14\\n\", \"8548 8554575 895 9954448 47\\n\", \"1 1000000000 488 744444444 748\\n\", \"7 7 4 4 2\\n\", \"1 6 2 4 1\\n\", \"1 10000 1 10000 6\\n\", \"4 7 1 1000000000 395\\n\", \"1 1000000000 1 100000000... | Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya and his friend Vasya play an interesting game. Petya randomly chooses an integer p from the in... | 0 |
{"tests": "{\"inputs\": [[\"LEET\"], [\"CODEWARS\"], [\"HELLO WORLD\"], [\"LOREM IPSUM DOLOR SIT AMET\"], [\"THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG\"]], \"outputs\": [[\"1337\"], [\"(0D3W@R$\"], [\"#3110 W0R1D\"], [\"10R3M !P$UM D010R $!7 @M37\"], [\"7#3 QU!(K 8R0WN F0X JUMP$ 0V3R 7#3 1@2Y D06\"]]}", "source": "pr... | ```if-not:rust
Your task is to write a function `toLeetSpeak` that converts a regular english sentence to Leetspeak.
```
```if:rust
Your task is to write a function `to_leet_speak` that converts a regular english sentence to Leetspeak.
```
More about LeetSpeak You can read at wiki -> https://en.wikipedia.org/wiki/Leet... | 0 |
{"tests": "{\"inputs\": [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], [20], [21], [22], [23], [24], [25]], \"outputs\": [[0], [1], [1], [2], [3], [5], [8], [13], [21], [34], [55], [89], [144], [233], [377], [610], [987], [1597], [2584], [4181], [6765], [10946]... | I love Fibonacci numbers in general, but I must admit I love some more than others.
I would like for you to write me a function that when given a number (n) returns the n-th number in the Fibonacci Sequence.
For example:
```python
nth_fib(4) == 2
```
Because 2 is the 4th number in the Fibonacci Sequence.
For ... | 0 |
{"tests": "{\"inputs\": [\"3 5\\n.....\\n.#.#.\\n.###.\\n.#.#.\\n.....\", \"3 1\\n.....\\n.#.#.\\n.###.\\n.#.#.\\n.....\", \"2 5\\n.....\\n.#.#.\\n.###.\\n.#.#.\\n.....\", \"4 2\\n.....\\n.#.#/\\n.###.\\n.#.#.\\n.....\", \"0 1\\n.....\\n.#.#.\\n.###.\\n.#.#.\\n.....\", \"4 1\\n.....\\n.#.#.\\n.###.\\n.#.#.\\n.....\", \... | problem
Given the squares of $ R * C $. Each square is either an empty square or a square with a hole. The given square meets the following conditions.
* The cells with holes are connected. (You can move a square with a hole in the cross direction to any square with a hole)
* Empty cells are connected.
You can gen... | 0.125 |
{"tests": "{\"inputs\": [[2, [1, 2]], [10, [10, 10]], [5, [5, 5]], [0, [0, 0]], [1, [0, 0]], [1, [0, 1]], [1, [1, 1]], [3, [3, 3]], [3, [1, 3]], [100, [100, 100]]], \"outputs\": [[3], [2], [2], [6], [5], [4], [5], [3], [1], [2]]}", "source": "primeintellect"} | # Task
You are a lifelong fan of your local football club, and proud to say you rarely miss a game. Even though you're a superfan, you still hate boring games. Luckily, boring games often end in a draw, at which point the winner is determined by a penalty shoot-out, which brings some excitement to the viewing experienc... | 0 |
{"tests": "{\"inputs\": [\"7\\n1\\n2\\n3\\n6\\n100\\n25\\n3000000000000\\n\", \"7\\n1\\n2\\n3\\n6\\n100\\n25\\n3000000000000\\n\", \"7\\n1\\n2\\n3\\n4\\n100\\n25\\n3000000000000\\n\", \"7\\n1\\n2\\n3\\n6\\n110\\n25\\n3000000000000\\n\", \"7\\n1\\n2\\n3\\n4\\n100\\n25\\n1991556943611\\n\", \"7\\n1\\n1\\n3\\n6\\n110\\n25... | Theofanis has a riddle for you and if you manage to solve it, he will give you a Cypriot snack halloumi for free (Cypriot cheese).
You are given an integer $n$. You need to find two integers $l$ and $r$ such that $-10^{18} \le l < r \le 10^{18}$ and $l + (l + 1) + \ldots + (r - 1) + r = n$.
-----Input-----
The firs... | 0.375 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.