info stringlengths 120 50k | question stringlengths 504 10.4k | avg@8_qwen3_4b_instruct_2507 float64 0 0.88 |
|---|---|---|
{"tests": "{\"inputs\": [\"10\\n4 5 1 1 4 5 12 3 6 4\\n0\", \"10\\n4 5 1 1 4 5 12 3 0 5\\n0\", \"10\\n4 5 1 1 3 5 14 3 0 5\\n0\", \"10\\n4 5 1 1 3 10 14 3 0 5\\n0\", \"10\\n4 5 1 0 3 10 14 3 0 5\\n0\", \"10\\n1 5 1 0 3 10 14 3 0 5\\n0\", \"10\\n1 5 1 0 3 4 27 0 0 5\\n0\", \"10\\n2 5 1 0 3 4 27 0 0 5\\n0\", \"10\\n2 5 1... | There is a frequency operation in the conversion operation of a finite number sequence. The conversion result of the sequence $ S = \\ {s_1, s_2, ... s_n \\} $ is a sequence of the same length. If the result is $ C = \\ {c_1, c_2, ..., c_n \\} $, then $ c_i $ represents the number of $ s_i $ in the sequence $ S $.
For... | 0.625 |
{"tests": "{\"inputs\": [\"5 3\\n15 13 15 15 12\\n\", \"5 4\\n15 13 15 15 12\\n\", \"4 4\\n20 10 40 30\\n\", \"1 1\\n1\\n\", \"100 53\\n16 17 1 2 27 5 9 9 53 24 17 33 35 24 20 48 56 73 12 14 39 55 58 13 59 73 29 26 40 33 22 29 34 22 55 38 63 66 36 13 60 42 10 15 21 9 11 5 23 37 79 47 26 3 79 53 44 8 71 75 42 11 34 39 7... | There are $n$ students in a school class, the rating of the $i$-th student on Codehorses is $a_i$. You have to form a team consisting of $k$ students ($1 \le k \le n$) such that the ratings of all team members are distinct.
If it is impossible to form a suitable team, print "NO" (without quotes). Otherwise print "YES"... | 0 |
{"tests": "{\"inputs\": [\"5\\n90 94\\n26 25\\n64 84\\n14 6\\n20 96\\n\", \"5\\n90 94\\n26 25\\n64 84\\n18 6\\n20 96\\n\", \"5\\n1912 1\\n5 6\\n999 1\\n88 2\\n11 100\\n\", \"5\\n90 94\\n26 25\\n64 84\\n22 6\\n20 96\\n\", \"5\\n1912 1\\n5 6\\n999 1\\n88 2\\n6 100\\n\", \"5\\n90 113\\n26 25\\n64 84\\n22 6\\n20 96\\n\", \... | You are given an integer n. You have to apply m operations to it.
In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes 21023 after applying the operation once.
You have to find the length of n after applying m operations. Since... | 0.625 |
{"tests": "{\"inputs\": [\"8 2 4\", \"3 3 1\", \"31 61 59\", \"3 8 7\", \"1 2 4\", \"4 3 1\", \"31 49 59\", \"6 8 7\", \"1 0 4\", \"4 2 1\", \"39 49 59\", \"4 8 7\", \"1 -1 4\", \"39 49 10\", \"4 4 7\", \"1 -1 2\", \"51 49 10\", \"4 4 0\", \"0 -1 2\", \"51 49 0\", \"0 -2 2\", \"51 79 0\", \"1 -2 2\", \"3 79 0\", \"0 -2... | There are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively. Print `Yes` if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print `No` otherwise.
Constraints
* 0\leq A,B,C\leq 100
* A, B and C are distinct integers.
I... | 0.5 |
{"tests": "{\"inputs\": [\"4 7\\n2 4\\n1 1\\n2 3\\n2 4\", \"4 4\\n2 4\\n1 1\\n2 0\\n2 4\", \"4 4\\n3 4\\n1 1\\n2 3\\n2 4\", \"4 4\\n2 4\\n1 1\\n2 0\\n3 4\", \"4 4\\n1 4\\n1 1\\n2 0\\n3 4\", \"4 5\\n0 4\\n0 1\\n4 5\\n3 4\", \"4 7\\n2 4\\n0 1\\n2 3\\n5 7\", \"4 7\\n1 3\\n0 1\\n4 1\\n3 7\", \"4 7\\n2 4\\n0 1\\n2 3\\n2 4\"... | There is a grid of squares with H+1 horizontal rows and W vertical columns.
You will start at one of the squares in the top row and repeat moving one square right or down. However, for each integer i from 1 through H, you cannot move down from the A_i-th, (A_i + 1)-th, \ldots, B_i-th squares from the left in the i-th ... | 0 |
{"tests": "{\"inputs\": [\"1000 15 80\\n\", \"2000 20 100\\n\", \"10000 1 1\\n\", \"1050 10 100\\n\", \"1001 10 100\\n\", \"1000 10 100\\n\", \"999 10 100\\n\", \"950 10 100\\n\", \"1 1 1\\n\", \"1 10000 10000\\n\", \"522 4575 6426\\n\", \"9445 8772 81\\n\", \"3447 629 3497\\n\", \"7202 7775 4325\\n\", \"3982 4784 8417... | Takahashi is meeting up with Aoki.
They have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.
Takahashi will leave his house now and go straight to the place at a speed of S meters per minute.
Will he arrive in time?
-----Constraints-----
- 1 \leq D \leq 10000
- 1 \leq T... | 0.5 |
{"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": "taco"} | ## 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.625 |
{"tests": "{\"inputs\": [\"15 13\\n\", \"9 10\\n\", \"47 46\\n\", \"49829224 49889315\\n\", \"483242 484564\\n\", \"644590722 593296648\\n\", \"971840165 826141527\\n\", \"49728622 49605627\\n\", \"99692141 99232337\\n\", \"48298903 49928606\\n\", \"792322809 775058858\\n\", \"998557701 924591072\\n\", \"939 887\\n\", ... | One popular blog site edits the uploaded photos like this. It cuts a rectangular area out of them so that the ratio of height to width (i.e. the height / width quotient) can vary from 0.8 to 1.25 inclusively. Besides, at least one side of the cut area should have a size, equal to some power of number 2 (2x for some int... | 0.25 |
{"tests": "{\"inputs\": [\"9 1 8 2\\n4 1 5 9\\n4 6 8 2\\n4 6 3 0\", \"9 1 8 2\\n6 1 5 9\\n4 6 8 2\\n2 6 3 0\", \"9 1 8 2\\n4 1 5 9\\n2 6 8 2\\n4 6 3 0\", \"9 1 8 2\\n6 2 5 9\\n4 6 8 2\\n4 6 3 0\", \"9 1 8 2\\n6 2 5 9\\n4 6 8 2\\n4 9 3 0\", \"9 1 8 2\\n6 1 2 9\\n4 6 13 2\\n2 6 3 1\", \"9 1 8 2\\n6 1 5 9\\n8 6 13 2\\n2 7... | Let's play Hit and Blow game. A imagines four numbers and B guesses the numbers. After B picks out four numbers, A answers:
* The number of numbers which have the same place with numbers A imagined (Hit)
* The number of numbers included (but different place) in the numbers A imagined (Blow)
For example, if A imagin... | 0.375 |
{"tests": "{\"inputs\": [\"4\\n1 2 3 5\\n\", \"5\\n1000000000 1000000000 1000000000 1000000000 1\\n\", \"4\\n1 12 3 5\\n\", \"5\\n1 3 2 2 4\\n\", \"5\\n1 2 3 2 1\\n\", \"1\\n1941283\\n\", \"3\\n2 8 2\\n\", \"3\\n6 4 6\\n\", \"3\\n5 8 7\\n\", \"40\\n2 2 88 88 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 7 7 2 2 2 2 2 2... | Oleg the bank client and Igor the analyst are arguing again. This time, they want to pick a gift as a present for their friend, ZS the coder. After a long thought, they decided that their friend loves to eat carrots the most and thus they want to pick the best carrot as their present.
There are n carrots arranged in a... | 0 |
{"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\": [\"6\\nA 1 0 0 2 0\\nB 0 0 1 1 0\\nC 1 1 1 1 1\\nD 1 0 0 1 2\\nE 2 0 0 0 0\\nF 1 1 0 2 1\\n4\\ng 1 1 1\\nh 0 1 2\\nx 0 0 0\\nb 0 2 1\\n0\", \"6\\nA 1 0 0 2 -1\\nB 0 0 1 1 0\\nC 1 1 1 1 1\\nD 1 0 0 1 2\\nE 2 0 0 0 0\\nF 1 1 0 2 1\\n4\\ng 1 1 1\\nh 0 1 2\\nx 0 0 0\\nb 0 2 1\\n0\", \"6\\nA 1 0 0 2 ... | Japan achieved the second straight victory in the national baseball competition WBC !! A baseball tournament was held at Aizu Gakuen High School as baseball became more popular. In this tournament, a round-robin league match will be held and the ranking will be decided in the following ways.
1. The team with the most ... | 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\": [\"124\\n\", \"04\\n\", \"5810438174\\n\", \"1\\n\", \"039\\n\", \"97247\\n\", \"5810438174\\n\", \"12883340691714056185860211260984431382156326935244\\n\", \"2144315253572020279108092911160072328496568665545836825277616363478721946398140227406814602154768031\\n\", \"8012464901405497108121360813... | Max wants to buy a new skateboard. He has calculated the amount of money that is needed to buy a new skateboard. He left a calculator on the floor and went to ask some money from his parents. Meanwhile his little brother Yusuf came and started to press the keys randomly. Unfortunately Max has forgotten the number which... | 0.375 |
{"tests": "{\"inputs\": [\"19\\n19 14 48\\n11 19 23\\n17 14 30\\n7 11 15\\n2 19 15\\n2 18 21\\n19 10 43\\n12 11 25\\n3 11 4\\n5 19 50\\n4 11 19\\n9 12 29\\n14 13 3\\n14 6 12\\n14 15 17\\n5 1 6\\n8 18 13\\n7 16 14\", \"3\\n1 3 10\\n2 3 20\", \"19\\n19 14 48\\n11 19 23\\n17 14 30\\n7 11 15\\n2 19 15\\n2 18 21\\n19 10 43\... | Snuke Festival 2017 will be held in a tree with N vertices numbered 1,2, ...,N. The i-th edge connects Vertex a_i and b_i, and has joyfulness c_i.
The staff is Snuke and N-1 black cats. Snuke will set up the headquarters in some vertex, and from there he will deploy a cat to each of the other N-1 vertices.
For each v... | 0.25 |
{"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\": [\"7 3\\n4 2 2\", \"6 2\\n1 4 1\", \"100 2\\n100\", \"110 2\\n110\", \"7 3\\n2 2 2\", \"7 3\\n2 1 2\", \"7 3\\n0 1 2\", \"7 3\\n0 1 1\", \"7 3\\n0 1 0\", \"7 3\\n-1 1 1\", \"7 5\\n-1 1 1\", \"7 3\\n4 1 2\", \"6 2\\n1 0 1\", \"7 3\\n2 2 1\", \"12 3\\n2 1 2\", \"7 3\\n1 1 2\", \"7 3\\n1 1 1\", \"7... | There are K pieces of cakes. Mr. Takahashi would like to eat one cake per day, taking K days to eat them all.
There are T types of cake, and the number of the cakes of type i (1 ≤ i ≤ T) is a_i.
Eating the same type of cake two days in a row would be no fun, so Mr. Takahashi would like to decide the order for eating ... | 0 |
{"tests": "{\"inputs\": [\"6\\n1 2 -6 4 5 3\\n\", \"6\\n100 -100 -100 -100 100 -100\\n\", \"5\\n-1 -2 -3 -4 -5\\n\", \"2\\n-1000 100000\\n\", \"98\\n-732082503 484310639 410514008 709792355 513377678 -643565830 -558057755 673249507 -879378244 595054694 886176495 197608768 127996665 169589649 -210521660 98709367 -470201... | We have N gemstones labeled 1 through N.
You can perform the following operation any number of times (possibly zero).
- Select a positive integer x, and smash all the gems labeled with multiples of x.
Then, for each i, if the gem labeled i remains without getting smashed, you will receive a_i yen (the currency of Japa... | 0.125 |
{"tests": "{\"inputs\": [\"5 3\\n3 2 1\\n\", \"5 3\\n2 3 1\\n\", \"5 1\\n3\\n\", \"5 2\\n3 4\\n\", \"20 19\\n2 18 19 11 9 20 15 1 8 14 4 6 5 12 17 16 7 13 3\\n\", \"10 1\\n6\\n\", \"20 18\\n8 14 18 10 1 3 7 15 2 12 17 19 5 4 11 13 20 16\\n\", \"10 2\\n3 7\\n\", \"100000 3\\n43791 91790 34124\\n\", \"20 17\\n9 11 19 4 8... | Let's suppose you have an array a, a stack s (initially empty) and an array b (also initially empty).
You may perform the following operations until both a and s are empty:
Take the first element of a, push it into s and remove it from a (if a is not empty); Take the top element from s, append it to the end of arr... | 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\": [\"2 3\\narc\\nrac\\n\", \"3 7\\natcoder\\nregular\\ncontest\\n\", \"12 12\\nbimonigaloaf\\nfaurwlkbleht\\ndexwimqxzxbb\\nlxdgyoifcxid\\nydxiliocfdgx\\nnfoabgilamoi\\nibxbdqmzxxwe\\npqirylfrcrnf\\nwtehfkllbura\\nyfrnpflcrirq\\nwvcclwgiubrk\\nlkbrwgwuiccv\\n\", \"3 3\\ndhh\\ndgz\\ndzg\\n\", \"5 1... | There is an H \times W grid (H vertical, W horizontal), where each square contains a lowercase English letter.
Specifically, the letter in the square at the i-th row and j-th column is equal to the j-th character in the string S_i.
Snuke can apply the following operation to this grid any number of times:
- Choose two ... | 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 2\\n11\\n\", \"5 4\\n21122\\n\", \"356 339\\n907131239889673760773746853858572438995417398894342817131941820700739474480510662042964057241360300464753872345887896839602445224067044833280801776357904174784695635378499062601000312720241449483527213191135843147786074556206960322941298425329118... | A car number in Berland consists of exactly n digits. A number is called beautiful if it has at least k equal digits. Vasya wants to change the digits in his car's number so that the number became beautiful. To replace one of n digits Vasya has to pay the sum of money, equal to the absolute difference between the old d... | 0 |
{"tests": "{\"inputs\": [\"habege\\necjecg\\n0\\n\", \"aaaaaaaaaa\\naaaaaaaaaa\\n50\\na a 47\\na a 40\\na a 22\\na a 48\\na a 37\\na a 26\\na a 40\\na a 28\\na a 8\\na a 46\\na a 42\\na a 37\\na a 1\\na a 0\\na a 16\\na a 34\\na a 12\\na a 50\\na a 45\\na a 49\\na a 12\\na a 8\\na a 32\\na a 17\\na a 13\\na a 1\\na a 1... | Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to make them identical. According to the game rules, with each move Valera can change one arbitrary ch... | 0.125 |
{"tests": "{\"inputs\": [\"6 2 4\\n1 6\\n1 2\\n2 3\\n3 4\\n4 5\\n5 6\\n\", \"6 3 2\\n1 5 6\\n1 2\\n1 3\\n1 4\\n1 5\\n5 6\\n\", \"10 1 5\\n5\\n1 2\\n2 3\\n3 4\\n4 5\\n5 6\\n6 7\\n7 8\\n8 9\\n9 10\\n\", \"11 1 5\\n6\\n1 2\\n2 3\\n3 4\\n4 5\\n5 6\\n6 7\\n7 8\\n8 9\\n9 10\\n10 11\\n\", \"2 1 1\\n1\\n1 2\\n\", \"6 2 4\\n1 6... | Inzane finally found Zane with a lot of money to spare, so they together decided to establish a country of their own.
Ruling a country is not an easy job. Thieves and terrorists are always ready to ruin the country's peace. To fight back, Zane and Inzane have enacted a very effective law: from each city it must be pos... | 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\": [\"3 5\\n1 2 3\\n\", \"12 10\\n1 1 10 10 10 10 10 10 9 10 10 10\\n\", \"7 2\\n2 3 6 4 5 7 1\\n\", \"8 4\\n1 3 4 5 5 3 4 1\\n\", \"15 5\\n11 15 16 24 24 28 36 40 49 49 53 55 66 73 100\\n\", \"11 10\\n58 97 93 74 59 59 76 59 59 59 30\\n\", \"1 1\\n1\\n\", \"15 5\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\n\... | Since you are the best Wraith King, Nizhniy Magazin «Mir» at the centre of Vinnytsia is offering you a discount.
You are given an array a of length n and an integer c.
The value of some array b of length k is the sum of its elements except for the $\lfloor \frac{k}{c} \rfloor$ smallest. For example, the value of the... | 0 |
{"tests": "{\"inputs\": [\"6 6\\n0 1\\n1 2\\n4 1\\n3 4\\n4 5\\n5 2\", \"6 6\\n0 1\\n1 2\\n4 1\\n3 4\\n4 5\\n5 0\", \"6 6\\n0 2\\n1 2\\n3 1\\n3 4\\n4 5\\n5 2\", \"6 6\\n0 1\\n1 2\\n3 1\\n3 4\\n4 5\\n5 1\", \"6 6\\n0 2\\n1 2\\n4 1\\n3 4\\n1 5\\n5 0\", \"6 0\\n0 1\\n1 2\\n4 1\\n3 4\\n4 5\\n5 2\", \"4 0\\n1 2\\n2 3\\n2 2\\... | <image>
A directed acyclic graph (DAG) can be used to represent the ordering of tasks. Tasks are represented by vertices and constraints where one task can begin before another, are represented by edges. For example, in the above example, you can undertake task B after both task A and task B are finished. You can obt... | 0.75 |
{"tests": "{\"inputs\": [\"1 4\\n6 5 1 10 1 1 5\\n\", \"3 2\\n1 10\\n1 2\\n1 5\\n\", \"1 1\\n1 100\\n\", \"1 68\\n100 26 58 15 8 69 66 49 97 18 74 27 39 19 76 37 25 4 88 75 17 79 41 21 44 39 7 42 63 82 92 87 41 85 25 30 43 80 95 70 98 88 16 15 97 74 81 76 33 19 64 3 14 72 17 36 33 21 34 59 38 75 48 1 57 20 81 56 74 67 ... | During her tantrums the princess usually smashes some collectable porcelain. Every furious shriek is accompanied with one item smashed.
The collection of porcelain is arranged neatly on n shelves. Within each shelf the items are placed in one row, so that one can access only the outermost items — the leftmost or the r... | 0.25 |
{"tests": "{\"inputs\": [\"1788 105960835 681218449 90629745 90632170\", \"4 7 11 4 5\", \"491995 412925347 465710940 59999126 59999339\", \"1788 122437383 681218449 90629745 90632170\", \"491995 412925347 465710940 59999126 4650906\", \"4 7 11 4 6\", \"1788 122437383 681218449 90629745 148553464\", \"801386 412925347 ... | There are N squares in a row. The leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty.
Aohashi would like to fill the empty squares with integers so that the following condition is satisfied:
* For any two adjacent squares, the (absolute) difference of the two... | 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.25 |
{"tests": "{\"inputs\": [\"brtakoktrosttttttttttosafasfkalsfkodfdasiofhadfhasdsajfdsafoasodsafahaihfdisoadspapsapiosapdsajdipsahdhasuirhaeuifhhfkjgosooooooooodafdfioottttafdsafaddfuiasdjfjasdo\\nokat\\ntako\\n\", \"aleksandrehteosidatedodam\\nevo\\nsi\\n\", \"goodbyeihopecontestisntsohar\\noh\\ngod\\n\", \"duxidimkeeto... | Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one.
GukiZ has strings a, b, and c. He wants to obtain string k by swapping some letters in a, so that k should contain as many non-overlapping substrings equal either to b or c as possible. Substring of string x... | 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 |
{"tests": "{\"inputs\": [\"3\\n3 1 2\\n\", \"7\\n5 0 7 8 3 3 2\\n\", \"50\\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100\\n\", \"50\\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0... | It's now the season of TAKOYAKI FESTIVAL!
This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The deliciousness of the i-th takoyaki is d_i.
As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.
There are \frac{N \t... | 0.5 |
{"tests": "{\"inputs\": [\"2\\n0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0\\n3.0 2.0 9.680227793087974 6.0 13.0 5.0 7.0 9.0\", \"2\\n0.943552035027174 0.0 1.0 1.0 1.0 0.0 2.0 1.0\\n3.0 2.0 9.680227793087974 6.0 13.541356008746918 5.95543610948743 7.0 9.233114893271226\", \"2\\n0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0\\n3.0 2.0 9.6802277930... | There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "YES" and if not prints "NO".
Input
Input consists of several datasets. In the fir... | 0.75 |
{"tests": "{\"inputs\": [[5], [11], [1], [2], [3], [4], [8], [16], [15], [31]], \"outputs\": [[3], [7], [1], [1], [3], [1], [1], [1], [15], [31]]}", "source": "taco"} | # Task
Suppose there are `n` people standing in a circle and they are numbered 1 through n in order.
Person 1 starts off with a sword and kills person 2. He then passes the sword to the next person still standing, in this case person 3. Person 3 then uses the sword to kill person 4, and passes it to person 5. This... | 0.625 |
{"tests": "{\"inputs\": [[5, 7, 3848], [2, 7, 3848], [2, 8, 5026], [4, 9, 6361], [3, 10, 7853], [3, 5, 1963], [4, 7, 3848], [0, 7, 3848], [7, 7, 3848], [2, 5, 1963], [2, 4, 1256], [4, 10, 7853], [3, 9, 6361], [2, 10, 7853], [5, 9, 6361], [5, 6, 2827], [1, 4, 1256]], \"outputs\": [[2940], [907], [982], [2731], [1981], [... | To introduce the problem think to my neighbor who drives a tanker truck.
The level indicator is down and he is worried
because he does not know if he will be able to make deliveries.
We put the truck on a horizontal ground and measured the height of the liquid in the tank.
Fortunately the tank is a perfect cylinder ... | 0 |
{"tests": "{\"inputs\": [[\"||| ||||//| |/\"], [\"|||||\"], [\" ///\"], [\"\"], [\" \"], [\" |\"], [\"||||| |||\"], [\"|||||/|||\"]], \"outputs\": [[\"/// ||||//| |/\"], [\"/////\"], [\" ///\"], [\"\"], [\" \"], [\" |\"], [\"///// |||\"], [\"//////|||\"]]}", "source": "taco"} | You're given a string of dominos. For each slot, there are 3 options:
* "|" represents a standing domino
* "/" represents a knocked over domino
* " " represents a space where there is no domino
For example:
```python
"||| ||||//| |/"
```
What you must do is find the resulting string if the first domino is ... | 0 |
{"tests": "{\"inputs\": [\"25\\n\", \"22\\n\", \"23\\n\", \"24\\n\", \"13\", \"18\", \"4\", \"8\", \"6\", \"0\", \"-1\", \"-2\", \"1\", \"2\", \"3\", \"7\", \"5\", \"-4\", \"-3\", \"-6\", \"-10\", \"-7\", \"-8\", \"10\", \"9\", \"11\", \"19\", \"15\", \"-5\", \"14\", \"12\", \"17\", \"16\", \"21\", \"-12\", \"-9\", \"-... | In some other world, today is December D-th.
Write a program that prints Christmas if D = 25, Christmas Eve if D = 24, Christmas Eve Eve if D = 23 and Christmas Eve Eve Eve if D = 22.
-----Constraints-----
- 22 \leq D \leq 25
- D is an integer.
-----Input-----
Input is given from Standard Input in the following for... | 0 |
{"tests": "{\"inputs\": [\"3 3 3\\n1 1\\n1 1\\n1 1\\n3 3 7\\n2 2\\n1 3\\n1 1\\n2 3\\n2 1\\n3 3\\n3 1\\n4 3 15\\n1 1\\n0 2\\n1 1\\n3 3\\n3 3\\n1 1\\n3 3\\n3 3\\n4 4\\n1 1\\n4 4\\n4 4\\n4 4\\n4 1\\n2 2\\n0 0 0\", \"3 3 3\\n1 1\\n1 1\\n1 1\\n3 3 7\\n3 2\\n1 3\\n1 1\\n2 3\\n2 1\\n3 3\\n3 1\\n4 3 15\\n1 1\\n2 2\\n1 1\\n3 3\... | Your company’s next product will be a new game, which is a three-dimensional variant of the classic game “Tic-Tac-Toe”. Two players place balls in a three-dimensional space (board), and try to make a sequence of a certain length.
People believe that it is fun to play the game, but they still cannot fix the values of s... | 0 |
{"tests": "{\"inputs\": [\"3\\n120 75\\n128 16\\n7 8\", \"3\\n120 75\\n128 16\\n7 11\", \"3\\n120 137\\n128 16\\n7 11\", \"3\\n53 136\\n128 16\\n0 11\", \"3\\n120 16\\n128 4\\n4 4\", \"3\\n215 16\\n128 12\\n6 4\", \"3\\n82 199\\n339 16\\n1 5\", \"3\\n120 75\\n184 5\\n16 18\", \"3\\n120 75\\n171 16\\n0 11\", \"3\\n53 13... | Read problems statements in Mandarin Chinese and Russian.
You are given two positive integers – A and B. You have to check whether A is divisible by all the prime divisors of B.
------ Input ------
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases... | 0.5 |
{"tests": "{\"inputs\": [\"3\\n6 3 2 5 4 1\\n\", \"2\\n3 4 2 1\\n\", \"4\\n1 2 3 4 5 6 7 8\\n\", \"3\\n5 4 1 6 3 2\\n\", \"4\\n6 5 8 7 2 1 4 3\\n\", \"9\\n16 5 18 7 2 9 4 11 6 13 8 15 10 17 12 1 14 3\\n\", \"15\\n11 22 13 24 15 26 17 28 19 30 21 2 23 4 25 6 27 8 29 10 1 12 3 14 5 16 7 18 9 20\\n\", \"3\\n5 4 1 6 3 2\\n... | The brave Knight came to the King and asked permission to marry the princess. The King knew that the Knight was brave, but he also wanted to know if he was smart enough. So he asked him to solve the following task.
There is a permutation $p_i$ of numbers from 1 to $2n$. You can make two types of operations.
Swap $p_1... | 0.125 |
{"tests": "{\"inputs\": [[12], [19], [450], [0], [13], [1], [5], [10]], \"outputs\": [[26], [-1], [2559], [10], [-1], [11], [15], [25]]}", "source": "taco"} | # Task
Given an integer `product`, find the smallest positive integer the product of whose digits is equal to product. If there is no such integer, return -1 instead.
# Example
For `product = 1`, the output should be `11`;
`1 x 1 = 1` (1 is not a valid result, because it has only 1 digit)
For `product = 12`, ... | 0 |
{"tests": "{\"inputs\": [[1, 2, 1, 3], [2, 3, 4, 5], [1, 2, 2, 3], [1, 1, 3, 5], [10, 11, 12, 13], [1, 20, -4, -5], [100, 100, 100, 100], [0, 0, 0, 0], [-14, 12, -10, 8], [7, 96, -1, 81], [112, 0, 0, 1]], \"outputs\": [[[[1, 7], [5, 5]]], [[[2, 23], [7, 22]]], [[[1, 8], [4, 7]]], [[[2, 8]]], [[[2, 263], [23, 262]]], [[... | We are still with squared integers.
Given 4 integers `a, b, c, d` we form the sum of the squares of `a` and `b`
and then the sum of the squares of `c` and `d`. We multiply the two sums hence a number `n` and we try to
decompose `n` in a sum of two squares `e` and `f` (e and f integers >= 0) so that `n = e² + f²`.
Mo... | 0 |
{"tests": "{\"inputs\": [[\"apples, pears # and bananas\\ngrapes\\nbananas !apples\", [\"#\", \"!\"]], [\"a #b\\nc\\nd $e f g\", [\"#\", \"$\"]], [\"apples, pears # and bananas\\ngrapes\\nbananas !#apples\", [\"#\", \"!\"]], [\"apples, pears # and bananas\\ngrapes\\nbananas #!apples\", [\"#\", \"!\"]], [\"apples, pears... | Complete the solution so that it strips all text that follows any of a set of comment markers passed in. Any whitespace at the end of the line should also be stripped out.
**Example:**
Given an input string of:
```
apples, pears # and bananas
grapes
bananas !apples
```
The output expected would be:
```
apples, pear... | 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": "t... | 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\": [\"3\\n0 0 1\\n0 0 1\\n1 1 0\\n\", \"4\\n0 1 1 1\\n1 0 1 1\\n1 1 0 1\\n1 1 1 0\\n\", \"3\\n0 0 0\\n0 0 1\\n0 1 0\\n\", \"4\\n0 0 0 1\\n0 0 0 0\\n0 0 0 1\\n1 0 1 0\\n\", \"4\\n0 0 1 0\\n0 0 0 1\\n1 0 0 0\\n0 1 0 0\\n\", \"10\\n0 0 0 0 0 0 1 0 0 0\\n0 0 0 0 0 0 0 0 0 0\\n0 0 0 1 0 0 0 0 0 0\\n0 0 ... | There are n points marked on the plane. The points are situated in such a way that they form a regular polygon (marked points are its vertices, and they are numbered in counter-clockwise order). You can draw n - 1 segments, each connecting any two marked points, in such a way that all points have to be connected with e... | 0.125 |
{"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": "taco"} | 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\\n0 0\\n1 1\\n0 3\\n1 2\", \"4\\n0 0\\n0 2\\n0 4\\n2 0\", \"3\\n-1 -1\\n1 0\\n3 1\", \"4\\n-10000 -10000\\n-10000 -9999\\n10000 10000\\n9999 10000\\n\", \"16\\n0 0\\n0 2\\n0 4\\n0 6\\n2 0\\n2 2\\n2 4\\n2 6\\n4 0\\n4 2\\n4 4\\n4 6\\n6 0\\n6 2\\n6 4\\n6 6\\n\", \"4\\n-10000 -10000\\n-10000 10... | This problem is same as the previous one, but has larger constraints.
It was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). After arriving at the power station, the cats got impressed with a large power transmission system c... | 0.25 |
{"tests": "{\"inputs\": [\"110\\n\", \"010\\n\", \"0001111\\n\", \"0111001100111011101000\\n\", \"0\\n\", \"1\\n\", \"0000000000000000\\n\", \"0100000001000001\\n\", \"0000100010001110\\n\", \"1001101000001101\\n\", \"0010000110000100\\n\", \"1111101000110110\\n\", \"1111111111111010\\n\", \"1111111111111111\\n\", \"11... | The only difference between easy and hard versions is the length of the string. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary... | 0 |
{"tests": "{\"inputs\": [\"10 10\\n.....W....\\n....W.W...\\n...W...W..\\n....W...W.\\n.....W...W\\n......W.W.\\nBBB....W..\\n..B..BBBBB\\n..B..B....\\n..B..B..W.\\n5 3\\n.B...\\n...BB\\n.....\\n1 1\\n.\\n0 0\", \"10 10\\n.....W....\\n....W.W...\\n..W...W...\\n....W...W.\\n.....W...W\\n......W.W.\\nBBB....W..\\n..B..BB... | Surrounding Area
Land fence
English text is not available in this practice contest.
Two real estate agents were boarding a passenger ship to the southern island. Blue sky, refreshing breeze ... The two enjoyed a voyage with other passengers. However, one day a tornado suddenly sank a passenger ship. The other passen... | 0.625 |
{"tests": "{\"inputs\": [\"3 1 2\\n1\\n\", \"9 2 26\\n2 3\\n\", \"12 3 1\\n2 5 6\\n\", \"2 1 1\\n1\\n\", \"2 1 234\\n1\\n\", \"6 2 5\\n1 3\\n\", \"2 1 1000000000\\n1\\n\", \"1000000000 1 1\\n1\\n\", \"1000000000 2 2\\n1 500000000\\n\", \"8 1 8\\n2\\n\", \"1000000000 1 1\\n1\\n\", \"1000000000 2 2\\n1 500000000\\n\", \"... | Consider some set of distinct characters $A$ and some string $S$, consisting of exactly $n$ characters, where each character is present in $A$.
You are given an array of $m$ integers $b$ ($b_1 < b_2 < \dots < b_m$).
You are allowed to perform the following move on the string $S$:
Choose some valid $i$ and set $k ... | 0 |
{"tests": "{\"inputs\": [\"5\\nDDRRR\\n\", \"6\\nDDRRRR\\n\", \"1\\nD\\n\", \"1\\nR\\n\", \"2\\nDR\\n\", \"3\\nRDD\\n\", \"3\\nDRD\\n\", \"4\\nDRRD\\n\", \"4\\nDRRR\\n\", \"4\\nRDRD\\n\", \"5\\nDRDRR\\n\", \"4\\nRRRR\\n\", \"5\\nRDDRD\\n\", \"5\\nDDRRD\\n\", \"5\\nDRRRD\\n\", \"5\\nDDDDD\\n\", \"6\\nDRRDDR\\n\", \"7\\n... | There are n employees in Alternative Cake Manufacturing (ACM). They are now voting on some very important question and the leading world media are trying to predict the outcome of the vote.
Each of the employees belongs to one of two fractions: depublicans or remocrats, and these two fractions have opposite opinions o... | 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\": [\"5 7\\n+ 5\\n- 10\\n- 20\\n+ 40\\n- 20\\n\", \"5 17\\n- 16\\n- 2\\n- 98\\n+ 100\\n- 98\\n\", \"6 1000000000\\n+ 1000000000\\n+ 1000000000\\n+ 1000000000\\n+ 1000000000\\n+ 1000000000\\n+ 1000000000\\n\", \"5 12\\n- 12\\n+ 7\\n- 6\\n- 1\\n+ 46\\n\", \"11 1000\\n- 100\\n+ 100\\n+ 100\\n+ 100\\n+... | After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer.
At the start of the day they have x ice cream packs. Since the ice cream is free, people start standing in the queue before Kay and Gerda's house even in the night. Each person in the q... | 0.375 |
{"tests": "{\"inputs\": [\"4\\n4\\n1 2 4 3\\n4\\n1 1 1 1\\n1\\n1\\n10\\n5 6 1 3 2 9 8 1 2 4\\n\", \"2\\n5\\n1 1 1 1 1\\n4\\n1 1 1 1\\n\", \"3\\n1\\n1\\n1\\n1\\n1\\n1\\n\", \"2\\n2\\n2 2\\n1\\n1\\n\", \"10\\n3\\n1 1 1\\n1\\n1\\n4\\n3 4 3 3\\n1\\n1\\n7\\n7 1 1 5 3 6 5\\n3\\n2 2 1\\n9\\n4 1 7 1 1 6 7 1 7\\n5\\n2 5 3 4 3\\... | This is the easy version of this problem. The only difference between easy and hard versions is the constraints on $k$ and $m$ (in this version $k=2$ and $m=3$). Also, in this version of the problem, you DON'T NEED to output the answer by modulo.
You are given a sequence $a$ of length $n$ consisting of integers from $... | 0.125 |
{"tests": "{\"inputs\": [\"10 10 3\\ncaa\\nc_c\\nba_\\naca\\nabb\\n_cc\\n_ba\\nbac\\nccb\\n_ab\\nabb 1\\ncca 8\\nacb 4\\ncbb 2\\nbaa 10\\nbba 8\\nbca 1\\ncab 8\\naaa 2\\nccb 6\\n\", \"5 10 1\\n_\\nb\\nc\\nd\\na\\nc 2\\na 5\\nb 5\\nb 2\\nd 5\\na 3\\nd 5\\nc 2\\nb 2\\nd 2\\n\", \"5 5 3\\ncaa\\nabb\\ncbb\\naac\\ncbc\\ncbc... | You are given n patterns p_1, p_2, ..., p_n and m strings s_1, s_2, ..., s_m. Each pattern p_i consists of k characters that are either lowercase Latin letters or wildcard characters (denoted by underscores). All patterns are pairwise distinct. Each string s_j consists of k lowercase Latin letters.
A string a matches ... | 0 |
{"tests": "{\"inputs\": [\"aabb\\n\", \"aabcaa\\n\", \"abbcccbba\\n\", \"aaaaaaaaaaa\\n\", \"aaaaaaaaabbbbbaaaabaaaaaaaaaaaaaaaaabaaaaaabbbbbbbaaabbbbbbbbbbbbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaa\\n\", \"abc\\n\", \"a\\n\", \"ab\\n\", \"ba\\n\", \"aaabbb\\n\", \"abababababab\\n\", \"aaabbbbbbaaa\\n\", \"bbbbbbbbbbbbbbbbb... | You are given a set of points on a straight line. Each point has a color assigned to it. For point a, its neighbors are the points which don't have any other points between them and a. Each point has at most two neighbors - one from the left and one from the right.
You perform a sequence of operations on this set of p... | 0.75 |
{"tests": "{\"inputs\": [\"0 1 4\", \"14 8 1\", \"9 2 9\", \"0 0 4\", \"14 8 2\", \"3 2 9\", \"11 15 2\", \"11 15 4\", \"3 0 12\", \"0 2 0\", \"11 15 0\", \"0 0 0\", \"16 5 0\", \"-2 0 0\", \"3 1 27\", \"-1 1 -4\", \"6 -2 0\", \"-1 -2 0\", \"-2 -2 -1\", \"-4 -2 -1\", \"0 -2 -4\", \"0 -2 -6\", \"1 -8 7\", \"1 -10 20\", ... | Takahashi has A untasty cookies containing antidotes, B tasty cookies containing antidotes and C tasty cookies containing poison.
Eating a cookie containing poison results in a stomachache, and eating a cookie containing poison while having a stomachache results in a death. As he wants to live, he cannot eat one in su... | 0 |
{"tests": "{\"inputs\": [\"36\\n\", \"91\\n\", \"314159265358979323846264338327950288419716939937551058209749445923078164062862089986280348253421170\\n\", \"30\", \"476640020082194381531155118436783393866726953614433851622190777875571135215042541028243752681838573\", \"22\", \"41\", \"4024190595003667858693588822821631... | In the Kingdom of AtCoder, only banknotes are used as currency. There are 10^{100}+1 kinds of banknotes, with the values of 1, 10, 10^2, 10^3, \dots, 10^{(10^{100})}. You have come shopping at a mall and are now buying a takoyaki machine with a value of N. (Takoyaki is the name of a Japanese snack.)
To make the payment... | 0 |
{"tests": "{\"inputs\": [\"6 2 4\\n1 2 1 1 0 3\\n1 6\\n3 5\\n\", \"5 3 1\\n0 1 1 1 1\\n1 5\\n2 4\\n1 3\\n\", \"6 2 3\\n1 4 1 1 0 3\\n1 6\\n3 5\\n\", \"5 3 1\\n0 1 1 1 1\\n1 5\\n2 4\\n1 2\\n\", \"5 3 0\\n0 1 1 1 1\\n1 5\\n2 4\\n1 2\\n\", \"6 2 4\\n1 2 1 1 1 5\\n1 6\\n3 5\\n\", \"5 3 1\\n0 1 2 1 1\\n1 5\\n2 4\\n1 2\\n\",... | Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the number of pairs of integers i and j, such that l ≤ i ≤ j ≤ r and the xor of the numbers ai, ai + 1, ..., aj is equal to k.
Input
The first line of the input contains i... | 0.625 |
{"tests": "{\"inputs\": [\"1\\n1\\n2\\n1 2\\n\", \"50\\n17 20 22 28 36 38 46 47 48 50 52 57 58 62 63 69 70 74 75 78 79 81 82 86 87 90 93 95 103 202 292 442 1756 1769 2208 2311 2799 2957 3483 4280 4324 4932 5109 5204 6225 6354 6561 7136 8754 9670\\n40\\n68 214 957 1649 1940 2078 2134 2716 3492 3686 4462 4559 4656 4756 4... | Vasya's bicycle chain drive consists of two parts: n stars are attached to the pedal axle, m stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation.
We know that the i-th star on the pedal axle has ai (0 < a1 < a2 < ... < an) teeth, and the j-th star on t... | 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 |
{"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\": [\"5\\n4 3 5 6 7\", \"5\\n4 3 5 10 7\", \"5\\n4 3 5 10 9\", \"5\\n4 6 5 10 9\", \"5\\n4 12 5 10 9\", \"5\\n4 12 5 0 9\", \"5\\n4 12 5 0 3\", \"5\\n1 12 5 0 3\", \"5\\n2 3 3 6 7\", \"5\\n4 3 5 10 17\", \"5\\n4 6 9 10 9\", \"5\\n6 12 5 0 9\", \"5\\n6 2 5 0 3\", \"5\\n2 12 7 0 0\", \"5\\n4 0 13 10 ... | F: Tea Party
Yun decided to hold a tea party at the company.
The shop sells $ N $ sets of bread, each containing $ A_1, A_2, A_3, \ dots, A_N $.
Yun decided to make a sandwich by combining two breads into a pair.
Yun-san is very careful, so I want to make sure that I don't have any leftover bread.
Calculate how ma... | 0 |
{"tests": "{\"inputs\": [\"A\\n\", \"G\\n\", \"C\\n\", \"T\\n\", \"C\", \"T\", \"C\", \"T\", \"G\", \"A\"], \"outputs\": [\"T\\n\", \"C\\n\", \"G\\n\", \"A\\n\", \"G\\n\", \"A\\n\", \"G\\n\", \"A\\n\", \"C\", \"T\"]}", "source": "taco"} | On the Planet AtCoder, there are four types of bases: A, C, G and T. A bonds with T, and C bonds with G.
You are given a letter b as input, which is A, C, G or T. Write a program that prints the letter representing the base that bonds with the base b.
-----Constraints-----
- b is one of the letters A, C, G and T.
--... | 0.625 |
{"tests": "{\"inputs\": [\"2 3 3\\n\", \"500000000000 500000000000 1000000000000\\n\", \"500000000000 500000000001 1000000000000\\n\", \"500000000000 499999999999 1000000000000\\n\", \"0 0 0\\n\", \"0 0 1000000000000\\n\", \"0 1000000000000 0\\n\", \"0 1000000000000 1000000000000\\n\", \"1000000000000 0 0\\n\", \"10000... | Takahashi has A cookies, and Aoki has B cookies.
Takahashi will do the following action K times:
- If Takahashi has one or more cookies, eat one of his cookies.
- Otherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.
- If they both have no cookies, do nothing.
In the end, how many cookies will Takah... | 0.125 |
{"tests": "{\"inputs\": [[\"7970521.5544\"], [\"7496314\"], [\"0\"], [\"6\"], [\"1.0000000000\"], [\"0000000000.1\"], [\"1010101\"], [\"1234567890.1234567890\"]], \"outputs\": [[[\"7000000\", \"900000\", \"70000\", \"500\", \"20\", \"1\", \".5\", \".05\", \".004\", \".0004\"]], [[\"7000000\", \"400000\", \"90000\", \"6... | # Task
You are given a decimal number `n` as a **string**. Transform it into an array of numbers (given as **strings** again), such that each number has only one nonzero digit and their sum equals n.
Each number in the output array should be written without any leading and trailing zeros.
# Input/Output
- `[inpu... | 0 |
{"tests": "{\"inputs\": [\"3\\n3 9 7\", \"4\\n1 2 1 9\", \"4\\n1 2 1 8\", \"5\\n7 2 8 8 8\", \"3\\n3 9 9\", \"3\\n3 1 9\", \"4\\n1 2 1 13\", \"3\\n1 1 9\", \"4\\n1 2 1 22\", \"3\\n0 1 9\", \"4\\n1 1 1 22\", \"3\\n0 1 5\", \"4\\n0 1 1 22\", \"4\\n0 0 1 22\", \"4\\n0 -1 1 22\", \"4\\n0 0 1 1\", \"4\\n0 0 1 2\", \"4\\n1 0... | There are N integers written on a blackboard. The i-th integer is A_i, and the greatest common divisor of these integers is 1.
Takahashi and Aoki will play a game using these integers. In this game, starting from Takahashi the two player alternately perform the following operation:
* Select one integer on the blackbo... | 0.375 |
{"tests": "{\"inputs\": [[1], [2], [3], [4], [5], [7], [8], [9], [10], [11], [13], [17], [88901], [290101]], \"outputs\": [[-1], [-1], [1], [-1], [4], [9], [1], [16], [-1], [25], [36], [64], [5428900], [429235524]]}", "source": "taco"} | In this Kata, you will be given a number `n` (`n > 0`) and your task will be to return the smallest square number `N` (`N > 0`) such that `n + N` is also a perfect square. If there is no answer, return `-1` (`nil` in Clojure, `Nothing` in Haskell, `None` in Rust).
```clojure
solve 13 = 36
; because 36 is the smalles... | 0 |
{"tests": "{\"inputs\": [\"9 23 42\", \"8 2 4\", \"3 1 2\", \"9 23 18\", \"3 2 2\", \"8 2 3\", \"9 23 23\", \"0 2 2\", \"7 2 3\", \"9 44 23\", \"0 2 1\", \"7 2 5\", \"9 44 0\", \"0 0 1\", \"7 1 5\", \"9 38 0\", \"0 1 1\", \"7 1 4\", \"1 38 0\", \"0 1 0\", \"8 1 4\", \"1 38 1\", \"0 2 0\", \"8 1 7\", \"1 31 0\", \"0 0 0... | A game is played on a strip consisting of N cells consecutively numbered from 1 to N.
Alice has her token on cell A. Borys has his token on a different cell B.
Players take turns, Alice moves first. The moving player must shift his or her token from its current cell X to the neighboring cell on the left, cell X-1, or... | 0.875 |
{"tests": "{\"inputs\": [\"6\\n3\\n1000000000 0 -1000000000\\n1\\n6\\n2\\n-1000000000 1000000000\\n2\\n1000000000 -1000000000\\n2\\n1000000000 1000000000\\n2\\n-1000000000 -1000000000\\n\", \"6\\n3\\n1000000000 0 -1000000000\\n1\\n6\\n2\\n-1000000000 1000000000\\n2\\n1000000000 -1000000000\\n2\\n1000000000 1000000100\\... | You have an array a of length n. For every positive integer x you are going to perform the following operation during the x-th second:
* Select some distinct indices i_{1}, i_{2}, …, i_{k} which are between 1 and n inclusive, and add 2^{x-1} to each corresponding position of a. Formally, a_{i_{j}} := a_{i_{j}} + 2^{... | 0.125 |
{"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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.