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\nLittle Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.\n\nThe dot product of two integer number vectors x and y of size n is the sum of the produc... | [{"type": "stdin_stdout", "input": "5\n1 0 1 0 1\n0 1 0 1 -1\n1 0 1 0 1\n0 1 0 1 0\n1 0 1 0 1\n7\n3\n2 4\n1 3\n3\n1 5\n1 5\n3\n", "output": "111\n"}, {"type": "stdin_stdout", "input": "5\n1 0 1 0 1\n0 1 0 1 -1\n1 0 1 0 1\n0 0 0 1 0\n1 0 1 0 1\n7\n3\n2 4\n1 3\n3\n1 5\n1 5\n3\n", "output": "111\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a string s = s1s2...s|s|, where |s| is the length of string s, and si its i-th character. \n\nLet's introduce several definitions:\n\n * A substring s[i..j] (1 ≤ i ≤ j ≤ |s|) of string s is string sisi + 1...sj.... | [{"type": "stdin_stdout", "input": "AAAAAAAAAAAAAAAAXAAAAAAAAAAAAAAAAAAAAAAA\n", "output": "17\n1 39\n2 37\n3 35\n4 33\n5 31\n6 29\n7 27\n8 25\n9 23\n10 21\n11 19\n12 17\n13 15\n14 13\n15 11\n16 9\n40 1\n"}, {"type": "stdin_stdout", "input": "GERALDPAVELGERALDPAVEL\n", "output": "2\n11 2\n22 1\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.\n\nGiven a sequence a consisting of n integers. The player can m... | [{"type": "stdin_stdout", "input": "100\n4 8 10 1 8 8 8 1 10 3 1 8 6 8 6 1 10 3 3 3 3 7 2 1 1 4 10 1 7 9 8 10 3 8 6 2 2 6 7 6 10 8 9 11 2 3 10 5 3 9 10 5 10 8 8 5 7 8 2 5 3 9 9 2 7 8 1 10 4 9 2 8 10 19 5 8 5 1 7 3 4 5 2 5 9 3 2 5 6 2 3 10 1 5 9 6 10 4 10 8\n", "output": "383\n"}, {"type": "stdin_stdout", "input": "100\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNew Year is coming in Line World! In this world, there are n cells numbered by integers from 1 to n, as a 1 × n board. People live in cells. However, it was hard to move between distinct cells, because of the difficulty o... | [{"type": "stdin_stdout", "input": "120 104\n41 15 95 85 34 11 25 42 65 39 77 80 74 17 66 73 21 14 36 63 63 79 45 24 65 7 63 80 51 21 2 19 78 28 71 2 15 23 17 68 62 18 54 39 43 70 3 46 34 23 41 65 32 10 13 18 10 3 16 48 54 18 57 28 3 30 44 50 15 2 20 22 45 44 3 29 2 27 11 2 12 25 25 31 1 2 32 4 11 30 13 16 26 21 1 13 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImplication is a function of two logical arguments, its value is false if and only if the value of the first argument is true and the value of the second argument is false. \n\nImplication is written by using character '<... | [{"type": "stdin_stdout", "input": "200\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a polyline going through points (0, 0) – (x, x) – (2x, 0) – (3x, x) – (4x, 0) – ... - (2kx, 0) – (2kx + x, x) – .... \n\nWe know that the polyline passes through the point (a, b). Find minimum positive value x su... | [{"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "999999999.5000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 111111111\n", "output": "111111111.1000000000\n"}, {"type": "stdin_stdout", "input": "999999999 111111111\n", "output": "111111111.0000000000\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently personal training sessions have finished in the Berland State University Olympiad Programmer Training Centre. By the results of these training sessions teams are composed for the oncoming team contest season. Eac... | [{"type": "stdin_stdout", "input": "7\n4 19 14 8 21 16 2 18 1 15 3 17 13 5 6 10 9 7 12 11 20\n4 19 10\n14 8 3\n21 17 9\n16 6 12\n2 13 20\n18 1 7\n15 5 11\n21\n", "output": "3 4 8 9 10 14 17 1 2 5 6 7 11 12 13 15 16 18 19 20\n"}, {"type": "stdin_stdout", "input": "6\n6 4 10 16 14 11 13 1 7 17 18 15 5 3 9 12 2 8\n6 10 1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday, Wet Shark is given n bishops on a 1000 by 1000 grid. Both rows and columns of the grid are numbered from 1 to 1000. Rows are numbered from top to bottom, while columns are numbered from left to right.\n\nWet Shark ... | [{"type": "stdin_stdout", "input": "10\n646 171\n816 449\n375 934\n950 299\n702 232\n657 81\n885 306\n660 304\n369 371\n798 657\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n646 171\n816 449\n375 934\n950 299\n702 232\n657 81\n885 306\n660 304\n369 371\n886 657\n", "output": "0\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Vasya's uncle is a postman. The post offices are located on one circular road. Besides, each post office has its own gas station located next to it. Petya's uncle works as follows: in the morning he should leave th... | [{"type": "stdin_stdout", "input": "20\n10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10\n10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10\n", "output": "20\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \n"}, {"type": "stdin_stdout", "input": "20\n31 16 20 30 19 35 8 11 20 45 10 26 21 39 29 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call a string \"s-palindrome\" if it is symmetric about the middle of the string. For example, the string \"oHo\" is \"s-palindrome\", but the string \"aa\" is not. The string \"aa\" is not \"s-palindrome\", because... | [{"type": "stdin_stdout", "input": "mmmmmmmmmmmmmmmm\n", "output": "NIE\n"}, {"type": "stdin_stdout", "input": "mmmmmmmmmmmmmmmn\n", "output": "NIE\n"}, {"type": "stdin_stdout", "input": "nnnnnnnnnnnnn\n", "output": "NIE\n"}, {"type": "stdin_stdout", "input": "onnnnnnnnnnnn\n", "output": "NIE\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In partic... | [{"type": "stdin_stdout", "input": "LLVYUOXHBHUZSAPUMQEKWSQAFRKSMEENXDQYOPQFXNNFXSRBGXFUIRBFJDSDKQIDMCPPTWRJOZCRHZYZPBVUJPQXHNALAOCJDTTBDZWYDBVPMNSQNVMLHHUJAOIWFSEJEJSRBYREOZKHEXTBAXPTISPGIPOYBFFEJNAKKXAEPNGKWYGEJTNEZIXAWRSCEIRTKNEWSKSGKNIKDEOVXGYVEVFRGTNDFNWIFDRZQEJQZYIWNZXCONVZAKKKETPTPPXZMIVDWPGXOFODRNJZBATKGXAPXYHT... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new innovative ticketing systems for public transport is introduced in Bytesburg. Now there is a single travel card for all transport. To make a trip a passenger scan his card and then he is charged according to the far... | [{"type": "stdin_stdout", "input": "10\n13\n45\n46\n60\n103\n115\n126\n150\n256\n516\n", "output": "20\n20\n10\n0\n20\n0\n0\n20\n20\n10\n"}, {"type": "stdin_stdout", "input": "7\n000\n138\n279\n308\n381\n718\n1185\n", "output": "20\n20\n20\n20\n20\n20\n0\n"}, {"type": "stdin_stdout", "input": "7\n100\n138\n279\n308\n39... | 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\nIt is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with an... | [{"type": "stdin_stdout", "input": "95 97575868 5\n4612 1644 3613 5413 5649 2419 5416 3926 4610 4419 2796 5062 2112 1071 3790 4220 3955 2142 4638 2832 2702 2115 2045 4085 3599 2452 5495 4767 1368 2344 4625 4132 5755 5815 2581 6259 1330 4938 815 5430 1628 3108 4342 3692 2928 1941 3714 4498 4471 4842 1822 867 3395 2587 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have an array a consisting of n integers. Each integer from 1 to n appears exactly once in this array.\n\nFor some indices i (1 ≤ i ≤ n - 1) it is possible to swap i-th element with (i + 1)-th, for other indices it is... | [{"type": "stdin_stdout", "input": "70\n4 65 66 30 67 16 39 35 57 14 42 51 5 21 61 53 63 13 60 29 68 70 69 46 20 2 43 47 49 52 26 44 54 62 25 19 12 28 27 24 18 36 6 33 7 8 11 1 45 32 64 38 23 22 56 59 15 9 41 37 40 55 3 31 34 48 50 10 17 58\n111111101101111111111110101111111111111101101111010010110011011110010\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days ar... | [{"type": "stdin_stdout", "input": "01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "1\n245 1 2 3 4 5 6 7 8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFatland is a town that started with N distinct empires, namely empires 1, 2, ..., N. But over time, the armies of some of these empires have taken over other ones. Each takeover occurred when the army of empire i invaded ... | [{"type": "stdin_stdout", "input": "910\n845\n320 116\n616 455\n607 218\n542 586\n762 51\n450 256\n475 864\n386 824\n133 762\n695 875\n127 190\n184 350\n187 583\n107 869\n491 470\n130 569\n522 35\n503 448\n846 77\n401 752\n509 443\n819 370\n469 531\n246 619\n665 842\n872 527\n639 299\n309 270\n156 909\n478 233\n526 320... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA Magic Fraction for N is one that has the following properties:\nIt is a proper fraction (The value is < 1)\nIt cannot be reduced further (The GCD of the numerator and the denominator is 1)\nThe product of the numerator ... | [{"type": "stdin_stdout", "input": "200", "output": "179994270852429\n"}, {"type": "stdin_stdout", "input": "192", "output": "39256782497101\n"}, {"type": "stdin_stdout", "input": "188", "output": "26062642963789\n"}, {"type": "stdin_stdout", "input": "111", "output": "1586718029\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOur hero - Maga is going to make a new contest for making the best teams. He is really excited about it. There will be S students in the contest. First N students in the final standings will be awarded. \n\nHe has a list(... | [{"type": "stdin_stdout", "input": "100\n1000 487 496 124\n1000 955 57 16\n1000 123 729 34\n1000 930 1 0\n1000 617 985 798\n1000 350 499 403\n1000 533 124 30\n1000 851 773 745\n1000 310 521 358\n1000 784 714 498\n1000 159 409 397\n1000 487 589 341\n1000 493 105 72\n1000 190 252 125\n1000 417 241 191\n1000 257 733 109\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Watson learned the concept of coprime numbers and now he wonders given an array A1, A2 . . . AN what is the size of the largest subset of the array such that the each pair of elements in the subset is coprime.\n\... | [{"type": "stdin_stdout", "input": "10\n50\n30 9 21 27 20 34 13 30 10 22 41 35 14 2 26 26 1 35 29 18 9 40 16 10 24 49 26 28 48 23 28 21 9 26 42 24 30 18 26 23 13 40 5 16 30 26 21 26 45 11\n50\n26 5 7 20 7 19 28 46 30 12 22 20 50 43 23 16 50 15 11 40 43 46 36 46 44 49 9 41 5 44 7 22 1 34 36 48 17 23 3 1 5 25 32 9 5 36 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXenny had a list of N strings of equal length. He wanted to sort them by the first M characters only. That means, while sorting the list of strings, he only wanted to consider the first M characters of each string.\nHelp ... | [{"type": "stdin_stdout", "input": "3\n96 69 70\nqbhesygzakrsloihfigftfojmuhbnnziovfbgorczlrlelcxcnwbwdbvnnnyitoeigmzpixaycjrymltjbcflu\ngmuajozobpgxxvyzeilbzjjwkssjtfvtxhfdcgxwhktxvzbxuyjfwklcatveycdlyfyydksbmuysczboyeqzuf\niqfoijdbcdijccrhqlwpkdctmbqetmnbfjbvbwjcvkxxxecbsyiiadyqzkgzvdpclqyhfnilsohodnmoulsyqf\nqafeydv... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a sequence of integers A_1, A_2, ..., A_N. If its elements are pairwise distinct, print `YES`; otherwise, print `NO`.\n\nConstraints\n\n* 2 ≤ N ≤ 200000\n* 1 ≤ A_i ≤ 10^9\n* All values in input are integers.\n\nI... | [{"type": "stdin_stdout", "input": "2\n10000100 10000000", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2\n10000100 10001000", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2\n10000100 10101000", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2\n10010100 10101000", "output": "YES\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke received a positive integer N from Takahashi. A positive integer m is called a favorite number when the following condition is satisfied:\n\n* The quotient and remainder of N divided by m are equal, that is, \\lfloo... | [{"type": "stdin_stdout", "input": "1000010000000", "output": "2716922731275\n"}, {"type": "stdin_stdout", "input": "1000011000000", "output": "3307289212967\n"}, {"type": "stdin_stdout", "input": "1100011000000", "output": "2999416055122\n"}, {"type": "stdin_stdout", "input": "1110011000000", "output": "3146654438234\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S of length N consisting of lowercase English letters. We will cut this string at one position into two strings X and Y. Here, we would like to maximize the number of different letters contained in ... | [{"type": "stdin_stdout", "input": "45\ntgxgtqkyjfhyzutjjdllptdpxrbrylqfqjynmfbfucbio", "output": "10\n"}, {"type": "stdin_stdout", "input": "45\nbnxgtqkykfhyzutjjdllptdpxrtrylqfqjygmfbftcbio", "output": "11\n"}, {"type": "stdin_stdout", "input": "45\nblxhtqkyjehxzutkjdmlpidpurtrzlbfribgmhqfzcyto", "output": "12\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.\n\nThey will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon wi... | [{"type": "stdin_stdout", "input": "6\n1 30 1 10 -1 6", "output": "15\n"}, {"type": "stdin_stdout", "input": "6\n1 36 1 10 -1 6", "output": "21\n"}, {"type": "stdin_stdout", "input": "6\n1 36 1 10 -1 1", "output": "26\n"}, {"type": "stdin_stdout", "input": "6\n0 3 3 7 1 24", "output": "10\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side... | [{"type": "stdin_stdout", "input": "149696127901", "output": "27217477801"}, {"type": "stdin_stdout", "input": "86483718001", "output": "15724312364\n"}, {"type": "stdin_stdout", "input": "79402108049", "output": "14436746918\n"}, {"type": "stdin_stdout", "input": "59146214190", "output": "10753857126\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAizuwakamatsu City is known as the \"City of History\". About 400 years ago, the skeleton of the castle town was created by Gamo Ujisato, but after that, it became the central city of the Aizu clan 230,000 stones, whose a... | [{"type": "stdin_stdout", "input": "4\n4\n0,1,1500\n0,2,2000\n1,2,600\n2,3,500\n0", "output": "23\n"}, {"type": "stdin_stdout", "input": "4\n4\n0,1,1500\n0,2,2000\n1,2,600\n2,3,400\n0", "output": "22\n"}, {"type": "stdin_stdout", "input": "4\n4\n0,1,0500\n0,2,2000\n0,2,600\n2,3,400\n0", "output": "12\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 40XX, the Earth was invaded by aliens! Already most of the Earth has been dominated by aliens, leaving Tsuruga Castle Fortress as the only remaining defense base. Suppression units are approaching the Tsuruga Castle Fo... | [{"type": "stdin_stdout", "input": "110 5\n111 101 5 5\n110 110 2 3\n-112 -100 5 11\n-208 160 109 90\n-110 159 10 3\n26 11\n15 -1 5 2\n25 0 5 1\n35 0 5 1\n118 0 5 1\n55 0 5 1\n65 0 5 1\n149 -1 5 1\n169 0 1 1\n90 0 5 1\n-19 -1 5 20\n-30 0 500 5\n0 0", "output": "1\n4\n"}, {"type": "stdin_stdout", "input": "100 5\n111 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string and a number k. You are suggested to generate new strings by swapping any adjacent pair of characters in the string up to k times. Write a program to report the lexicographically smallest string amo... | [{"type": "stdin_stdout", "input": "pckoshien\n16", "output": "cehikposn\n"}, {"type": "stdin_stdout", "input": "pckoshien\n30", "output": "cehiknops\n"}, {"type": "stdin_stdout", "input": "pckosiien\n26", "output": "ceiiknops\n"}, {"type": "stdin_stdout", "input": "pckoshien\n14", "output": "cehkopisn\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn art exhibition will be held in JOI. At the art exhibition, various works of art from all over the country will be exhibited.\n\nN works of art were collected as candidates for the works of art to be exhibited. These wo... | [{"type": "stdin_stdout", "input": "3\n1 12\n26 -1\n2 0", "output": "12\n"}, {"type": "stdin_stdout", "input": "3\n1 11\n80 0\n2 -1", "output": "11\n"}, {"type": "stdin_stdout", "input": "3\n0 17\n14 1\n13 2", "output": "17\n"}, {"type": "stdin_stdout", "input": "3\n0 16\n54 3\n5 1", "output": "16\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProf. Hachioji has devised a new numeral system of integral numbers with four lowercase letters \"m\", \"c\", \"x\", \"i\" and with eight digits \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\". He doesn't use digit... | [{"type": "stdin_stdout", "input": "10\nxi x8i\ni 9i\nc2x2i 5c9x8i\nm2ci 4m7c9x8i\n8c9x8i i\ni 9m9c9x8i\nm i\ni m\nm9i i\n8m9c7xi c1x8i", "output": "2x9i\nx\n7c2x\n5m9c9x9i\n8c9x9i\n9m9c9x9i\nmi\nmi\nmx\n9m8x9i\n"}, {"type": "stdin_stdout", "input": "10\nxi x8i\ni 9i\nc2x3i 5c8x8i\nm2ci 4m7c9x8i\n9c8x9i i\ni 9m9c9x8i\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour task in this problem is to create a program that finds the shortest path between two given locations on a given street map, which is represented as a collection of line segments on a plane.\n\n<image>\n\nFigure 4 is ... | [{"type": "stdin_stdout", "input": "8\n1 1\n4 4\n1 1 4 1\n1 1 1 4\n3 1 3 4\n4 3 5 3\n2 4 3 5\n4 1 4 4\n3 3 2 2\n1 4 4 4\n9\n1 5\n5 1\n5 4 5 1\n1 5 1 1\n1 5 5 1\n2 3 2 4\n5 4 1 5\n1 2 2 1\n4 2 4 1\n1 1 5 1\n5 3 4 3\n11\n5 5\n1 0\n3 1 5 1\n4 3 4 2\n3 1 5 5\n2 3 2 2\n1 0 1 2\n1 2 3 4\n3 4 5 5\n1 0 5 2\n4 0 4 1\n5 5 5 1\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nN people run a marathon. There are M resting places on the way. For each resting place, the i-th runner takes a break with probability P_i percent. When the i-th runner takes a break, he gets rest for T_i time.\n\nThe i-t... | [{"type": "stdin_stdout", "input": "3 2 100\n-1 2 2\n50 -1 1\n83 2 2", "output": "0.9767033300\n0.0000000000\n-0.0005526700\n"}, {"type": "stdin_stdout", "input": "3 5 010\n-1 2 2\n55 0 1\n22 2 2", "output": "0.7318185458\n-0.0000007555\n-0.0143144522\n"}, {"type": "stdin_stdout", "input": "3 3 111\n-1 1 2\n1 0 2\n126 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are a secret agent from the Intelligence Center of Peacemaking Committee. You've just sneaked into a secret laboratory of an evil company, Automated Crime Machines.\n\nYour mission is to get a confidential document ke... | [{"type": "stdin_stdout", "input": "10 1\n3\n1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "7 1\n6\n-1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "11 1\n3\n1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6 2\n10\n3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "7 1\n6\n-2",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou received a card with an integer $S$ and a multiplication table of infinite size. All the elements in the table are integers, and an integer at the $i$-th row from the top and the $j$-th column from the left is $A_{i,j... | [{"type": "stdin_stdout", "input": "62118", "output": "1280\n"}, {"type": "stdin_stdout", "input": "83160", "output": "5120"}, {"type": "stdin_stdout", "input": "10614", "output": "128\n"}, {"type": "stdin_stdout", "input": "20928", "output": "112\n"}, {"type": "stdin_stdout", "input": "11016", "output": "560\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given two segments s1 and s2, print the distance between them.\n\ns1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3.\n\nConstraints\n\n* 1 ≤ q ≤ 1000\n* -10000 ≤ xpi, ypi ≤ 10000\n* p0 ≠ p... | [{"type": "stdin_stdout", "input": "3\n-1 -1 -1 -6 -1 1 1 1\n0 -1 18 -1 2 0 -1 2\n-11 1 2 -1 0 2 -1 0", "output": "2.0000000000\n1.0000000000\n0.5322001449\n"}, {"type": "stdin_stdout", "input": "3\n-1 -1 -1 -6 -1 1 1 1\n0 -1 18 -1 2 0 -1 2\n-11 1 3 -1 0 2 -1 0", "output": "2.0000000000\n1.0000000000\n0.4242640687\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a sequence of integers $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ and reverse specified elements by a list of the following operation:\n\n* reverse($b, e$): reverse the order of $a_b, a_{b+1}, ...,... | [{"type": "stdin_stdout", "input": "8\n0 12 -4 1 20 -1 2 1\n1\n5 1\n-3 -1", "output": "0 12 -4 1 20 -1 2 1\n"}, {"type": "stdin_stdout", "input": "8\n0 12 -4 1 20 -1 2 0\n0\n5 1\n-3 -1", "output": "0 12 -4 1 20 -1 2 0\n"}, {"type": "stdin_stdout", "input": "8\n0 12 -2 1 20 -1 2 0\n0\n5 3\n-3 -1", "output": "0 12 -2 1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are looking at the floor plan of the Summer Informatics School's new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it ... | [{"type": "stdin_stdout", "input": "100000000 100000000 100000000 100000000 1\n100000000 100000000 100001000 1\n", "output": "100000999\n"}, {"type": "stdin_stdout", "input": "100000000 100000000 100000000 100000000 1\n100000000 100000000 100000000 1\n", "output": "99999999\n"}, {"type": "stdin_stdout", "input": "3 6 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAcingel is a small town. There was only one doctor here — Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead in her house? Mr Gawry, worl... | [{"type": "stdin_stdout", "input": "20 5\n8 1 13 19 3 14 5 2 4 6 12 18 20 17 16 15 11 10 7 9\n12 18 20 17 16 15 11 10 7 9 8 1 13 19 3 14 5 2 4 6\n5 2 4 6 12 18 20 17 16 15 11 10 7 9 8 1 13 19 3 14\n5 2 4 6 12 18 20 17 16 15 11 10 7 9 8 1 13 19 3 14\n8 1 13 19 3 14 5 2 4 6 12 18 20 17 16 15 11 10 7 9\n", "output": "86\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova's house is an array consisting of n elements (yeah, this is the first problem, I think, where someone lives in the array). There are heaters in some positions of the array. The i-th element of the array is 1 if there... | [{"type": "stdin_stdout", "input": "187 64\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya got really tired of these credits (from problem F) and now wants to earn the money himself! He decided to make a contest to gain a profit.\n\nVasya has n problems to choose from. They are numbered from 1 to n. The d... | [{"type": "stdin_stdout", "input": "22 936\n20 743\n55 46\n83 282\n157 3\n168 979\n241 338\n293 113\n312 292\n333 509\n339 632\n345 149\n347 109\n384 846\n420 151\n619 923\n647 336\n706 935\n726 600\n760 45\n804 126\n810 739\n906 341\n", "output": " 3371\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers. Beauty of array is the maximum sum of some consecutive subarray of this array (this subarray may be empty). For example, the beauty of the array [10, -5, 10, -4, 1] is 15... | [{"type": "stdin_stdout", "input": "42 0\n286046708 375522374 -729242288 -594215986 -417878652 197367358 -252467864 -633931002 396498018 -511564535 -989028451 133570042 -189524845 -823874429 -29495943 609283144 349227466 -228464789 -326269641 -837429605 310547279 27725681 -167613209 -86658444 900798243 607258117 280296... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice is the leader of the State Refactoring Party, and she is about to become the prime minister. \n\nThe elections have just taken place. There are n parties, numbered from 1 to n. The i-th party has received a_i seats ... | [{"type": "stdin_stdout", "input": "100\n100 48 48 22 21 27 51 43 53 34 54 37 45 37 27 53 39 53 37 44 55 44 31 36 55 47 45 23 40 32 55 54 40 38 30 25 28 20 39 20 53 50 41 26 29 37 42 55 23 27 51 30 39 50 24 30 22 50 56 32 60 45 50 43 27 25 52 59 47 58 28 56 49 39 33 52 26 46 23 42 45 58 42 50 49 25 28 30 46 43 26 32 40... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob have received three big piles of candies as a gift. Now they want to divide these candies as fair as possible. To do this, Alice takes one pile of candies, then Bob takes one of the other two piles. The last... | [{"type": "stdin_stdout", "input": "4\n1 3 4\n1 10 100\n10000000000000000 10000000000000000 10000000000000000\n23 34 45\n", "output": "4\n55\n15000000000000000\n51\n"}, {"type": "stdin_stdout", "input": "4\n1 3 4\n1 10 100\n10000000000000000 10000000000000000 10000000000000000\n23 34 22\n", "output": "4\n55\n1500000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is reading a book consisting of n pages numbered from 1 to n. Every time he finishes the page with the number divisible by m, he writes down the last digit of this page number. For example, if n=15 and m=5, pages... | [{"type": "stdin_stdout", "input": "7\n1 1\n10 1\n100 3\n1024 14\n998244353 1337\n123 144\n1234312817382646 13\n", "output": "1\n45\n153\n294\n3359835\n0\n427262129093995\n"}, {"type": "stdin_stdout", "input": "7\n1 1\n10 2\n100 3\n1024 14\n998244353 1337\n123 144\n1234312817382646 13\n", "output": "1\n20\n153\n294\n33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice got a new doll these days. It can even walk!\n\nAlice has built a maze for the doll and wants to test it. The maze is a grid with n rows and m columns. There are k obstacles, the i-th of them is on the cell (x_i, y_... | [{"type": "stdin_stdout", "input": "10 10 70\n10 4\n5 5\n6 10\n8 9\n3 8\n10 9\n10 10\n8 2\n2 10\n7 2\n7 3\n10 2\n8 3\n9 8\n2 9\n3 1\n6 5\n6 9\n2 8\n10 7\n8 4\n8 6\n7 6\n5 6\n9 10\n3 9\n5 8\n4 8\n3 10\n10 5\n5 2\n5 4\n8 8\n3 2\n3 6\n2 3\n1 9\n6 6\n2 4\n6 2\n5 3\n6 4\n7 9\n2 2\n5 9\n7 10\n7 8\n3 3\n2 6\n7 5\n8 10\n3 4\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the harder version of the problem. In this version, 1 ≤ n ≤ 10^6 and 0 ≤ a_i ≤ 10^6. You can hack this problem if you locked it. But you can hack the previous problem only if you locked both problems\n\nChristmas ... | [{"type": "stdin_stdout", "input": "100\n61 28 67 53 13 6 70 5 79 82 60 60 27 17 80 25 82 82 69 76 81 43 58 86 18 78 4 25 8 30 33 87 91 18 90 26 62 11 28 66 9 33 58 66 47 48 80 38 25 57 4 84 79 71 54 159 63 32 97 62 26 68 5 69 54 93 25 26 100 73 24 94 118 39 30 45 95 80 0 29 57 98 92 15 17 76 69 11 57 56 48 10 28 7 63 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers a and b. You can perform a sequence of operations: during the first operation you choose one of these numbers and increase it by 1; during the second operation you choose one of these numbers an... | [{"type": "stdin_stdout", "input": "3\n1 3\n11 11\n30 20\n", "output": "3\n0\n4\n"}, {"type": "stdin_stdout", "input": "3\n0 3\n11 11\n30 20\n", "output": "2\n0\n4\n"}, {"type": "stdin_stdout", "input": "3\n1 3\n11 1\n30 20\n", "output": "3\n4\n4\n"}, {"type": "stdin_stdout", "input": "3\n1 3\n11 0\n30 20\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of lowercase Latin letters. Let the length of s be |s|. You may perform several operations on this string.\n\nIn one operation, you can choose some index i and remove the i-th character... | [{"type": "stdin_stdout", "input": "100\naaaaaabbcccccccddffffhhhhhhhhiiiiiikkkkkkkkmmmmmmooooooopppprrrrrrrrrttttttvvvvvvvvvvvvxxxxxxxzzzzzz\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "100\nbabaababbaabbabababbabbbababababbaabababaaababaababbbaaababbaabbababababbababbabaabbaabaaaaabbababba\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDenis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally... Denis asks her to be to... | [{"type": "stdin_stdout", "input": "10 10\n1101001\n0110000\n0111010\n0010000\n1010000\n0111000\n1011011\n1010010\n1101011\n1111110\n", "output": "9941743758\n"}, {"type": "stdin_stdout", "input": "10 10\n0101111\n0000000\n1111011\n1011011\n1011011\n1111011\n0010010\n1010010\n1101111\n0000000\n", "output": "8993391761\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmong Johnny's numerous hobbies, there are two seemingly harmless ones: applying bitwise operations and sneaking into his dad's office. As it is usually the case with small children, Johnny is unaware that combining these... | [{"type": "stdin_stdout", "input": "6\n4\n1 0 2 5\n6\n10 7 14 16 0 12\n2\n0 1\n3\n1 2 6\n6\n1 4 6 10 11 20\n2\n0 1023\n", "output": "-1\n-1\n1\n-1\n-1\n1023\n"}, {"type": "stdin_stdout", "input": "6\n4\n1 0 2 6\n6\n10 7 27 16 1 12\n2\n0 1\n3\n1 2 6\n6\n0 8 6 10 11 33\n2\n0 1023\n", "output": "-1\n11\n1\n-1\n-1\n1023\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the hard version of the problem. The difference between the versions is the constraint on n and the required number of operations. You can make hacks only if all versions of the problem are solved.\n\nThere are tw... | [{"type": "stdin_stdout", "input": "5\n2\n01\n10\n5\n01011\n11100\n2\n01\n01\n10\n0110011011\n1000110100\n1\n0\n1\n", "output": "3 1 2 1\n5 1 2 3 5 3\n4 1 2 2 1\n11 1 3 5 7 8 10 8 7 6 4 1\n1 1\n"}, {"type": "stdin_stdout", "input": "5\n2\n01\n10\n5\n01011\n11100\n2\n01\n01\n10\n0110011011\n1000110100\n1\n0\n1\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have given an array a of length n and an integer x to a brand new robot. What the robot does is the following: it iterates over the elements of the array, let the current element be q. If q is divisible by x, the robo... | [{"type": "stdin_stdout", "input": "1\n20 9\n288 279 252 279 288 207 261 270 297 288 276 265 209 217 214 300 227 221 215 271\n", "output": "7833\n"}, {"type": "stdin_stdout", "input": "1\n20 9\n288 279 252 279 288 207 261 270 297 288 276 265 209 217 214 300 227 221 215 113\n", "output": "7675\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n rectangles, each of height 1. Each rectangle's width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x). \n\nYou are also given a two-dimensional box of width W. Note that... | [{"type": "stdin_stdout", "input": "2\n5 16\n1 2 8 4 8\n6 10\n2 8 8 2 2 8\n", "output": "\n2\n3\n"}, {"type": "stdin_stdout", "input": "2\n5 20\n1 2 16 2 8\n6 12\n4 8 8 4 2 8\n", "output": "2\n3\n"}, {"type": "stdin_stdout", "input": "2\n5 13\n2 2 8 2 8\n6 23\n1 16 8 2 2 1\n", "output": "2\n2\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has 26 tasks. Each task is designated by a capital letter of the Latin alphabet.\n\nThe teacher asked Polycarp to solve tasks in the following way: if Polycarp began to solve some task, then he must solve it to t... | [{"type": "stdin_stdout", "input": "5\n3\nABA\n11\nDDBBCCCBBEZ\n7\nFFGZZZY\n1\nZ\n2\nAB\n", "output": "\nNO\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "1\n24\nDEBOOFORCEDMETODOTHISSMH\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n11\nDEBOOFORCEDMETODOTHISSMH\n", "output": "No\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of positive integers a = [a_0, a_1, ..., a_{n - 1}] (n ≥ 2).\n\nIn one step, the array a is replaced with another array of length n, in which each element is the [greatest common divisor (GCD)](http... | [{"type": "stdin_stdout", "input": "1\n97\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n97\n1 1 1 1 1 1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe country Treeland consists of n cities, some pairs of them are connected with unidirectional roads. Overall there are n - 1 roads in the country. We know that if we don't take the direction of the roads into considerat... | [{"type": "stdin_stdout", "input": "15\n15 6\n2 15\n14 15\n15 12\n1 2\n10 15\n14 4\n13 7\n11 1\n5 2\n7 2\n3 2\n14 8\n9 15\n", "output": "7\n11 13\n"}, {"type": "stdin_stdout", "input": "15\n15 6\n2 15\n14 15\n15 12\n1 2\n10 15\n14 4\n13 7\n11 1\n5 2\n7 2\n3 2\n7 8\n9 15\n", "output": "7\n11 13\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus is the director of a large corporation. There are n secretaries working for the corporation, each of them corresponds via the famous Spyke VoIP system during the day. We know that when two people call each othe... | [{"type": "stdin_stdout", "input": "123\n0 6361 8903 10428 0 258 0 10422 0 0 2642 1958 0 0 0 0 0 8249 1958 0 0 2642 0 0 0 11566 4709 1847 3998 0 1331 0 0 10289 2739 6135 3450 0 0 10994 6069 4337 5854 1331 5854 0 630 630 11244 5928 2706 0 683 214 0 9080 0 0 0 10422 683 11566 10994 0 0 3450 11244 11542 3998 1847 2708 987... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSmart Beaver decided to be not only smart, but also a healthy beaver! And so he began to attend physical education classes at school X. In this school, physical education has a very creative teacher. One of his favorite w... | [{"type": "stdin_stdout", "input": "200\n1 2 1 1 2 2 1 1 1 1 1 1 2 1 2 2 2 2 2 1 2 2 1 1 2 2 2 2 2 1 2 1 1 2 2 2 1 2 2 2 1 1 2 2 2 1 2 2 1 2 1 2 2 1 2 2 2 2 2 1 2 2 1 2 1 1 2 2 2 2 2 2 2 1 2 2 2 1 1 2 1 2 2 1 1 2 2 1 1 1 2 2 1 1 2 2 1 1 2 2 2 1 2 2 2 1 2 1 2 2 2 2 2 2 2 1 1 1 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 1 2 1 2 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXenia the beginner programmer has a sequence a, consisting of 2n non-negative integers: a1, a2, ..., a2n. Xenia is currently studying bit operations. To better understand how they work, Xenia decided to calculate some val... | [{"type": "stdin_stdout", "input": "2 10\n47 17 22 0\n2 15\n2 42\n1 9\n3 13\n3 28\n1 20\n1 13\n1 50\n2 20\n2 12\n", "output": "57\n57\n61\n38\n55\n34\n51\n38\n42\n34\n"}, {"type": "stdin_stdout", "input": "2 10\n47 17 22 0\n4 15\n2 42\n1 9\n3 13\n3 28\n1 20\n1 13\n1 50\n2 20\n2 12\n", "output": "32\n48\n52\n36\n52\n33\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forward and ... | [{"type": "stdin_stdout", "input": "6\nK.......\n........\n.##..##.\n#..##..#\n........\n...##...\n.#....#.\n..####.K\n\n.......K\n........\n.##..##.\n#..##..#\n........\n...##...\n.#....#.\nK.####..\n\nK.......\n........\n.##..##.\n#..##..#\n........\n...##...\n.#....#.\nK.####..\n\n.......K\n........\n.##..##.\n#..##... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Chris is participating in a graph cutting contest. He's a pro. The time has come to test his skills to the fullest.\n\nChris is given a simple undirected connected graph with n vertices (numbered from 1 to n) and m... | [{"type": "stdin_stdout", "input": "8 30\n10 4\n3 8\n3 2\n10 1\n3 5\n3 4\n5 1\n8 2\n8 4\n3 10\n7 9\n3 6\n9 5\n5 10\n7 6\n7 5\n9 1\n2 7\n9 10\n1 4\n9 8\n6 2\n2 1\n7 1\n6 4\n4 5\n2 14\n10 8\n7 8\n5 2\n", "output": "3 5 1\n10 5 7\n4 5 2\n5 9 1\n10 9 8\n3 6 2\n4 6 7\n9 7 1\n8 7 2\n3 2 1\n14 2 8\n4 8 10\n8 3 10\n3 4 1\n4 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price ... | [{"type": "stdin_stdout", "input": "4\n4 2\n6 1\n2 6\n-2 11\n", "output": "Happy Alex\n"}, {"type": "stdin_stdout", "input": "4\n4 1\n6 2\n2 5\n-1 4\n", "output": "Happy Alex\n"}, {"type": "stdin_stdout", "input": "4\n4 1\n6 2\n2 5\n-2 4\n", "output": "Happy Alex\n"}, {"type": "stdin_stdout", "input": "4\n4 1\n6 2\n2 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are r red and g green blocks for construction of the red-green tower. Red-green tower can be built following next rules:\n\n * Red-green tower is consisting of some number of levels;\n\n * Let the red-green tower ... | [{"type": "stdin_stdout", "input": "136749 183300\n", "output": "906576609\n"}, {"type": "stdin_stdout", "input": "200000 199999\n", "output": "396481680\n"}, {"type": "stdin_stdout", "input": "199585 199585\n", "output": "199771918\n"}, {"type": "stdin_stdout", "input": "107344 159729\n", "output": "849320920\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEverybody knows that the capital of Berland is connected to Bercouver (the Olympic capital) by a direct road. To improve the road's traffic capacity, there was placed just one traffic sign, limiting the maximum speed. Tra... | [{"type": "stdin_stdout", "input": "2000 10000\n8000 4000 4000\n", "output": "2.828427124746\n"}, {"type": "stdin_stdout", "input": "5527 8154\n3974 3550 1639\n", "output": "1.555031897139\n"}, {"type": "stdin_stdout", "input": "9788 8432\n2795 2025 3436\n", "output": "0.863942827831\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given the current time in 24-hour format hh:mm. Find and print the time after a minutes.\n\nNote that you should find only the time after a minutes, see the examples to clarify the problem statement.\n\nYou can re... | [{"type": "stdin_stdout", "input": "00:00\n10000\n", "output": "22:40\n"}, {"type": "stdin_stdout", "input": "12:34\n10000\n", "output": "11:14\n"}, {"type": "stdin_stdout", "input": "00:00\n00000\n", "output": "00:00\n"}, {"type": "stdin_stdout", "input": "14:32\n10000\n", "output": "13:12\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe term of this problem is the same as the previous one, the only exception — increased restrictions.\n\nInput\n\nThe first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ 109) — the number of ingre... | [{"type": "stdin_stdout", "input": "80 979\n2 1 1 1 2 1 1 1 3 1 4 4 2 1 1 3 1 1 2 1 4 1 1 2 5 4 8 1 3 6 5 7 2 3 4 1 2 2 6 1 2 2 4 1 1 2 3 2 8 1 1 3 3 4 1 1 2 1 4 4 1 4 3 2 6 5 2 1 4 1 2 3 2 1 3 3 2 2 1 3\n498 976 513 869 917 914 664 656 957 893 981 947 985 693 576 958 987 822 981 718 884 729 295 683 485 998 730 894 731... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nR3D3 spent some time on an internship in MDCS. After earning enough money, he decided to go on a holiday somewhere far, far away. He enjoyed suntanning, drinking alcohol-free cocktails and going to concerts of popular loc... | [{"type": "stdin_stdout", "input": "100000000 100000000 100000000\n", "output": "266578227200000000\n"}, {"type": "stdin_stdout", "input": "100000000 100000010 100000000\n", "output": "266578239852872360\n"}, {"type": "stdin_stdout", "input": "100000000 50000000 100000000\n", "output": "191720992950000000\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nInput\n\nThe input consists of four lines, each line containing a single digit 0 or 1.\n\nOutput\n\nOutput a single digit, 0 or 1.\n\nExample\n\nInput\n\n0\n1\n1\n0\n\n\nOutput\n\n0\n\nThe input will be given v... | [{"type": "stdin_stdout", "input": "0\n1\n1\n0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n0\n0\n1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "0\n1\n0\n0\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1\n1\n0\n1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "0\n1\n0\n1\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": "abaaaaaabaaaabbabbaaabbbbabababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabaababbabababbabbbbabbbaabbabbbabaabbaabbaaaaaab\n", "output": "502032780\n"}, {"type": "stdin_stdout", "input": "abaaaaaabaaaabbabbaaabbababababaaaaabbaabbaaaaabbbaababaaaaaaabbbbbaaaaabbababbabababbabbbbabbbaab... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is known that passages in Singer house are complex and intertwined. Let's define a Singer k-house as a graph built by the following process: take complete binary tree of height k and add edges from each vertex to all i... | [{"type": "stdin_stdout", "input": "181\n", "output": "421742777\n"}, {"type": "stdin_stdout", "input": "261\n", "output": "952127278\n"}, {"type": "stdin_stdout", "input": "121\n", "output": "631667314\n"}, {"type": "stdin_stdout", "input": "351\n", "output": "625447969\n"}, {"type": "stdin_stdout", "input": "141\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWinnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are winding paths between each pair... | [{"type": "stdin_stdout", "input": "100\n100\n100\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "100\n100\n110\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "100\n100\n111\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "100\n100\n010\n100\n", "output": "990\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter likes to travel by train. He likes it so much that on the train he falls asleep. \n\nOnce in summer Peter was going by train from city A to city B, and as usual, was sleeping. Then he woke up, started to look throug... | [{"type": "stdin_stdout", "input": "aababaaababaabbaabababaaababaabababbaabbabaabababaabbabbbababbababababababaabababaababaaaabababaabab\nabaabababaa\nabaabbaa\n", "output": "backward\n"}, {"type": "stdin_stdout", "input": "aababaaababaabbaabababaaababaabababbaabbabaabababaabbabbbababbababababababaabababaababaaaabababa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIgor K. always used to trust his favorite Kashpirovsky Antivirus. That is why he didn't hesitate to download the link one of his groupmates sent him via QIP Infinium. The link was said to contain \"some real funny stuff a... | [{"type": "stdin_stdout", "input": "10110010010001110110110111100100011101101110010100100010110101011001011101111001\n1001000100\n1011001001\n0101100101\n0001110110\n1000101101\n0110110000\n0000010011\n1101111001\n1101010111\n1110010100\n", "output": "13739427\n"}, {"type": "stdin_stdout", "input": "0001010110111011010... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph consisting of n vertices and m edges. Your task is to find the number of connected components which are cycles.\n\nHere are some definitions of graph theory.\n\nAn undirected graph consis... | [{"type": "stdin_stdout", "input": "17 15\n1 8\n1 12\n5 11\n11 9\n11 15\n15 5\n4 13\n3 10\n4 3\n15 16\n7 10\n16 7\n14 3\n14 4\n17 6\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "32 15\n1 5\n1 12\n5 11\n11 9\n9 15\n15 5\n4 13\n2 10\n4 3\n10 20\n7 10\n21 7\n14 3\n14 4\n17 11\n", "output": "0\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChandu has been appointed as the superintendent of a jail having N prisoners .\n\nPrisoner are numbered form 1 to N.\nToday he has been specially invited to execute the prisoners.\n\nAll the prisoners are arranged in circ... | [{"type": "stdin_stdout", "input": "1000\n3003\n4638\n1156\n4277\n1903\n1654\n1306\n3643\n4615\n2707\n1861\n2651\n1617\n1686\n2909\n3456\n1055\n1670\n2693\n1270\n4358\n4731\n4420\n4965\n1190\n2568\n4704\n2147\n3198\n2315\n1524\n4715\n2378\n3484\n3424\n1558\n3095\n3548\n1093\n3555\n1806\n1568\n4759\n1776\n4024\n4925\n22... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs the league stage of the world cup has come to its end, its time to calculate the highest points earned in the league stage by a team. \nThere are many teams playing in the world cup. A team is awarded 3 points for a wi... | [{"type": "stdin_stdout", "input": "3\n3 1 1\n14 0 10\n0 2 1\n\nS@MPLE", "output": "32\n"}, {"type": "stdin_stdout", "input": "3\n10 1 1\n0 1 3\n0 0 2\n\nLEPMAS", "output": "30\n"}, {"type": "stdin_stdout", "input": "3\n3 2 1\n10 1 3\n1 0 1\n\nSAMPLE", "output": "28\n"}, {"type": "stdin_stdout", "input": "3\n12 0 1\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRamesh is a hard-working employee.Seeing his dedication towards his work his boss decided to promote him. Ramesh was overjoyed on getting to know this.But soon he realized he needed to shift to another Town X. Ramesh need... | [{"type": "stdin_stdout", "input": "7 2\n10 2 16 19 6 11 10\n29 25\n\nSAMPLE", "output": "7\n"}, {"type": "stdin_stdout", "input": "7 2\n10 2 16 19 6 11 10\n29 25\n\nELPMAS", "output": "7\n"}, {"type": "stdin_stdout", "input": "7 2\n10 2 7 19 6 11 10\n2 20\n\nELPMAS", "output": "11\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N temples in a straight line and K monks who want to spread their enlightening power to the entire road of temples. All the monks have an enlightenment value, which denotes the range of enlightenment which they... | [{"type": "stdin_stdout", "input": "967 615\n6749 6417 199 5907 7677 8590 8796 3463 721 963 1779 8646 4529 7831 8222 1665 3941 4397 6286 2971 1613 2501 6285 3381 1438 5360 160 9400 5006 5423 9949 3213 3181 4385 1901 1111 191 4089 5685 1396 8701 3277 1481 517 6253 1313 2255 5948 6085 7201 5310 1105 985 748 9271 2883 734... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N boxes numbered 1 to N, and M balls numbered 1 to M. Currently, Ball i is in Box A_i.\n\nYou can do the following operation:\n\n* Choose a box containing two or more balls, pick up one of the balls from that box,... | [{"type": "stdin_stdout", "input": "5 5\n1 4 1\n3 1 2\n0 3 1\n1 8 1\n12 4 1", "output": "5\n"}, {"type": "stdin_stdout", "input": "4 5\n1 4 1\n3 1 2\n0 3 1\n1 8 1\n12 4 1", "output": "5\n"}, {"type": "stdin_stdout", "input": "5 5\n1 15 2\n3 1 1\n0 3 1\n1 5 1\n7 4 1", "output": "5\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i. There is no other way to decrease the monster'... | [{"type": "stdin_stdout", "input": "210 3\n31 41 59 26 53", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "210 3\n31 55 59 26 53", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "210 5\n31 41 59 26 53", "output": "Yes"}, {"type": "stdin_stdout", "input": "211 5\n31 33 59 26 53", "output": "No\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a permutation P of \\\\{1, 2, \\ldots, N\\\\}.\n\nFor a pair (L, R) (1 \\le L \\lt R \\le N), let X_{L, R} be the second largest value among P_L, P_{L+1}, \\ldots, P_R.\n\nFind \\displaystyle \\sum_{L=1}^{N-1} \\... | [{"type": "stdin_stdout", "input": "8\n8 1 7 3 4 5 6 2", "output": "135\n"}, {"type": "stdin_stdout", "input": "8\n8 2 7 3 4 5 6 1", "output": "136"}, {"type": "stdin_stdout", "input": "5\n1 3 2 4 5", "output": "29\n"}, {"type": "stdin_stdout", "input": "5\n2 3 1 4 5", "output": "28\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence (P_1,P_2,...,P_N) which is a permutation of the integers from 1 through N. You would like to sort this sequence in ascending order by repeating the following operation:\n\n* Choose an element in t... | [{"type": "stdin_stdout", "input": "8\n6\n3\n2\n1\n7\n4\n8\n5", "output": "5\n"}, {"type": "stdin_stdout", "input": "8\n6\n3\n1\n2\n5\n4\n8\n7", "output": "6\n"}, {"type": "stdin_stdout", "input": "8\n6\n3\n2\n1\n4\n7\n8\n5", "output": "5\n"}, {"type": "stdin_stdout", "input": "8\n6\n3\n2\n1\n7\n4\n5\n8", "output": "5\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nN contestants participated in a competition. The total of N-1 matches were played in a knockout tournament. For some reasons, the tournament may not be \"fair\" for all the contestants. That is, the number of the matches ... | [{"type": "stdin_stdout", "input": "7\n1\n2\n2\n3\n1\n4", "output": "4\n"}, {"type": "stdin_stdout", "input": "7\n1\n4\n2\n3\n1\n3", "output": "5\n"}, {"type": "stdin_stdout", "input": "7\n1\n4\n2\n3\n1\n4", "output": "4\n"}, {"type": "stdin_stdout", "input": "7\n1\n4\n2\n3\n1\n7", "output": "4\n"}, {"type": "stdin_std... | 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@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": "abCCCCC2000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. A came to Aizu for sightseeing. You can overlook the Aizu Basin from the window of the hotel where you stayed. As I was looking at the scenery, I noticed a piece of the photo on the floor. Apparently I took the outsid... | [{"type": "stdin_stdout", "input": "8 4\n2 1 3 1 1 5 1 3\n2 3 2 4 1 0 2 1\n0 3 -1 2 1 1 4 2\n1 2 3 2 1 1 5 4\n0 2 0 1 1 3 2 1\n1 3 1 2 2 4 3 2\n5 1 2 1 4 1 1 5\n4 1 1 -1 1 2 2 1\n2 -1 -1 -1\n0 3 -1 -1\n-1 2 2 4\n-1 1 -1 1\n5 3\n1 0 2 3 5\n2 3 7 2 1\n2 5 4 2 2\n8 9 0 3 3\n3 6 0 4 7\n-1 -1 2\n-1 3 5\n0 4 -1\n0 0", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCompute A + B.\n\nConstraints\n\n* -1000 ≤ A, B ≤ 1000\n\nInput\n\nThe input will consist of a series of pairs of integers A and B separated by a space, one pair of integers per line. The input will be terminated by EOF.\... | [{"type": "stdin_stdout", "input": "1 2\n10 5\n101 20", "output": "3\n15\n121\n"}, {"type": "stdin_stdout", "input": "1 2\n10 4\n101 20", "output": "3\n14\n121\n"}, {"type": "stdin_stdout", "input": "1 2\n10 4\n101 37", "output": "3\n14\n138\n"}, {"type": "stdin_stdout", "input": "1 2\n11 4\n101 37", "output": "3\n15\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1.\n\n<image>\nFigure B-1: Layout of the exchange li... | [{"type": "stdin_stdout", "input": "4\n_e\na`ba\nebbf\neddea", "output": "2\n12\n12\n13\n"}, {"type": "stdin_stdout", "input": "4\ne]\na`ba\nebbf\needea", "output": "2\n12\n12\n14\n"}, {"type": "stdin_stdout", "input": "4\n_f\n`db_\nfecf\nhaefg", "output": "2\n12\n12\n18\n"}, {"type": "stdin_stdout", "input": "4\naa\nd... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe mayor of Amida, the City of Miracle, is not elected like any other city. Once exhausted by long political struggles and catastrophes, the city has decided to leave the fate of all candidates to the lottery in order to... | [{"type": "stdin_stdout", "input": "4 3 1\n3 1 2\n0 1 3\n4 3 4\n1 0 1\n0 0 0", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "4 3 1\n3 1 1\n0 1 3\n4 3 4\n1 0 1\n0 0 0", "output": "3\n1\n"}, {"type": "stdin_stdout", "input": "6 4 1\n3 -1 2\n2 2 3\n3 3 4\n0 2 4\n0 0 0", "output": "1\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAngry Birds is a mobile game of a big craze all over the world. You were convinced that it was a waste of time to play the game, so you decided to create an automatic solver.\n\n<image>\n\nYou are describing a routine tha... | [{"type": "stdin_stdout", "input": "2 1 10 2\n-1 4 1 2", "output": "No\n"}, {"type": "stdin_stdout", "input": "2 3 4 2\n-1 2 1 2", "output": "No\n"}, {"type": "stdin_stdout", "input": "2 1 4 2\n-1 2 1 2", "output": "No\n"}, {"type": "stdin_stdout", "input": "2 1 4 2\n-1 4 1 2", "output": "No\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Manhattan, roads run where the x or y coordinate is an integer. Both Sunuke-kun's house and Sumeke-kun's house are on the road, and the straight line distance (Euclidean distance) is just d. Find the maximum value that... | [{"type": "stdin_stdout", "input": "10.685123853325852", "output": "15.1110470690\n"}, {"type": "stdin_stdout", "input": "10.702511281748821", "output": "15.1356366061\n"}, {"type": "stdin_stdout", "input": "10.804121325601631", "output": "15.2793349082\n"}, {"type": "stdin_stdout", "input": "11.285119341606524", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nD: Sontaku (Surmise)\n\nSome twins like even numbers.\n\nCount how many even numbers are in $ N $ integers $ A_1, A_2, A_3, \\ dots, A_N $.\n\ninput\n\nThe integer $ N $ is given on the first line.\n\nOn the second line, ... | [{"type": "stdin_stdout", "input": "5\n5 12 0 2 18", "output": "4\n"}, {"type": "stdin_stdout", "input": "5\n2 12 0 2 18", "output": "5\n"}, {"type": "stdin_stdout", "input": "5\n5 12 1 2 12", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n5 12 1 2 18", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads $n$ items and sorts them. Each item has attributes $\\\\{value, weight, type, date, name\\\\}$ and they are represented by $\\\\{$ integer, integer, upper-case letter, integer, string $\\\\}$ r... | [{"type": "stdin_stdout", "input": "5\n105 24 C 1500000000000 white\n100 23 C 1500000000000 blue\n105 23 A 1480000000000 pink\n110 25 B 1500000000000 black\n110 20 A 1484487224415 gree", "output": "100 23 C 1500000000000 blue\n105 23 A 1480000000000 pink\n105 24 C 1500000000000 white\n110 20 A 1484487224415 gree\n110 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sequence a_1, a_2, ..., a_n is called good if, for each element a_i, there exists an element a_j (i ≠ j) such that a_i+a_j is a power of two (that is, 2^d for some non-negative integer d).\n\nFor example, the following ... | [{"type": "stdin_stdout", "input": "10\n3 10 14 1 10 12 5 16 5 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n3 10 14 1 10 8 5 16 5 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n3 10 9 1 10 8 5 16 5 2\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\n2 10 9 1 10 4 5 8 5 4\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string t consisting of n lowercase Latin letters and an integer number k.\n\nLet's define a substring of some string s with indices from l to r as s[l ... r].\n\nYour task is to construct such string s of ... | [{"type": "stdin_stdout", "input": "50 68\npyndtohzaimzvqkvdkwlmccauhlmmljruldlobtadxclrvncea\n", "output": "pyndtohzaimzvqkvdkwlmccauhlmmljruldlobtadxclrvnceapyndtohzaimzvqkvdkwlmccauhlmmljruldlobtadxclrvnceapyndtohzaimzvqkvdkwlmccauhlmmljruldlobtadxclrvnceapyndtohzaimzvqkvdkwlmccauhlmmljruldlobtadxclrvnceapyndtohzaim... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a galaxy far, far away Lesha the student has just got to know that he has an exam in two days. As always, he hasn't attended any single class during the previous year, so he decided to spend the remaining time wisely.\... | [{"type": "stdin_stdout", "input": "79256157 81208498\n", "output": "5171\n17914 17913 17912 17911 17910 17909 17908 17907 17906 17905 17904 17903 17902 17901 17900 17899 17898 17897 17896 17895 17894 17893 17892 17891 17890 17889 17888 17887 17886 17885 17884 17883 17882 17881 17880 17879 17878 17877 17876 17875 17874... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.\n\nThere were n cla... | [{"type": "stdin_stdout", "input": "200\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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "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 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet f_{x} = c^{2x-6} ⋅ f_{x-1} ⋅ f_{x-2} ⋅ f_{x-3} for x ≥ 4.\n\nYou have given integers n, f_{1}, f_{2}, f_{3}, and c. Find f_{n} mod (10^{9}+7).\n\nInput\n\nThe only line contains five integers n, f_{1}, f_{2}, f_{3}, a... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "607659049"}, {"type": "stdin_stdout", "input": "1440135023384277212 298741808 401572465 730243936 632306255\n", "output": "694201657\n"}, {"type": "stdin_stdout", "input": "1440135023384277212 298741808 71... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJack has become a soldier now. Unfortunately, he has trouble with the drill. Instead of marching beginning with the left foot and then changing legs with each step, as ordered, he keeps repeating a sequence of steps, in w... | [{"type": "stdin_stdout", "input": "RXLLRXXLLRLRLLXXXXRXXRLLRRRRXLLRRLXXLRXXLXLRLLLLLRXLRXLXRXLXLRRXXRRLXLXLRLRXRXLXXXLRXLLXLRRRRXRLLXRRLLRRXRRRLRLLRLRXXXRLXLXLLLRXXLLXLRXXLLLRLXRRXRLXLXXXXXXLXRXXRXXXRXLXXRRXLLXRRXLXXRRXLXXRLXLXXLXRXXRLRLLXLXLXLRXLXLXLLLRLXXLXLLRLLLLRLRRRRXRRLLRLXLXXRLRRLXRRXXXRLLXRRRXXRRRXXLRXRLLXRRRX... | 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 ≤ hh < 24 and 0 ≤ mm < 60. We use 24-hour time format!\n\n... | [{"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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.