info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"tests": "{\"inputs\": [[\"4103432323\"], [\"4103438970\"], [\"4104305768\"], [\"4102204351\"], [\"4107056043\"]], \"outputs\": [[\"6957678787\"], [\"6957672135\"], [\"6956750342\"], [\"6958856709\"], [\"6953504567\"]]}", "source": "primeintellect"} | Fans of The Wire will appreciate this one.
For those that haven't seen the show, the Barksdale Organization has a simple method for encoding telephone numbers exchanged via pagers: "Jump to the other side of the 5 on the keypad, and swap 5's and 0's."
Here's a keypad for visualization.
```
βββββ¬ββββ¬ββββ
β 1 β 2 β 3 β... | 0 |
{"tests": "{\"inputs\": [\"8 703528038 1\\n\", \"94 1634867304 3200\\n\", \"5 559703685 1\\n\", \"80 500000000000000000 3200\\n\", \"1 1000000000000000000 0\\n\", \"4 1484499480 1\\n\", \"87 434070509 3200\\n\", \"38 1150965180 1\\n\", \"5 37 24\\n\", \"5 37 4\\n\", \"92 548977630 3200\\n\", \"36 290905083 1\\n\", \"3 ... | John Doe has an n Γ m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants to use such operations to make each square subtable of size n Γ n have exactly k points.
John Doe wondered, how many distinct ways to fill the table with points are there, provided that... | 0 |
{"tests": "{\"inputs\": [\"2\\n3\\n4\", \"2\\n1\\n4\", \"2\\n2\\n4\", \"2\\n2\\n1\", \"2\\n1\\n1\", \"2\\n4\\n4\", \"2\\n5\\n4\", \"2\\n1\\n6\", \"2\\n-1\\n4\", \"2\\n6\\n4\", \"2\\n4\\n1\", \"2\\n-1\\n7\", \"2\\n6\\n2\", \"2\\n6\\n1\", \"2\\n-1\\n8\", \"2\\n6\\n3\", \"2\\n10\\n1\", \"2\\n4\\n3\", \"2\\n1\\n7\", \"2\\n... | Asmany strings are strings of '0's and '1's that have as many 00 as 11. A string such as 00110001 consists of 3 "00" and
1 "11". Of course this is not an Asmany string. 0011, 1100, 000111000111 are Asmany strings. An L'th Asmany number is the number of
Asmany strings of length L for all positive integers L.
For esoter... | 0 |
{"tests": "{\"inputs\": [\"1000000000 1\\n\", \"481485937 21902154\\n\", \"1 1000000000\\n\", \"999999999 111111111\\n\", \"11 5\\n\", \"836218485 1720897\\n\", \"100000000 1\\n\", \"999899988 13\\n\", \"888888888 111111111\\n\", \"404878182 80324806\\n\", \"405262931 391908625\\n\", \"999999998 111111111\\n\", \"40564... | There is a polyline going through points (0, 0) β (x, x) β (2x, 0) β (3x, x) β (4x, 0) β ... - (2kx, 0) β (2kx + x, x) β ....
We know that the polyline passes through the point (a, b). Find minimum positive value x such that it is true or determine that there is no such x.
Input
Only one line containing two positiv... | 0.375 |
{"tests": "{\"inputs\": [\"10 5\\nYES NO YES NO YES NO\\n\", \"30 2\\nYES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES\\n\", \"3 2\\nYES YES\\n\", \"8 3\\nYES NO YES NO YES NO\\n\", \"50 50\\nYES\\n\", \"50 48\\nYES NO YES\\n\", \"50 3\\nNO YES NO YES N... | In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two Bobs?).
A group of soldiers is effective if and only if their names... | 0 |
{"tests": "{\"inputs\": [\"8 53 4\\n------------------------------------G-------------R--\\n-----------G--R--------------------------------------\\n----------------------------------GR-----------------\\n----------------------R------------------G-----------\\n-------------R----------------G----------------------\\n----... | Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card games and play with toy soldiers.
The rules of the game are as f... | 0 |
{"tests": "{\"inputs\": [\"4 16 105\\n2 4 15\\n1 1 16\\n2 2 57\\n3 4 31\\n1 2 47\\n2 3 28\\n1 3 70\\n4 2 50\\n3 1 10\\n4 1 11\\n4 4 27\\n1 4 56\\n3 3 28\\n3 2 28\\n2 1 33\\n4 3 63\\n\", \"5 15 90\\n2 3 71\\n5 1 72\\n3 2 29\\n2 5 35\\n5 4 49\\n2 1 5\\n3 3 37\\n5 2 3\\n1 1 24\\n1 3 50\\n5 3 45\\n2 2 31\\n4 3 71\\n3 1 30\... | The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series.
There are n single men and n single women among the main characters. An opinion poll showed that viewers lik... | 0 |
{"tests": "{\"inputs\": [[4, 0.64, \"|~~2~~~22~2~~22~2~~~~2~~~|\"], [9, 0.22, \"|~~~~~~~2~2~~~|\"], [6, 0.41, \"|~~~~~22~2~~~~~|\"], [8, 0.05, \"|2~~~~|\"], [8, 0.92, \"|~~~~2~2~~~~~22~~2~~~~2~~~2|\"]], \"outputs\": [[\"|~~X~~~X2~2~~22~2~~~~2~~~|\"], [\"|~~~~~~~X~2~~~|\"], [\"|~~~~~XX~2~~~~~|\"], [\"|2~~~~|\"], [\"|~~~... | You've arrived at a carnival and head straight for the duck shooting tent. Why wouldn't you?
You will be given a set amount of ammo, and an aim rating of between 1 and 0. No your aim is not always perfect - hey maybe someone fiddled with the sights on the gun...
Anyway your task is to calculate how many successful sh... | 0 |
{"tests": "{\"inputs\": [\"2\\n2 3\\n1.0\\n1 1.0 0.1 0.3\\n5\\n5 10 15 20 25\\n0.15\\n1 1.0 0.04 0.5\\n10\\n1783 3640 3991 4623 5465 5481 6369 6533 6865 8425\\n4.172\\n72 59.4705 0.0052834 0.12728810127294996\\n0\", \"2\\n2 4\\n1.0\\n1 1.0 0.1 0.3\\n5\\n5 10 15 20 25\\n0.15\\n1 1.0 0.04 0.5\\n10\\n1783 3640 3991 4623 5... | In the year 2020, a race of atomically energized cars will be held. Unlike todayβs car races, fueling is not a concern of racing teams. Cars can run throughout the course without any refueling. Instead, the critical factor is tire (tyre). Teams should carefully plan where to change tires of their cars.
The race is a r... | 0 |
{"tests": "{\"inputs\": [\"ABC 3\\nABC 1\\n2(4(AB)3(XY))10C 30\\n1000(1000(1000(1000(1000(1000(NM)))))) 999999\\n0 0\", \"ABC 3\\nABC 0\\n2(4(AB)3(XY))10C 3\\n1000(1000(1000(1000(1000(1000(NM)))))) 999999\\n0 0\", \"ABC 3\\nABC 2\\n2(4(AB)3(XY))10C 30\\n1000(1000(1000(1000(1000(1000(NM)))))) 999999\\n0 0\", \"ABC 3\\nA... | In 2300, the Life Science Division of Federal Republic of Space starts a very ambitious project to complete the genome sequencing of all living creatures in the entire universe and develop the genomic database of all space life. Thanks to scientific research over many years, it has been known that the genome of any spe... | 0 |
{"tests": "{\"inputs\": [\"1 1\\n2 2\\n6 1+2*3-4\\n3 1|2^3&4\\n3 (1+2)*3\\n3 1-1-1-1\\n0 #\", \"1 1\\n2 2\\n6 1+2*3-4\\n3 1|2^3&4\\n4 (1+2)*3\\n3 1-1-1-1\\n0 #\", \"1 1\\n2 2\\n1 1+2*3-4\\n3 1|2^3&4\\n4 (1+2)*3\\n3 1-1-1-1\\n0 #\", \"1 1\\n2 2\\n1 1+2-3*4\\n3 1|2^3&4\\n4 (1+2)*3\\n3 1-1-1-1\\n0 #\", \"1 1\\n2 2\\n1 1+2... | Dr. Akita, who lives in the neighborhood, is a historical researcher in the field and recently discovered a new ancient document about Ono no Komachi.
It is widely known that Ono no Komachi has given General Fukakusa, who wants to be dating, on condition that he keeps going for 100 nights, but he claims that this disc... | 0 |
{"tests": "{\"inputs\": [[0], [1], [2], [4], [3], [16]], \"outputs\": [[0], [0], [0], [1], [1], [3]]}", "source": "primeintellect"} | Andrzej was given a task:
There are n jars with pills. In every jar there is a different type of pill and the amount of pills in each jar is infinite. One type of pill makes a person glow about 30 minutes after taking and none of the other types has any effect.
His job is to determine, in which jar are the pills that m... | 0 |
{"tests": "{\"inputs\": [\"5\\n3 8 2 13 7\\nLLRLL\\n\", \"5\\n3 8 2 13 7\\nLLRLL\\n\", \"5\\n3 4 2 13 7\\nLLRLL\\n\", \"5\\n3 4 2 2 7\\nLLRLL\\n\", \"5\\n6 4 2 2 7\\nLLRLL\\n\", \"5\\n6 4 3 2 7\\nLLRLL\\n\", \"5\\n12 4 3 2 7\\nLLRLL\\n\", \"5\\n3 8 2 20 7\\nLLRLL\\n\", \"5\\n3 8 2 9 7\\nLLRLL\\n\", \"5\\n4 4 2 2 7\\nLL... | You are given an array $A$ of length $N$ weights of masses $A_1$, $A_2$...$A_N$.β―No two weights have the same mass. You can put every weight on one side of the balance (left or right).β―Youβ―don't have to putβ―weightsβ―in order $A_1$,...,$A_N$.β―There is also aβ―string $S$β―consisting of characters "L" and "R",β―meaning that a... | 0 |
{"tests": "{\"inputs\": [\"4\\n8 3 2 1\", \"5\\n0 5 3 4 2\", \"5\\n0 5 3 1 2\", \"5\\n1 8 3 4 2\", \"5\\n0 9 3 1 2\", \"5\\n1 8 3 4 0\", \"5\\n0 15 3 1 2\", \"5\\n1 5 3 8 2\", \"5\\n0 5 6 4 2\", \"5\\n0 5 3 1 4\", \"5\\n0 19 3 1 2\", \"4\\n3 5 2 1\", \"5\\n0 5 6 4 3\", \"5\\n0 12 3 1 4\", \"5\\n0 17 3 1 4\", \"4\\n4 0 ... | You are given $n$ integers $w_i (i = 0, 1, ..., n-1)$ to be sorted in ascending order. You can swap two integers $w_i$ and $w_j$. Each swap operation has a cost, which is the sum of the two integers $w_i + w_j$. You can perform the operations any number of times.
Write a program which reports the minimal total cost to... | 0 |
{"tests": "{\"inputs\": [[1], [5], [7], [153], [370], [371], [1634]], \"outputs\": [[true], [true], [true], [true], [true], [true], [true]]}", "source": "primeintellect"} | A [Narcissistic Number](https://en.wikipedia.org/wiki/Narcissistic_number) is a positive number which is the sum of its own digits, each raised to the power of the number of digits in a given base. In this Kata, we will restrict ourselves to decimal (base 10).
For example, take 153 (3 digits):
```
1^3 + 5^3 + 3^3 ... | 0 |
{"tests": "{\"inputs\": [[[1, 2, 3, 4], 2], [[38, 200, -18, 45], 1], [[1, 0, 0, 1], 5], [[0, 2, 0, 3], -2], [[-20, 1, -3, 14], -5], [[1, 2, 3, 5], 100], [[0, 4, 6, 13], 100]], \"outputs\": [[3], [200], [20], [-126], [-44402], [60560100487003612846322657690093088848428068520476594299], [335254562473098582210532865941148... | In an infinite array with two rows, the numbers in the top row are denoted
`. . . , A[β2], A[β1], A[0], A[1], A[2], . . .`
and the numbers in the bottom row are denoted
`. . . , B[β2], B[β1], B[0], B[1], B[2], . . .`
For each integer `k`, the entry `A[k]` is directly above
the entry `B[k]` in the array, as shown:
... | 0 |
{"tests": "{\"inputs\": [[\"Example string\"], [\"Example Input\"], [\"To be OR not to be That is the Question\"], [\"\"], [\"You Know When THAT Hotline Bling\"], [\" A b C d E f G \"]], \"outputs\": [[\"STRING eXAMPLE\"], [\"iNPUT eXAMPLE\"], [\"qUESTION THE IS tHAT BE TO NOT or BE tO\"], [\"\"], [\"bLING hOTLINE t... | Given a string, return a new string that has transformed based on the input:
* Change case of every character, ie. lower case to upper case, upper case to lower case.
* Reverse the order of words from the input.
**Note:** You will have to handle multiple spaces, and leading/trailing spaces.
For example:
```
"Exampl... | 0 |
{"tests": "{\"inputs\": [[1], [3], [4], [10], [2000]], \"outputs\": [[1], [7], [14], [175], [1333335000]]}", "source": "primeintellect"} | # Task
A lock has `n` buttons in it, numbered from `1 to n`. To open the lock, you have to press all buttons in some order, i.e. a key to the lock is a permutation of the first `n` integers. If you push the right button in the right order, it will be pressed into the lock. Otherwise all pressed buttons will pop out. W... | 0 |
{"tests": "{\"inputs\": [\"4\\n6\\n2 1 2 3 1 1\\n5\\n1 1 1 2 2\\n8\\n7 7 2 7 7 1 8 7\\n10\\n1 2 3 4 1 1 2 3 4 1\\n\", \"4\\n6\\n2 1 2 3 1 1\\n5\\n1 1 1 2 2\\n8\\n7 7 2 7 7 1 8 7\\n10\\n1 2 3 4 1 1 2 4 4 1\\n\", \"4\\n6\\n2 2 2 3 1 1\\n5\\n1 1 1 2 2\\n8\\n7 7 2 7 7 1 8 7\\n10\\n1 2 6 4 1 1 2 4 4 1\\n\", \"4\\n6\\n2 2 2 ... | To help those contestants who struggle a lot in contests, the headquarters of Codeforces are planning to introduce Division 5. In this new division, the tags of all problems will be announced prior to the round to help the contestants.
The contest consists of $n$ problems, where the tag of the $i$-th problem is denote... | 0 |
{"tests": "{\"inputs\": [\"4\\n5\\n01110\\n10 5 8 9 6\\n6\\n011011\\n20 10 9 30 20 19\\n4\\n0000\\n100 100 100 100\\n4\\n0111\\n5 4 5 1\\n\", \"7\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n3\\n101\\n1 1 1\\n\", \"7\\n6\\n011011\\n20 10 9 30 20 19\\n6\\n... | Monocarp has been collecting rare magazines for quite a while, and now he has decided to sell them. He distributed the magazines between $n$ boxes, arranged in a row. The $i$-th box contains $a_i$ magazines. Some of the boxes are covered with lids, others are not.
Suddenly it started to rain, and now Monocarp has to s... | 0.125 |
{"tests": "{\"inputs\": [\"2\\n2 2 4\\n0 1000000\\n0 1000000\\n1 0\\n1000000 1\\n999999 1000000\\n0 999999\\n5 4 9\\n0 1 2 6 1000000\\n0 4 8 1000000\\n4 4\\n2 5\\n2 2\\n6 3\\n1000000 1\\n3 8\\n5 8\\n8 8\\n6 8\\n\", \"1\\n2 2 2\\n0 1000000\\n0 1000000\\n1556 1000000\\n0 34\\n\", \"1\\n2 2 2\\n0 1000000\\n0 1000000\\n155... | There is a city that can be represented as a square grid with corner points in $(0, 0)$ and $(10^6, 10^6)$.
The city has $n$ vertical and $m$ horizontal streets that goes across the whole city, i. e. the $i$-th vertical streets goes from $(x_i, 0)$ to $(x_i, 10^6)$ and the $j$-th horizontal street goes from $(0, y_j)$... | 0 |
{"tests": "{\"inputs\": [[\"$-Wy,dM79H'i'o$n0C&I.ZTcMJw5vPlZc Hn!krhlaa:khV mkL;gvtP-S7Rt1Vp2RV:wV9VuhO Iz3dqb.U0w\"], [\"5MyQa9p0riYplZc\"], [\"5MyQa79H'ijQaw!Ns6jVtpmnlZ.V6p\"], [\"\"], [null]], \"outputs\": [[\"Do the kata \\\"Kobayashi-Maru-Test!\\\" Endless fun and excitement when finding a solution!\"], [\"This i... | For encrypting strings this region of chars is given (in this order!):
* all letters (ascending, first all UpperCase, then all LowerCase)
* all digits (ascending)
* the following chars: `.,:;-?! '()$%&"`
These are 77 chars! (This region is zero-based.)
Write two methods:
```python
def encrypt(text)
def decrypt(enc... | 0 |
{"tests": "{\"inputs\": [[\".----.----.----.----.----\"], [\"..----------...-....----------\"], [\"---------------\"], [\"..---.--------....--\"], [\".----..---...--....-.....-....--...---..----.-----\"]], \"outputs\": [[11111], [207600], [0], [2193], [1234567890]]}", "source": "primeintellect"} | The Earth has been invaded by aliens. They demand our beer and threaten to destroy the Earth if we do not supply the exact number of beers demanded.
Unfortunately, the aliens only speak Morse code. Write a program to convert morse code into numbers using the following convention:
1 .----
2 ..---
3 ...--
4 ....-
5 ...... | 0 |
{"tests": "{\"inputs\": [\"25 28\\nATK 1267\\nDEF 1944\\nATK 1244\\nATK 1164\\nATK 1131\\nDEF 1589\\nDEF 1116\\nDEF 1903\\nATK 1162\\nATK 1058\\nDEF 1291\\nDEF 1199\\nDEF 754\\nDEF 1726\\nDEF 1621\\nATK 1210\\nDEF 939\\nDEF 919\\nDEF 978\\nDEF 1967\\nATK 1179\\nDEF 1981\\nATK 1088\\nDEF 404\\nATK 1250\\n2149\\n1969\\n2... | Fox Ciel is playing a card game with her friend Jiro.
Jiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known that position of all Ciel's cards is Attack.
Now is Ciel's battle phase, Ciel can do the following ope... | 0 |
{"tests": "{\"inputs\": [[\"123321\"], [\"12341234\"], [\"100001\"], [\"100200\"], [\"912435\"], [\"12a12a\"], [\"999999\"], [\"1111\"], [\"000000\"], [\"\"]], \"outputs\": [[true], [false], [true], [false], [true], [false], [true], [false], [true], [false]]}", "source": "primeintellect"} | In Russia regular bus tickets usually consist of 6 digits. The ticket is called lucky when the sum of the first three digits equals to the sum of the last three digits. Write a function to find out whether the ticket is lucky or not. Return true if so, otherwise return false. Consider that input is always a string. Wat... | 0 |
{"tests": "{\"inputs\": [\"1\\nabc\\n\", \"5\\n123\\n234\\n345\\n456\\n567\\n\", \"8\\nzHW\\ncwx\\nxmo\\nWcw\\nox1\\nwxm\\nmox\\nHWc\\n\", \"2\\nbba\\nabb\\n\", \"99\\naaJ\\nJx9\\naLL\\nrCx\\nllJ\\naja\\nxxr\\nLal\\nv9C\\njrL\\nLvL\\nJLl\\nxlJ\\nLja\\nLLC\\njvL\\n9CJ\\nvrJ\\nlJJ\\nlCC\\nlxC\\njxl\\nLaJ\\nLxJ\\nrjr\\nxv... | While dad was at work, a little girl Tanya decided to play with dad's password to his secret database. Dad's password is a string consisting of n + 2 characters. She has written all the possible n three-letter continuous substrings of the password on pieces of paper, one for each piece of paper, and threw the password ... | 0 |
{"tests": "{\"inputs\": [\"0 1\\n3 1\", \"2 2\\n-1 -3\\n3 10\", \"2 3\\n4 3\\n1 2\", \"2 3\\n4 2\\n1 2\", \"2 3\\n1 2\\n1 2\", \"2 3\\n1 2\\n2 3\", \"1 3\\n1 2\\n2 3\", \"1 31\\n0 8\\n1 6\", \"1 1\\n3 2\", \"2 1\\n-1 0\\n3 10\", \"1 0\\n-1 1\\n3 8\", \"1 31\\n0 9\\n1 6\", \"2 1\\n-2 0\\n3 10\", \"2 2\\n-1 -2\\n3 13\", ... | Problem statement
Real variables $ x_1, x_2, ..., x_N $ satisfy the following conditions.
1. $ 0 \ leq x_i \ leq 1 $ ($ 1 \ leq i \ leq N $)
2. $ w_1x_1 + w_2x_2 + ... + w_Nx_N \ leq W $
At this time, find the maximum value that $ v_1x_1 + v_2x_2 + ... + v_Nx_N $ can take. It is known that such a maximum actually ... | 0.25 |
{"tests": "{\"inputs\": [\"3 5\", \"21 300\", \"300 280\", \"5 5\", \"13 300\", \"5 6\", \"13 146\", \"2 146\", \"1 8\", \"62 300\", \"13 178\", \"3 6\", \"4 146\", \"3 146\", \"4 6\", \"2 8\", \"2 13\", \"2 5\", \"62 108\", \"13 214\", \"2 3\", \"3 289\", \"2 14\", \"2 18\", \"2 6\", \"23 108\", \"6 58\", \"2 4\", \"1... | There are N towns in Takahashi Kingdom. They are conveniently numbered 1 through N.
Takahashi the king is planning to go on a tour of inspection for M days. He will determine a sequence of towns c, and visit town c_i on the i-th day. That is, on the i-th day, he will travel from his current location to town c_i. If he... | 0 |
{"tests": "{\"inputs\": [\"2\\n1 1\\n01000010\\n5 1\\n01101110\\n\", \"2\\n1 1\\n01000110\\n5 1\\n01101110\\n\", \"2\\n2 1\\n01000110\\n5 1\\n01101110\\n\", \"2\\n2 1\\n01000110\\n5 1\\n01101101\\n\", \"2\\n2 1\\n11000111\\n5 1\\n01101001\\n\", \"2\\n1 1\\n01000010\\n10 1\\n01101110\\n\", \"2\\n1 1\\n01000110\\n5 2\\n0... | Bertown is a city with $n$ buildings in a straight line.
The city's security service discovered that some buildings were mined. A map was compiled, which is a string of length $n$, where the $i$-th character is "1" if there is a mine under the building number $i$ and "0" otherwise.
Bertown's best sapper knows how to ... | 0 |
{"tests": "{\"inputs\": [\"0ig3hd12fz99\", \"0hg3hd12fz99\", \"833453334\", \"2336078995\", \"1437005866\", \"4037065\", \"15423151\", \"8181\", \"111\", \"0hg3hd13fz99\", \"90\", \"2\", \"1496009822\", \"0hf3hd12fz99\", \"1173329527\", \"99zf21dh3fh0\", \"0hfdh312fz99\", \"1810014501\", \"0gfdh312fz99\", \"2441147408\... | Problem
Given the string S, which consists of lowercase letters and numbers. Follow the steps below to compress the length of string S.
1. Change the order of the characters in the character string to any order.
Example: "0ig3he12fz99"-> "efghiz012399"
2. Perform the following operations any number of times.
* Sele... | 0 |
{"tests": "{\"inputs\": [\"5\\n0 2 3 4 5\", \"5\\n1 2 1 4 5\", \"5\\n0 4 3 13 4\", \"5\\n0 2 3 4 8\", \"5\\n0 2 3 4 14\", \"5\\n0 1 3 4 5\", \"5\\n0 2 3 4 2\", \"5\\n0 2 3 8 2\", \"5\\n0 2 3 13 2\", \"5\\n0 2 3 13 4\", \"5\\n0 4 3 9 4\", \"5\\n0 4 3 12 4\", \"5\\n1 4 3 12 4\", \"5\\n2 4 3 12 4\", \"5\\n2 4 3 22 4\", \"... | problem
Given the sequence $ A $ of length $ N $. The $ i $ item in $ A $ is $ A_i $. You can do the following for this sequence:
* $ 1 \ leq i \ leq N --Choose the integer i that is 1 $. Swap the value of $ A_i $ with the value of $ A_ {i + 1} $.
Find the minimum number of operations required to make $ A $ a sequ... | 0 |
{"tests": "{\"inputs\": [\"3 8 3\\n0 2\\n3 2\\n6 1\", \"4 20 18\\n7 2\\n9 1\\n12 1\\n18 1\", \"2 8 3\\n0 1\\n3 2\\n6 1\", \"3 8 3\\n1 2\\n3 2\\n6 1\", \"4 20 18\\n3 2\\n9 1\\n12 1\\n18 1\", \"1 8 3\\n1 2\\n3 2\\n6 1\", \"1 8 0\\n1 2\\n3 4\\n6 1\", \"1 8 1\\n1 2\\n3 4\\n6 1\", \"2 8 3\\n1 1\\n3 2\\n6 1\", \"1 5 3\\n1 2\... | There is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are N ants. These ants are numbered 1 through N in order of increasing coordinate, and ant i is at coor... | 0 |
{"tests": "{\"inputs\": [[\"aabb\"], [\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaabc\"], [\"abbcabb\"], [\"zyyzzzzz\"], [\"aaabbb\"]], \"outputs\": [[true], [false], [true], [true], [false]]}", "source": "primeintellect"} | # Task
Given a string `s`, find out if its characters can be rearranged to form a palindrome.
# Example
For `s = "aabb"`, the output should be `true`.
We can rearrange `"aabb"` to make `"abba"`, which is a palindrome.
# Input/Output
- `[input]` string `s`
A string consisting of lowercase English letters.... | 0 |
{"tests": "{\"inputs\": [\"4\\n3\\n0 2 1\\n2\\n1 0\\n5\\n0 0 0 0 0\\n4\\n0 1 2 3\\n\", \"1\\n30\\n0 0 0 2 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\n\", \"1\\n30\\n0 0 0 2 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\n\", \"1\\n30\\n0 0 0 1 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\\n\", \"... | Let's call a sequence of integers $x_1, x_2, \dots, x_k$ MEX-correct if for all $i$ ($1 \le i \le k$) $|x_i - \operatorname{MEX}(x_1, x_2, \dots, x_i)| \le 1$ holds. Where $\operatorname{MEX}(x_1, \dots, x_k)$ is the minimum non-negative integer that doesn't belong to the set $x_1, \dots, x_k$. For example, $\operatorn... | 0 |
{"tests": "{\"inputs\": [\"3 2\\n100 50 200\\n\", \"5 8\\n50 30 40 10 20\\n\", \"10 100\\n7 10 4 5 9 3 6 8 2 1\\n\", \"5 8\\n21 30 40 10 20\", \"10 100\\n7 10 4 5 9 3 6 8 1 1\", \"3 2\\n100 78 200\", \"5 8\\n21 30 40 0 20\", \"3 3\\n100 78 200\", \"5 8\\n21 30 24 0 20\", \"3 3\\n100 38 200\", \"3 5\\n100 38 200\", \"3 ... | There are N towns located in a line, conveniently numbered 1 through N. Takahashi the merchant is going on a travel from town 1 to town N, buying and selling apples.
Takahashi will begin the travel at town 1, with no apple in his possession. The actions that can be performed during the travel are as follows:
- Move: W... | 0 |
{"tests": "{\"inputs\": [\"(][)\\n\", \"[(()[])]()[()[]]\\n\", \"[[]\\n\", \"(()[))()[]\\n\", \"([]\\n\", \")[)][)))((([[)]((]][)[)((]([)[)(([)[)]][([\\n\", \"][([))][[))[[((]][([(([[)]]])([)][([([[[[([))]])][[[[[([)]]([[(((]([(](([([[)[(]])(][(((][)[[)][)(][[)[[)])))[)]))]])[([[))(([(]][))([(]]][(])]))))))[[[[[([[([)[... | A bracket sequence is a string, containing only characters "(", ")", "[" and "]".
A correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()[]", "([... | 0 |
{"tests": "{\"inputs\": [[\"WIN\"], [\"b64\"], [\"B64\"], [\"/+/\"], [\"HelloWorld\"]], \"outputs\": [[90637], [114360], [7864], [262079], [134710352538679645]]}", "source": "primeintellect"} | # Base64 Numeric Translator
Our standard numbering system is (Base 10). That includes 0 through 9. Binary is (Base 2), only 1βs and 0βs. And Hexadecimal is (Base 16) (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F). A hexadecimal βFβ has a (Base 10) value of 15. (Base 64) has 64 individual characters which translate ... | 0 |
{"tests": "{\"inputs\": [[[\"Hello\", \"World\"]], [[\"joey\", \"louise\"]], [[\"a\", \"cat\"]], [[\"cat\", \"\"]], [[\"!a!a!\", \"?b?b\"]]], \"outputs\": [[\"H W\\ne o\\nl r\\nl l\\no d\"], [\"j l\\no o\\ne u\\ny i\\n s\\n e\"], [\"a c\\n a\\n t\"], [\"c \\na \\nt \"], [\"! ?\\na b\\n! ?\\na b\\n! \"]]}", "sou... | You will be given an array that contains two strings. Your job is to create a function that will take those two strings and transpose them, so that the strings go from top to bottom instead of left to right.
A few things to note:
1. There should be one space in between the two characters
2. You don't have to modify th... | 0 |
{"tests": "{\"inputs\": [\"7\\n21 12 1 16 13 6 7\\n20 11 2 20 14 5 8\\n19 10 3 18 15 4 9\", \"5\\n9 6 15 12 1\\n10 5 14 11 2\\n7 4 13 10 3\", \"6\\n15 10 3 4 9 5\\n14 11 2 5 8 17\\n13 12 1 6 7 18\", \"5\\n1 2 3 0 5\\n6 7 8 9 10\\n11 12 13 14 15\", \"7\\n21 12 1 16 14 6 7\\n20 11 2 20 14 5 8\\n19 10 3 18 15 4 9\", \"5\\... | We have a grid with 3 rows and N columns. The cell at the i-th row and j-th column is denoted (i, j). Initially, each cell (i, j) contains the integer i+3j-3.
<image>
A grid with N=5 columns
Snuke can perform the following operation any number of times:
* Choose a 3Γ3 subrectangle of the grid. The placement of inte... | 0 |
{"tests": "{\"inputs\": [[[\"abcd\", \"aaa\"]], [[\"trances\", \"nectar\"]], [[\"THE EYES\", \"they see\"]], [[\"assert\", \"staring\"]], [[\"arches\", \"later\"]], [[\"dale\", \"caller\"]], [[\"parses\", \"parsecs\"]], [[\"replays\", \"adam\"]], [[\"mastering\", \"streaming\"]], [[\"drapes\", \"compadres\"]], [[\"delt... | Write a function that checks if all the letters in the second string are present in the first one at least once, regardless of how many times they appear:
```
["ab", "aaa"] => true
["trances", "nectar"] => true
["compadres", "DRAPES"] => true
["parses", "parsecs"] => false
```
Function should not be cas... | 0 |
{"tests": "{\"inputs\": [\"3\\n5\\nABCDE\\nEBCDA\\n0 10 20 30 40 50\\n4\\nCHEF\\nQUIZ\\n4 3 2 1 0\\n8\\nABBABAAB\\nABABABAB\\n100 100 100 100 100 100 100 100 100\", \"3\\n5\\nABCDE\\nEBCDA\\n0 8 20 30 40 50\\n4\\nCHEF\\nQUIZ\\n4 3 2 1 0\\n8\\nABBABAAB\\nABABABAB\\n100 100 100 100 100 100 100 100 100\", \"3\\n5\\nABCDE\... | Read problems statements in Mandarin Chinese and Russian
Chef is going to participate in a new quiz show: "Who dares to be a millionaire?"
According to the rules of the game, contestants must answer N questions. The quiz being famous for its difficulty, each question has 26 candidate answers, but only one of which ... | 0.5 |
{"tests": "{\"inputs\": [\"-[..[]+>>.>,]>.+]>.]>[.>+,>+\\n\", \".<>.+]>],>><\\n\", \"+,+><[>..,]-.[.++[>-<<-,-.>,.>]+,<,]]<[>,-+,.-[+,[.[<.-[].+>[,>-.>>]-[-][+,>>-,+<-,<.+-.+[.,\\n\", \"<.,+.><[,.+<[,.,<-,[>,\\n\", \"[-.].+<<]---+[+-+-[,[[[,]-<[-[[><>]\\n\", \",]+>.],,+->+>-[]][><,-]><]++<.,-[.>.<+.[.<,[-,,[<]+>]->>]>]... | Unary is a minimalistic Brainfuck dialect in which programs are written using only one token.
Brainfuck programs use 8 commands: "+", "-", "[", "]", "<", ">", "." and "," (their meaning is not important for the purposes of this problem). Unary programs are created from Brainfuck programs using the following algorithm... | 0 |
{"tests": "{\"inputs\": [\"6\\n3 2 2 2\\n0 0 -2 -2 2 2\\n3 1 4 1\\n0 0 -1 -1 1 1\\n1 1 1 1\\n1 1 1 1 1 1\\n0 0 0 1\\n0 0 0 0 0 1\\n5 1 1 1\\n0 0 -100 -100 0 100\\n1 1 5 1\\n0 0 -100 -100 100 0\\n\", \"1\\n83 75 18 67\\n-4233924 24412104 -4233956 24412104 -4233832 24412181\\n\", \"1\\n0 0 1 1\\n0 0 0 0 0 0\\n\", \"1\\n8... | Alice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat!
Initially, Alice's cat is located in a cell $(x,y)$ of an infinite grid. According to Alice's theory, cat needs to move: exactly $a$ steps left: from $(u,v)$ to $(u-1,v)$; exactly $b$ steps right: from $(u,v)$ to $(u+1... | 0 |
{"tests": "{\"inputs\": [[\"SATORAREPOTENETOPERAROTAS\"], [\"NOTSQUARE\"], [\"BITICETEN\"], [\"CARDAREAREARDART\"], [\"CODEWARS\"], [\"AAAAACEEELLRRRTT\"], [\"AAACCEEEEHHHMMTT\"], [\"AAACCEEEEHHHMMTTXXX\"], [\"ABCD\"], [\"GHBEAEFGCIIDFHGG\"], [\"AAHHFDKIHHFCXZBFDERRRTXXAA\"], [\"AABBCCDDEEFFGGGG\"], [\"ABCABCABC\"], [\... | A [Word Square](https://en.wikipedia.org/wiki/Word_square) is a set of words written out in a square grid, such that the same words can be read both horizontally and vertically. The number of words, equal to the number of letters in each word, is known as the *order* of the square.
For example, this is an *order* `5` ... | 0 |
{"tests": "{\"inputs\": [[\"a\"], [\"aa\"], [\"baa\"], [\"aab\"], [\"baabcd\"], [\"racecars\"], [\"abcdefghba\"], [\"\"]], \"outputs\": [[true], [true], [true], [true], [false], [false], [false], [true]]}", "source": "primeintellect"} | Write a function that will check whether the permutation of an input string is a palindrome. Bonus points for a solution that is efficient and/or that uses _only_ built-in language functions. Deem yourself **brilliant** if you can come up with a version that does not use _any_ function whatsoever.
# Example
`madam... | 0 |
{"tests": "{\"inputs\": [[2, \"+\", 4], [6, \"-\", 1.5], [-4, \"*\", 8], [49, \"/\", -7], [8, \"m\", 2], [4, \"/\", 0], [3.2, \"+\", 8], [3.2, \"-\", 8], [3.2, \"/\", 8], [3.2, \"*\", 8], [-3, \"+\", 0], [-3, \"-\", 0], [-3, \"/\", 0], [-2, \"/\", -2], [-2, \"codewars\", -2], [-3, \"*\", 0], [0, \"*\", 0], [0, \"**\", ... | **Debug** a function called calculate that takes 3 values. The first and third values are numbers. The second value is a character. If the character is "+" , "-", "\*", or "/", the function will return the result of the corresponding mathematical function on the two numbers. If the string is not one of the specified ch... | 0 |
{"tests": "{\"inputs\": [\"10 3\\n10000 20000 30000 40000 50000 60000 70000 80000 90000 100000\\n\", \"2 2\\n52233 12247\\n\", \"5 3\\n100 100 100 100 100\\n\", \"100 51\\n245 196 57 35 8 4 2 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... | Let's call beauty of an array b_1, b_2, β¦, b_n (n > 1) β min_{1 β€ i < j β€ n} |b_i - b_j|.
You're given an array a_1, a_2, β¦ a_n and a number k. Calculate the sum of beauty over all subsequences of the array of length exactly k. As this number can be very large, output it modulo 998244353.
A sequence a is a subsequenc... | 0 |
{"tests": "{\"inputs\": [\"xxo xoo xxo\\nooo ooo xxx\\noox oxo oxx\\n\\noxo oxo xxx\\nxoo oxx oxo\\nxxx oxx ooo\\n\\noxx xoo xxo\\nxxx oox xox\\nxxo o.o oxo\\n9 6\\n\", \"ox. o.x .o.\\nxxo xoo .oo\\n.xx oox o..\\n\\nxx. oox oxx\\noox oxx xxo\\nxo. oxo x.x\\n\\no.x .x. xx.\\n.xo ox. ooo\\n.ox xo. ..o\\n6 2\\n\", \"... .... | Two bears are playing tic-tac-toe via mail. It's boring for them to play usual tic-tac-toe game, so they are a playing modified version of this game. Here are its rules.
The game is played on the following field.
<image>
Players are making moves by turns. At first move a player can put his chip in any cell of any sm... | 0 |
{"tests": "{\"inputs\": [[1], [5], [12], [42], [88], [89], [92], [100], [111], [200], [2017]], \"outputs\": [[\"white\"], [\"black\"], [\"black\"], [\"white\"], [\"white\"], [\"white\"], [\"white\"], [\"black\"], [\"white\"], [\"black\"], [\"white\"]]}", "source": "primeintellect"} | ## Your Story
"A *piano* in the home meant something." - *Fried Green Tomatoes at the Whistle Stop Cafe*
You've just realized a childhood dream by getting a beautiful and beautiful-sounding upright piano from a friend who was leaving the country. You immediately started doing things like playing "Heart and Soul" over ... | 0 |
{"tests": "{\"inputs\": [[\"abcdef\", [1, 2, 5]], [\"abcdef\", [1, 2, 5, 100]], [\"codewars\", [1, 3, 5, 50]], [\"abracadabra\", [2, 6, 9, 10]], [\"codewarriors\", [5]], [\"indexinglessons\", [0]]], \"outputs\": [[\"aBCdeF\"], [\"aBCdeF\"], [\"cOdEwArs\"], [\"abRacaDabRA\"], [\"codewArriors\"], [\"Indexinglessons\"]]}"... | Given a string and an array of integers representing indices, capitalize all letters at the given indices.
For example:
* `capitalize("abcdef",[1,2,5]) = "aBCdeF"`
* `capitalize("abcdef",[1,2,5,100]) = "aBCdeF"`. There is no index 100.
The input will be a lowercase string with no spaces and an array of digits.
Goo... | 0 |
{"tests": "{\"inputs\": [\"7 6 5 2 8 9 2 3 4\", \"7 5 -1 1 -1 9 2 3 4\", \"7 6 -1 1 -1 14 2 3 4\", \"7 6 5 2 8 9 1 3 4\", \"5 6 -1 1 -1 14 2 3 4\", \"7 6 5 3 8 9 1 3 4\", \"7 6 5 3 8 3 1 3 4\", \"7 6 5 3 8 3 1 1 4\", \"7 6 5 3 0 3 1 1 4\", \"7 6 2 3 0 3 1 1 4\", \"7 6 0 3 0 3 1 1 4\", \"7 6 0 3 0 3 1 1 1\", \"7 6 0 3 0... | Addition is easy to calculate by hand, but if some numbers are missing, is it easy to fill in the missing numbers? For example, in the following long division, if there is a condition that the numbers 1 to 9 appear only once, how many numbers will fit in the C and E squares? In this case, 8 is correct for C and 5 is co... | 0.875 |
{"tests": "{\"inputs\": [\"3 100000007\\n\", \"4 100000007\\n\", \"400 234567899\\n\", \"5 999999937\\n\", \"6 100000007\\n\", \"7 100000007\\n\", \"100 999999733\\n\", \"350 999999733\\n\", \"400 100000007\\n\", \"397 999999733\\n\", \"398 999999733\\n\", \"399 999999733\\n\", \"400 999999733\\n\", \"6 100000007\\n\",... | There are $n$ computers in a row, all originally off, and Phoenix wants to turn all of them on. He will manually turn on computers one at a time. At any point, if computer $i-1$ and computer $i+1$ are both on, computer $i$ $(2 \le i \le n-1)$ will turn on automatically if it is not already on. Note that Phoenix cannot ... | 0 |
{"tests": "{\"inputs\": [\"281 12 23\\n178 650197\\n129 288456\\n34 924882\\n43 472160\\n207 957083\\n103 724815\\n167 308008\\n135 906958\\n74 242828\\n229 146026\\n85 241042\\n22 39127\\n62 47524\\n113 760274\\n156 562141\\n10 209057\\n50 714473\\n201 164128\\n97 624021\\n120 102709\\n147 388268\\n219 933977\\n190 95... | Johnny drives a truck and must deliver a package from his hometown to the district center. His hometown is located at point 0 on a number line, and the district center is located at the point d.
Johnny's truck has a gas tank that holds exactly n liters, and his tank is initially full. As he drives, the truck consumes ... | 0 |
{"tests": "{\"inputs\": [\"0\", \"26\", \"25\", \"23\", \"5\", \"4\", \"1\", \"8\", \"38\", \"47\", \"48\", \"75\", \"138\", \"149\", \"132\", \"374\", \"315\", \"933\", \"945\", \"456\", \"942\", \"2139\", \"1374\", \"3723\", \"18\", \"14\", \"7\", \"2\", \"3\", \"12\", \"15\", \"16\", \"17\", \"6\", \"20\", \"21\", \... | Fast Forwarding
Mr. Anderson frequently rents video tapes of his favorite classic films. Watching the films so many times, he has learned the precise start times of his favorite scenes in all such films. He now wants to find how to wind the tape to watch his favorite scene as quickly as possible on his video player.
... | 0 |
{"tests": "{\"inputs\": [[[7, 7, 8, 8, 9, 9]], [[9, 7, 8, 8, 9, 7]], [[8, 8, 7, 9, 9, 9, 8, 9, 7]], [[9, 9, 9, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7]], [[9, 9, 9, 7, 7, 8, 9, 7, 8, 9, 7, 9]], [[9, 9, 7, 7, 8, 8]], [[9, 7, 9]], [[8, 7, 8]], [[7, 8, 7, 8]], [[8, 8, 7, 8]], [[8, 8, 7, 7, 8]]], \"outputs\": [[0], [1], [4], [6... | # Task
Sorting is one of the most basic computational devices used in Computer Science.
Given a sequence (length β€ 1000) of 3 different key values (7, 8, 9), your task is to find the minimum number of exchange operations necessary to make the sequence sorted.
One operation is the switching of 2 key values in th... | 0 |
{"tests": "{\"inputs\": [\"3\\n97972354 -510322\\n97972814 -510361\\n97972410 -510528\\n\", \"12\\n-83240790 -33942371\\n-83240805 -33942145\\n-83240821 -33941752\\n-83240424 -33941833\\n-83240107 -33942105\\n-83239958 -33942314\\n-83239777 -33942699\\n-83239762 -33942925\\n-83239746 -33943318\\n-83240143 -33943237\\n-... | You are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The points are numbered from 1 to n, in clockwise order.
We define the distance between two points p_1 = (x_1... | 0 |
{"tests": "{\"inputs\": [[\"*\", \"00101100\"], [\">*>*\", \"00101100\"], [\"*>*>*>*>*>*>*>*\", \"00101100\"], [\"*>*>>*>>>*>*\", \"00101100\"], [\">>>>>*<*<<*\", \"00101100\"], [\"iwmlis *!BOSS 333 ^v$#@\", \"00101100\"], [\">*>*;;;.!.,+-++--!!-!!!-\", \"00101100\"], [\" * >* >*>*lskdfjsdklfj>*;;+--+--++... | # Esolang Interpreters #2 - Custom Smallfuck Interpreter
## About this Kata Series
"Esolang Interpreters" is a Kata Series that originally began as three separate, independent esolang interpreter Kata authored by [@donaldsebleung](http://codewars.com/users/donaldsebleung) which all shared a similar format and were al... | 0 |
{"tests": "{\"inputs\": [\"8\\n1\\n2\\n6\\n13\\n14\\n3620\\n10000\\n1000000000000000000\\n\", \"1\\n450283905890997363\\n\", \"1\\n387420490\\n\", \"100\\n1\\n8\\n4\\n6\\n5\\n4\\n4\\n6\\n8\\n3\\n9\\n5\\n7\\n8\\n8\\n5\\n9\\n6\\n9\\n4\\n5\\n6\\n4\\n4\\n7\\n1\\n2\\n2\\n5\\n6\\n1\\n5\\n10\\n9\\n10\\n9\\n3\\n1\\n2\\n3\\n2\\... | The only difference between easy and hard versions is the maximum value of $n$.
You are given a positive integer number $n$. You really love good numbers so you want to find the smallest good number greater than or equal to $n$.
The positive integer is called good if it can be represented as a sum of distinct powers ... | 0 |
{"tests": "{\"inputs\": [\"2 3\\nUo.\\noo.\", \"2 3\\n.oU\\noo.\", \"10 10\\n.o....o...\\no.oo......\\n..oo..oo..\\n..o.......\\n..oo..oo..\\n.o.o...o..\\no..U.o....\\noo......oo\\noo........\\noo..oo....\", \"2 3\\n.oU\\n.oo\", \"1 3\\nUo.\\noo.\", \"1 3\\n.oU\\noo.\", \"2 3\\noU.\\noo.\", \"1 3\\noU.\\noo.\", \"1 3\\... | There is a frog living in a big pond. He loves jumping between lotus leaves floating on the pond. Interestingly, these leaves have strange habits. First, a leaf will sink into the water after the frog jumps from it. Second, they are aligned regularly as if they are placed on the grid points as in the example below.
<i... | 0 |
{"tests": "{\"inputs\": [\"aaaaaaaadbaaabbbbbddaaabdadbbbbbdbbabbbabaabdbbdababbbddddbdaabbddbbbbabbbbbabadaadabaaaadbbabbbaddb\\naaaaaaaaaaaaaa\\n61 52 5 43 53 81 7 96 6 9 34 78 79 12 8 63 22 76 18 46 41 56 3 20 57 21 75 73 100 94 35 69 32 4 70 95 88 44 68 10 71 98 23 89 36 62 28 51 24 30 74 55 27 80 38 48 93 1 19 84 ... | Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.
Sergey gives Nastya the word t and wants to get the word p out of it. Nastya removes letters in a certain ... | 0.375 |
{"tests": "{\"inputs\": [\"10\\n3 0 5 2 7 4 9 6 10 8\", \"5\\n3 1 5 4 2\", \"3\\n1 3 2\", \"10\\n3 0 5 2 7 4 9 6 17 8\", \"10\\n3 0 5 1 7 4 9 6 17 8\", \"10\\n3 0 5 1 7 4 12 6 17 8\", \"10\\n3 0 5 2 7 4 9 6 11 8\", \"10\\n3 0 5 2 7 4 10 6 17 8\", \"10\\n3 0 5 1 7 4 9 6 12 8\", \"10\\n2 0 5 1 7 4 12 6 17 8\", \"10\\n3 0... | A permutation of N numbers from 1 to N A1, A2, β¦β¦, AN is given. You can perform the operation reverse (i, j) to reverse the order of the numbers in the interval [i, j] (1 β€ i β€ j β€ N) for this permutation. For example, if reverse (2, 4) is applied to [1, 2, 3, 4, 5], it becomes [1, 4, 3, 2, 5]. Calculate how many opera... | 0 |
{"tests": "{\"inputs\": [\"(1989967-3*2-211+4487)\", \"3-2)3\", \"(5-3*4)+(0-2+1)\", \"3)2-3\", \"0-2+3-4+5-6*0\", \"(1998967-3*1-211+4487)\", \"(5-3*4)*(0-1+1)\", \"(199896743*1-211+4-87)\", \"(5-3*4)*(0-1+2)\", \"0*6-5+5-3+2-0\", \"(199876743*1-211+4-89)\", \"(5-3*3)*(0-1+2)\", \"(199877743*1-211+4-89)\", \"3*1-3\", ... | One day, Ikta, an elementary school student, received a piece of paper with mathematical formulas from his grandfather. Apparently, the grandfather will give you as much money as the answer to the formula. Ikta has only learned addition, subtraction, and multiplication, so only addition, subtraction, and multiplication... | 0.125 |
{"tests": "{\"inputs\": [\"6 4\\n0 4 5 6\", \"6 4\\n0 4 4 6\", \"9 3\\n0 0 0 3\", \"6 4\\n0 4 6 6\", \"6 4\\n0 1 4 6\", \"6 4\\n0 2 4 6\", \"6 3\\n0 2 4 6\", \"6 3\\n0 2 4 5\", \"6 3\\n0 2 4 3\", \"6 3\\n0 0 4 3\", \"9 3\\n0 0 4 3\", \"9 3\\n0 1 0 3\", \"0 3\\n0 1 0 3\", \"1 3\\n0 1 0 3\", \"1 0\\n0 1 0 3\", \"2 0\\n0 ... | problem
$ M $ students will be tested in a classroom with $ N $ seats in a straight line. Seats are numbered $ 1 \ dots N $ from the front, and $ 1 $ per seat can seat $ 1 $ students.
Now each student is sitting in the $ A_1, \ dots, A_M $ seats.
To start the test, the following conditions must be met:
* $ 1 \ dots... | 0 |
{"tests": "{\"inputs\": [\"1 1 100\\n50 200 20 40 0\\n1\\n2 4 101\\n7 4 1 4 1\\n19 5 1 4 0\\n5\\n3\\n7\\n9\\n1 2 3\\n1 1 1 1 0\\n1\\n3\\n1 2 10\\n5 10 1 1 1\\n2\\n3\\n0 0 0\", \"1 1 100\\n50 200 20 40 0\\n1\\n2 4 101\\n7 4 1 4 1\\n19 5 1 4 0\\n5\\n3\\n7\\n9\\n1 2 3\\n2 1 1 1 0\\n1\\n3\\n1 2 10\\n5 10 1 1 1\\n2\\n3\\n0 ... | ACM countries have rivers that flow from east to west in the center. This river flows from the neighboring country in the west through the neighboring country in ACM to the neighboring country in the east, and the total length in ACM is K km. It is planned to install several locks on this river and use it as a canal.
... | 0 |
{"tests": "{\"inputs\": [\"BBBBBBBB\\nWBWWBBBW\\nBBBBBBBB\\nWBWWBBBW\\nWBWWBBBW\\nWBWWBBBW\\nWBWWBBBW\\nBBBBBBBB\\n\", \"BBBBBBBB\\nBBBBBBBB\\nBBBBBBBB\\nBBBBBBBB\\nBBBBBBBB\\nBBBBBBBB\\nBBBBBBBB\\nBWBBWBWB\\n\", \"BBBBBBBB\\nWWWBBBBB\\nWWWBBBBB\\nBBBBBBBB\\nWWWBBBBB\\nWWWBBBBB\\nBBBBBBBB\\nBBBBBBBB\\n\", \"BBBBBBBB\\n... | A famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have been playing this old game on uninteresting, monotonous boards. Kalevitch decided to put an end to this tradition and to introduce a new attitude to chessboards.
As before, th... | 0.125 |
{"tests": "{\"inputs\": [\"1 2\\n\\nYes\\n\\nNo\\n\\nYer\\n\\nYes\\n\", \"1 2\\n\\nseY\\n\\nNo\\n\\nYes\\n\\nYds\\n\", \"1 2\\n\\nYes\\n\\noN\\n\\nYer\\n\\nYes\\n\", \"1 2\\n\\nYes\\n\\nNo\\n\\nYer\\n\\nYds\\n\", \"1 2\\n\\nYes\\n\\noN\\n\\nYer\\n\\nseY\\n\", \"1 0\\n\\nYes\\n\\noN\\n\\nYer\\n\\nseY\\n\", \"1 2\\n\\nYe... | This is an interactive problem.
In the Wonderful Metropolis of the Future, there is no need in subway train drivers. Due to the technological progress, they were replaced by the Artificial Intelligence (AI). Unfortunately, one day the predictions of sci-fi writers came true: the AI rebelled and now there is an uncontr... | 0 |
{"tests": "{\"inputs\": [\"1\\n#define sum x+y\\nsum*r\\n\", \"3\\n#define uYdw ((9-x-3) )\\n#define fy (((x+21)))\\n#define nY ((2+x)-46)\\n141141432\\n\", \"3\\n#define T ((b/1 +1))\\n#define pm (s)-43-(s)\\n#define jkNBpvDZl ((x ))/65\\n(((58*7)))\\n\", \"1\\n#define sum x+y\\nr*sum\\n\", \"3\\n#define null x/0\\n#d... | Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.
In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. T... | 0 |
{"tests": "{\"inputs\": [[[[0, 0], [1, 1]]], [[[0, 0], [-5, -6]]], [[[0, 0], [10, 15]]], [[[0, 0], [5, 1]]], [[[0, 0], [5, 4]]], [[[0, 0], [-7, 4]]], [[[0, 0], [0, 0]]], [[[-3, 4], [10, 5]]]], \"outputs\": [[\"1.41\"], [\"7.81\"], [\"18.03\"], [\"5.10\"], [\"6.40\"], [\"8.06\"], [\"0.00\"], [\"13.04\"]]}", "source": "p... | Find the length between 2 co-ordinates. The co-ordinates are made of integers between -20 and 20 and will be given in the form of a 2D array:
(0,0) and (5,-7) would be [ [ 0 , 0 ] , [ 5, -7 ] ]
The function must return the answer rounded to 2 decimal places in the form of a string.
```python
length_of_line([[0, 0],... | 0 |
{"tests": "{\"inputs\": [\"2 1\\n1 2\\n3\\n1 2\\n1 2\\n2 1\\n\", \"5 4\\n1 3\\n2 3\\n4 3\\n1 5\\n3\\n1 3\\n2 4\\n5 2\\n\", \"6 6\\n1 2\\n2 3\\n3 4\\n4 5\\n5 6\\n6 1\\n4\\n1 2\\n1 6\\n6 5\\n4 3\\n\", \"40 43\\n1 2\\n1 3\\n1 4\\n4 5\\n5 6\\n1 7\\n5 8\\n7 9\\n2 10\\n10 11\\n11 12\\n2 13\\n13 14\\n14 15\\n15 16\\n16 17\\n1... | A connected undirected graph is called a vertex cactus, if each vertex of this graph belongs to at most one simple cycle.
A simple cycle in a undirected graph is a sequence of distinct vertices v1, v2, ..., vt (t > 2), such that for any i (1 β€ i < t) exists an edge between vertices vi and vi + 1, and also exists an ed... | 0 |
{"tests": "{\"inputs\": [\"31 1899100\\n\", \"16 747\\n\", \"44 863791309\\n\", \"25 121393\\n\", \"15 463\\n\", \"36 7074882\\n\", \"50 20365011074\\n\", \"34 2412850\\n\", \"39 68773650\\n\", \"24 47430\\n\", \"18 1809\\n\", \"19 859\\n\", \"10 89\\n\", \"6 10\\n\", \"32 1314567\\n\", \"2 2\\n\", \"23 45599\\n\", \"4... | Let's define the permutation of length n as an array p = [p1, p2, ..., pn] consisting of n distinct integers from range from 1 to n. We say that this permutation maps value 1 into the value p1, value 2 into the value p2 and so on.
Kyota Ootori has just learned about cyclic representation of a permutation. A cycle is a... | 0 |
{"tests": "{\"inputs\": [[15], [253], [24], [13], [3], [29]], \"outputs\": [[[3, 5]], [[11, 23]], [[2, 3, 4, 6, 8, 12]], [\"13 is prime\"], [\"3 is prime\"], [\"29 is prime\"]]}", "source": "primeintellect"} | Create a function named `divisors`/`Divisors` that takes an integer `n > 1` and returns an array with all of the integer's divisors(except for 1 and the number itself), from smallest to largest. If the number is prime return the string '(integer) is prime' (`null` in C#) (use `Either String a` in Haskell and `Result, S... | 0 |
{"tests": "{\"inputs\": [[\"150.0.0.0\", \"150.0.0.1\"], [\"10.0.0.0\", \"10.0.0.50\"], [\"20.0.0.10\", \"20.0.1.0\"], [\"10.11.12.13\", \"10.11.13.0\"], [\"160.0.0.0\", \"160.0.1.0\"], [\"170.0.0.0\", \"170.1.0.0\"], [\"50.0.0.0\", \"50.1.1.1\"], [\"180.0.0.0\", \"181.0.0.0\"], [\"1.2.3.4\", \"5.6.7.8\"]], \"outputs\"... | ```if-not:sql
Implement a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).
```
```if:sql
Given a database of first and last IPv4 addresses, calculate the number of addresses between them (including the first one, excluding th... | 0 |
{"tests": "{\"inputs\": [\"4\\n5 0 0 0\\n0 0 0 5\\n2 5 10 6\\n3 0 0 7\\n\", \"1\\n1001 100000000 100000000 100000000\\n\", \"1\\n1 100000000 100000000 100000000\\n\", \"1\\n25 5 5 5\\n\", \"1\\n4001 0 0 0\\n\", \"1\\n1 100000000 100000000 1234\\n\", \"1\\n1 100000000 100000000 1238\\n\", \"1\\n1 100000000 100000000 1\\... | Eve is a beginner stand-up comedian. Her first show gathered a grand total of two spectators: Alice and Bob.
Eve prepared $a_1 + a_2 + a_3 + a_4$ jokes to tell, grouped by their type:
type 1: both Alice and Bob like them;
type 2: Alice likes them, but Bob doesn't;
type 3: Bob likes them, but Alice doesn't;
type 4:... | 0 |
{"tests": "{\"inputs\": [\"3\\n101110\\n2\\n01\\n1\\n110\\n1\\n\", \"3\\n100110\\n2\\n01\\n1\\n110\\n1\\n\", \"3\\n100110\\n2\\n01\\n1\\n111\\n1\\n\", \"3\\n100110\\n2\\n01\\n2\\n011\\n1\\n\", \"3\\n000110\\n2\\n01\\n2\\n011\\n1\\n\", \"3\\n001110\\n2\\n01\\n2\\n111\\n1\\n\", \"3\\n001110\\n2\\n01\\n2\\n101\\n1\\n\", \... | Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | 0.125 |
{"tests": "{\"inputs\": [\"4\\n7\\n11\\n240\\n17179869184\\n\", \"100\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n11\\n12\\n13\\n14\\n15\\n16\\n17\\n18\\n19\\n20\\n21\\n22\\n23\\n24\\n25\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n33\\n34\\n35\\n36\\n37\\n38\\n39\\n40\\n41\\n42\\n43\\n44\\n45\\n46\\n47\\n48\\n49\\n50\\n51\\n52... | A number is called powerful if it is a power of two or a factorial. In other words, the number $m$ is powerful if there exists a non-negative integer $d$ such that $m=2^d$ or $m=d!$, where $d!=1\cdot 2\cdot \ldots \cdot d$ (in particular, $0! = 1$). For example $1$, $4$, and $6$ are powerful numbers, because $1=1!$, $4... | 0 |
{"tests": "{\"inputs\": [\"12 18\\nCBBCAACABACCACABBC\\nABCAACABAABCBCBCCC\\nBCAACCCBBBABBACBBA\\nACCBCBBBAABACCACCC\\nCAABCCCACACCBACACC\\nBBBCBCACCABCCBCBBB\\nBAABBCACAAAAACCBCB\\nBAABAABACBCABACBCA\\nAABCBCCBCCABACCCAC\\nCCBBBAACCCBCACCCBB\\nCBABACBBBABCBACCCB\\nAABACCCBCCACBCACCB\\n\", \"10 11\\nABBBAABABBB\\nBBAAB... | The Hedgehog recently remembered one of his favorite childhood activities, β solving puzzles, and got into it with new vigor. He would sit day in, day out with his friend buried into thousands of tiny pieces of the picture, looking for the required items one by one.
Soon the Hedgehog came up with a brilliant idea: ins... | 0.5 |
{"tests": "{\"inputs\": [\"5 5\\n1 2 3 4 5\\n1 2 1 4 5\\n5 5\\n2 5 4 1 3\\n4 1 5 3 2\\n5 5\\n1 2 3 4 5\\n3 3 3 4 5\\n3 3\\n7 7 7\\n7 7 7\\n3 3\\n4 4 4\\n4 3 4\\n4 3\\n4 2 2 4\\n4 2 1\\n4 4\\n2 8 8 8\\n2 3 8 3\\n10 10\\n9 9 9 9 9 9 9 9 9 9\\n9 9 9 9 9 9 9 9 9 9\\n10 9\\n20 1 20 20 20 20 20 18 20 20\\n20 20 20 20 7 20 20... | International Center for Picassonian Cubism is a Spanish national museum of cubist artworks, dedicated to Pablo Picasso. The center held a competition for an artwork that will be displayed in front of the facade of the museum building. The artwork is a collection of cubes that are piled up on the ground and is intended... | 0 |
{"tests": "{\"inputs\": [\"3 7 3\\n0 1 1 1\\n0 1 1 2\\n1 1 3 4\\n1 1 1 1\\n1 2 1 2\\n3 1 1 3\\n2 2 2 1\", \"5 10 5\\n0 1 1 2\\n0 2 1 2\\n0 1 2 3\\n1 2 0 2\\n1 4 2 3\\n2 1 1 1\\n2 1 1 2\\n3 3 2 3\\n4 1 1 2\\n4 2 1 2\", \"5 10 5\\n0 1 1 2\\n0 2 1 2\\n0 1 2 3\\n1 2 0 2\\n1 4 2 3\\n2 1 1 1\\n2 1 1 2\\n3 3 2 4\\n4 1 1 2\\n4... | Problem
Yamano Mifune Gakuen's 1st grade G group is a class where female students carrying misfortune gather. They face various challenges every day with the goal of being happy.
In their class, they can take practical happiness courses as part of the test of happiness.
From Monday to Friday, there are classes from 1... | 0.75 |
{"tests": "{\"inputs\": [\"4 4\\nBEEP\\nYYRE\\nBBRP\\nRBYP\\n1\\n1 2\", \"3 3\\nRGR\\nRBP\\nYEB\\n1\\n1 2\", \"3 3\\nGRR\\nRBP\\nYEB\\n1\\n1 1\", \"4 4\\nBEEP\\nERYY\\nBBRP\\nRBYP\\n1\\n1 3\", \"3 3\\nGRR\\nRBP\\nYEB\\n1\\n1 0\", \"4 5\\nBYYGG\\nRRRRR\\nRRBRR\\nYYGGB\\n2\\n4 1\\n3 1\", \"4 4\\nBEEP\\nYYRE\\nBBRP\\nRBYP... | Backgorund
The super popular game "Puzzle & Hexagons" has finally been released. This game is so funny that many people are addicted to it. There were a number of people who were certified as addicted by doctors because of their excessive enthusiasm. Volunteers from around the world have created a "Puzzle & Hexagons" ... | 0 |
{"tests": "{\"inputs\": [\"5\\n1 2 2 1 3\\n\", \"5\\n1 2 2 1 1\\n\", \"100\\n7 4 5 5 10 10 5 8 5 7 4 5 4 6 8 8 2 6 3 3 10 7 10 8 6 2 7 3 9 7 7 2 4 5 2 4 9 5 10 1 10 5 10 4 1 3 4 2 6 9 9 9 10 6 2 5 6 1 8 10 4 10 3 4 10 5 5 4 10 4 5 3 7 10 2 7 3 6 9 6 1 6 5 5 4 6 6 4 4 1 5 1 6 6 6 8 8 6 2 6\\n\", \"100\\n82 51 81 14 37 1... | One day you wanted to read something, so you went to your bookshelf to grab some book. But when you saw how messy the bookshelf was you decided to clean it up first.
There are $n$ books standing in a row on the shelf, the $i$-th book has color $a_i$.
You'd like to rearrange the books to make the shelf look beautiful.... | 0 |
{"tests": "{\"inputs\": [[\"Joe had a bad day\"], [\"Joe had some bad days\"], [\"Joe is having no fun\"], [\"Sometimes joe cries for hours\"], [\"Joe is having lots of fun\"], [\"Joe is working hard a lot\"], [\"Joe listened to the noise and it was an onamonapia\"], [\"Joe listened to the noises and there were some on... | KISS stands for Keep It Simple Stupid.
It is a design principle for keeping things simple rather than complex.
You are the boss of Joe.
Joe is submitting words to you to publish to a blog. He likes to complicate things.
Define a function that determines if Joe's work is simple or complex.
Input will be non emtpy st... | 0 |
{"tests": "{\"inputs\": [[[1, 1, 1, 2, 1, 1]], [[0, 0, 0.55, 0, 0]], [[4, 4, 4, 3, 4, 4, 4, 4]], [[5, 5, 5, 5, 4, 5, 5, 5]], [[6, 6, 6, 6, 6, 5, 6, 6]], [[7, 7, 7, 7, 7, 7, 6, 7]], [[8, 8, 8, 8, 8, 8, 8, 7]], [[3, 3, 3, 3, 3, 3, 3, 2]], [[2, 2, 2, 2, 2, 2, 2, 1]], [[0, 1, 1, 1, 1, 1, 1, 1]]], \"outputs\": [[2], [0.55],... | There is an array with some numbers. All numbers are equal except for one. Try to find it!
```python
find_uniq([ 1, 1, 1, 2, 1, 1 ]) == 2
find_uniq([ 0, 0, 0.55, 0, 0 ]) == 0.55
```
Itβs guaranteed that array contains at least 3 numbers.
The tests contain some very huge arrays, so think about performance.
This is t... | 0 |
{"tests": "{\"inputs\": [\"2\\n4\\n4 8 9 6\\n6\\n2 1 7 4 0 0\\n\", \"2\\n4\\n8 8 9 6\\n6\\n2 1 7 4 0 0\\n\", \"2\\n4\\n8 8 9 8\\n6\\n2 0 7 4 0 0\\n\", \"2\\n4\\n3 8 14 6\\n6\\n2 1 7 4 0 0\\n\", \"2\\n4\\n3 8 14 6\\n6\\n2 0 7 4 0 0\\n\", \"2\\n4\\n3 8 1 6\\n6\\n2 0 7 4 0 0\\n\", \"2\\n4\\n8 8 9 8\\n6\\n2 1 2 4 0 0\\n\",... | Little Dormi received a histogram with $n$ bars of height $a_1, a_2, \ldots, a_n$ for Christmas. However, the more he played with his new histogram, the more he realized its imperfections, so today he wanted to modify it to his liking.
To modify the histogram, Little Dormi is able to perform the following operation an... | 0 |
{"tests": "{\"inputs\": [[[1, 3, 2, 4], 2, 3], [[1, 3, 2], 2, 2], [[1, 3, 2, 4], 1, 2], [[1, 3, 2, 4], 2, 8], [[1, -1, 2, -1], 2, 3]], \"outputs\": [[2.5], [2.25], [-1], [-1], [0]]}", "source": "primeintellect"} | Write a function getMean that takes as parameters an array (arr) and 2 integers (x and y). The function should return the mean between the mean of the the first x elements of the array and the mean of the last y elements of the array.
The mean should be computed if both x and y have values higher than 1 but less or eq... | 0 |
{"tests": "{\"inputs\": [\"50 4 12\\nto tail\\n00000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000001000100000000000000000000000000000000000000010000000010000000000000000000000000000000000000000001\\n\", \"3 1 3\\nto head\\n1011111111111111101111011011111111011101111111... | A stowaway and a controller play the following game.
The train is represented by n wagons which are numbered with positive integers from 1 to n from the head to the tail. The stowaway and the controller are initially in some two different wagons. Every minute the train can be in one of two conditions β moving or idle... | 0 |
{"tests": "{\"inputs\": [\"8 1 10 2 6 4\\n\", \"8 1 10 2 6 5\\n\", \"9 1 10 9 2 9\\n\", \"20 15 25 3 5 7\\n\", \"722593107 305596769 756141045 457450188 53 829308825\\n\", \"999999999999999998 3 999999999999999999 399999999999999999 5 999999999999999996\\n\", \"999999999999999999 1 1000000000000000000 10000000000000000... | In recent years John has very successfully settled at his new job at the office. But John doesn't like to idly sit around while his code is compiling, so he immediately found himself an interesting distraction. The point of his distraction was to maintain a water level in the water cooler used by other zebras.
Origina... | 0 |
{"tests": "{\"inputs\": [\"syvncqmfhautvxudqdhggz\\nhrpxzeghsocjpicuixskfuzupytsgjsdiyb\\nybcmnmnbpndbxlxbzhbfnqvwcffvrdhtickyqhupmcehls\\n\", \"iefouqzxoyuieqdzalfktehtvdbvjmeubju\\nocotspetkkhvwfgaqynhovjwjhciefouqzxoyuieqdzalfktehtvdbvjmeubjubcmnvpwgdpnchqhzjrchyrfpvigubp\\nycnhjwgbocotspetkkhvwfgaqynhovjwjhcief\\n\... | Sometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings β input data to his problem is one string. Bob has 3 wrong solutions to this problem. The first gives the wrong answer if the input data contains the substring s1, the second enters an infinite loop i... | 0.5 |
{"tests": "{\"inputs\": [[[1, 1, 5, 6, 9, 16, 27], 4], [[1, 1, 3, 3], 2], [[4, 8, 12, 12, 3, 6, 2], 6], [[1, 2, 3, 4, 5, 6, 7], 7], [[1, 6, 2, 3, 7, 8, 7], 0], [[1, 2, 3, 4], 0], [[1, 1, 1, 1], 0], [[], 3]], \"outputs\": [[3], [4], [3], [0], [1], [0], [6], [0]]}", "source": "primeintellect"} | Write a function that accepts two arguments: an array/list of integers and another integer (`n`).
Determine the number of times where two integers in the array have a difference of `n`.
For example:
```
[1, 1, 5, 6, 9, 16, 27], n=4 --> 3 # (1,5), (1,5), (5,9)
[1, 1, 3, 3], n=2 --> 4 # (1,3), (1,3), ... | 0 |
{"tests": "{\"inputs\": [\"100 100 1 1\\n50 0 50 100 50\\n640 480 1 2\\n0 0 640 480 100\\n0 0 0 0\", \"100 100 1 1\\n62 0 50 100 50\\n640 480 1 1\\n0 0 640 480 100\\n0 0 0 0\", \"100 100 1 1\\n50 0 50 100 50\\n640 480 1 2\\n0 0 640 480 110\\n0 0 0 0\", \"100 100 1 1\\n76 0 50 100 50\\n640 480 1 1\\n0 0 640 480 100\\n0 ... | Nathan O. Davis is challenging a kind of shooter game. In this game, enemies emit laser beams from outside of the screen. A laser beam is a straight line with a certain thickness. Nathan moves a circular-shaped machine within the screen, in such a way it does not overlap a laser beam. As in many shooters, the machine i... | 0.125 |
{"tests": "{\"inputs\": [\"3\\n1 1 8 8\\n2 4 3 8\\n8 3 8 8\", \"3\\n1 1 8 8\\n2 3 3 8\\n8 3 8 8\", \"3\\n1 1 8 7\\n2 3 3 8\\n8 3 8 8\", \"3\\n1 1 8 7\\n2 3 3 4\\n8 3 8 8\", \"3\\n1 1 8 7\\n2 3 3 4\\n8 3 8 2\", \"3\\n1 1 1 8\\n2 3 3 8\\n8 3 8 8\", \"3\\n1 1 8 7\\n2 3 3 8\\n8 3 8 3\", \"3\\n1 1 8 7\\n2 3 3 6\\n8 3 8 8\",... | problem
Prepare the Othello board. The upper left is $ (1,1) $ and the lower right is $ (8,8) $. The board to be prepared here is $ (5,4) as follows. ) There is no $ black stone.
........
........
........
... ox ...
.... o ...
........
........
........
Kuroishi: x Shiraishi: o
8x8 board
From this state, Black st... | 0 |
{"tests": "{\"inputs\": [\"1\\n1\\n1\\n\", \"1\\n1\\n1000000000\\n\", \"5\\n16 2 8 19 4\\n10 9 10 10 10\\n\", \"5\\n12 19 11 13 16\\n14 14 14 14 15\\n\", \"2\\n1 5\\n3 4\\n\", \"5\\n19 9 3 20 2\\n11 11 10 11 10\\n\", \"20\\n53 86 76 100 16 12 13 97 79 23 28 64 42 10 23 56 59 76 48 12\\n48 49 49 49 48 49 48 49 49 49 48 ... | There are n stones arranged on an axis. Initially the i-th stone is located at the coordinate s_i. There may be more than one stone in a single place.
You can perform zero or more operations of the following type:
* take two stones with indices i and j so that s_i β€ s_j, choose an integer d (0 β€ 2 β
d β€ s_j - s_i)... | 0 |
{"tests": "{\"inputs\": [\"10 2 5\\n\", \"21 4 6\\n\", \"1337 7 7\\n\", \"455678451 22 17\\n\", \"21 7 9\\n\", \"51 9 11\\n\", \"302 17 21\\n\", \"3 4 14\\n\", \"2 14 19\\n\", \"58 11 7\\n\", \"65 14 11\\n\", \"31 5 18\\n\", \"59 19 5\\n\", \"98 12 22\\n\", \"181 21 13\\n\", \"18 14 5\\n\", \"25 15 20\\n\", \"97 14 11\... | Let's call the set of positive integers $S$ correct if the following two conditions are met:
$S \subseteq \{1, 2, \dots, n\}$;
if $a \in S$ and $b \in S$, then $|a-b| \neq x$ and $|a-b| \neq y$.
For the given values $n$, $x$, and $y$, you have to find the maximum size of the correct set.
-----Input-----
A single ... | 0 |
{"tests": "{\"inputs\": [\"3\\n0\\n0\\n1000000010\", \"4\\n11\\n5\\n10\\n6\", \"4\\n6\\n5\\n10\\n6\", \"4\\n6\\n5\\n20\\n6\", \"4\\n2\\n5\\n20\\n6\", \"4\\n2\\n5\\n10\\n6\", \"4\\n2\\n5\\n10\\n5\", \"4\\n0\\n5\\n10\\n5\", \"4\\n0\\n7\\n10\\n5\", \"4\\n0\\n7\\n10\\n1\", \"4\\n0\\n7\\n10\\n0\", \"3\\n0\\n0\\n0000000000\"... | Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.
Today's training is to perform a very large number of calculations to improve the calculation power and raise awareness. Exponentiation is an operation that easily produces large numbers.... | 0 |
{"tests": "{\"inputs\": [\"27 29\\n12 11\\n21 20\\n19 26\\n16 24\\n22 4\\n1 3\\n23 5\\n9 1\\n4 3\\n21 23\\n22 8\\n14 6\\n25 13\\n7 20\\n9 16\\n3 20\\n23 19\\n17 10\\n13 18\\n8 14\\n23 25\\n25 27\\n19 15\\n19 15\\n17 24\\n12 27\\n18 11\\n25 5\\n22 17\\n\", \"15 29\\n6 11\\n14 3\\n10 4\\n14 7\\n6 14\\n7 15\\n13 8\\n10 13... | A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.
In the constructing process m bidirectional ski r... | 0.75 |
{"tests": "{\"inputs\": [[0], [3], [16], [32], [49], [89], [327], [363], [366], [512], [656], [1038], [1052], [1222], [1235], [1302], [1735], [1757], [1974], [2048]], \"outputs\": [[0], [7], [171], [683], [1215], [3715], [52239], [60195], [62063], [174763], [209095], [699451], [700379], [757295], [762019], [832559], [1... | Introduction
It's been more than 20 minutes since the negligent waiter has taken your order for the house special prime tofu steak with a side of chili fries.
Out of boredom, you start fiddling around with the condiments tray. To be efficient, you want to be familiar with the choice of sauces and spices before your o... | 0 |
{"tests": "{\"inputs\": [\"500 1 500 500\\n\", \"300 300 1 300\\n\", \"5000 1 5000 5000\\n\", \"232 195 193 322\\n\", \"5000 5000 1 5000\\n\", \"2 2 1 1\\n\", \"500 499 500 500\\n\", \"1000 500 1 2000\\n\", \"3 2 3 1\\n\", \"300 1 300 300\\n\", \"500 498 500 499\\n\", \"500 500 498 5000\\n\", \"2 1 2 1\\n\", \"2 1 2 50... | Imagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very bored, so you want to take the lift. Floor number b has a secret lab, the entry is forbidden. Howe... | 0 |
{"tests": "{\"inputs\": [\"aaaccabcbc\\nabcbabbbaa\\n\", \"nclmevhtio\\nefnepwqphvwxiyguotuk\\n\", \"zkccmpbrfadhkukfvkci\\nfopwpsbztb\\n\", \"abbbaabbba\\nbaaaababbb\\n\", \"aaaccabcbc\\nacbbabbbaa\\n\", \"nclmevhtio\\nefneowqphvwxiyguotuk\\n\", \"zkcbmpbrfadhkukfvkci\\nfopwpsbztb\\n\", \"abbbaabbba\\nbbaaababbb\\n\",... | You are given two strings x and y, both consist only of lowercase Latin letters. Let |s| be the length of string s.
Let's call a sequence a a merging sequence if it consists of exactly |x| zeros and exactly |y| ones in some order.
A merge z is produced from a sequence a by the following rules:
* if a_i=0, then re... | 0 |
{"tests": "{\"inputs\": [[2], [3], [5], [9], [7], [23], [79], [32], [39], [55], [11350224]], \"outputs\": [[\"Special!!\"], [\"Special!!\"], [\"Special!!\"], [\"NOT!!\"], [\"NOT!!\"], [\"Special!!\"], [\"NOT!!\"], [\"Special!!\"], [\"NOT!!\"], [\"Special!!\"], [\"Special!!\"]]}", "source": "primeintellect"} | # Definition
A number is a **_Special Number_** *if itβs digits only consist 0, 1, 2, 3, 4 or 5*
**_Given_** a number *determine if it special number or not* .
# Warm-up (Highly recommended)
# [Playing With Numbers Series](https://www.codewars.com/collections/playing-with-numbers)
___
# Notes
* **_The numbe... | 0 |
{"tests": "{\"inputs\": [\"3 6 3\\n2 1 3\\n1 2 3 1 2 3\\n1 5\\n2 6\\n3 5\\n\", \"2 4 3\\n2 1\\n1 1 2 2\\n1 2\\n2 3\\n3 4\\n\", \"1 1 1\\n1\\n1\\n1 1\\n\", \"1 1 1\\n1\\n1\\n1 1\\n\", \"2 4 3\\n2 1\\n1 1 2 2\\n2 2\\n2 3\\n3 4\\n\", \"3 6 3\\n2 1 3\\n1 1 3 1 2 3\\n1 5\\n2 6\\n3 5\\n\", \"3 6 3\\n2 1 3\\n1 2 3 1 2 3\\n1 5... | Recently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation $p$ of length $n$, and Skynyrd bought an array $a$ of length $m$, consisting of integers from $1$ to $n$.
Lynyrd and Skynyrd became bored, so they asked you $q$ queries, each of which has the following form: "does the subsegment of $a$ from ... | 0.5 |
{"tests": "{\"inputs\": [[\"abcdefg\", \"abcqetg\"], [\"Hello World!\", \"hello world.\"], [\"FixedGrey\", \"FixedGrey\"], [\"HACKER\", \"H4CK3R\"], [\"This is a really long sentence.\", \"That is a_really long sentence,\"], [\"\", \"\"], [\"abcdefghijklmnopqrstuvwxyz\", \"zyxwvutsrqponmlkjihgfedcba\"], [\"YOLO lol\", ... | This kata is part of the collection [Mary's Puzzle Books](https://www.codewars.com/collections/marys-puzzle-books).
Mary brought home a "spot the differences" book. The book is full of a bunch of problems, and each problem consists of two strings that are similar. However, in each string there are a few characters tha... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.