problem_id
stringlengths
9
127
⌀
prompt
stringlengths
22
45.7k
verification_info
stringlengths
18
19.2M
Qwen/Qwen3-32B_avg_reward
float64
0
1
Qwen/Qwen3-4B_avg_reward
float64
0
0
deepseek-ai/DeepSeek-R1-0528-Qwen3-8B_avg_reward
float64
0
1
deepseek-ai/DeepSeek-R1-0528_avg_reward
float64
0
1
⌀
prime_rl_code_10002
You are looking for a particular family photo with you and your favorite relatives Alice and Bob. Each family photo contains a line-up of $n$ people. On the photo you’re looking for, you remember that Alice, who is taller than you, was somewhere on your left from the perspective of the photographer. Also, Bob who is ta...
{"test_cases": "{\"inputs\": [\"1\\n3\\n2 1 3\\n\", \"4\\n4\\n140 157 160 193\\n5\\n15 24 38 9 30\\n6\\n36 12 24 29 23 15\\n6\\n170 230 320 180 250 210\\n\"], \"outputs\": [\"1\\n1\\n\", \"2\\n2\\n4\\n\"]}", "style": "rule"}
0.071429
0
0.5
null
prime_rl_code_10050
There is a board of m × n squares. The squares of i rows and j columns are represented by (i, j) (0 ≤ i <m, 0 ≤ j <n). When the rabbit is at (x, y), it can jump to ((x + a) mod m, (y + b) mod n) or ((x + c) mod m, (y + d) mod n) it can. Now the rabbit is at (0, 0). If you can't go back to the square that once jumped,...
{"test_cases": "{\"inputs\": [\"2 6 2 2 2 4\", \"3 6 2 2 2 4\", \"4 6 2 2 2 8\", \"4 2 2 2 2 8\", \"4 2 1 2 2 8\", \"1 2 1 2 3 8\", \"1 5 2 0 4 2\", \"3 6 2 2 2 7\", \"3 7 2 2 2 4\", \"4 3 0 2 1 8\", \"2 5 1 2 0 2\", \"2 8 0 2 3 15\", \"2 14 0 2 2 4\", \"2 27 0 2 2 4\", \"2 13 0 4 3 15\", \"2 27 0 1 1 3\", \"2 16 0 6 1...
0.5
0
0
null
prime_rl_code_10057
Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications generated by those applications (maybe Loki put a curse on it so he can't). q events are abou...
{"test_cases": "{\"inputs\": [\"4 6\\n1 2\\n1 4\\n1 2\\n3 3\\n1 3\\n1 3\\n\", \"3 4\\n1 3\\n1 1\\n1 2\\n2 3\\n\", \"300000 1\\n1 300000\\n\", \"10 85\\n2 2\\n1 10\\n1 1\\n2 6\\n1 2\\n1 4\\n1 7\\n2 1\\n1 1\\n3 3\\n1 9\\n1 6\\n1 8\\n1 10\\n3 8\\n2 8\\n1 6\\n1 3\\n1 9\\n1 6\\n1 3\\n1 8\\n1 1\\n1 6\\n1 10\\n2 1\\n2 10\\n1 ...
0.6
0
0.25
null
prime_rl_code_1007
After solving Reese's first problem Harold thought he had proven himself. But Reese wasn't convinced so he gave Harold another query. He told Harold to find the nth term of the sequence given by the equation. a[n]=( f[n] + g[n] ) % n where, f[n] = f[n-1] + x(n) ; where x(n) = smallest prime factor of n. and g[n] =...
{"test_cases": "{\"inputs\": [\"1\\n3\\n\\n\\nSAMPLE\", \"400\\n44\\n18470\\n6337\\n26503\\n19172\\n15727\\n11481\\n29361\\n26965\\n24467\\n5708\\n28148\\n23284\\n16830\\n9964\\n494\\n2998\\n11945\\n4830\\n5439\\n32394\\n14607\\n3905\\n156\\n295\\n12385\\n17424\\n18719\\n19721\\n19898\\n5450\\n21729\\n14774\\n11541\\n1...
0
0
0.25
null
prime_rl_code_1009
Some chefs go for a tour lasting N days. They take packages of bread for food. Each package has K pieces of breads. On the i^th day, they eat Ai pieces of bread. Unfortunately, chefs are very lazy people, and they always forget to close the package of breads, so each day the last piece of bread becomes exposed to mold ...
{"test_cases": "{\"inputs\": [\"3\\n3 4\\n3 1 2\\n1 1\\n1\\n2 4\\n8 8\", \"3\\n3 4\\n3 1 2\\n1 1\\n1\\n2 4\\n8 1\", \"3\\n3 4\\n3 1 2\\n1 1\\n1\\n2 2\\n8 1\", \"3\\n3 4\\n6 1 2\\n1 1\\n1\\n2 2\\n8 1\", \"3\\n3 4\\n6 1 2\\n1 1\\n1\\n2 2\\n10 1\", \"3\\n3 4\\n3 1 0\\n1 1\\n1\\n2 4\\n8 8\", \"3\\n3 4\\n3 1 4\\n1 1\\n1\\n2...
0.25
0
0.333333
null
prime_rl_code_1012
Digital collectible card games have become very popular recently. So Vova decided to try one of these. Vova has n cards in his collection. Each of these cards is characterised by its power pi, magic number ci and level li. Vova wants to build a deck with total power not less than k, but magic numbers may not allow him...
{"test_cases": "{\"inputs\": [\"5 8\\n5 5 1\\n1 5 4\\n4 6 3\\n1 12 4\\n3 12 1\\n\", \"3 7\\n4 4 1\\n5 8 2\\n5 3 3\\n\", \"5 8\\n5 1 5\\n1 1 4\\n4 1 3\\n1 1 4\\n3 1 1\\n\", \"30 100\\n2 16 20\\n12 125 8\\n11 13 23\\n20 58 7\\n10 157 29\\n17 58 6\\n1 169 29\\n17 33 26\\n1 71 1\\n4 94 16\\n7 141 6\\n8 168 23\\n3 161 5\\n1...
0.5
0
0
null
prime_rl_code_10166
Oliver and Nova are true lovers. Inspite of knowing that Nova will die Oliver married her at the lake where they met. But they had a conflict about even and odd numbers. Nova likes the odd numbers and Oliver prefers even. One day they went to a fair where Oliver bought some square shaped marshmallows and Nova bought so...
{"test_cases": "{\"inputs\": [\"5\\n1\\n2\\n3\\n4\\n5\\n\", \"5\\n6\\n7\\n8\\n9\\n10\\n\", \"3\\n11\\n12\\n13\\n\", \"5\\n14\\n15\\n16\\n17\\n18\\n\", \"3\\n19\\n20\\n21\\n\", \"4\\n1\\n1845271\\n500000\\n750000\\n\", \"3\\n2\\n1845270\\n1000000\\n\", \"2\\n1845271\\n1845270\\n\", \"3\\n1\\n2\\n3\\n\", \"3\\n1845270\\n...
0.1
0
0
null
prime_rl_code_10168
You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met: * There are y elements in F, and all of them are integer numbers; * <image>. You have to count the number of pairwise distinct arrays that are y-factorizations of x. Two array...
{"test_cases": "{\"inputs\": [\"2\\n6 3\\n4 2\\n\", \"1\\n65536 1000000\\n\", \"1\\n524288 1000000\\n\", \"1\\n5612 11399\\n\", \"1\\n36157 1000000\\n\", \"1\\n2904 11399\\n\", \"2\\n6 3\\n4 4\\n\", \"1\\n2904 8217\\n\", \"2\\n6 3\\n4 3\\n\", \"1\\n1754 8217\\n\", \"2\\n6 3\\n4 5\\n\", \"1\\n397 8217\\n\", \"2\\n7 3\\n...
0.142857
0
1
null
prime_rl_code_10203
Snuke, who loves animals, built a zoo. There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered...
{"test_cases": "{\"inputs\": [\"10\\noxooxoxoox\", \"6\\nooxoox\", \"3\\noox\", \"3\\nxoo\", \"6\\nxooxoo\", \"10\\nxooxoxooxo\", \"10\\nxxooxoxooo\", \"10\\noxooooxxox\", \"10\\nxoxxooooxo\", \"10\\noooxoxooxx\", \"10\\noxooooxxxo\", \"10\\noxoooxxoox\", \"10\\noxooooxoxx\", \"10\\noxoooxooxx\", \"10\\nxxoxxooooo\", \...
0.8
0
0.5
null
prime_rl_code_10206
You are given an integer N. Let A be an N \times N grid such that A_{i, j} = i + N\cdot(j-1) for 1 ≤ i, j ≤ N. For example, if N = 4 the grid looks like: You start at the top left corner of the grid, i.e, cell (1, 1). You would like to reach the bottom-right corner, cell (N, N). To do so, whenever you are at cell (i, ...
{"test_cases": "{\"inputs\": [\"5\\n5 0\\n6 1\\n7 0\\n8 1\\n9 0\\n\", \"5\\n11 0\\n12 1\\n13 0\\n14 1\\n15 0\\n\", \"5\\n16 1\\n17 0\\n18 1\\n19 0\\n20 1\\n\", \"1\\n25 0\\n\", \"3\\n2 1\\n3 0\\n3 1\\n\", \"4\\n4 0\\n4 1\\n5 0\\n5 1\\n\", \"3\\n1000000000 0\\n1000000000 1\\n999999999 0\\n\"], \"outputs\": [\"No\\nYes\\...
0
0
1
null
prime_rl_code_10214
Given an integer $n$, find each $\boldsymbol{x}$ such that: $0\leq x\leq n$ $n+x=n\oplus x$ where $\oplus$ denotes the bitwise XOR operator. Return the number of $\boldsymbol{x}$'s satisfying the criteria. Example $n=4$ There are four values that meet the criteria: $4+0=4\oplus0=4$ $4+1=4\oplus1=5$ $4+2=4\o...
{"test_cases": "{\"inputs\": [\" 3\\n\", \" 7\\n\", \" 1\\n\", \" 100\\n\", \" 1000000000000000\\n\", \" 999999999999999\\n\"], \"outputs\": [\"1\", \"1\", \"1\", \"16\", \"1073741824\", \"65536\"]}", "style": "rule"}
0.375
0
0
null
prime_rl_code_10225
There is a string s of length 3 or greater. No two neighboring characters in s are equal. Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first: * Remove one of the characters in s, excluding both ends. However, a character cannot b...
{"test_cases": "{\"inputs\": [\"abc\", \"aba\", \"abcab\", \"abb\", \"aaa\", \"baa\", \"bacba\", \"bba\", \"badba\", \"aa`\", \"aab\", \"cadba\", \"`aa\", \"bca\", \"dadba\", \"`ab\", \"acb\", \"ddaba\", \"``b\", \"aca\", \"dd`ba\", \"`_b\", \"bb`\", \"dd`b`\", \"b_`\", \"`bb\", \"ddb``\", \"c_`\", \"`cb\", \"ddba`\", ...
0.5
0
0.5
null
prime_rl_code_10230
Having just moved to Transylvania, one of the first orders of business is to get a transit card for the public transportation. The transit card can be charged with intervals of dates. For each such interval, the first few days come at a pretty high price per day, the next few days come at a slightly lower price per day...
{"test_cases": "{\"inputs\": [\"3\\n20 15 10\\n7 7\\n30 0\\n\", \"3\\n20 15 10\\n7 7\\n30 2\\n5 5\\n15 25\\n\"], \"outputs\": [\"405\\n\", \"345\\n\"]}", "style": "rule"}
0.666667
0
1
null
prime_rl_code_1026
Read problems statements in Mandarin Chinese and Russian as well. You are given a function f which is defined as : Your task is to find the value of where M is given in input. ------ Input Format ------ First line contains T, the number of test cases. First line of each test case contain 3 space separated int...
{"test_cases": "{\"inputs\": [\"2\\n5 114 1\\n2\\n50 3874 3\\n31\\n17\\n21\"], \"outputs\": [\"72\\n3718\\n624\\n1144\"]}", "style": "rule"}
0.4
0
0.666667
null
prime_rl_code_1030
Input The input is given from Standard Input in the following format: > $N \ K$ Output * Please output the $K$-th triangle area. * Print a floating number denoting the answer. The relative or absolute error of your answer should not be higher than $10^{−9}$. Constraints * $3 \le N \le 200,000$ * $1 \le K \le \...
{"test_cases": "{\"inputs\": [\"4 4\", \"6 6\", \"7 4\", \"11 1\", \"5 6\", \"6 15\", \"8 4\", \"7 12\", \"11 14\", \"13 11\", \"17 11\", \"12 4\", \"9 1\", \"5 1\", \"7 23\", \"8 14\", \"6 20\", \"20 11\", \"29 7\", \"21 4\", \"10 1\", \"10 23\", \"17 18\", \"53 7\", \"15 1\", \"13 14\", \"55 7\", \"96 7\", \"34 2\", ...
0
0
0.2
null
prime_rl_code_10302
The tablet interface technology, which can be operated by touching the screen with a finger, has also been applied in the field of games, and various types of games with new operability have been created. The game currently being developed by AZ is one of them. The requirements for this software (game) are as follows....
{"test_cases": "{\"inputs\": [\"3 3\\nR G B\\nG G G\\nG B B\\n2 4\\nR G\\nG G\\nR B\\nB R\\n4 3\\nG G B R\\nG R R G\\nB G G R\\n0 0\", \"3 3\\nR G B\\nG G G\\nG B B\\n2 4\\nR G\\nG G\\nR B\\nB R\\n4 3\\nF G B R\\nG R R G\\nB G G R\\n0 0\", \"3 3\\nR G B\\nG G G\\nG B B\\n2 4\\nS G\\nG G\\nR B\\nB R\\n4 3\\nG G B R\\nG ...
0.933333
0
0
null
prime_rl_code_10308
Images by John Fowler, Carol Highsmith, and Richard Woodland You have decided to spend a day of your trip to Rapid City taking photographs of the South Dakota Badlands, which are renowned for their spectacular and unusual land formations. You are an amateur photographer, yet very particular about lighting conditions. ...
{"test_cases": "{\n \"inputs\": [\n \"2 10\\n0 15\\n5 20\\n\",\n \"2 10\\n1 15\\n0 20\\n\",\n \"2 10\\n5 30\\n10 20\\n\"\n ],\n \"outputs\": [\n \"yes\\n\",\n \"no\\n\",\n \"yes\\n\"\n ]\n}", "style": "rule"}
0.285714
0
0.428571
null
prime_rl_code_1031
David is writing an article for the Bulletin of the Association of Proof Completions. In his article, he proves several theorems. For every theorem, David came up with a proof. Since David is a very eager student, he even came up with multiple proofs for some of the theorems. As usual, a proof for a theorem may depend ...
{"test_cases": "{\"inputs\": [\"2\\n2\\n10 0\\n3 1 1\\n1\\n4 1 0\\n\", \"4\\n2\\n1 2 1 3\\n5 1 2\\n1\\n2 0\\n1\\n0 0\\n2\\n2 0\\n1 1 1\\n\"], \"outputs\": [\"10\\n\", \"4\\n\"]}", "style": "rule"}
0.083333
0
1
null
prime_rl_code_10346
Title: Obsession with Robots Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: The whole world got obsessed with robots,and to keep pace with the progress, great Berland's programmer Draude decided to build his own robot. He was working hard at the robot. He taught it to walk the shortest path fr...
{"test_cases": "{\"inputs\": [\"LLUUUR\", \"RRUULLDD\", \"L\", \"R\", \"R\", \"RR\", \"DL\", \"LD\", \"RUL\", \"ULD\", \"DDR\", \"RRDD\", \"RRLR\", \"RRDL\", \"LRUD\", \"RDRLL\", \"DRDRD\", \"ULURL\", \"LUUDU\", \"RDLUR\", \"DLDLDDRR\", \"RDRDDD\", \"UULLDLUR\", \"LULU\", \"LLDDLDLLDDDLLLDLLLLLUU\", \"LLDDLDLLDDDLLLDLL...
0.8
0
0.666667
null
prime_rl_code_10372
Your fancy debugger will not help you in this matter. There are many ways in which code can produce different behavior between debug and release builds, and when this happens, one may have to resort to more primitive forms of debugging. So you and your printf are now on your own in the search for a line of code that ...
{"test_cases": "{\"inputs\": [\"1 100 20\\n\", \"10 10 1\\n\", \"16 1 10\\n\"], \"outputs\": [\"0\\n\", \"19\\n\", \"44\\n\"]}", "style": "rule"}
0.875
0
0.4
null
prime_rl_code_10400
«Next please», — the princess called and cast an estimating glance at the next groom. The princess intends to choose the most worthy groom, this is, the richest one. Whenever she sees a groom who is more rich than each of the previous ones, she says a measured «Oh...». Whenever the groom is richer than all previous on...
{"test_cases": "{\"inputs\": [\"10 2 3\\n\", \"5 0 0\\n\", \"100 11 13\\n\", \"100 2 0\\n\", \"100 1 0\\n\", \"100 3 0\\n\", \"4 1 2\\n\", \"10 7 0\\n\", \"4 1 0\\n\", \"4 3 0\\n\", \"4 2 0\\n\", \"7 4 0\\n\", \"15 10 0\\n\", \"2 1 0\\n\", \"2 0 0\\n\", \"5 2 2\\n\", \"16 0 15\\n\", \"4 2 1\\n\", \"10 5 0\\n\", \"100 0...
0.384615
0
0
null
prime_rl_code_10410
You are an adventurer currently journeying inside an evil temple. After defeating a couple of weak zombies, you arrived at a square room consisting of tiles forming an n × n grid. The rows are numbered 1 through n from top to bottom, and the columns are numbered 1 through n from left to right. At the far side of the ro...
{"test_cases": "{\n \"inputs\": [\n \"3\\n.E.\\nE.E\\n.E.\\n\",\n \"3\\nEEE\\nE..\\nE.E\\n\",\n \"5\\nEE.EE\\nE.EE.\\nE...E\\n.EE.E\\nEE.EE\\n\",\n \"3\\nEEE\\nEEE\\n...\\n\",\n \"3\\n.EE\\n.EE\\n.EE\\n\",\n \"5\\nEE.EE\\nEE..E\\nEEE..\\nEE..E\\nEE.EE\\n\",\n \"1\\nE\\n\",\n \"8\\nE.EEE..E\\nEE...
1
0
1
null
prime_rl_code_10417
Let's denote a m-free matrix as a binary (that is, consisting of only 1's and 0's) matrix such that every square submatrix of size m × m of this matrix contains at least one zero. Consider the following problem: You are given two integers n and m. You have to construct an m-free square matrix of size n × n such that...
{"test_cases": "{\"inputs\": [\"3\\n21\\n0\\n1\\n\", \"1\\n28\\n\", \"1\\n56\\n\", \"1\\n14\\n\", \"1\\n9\\n\", \"1\\n2925\\n\", \"1\\n5704\\n\", \"1\\n999944\\n\", \"1\\n1980\\n\", \"1\\n144\\n\", \"1\\n297540\\n\", \"1\\n25\\n\", \"1\\n4860\\n\", \"1\\n2\\n\", \"1\\n36\\n\", \"1\\n6\\n\", \"1\\n4104\\n\", \"1\\n16\\n...
0
0
0.125
null
prime_rl_code_10433
Problem There is an arithmetic progression A with the number of terms N, the first term a, and the tolerance d. Since M statements that rewrite the sequence are given in the following format, find the value of the K item of the sequence A when the sequence A is rewritten M times in the given order. * The i-th stateme...
{"test_cases": "{\"inputs\": [\"5\\n1 1\\n3\\n1 2 3\\n2 3 5\\n0 1 5\\n1\", \"4\\n2 0\\n3\\n0 1 2\\n1 1 4\\n2 2 4\\n3\", \"5\\n0 2\\n3\\n0 2 3\\n2 3 5\\n0 1 5\\n1\", \"5\\n1 1\\n3\\n1 2 3\\n2 6 5\\n0 1 5\\n1\", \"5\\n1 0\\n3\\n1 2 3\\n2 0 5\\n0 1 5\\n1\", \"5\\n0 1\\n3\\n0 3 3\\n2 3 5\\n0 0 10\\n1\", \"4\\n2 0\\n1\\n1 -...
0.625
0
0.333333
null
prime_rl_code_10434
A positive integer number n is written on a blackboard. It consists of not more than 105 digits. You have to transform it into a beautiful number by erasing some of the digits, and you want to erase as few digits as possible. The number is called beautiful if it consists of at least one digit, doesn't have leading zer...
{"test_cases": "{\"inputs\": [\"10\\n\", \"11\\n\", \"1033\\n\", \"100020001\\n\", \"100000000000000000222\\n\", \"8008\\n\", \"10000555\\n\", \"20020201\\n\", \"7\\n\", \"10001\\n\", \"2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002\\n\", \"8059\\n\", \"100000001\\n...
0.222222
0
0
null
prime_rl_code_10478
Title: Keyboard Time Limit: None seconds Memory Limit: None megabytes Problem Description: Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way: Unfortunately Mole is blind, so sometimes it is problem for him to put his hands accurately....
{"test_cases": "{\"inputs\": [\"R\\ns;;upimrrfod;pbr\", \"R\\nwertyuiop;lkjhgfdsxcvbnm,.\", \"L\\nzxcvbnm,kjhgfdsaqwertyuio\", \"R\\nbubbuduppudup\", \"L\\ngggggggggggggggggggggggggggggggggggggggggg\", \"R\\ngggggggggggggggggggggggggggggggggggggggggg\", \"L\\ngggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg...
0.619048
0
0.571429
null
prime_rl_code_10500
Gerda is travelling to the palace of the Snow Queen. The road network consists of n intersections and m bidirectional roads. Roads are numbered from 1 to m. Snow Queen put a powerful spell on the roads to change the weather conditions there. Now, if Gerda steps on the road i at the moment of time less or equal to i, s...
{"test_cases": "{\"inputs\": [\"5 4 6\\n1 2\\n2 3\\n3 4\\n3 5\\n1 3 2 4\\n1 3 2 4\\n1 4 4 5\\n1 4 4 1\\n2 3 1 4\\n2 2 2 3\\n\", \"5 4 6\\n1 2\\n2 3\\n3 4\\n3 5\\n1 3 2 4\\n1 3 2 4\\n1 4 4 5\\n1 4 4 1\\n2 3 1 4\\n2 1 2 3\\n\", \"5 4 6\\n1 2\\n1 3\\n3 4\\n3 5\\n1 3 2 4\\n1 3 2 4\\n1 4 4 5\\n1 4 4 1\\n2 3 1 4\\n2 1 2 3\\n...
0.25
0
0
null
prime_rl_code_10503
The legendary Farmer John is throwing a huge party, and animals from all over the world are hanging out at his house. His guests are hungry, so he instructs his cow Bessie to bring out the snacks! Moo! There are $n$ snacks flavors, numbered with integers $1, 2, \ldots, n$. Bessie has $n$ snacks, one snack of each flav...
{"test_cases": "{\n \"inputs\": [\n \"5 4\\n1 2\\n4 3\\n1 4\\n3 4\\n\",\n \"6 5\\n2 3\\n2 1\\n3 4\\n6 5\\n4 5\\n\",\n \"2 1\\n1 2\\n\",\n \"100000 12\\n8 7\\n1 9\\n5 4\\n11 12\\n7 8\\n3 4\\n3 5\\n12 15\\n15 13\\n13 14\\n7 8\\n11 14\\n\",\n \"10 15\\n1 2\\n2 3\\n3 4\\n4 5\\n5 1\\n1 6\\n2 7\\n3 8\\n4 9\\n...
0.666667
0
1
null
prime_rl_code_10505
Let f(x) = a0 + a1x + a2x2 + ... + adxd be the function where each ai (0 ≤ i ≤ d) is a constant integer (and ad is non-zero) and x is a variable. Your task is to write a program that finds all complex integer solutions of the equation f(x) = 0 for a given f(x). Here, by complex integers, we mean complex numbers whose r...
{"test_cases": "{\"inputs\": [\"4\\n-2 0 0 0 2\", \"8\\n0 0 25 15 17 -10 1 -1 1\"], \"outputs\": [\"4\\n-1 -i i 1\", \"5\\n-1-2i -1+2i 0 2-i 2+i\"]}", "style": "rule"}
0.5
0
0
null
prime_rl_code_10512
Alice and Bob play a game. The game consists of several sets, and each set consists of several rounds. Each round is won either by Alice or by Bob, and the set ends when one of the players has won $x$ rounds in a row. For example, if Bob won five rounds in a row and $x = 2$, then two sets ends. You know that Alice and...
{"test_cases": "{\"inputs\": [\"6\\n11?000\\n\", \"5\\n01?01\\n\", \"12\\n???1??????1?\\n\", \"1\\n0\\n\", \"1\\n1\\n\", \"1\\n?\\n\", \"1\\n0\\n\", \"1\\n1\\n\", \"1\\n?\\n\", \"5\\n10?10\\n\", \"6\\n01?000\\n\", \"5\\n10?00\\n\", \"5\\n01?00\\n\", \"12\\n?1?1????????\\n\", \"6\\n000?11\\n\", \"6\\n00?011\\n\", \"5\\n...
0.333333
0
1
null
prime_rl_code_10533
In Fire City, there are n intersections and m one-way roads. The i-th road goes from intersection a_i to b_i and has length l_i miles. There are q cars that may only drive along those roads. The i-th car starts at intersection v_i and has an odometer that begins at s_i, increments for each mile driven, and resets to ...
{"test_cases": "{\"inputs\": [\"4 5\\n1 2 1\\n2 3 1\\n3 1 2\\n1 4 1\\n4 3 2\\n2\\n1 2 4\\n4 3 5\\n\", \"4 4\\n1 2 1\\n2 3 1\\n3 1 2\\n1 4 3\\n3\\n1 1 3\\n1 2 4\\n4 0 1\\n\", \"2 1\\n2 1 1\\n1\\n2 1 2\\n\", \"4 5\\n1 2 1\\n2 3 1\\n3 1 2\\n1 4 1\\n4 3 2\\n2\\n1 2 4\\n3 3 5\\n\", \"3 1\\n2 1 1\\n1\\n2 1 2\\n\", \"3 1\\n2 ...
1
0
0
null
prime_rl_code_10537
Given integers c_{0}, c_{1}, …, c_{k-1} we can define the cost of a number 0 ≤ x < 2^{k} as p(x) = ∑_{i=0}^{k-1} \left( \left⌊ \frac{x}{2^{i}} \right⌋ mod 2 \right) ⋅ c_{i}. In other words, the cost of number x is the sum of c_{i} over the bits of x which are equal to one. Let's define the cost of array a of length n ...
{"test_cases": "{\"inputs\": [\"3 3\\n2 2\\n3 4\\n4 6\\n1 10 100\\n\", \"4 3\\n3 3\\n5 5\\n6 6\\n1 1\\n5 2 7\\n\", \"10 5\\n24 25\\n19 25\\n29 30\\n10 10\\n17 18\\n3 5\\n6 6\\n27 28\\n24 25\\n18 19\\n721346627811 595743484034 307306176471 985410838490 311769045406\\n\", \"5 5\\n21 22\\n10 25\\n5 6\\n20 25\\n15 22\\n220...
0.090909
0
0
null
prime_rl_code_10540
Title: Two Permutations Time Limit: None seconds Memory Limit: None megabytes Problem Description: Rubik is very keen on number permutations. A permutation *a* with length *n* is a sequence, consisting of *n* different numbers from 1 to *n*. Element number *i* (1<=≤<=*i*<=≤<=*n*) of this permutation will be denote...
{"test_cases": "{\"inputs\": [\"1 1\\n1\\n1\", \"1 2\\n1\\n2 1\", \"3 3\\n2 3 1\\n1 2 3\", \"2 4\\n2 1\\n1 4 2 3\", \"2 5\\n1 2\\n2 5 1 3 4\", \"1 6\\n1\\n3 4 1 6 5 2\", \"3 7\\n1 2 3\\n1 2 3 4 5 7 6\", \"2 8\\n2 1\\n8 3 1 4 2 7 5 6\", \"5 9\\n3 5 2 4 1\\n1 6 8 9 4 2 7 3 5\", \"2 10\\n1 2\\n5 7 8 3 1 10 2 4 9 6\"], \"o...
1
0
1
null
prime_rl_code_10541
Title: Xor-MST Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a complete undirected graph with *n* vertices. A number *a**i* is assigned to each vertex, and the weight of an edge between vertices *i* and *j* is equal to *a**i*<=*xor*<=*a**j*. Calculate the weight of the min...
{"test_cases": "{\"inputs\": [\"5\\n1 2 3 4 5\", \"4\\n1 2 3 4\", \"1\\n1\"], \"outputs\": [\"8\", \"8\", \"0\"]}", "style": "rule"}
1
0
0.5
null
prime_rl_code_10542
Polycarpus develops an interesting theory about the interrelation of arithmetic progressions with just everything in the world. His current idea is that the population of the capital of Berland changes over time like an arithmetic progression. Well, or like multiple arithmetic progressions. Polycarpus believes that if...
{"test_cases": "{\n \"inputs\": [\n \"9\\n8 6 4 2 1 4 7 10 2\\n\",\n \"9\\n-1 6 -1 2 -1 4 7 -1 2\\n\",\n \"5\\n-1 -1 -1 -1 -1\\n\",\n \"7\\n-1 -1 4 5 1 2 3\\n\",\n \"1\\n1\\n\",\n \"1\\n65\\n\",\n \"1\\n1000000000\\n\",\n \"1\\n-1\\n\",\n \"2\\n1000000000 1000000000\\n\",\n \"2\\n10000000...
0
0
0.5
null
prime_rl_code_10551
Little Vasya likes very much to play with sets consisting of positive integers. To make the game more interesting, Vasya chose n non-empty sets in such a way, that no two of them have common elements. One day he wanted to show his friends just how interesting playing with numbers is. For that he wrote out all possible...
{"test_cases": "{\"inputs\": [\"3\\n2 1 2\\n10 1 90 80 70 60 50 40 30 20 10\\n10 2 10 20 30 40 50 60 70 80 90\\n\", \"2\\n2 1 2\\n\", \"2\\n10 1 2 3 4 5 6 7 8 9 10\\n\", \"4\\n4 56 44 53 43\\n3 109 44 43\\n3 109 56 53\\n3 43 62 44\\n3 62 56 53\\n2 109 62\\n\", \"10\\n2 32 157\\n2 86 157\\n2 86 32\\n2 154 157\\n2 32 154...
0.142857
0
0
null
prime_rl_code_10569
You are given a directed graph of $n$ vertices and $m$ edges. Vertices are numbered from $1$ to $n$. There is a token in vertex $1$. The following actions are allowed: Token movement. To move the token from vertex $u$ to vertex $v$ if there is an edge $u \to v$ in the graph. This action takes $1$ second. Graph tran...
{"test_cases": "{\"inputs\": [\"4 4\\n1 2\\n2 3\\n3 4\\n4 1\\n\", \"4 3\\n2 1\\n2 3\\n4 3\\n\", \"10 20\\n2 1\\n7 9\\n10 2\\n4 9\\n3 1\\n6 4\\n3 6\\n2 9\\n5 2\\n3 9\\n6 8\\n8 7\\n10 4\\n7 4\\n8 5\\n3 4\\n6 7\\n2 6\\n10 6\\n3 8\\n\", \"10 9\\n8 5\\n3 5\\n3 7\\n10 6\\n4 6\\n8 1\\n9 2\\n4 2\\n9 7\\n\", \"50 49\\n1 3\\n6 4...
0.095238
0
1
null
prime_rl_code_10574
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...
{"test_cases": "{\"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\", \"bbbbbbbbbbbb...
1
0
0.2
null
prime_rl_code_10582
Title: Rectangle Puzzle II Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a rectangle grid. That grid's size is *n*<=×<=*m*. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates — a pair of integers (*x*,<=*y*) (0<=≤<=*x*<=≤<=*n*,<...
{"test_cases": "{\"inputs\": [\"9 9 5 5 2 1\", \"100 100 52 50 46 56\", \"100 100 16 60 42 75\", \"100 100 28 22 47 50\", \"100 100 44 36 96 21\", \"100 100 56 46 1 47\", \"100 100 20 53 6 22\", \"100 100 32 63 2 41\", \"100 100 48 73 63 16\", \"100 100 13 59 14 20\", \"36830763 28058366 30827357 20792295 11047103 2067...
0.8
0
0.666667
null
prime_rl_code_1059
Monocarp has arranged $n$ colored marbles in a row. The color of the $i$-th marble is $a_i$. Monocarp likes ordered things, so he wants to rearrange marbles in such a way that all marbles of the same color form a contiguos segment (and there is only one such segment for each color). In other words, Monocarp wants to ...
{"test_cases": "{\"inputs\": [\"7\\n3 4 2 3 4 2 2\\n\", \"5\\n20 1 14 10 2\\n\", \"13\\n5 5 4 4 3 5 7 6 5 4 4 6 5\\n\", \"10\\n13 13 13 13 13 13 13 9 9 13\\n\", \"100\\n11 16 16 11 16 11 16 16 11 16 16 16 16 16 16 16 16 16 11 16 16 16 16 16 16 11 16 11 16 11 16 16 16 11 5 16 16 11 16 16 16 16 16 11 16 11 5 16 16 16 16 ...
0.5
0
0.25
null
prime_rl_code_10592
Alice and Bob are playing chess on a huge chessboard with dimensions n × n. Alice has a single piece left — a queen, located at (a_x, a_y), while Bob has only the king standing at (b_x, b_y). Alice thinks that as her queen is dominating the chessboard, victory is hers. But Bob has made a devious plan to seize the vic...
{"test_cases": "{\"inputs\": [\"8\\n4 4\\n2 3\\n1 6\\n\", \"8\\n3 5\\n1 2\\n6 1\\n\", \"8\\n4 4\\n1 3\\n3 1\\n\", \"4\\n1 2\\n4 3\\n4 4\\n\", \"1000\\n114 372\\n112 350\\n113 352\\n\", \"4\\n2 3\\n3 1\\n4 2\\n\", \"100\\n12 47\\n24 26\\n3 4\\n\", \"20\\n11 10\\n12 18\\n18 11\\n\", \"5\\n3 3\\n4 1\\n5 2\\n\", \"50\\n2 3...
0.25
0
0.75
null
prime_rl_code_10595
Example Input 3 2 R1 Output 3 1 2 4 5 6 7 8 9 Write Python code to solve the problem. Present the code in ```python Your code ``` at the end.
{"test_cases": "{\"inputs\": [\"2 2\\nR1\", \"1 2\\nR1\", \"5 2\\nR1\", \"4 2\\nR1\", \"8 2\\nR1\", \"7 2\\nR1\", \"3 2\\nR2\", \"11 2\\nR1\", \"3 2\\nR3\", \"11 2\\nR2\", \"20 2\\nR1\", \"5 2\\nR3\", \"7 2\\nR2\", \"22 2\\nR1\", \"9 2\\nR2\", \"30 2\\nR1\", \"9 2\\nR1\", \"36 2\\nR1\", \"5 2\\nR2\", \"6 2\\nR2\", \"31...
0.4
0
0
null
prime_rl_code_10620
In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at position i it...
{"test_cases": "{\"inputs\": [\"5\\n&gt;&gt;&gt;&gt;&gt;\\n\", \"4\\n&lt;&lt;&gt;&lt;\\n\", \"4\\n&gt;&gt;&lt;&lt;\\n\", \"4\\n<><>\\n\", \"5\\n<><>>\\n\", \"5\\n><>>>\\n\", \"100\\n<<<<<<<<<<<<<<<<<<<<<<<<>><<>><<<<<>><>><<<>><><<>>><<>>><<<<><><><<><<<<><>>>>>>>>>>>>>>>>>>>>>>>>>\\n\", \"8\\n<<>><<>>\\n\", \"4\\n<><<...
0.181818
0
0.6
null
prime_rl_code_10645
Title: Powers of Two Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Find the number of pairs of indexes *i*,<=*j* (*i*<=&lt;<=*j*) that *a**i*<=+<=*a**j* is a power of 2 (i. e. some integer *x* exists so that *a**i*<=+<=*a**j*<==<=2*x...
{"test_cases": "{\"inputs\": [\"4\\n7 3 2 1\", \"3\\n1 1 1\", \"1\\n1000000000\", \"10\\n2827343 1373647 96204862 723505 796619138 71550121 799843967 5561265 402690754 446173607\", \"10\\n6 6 7 3 9 14 15 7 2 2\", \"100\\n3 6 12 1 16 4 9 5 4 4 5 8 12 4 6 14 5 1 2 2 2 1 7 1 9 10 6 13 7 8 3 11 8 11 7 5 15 6 14 10 4 2 10 9...
0.111111
0
0.5
null
prime_rl_code_10649
Title: Restoration of the Permutation Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Let *A*<==<={*a*1,<=*a*2,<=...,<=*a**n*} be any permutation of the first *n* natural numbers {1,<=2,<=...,<=*n*}. You are given a positive integer *k* and another sequence *B*<==<={*b*1,<=*b*2,<=...,<=*b**n*}...
{"test_cases": "{\"inputs\": [\"5 2\\n1 2 1 0 0\", \"4 2\\n1 0 0 0\", \"10 3\\n4 2 4 2 1 0 1 0 0 0\", \"15 3\\n4 2 7 5 1 1 1 0 0 0 0 0 0 0 0\", \"5 1\\n1 3 2 0 0\", \"8 3\\n2 0 2 2 1 0 0 0\", \"1 1\\n0\", \"10 10\\n0 0 0 0 0 0 0 0 0 0\", \"10 9\\n1 0 0 0 0 0 0 0 0 0\", \"10 1\\n9 8 7 6 5 4 3 2 1 0\", \"10 1\\n7 6 5 4 3...
1
0
0
null
prime_rl_code_10687
You are given a [directed graph](https://en.wikipedia.org/wiki/Directed_graph) consisting of n vertices and m edges (each edge is directed, so it can be traversed in only one direction). You are allowed to remove at most one edge from it. Can you make this graph [acyclic](https://en.wikipedia.org/wiki/Directed_acyclic...
{"test_cases": "{\"inputs\": [\"3 4\\n1 2\\n2 3\\n3 2\\n3 1\\n\", \"5 6\\n1 2\\n2 3\\n3 2\\n3 1\\n2 1\\n4 5\\n\", \"3 4\\n1 2\\n2 1\\n1 3\\n3 1\\n\", \"4 6\\n1 2\\n2 4\\n2 3\\n3 1\\n4 3\\n3 2\\n\", \"4 5\\n1 2\\n2 4\\n2 3\\n3 1\\n4 3\\n\", \"9 12\\n1 2\\n2 3\\n2 4\\n4 5\\n3 5\\n5 6\\n6 7\\n6 8\\n7 9\\n8 9\\n9 1\\n3 6\\...
0.6
0
0.6
null
prime_rl_code_10727
Pandey needs your help. As you know, he is on the quest to save the princess. After traveling for a number of days, he has finally reached the palace, but one last battle remains to be fought. However he has only one unit of energy left in him. To win the battle, he needs all the energy he can get. So he is searching f...
{"test_cases": "{\"inputs\": [\"2\\n3\\nN\\n- 2\\nN\\n3\\n- 1\\n* 4\\n/ 2\\n\\n\\nSAMPLE\", \"10\\n48\\n+ 3\\n+ 2\\n+ 4\\n- 3\\n- 4\\n- 2\\n+ 3\\n+ 2\\n- 2\\nN\\nN\\n+ 3\\n+ 4\\nN\\n- 4\\n+ 5\\nN\\n- 3\\nN\\n- 5\\n+ 5\\n- 3\\nN\\n- 1\\n- 3\\nN\\n- 2\\nN\\n- 3\\n- 2\\n+ 1\\n* 1\\n+ 5\\n- 4\\n* 1\\n* 4\\n+ 4\\nN\\n+ 2\\n...
0.727273
0
0
null
prime_rl_code_10745
Heidi found out that the Daleks have created a network of bidirectional Time Corridors connecting different destinations (at different times!). She suspects that they are planning another invasion on the entire Space and Time. In order to counter the invasion, she plans to deploy a trap in the Time Vortex, along a care...
{"test_cases": "{\"inputs\": [\"10 10\\n9 10 1000000000\\n10 2 1000000000\\n6 3 1000000000\\n8 6 1000000000\\n4 8 1000000000\\n7 5 1000000000\\n9 7 1000000000\\n1 3 1000000000\\n1 5 1000000000\\n4 2 1000000000\\n\", \"10 21\\n10 2 500000000\\n8 7 500000000\\n9 1 0\\n9 8 1000000000\\n3 4 1000000000\\n2 4 1000000000\\n5 ...
0.777778
0
1
null
prime_rl_code_10755
Everyone knows that two consecutive (adjacent) "minus" signs can be replaced with a single "plus" sign. You are given the string s, consisting of "plus" and "minus" signs only. Zero or more operations can be performed with it. In each operation you can choose any two adjacent "minus" signs, and replace them with a sin...
{"test_cases": "{\"inputs\": [\"5\\n-+--+\\n-+++\\n--------\\n-+--+-\\n-\\n+\\n--\\n---\\n+++\\n+++\\n\"], \"outputs\": [\"\\nYES\\nYES\\nNO\\nNO\\nYES\\n\"]}", "style": "rule"}
0.875
0
0.833333
null
prime_rl_code_10758
Title: New Year Ratings Change Time Limit: None seconds Memory Limit: None megabytes Problem Description: One very well-known internet resource site (let's call it X) has come up with a New Year adventure. Specifically, they decided to give ratings to all visitors. There are *n* users on the site, for each user we ...
{"test_cases": "{\"inputs\": [\"3\\n5 1 1\", \"1\\n1000000000\", \"10\\n1 1 1 1 1 1 1 1 1 1\", \"10\\n1 10 1 10 1 1 7 8 6 7\", \"10\\n20 19 12 1 12 15 2 12 6 10\", \"10\\n4 5 10 5 2 14 15 6 10 6\"], \"outputs\": [\"5 1 2\", \"1000000000\", \"1 2 3 4 5 6 7 8 9 10\", \"1 10 2 11 3 4 7 9 6 8\", \"20 19 12 1 13 15 2 14 6 1...
0.5
0
0.25
null
prime_rl_code_10776
Hasan loves playing games and has recently discovered a game called TopScore. In this soccer-like game there are p players doing penalty shoot-outs. Winner is the one who scores the most. In case of ties, one of the top-scorers will be declared as the winner randomly with equal probability. They have just finished the...
{"test_cases": "{\"inputs\": [\"10 30 10\\n\", \"2 6 3\\n\", \"5 20 11\\n\", \"1 5000 4999\\n\", \"2 1 0\\n\", \"83 2813 123\\n\", \"93 2364 2364\\n\", \"100 1 0\\n\", \"21 862 387\\n\", \"1 1 0\\n\", \"93 2364 1182\\n\", \"1 0 0\\n\", \"100 5000 30\\n\", \"100 0 0\\n\", \"45 2315 2018\\n\", \"45 886 245\\n\", \"69 813...
0
0
0.25
null
prime_rl_code_10787
Olya works as a warehouse keeper for a T-Shirt factory. Now the factory is facing hard times, so currently they produce only the T-shirts of three kinds: red, green and blue T-Shirts. All the T-shirts are stored in the containers, each of the containers contain the T-Shirts of a single colour. Now there are N container...
{"test_cases": "{\"inputs\": [\"4\\nrgr\\nrrr\\nrgb\\nrgbr\", \"4\\nrfr\\nrrr\\nrgb\\nrgbr\", \"4\\nrrf\\nrrr\\narg\\nrfbr\", \"4\\nrrf\\nrrr\\narg\\nrfbq\", \"4\\nrfr\\nrrr\\ngrb\\nrgbr\", \"4\\nfrr\\nrrr\\ngrb\\nrgbr\", \"4\\nfrr\\nrrr\\nbrg\\nrgbr\", \"4\\nfrr\\nrrr\\narg\\nrgbr\", \"4\\nrrf\\nrrr\\narg\\nrgbr\", \"...
0.142857
0
0
null
prime_rl_code_1079
Rng has a connected undirected graph with N vertices. Currently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i. Rng will add new edges to the graph by repeating the following operation: * Operation: Choose u and v (u \neq v) such that Vertex v can be reached by traversing exactly thr...
{"test_cases": "{\"inputs\": [\"6 5\\n1 2\\n2 3\\n3 4\\n4 5\\n5 6\", \"5 5\\n1 2\\n2 3\\n3 1\\n5 4\\n5 1\", \"6 5\\n1 2\\n2 3\\n3 4\\n4 5\\n4 6\", \"5 5\\n1 2\\n2 3\\n3 1\\n5 3\\n5 1\", \"6 5\\n1 2\\n2 2\\n3 4\\n4 5\\n5 6\", \"5 5\\n1 2\\n2 3\\n3 2\\n5 4\\n5 1\", \"6 5\\n1 2\\n2 3\\n3 4\\n4 5\\n3 6\", \"12 5\\n1 2\\n2 ...
0.875
0
0
null
prime_rl_code_10796
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number a_{i} written on it. They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes al...
{"test_cases": "{\n \"inputs\": [\n \"3\\n4 5 7\\n\",\n \"2\\n1 1\\n\",\n \"10\\n38282 53699 38282 38282 38282 38282 38282 38282 38282 38282\\n\",\n \"10\\n50165 50165 50165 50165 50165 50165 50165 50165 50165 50165\\n\",\n \"10\\n83176 83176 83176 23495 83176 8196 83176 23495 83176 83176\\n\",\n \"1...
0.333333
0
1
null
prime_rl_code_10822
Not to be confused with chessboard. [Image] -----Input----- The first line of input contains a single integer N (1 ≤ N ≤ 100) — the number of cheeses you have. The next N lines describe the cheeses you have. Each line contains two space-separated strings: the name of the cheese and its type. The name is a string...
{"test_cases": "{\n \"inputs\": [\n \"9\\nbrie soft\\ncamembert soft\\nfeta soft\\ngoat soft\\nmuenster soft\\nasiago hard\\ncheddar hard\\ngouda hard\\nswiss hard\\n\",\n \"6\\nparmesan hard\\nemmental hard\\nedam hard\\ncolby hard\\ngruyere hard\\nasiago hard\\n\",\n \"9\\ngorgonzola soft\\ncambozola soft\\...
0.043478
0
0
null
prime_rl_code_10845
Problem Statement You are given a list of $N$ intervals. The $i$-th interval is $[l_i, r_i)$, which denotes a range of numbers greater than or equal to $l_i$ and strictly less than $r_i$. In this task, you consider the following two numbers: * The minimum integer $x$ such that you can select $x$ intervals from the gi...
{"test_cases": "{\"inputs\": [\"\"], \"outputs\": [\"\"]}", "style": "rule"}
0
0
0.5
null
prime_rl_code_10849
Polycarp is choosing three problems for creating a programming test. Totally he has n problems in his list. The complexity of the i-th problem equals r_i. All problems are numerated from 1 to n. Help Polycarp to choose such three problems a, b and c, so that the complexity of the first problem strictly less than the c...
{"test_cases": "{\"inputs\": [\"6\\n3 1 4 1 5 9\\n\", \"5\\n1 1000000000 1 1000000000 1\\n\", \"9\\n10 10 11 10 10 10 10 10 1\\n\"], \"outputs\": [\"\\n4 1 3 \", \"\\n-1 -1 -1\\n\", \"\\n9 8 3 \"]}", "style": "rule"}
0
0
0.666667
null
prime_rl_code_10852
Title: Vanya and Food Processor Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vanya smashes potato in a vertical food processor. At each moment of time the height of the potato in the processor doesn't exceed *h* and the processor smashes *k* centimeters of potato each second. If there a...
{"test_cases": "{\"inputs\": [\"5 6 3\\n5 4 3 2 1\", \"5 6 3\\n5 5 5 5 5\", \"5 6 3\\n1 2 1 1 1\", \"10 100 80\\n76 75 73 71 76 74 73 70 78 75\", \"10 100 88\\n11 23 69 6 71 15 25 1 43 37\", \"10 100 81\\n100 97 96 98 98 95 100 97 97 99\", \"10 1000000000 34\\n262467899 490831561 793808758 450543931 364178715 95212706 ...
0.769231
0
0.166667
null
prime_rl_code_10856
Okay. Before we begin, a hint : This one's taken from somewhere. Word to word. Google comes to mind, doesn't it? Here goes: For the heck of it, we define a new sequence as the infinite sequence of all integers, in ascending order, that can represented as any positive integer power of 5 (i.e 5k where k is a positive i...
{"test_cases": "{\"inputs\": [\"4 \\n1 \\n2 \\n3 \\n9\", \"4 \\n1 \\n2 \\n3 \\n3\", \"4 \\n1 \\n2 \\n3 \\n5\", \"4 \\n1 \\n2 \\n6 \\n9\", \"4 \\n1 \\n2 \\n3 \\n6\", \"4 \\n2 \\n2 \\n3 \\n6\", \"4 \\n2 \\n2 \\n3 \\n9\", \"4 \\n1 \\n2 \\n1 \\n9\", \"4 \\n1 \\n3 \\n1 \\n9\", \"4 \\n1 \\n6 \\n1 \\n9\", \"4 \\n1 \\n3 \\n3 \...
0
0
0.2
null
prime_rl_code_10920
Every character in the string “IITMANDI” is given a certain number of points. You are given a scrabble board with only one row. The input contains the positions of score modifiers such as: Double Letter, Triple Letter, Double Word and Triple Word. You need to find the best position to place the string “IITMANDI” such t...
{"test_cases": "{\"inputs\": [\"1\\n8\\n.D.D.D.D\\n1 2 3 4 5 6 7 8\\n\"], \"outputs\": [\"576\"]}", "style": "rule"}
1
0
1
null
prime_rl_code_10929
Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on. During cooking, Julia goes to the kitchen every d minutes and turns on the stove if it is turned off. While the cooker is turned off, it stays warm. The s...
{"test_cases": "{\"inputs\": [\"4 2 20\\n\", \"3 2 6\\n\", \"8 10 9\\n\", \"312 93 1000000000000000000\\n\", \"42 9 1000000000000000000\\n\", \"1000 1000 1000\\n\", \"963276084 698548036 1000000000\\n\", \"200 10 979220166595737684\\n\", \"3260 4439 6837\\n\", \"87 4 1000\\n\", \"6 3 417701740543616353\\n\", \"9 100000...
0.75
0
0
null
prime_rl_code_10953
Vanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya's character performs attack with frequency x hits per second and Vova's character performs attack with frequency y hits per second. Each character spends fixed time to raise a weapon and then he hits (the time to...
{"test_cases": "{\"inputs\": [\"4 3 2\\n1\\n2\\n3\\n4\\n\", \"2 1 1\\n1\\n2\\n\", \"7 5 20\\n26\\n27\\n28\\n29\\n30\\n31\\n32\\n\", \"10 10 1\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\", \"10 1 10\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n\", \"1 999999 1000000\\n1000000000\\n\", \"5 5 6\\n999999999\\n999999998\\n99...
0.555556
0
0
null
prime_rl_code_10969
Give you N cards. Only one natural number is written on each card. However, the same number is never written. From now on, as a question, I will say an appropriate natural number. Please answer the largest remainder you get when you divide the number on the card you have by the number I said. For example, suppose you...
{"test_cases": "{\"inputs\": [\"3 3\\n9 3 8\\n4\\n6\\n5\", \"3 3\\n9 3 8\\n6\\n6\\n5\", \"3 3\\n9 3 10\\n6\\n6\\n5\", \"3 3\\n9 3 8\\n4\\n6\\n3\", \"3 3\\n9 3 8\\n6\\n6\\n2\", \"3 2\\n1 3 8\\n4\\n6\\n3\", \"3 3\\n9 2 8\\n4\\n6\\n5\", \"3 3\\n12 3 8\\n6\\n6\\n5\", \"3 3\\n9 3 8\\n4\\n6\\n1\", \"3 3\\n9 3 8\\n12\\n6\\n2\...
0
0
1
null
prime_rl_code_10979
DJ Boy is a new generation child he has never seen numeric keypad of mobile. So one day when Prem showed him his mobile, DJ boy started laughing on him. Prem being smart gave him a problem to solve with some condition. Your task is to help DJ boy to solve this problem: Given a number N, DJ boy has to tell how many num...
{"test_cases": "{\"inputs\": [\"100\\n0\\n1\\n10000\\n2\\n3\\n10\\n8973\\n6202\\n4625\\n5469\\n2038\\n5916\\n3405\\n5533\\n7004\\n2469\\n9853\\n4992\\n361\\n9819\\n3294\\n7195\\n4036\\n9404\\n8767\\n5404\\n1711\\n3214\\n3100\\n3751\\n2139\\n5437\\n4993\\n1759\\n9572\\n6270\\n3789\\n9623\\n2472\\n9493\\n6170\\n5589\\n54...
0.8
0
0
null
prime_rl_code_10994
You are a member of the Senate of an ancient empire governed by a mighty dictator. You have joined a bipartisan secret committee of the Senate that is plotting to overthrow the dictator. In order for the plot to succeed, it is crucial that all the states in the empire ultimately support the plan–and to accomplish this...
{"test_cases": "{\"inputs\": [\"4 3\\n0 1 0 0\\n1 2\\n2 3\\n2 4\\n\", \"5 4\\n0 1 1 0 1\\n1 2\\n2 3\\n3 4\\n4 5\\n\"], \"outputs\": [\"1\\n\", \"2\\n\"]}", "style": "rule"}
1
0
1
null
prime_rl_code_11009
Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor. Let's assume that n people stand in the queue for the escalator. At each second one of the two following possibilities takes place: either the first person in the queue ente...
{"test_cases": "{\n \"inputs\": [\n \"1 0.50 1\\n\",\n \"1 0.50 4\\n\",\n \"4 0.20 2\\n\",\n \"2000 0.61 2000\\n\",\n \"100 1.00 200\\n\",\n \"417 0.57 742\\n\",\n \"100 0.01 53\\n\",\n \"300 0.05 55\\n\",\n \"1400 0.02 200\\n\",\n \"2000 0.01 234\\n\",\n \"1 0.01 2000\\n\",\n \"300...
1
0
0.5
null
prime_rl_code_11013
Given is a positive integer N. We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K. - Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K. In how many choices of K will N become 1 in the end? -----Constraints----- - 2 \...
{"test_cases": "{\"inputs\": [\"6\\n\", \"3141\\n\", \"314159265358\\n\", \"1000000000000\\n\", \"642507465600\\n\", \"2\\n\", \"4294967296\\n\", \"260522\\n\", \"914575\\n\", \"436426\\n\", \"540024979445\\n\", \"917861648772\\n\", \"962623690081\\n\", \"523968956449\\n\", \"145329450841\\n\", \"2106351025\\n\", \"105...
0.833333
0
1
null
prime_rl_code_11043
Example Input 3 y 7 y 6 n 5 Output 1 Write Python code to solve the problem. Present the code in ```python Your code ``` at the end.
{"test_cases": "{\"inputs\": [\"3\\ny 7\\ny 2\\nn 5\", \"3\\ny 7\\ny 3\\nn 5\", \"3\\ny 7\\ny 3\\nn 10\", \"3\\ny 2\\ny 3\\nn 10\", \"3\\ny 2\\ny 6\\nn 10\", \"3\\nx 2\\ny 6\\nn 10\", \"3\\ny 7\\ny 11\\nn 5\", \"3\\ny 8\\ny 2\\nn 5\", \"3\\ny 7\\ny 6\\nn 2\", \"3\\ny 0\\ny 3\\nn 10\", \"3\\ny 4\\ny 3\\nn 10\", \"3\\ny ...
0.166667
0
0
null
prime_rl_code_11074
You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some positive integer from 1 to n, such that equality holds. Input The only line of the input contains a re...
{"test_cases": "{\"inputs\": [\"? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? - ? + ? + ? + ? + ? + ? + ? - ? + ? - ? + ? + ? + ? + ? - ? + ? + ? + ? + ? + ? + ? + ? - ...
0.130435
0
0.142857
null
prime_rl_code_11084
We have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell. However, she cannot enter the cells in the intersection of the bottom A rows and the leftmost B columns. (That is, there a...
{"test_cases": "{\"inputs\": [\"2 3 1 1\\n\", \"10 7 3 4\\n\", \"100000 100000 99999 99999\\n\", \"100000 100000 44444 55555\\n\"], \"outputs\": [\"2\\n\", \"3570\\n\", \"1\\n\", \"738162020\\n\"]}", "style": "rule"}
1
0
0.25
null
prime_rl_code_11096
Title: Alyona and Mex Time Limit: None seconds Memory Limit: None megabytes Problem Description: Someone gave Alyona an array containing *n* positive integers *a*1,<=*a*2,<=...,<=*a**n*. In one operation, Alyona can choose any element of the array and decrease it, i.e. replace with any positive integer that is small...
{"test_cases": "{\"inputs\": [\"5\\n1 3 3 3 6\", \"2\\n2 1\", \"1\\n1\", \"1\\n1000000000\", \"1\\n2\", \"2\\n1 1\", \"2\\n1 3\", \"2\\n2 2\", \"2\\n2 3\", \"2\\n3 3\", \"3\\n1 1 1\", \"3\\n2 1 1\", \"3\\n3 1 1\", \"3\\n1 1 4\", \"3\\n2 1 2\", \"3\\n3 2 1\", \"3\\n2 4 1\", \"3\\n3 3 1\", \"3\\n1 3 4\", \"3\\n4 1 4\", \...
0
0
0.5
null
prime_rl_code_11115
Kulyash has given you an array A of size N. He defines the *subsequence-number* of a non-empty [subsequence] S of array A as the number formed by the concatenation of all the elements of the subsequence S. Find the count of non-empty subsequences of A having their *subsequence-numbers* divisible by 7. Since the an...
{"test_cases": "{\"inputs\": [\"5\\n1\\n4\\n4\\n1234\\n5\\n12345\\n7\\n7123651\\n6\\n451754\\n\", \"1\\n3\\n711\\n\", \"1\\n4\\n4567\\n\", \"1\\n5\\n98765\\n\", \"1\\n6\\n457812\\n\", \"1\\n5\\n12345\\n\", \"1\\n10\\n1234567890\\n\", \"1\\n4\\n1234\\n\", \"1\\n5\\n300000 200000 100000 90000 80000\\n\", \"1\\n5\\n123456...
0
0
0.111111
null
prime_rl_code_1115
Title: Mysterious numbers - 1 Time Limit: None seconds Memory Limit: None megabytes Problem Description: The input contains two integers *a*1,<=*a*2 (0<=≤<=*a**i*<=≤<=109), separated by a single space. Output a single integer. Input Specification: The input contains two integers *a*1,<=*a*2 (0<=≤<=*a**i*<=≤<=109),...
{"test_cases": "{\"inputs\": [\"3 14\", \"27 12\", \"100 200\", \"0 0\", \"31415 92653\", \"1000000000 0\", \"0 1000000000\", \"1000000000 1000000000\", \"804289383 846930886\", \"681692777 714636915\", \"957747793 424238335\", \"719885386 649760492\", \"596516649 189641421\", \"25202362 350490027\", \"783368690 102520...
0.75
0
0
null
prime_rl_code_11154
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 ...
{"test_cases": "{\"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 ...
1
0
0.5
null
prime_rl_code_1117
In 1945, Vietnam had a huge famine because of which thousands of Vietnamese people were dying everyday. The Soviet Union wanted to help the Vietnamese. They were regualrly sending food supplies to Vietnam. The Vietnamese officials decided that they would provide food to the children first. (Food supplies included food...
{"test_cases": "{\"inputs\": [\"13\\n78 12 60 78 68 37 57 40 49 13 94 91 89 \\n0\\n\\nSAMPLE\", \"184\\n7 8 6 4 6 7 3 10 2 3 8 1 10 4 7 1 7 3 7 2 9 8 10 3 1 3 4 8 6 10 3 3 9 10 8 4 7 2 3 10 4 2 10 5 8 9 5 6 1 4 7 2 1 7 4 3 1 7 2 6 6 5 8 7 6 7 10 4 8 5 6 3 6 5 8 5 5 4 1 8 9 7 9 9 5 4 2 5 10 3 1 7 9 10 3 7 7 5 10 6 1 5 9...
0
0
1
null
prime_rl_code_11216
Title: Sereja and Bottles Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sereja and his friends went to a picnic. The guys had *n* soda bottles just for it. Sereja forgot the bottle opener as usual, so the guys had to come up with another way to open bottles. Sereja knows that the *i*-th...
{"test_cases": "{\"inputs\": [\"4\\n1 1\\n2 2\\n3 3\\n4 4\", \"4\\n1 2\\n2 3\\n3 4\\n4 1\", \"3\\n2 828\\n4 392\\n4 903\", \"4\\n2 3\\n1 772\\n3 870\\n3 668\", \"5\\n1 4\\n6 6\\n4 3\\n3 4\\n4 758\", \"6\\n4 843\\n2 107\\n10 943\\n9 649\\n7 806\\n6 730\", \"7\\n351 955\\n7 841\\n102 377\\n394 102\\n549 440\\n630 324\\n6...
0.875
0
1
null
prime_rl_code_11217
Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with $n$ rows and $m$ columns. Each cell is either black or white. For each iteration of the game (the initial iteration is $0$), the co...
{"test_cases": "{\"inputs\": [\"3 3 3\\n000\\n111\\n000\\n1 1 1\\n2 2 2\\n3 3 3\\n\", \"5 2 2\\n01\\n10\\n01\\n10\\n01\\n1 1 4\\n5 1 4\\n\", \"5 5 3\\n01011\\n10110\\n01101\\n11010\\n10101\\n1 1 4\\n1 2 3\\n5 5 3\\n\", \"1 1 3\\n0\\n1 1 1\\n1 1 2\\n1 1 3\\n\", \"1 1 1\\n1\\n1 1 1\\n\", \"2 2 1\\n10\\n11\\n1 2 100000000...
1
0
0
null
prime_rl_code_11227
Raghav is good in mathematics. He loves to ask puzzles with his friends. One day, he decides to challenge his friend Aditya who is not good with puzzles. So, Aditya needs your help in determining the solution to the puzzle asked by his friend which is stated as:- Tell the total number of ways he can choose three numbe...
{"test_cases": "{\"inputs\": [\"8\\n3 5 3 1 2 5 3 7\\n\\nSAMPLE\", \"30\\n2 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 5 5 5 5 5 5 5 1 1 1 1 1\", \"12\\n3 1 3 5 20000 30000 2 0 1 1 2 3\", \"8\\n0 0 0 0 0 0 0 0\"], \"outputs\": [\"6\", \"618\", \"13\", \"56\"]}", "style": "rule"}
0.6
0
0
null
prime_rl_code_11261
Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the progr...
{"test_cases": "{\"inputs\": [\"2 -1 -2 -1\\n2 -1 2 -1\\n2 -1 -2 -1\\n2 -1 2 -1\\n\", \"0 0 0 1\\n0 1 0 1\\n0 1 0 0\\n0 1 0 1\\n\", \"0 0 2 2\\n0 0 2 0\\n2 2 2 2\\n0 2 0 2\\n\", \"130120899 550158649 130120899 831843953\\n130120899 550158649 130120899 831843953\\n130120899 550158649 434006978 831843953\\n434006978 5501...
0.538462
0
0.6
null
prime_rl_code_11274
Note that this is the first problem of the two similar problems. You can hack this problem only if you solve both problems. You are given a tree with n nodes. In the beginning, 0 is written on all edges. In one operation, you can choose any 2 distinct leaves u, v and any real number x and add x to values written on al...
{"test_cases": "{\"inputs\": [\"2\\n1 2\\n\", \"3\\n1 2\\n2 3\\n\", \"5\\n1 2\\n1 3\\n1 4\\n2 5\\n\", \"6\\n1 2\\n1 3\\n1 4\\n2 5\\n2 6\\n\", \"50\\n16 4\\n17 9\\n31 19\\n22 10\\n8 1\\n40 30\\n3 31\\n20 29\\n47 27\\n22 25\\n32 34\\n12 15\\n40 32\\n10 33\\n47 12\\n6 24\\n46 41\\n14 23\\n12 35\\n31 42\\n46 28\\n31 20\\n4...
0.769231
0
0.125
null
prime_rl_code_11278
Snuke has N strings. The i-th string is s_i. Let us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string. Constraints * 1 \leq N \leq 10^{4} * 2 \leq |s_i| \leq 10 * s_i consists of uppercase English letters. In...
{"test_cases": "{\"inputs\": [\"9\\nBEWPVCRWH\\nZZNQYIJX\\nBAVREA\\nPA\\nHJMYITEOX\\nBCJHMRMNK\\nBP\\nQVFABZ\\nPRGKSPUNA\", \"7\\nRABYBBE\\nJOZ\\nBMHQUVA\\nBPA\\nISU\\nMCMABAOBHZ\\nSZMEHMA\", \"3\\nABCA\\nXBAZ\\nBAD\", \"9\\nBEWPVCRWH\\nZQNZYIJX\\nBAVREA\\nPA\\nHJMYITEOX\\nBCJHMRMNK\\nBP\\nQVFABZ\\nPRGKSPUNA\", \"7\\nE...
0.818182
0
0
null
prime_rl_code_11279
The problem was inspired by Pied Piper story. After a challenge from Hooli's compression competitor Nucleus, Richard pulled an all-nighter to invent a new approach to compression: middle-out. You are given two strings $s$ and $t$ of the same length $n$. Their characters are numbered from $1$ to $n$ from left to right ...
{"test_cases": "{\"inputs\": [\"3\\n9\\niredppipe\\npiedpiper\\n4\\nestt\\ntest\\n4\\ntste\\ntest\\n\", \"4\\n1\\na\\nz\\n5\\nadhas\\ndasha\\n5\\naashd\\ndasha\\n5\\naahsd\\ndasha\\n\", \"6\\n7\\ncontest\\nntecost\\n7\\ncontest\\nnstteco\\n7\\ncontest\\ntnsteco\\n7\\ncontest\\ncotestn\\n7\\ncontest\\ncontest\\n7\\nonte...
0
0
1
null
prime_rl_code_11307
Jack stays in a n-storey hostel. His dorm room is on the jth floor. Every morning, he is in so much hurry for classes that he cannot not decide whether to take Lift or Stairs to reach ground-floor. He asks you to help him choose either Stairs or Lift based on total time taken to reach ground-floor. It takes him 10 sec...
{"test_cases": "{\"inputs\": [\"3\\n30 10 20 U\\n10 10 10 U\\n80 60 60 D\\n\\nSAMPLE\", \"32\\n10 5 5 U\\n10 5 5 D\\n10 3 3 D\\n10 9 9 U\\n10 10 10 U\\n10 10 10 D\\n100 80 20 U\\n100 80 45 U\\n100 80 46 U\\n100 80 40 D\\n100 80 0 D\\n100 80 79 D\\n100 100 3 U\\n100 100 4 U\\n100 100 5 U\\n100 100 2 U\\n100 100 1 D\\n10...
0.266667
0
0
null
prime_rl_code_11334
CSS colors are defined using a hexadecimal (HEX) notation for the combination of Red, Green, and Blue color values (RGB). Specifications of HEX Color Code ■ It must start with a '#' symbol. ■ It can have $3$ or $\boldsymbol{6}$ digits. ■ Each digit is in the range of $\mbox{o}$ to $\mbox{F}$. ($1,2,3,4,5,6,7,8,9,0,...
{"test_cases": "{\"inputs\": [\"11\\n#BED\\n{\\n color: #FfFdF8; background-color:#aef;\\n font-size: 123px;\\n background: -webkit-linear-gradient(top, #f9f9f9, #fff);\\n}\\n#Cab\\n{\\n background-color: #ABC;\\n border: 2px dashed #fff;\\n} \\n\"], \"outputs\": [\"#FfFdF8\\n#aef\\n#f9f9f9\\n#fff\\n#A...
0.833333
0
0.5
null
prime_rl_code_11364
Title: Tricky Function Time Limit: None seconds Memory Limit: None megabytes Problem Description: Iahub and Sorin are the best competitive programmers in their town. However, they can't both qualify to an important contest. The selection will be made with the help of a single problem. Blatnatalag, a friend of Iahub,...
{"test_cases": "{\"inputs\": [\"4\\n1 0 0 -1\", \"2\\n1 -1\", \"100\\n-57 -64 83 76 80 27 60 76 -80 -56 52 72 -17 92 -96 87 41 -88 94 89 12 42 36 34 -100 -43 -42 62 3 87 -69 -6 -27 -59 -7 5 -90 -23 63 -87 -60 -92 -40 54 -16 -47 67 -64 10 33 -19 53 -7 -62 16 -74 -36 4 -75 -55 92 3 -22 43 -30 48 -27 88 -58 41 36 8 -40 -3...
0.125
0
0
null
prime_rl_code_11369
Okabe and Super Hacker Daru are stacking and removing boxes. There are n boxes numbered from 1 to n. Initially there are no boxes on the stack. Okabe, being a control freak, gives Daru 2n commands: n of which are to add a box to the top of the stack, and n of which are to remove a box from the top of the stack and thr...
{"test_cases": "{\n \"inputs\": [\n \"3\\nadd 1\\nremove\\nadd 2\\nadd 3\\nremove\\nremove\\n\",\n \"7\\nadd 3\\nadd 2\\nadd 1\\nremove\\nadd 4\\nremove\\nremove\\nremove\\nadd 6\\nadd 7\\nadd 5\\nremove\\nremove\\nremove\\n\",\n \"4\\nadd 1\\nadd 3\\nremove\\nadd 4\\nadd 2\\nremove\\nremove\\nremove\\n\",\n ...
0.25
0
0
null
prime_rl_code_1137
Once upon a time in the Kingdom of Far Far Away lived Sir Lancelot, the chief Royal General. He was very proud of his men and he liked to invite the King to come and watch drill exercises which demonstrated the fighting techniques and tactics of the squad he was in charge of. But time went by and one day Sir Lancelot h...
{"test_cases": "{\"inputs\": [\"2 4\\n\", \"3 4\\n\", \"915 72\\n\", \"967 4\\n\", \"997 997\\n\", \"998 999\\n\", \"1 991\\n\", \"757 210\\n\", \"1 865\\n\", \"995 2\\n\", \"862 330\\n\", \"1 999\\n\", \"953 874\\n\", \"2 348\\n\", \"998 998\\n\", \"1 1000\\n\", \"555 349\\n\", \"993 2\\n\", \"936 759\\n\", \"44 343\\...
1
0
0
null
prime_rl_code_11378
Each digit of a number is represented by a cluster of adjacent X, with spaces between neighboring clusters. The digit is determined by the number of X in the cluster. For example, the number 243 would be represented by the following pattern -XX-XXXX-XXX- So to represent 0 the pattern will be -- (2 dashes without a...
{"test_cases": "{\"inputs\": [\"2\\n-XX-XXXX-XXX-\\n-XX--XXXX---XXX-\\n\\nSAMPLE\", \"2\\n-XXXXX-X-XXX-\\n-XX--XXXX---XXX-\\n\\nSAMPLE\", \"2\\n-XXXXX-X-XXX-\\n-XXX---XXXX--XX-\\n\\nSAMPLE\", \"2\\n-XXX-X-XXXXX-\\n-XX--XXXX---XXX-\\n\\nELPMAS\", \"2\\n-XXX-X-XXXXX-\\n-XXX---XXXX--XX-\\n\\nELPMAS\", \"2\\n-XXXXX-X-XXX-\...
0
0
0.75
null
prime_rl_code_11394
Expression Mining Consider an arithmetic expression built by combining single-digit positive integers with addition symbols `+`, multiplication symbols `*`, and parentheses `(` `)`, defined by the following grammar rules with the start symbol `E`. E ::= T | E '+' T T ::= F | T '*' F F ::= '1' | '2' | '3' | '4' | '5'...
{"test_cases": "{\"inputs\": [\"3\\n(1+2)*3+3\\n2\\n1*1*1+1*1*1\\n587\\n1*(2*3*4)+5+((6+7*8))*(9)\\n0\", \"3\\n(1+2)*3+3\\n3\\n1*1*1+1*1*1\\n587\\n1*(2*3*4)+5+((6+7*8))*(9)\\n0\", \"3\\n(1+2)*3+3\\n3\\n1*1*1+1*1*1\\n721\\n1*(2*3*4)+5+((6+7*8))*(9)\\n0\", \"3\\n(1+2)*3+3\\n3\\n1*1*1+1*1+1\\n1480\\n1*(2*3*4)+5+((6+7*8))*...
0.142857
0
0
null
prime_rl_code_11445
Cesar and Raul like betting and good food, in no particular order. They want to try out a new fancy restaurant and they decided to make a bet – they are going to play a game and the loser pays for dinner. They have a box with $N$ balls. Each ball contains a distinct number between $1$ and $N$. Then, the game proceeds ...
{"test_cases": "{\"inputs\": [\"2 1 1\\n1\\n2\\n\", \"30 5 10\\n2 3 5 7 11 13 17 19 23 29\\n20 18 16 14 12 10 8 6 4 2\\n\"], \"outputs\": [\"1.00000000\\n\", \"13.30378396\\n\"]}", "style": "rule"}
0.333333
0
0
null
prime_rl_code_11453
Constraints * 1 ≤ |V| ≤ 100 * 0 ≤ |E| ≤ 9900 * -2 × 107 ≤ di ≤ 2 × 107 * There are no parallel edges * There are no self-loops Input An edge-weighted graph G (V, E). |V| |E| s0 t0 d0 s1 t1 d1 : s|E|-1 t|E|-1 d|E|-1 |V| is the number of vertices and |E| is the number of edges in G. The graph vertices are named wi...
{"test_cases": "{\"inputs\": [\"4 6\\n0 1 1\\n0 2 -5\\n1 2 2\\n1 3 4\\n2 3 1\\n3 2 7\", \"4 6\\n0 1 1\\n0 2 5\\n1 2 2\\n1 3 4\\n2 3 1\\n3 2 -7\", \"4 6\\n0 1 1\\n0 2 5\\n1 2 2\\n1 3 4\\n2 3 1\\n3 2 7\", \"4 6\\n0 1 1\\n0 2 5\\n1 2 2\\n1 3 8\\n2 3 1\\n3 2 -7\", \"4 6\\n0 1 1\\n0 3 -5\\n1 2 2\\n1 3 4\\n2 3 1\\n3 2 7\", \...
1
0
0
null
prime_rl_code_11457
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...
{"test_cases": "{\n \"inputs\": [\n \"5\\nDDRRR\\n\",\n \"6\\nDDRRRR\\n\",\n \"1\\nD\\n\",\n \"1\\nR\\n\",\n \"2\\nDR\\n\",\n \"3\\nRDD\\n\",\n \"3\\nDRD\\n\",\n \"4\\nDRRD\\n\",\n \"4\\nDRRR\\n\",\n \"4\\nRDRD\\n\",\n \"5\\nDRDRR\\n\",\n \"4\\nRRRR\\n\",\n \"5\\nRDDRD\\n\",\n ...
0.25
0
0
null
prime_rl_code_11473
Maggu loves to create problems involving queries. This time ,he has created one for you. Given an array containing n elements and maggu asked you two types of queries. type 0 : l r type 1 : l r Explanation: type 0 : add 2^1 to l th element, 2^2 to the (l+1) th element , 2^3 ot the (l+2) th element and so on upto ...
{"test_cases": "{\"inputs\": [\"10000\\n94882456 52761424 85761893 31233412 27793199 86024866 13893447 49637883 98407637 9737261 54120015 77773360 26603802 47835121 61898415 8778384 34965110 48499256 43808807 97228290 86124259 39246183 62952004 95325259 29419699 91250840 99769358 25441617 32825362 46291504 93440597 875...
0.25
0
0
null
prime_rl_code_11480
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling. Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat t...
{"test_cases": "{\n \"inputs\": [\n \"4\\n7\\n1 7 1 6 4 4 6\\n8\\n1 1 4 6 4 6 4 7\\n3\\n3 3 3\\n6\\n2 5 2 3 1 4\\n\",\n \"1\\n15\\n1 2 3 4 5 1 2 3 4 5 1 2 3 4 5\\n\"\n ],\n \"outputs\": [\n \"3\\n2\\n0\\n4\\n\",\n \"4\\n\"\n ]\n}", "style": "rule"}
0.6
0
0
null
prime_rl_code_11495
Math teacher Mr. Matsudaira is teaching expansion and factoring of polynomials to his students. Last week he instructed the students to write two polynomials (with a single variable x), and to report GCM (greatest common measure) of them as a homework, but he found it boring to check their answers manually. So you are ...
{"test_cases": "{\"inputs\": [\"-(x^3-3x^2+3x-1)\\n(x-1)^2\\nx^2+10x+25\\nx^2+6x+5\\nx^4+1\\nx-1\\n.\", \"-(x^4-3x^2+3x-1)\\n(x-1)^2\\nx^2+10x+25\\nx^2+6x+5\\nx^3+1\\nx-1\\n.\", \"-(x^3-3x^2+3x-1)\\n(x-1)^2\\nx^2+10x+15\\nx^2+6x+5\\nx^4+1\\nx-1\\n.\", \"-(x^3-2x^2+3x-1)\\n(x-1)^2\\nx^2+10x+25\\nx^2+6x+5\\n1^4+x\\nx-2\\...
0.333333
0
0
null
prime_rl_code_11507
The BITians are furious that their lift stops working frequently .Adding to this, there are 7 floors in BIT which becomes really tedious to climb. Vikas has to attend the class in 5th floor. He decides to take a step of 1 or 2 each time to reach his class. He wants to find the number of ways in which he c...
{"test_cases": "{\"inputs\": [\"2\\n2\\n4\\n\\nSAMPLE\", \"2\\n2\\n4\\n\\nSAMPLF\", \"2\\n4\\n4\\n\\nSAMPLF\", \"2\\n4\\n8\\n\\nSAMPLF\", \"2\\n8\\n8\\n\\nSAMPLF\", \"2\\n3\\n8\\n\\nSAMPLF\", \"2\\n3\\n9\\n\\nRAMPLF\", \"2\\n6\\n9\\n\\nRAMPLF\", \"2\\n8\\n9\\n\\nFLPMAR\", \"2\\n11\\n9\\n\\nFLPMAR\", \"2\\n17\\n9\\n\\nA...
0.333333
0
0.4
null
prime_rl_code_11521
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only T seconds after coming. Fortunately, Adilbek can spend time witho...
{"test_cases": "{\"inputs\": [\"3 5\\n2 2 2\\n\", \"3 5\\n2 1 2\\n\", \"20 30\\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\\n\", \"20 31\\n2 2 1 2 1 1 2 1 2 2 1 2 1 2 1 1 1 2 1 2\\n\", \"20 26\\n1 2 1 1 1 2 1 1 2 2 2 1 2 1 2 1 1 2 2 1\\n\", \"20 28\\n2 1 1 2 2 1 2 2 2 1 2 1 1 1 1 2 1 1 2 1\\n\", \"5 10\\n2 2 2 2 1\\n\", \...
0.333333
0
0.75
null
prime_rl_code_11526
Nick has n bottles of soda left after his birthday. Each bottle is described by two values: remaining amount of soda a_{i} and bottle volume b_{i} (a_{i} ≤ b_{i}). Nick has decided to pour all remaining soda into minimal number of bottles, moreover he has to do it as soon as possible. Nick spends x seconds to pour x u...
{"test_cases": "{\n \"inputs\": [\n \"4\\n3 3 4 3\\n4 7 6 5\\n\",\n \"2\\n1 1\\n100 100\\n\",\n \"5\\n10 30 5 6 24\\n10 41 7 8 24\\n\",\n \"1\\n1\\n100\\n\",\n \"1\\n100\\n100\\n\",\n \"1\\n50\\n100\\n\",\n \"10\\n18 42 5 1 26 8 40 34 8 29\\n18 71 21 67 38 13 99 37 47 76\\n\",\n \"20\\n24 22 4 ...
0.2
0
0.5
null
prime_rl_code_11540
There are N infants registered in AtCoder, numbered 1 to N, and 2\times 10^5 kindergartens, numbered 1 to 2\times 10^5. Infant i has a rating of A_i and initially belongs to Kindergarten B_i. From now on, Q transfers will happen. After the j-th transfer, Infant C_j will belong to Kindergarten D_j. Here, we define the e...
{"test_cases": "{\"inputs\": [\"6 3\\n8 1\\n6 2\\n9 3\\n1 1\\n2 2\\n1 3\\n4 3\\n2 1\\n1 2\\n\", \"2 2\\n4208 1234\\n3056 5678\\n1 2020\\n2 2020\\n\"], \"outputs\": [\"6\\n2\\n6\\n\", \"3056\\n4208\\n\"]}", "style": "rule"}
0.25
0
1
null
prime_rl_code_11675
Title: Olya and Energy Drinks Time Limit: None seconds Memory Limit: None megabytes Problem Description: Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of *n*<=×<=*m* cells, each cell of which is empty or litt...
{"test_cases": "{\"inputs\": [\"3 4 4\\n....\\n###.\\n....\\n1 1 3 1\", \"3 4 1\\n....\\n###.\\n....\\n1 1 3 1\", \"2 2 1\\n.#\\n#.\\n1 1 2 2\", \"10 10 1\\n##########\\n#.........\\n#.#######.\\n#.#.....#.\\n#.#.###.#.\\n#.#.#.#.#.\\n#.#.#.#.#.\\n#.#.#...#.\\n#.#.#####.\\n#.#.......\\n6 6 10 2\", \"10 10 3\\n#########...
1
0
1
null