messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 1
value |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nMeatishi can increase or decrease the number of fingers.\nThere are n buns in front of Nikunishi-kun.\nMeatishi is trying to count the number of steamed buns by breaking his finger.\nThere are only tw... | [{"type": "stdin_stdout", "input": "1237235", "output": "21\n"}, {"type": "stdin_stdout", "input": "140502", "output": "18\n"}, {"type": "stdin_stdout", "input": "299812", "output": "19\n"}, {"type": "stdin_stdout", "input": "763679", "output": "20\n"}, {"type": "stdin_stdout", "input": "17679", "output": "15\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs we all know Barney's job is \"PLEASE\" and he has not much to do at work. That's why he started playing \"cups and key\". In this game there are three identical cups arranged in a line from left to right. Initially key... | [{"type": "stdin_stdout", "input": "12\n254904759290707697 475737283258450340 533306428548398547 442127134828578937 779740159015946254 272877594683860919 93000149670491971 349640818793278778 498293278222136720 551099726729989816 149940343283925029 1677751211246811281\n", "output": "144527324/433581971\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an ice cream shop named Ten Ice Cream. At this store, we always have 10 types of ice cream on the shelves. The store manager creates a daily graph showing how well ice cream is selling for reference in product de... | [{"type": "stdin_stdout", "input": "15\n2\n6\n7\n0\n1\n9\n8\n7\n4\n8\n9\n1\n9\n4\n2\n1\n2\n1\n0\n0", "output": "*\n**\n**\n-\n**\n-\n*\n**\n**\n***\n-\n-\n*\n-\n-\n-\n-\n-\n-\n-\n*\n-\n-\n-\n-\n-\n-\n-\n-\n-\n"}, {"type": "stdin_stdout", "input": "15\n1\n6\n7\n0\n1\n9\n8\n7\n4\n8\n9\n1\n9\n4\n2\n1\n2\n1\n0\n0", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string is called square if it is some string written twice in a row. For example, the strings \"aa\", \"abcabc\", \"abab\" and \"baabaa\" are square. But the strings \"aaa\", \"abaaab\" and \"abcdabc\" are not square.\n... | [{"type": "stdin_stdout", "input": "10\na\naa\naaa\naaaa\nabab\nabcabc\nabacaba\nxxyy\nxyyx\nxyxy\n", "output": "NO\nYES\nNO\nYES\nYES\nYES\nNO\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "10\na\naa\naaa\naaaa\nabab\nabcabc\nabacaba\nyxxy\nxyyx\nxyxy\n", "output": "NO\nYES\nNO\nYES\nYES\nYES\nNO\nNO\nNO\nYES\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants h... | [{"type": "stdin_stdout", "input": "100\n98 52 63 2 18 96 31 58 84 40 41 45 66 100 46 71 26 48 81 20 73 91 68 76 13 93 17 29 64 95 79 21 55 75 19 85 54 51 89 78 15 87 43 59 36 1 90 35 65 56 62 28 86 5 82 49 3 99 33 9 92 32 74 69 27 22 77 16 44 94 34 6 57 70 23 12 61 25 8 11 67 47 83 88 10 14 30 7 97 60 42 37 24 38 53 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA robber has attempted to rob a bank but failed to complete his task. However, he had managed to open all the safes.\n\nOleg the bank client loves money (who doesn't), and decides to take advantage of this failed robbery ... | [{"type": "stdin_stdout", "input": "8 3 13\n12\n3 3 3 12 7 6 10 1 8 8 7 12\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 3 13\n12\n3 3 3 8 7 6 10 1 8 8 7 12\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 5 13\n12\n3 3 3 8 7 6 10 1 7 8 7 11\n", "output": "8\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonocarp is playing yet another computer game. In this game, his character has to kill a dragon. The battle with the dragon lasts $100^{500}$ seconds, during which Monocarp attacks the dragon with a poisoned dagger. The $... | [{"type": "stdin_stdout", "input": "4\n2 13\n1 5\n3 11\n1 4 20\n5 3\n1 2 4 8 7\n4 1000\n5 25 95 1337\n", "output": "9\n4\n1\n455\n"}, {"type": "stdin_stdout", "input": "4\n2 1\n1 5\n3 10\n2 4 10\n5 3\n1 2 4 5 7\n4 1000\n3 25 124 1337\n", "output": "1\n4\n1\n440\n"}, {"type": "stdin_stdout", "input": "4\n2 5\n1 5\n3 10\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChampernown constant is an irrational number represented in decimal by \"0.\" followed by concatenation of all positive integers in the increasing order. The first few digits of this constant are: 0.123456789101112...\n\n... | [{"type": "stdin_stdout", "input": "11 17\n11 14\n0 0", "output": "01112131415161718\n01112131415161\n"}, {"type": "stdin_stdout", "input": "4 7\n2 26\n0 0", "output": "4567891\n23456789101112131415161718\n"}, {"type": "stdin_stdout", "input": "2 5\n1 26\n0 0", "output": "23456\n12345678910111213141516171\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting of n square cells (that is, on a 1 × n table).\n\nAt the beginning of the game Alice puts k ships on the fie... | [{"type": "stdin_stdout", "input": "50 7 3\n50\n17 47 1 12 21 25 6 5 49 27 34 8 16 38 11 44 48 9 2 20 3 22 33 23 36 41 15 35 31 30 50 7 45 42 37 29 14 26 24 46 19 4 10 28 18 43 32 39 40 13\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "50 1 1\n50\n1 13 21 37 30 48 23 19 6 49 36 14 9 24 44 10 41 28 20 2 15 11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe 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 from ... | [{"type": "stdin_stdout", "input": "RLRRRRRDRRDRRRRDLRRRRRRRDLRLDDLRRRRLDLDRDRRRRDRDRDRDLRRURRLRRRRDRRRRRRRRLDDRLRRDRRRRRRRDRDRLDRDDDRDR\n", "output": "BUG\n"}, {"type": "stdin_stdout", "input": "DDDDDDDDDDDDDDDDDDDDDDDDDLLLLLLLLLLLLLLLLLLLLLLLLRRRRRRRRRRRRRRRRRRRRRRRRRRRUUUUUUUUUUUUUUUUUUUUUUUU\n", "output": "BUG\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a bookshelf which can fit $n$ books. The $i$-th position of bookshelf is $a_i = 1$ if there is a book on this position and $a_i = 0$ otherwise. It is guaranteed that there is at least one book on the bookshelf.\n... | [{"type": "stdin_stdout", "input": "5\n7\n0 0 1 0 1 0 1\n3\n1 0 0\n5\n1 1 0 0 1\n6\n1 0 0 0 0 1\n5\n1 1 0 1 1\n", "output": "2\n0\n2\n4\n1\n"}, {"type": "stdin_stdout", "input": "5\n7\n0 0 1 0 1 0 1\n3\n1 0 0\n5\n1 1 0 1 1\n6\n1 0 0 0 0 1\n5\n1 1 0 1 1\n", "output": "2\n0\n1\n4\n1\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp took $n$ videos, the duration of the $i$-th video is $a_i$ seconds. The videos are listed in the chronological order, i.e. the $1$-st video is the earliest, the $2$-nd video is the next, ..., the $n$-th video is ... | [{"type": "stdin_stdout", "input": "6 3\n3 3 1 4 1 6\n", "output": "Yes\n2 3 1 \n"}, {"type": "stdin_stdout", "input": "6 3\n3 3 1 4 1 6\n", "output": "Yes\n2 3 1 "}, {"type": "stdin_stdout", "input": "3 3\n1 1 1\n", "output": "Yes\n1 1 1 \n"}, {"type": "stdin_stdout", "input": "3 3\n1 1 1\n", "output": "Yes\n1 1 1 "},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya writes his own library for building graphical user interface. Vasya called his creation VTK (VasyaToolKit). One of the interesting aspects of this library is that widgets are packed in each other. \n\nA widget is so... | [{"type": "stdin_stdout", "input": "20\nVBox hykl\nVBox enwv\nenwv.pack(hykl)\nVBox dlepf\ndlepf.pack(hykl)\nenwv.set_border(30)\nWidget mjrrik(54,21)\nhykl.set_border(2)\ndlepf.set_border(22)\nenwv.set_border(3)\nenwv.pack(dlepf)\ndlepf.pack(mjrrik)\nhykl.set_spacing(96)\nenwv.set_border(32)\ndlepf.set_border(72)\nWid... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool programmer, he needs at least p experience points, and a desired flat in Moscow costs q dollars. Mikha... | [{"type": "stdin_stdout", "input": "10 468662 93838\n589910 727627\n279516 867207\n470524 533177\n467834 784167\n295605 512137\n104422 629804\n925609 728473\n922365 964620\n998983 958315\n425628 935048\n", "output": "0.4691391144794256\n"}, {"type": "stdin_stdout", "input": "10 326330 93838\n589910 727627\n279516 86720... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWell, the series which Stepan watched for a very long time, ended. In total, the series had n episodes. For each of them, Stepan remembers either that he definitely has watched it, or that he definitely hasn't watched it,... | [{"type": "stdin_stdout", "input": "100 100\n????????????????????????????????????????????????????????????????????????????????????????????????????\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 100\n????????????????????????????????????????????????????????????????????????????????????????????????????\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet $LCM(x, y)$ be the minimum positive integer that is divisible by both $x$ and $y$. For example, $LCM(13, 37) = 481$, $LCM(9, 6) = 18$.\n\nYou are given two integers $l$ and $r$. Find two integers $x$ and $y$ such that... | [{"type": "stdin_stdout", "input": "69\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nYou are given an array A of N integers. You are to fulfill M queries. Each query has one of the following three types:\n\nC d : Rotate the array A clockwise b... | [{"type": "stdin_stdout", "input": "5 3\n0 13 10 -1 -2\nR -1\nC 1\nR 4\n@ 1\nS 2", "output": "-1\n-2\n"}, {"type": "stdin_stdout", "input": "5 3\n0 13 10 -1 -2\nR -2\nC 1\nR 4\n@ 1\nS 2", "output": "10\n-2\n"}, {"type": "stdin_stdout", "input": "5 3\n0 13 10 -1 -2\nR 0\nC 1\nR 4\n@ 1\nS 2", "output": "-2\n-2\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of peop... | [{"type": "stdin_stdout", "input": "50 50\n6 10\n10 0\n1 9\n8 2\n4 9\n0 7\n2 0\n7 5\n4 8\n13 7\n2 4\n5 6\n6 8\n3 2\n4 6\n7 8\n6 9\n7 7\n7 3\n9 5\n3 10\n7 2\n4 3\n2 0\n6 5\n5 3\n1 7\n1 7\n9 1\n10 4\n10 5\n4 2\n10 10\n0 7\n1 2\n10 1\n1 7\n3 7\n8 7\n5 2\n6 1\n3 1\n4 7\n7 10\n1 5\n10 8\n5 5\n5 1\n3 3\n1 6\n2 1\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey thinks he is truly a successful developer, but in reality he didn't know about the binary search algorithm until recently. After reading some literature Andrey understood that this algorithm allows to quickly find ... | [{"type": "stdin_stdout", "input": "1000 1000 999\n", "output": "756641425\n"}, {"type": "stdin_stdout", "input": "1000 501 501\n", "output": "646597996\n"}, {"type": "stdin_stdout", "input": "1000 888 888\n", "output": "644649893\n"}, {"type": "stdin_stdout", "input": "1000 500 500\n", "output": "646597996\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGardener Alexey teaches competitive programming to high school students. To congratulate Alexey on the Teacher's Day, the students have gifted him a collection of wooden sticks, where every stick has an integer length. No... | [{"type": "stdin_stdout", "input": "11\n9969 9945 12703 11114 8159 10000 9928 9985 6747 9181 9933\n", "output": "5991155360\n"}, {"type": "stdin_stdout", "input": "11\n9969 9945 12703 9914 8159 10000 9928 9985 6747 9939 9933\n", "output": "5907768442\n"}, {"type": "stdin_stdout", "input": "11\n9969 9945 12703 9914 8159... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach month Blake gets the report containing main economic indicators of the company \"Blake Technologies\". There are n commodities produced by the company. For each of them there is exactly one integer in the final repor... | [{"type": "stdin_stdout", "input": "100 30\n65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 65 74 57 115 16 55 102 79 97 21 80 41 56 49 103 61 66 1 36 44 43 82 37 38 106 27 114 51 112 55 87 41 69 31 86 58 27 46 99 18 105 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nThe International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business.\n\nOne of the unique features of this contest is the grea... | [{"type": "stdin_stdout", "input": "3\n1000\n342\n-1\n5\n-1\n2\n18\n11\n932\n5\n420\n1100\n0\n200\n685\n8\n353\n143\n402\n274\n283\n31\n402\n523\n0", "output": "342\n10\n435\n309\n"}, {"type": "stdin_stdout", "input": "3\n1000\n342\n0\n5\n2\n2\n11\n11\n932\n5\n148\n1000\n0\n200\n400\n8\n353\n242\n1097\n274\n283\n107\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have integer $n$. Calculate how many ways are there to fully cover belt-like area of $4n-2$ triangles with diamond shapes. \n\nDiamond shape consists of two triangles. You can move, rotate or flip the shape, but you c... | [{"type": "stdin_stdout", "input": "1\n1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1\n1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1\n1111011001\n", "output": "1111011001\n"}, {"type": "stdin_stdout", "input": "1\n1011011001\n", "output": "1011011001\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's that time of the year, Felicity is around the corner and you can see people celebrating all around the Himalayan region. The Himalayan region has n gyms. The i-th gym has g_{i} Pokemon in it. There are m distinct Pok... | [{"type": "stdin_stdout", "input": "100 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne way to create a task is to learn from life. You can choose some experience in real life, formalize it and then you will get a new task.\n\nLet's think about a scene in real life: there are lots of people waiting in fr... | [{"type": "stdin_stdout", "input": "100 1\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 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA girl named Sonya is studying in the scientific lyceum of the Kingdom of Kremland. The teacher of computer science (Sonya's favorite subject!) invented a task for her.\n\nGiven an array $a$ of length $n$, consisting only... | [{"type": "stdin_stdout", "input": "100 1000000000\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "216163471\n"}, {"type": "stdin_stdout", "input": "100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWinter is here at the North and the White Walkers are close. John Snow has an army consisting of n soldiers. While the rest of the world is fighting for the Iron Throne, he is going to get ready for the attack of the Whit... | [{"type": "stdin_stdout", "input": "4\n7 12 15 5\n", "output": "55\n"}, {"type": "stdin_stdout", "input": "4\n5 12 4 6\n", "output": "57\n"}, {"type": "stdin_stdout", "input": "4\n5 12 5 6\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "4\n7 6 15 5\n", "output": "49\n"}, {"type": "stdin_stdout", "input": "4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConstraints\n\n* 1 ≤ |V| ≤ 100\n* 0 ≤ |E| ≤ 9900\n* -2 × 107 ≤ di ≤ 2 × 107\n* There are no parallel edges\n* There are no self-loops\n\nInput\n\nAn edge-weighted graph G (V, E).\n\n\n|V| |E|\ns0 t0 d0\ns1 t1 d1\n:\ns|E|-... | [{"type": "stdin_stdout", "input": "15 6\n1 2 2\n1 3 -5\n1 2 3\n1 11 4\n2 0 1\n3 2 12", "output": "0 INF INF INF INF INF INF INF INF INF INF INF INF INF INF\n4 0 3 -5 INF INF INF INF INF INF INF 4 INF INF INF\n1 INF 0 INF INF INF INF INF INF INF INF INF INF INF INF\n13 INF 12 0 INF INF INF INF INF INF INF INF INF INF I... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an infinite 2-dimensional grid. The robot stands in cell $(0, 0)$ and wants to reach cell $(x, y)$. Here is a list of possible commands the robot can execute:\n\nmove north from cell $(i, j)$ to $(i, j + 1)$;\n\n... | [{"type": "stdin_stdout", "input": "100\n0 0\n0 1\n1 0\n1 1\n0 2\n1 2\n2 0\n2 1\n2 2\n0 3\n1 3\n2 3\n3 0\n3 1\n3 2\n3 3\n0 4\n1 4\n2 4\n3 4\n4 0\n4 1\n4 2\n4 3\n4 4\n0 5\n1 5\n2 5\n3 5\n4 5\n5 0\n5 1\n5 2\n5 3\n5 4\n5 5\n0 6\n1 6\n2 6\n3 6\n4 6\n5 6\n6 0\n6 1\n6 2\n6 3\n6 4\n6 5\n6 6\n0 7\n1 7\n2 7\n3 7\n4 7\n5 7\n6 7\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical O... | [{"type": "stdin_stdout", "input": "7 10\n1 0 1 0 0 0 1 0 1 0\n1 0 1 0 0 0 1 0 1 0\n1 1 1 1 1 1 1 1 1 1\n1 0 1 0 0 0 1 0 1 0\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1\n", "output": "YES\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n1 0 1 0 0 0 1 0 1 0\n0 0 0 0 0 0 0 0 0 0\n1 0 1 0 0 0 1 0 1 0\n1 0 1 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$n$ heroes fight against each other in the Arena. Initially, the $i$-th hero has level $a_i$.\n\nEach minute, a fight between two different heroes occurs. These heroes can be chosen arbitrarily (it's even possible that it... | [{"type": "stdin_stdout", "input": "2\n8\n1 9 1 9 8 10 10 10\n5\n10 10 10 10 10\n", "output": "6\n0\n"}, {"type": "stdin_stdout", "input": "2\n8\n1 9 1 9 8 10 10 10\n5\n10 10 10 10 10\n", "output": "6\n0\n"}, {"type": "stdin_stdout", "input": "2\n8\n1 9 1 9 8 10 16 10\n5\n10 10 10 10 10\n", "output": "6\n0\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLee was cleaning his house for the party when he found a messy string under the carpets. Now he'd like to make it clean accurately and in a stylish way...\n\nThe string $s$ he found is a binary string of length $n$ (i. e.... | [{"type": "stdin_stdout", "input": "5\n10\n0010111111\n4\n0000\n8\n01011111\n10\n1011010100\n1\n0\n", "output": "000111111\n0000\n0011111\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n10\n0010111111\n4\n1111\n8\n01011111\n10\n1011010100\n1\n0\n", "output": "000111111\n1111\n0011111\n0\n0\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a town in Zabaikalsky region), wants to rent three displays to highlight an important problem.\n\nThere are $n$ displays placed along a road,... | [{"type": "stdin_stdout", "input": "20\n804301132 586588704 822785255 552472140 16115810 148658854 66743034 628305150 677780684 931815125 208050516 401554301 954478790 571480982 387546138 832279893 641889899 80960260 717802881 172455365\n61699500 83254572 29028223 27833657 55743179 118122387 94729965 147554867 62937826... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant from the Zoo of Lviv has an array A that consists of N positive integers. Let A[i] be the i-th number in this array (i = 1, 2, ..., N).\n\nFind the minimal number x > 1 such that x is a divisor of all ... | [{"type": "stdin_stdout", "input": "2\n3\n2 4 8\n3\n4 7 5\n\n\n", "output": "2\n-1\n"}, {"type": "stdin_stdout", "input": "2\n3\n3 4 16\n3\n1 10 6", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\n1\n1 4 6\n1\n1 13 10", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\n2\n2 3 8\n3\n0 0 11", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTry guessing the statement from this picture: $3$ \n\nYou are given a non-negative integer $d$. You have to find two non-negative real numbers $a$ and $b$ such that $a + b = d$ and $a \\cdot b = d$.\n\n\n-----Input-----\... | [{"type": "stdin_stdout", "input": "7\n69\n0\n1\n4\n5\n999\n1010\n", "output": "Y 67.98507130050643 1.014928699493561\nY 0.0 0.0\nN\nY 2.000000021073422 1.999999978926578\nY 3.6180339887498913 1.3819660112501058\nY 997.9989969899639 1.0010030100361376\nY 1008.9990079355314 1.0009920644684442\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUser ainta loves to play with cards. He has a cards containing letter \"o\" and b cards containing letter \"x\". He arranges the cards in a row, and calculates the score of the deck by the formula below. At first, the sc... | [{"type": "stdin_stdout", "input": "79123 17331\n", "output": "6246978154\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCompare given two sequence $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ and $B = \\\\{b_0, b_1, ..., b_{m-1}$ lexicographically.\n\nConstraints\n\n* $1 \\leq n, m \\leq 1,000$\n* $0 \\leq a_i, b_i \\leq 1,000$\n\nInput\n\nThe i... | [{"type": "stdin_stdout", "input": "4\n0 4 12 1\n5\n1 2 5 4 1", "output": "1\n"}, {"type": "stdin_stdout", "input": "4\n1 4 1 1\n2\n-1 4 5 4 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1 4 1 1\n2\n-1 4 9 4 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1 4 1 1\n2\n-2 4 9 4 2", "output": "0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is preparing a contest, and now he has written a statement for an easy problem. The statement is a string of length $n$ consisting of lowercase Latin latters. Vasya thinks that the statement can be considered hard i... | [{"type": "stdin_stdout", "input": "25\ndadddhrdhradrdzzzahazaddr\n582987584 321035417 414785252 587245865 701672370 65936511 563890835 134108386 387506178 22811155 989335244 1206131752 445085282 809768866 105799145 196558041 1131981383 134067229 875977231 488184174 41982468 225574390 702881847 937432062 185455403\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet N be a positive odd number.\n\nThere are N coins, numbered 1, 2, \\ldots, N. For each i (1 \\leq i \\leq N), when Coin i is tossed, it comes up heads with probability p_i and tails with probability 1 - p_i.\n\nTaro ha... | [{"type": "stdin_stdout", "input": "5\n1.1614561119919404 1.1884479131493024 2.346315137474776 3.457070091264252 0.7256297605857085", "output": "0.0803727774076\n"}, {"type": "stdin_stdout", "input": "5\n1.1614561119919404 1.1884479131493024 2.346315137474776 4.129281462465055 0.7256297605857085", "output": "-0.1355589... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactly n skills. Each skill is represented by a non-n... | [{"type": "stdin_stdout", "input": "1 1000000000 1000 1000 1000000000000000\n1000000000\n", "output": "1000000001000\n1000000000 \n"}, {"type": "stdin_stdout", "input": "1 1000001000 1000 1000 1000000000000000\n1000000000\n", "output": "1000001001000\n1000001000\n"}, {"type": "stdin_stdout", "input": "1 1000000000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe \"Bulls and Cows\" game needs two people to play. The thinker thinks of a number and the guesser tries to guess it.\n\nThe thinker thinks of a four-digit number in the decimal system. All the digits in the number are ... | [{"type": "stdin_stdout", "input": "10\n0132 0 1\n6801 0 1\n8749 1 1\n8036 0 0\n7384 0 2\n8594 0 1\n9307 1 0\n7390 0 1\n6127 1 1\n0381 0 1\n", "output": "Incorrect data\n"}, {"type": "stdin_stdout", "input": "10\n8795 0 3\n4971 1 1\n5032 0 1\n5479 0 3\n2501 0 1\n9052 1 1\n3649 0 1\n1927 1 0\n9173 0 1\n8014 0 2\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.\nYou are given Q queries.\nIn the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that ... | [{"type": "stdin_stdout", "input": "6\n1 53\n7 129\n37 55\n19 51\n103 169\n13 33", "output": "4\n4\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "6\n1 53\n7 129\n65 55\n19 51\n17 169\n13 49", "output": "4\n4\n-1\n1\n4\n2\n"}, {"type": "stdin_stdout", "input": "6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi likes the sound when he buys a drink from a vending machine.\nThat sound can be heard by spending A yen (the currency of Japan) each time.\nTakahashi has B yen. He will hear the sound as many times as he can wit... | [{"type": "stdin_stdout", "input": "100 100 100\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 100 100\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "011 -1 106", "output": "-1\n"}, {"type": "stdin_stdout", "input": "001 -1 106", "output": "-1\n"}, {"type": "stdin_stdout", "input": "101 -1 106",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.\n\nThe teacher has written down the sum of multiple numbers. Pupils should calculate the sum. To m... | [{"type": "stdin_stdout", "input": "2+3+3+1+2+2+2+1+1+2+1+3+2+2+3+3+2+2+3+3+3+1+1+1+3+3+3+2+1+3+2+3+2+1+1+3+3+3+1+2+2+1+2+2+1+2+1+3+1+1\n", "output": "1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3+3\n"}, {"type": "stdin_stdout", "input": "2+1+2+2+1+3+2+3+1+1+2+1+2+2+3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe development of algae in a pond is as follows.\nLet the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:\n - x_{i+1} = rx_i - D\nYou are given r, D and x_{2... | [{"type": "stdin_stdout", "input": "28 -2 -1", "output": "-26\n-726\n-20326\n-569126\n-15935526\n-446194726\n-12493452326\n-349816665126\n-9794866623526\n-274256265458726\n"}, {"type": "stdin_stdout", "input": "17 -2 -1", "output": "-15\n-253\n-4299\n-73081\n-1242375\n-21120373\n-359046339\n-6103787761\n-103764391935\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSmeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise.\nYou are given Smeke's current rating, x. Print ABC i... | [{"type": "stdin_stdout", "input": "1000\n", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "2000\n", "output": "ARC\n"}, {"type": "stdin_stdout", "input": "0000", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "2936", "output": "ARC\n"}, {"type": "stdin_stdout", "input": "0100", "output": "ABC\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food inc... | [{"type": "stdin_stdout", "input": "20 58\n156216 11 152 99\n", "output": "191884.80000000002\n"}, {"type": "stdin_stdout", "input": "20 58\n93398 43 152 99\n", "output": "114790.40000000001\n"}, {"type": "stdin_stdout", "input": "18 46\n10753 23 46 140\n", "output": "3275.2000000000003\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactly n skills. Each skill is represented by a non-n... | [{"type": "stdin_stdout", "input": "5 5 10 20 50\n0 0 0 0 0\n", "output": " 150\n 5 5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe GCD table G of size n × n for an array of positive integers a of length n is defined by formula \n\n<image>\n\nLet us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest ... | [{"type": "stdin_stdout", "input": "5\n537163 537163 537163 537163 537163 537163 1074326 537163 537163 537163 515139317 1074326 537163 537163 537163 539311652 321760637 170817834 537163 537163 537163 537163 537163 537163 392666153\n", "output": "539311652 515139317 392666153 321760637 170817834 "}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangular grid of size $n \\times m$. Each cell has a number written on it; the number on the cell ($i, j$) is $a_{i, j}$. Your task is to calculate the number of paths from the upper-left cell ($1, 1$) to th... | [{"type": "stdin_stdout", "input": "10 10 524287\n1 2 4 8 16 32 64 128 256 512\n2 4 8 16 32 64 128 256 512 1024\n4 8 16 32 64 128 256 512 1024 2048\n8 16 32 64 128 256 512 1024 2048 4096\n16 32 64 128 256 512 1024 2048 4096 8192\n32 64 128 256 512 1024 2048 4096 8192 16384\n64 128 256 512 1024 2048 4096 8192 16384 3276... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n«One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.\n\nHowever, just counting dragons was boring as well, so she ente... | [{"type": "stdin_stdout", "input": "10\n10\n10\n10\n100000\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "10\n10\n10\n4\n100000\n", "output": "30000\n"}, {"type": "stdin_stdout", "input": "10\n10\n16\n4\n100000\n", "output": "30000\n"}, {"type": "stdin_stdout", "input": "1\n1\n1\n1\n100000\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr Keks is a typical white-collar in Byteland.\n\nHe has a bookshelf in his office with some books on it, each book has an integer positive price.\n\nMr Keks defines the value of a shelf as the sum of books prices on it. ... | [{"type": "stdin_stdout", "input": "30 4\n893642632982367 772277951746295 510759449350295 826812150840579 1060893142351815 525992742241552 154832018679993 645715002371268 27232975419720 475004229372388 200177708355593 810661468479466 49618609534806 301608930846726 97042172725806 441637617418914 594900693592862 62651070... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved com... | [{"type": "stdin_stdout", "input": "3 3 2 5\ndesolator\nrefresher\nperseverance\nvanguard: desolator 1, refresher 1\nmaelstorm: perseverance 2\n1 desolator\n2 perseverance\n1 refresher\n2 desolator\n2 perseverance\n", "output": "1\nvanguard 1\n2\ndesolator 1\nmaelstorm 1\n0\n"}, {"type": "stdin_stdout", "input": "2 3 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPrime numbers are widely applied for cryptographic and communication technology. A twin prime is a prime number that differs from another prime number by 2. For example, (5, 7) and (11, 13) are twin prime pairs.\n\nIn thi... | [{"type": "stdin_stdout", "input": "12\n110\n200\n300\n0", "output": "5 7\n107 109\n197 199\n281 283\n"}, {"type": "stdin_stdout", "input": "12\n110\n200\n227\n0", "output": "5 7\n107 109\n197 199\n197 199\n"}, {"type": "stdin_stdout", "input": "12\n110\n200\n329\n0", "output": "5 7\n107 109\n197 199\n311 313\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDO YOU EXPECT ME TO FIND THIS OUT?\n\nWHAT BASE AND/XOR LANGUAGE INCLUDES string?\n\nDON'T BYTE OF MORE THAN YOU CAN CHEW\n\nYOU CAN ONLY DISTORT THE LARGEST OF MATHEMATICS SO FAR\n\nSAYING \"ABRACADABRA\" WITHOUT A MAGIC... | [{"type": "stdin_stdout", "input": "10\n5 5 10 10 10 2 4 3 4 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n5 5 10 10 10 2 4 3 4 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n5 5 10 10 10 1 4 3 4 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n3 5 10 10 10 1 4 3 4 10\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSmith wakes up at the side of a dirty, disused bathroom, his ankle chained to pipes. Next to him is tape-player with a hand-written message \"Play Me\". He finds a tape in his own back pocket. After putting the tape in th... | [{"type": "stdin_stdout", "input": "15 6\naaa\naaabbb\naaabb\naaaaa\naaaaaa\naaaa\naaabbbb\naaaaa\naaaaaa\naaaa\naaabbbb\naabbbb\naa\naa\naab\na\n?a?\n??\n?aa?bb?\n?aa?aa?\n??aaa?\n", "output": "0\n4\n2\n5\n6\n7\n"}, {"type": "stdin_stdout", "input": "15 6\naaa\naaabbb\naaabb\naaaaa\naaaaaa\naaaa\naaabbbb\naaaaa\naaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLeha like all kinds of strange things. Recently he liked the function F(n, k). Consider all possible k-element subsets of the set [1, 2, ..., n]. For subset find minimal element in it. F(n, k) — mathematical expectation o... | [{"type": "stdin_stdout", "input": "7\n4 12 5 15 8 2 5\n2 1 2 0 1 1 1\n", "output": "4 12 2 15 8 5 5\n"}, {"type": "stdin_stdout", "input": "7\n4 12 5 8 10 2 3\n2 1 2 1 1 1 2\n", "output": "4 12 3 10 8 5 2\n"}, {"type": "stdin_stdout", "input": "7\n4 12 5 8 10 2 3\n2 2 2 1 1 1 2\n", "output": "5 4 3 12 10 8 2\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which computes the digit number of sum of two integers a and b.\n\nConstraints\n\n* 0 ≤ a, b ≤ 1,000,000\n* The number of datasets ≤ 200\n\nInput\n\nThere are several test cases. Each test case consists of... | [{"type": "stdin_stdout", "input": "-2 -1\n2 -15\n0110 -1", "output": "2\n3\n3\n"}, {"type": "stdin_stdout", "input": "10 10\n2 36\n1000 25", "output": "2\n2\n4\n"}, {"type": "stdin_stdout", "input": "-1 -1\n0 -1\n0111 14", "output": "2\n2\n3\n"}, {"type": "stdin_stdout", "input": "-2 -1\n0 -1\n0011 14", "output": "2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDothraki are planning an attack to usurp King Robert's throne. King Robert learns of this conspiracy from Raven and plans to lock the single door through which the enemy can enter his kingdom.\n\nBut, to lock the door he ... | [{"type": "stdin_stdout", "input": "wmtdtgddcldazqohcrpyjjebruxjxlstxmzqucvypaarrqyvhpurbyuuvteseyobmnuirrigsixjyweilabmzvhwpnovlexartiikrpcbmnckukwunkvktrziixwmwwgpeobxfgzstbepncmanhmibmrjlnxhldwpuxpzfotbryqeacgpmsypgrargxyrdwixwxybnscesviszqknlicrbcjhajafgkcekafxukcmfmhedrsqbwhczslbcngkxkohmvfjfjvmxctcvnswjaaksllwyti... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers re... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "111 136", "output": "1\n"}, {"type": "stdin_stdout", "input": "110 112", "output": "1\n"}, {"type": "stdin_stdout", "input": "011 127", "output": "1\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer K. Print the string obtained by repeating the string `ACL` K times and concatenating them.\n\nFor example, if K = 3, print `ACLACLACL`.\n\nConstraints\n\n* 1 \\leq K \\leq 5\n* All values in input... | [{"type": "stdin_stdout", "input": "451", "output": "ACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACLACL... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero and negative integers. Even stranger, the hotel is currently at full capa... | [{"type": "stdin_stdout", "input": "10\n3\n-14 -33 142\n16\n45 -84 35 85 69 -64 93 -70 0 -102 2 -52 -55 38 33 -98\n2\n5 0\n4\n-65 -113 5 6\n5\n82 -66 113 -81 -35\n5\n-125 107 -1 2 -10\n1\n25\n1\n-19\n1\n-8\n12\n32 41 43 -157 57 8 -86 111 -25 96 28 -44\n", "output": "NO\nNO\nNO\nNO\nNO\nNO\nYES\nYES\nYES\nNO\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA tatami mat, a Japanese traditional floor cover, has a rectangular form with aspect ratio 1:2. When spreading tatami mats on a floor, it is prohibited to make a cross with the border of the tatami mats, because it is bel... | [{"type": "stdin_stdout", "input": "6 12\n2 18\n0 0", "output": "4\n872\n"}, {"type": "stdin_stdout", "input": "5 18\n18 4\n0 0", "output": "10\n25\n"}, {"type": "stdin_stdout", "input": "14 14\n8 3\n0 0", "output": "2\n10\n"}, {"type": "stdin_stdout", "input": "8 10\n18 4\n0 0", "output": "1\n25\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBrave Ponta and his best friend, Brave Gonta, have come to Luida's bar in search of friends to embark on an epic adventure. There are many warriors, monks and wizards in the tavern who are itching to go on an adventure.\n... | [{"type": "stdin_stdout", "input": "5\n1 4 3 2 20\n19\n1 3 4 10\n0", "output": "10\n2\n"}, {"type": "stdin_stdout", "input": "5\n1 4 3 2 20\n19\n2 3 4 10\n0", "output": "10\n1\n"}, {"type": "stdin_stdout", "input": "5\n2 0 3 4 20\n29\n1 3 4 10\n0", "output": "11\n2\n"}, {"type": "stdin_stdout", "input": "5\n2 0 3 4 20\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs meticulous Gerald sets the table, Alexander finished another post on Codeforces and begins to respond to New Year greetings from friends. Alexander has n friends, and each of them sends to Alexander exactly one e-card.... | [{"type": "stdin_stdout", "input": "10\n5 1 6 2 8 3 4 10 9 7\n3 1 10 6 8 5 2 7 9 4\n2 9 1 4 10 6 8 7 3 5\n10 1 7 8 3 2 4 6 5 9\n3 2 10 4 7 8 5 6 1 9\n5 6 3 10 8 7 2 9 4 1\n6 5 1 3 2 7 9 10 8 4\n1 10 9 3 7 8 4 2 6 5\n6 8 4 5 9 1 2 10 7 3\n9 6 8 5 10 3 1 7 2 4\n5 7 4 8 9 6 1 10 3 2\n", "output": "5 1 1 1 4 5 5 1 4 5 \n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a string $s$ and a chip, which you can place onto any character of this string.\n\nAfter placing the chip, you move it to the right several (maybe zero) times, i. e. you perform the following operation several ti... | [{"type": "stdin_stdout", "input": "1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have A 500-yen coins, B 100-yen coins and C 50-yen coins (yen is the currency of Japan).\nIn how many ways can we select some of these coins so that they are X yen in total?\nCoins of the same kind cannot be distingui... | [{"type": "stdin_stdout", "input": "30\n40\n50\n6000\n", "output": "213\n"}, {"type": "stdin_stdout", "input": "30\n40\n77\n6000", "output": "293\n"}, {"type": "stdin_stdout", "input": "30\n47\n77\n6000", "output": "319\n"}, {"type": "stdin_stdout", "input": "30\n112\n134\n6415", "output": "0\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ cities numbered from $1$ to $n$, and city $i$ has beauty $a_i$.\n\nA salesman wants to start at city $1$, visit every city exactly once, and return to city $1$.\n\nFor all $i\\ne j$, a flight from city $i$ t... | [{"type": "stdin_stdout", "input": "30\n13 1\n111 5\n50 5\n61 0\n76 98\n110 1\n17 1\n4 17\n72 28\n75 90\n16 0\n13 12\n57 0\n47 12\n34 13\n61 120\n3 1\n134 100\n89 94\n88 10\n42 3\n93 33\n6 5\n81 48\n31 17\n32 0\n11 5\n69 1\n58 1\n3 21\n", "output": "750\n"}, {"type": "stdin_stdout", "input": "30\n13 1\n59 5\n50 5\n61 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n5 3\n4\n2\n5\n\n\nOutput\n\n5\n2\n4\n1\n3\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this prob... | [{"type": "stdin_stdout", "input": "92 1\n1\n-2\n2", "output": "1\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\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima worked all day and wrote down on a long paper strip his favorite number $n$ consisting of $l$ digits. Unfortunately, the strip turned out to be so long that it didn't fit in the Dima's bookshelf.\n\nTo solve the issu... | [{"type": "stdin_stdout", "input": "100\n8820100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000026601\n", "output": "88201000000000000000000000000000000000000000000000000000000000000000000000000000000000000026601\n"}, {"type": "stdin_stdout", "input": "100\n8820100000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining points are located on one side of the OY axis.\n\n\n-----Input-----\n\nThe first line co... | [{"type": "stdin_stdout", "input": "23\n-1 1\n-1 2\n-2 4\n-7 -8\n-3 3\n-9 -14\n-5 3\n-6 2\n-7 11\n-4 4\n-8 5\n1 1\n-1 -1\n-1 -2\n-2 -4\n-7 8\n-3 -3\n-9 14\n-5 -3\n-6 -2\n-7 -11\n-4 -4\n-8 -5\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "23\n-1 1\n-1 2\n-2 4\n-7 -8\n-3 3\n-9 -14\n-5 3\n-6 2\n-7 11\n-4 4\n-8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \nA new school in Byteland is now in the process of renewing some classrooms with new, stronger and better chairs, so that the students can stay still and pay a... | [{"type": "stdin_stdout", "input": "2\n8\n29", "output": "255\n536870911\n"}, {"type": "stdin_stdout", "input": "2\n8\n49", "output": "255\n949480668\n"}, {"type": "stdin_stdout", "input": "2\n21\n9", "output": "2097151\n511\n"}, {"type": "stdin_stdout", "input": "2\n4\n22", "output": "15\n4194303\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA superhero fights with a monster. The battle consists of rounds, each of which lasts exactly $n$ minutes. After a round ends, the next round starts immediately. This is repeated over and over again.\n\nEach round has the... | [{"type": "stdin_stdout", "input": "1000000000000 10\n-10 5 -2 -2 -10 -7 -5 -9 -3 -4\n", "output": "212765957448\n"}, {"type": "stdin_stdout", "input": "1000000000000 10\n-10 9 -2 -2 -10 -7 -5 -9 -3 -4\n", "output": "232558139536\n"}, {"type": "stdin_stdout", "input": "1000000000000 10\n-14 9 -2 -2 -10 -7 -5 -9 -3 -4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIkta, who hates to lose, has recently been enthusiastic about playing games using the Go board. However, neither Go nor Gomoku can beat my friends at all, so I decided to give a special training to the lesser-known game P... | [{"type": "stdin_stdout", "input": "...............\n...............\n...............\n...............\n...............\n...............\n...............\n...............\n...............\n...............\n...............\n....../........\n...............\n...............\n...............\n...............\n............... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of substrings \"ab\" in the string and replace it with the string \"bba\". If we have no \"ab\" as a substring,... | [{"type": "stdin_stdout", "input": "abaaaaaabaaaabbabbaaabbbbabababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabaababbabababbabbbbaabbaabbabbbabaabbaabbaaaaaab\n", "output": "235606597\n"}, {"type": "stdin_stdout", "input": "abaaaaaabaaaabbabbaaabbbbabababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabaababbabababbabbbbaabbaab... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a $n \\times m$ grid. You are standing at cell $(1, 1)$ and your goal is to finish at cell $(n, m)$.\n\nYou can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell... | [{"type": "stdin_stdout", "input": "9\n1 1 0\n2 2 4\n2 2 3\n2 2 -2\n1 1 1\n100 100 11000\n2 3 7\n3 1 9\n2 6 11\n", "output": "YES\nNO\nYES\nNO\nNO\nNO\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "9\n1 1 0\n2 2 4\n2 2 3\n2 2 -1\n2 1 1\n100 100 10000\n2 4 7\n3 1 9\n2 6 8\n", "output": "YES\nNO\nYES\nNO\nYES\nNO\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBees Alice and Alesya gave beekeeper Polina famous card game \"Set\" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, sh... | [{"type": "stdin_stdout", "input": "24 4\nSETS\nETES\nSSST\nESTE\nTSES\nSSES\nTESS\nSEEE\nETEE\nETSS\nSSEE\nESTT\nSTSS\nTTTT\nTEEE\nTSEE\nESET\nTTTE\nETTT\nSTEE\nSTTE\nESSS\nTEET\nTETE\n", "output": "31\n"}, {"type": "stdin_stdout", "input": "24 4\nSETS\nETES\nSSST\nESTE\nTSES\nSSES\nTESS\nEESE\nETEE\nETSS\nSSEE\nESTT\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got a list of program warning logs. Each record of a log stream is a string in this format: \"2012-MM-DD HH:MM:SS:MESSAGE\" (without the quotes). \n\nString \"MESSAGE\" consists of spaces, uppercase and lowercase ... | [{"type": "stdin_stdout", "input": "60 3\n2012-03-16 16:15:25: Disk size is\n2012-03-16 16:15:25: Network failute\n2012-03-16 16:16:29: Cant write varlog\n2012-03-16 16:16:42: Unable to start process\n2012-03-16 16:16:43: Disk size is too small\n2012-03-16 16:16:53: Timeout detected\n", "output": "2012-03-16 16:16:43\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\nWe will choose K adjacent dice, throw each of them independently, and c... | [{"type": "stdin_stdout", "input": "10 4\n17 13 13 12 15 20 10 13 17 11\n", "output": "32.000000000000\n"}, {"type": "stdin_stdout", "input": "10 4\n17 13 13 12 15 20 10 13 17 11", "output": "32.000000000000"}, {"type": "stdin_stdout", "input": "10 4\n17 21 13 12 15 20 10 13 17 11", "output": "33.5000000000\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N towns in JOI, which are connected by M bidirectional roads. There are shopping malls in K towns, and the people go to one of those towns through the road to shop.\n\nDepending on the location of your home, you... | [{"type": "stdin_stdout", "input": "10 3 1\n1 2 5\n3 3 2\n3 1 1\n2", "output": "7\n"}, {"type": "stdin_stdout", "input": "11 3 1\n1 1 1\n2 3 0\n3 1 1\n1", "output": "1\n"}, {"type": "stdin_stdout", "input": "10 3 1\n1 2 2\n2 3 2\n3 1 1\n1", "output": "3\n"}, {"type": "stdin_stdout", "input": "10 3 1\n1 2 2\n2 3 2\n2 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIf the strings are consecutive, you can replace the characters with a rule to shorten the string. For example, for the string AAAA, the expression @ 4A will compress one character. Create a program that restores the chara... | [{"type": "stdin_stdout", "input": "ab@5C1@8050\n@99,1=1@90", "output": "abCCCCC10000000050\n999999999,1=1000000000"}, {"type": "stdin_stdout", "input": "ab@5C2@8050\n@99,1=1@90", "output": "abCCCCC20000000050\n999999999,1=1000000000"}, {"type": "stdin_stdout", "input": "ab@5C1@8050\n@99+1<1@90", "output": "abCCCCC1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFacetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be described).\... | [{"type": "stdin_stdout", "input": "kmircqsffq\n14\nfrnf likes xgmmp's post\nfnfdpupayp commented on syz's post\nxefshpn commented on xgmmp's post\nm posted on gdwydzktok's wall\neskm likes pqmbnuc's post\npnqiapduhz likes zzqvjdz's post\nx likes nouuurc's post\nvnyxhoukuo posted on uhblapjab's wall\nblpjpxn likes zvwb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two non-negative integers L and R.\nWe will choose two integers i and j such that L \\leq i < j \\leq R.\nFind the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\n-----Constraints-----\n - All... | [{"type": "stdin_stdout", "input": "1999999216 1999999234\n", "output": "650\n"}, {"type": "stdin_stdout", "input": "1999999264 1999999270\n", "output": "26\n"}, {"type": "stdin_stdout", "input": "1999999266 1999999276\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "1999997173 1999999190\n", "output": "0\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAdvanced Creative Mobile (ACM) has decided to develop a GUI application to be installed in a new portable computer.\n\nAs shown in the figure below, the GUI has a nested structure in which it has one main panel, several p... | [{"type": "stdin_stdout", "input": "5\n<main>10,10,190,150<menu>20,20,70,140</menu><primary>80,20,180,140</primary></main>\n9 10\n0 17\n40 190\n2 3\n130 80\n0", "output": "OUT OF MAIN PANEL 1\nOUT OF MAIN PANEL 1\nOUT OF MAIN PANEL 1\nOUT OF MAIN PANEL 1\nprimary 0\n"}, {"type": "stdin_stdout", "input": "5\n<main>10,10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWelcome! Everything is fine.\n\nYou have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity.\n\nYou h... | [{"type": "stdin_stdout", "input": "2\n3\n1 2 3\n3 2 4\n2 4 3\n4 5 6\n5 6 5\n2\n1 2 1\n1 3 2\n1 4 3\n", "output": "15 33\n6 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 2 0\n3 2 4\n2 4 3\n4 5 6\n5 6 5\n2\n1 2 1\n1 3 2\n1 4 3\n", "output": "12 30\n6 6\n"}, {"type": "stdin_stdout", "input": "2\n3\n1 2 0\n3 1 4\n2 4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are decorating a Christmas Tree. \n\nAlice wants only $3$ types of ornaments to be used on the Christmas Tree: yellow, blue and red. They have $y$ yellow ornaments, $b$ blue ornaments and $r$ red ornaments.\... | [{"type": "stdin_stdout", "input": "100 100 100\n", "output": "297\n"}, {"type": "stdin_stdout", "input": "156 101 100\n", "output": "297\n"}, {"type": "stdin_stdout", "input": "156 111 100\n", "output": "297\n"}, {"type": "stdin_stdout", "input": "100 100 100\n", "output": "297"}, {"type": "stdin_stdout", "input": "99... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNew Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows $h$ hours and $m$ minutes, where $0 \\le hh < 24$ and $0 \\le mm < 60$. We use 24-hour ti... | [{"type": "stdin_stdout", "input": "5\n3 55\n22 30\n21 10\n20 21\n19 59\n", "output": "1205\n90\n170\n219\n241\n"}, {"type": "stdin_stdout", "input": "5\n4 55\n22 30\n21 10\n20 21\n19 59\n", "output": "1145\n90\n170\n219\n241\n"}, {"type": "stdin_stdout", "input": "5\n15 14\n22 45\n21 2\n0 21\n19 59\n", "output": "526\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree. Each vertex contains a_i tons of gold, which costs c_i per one ton. Initially, the tree consists only a root numbered 0 with a_0 tons of gold and price c_0 per ton.\n\nThere are q queries. Eac... | [{"type": "stdin_stdout", "input": "5 5 2\n2 0 2\n1 0 3 4\n2 2 4\n1 0 1 3\n2 4 2\n", "output": "\n2 4\n4 10\n1 3\n"}, {"type": "stdin_stdout", "input": "5 5 2\n2 0 2\n1 0 1 4\n2 2 4\n1 0 1 3\n2 4 2\n", "output": "2 4\n4 10\n1 3\n"}, {"type": "stdin_stdout", "input": "5 10 2\n2 0 2\n1 0 3 4\n2 2 4\n1 0 1 3\n2 4 2\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBajtek, known for his unusual gifts, recently got an integer array $x_0, x_1, \\ldots, x_{k-1}$.\n\nUnfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. After hours spent ... | [{"type": "stdin_stdout", "input": "100\n57 81 176 211 251 311 346 404 469 506 563 587 682 717 757 817 852 910 975 1012 1069 1093 1188 1223 1263 1323 1358 1416 1481 1518 1575 1599 1694 1729 1769 1829 1864 1922 1987 2024 2081 2105 2200 2235 2275 2335 2370 2428 2493 2530 2587 2611 2706 2741 2781 2841 2876 2934 2999 3036 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer array $a$ of length $n$.\n\nDoes there exist an array $b$ consisting of $n+1$ positive integers such that $a_i=\\gcd (b_i,b_{i+1})$ for all $i$ ($1 \\leq i \\leq n$)?\n\nNote that $\\gcd(x, y)$ de... | [{"type": "stdin_stdout", "input": "3\n7\n48 27 99 27 93 72 2\n5\n86 73 29 1 37\n9\n45 59 22 6 75 4 14 57 23\n", "output": "NO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "4\n1\n343\n2\n4 2\n3\n4 2 4\n4\n1 1 1 1\n", "output": "YES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "1\n8\n157 5487 4421 1774 4662 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEudokimus, a system administrator is in trouble again. As a result of an error in some script, a list of names of very important files has been damaged. Since they were files in the BerFS file system, it is known that eac... | [{"type": "stdin_stdout", "input": "b.baba.ebpbac.iabaeabac.abab.adabacaba.ahcggibij.adaacab.ebaba.aa.abacaba.dacabada.daqjcpc.jadab.dab\n", "output": "YES\nb.bab\na.ebp\nbac.iab\naeabac.aba\nb.ada\nbacaba.ahc\nggibij.ada\nacab.eba\nba.a\na.aba\ncaba.dac\nabada.daq\njcpc.jad\nab.dab\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.\n\nAlice received a set of Toy Train™ from Bob. It consists of one train and a co... | [{"type": "stdin_stdout", "input": "100 50\n29 35\n10 75\n29 34\n10 87\n29 13\n29 38\n41 21\n10 6\n29 94\n10 47\n31 27\n41 24\n41 8\n10 93\n41 52\n41 36\n31 32\n85 81\n31 32\n41 79\n41 99\n85 88\n41 25\n31 68\n41 93\n10 87\n85 97\n41 85\n10 64\n10 68\n85 22\n10 45\n85 15\n10 16\n10 21\n41 66\n29 68\n41 96\n29 34\n10 22... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{... | [{"type": "stdin_stdout", "input": "10000000000 99201 99975\n", "output": "992010000000000\n"}, {"type": "stdin_stdout", "input": "9999999995 82382 99996\n", "output": "309280000028478\n"}, {"type": "stdin_stdout", "input": "9999999997 38566 99996\n", "output": "309280000067758\n"}, {"type": "stdin_stdout", "input": "9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string $s$ of length $n$ can be encrypted by the following algorithm: iterate over all divisors of $n$ in decreasing order (i.e. from $n$ to $1$), for each divisor $d$, reverse the substring $s[1 \\dots d]$ (i.e. the ... | [{"type": "stdin_stdout", "input": "100\nedykhvzcntljuuoqghptioetqnfllwekzohiuaxelgecabvsbibgqodqxvyfkbyjwtgbyhvssntinkwsinwsmalusiwnjmtcoovf\n", "output": "fvooctmjnwisulamswniswknitnssvhybgtwjybkfyvxqdoqgbqteoitnczvkyedhljuuoqghptnfllwekzohiuaxelgecabvsbi\n"}, {"type": "stdin_stdout", "input": "100\nooooooooooooooooo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef Palin, as his name suggests, is always very interested in palindromic strings. Recently, he made a pretty interesting discovery on palindromes and that made him feel really Lucky. He came across something known as Lu... | [{"type": "stdin_stdout", "input": "3\nlatbcdkfy\nfeicedocljbux\naaaaaaba", "output": "luckykcul 8\nfluckyoykculf 10\nunlucky\n"}, {"type": "stdin_stdout", "input": "3\nytkdadfbl\ntobjlcedechwf\naabaaaba", "output": "luckykcul 8\nfluckyeykculf 10\nunlucky\n"}, {"type": "stdin_stdout", "input": "3\nytkdadfbl\ntobjlcfdec... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWilliam has an array of $n$ integers $a_1, a_2, \\dots, a_n$. In one move he can swap two neighboring items. Two items $a_i$ and $a_j$ are considered neighboring if the condition $|i - j| = 1$ is satisfied.\n\nWilliam wan... | [{"type": "stdin_stdout", "input": "5\n3\n2 4 6\n5\n4 4 4 4 4\n5\n1 3 5 10 12\n5\n1 1 1 1 1\n5\n4 8 10 6 2\n", "output": "-1\n-1\n3\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "5\n3\n2 4 12\n5\n4 4 4 4 4\n5\n1 2 5 14 9\n5\n2 2 0 1 2\n5\n4 0 10 6 2\n", "output": "-1\n-1\n0\n-1\n-1\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFamous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be n players participating, and the tournament will follow knockout rules from the very first game. ... | [{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "85\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "85\n"}, {"type": "stdin_stdout", "input": "123456789123456789\n", "output": "81\n"}, {"type": "stdin_stdout", "input": "679891637638612257\n", "output": "84\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N students in a school.\nWe will divide these students into some groups, and in each group they will discuss some themes.\nYou think that groups consisting of two or less students cannot have an effective discus... | [{"type": "stdin_stdout", "input": "1000\n", "output": "333\n"}, {"type": "stdin_stdout", "input": "303\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "807\n", "output": "269\n"}, {"type": "stdin_stdout", "input": "596\n", "output": "198\n"}, {"type": "stdin_stdout", "input": "604\n", "output": "201\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHave you ever used the chat application QQ? Well, in a chat group of QQ, administrators can muzzle a user for days.\n\nIn Boboniu's chat group, there's a person called Du Yi who likes to make fun of Boboniu every day.\n\n... | [{"type": "stdin_stdout", "input": "100 61 71\n11 18 0 47 33 75 91 13 8 21 73 64 50 97 62 50 2 36 68 32 64 74 32 77 81 41 23 44 40 36 45 33 21 68 57 79 75 23 67 37 99 27 30 56 75 62 75 63 46 19 79 42 11 66 21 25 2 12 89 48 75 7 57 85 80 14 82 29 66 47 29 10 1 84 79 39 33 81 73 51 80 67 52 25 38 68 57 53 38 83 83 3 86 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).\n\nYou are given a sequence $a$ consisting of $n$ integers.\n\nYou are ma... | [{"type": "stdin_stdout", "input": "93\n6 6 10 10 8 4 7 10 2 3 4 10 7 2 8 8 4 2 4 4 7 7 3 2 3 1 5 3 7 2 4 9 10 8 10 5 1 6 2 1 10 3 5 6 6 9 3 10 1 10 1 6 2 3 8 7 1 5 4 10 4 3 5 8 8 1 3 8 2 3 10 7 2 4 5 2 6 4 10 4 4 8 5 1 6 3 1 9 5 4 9 4 3\n", "output": "4\nRRLR\n"}, {"type": "stdin_stdout", "input": "93\n6 6 10 10 9 4 7... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.