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\nWe have a tree with N vertices. The vertices are numbered 0 through N - 1, and the i-th edge (0 ≤ i < N - 1) comnnects Vertex a_i and b_i. For each pair of vertices u and v (0 ≤ u, v < N), we define the distance d(u, v) a... | [{"type": "stdin_stdout", "input": "10\n2 8\n6 0\n4 1\n7 6\n2 3\n8 6\n6 9\n2 4\n5 8", "output": "3"}, {"type": "stdin_stdout", "input": "5\n0 1\n0 2\n0 3\n3 4", "output": "2"}, {"type": "stdin_stdout", "input": "5\n0 1\n0 2\n1 3\n3 4", "output": "1"}, {"type": "stdin_stdout", "input": "2\n0 18", "output": "1"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he to... | [{"type": "stdin_stdout", "input": "atcoderbeeinnercontgst\natcoderregularcontest", "output": "aattccooddeerrbreeegiunlnaerrccoonnttegsstt\n"}, {"type": "stdin_stdout", "input": "atcoderbeeinnercontgst\natcoaerreguldrcontest", "output": "aattccoodaeerrbreeegiunlnderrccoonnttegsstt\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is playing with N cards.\n\nThe i-th card has an integer X_i on it.\n\nTakahashi is trying to create as many pairs of cards as possible satisfying one of the following conditions:\n\n* The integers on the two ca... | [{"type": "stdin_stdout", "input": "15 10\n1 5 6 10 11 11 11 20 21 25 25 26 99 124 99", "output": "6\n"}, {"type": "stdin_stdout", "input": "15 10\n0 5 6 10 11 11 11 20 21 25 25 26 99 131 99", "output": "5\n"}, {"type": "stdin_stdout", "input": "15 10\n0 5 6 10 11 11 11 20 21 46 25 26 99 131 99", "output": "5\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given circle $A$ with radius $r_a$ and with central coordinate $(x_a, y_a)$ and circle $B$ with radius $r_b$ and with central coordinate $(x_b, y_b)$.\n\nWrite a program which prints:\n\n* \"2\" if $B$ is in $A$,\... | [{"type": "stdin_stdout", "input": "2\n1.3018830993798196 1.1804991696233216 6.678597997840617 2.1321559253491804 2.072303142011048 4.898405435743801\n1.6154186783950772 0.39921226227011497 2.512872370263131 5.273208013897418 2.169775861927481 3.924014997809771", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe brothers Hiroshi and Kenjiro came to Lake Inawashiro for fishing. The two decided to score as follows and compete with the total score of the fish they caught.\n\n* One char is a point\n* One yamame trout b points\n* ... | [{"type": "stdin_stdout", "input": "0 11\n10 0\n-1 1 41 0", "output": "kenjiro\n"}, {"type": "stdin_stdout", "input": "0 11\n10 0\n-1 2 41 0", "output": "kenjiro\n"}, {"type": "stdin_stdout", "input": "0 10\n10 0\n-1 2 41 0", "output": "kenjiro\n"}, {"type": "stdin_stdout", "input": "0 10\n10 1\n-1 2 41 0", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMy arm is stuck and I can't pull it out.\n\nI tried to pick up something that had rolled over to the back of my desk, and I inserted my arm while illuminating it with the screen of my cell phone instead of a flashlight, b... | [{"type": "stdin_stdout", "input": "1\n11\n111111\n111111111111\n12345\n11111111119999999999\n11111111113333333333\n11111111118888888888\n11111111112222222222111111111\n11111111110000000000444444444\n11224111122411\n888888888888999999999999888888888888999999999999999999\n666666666666666777333333333338888888888\n1111114... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring a voyage of the starship Hakodate-maru (see Problem A), researchers found strange synchronized movements of stars. Having heard these observations, Dr. Extreme proposed a theory of \"super stars\". Do not take this... | [{"type": "stdin_stdout", "input": "4\n10.431258066320945 10.00000 10.963374203026609\n21.297630146026126 10.00000 10.00000\n20.00000 20.997700286656844 10.00000\n11.414338431837134 20.00000 10.00000\n4\n11.03531062521475 12.469639655902677 10.968703737628516\n10.00000 51.12714506944212 50.70404839090845\n51.1844286530... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\ncrc\n1\n\n\nOutput\n\ncrc\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python code to solve thi... | [{"type": "stdin_stdout", "input": "epi\n-2", "output": "eipie\n"}, {"type": "stdin_stdout", "input": "eoi\n-2", "output": "eioie\n"}, {"type": "stdin_stdout", "input": "eoj\n-2", "output": "ejoje\n"}, {"type": "stdin_stdout", "input": "enj\n-2", "output": "ejnje\n"}, {"type": "stdin_stdout", "input": "fnj\n-2", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nYamano Mifune Gakuen's 1st grade G group is a class where female students carrying misfortune gather. They face various challenges every day with the goal of being happy.\n\nIn their class, they can take practi... | [{"type": "stdin_stdout", "input": "5 10 5\n0 1 1 2\n0 2 1 2\n0 1 2 3\n1 2 0 2\n1 4 2 3\n2 1 1 1\n2 1 1 2\n3 3 2 3\n4 1 1 2\n4 2 1 2", "output": "13\n"}, {"type": "stdin_stdout", "input": "5 10 5\n0 1 1 2\n0 2 1 2\n0 1 2 3\n1 2 0 2\n1 4 2 3\n2 1 1 1\n2 1 1 2\n3 3 2 4\n4 1 1 2\n4 2 0 2", "output": "14\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.\n\nConstraints\n\n* 1 ≤ length of T ≤ 1000000\n* 1 ≤ length of P ≤ 10000\n* The input consists of... | [{"type": "stdin_stdout", "input": "aaaaab\naa", "output": "0\n1\n2\n3\n"}, {"type": "stdin_stdout", "input": "baaaaa\naa", "output": "1\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "aaabaa\naa", "output": "0\n1\n4\n"}, {"type": "stdin_stdout", "input": "baaaab\naa", "output": "1\n2\n3\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the online judge system, a judge file may include multiple datasets to check whether the submitted program outputs a correct answer for each test case. This task is to practice solving a problem with multiple datasets.... | [{"type": "stdin_stdout", "input": "3\n14\n11\n14\n2\n58\n0", "output": "Case 1: 3\nCase 2: 14\nCase 3: 11\nCase 4: 14\nCase 5: 2\nCase 6: 58\n"}, {"type": "stdin_stdout", "input": "3\n5\n11\n14\n26\n34\n0", "output": "Case 1: 3\nCase 2: 5\nCase 3: 11\nCase 4: 14\nCase 5: 26\nCase 6: 34\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings s and t. Both strings have length n and consist of lowercase Latin letters. The characters in the strings are numbered from 1 to n.\n\nYou can successively perform the following move any number o... | [{"type": "stdin_stdout", "input": "50\naabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyz\nzyxxwwvvuuttssrrqqppoonnmmllkkjjiihhggffeeddccbbaa\n", "output": "1201\n49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 49 48 47 46 45 44 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a binary string s.\n\nFind the number of distinct cyclical binary strings of length n which contain s as a substring.\n\nThe cyclical string t contains s as a substring if there is some cyclical shift of str... | [{"type": "stdin_stdout", "input": "40\n1111110111111111111111011111111111111110\n", "output": "40\n"}, {"type": "stdin_stdout", "input": "40\n0000000000100000100000000000000000000000\n", "output": "40\n"}, {"type": "stdin_stdout", "input": "40\n0000010010000000000001000110000001010100\n", "output": "40\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou came to the exhibition and one exhibit has drawn your attention. It consists of n stacks of blocks, where the i-th stack consists of a_i blocks resting on the surface.\n\nThe height of the exhibit is equal to m. Conse... | [{"type": "stdin_stdout", "input": "50 1000000000\n824428839 821375880 831521735 868908015 86990853 248293447 886713846 425716910 443947914 504402098 40124673 774093026 271211165 873482658 592754073 490097471 947930201 69692739 145291746 418475785 80274059 696889747 854947829 231642778 141525047 57563878 92067934 38750... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut is going to travel to the Tree Country, in which there are n cities. Most of the land of this country is covered by forest. Furthermore, the local road system forms a tree (connected graph without cycles). Nu... | [{"type": "stdin_stdout", "input": "10\n81 34 31 38 69 62 54 18 72 29\n4 8 12\n2 9 25\n4 5 17\n5 7 35\n10 1 13\n9 3 53\n7 6 22\n1 6 82\n3 10 42\n", "output": " 187\n"}, {"type": "stdin_stdout", "input": "10\n11 43 11 96 18 53 25 89 31 41\n2 4 41\n7 1 88\n3 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of two phases. During the first phase you make your move and during the second phase Slavik makes his move.\n\nThere ... | [{"type": "stdin_stdout", "input": "100 2 2\n1 73456 13268 11914 2 1 2 1 1 2 1 1 87480 65464 2 40468 7016 70750 28675 92808 74100 22702 47484 22345 61255 1 104206 62017 89058 61094 76626 1 171051 98876 97451 18228 2 2 1 38979 1 144831 1 43289 73591 2 1 91061 89577 13598 1 2 2 57020 2 82044 24974 1 1 958 8399 1 98709 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice lives on a flat planet that can be modeled as a square grid of size n × n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c with ordered pair (r, c). Each... | [{"type": "stdin_stdout", "input": "10\n9 9\n2 2\n1111111111\n1000111111\n1000111111\n1111111111\n1111000001\n1111011111\n1111010001\n1111010101\n1111000101\n1111111111\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n2 2\n9 9\n1111111111\n1000111111\n1000111111\n1111111111\n1111000001\n1111011111\n11110100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1 ≤ m ≤ n) special items of them.\n\nT... | [{"type": "stdin_stdout", "input": "1000000000000000000 20 365\n31881893160049984 103938857870698567 103962228223609431 140762820261865064 175962215264653912 239086305245565642 354522451098745823 383839975876242372 443471287955807705 478923027151493682 511195154588214957 619570919279066139 677571312513476877 7058647976... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an easier version of the next problem. The difference is only in constraints.\n\nYou are given a rectangular n × m matrix a. In one move you can choose any column and cyclically shift elements in this column. You ... | [{"type": "stdin_stdout", "input": "40\n2 2\n5 2\n1 5\n1 1\n3\n1 2\n1 1\n1 2\n1 1\n1 2\n2 3\n2 1\n1\n1\n1 1\n1\n2 1\n1\n1\n1 2\n2 3\n2 2\n1 3\n3 3\n1 1\n1\n2 1\n3\n4\n1 1\n2\n2 2\n1 1\n1 1\n2 2\n1 1\n1 1\n1 1\n1\n2 1\n1\n1\n2 1\n5\n3\n1 1\n2\n1 2\n2 2\n2 1\n1\n1\n2 2\n3 2\n2 4\n1 1\n5\n1 2\n2 1\n1 2\n1 1\n1 2\n1 1\n1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is interactive.\n\nWe have hidden an array a of n pairwise different numbers (this means that no two numbers are equal). You can get some information about this array using a new device you just ordered on Am... | [{"type": "stdin_stdout", "input": "49 48 47\n747080538 138591411 638550649 673032887 796857375 832746364 509949708 311532132 460813705 216311740 165294553 956747626 618288861 357459930 221681705 949165023 594484764 720355327 152613351 968837649 507974993 368359947 153531713 845369067 168627715 32853845 361562163 35799... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[3R2 - Standby for Action](https://www.youtube.com/watch?v=P2ZVC9aoiKo)\n\nOur dear Cafe's owner, JOE Miller, will soon take part in a new game TV-show \"1 vs. n\"!\n\nThe game goes in rounds, where in each round the host... | [{"type": "stdin_stdout", "input": "100000\n", "output": "12.090146129863335\n"}, {"type": "stdin_stdout", "input": "111735\n", "output": "12.201105415046918\n"}, {"type": "stdin_stdout", "input": "178482\n", "output": "12.669461501082823\n"}, {"type": "stdin_stdout", "input": "152946\n", "output": "12.515059130925348\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be n participants, one of whom is Nikolay. Like any good olympiad, it consists ... | [{"type": "stdin_stdout", "input": "25\n5 1 1\n5 2 3\n5 5 5\n5 5 1\n5 4 4\n10 1 2\n10 3 7\n10 10 10\n10 3 1\n10 7 6\n1000000 21232 1234\n999999 999999 999999\n1000000 300001 966605\n1000000 290001 679121\n500000 111099 123456\n100 1 1\n1000000000 1 1000000000\n1000000000 1 500000000\n100000000 1 12345678\n1000000000 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nYou are given a sequence a consisting of n positive integers.\n\nLet's define a three blocks palindrome as the sequence, consisting of at most two dist... | [{"type": "stdin_stdout", "input": "6\n8\n1 1 4 2 1 2 1 1\n3\n1 3 12\n4\n1 10 10 1\n1\n26\n2\n2 4\n3\n2 1 1\n", "output": "6\n1\n4\n1\n1\n2\n"}, {"type": "stdin_stdout", "input": "6\n8\n1 1 2 2 3 2 1 1\n3\n1 3 3\n4\n1 10 10 1\n1\n26\n2\n2 1\n3\n1 1 1\n", "output": "7\n2\n4\n1\n1\n3\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMaria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus.\n\nShe has n friends who are also grannies (Maria is not included in this numbe... | [{"type": "stdin_stdout", "input": "4\n5\n1 1 0 2 1\n6\n2 3 4 4 12 7\n6\n2 5 4 5 0 11\n5\n1 2 1 5 6\n", "output": "6\n5\n6\n4\n"}, {"type": "stdin_stdout", "input": "4\n5\n1 1 2 2 1\n6\n2 3 4 4 6 7\n6\n2 5 4 5 0 11\n5\n1 2 1 5 6\n", "output": "6\n5\n6\n4\n"}, {"type": "stdin_stdout", "input": "4\n5\n2 0 2 2 -1\n6\n2 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree with n vertices. You are allowed to modify the structure of the tree through the following multi-step operation:\n\n 1. Choose three vertices a, b, and c such that b is adjacent to both a and c. \n ... | [{"type": "stdin_stdout", "input": "15\n4 6\n8 4\n12 11\n7 6\n9 8\n5 1\n14 13\n6 13\n1 4\n1 2\n6 11\n10 8\n15 14\n3 1\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "15\n9 11\n8 15\n6 5\n12 10\n1 2\n5 11\n10 7\n3 2\n6 7\n4 8\n3 5\n9 13\n13 14\n3 4\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "15\n9 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n people who want to participate in a boat competition. The weight of the i-th participant is w_i. Only teams consisting of two people can participate in this competition. As an organizer, you think that it's fa... | [{"type": "stdin_stdout", "input": "4\n14\n2 6 5 9 5 8 13 14 12 5 6 14 5 2\n36\n15 22 27 14 23 36 10 17 33 21 18 22 3 4 32 24 8 19 36 22 17 11 24 10 33 4 30 6 2 17 11 16 18 1 2 20\n2\n2 2\n12\n4 9 10 6 1 9 5 8 12 9 9 12\n", "output": "3\n11\n1\n4\n"}, {"type": "stdin_stdout", "input": "4\n14\n2 6 5 9 5 8 13 14 12 5 6 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call a sequence b_1, b_2, b_3 ..., b_{k - 1}, b_k almost increasing if $$$min(b_1, b_2) ≤ min(b_2, b_3) ≤ ... ≤ min(b_{k - 1}, b_k).$$$ In particular, any sequence with no more than two elements is almost increasing... | [{"type": "stdin_stdout", "input": "3\n8\n1 2 7 3 2 1 2 3\n2\n2 1\n7\n4 1 5 2 6 3 7\n", "output": "\n6\n2\n7\n"}, {"type": "stdin_stdout", "input": "3\n8\n1 2 7 3 2 1 2 5\n2\n2 1\n7\n4 1 5 2 6 3 7\n", "output": "6\n2\n7\n"}, {"type": "stdin_stdout", "input": "3\n8\n1 2 7 6 2 1 1 3\n2\n2 1\n7\n4 1 5 2 6 3 7\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Bob took a paper stripe of n squares (the height of the stripe is 1 square). In each square he wrote an integer number, possibly negative. He became interested in how many ways exist to cut this stripe into two piece... | [{"type": "stdin_stdout", "input": "100\n-4 2 4 4 1 3 -3 -3 2 1 -4 0 0 2 3 -1 -4 -3 4 -2 -3 -3 -3 -1 -2 -3 -1 -4 0 4 0 -1 4 0 -4 -4 4 -4 -2 1 -4 1 -3 -2 3 -4 4 0 -1 3 -1 4 -1 4 -1 3 -3 -3 -2 -2 4 -3 -3 4 -3 -2 -1 0 -2 4 0 -3 -1 -2 -3 1 -4 1 -3 -3 -3 -2 -3 0 1 -2 -2 -4 -3 -1 2 3 -1 1 1 0 3 -3 -1 -2\n", "output": "1\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has exactly two distinct positive integer divisors.\n\nConsider positive integers a, a ... | [{"type": "stdin_stdout", "input": "10000 1000000 60000\n", "output": "793662"}, {"type": "stdin_stdout", "input": "100000 1000000 7821\n", "output": "108426"}, {"type": "stdin_stdout", "input": "100000 1000000 8225\n", "output": "114000"}, {"type": "stdin_stdout", "input": "100001 1000000 8225\n", "output": "114000"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoma (a popular Russian name that means 'Roman') loves the Little Lvov Elephant's lucky numbers.\n\nLet us remind you that lucky numbers are positive integers whose decimal representation only contains lucky digits 4 and ... | [{"type": "stdin_stdout", "input": "49 2\n34644511 221617567 136135827 144208961 359490601 86708232 545390603 188605873 64330753 488776302 104482891 112998614 437791390 46521319 70778345 339141601 136198441 292941209 299339510 582531183 555958105 437904637 74219097 135224808 236010407 122674666 438442529 186501223 6393... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation p of size n is the sequence p1, p2, ..., pn, consisting of n distinct integers, each of them is from 1 to n (1 ≤ pi ≤ n).\n\nA lucky permutation is such permutation p, that any integer i (1 ≤ i ≤ n) meets th... | [{"type": "stdin_stdout", "input": "16440\n", "output": "2 16440 4 16438 6 16436 8 16434 10 16432 12 16430 14 16428 16 16426 18 16424 20 16422 22 16420 24 16418 26 16416 28 16414 30 16412 32 16410 34 16408 36 16406 38 16404 40 16402 42 16400 44 16398 46 16396 48 16394 50 16392 52 16390 54 16388 56 16386 58 16384 60 163... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCurrently Tiny is learning Computational Geometry. When trying to solve a problem called \"The Closest Pair Of Points In The Plane\", he found that a code which gave a wrong time complexity got Accepted instead of Time Li... | [{"type": "stdin_stdout", "input": "3119 2029631\n", "output": "0 0\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6\n0 7\n0 8\n0 9\n0 10\n0 11\n0 12\n0 13\n0 14\n0 15\n0 16\n0 17\n0 18\n0 19\n0 20\n0 21\n0 22\n0 23\n0 24\n0 25\n0 26\n0 27\n0 28\n0 29\n0 30\n0 31\n0 32\n0 33\n0 34\n0 35\n0 36\n0 37\n0 38\n0 39\n0 40\n0 41\n0 42\n0 43\n0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland scientists know that the Old Berland language had exactly n words. Those words had lengths of l1, l2, ..., ln letters. Every word consisted of two letters, 0 and 1. Ancient Berland people spoke quickly and didn’t ... | [{"type": "stdin_stdout", "input": "100\n17 18 22 15 14 18 9 21 14 19 14 20 12 15 9 23 19 20 19 22 13 22 17 11 21 22 8 17 23 18 21 23 22 23 15 18 21 17 17 9 13 21 23 19 18 23 15 14 17 19 22 23 12 16 23 16 20 9 12 17 18 11 10 17 16 21 8 21 16 19 21 17 12 20 14 16 17 10 22 20 17 13 15 19 9 22 12 20 20 13 19 16 18 7 15 18... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInna likes sweets and a game called the \"Candy Matrix\". Today, she came up with the new game \"Candy Matrix 2: Reload\".\n\nThe field for the new game is a rectangle table of size n × m. Each line of the table contains ... | [{"type": "stdin_stdout", "input": "10 10\nG********S\n*G*******S\n**G******S\n***G*****S\n****G****S\nS***G*****\n******G**S\n*******G*S\n********GS\nG********S\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 10\nG********S\n*G*******S\n**G******S\n***G*****S\n****S****G\nS***G*****\n******G**S\n*******G*... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.\n\nTo ensure the security, you have to build some police checkposts... | [{"type": "stdin_stdout", "input": "100\n174 174 49 152 10 185 101 157 28 177 105 83 155 178 119 123 197 197 56 174 39 53 85 94 72 166 71 43 177 123 186 11 64 82 145 81 11 29 100 10 106 45 138 79 131 90 80 104 149 116 129 30 96 192 11 182 92 157 95 136 152 38 68 34 42 95 164 134 117 75 186 185 28 146 86 24 147 12 166 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least ai candies.\n\nJzzhu asks children to line up. Initially... | [{"type": "stdin_stdout", "input": "100 20\n21 19 61 70 54 97 98 14 61 72 25 94 24 56 55 25 12 80 76 11 35 17 80 26 11 94 52 47 84 61 10 2 74 25 10 21 2 79 55 50 30 75 10 64 44 5 60 96 52 16 74 41 20 77 20 44 8 86 74 36 49 61 99 13 54 64 19 99 50 43 12 73 48 48 83 55 72 73 63 81 30 27 95 9 97 82 24 3 89 90 33 14 47 88 ... | 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 100\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... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai... | [{"type": "stdin_stdout", "input": "20\n452405440 586588704 509061481 392584366 16115810 148658854 66743034 290624691 677780684 519361360 208050516 401554301 954478790 989443769 387546138 832279893 1081316002 80960260 846049648 588066499\n", "output": "1081316002 954478790 452405440 392584366 387546138 387546138 208050... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPasha has recently bought a new phone jPager and started adding his friends' phone numbers there. Each phone number consists of exactly n digits.\n\nAlso Pasha has a number k and two sequences of length n / k (n is divisi... | [{"type": "stdin_stdout", "input": "100 1\n5 3 1 5 6 2 4 8 3 3 1 1 2 8 2 3 8 2 5 2 6 2 3 5 2 1 2 1 2 8 4 3 3 5 1 4 2 2 2 5 8 2 2 6 2 9 3 4 1 8 1 5 5 6 6 2 2 7 3 3 4 2 4 1 2 6 6 4 9 4 3 2 3 8 2 3 1 4 1 4 1 3 5 3 5 5 2 3 4 1 1 8 1 5 6 9 4 2 5 1\n6 0 4 5 3 1 0 7 5 3 5 4 5 4 0 2 1 6 2 2 4 3 1 9 5 9 2 2 6 8 6 5 9 6 4 9 9 7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCalculate the value of the sum: n mod 1 + n mod 2 + n mod 3 + ... + n mod m. As the result can be very large, you should print the value modulo 109 + 7 (the remainder when divided by 109 + 7).\n\nThe modulo operator a mod... | [{"type": "stdin_stdout", "input": "10000000000000 10000000000000\n", "output": "869957328\n"}, {"type": "stdin_stdout", "input": "2213058376259 2126643910770\n", "output": "971336268\n"}, {"type": "stdin_stdout", "input": "7244641009859 6300054748096\n", "output": "955368330\n"}, {"type": "stdin_stdout", "input": "469... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBad news came to Mike's village, some thieves stole a bunch of chocolates from the local factory! Horrible! \n\nAside from loving sweet things, thieves from this area are known to be very greedy. So after a thief takes hi... | [{"type": "stdin_stdout", "input": "1000000000000000\n", "output": "4949100894494448\n"}, {"type": "stdin_stdout", "input": "998749999999991\n", "output": "4942914518376840\n"}, {"type": "stdin_stdout", "input": "999999999999993\n", "output": "4949100894494416\n"}, {"type": "stdin_stdout", "input": "999999999999997\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has n rows of seats. There are 4 seats in each row, and the seats are separated into pairs b... | [{"type": "stdin_stdout", "input": "61\nOX|XX\nOX|XX\nOX|XX\nXO|XO\nXX|XO\nXX|XX\nXX|XX\nOX|XX\nXO|XO\nOX|XO\nXO|OX\nXX|XX\nXX|XX\nOX|OX\nXX|OX\nOX|XO\nOX|XO\nXO|OX\nXO|XX\nOX|XX\nOX|XX\nXO|OX\nXO|XX\nXO|XX\nOX|XX\nXX|XX\nXX|XO\nXO|XX\nXX|XX\nXO|OX\nXX|XO\nXO|XX\nXO|XO\nXO|OX\nXX|OX\nXO|OX\nOX|XX\nXX|OX\nXX|XX\nOX|XO\n... | 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": "10\n11\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\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the lesson small girl Alyona works with one famous spreadsheet computer program and learns how to edit tables.\n\nNow she has a table filled with integers. The table consists of n rows and m columns. By ai, j we wi... | [{"type": "stdin_stdout", "input": "11 1\n501465490\n366941771\n415080944\n385243536\n445132523\n697044413\n894369800\n812743722\n23684788\n466526046\n953916313\n45\n2 4\n8 9\n7 7\n4 9\n2 9\n2 11\n4 4\n5 7\n1 2\n5 10\n5 6\n1 7\n4 4\n1 6\n2 7\n10 11\n1 8\n6 11\n8 8\n8 10\n1 1\n5 10\n9 10\n6 9\n6 11\n1 1\n9 9\n10 11\n1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour search for Heidi is over – you finally found her at a library, dressed up as a human. In fact, she has spent so much time there that she now runs the place! Her job is to buy books and keep them at the library so tha... | [{"type": "stdin_stdout", "input": "80 4\n71 49 41 21 72 71 37 14 51 59 73 11 70 15 36 46 32 57 58 15 72 67 16 75 70 11 67 3 40 36 2 9 63 68 32 22 63 52 67 55 35 19 72 59 22 19 44 55 59 74 4 34 53 3 22 57 32 27 78 12 71 4 26 15 43 21 79 10 67 39 34 74 38 26 31 78 2 78 69 42\n", "output": "62\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's well known that the best way to distract from something is to do one's favourite thing. Job is such a thing for Leha.\n\nSo the hacker began to work hard in order to get rid of boredom. It means that Leha began to ha... | [{"type": "stdin_stdout", "input": "15 17\n1 10 8\n5 19 1\n12 14 6\n9 19 8\n6 7 3\n5 11 9\n7 12 5\n17 20 8\n6 12 6\n11 19 4\n3 14 1\n15 19 10\n3 20 5\n5 19 9\n10 18 10\n", "output": "11"}, {"type": "stdin_stdout", "input": "15 24\n2 14 5\n7 14 4\n6 11 6\n3 5 6\n4 13 5\n10 11 4\n8 8 6\n5 14 4\n2 2 3\n9 14 5\n2 16 6\n14 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp plans to conduct a load testing of its new project Fakebook. He already agreed with his friends that at certain points in time they will send requests to Fakebook. The load testing will last n minutes and in the ... | [{"type": "stdin_stdout", "input": "100\n9997 9615 4045 2846 7656 2941 2233 9214 837 3312 5832 578 6146 8773 164 7303 3260 8684 1732 6608 9061 9224 7263 7279 1361 1823 8075 5946 2236 6529 6783 7494 510 1217 1135 8745 6517 141 8180 1948 6827 6091 2730 897 1254 705 1990 1806 1957 2571 8355 5542 5536 1527 886 2093 1532 48... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n— This is not playing but duty as allies of justice, Nii-chan!\n\n— Not allies but justice itself, Onii-chan!\n\nWith hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sisters — Karen an... | [{"type": "stdin_stdout", "input": "2048 4096 1024\n", "output": "445542375\n"}, {"type": "stdin_stdout", "input": "1171 2989 2853\n", "output": "234725427\n"}, {"type": "stdin_stdout", "input": "4998 4998 4998\n", "output": "259368717\n"}, {"type": "stdin_stdout", "input": "3238 2923 4661\n", "output": "636587126\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile Vasya finished eating his piece of pizza, the lesson has already started. For being late for the lesson, the teacher suggested Vasya to solve one interesting problem. Vasya has an array a and integer x. He should fi... | [{"type": "stdin_stdout", "input": "100 2 1\n1 2 2 2 1 2 1 2 2 2 2 1 2 1 1 2 1 2 2 1 1 2 1 1 2 2 1 1 2 1 2 2 2 2 2 1 1 1 2 1 2 1 2 1 2 1 2 2 1 2 2 2 1 1 1 2 2 1 1 2 2 1 1 1 1 1 1 2 2 1 1 2 2 1 2 2 1 2 1 2 2 1 2 1 1 1 2 2 1 1 2 1 2 2 1 1 2 2 2 1\n", "output": "5200"}, {"type": "stdin_stdout", "input": "5 1000000000 0\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJamie has recently found undirected weighted graphs with the following properties very interesting:\n\n * The graph is connected and contains exactly n vertices and m edges. \n * All edge weights are integers and are in... | [{"type": "stdin_stdout", "input": "965 5451\n", "output": "967 967\n1 2 1\n2 3 1\n3 4 1\n4 5 1\n5 6 1\n6 7 1\n7 8 1\n8 9 1\n9 10 1\n10 11 1\n11 12 1\n12 13 1\n13 14 1\n14 15 1\n15 16 1\n16 17 1\n17 18 1\n18 19 1\n19 20 1\n20 21 1\n21 22 1\n22 23 1\n23 24 1\n24 25 1\n25 26 1\n26 27 1\n27 28 1\n28 29 1\n29 30 1\n30 31 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValya and Tolya are an ideal pair, but they quarrel sometimes. Recently, Valya took offense at her boyfriend because he came to her in t-shirt with lettering that differs from lettering on her pullover. Now she doesn't wa... | [{"type": "stdin_stdout", "input": "242\nrrrrrrrrrrrrrmmmmmmmmmmmmmgggggggggggggwwwwwwwwwwwwwyyyyyyyyyyyyyhhhhhhhhhhhhhoooooooooooooqqqqqqqqqqqqqjjjjjjjjjjjjjvvvvvvvvvvvvvlllllllllllllnnnnnnnnnnnnnfffffffffffffeeeeeeeeaaaaaaaaiiiiiiiiuuuuuuuuzzyzzzzzbbbbbbbbxxxxxxxxttttttttsscckppdd\nzpdpkcscstxbzuiaetxbzuiaetxbduiaetx... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo make a paper airplane, one has to use a rectangular piece of paper. From a sheet of standard size you can make s airplanes.\n\nA group of k people decided to make n airplanes each. They are going to buy several packs o... | [{"type": "stdin_stdout", "input": "10000 10000 1 1\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "10000 10000 3 2\n", "output": "16670000\n"}, {"type": "stdin_stdout", "input": "10000 10000 2 4\n", "output": "12500000\n"}, {"type": "stdin_stdout", "input": "10000 10000 1 4\n", "output": "25000000\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNastya owns too many arrays now, so she wants to delete the least important of them. However, she discovered that this array is magic! Nastya now knows that the array has the following properties:\n\n * In one second we ... | [{"type": "stdin_stdout", "input": "13\n-2075 -32242 27034 -37618 -96962 145894 64846 29532 -71761 28908 -21222 -61370 46899\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "13\n-2075 -32242 27034 -37618 -96962 82203 64846 48249 -71761 28908 -21222 -61370 46899\n", "output": "13\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChandu and Kundu are bored of dramatic games around. As they are very good friends and scholars they decided to discover a new game. \nIn total they had N number of marbles with value inscribed on each of them from 1 to ... | [{"type": "stdin_stdout", "input": "45\n14 13 2 4 6 5 7 22 8 9 11 18 3 10 17 21 20 16 12 1 19 15\n33\n28 10 9 14 15 20 27 22 21 4 13 30 17 18 6 2 1 5 8 12 3 26 11 24 23 19 25 16 29 7\n48\n21 38 16 23 32 5 27 19 9 28 17 35 30 20 43 11 42 15 39 8 22 31 36 34 18 29 25 1 6 24 44 2 26 33 37 14 3 13 10 40 7 4 41 12\n67\n5 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Jhool was was the most intelligent kid of his school. But he did NOT like his class teacher, his school, and the way he was taught things in school. Well, he was a rebel, to say the least. Like most of us, he hate... | [{"type": "stdin_stdout", "input": "10\n134\n4 43\n172\n67 23\n54\n13 29\n56\n23 33\n128\n50 19\n75\n15 39\n98\n52 43\n31\n5 2\n5\n5 6\n96\n41 12", "output": "Little Jhool wins!\nLittle Jhool wins!\nLittle Jhool wins!\nLittle Jhool wins!\nLittle Jhool wins!\nLittle Jhool wins!\nLittle Jhool wins!\nLittle Jhool wins!\nT... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSamu is playing a shooting game in play station. There are two apples to aim in this shooting game. Hitting first apple will provide her X points and hitting second apple will provide her Y points. And if she misses the ... | [{"type": "stdin_stdout", "input": "10\n2 3 327 123 7 18\n8 5 29 132 18 17\n2 2 69 28 12 6\n8 10 81 77 16 0\n5 9 82 182 1 8\n7 4 92 133 16 17\n1 3 55 56 3 17\n3 9 37 160 4 14\n5 3 11 109 10 9\n5 9 82 182 1 8", "output": "99.703827\n0.000122\n3.312847\n85.413494\n0.000137\n14.183985\n0.127003\n0.000051\n0.000000\n0.0001... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSunny, Arpit and Kunal are playing a game. All three of them are standing on a number line, each occupying a different integer.\n\nThe rules are as follows:\n\nTwo of them cannot be at the same integer at same time.\n\nIn... | [{"type": "stdin_stdout", "input": "2\n-2 -2 -2\n-2 -2 -2\n\nEDNSMN", "output": "-1\n-1\n"}, {"type": "stdin_stdout", "input": "2\n11 -10 0\n13 -3 -7\n\nULOCEO", "output": "10\n15\n"}, {"type": "stdin_stdout", "input": "2\n-2 -2 -2\n-2 -1 -2\n\nEDNSMN", "output": "-1\n0\n"}, {"type": "stdin_stdout", "input": "2\n5 -10 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have to go on a trip in your car which can hold a limited amount of fuel. You know how many liters of fuel your car uses per hour for certain speeds and you have to find out how far a certain amount of fuel will take ... | [{"type": "stdin_stdout", "input": "6\n250 763 230 116 210 306\n4704 1883 4000 3500 3166 3000\n50000\n\nSAMPLE", "output": "20260.223\n"}, {"type": "stdin_stdout", "input": "6\n233 763 230 116 210 211\n4704 2941 7334 3500 3166 3000\n50000\n\nSAMPLE", "output": "12971.778\n"}, {"type": "stdin_stdout", "input": "6\n51 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different charac... | [{"type": "stdin_stdout", "input": "eeffocfopuc\ncupofhottea", "output": "11\n"}, {"type": "stdin_stdout", "input": "ffgdmdfqpuc\noevt`ieuppd", "output": "10\n"}, {"type": "stdin_stdout", "input": "efffocfopuc\ncupofhottea", "output": "11\n"}, {"type": "stdin_stdout", "input": "efffodfopuc\ncupofhottea", "output": "11\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If... | [{"type": "stdin_stdout", "input": "AAB", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "ABB", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "BAA", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "BAB", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "BAA", "output": "Yes\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used.... | [{"type": "stdin_stdout", "input": "7\n218 1140 1051 233 449 890 389", "output": "15\n"}, {"type": "stdin_stdout", "input": "7\n218 1140 1051 233 636 890 389", "output": "13\n"}, {"type": "stdin_stdout", "input": "7\n218 1140 1051 40 1181 890 389", "output": "14\n"}, {"type": "stdin_stdout", "input": "7\n218 1140 704 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n* 3 \\leq N \\leq 100\n\nInput\n\nInput ... | [{"type": "stdin_stdout", "input": "-636", "output": "-114840\n"}, {"type": "stdin_stdout", "input": "-729", "output": "-131580\n"}, {"type": "stdin_stdout", "input": "-102", "output": "-18720\n"}, {"type": "stdin_stdout", "input": "-161", "output": "-29340\n"}, {"type": "stdin_stdout", "input": "-151", "output": "-275... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA prime number is an integer that is greater than 1 and can only be divided by itself or 1. For example, 2 is a prime number because it is divisible only by 2 and 1, but 12 is not a prime number because it is divisible by... | [{"type": "stdin_stdout", "input": "19\n10887", "output": "17 23\n10883 10889\n"}, {"type": "stdin_stdout", "input": "19\n17073", "output": "17 23\n17053 17077\n"}, {"type": "stdin_stdout", "input": "19\n30085", "output": "17 23\n30071 30089\n"}, {"type": "stdin_stdout", "input": "19\n21592", "output": "17 23\n21589 21... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro, who aims to become a web designer, is currently training. My senior at the office tells me that the background color of this page is # ffe085, which is a color number peculiar to web design, but I can't think of wha... | [{"type": "stdin_stdout", "input": "#ffe075\n#787878\n#decade\n#ff55ff\n0", "output": "yellow\nblack\nwhite\nfuchsia\n"}, {"type": "stdin_stdout", "input": "#ffe075\n#787878\n#decace\n#ff55ff\n0", "output": "yellow\nblack\nwhite\nfuchsia\n"}, {"type": "stdin_stdout", "input": "#ffe085\n#787878\n\"decade\n#ff55ff\n0", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe \"Western calendar\" is a concept imported from the West, but in Japan there is a concept called the Japanese calendar, which identifies the \"era name\" by adding a year as a method of expressing the year on the cale... | [{"type": "stdin_stdout", "input": "1 1914", "output": "3781\n"}, {"type": "stdin_stdout", "input": "2 1914", "output": "3825\n"}, {"type": "stdin_stdout", "input": "1 125", "output": "1992\n"}, {"type": "stdin_stdout", "input": "2 125", "output": "2036\n"}, {"type": "stdin_stdout", "input": "2 141", "output": "2052\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIOI Real Estate rents condominiums. The apartment room handled by this company is 1LDK, and the area is 2xy + x + y as shown in the figure below. However, x and y are positive integers.\n\n\nFigure_Madori\n\n\nIn the IOI ... | [{"type": "stdin_stdout", "input": "10\n8\n0\n12\n10\n12\n13\n20\n17\n19\n25", "output": "3\n"}, {"type": "stdin_stdout", "input": "10\n4\n7\n9\n10\n12\n13\n20\n17\n19\n20", "output": "3\n"}, {"type": "stdin_stdout", "input": "10\n8\n7\n8\n10\n12\n13\n20\n17\n19\n20", "output": "4\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTravelling by train is fun and exciting. But more than that indeed. Young challenging boys often tried to purchase the longest single tickets and to single ride the longest routes of various railway systems. Route plannin... | [{"type": "stdin_stdout", "input": "6 5\n 1 3 10\n 2 3 12\n 3 4 2\n 2 5 13\n 4 6 11\n10 10\n 1 3 11\n 2 3 25\n 2 5 81\n 3 6 82\n 4 10 58\n 5 9 68\n 6 7 80\n 6 9 67\n 8 9 44\n 9 10 21\n 0 0", "output": "38\n5 2 3 4 6\n446\n4 10 9 5 2 3 6 9 8\n"}, {"type": "stdin_stdout", "input": "6 5\n ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMeikyokan University is very famous for its research and education in the area of computer science. This university has a computer center that has advanced and secure computing facilities including supercomputers and many... | [{"type": "stdin_stdout", "input": "8\n2\nomura\ntoshio\nraku\ntanaka\ninura\nyoshoi\nhayashi\nmiura\n3\n1\ntasaka\nnakata\ntanaka\n1\n1\nfoo\n5\n2\npsqt\nabcdef\nabzdefa\npqrst\nabdxcef\n0", "output": "inura,miura\ninura,omura\nmiura,omura\ntoshio,yoshoi\n4\ntanaka,tasaka\n1\n0\nabcdef,abdxcef\nabcdef,abzdefa\npqrst,p... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem F Pizza Delivery\n\nAlyssa is a college student, living in New Tsukuba City. All the streets in the city are one-way. A new social experiment starting tomorrow is on alternative traffic regulation reversing the on... | [{"type": "stdin_stdout", "input": "4 5\n1 3 7\n4 2 6\n4 3 0\n2 1 34\n3 3 12", "output": "SOSO\nSOSO\nHAPPY\nHAPPY\nSOSO\n"}, {"type": "stdin_stdout", "input": "4 5\n1 1 5\n3 4 6\n4 2 13\n2 1 6\n2 3 17", "output": "SOSO\nSOSO\nSOSO\nHAPPY\nSOSO\n"}, {"type": "stdin_stdout", "input": "4 5\n1 3 5\n3 4 6\n2 2 7\n2 1 1\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBamboo Blossoms\n\nThe bamboos live for decades, and at the end of their lives, they flower to make their seeds. Dr. ACM, a biologist, was fascinated by the bamboos in blossom in his travel to Tsukuba. He liked the flower... | [{"type": "stdin_stdout", "input": "3 2\n2 6\n10 10\n110 181\n2 371896\n0 0", "output": "5\n17\n21\n379\n5361757\n"}, {"type": "stdin_stdout", "input": "12 1\n3 1\n10 20\n100 50\n3 202868\n0 0", "output": "13\n4\n47\n150\n2792771\n"}, {"type": "stdin_stdout", "input": "2 4\n3 1\n13 35\n100 47\n4 346519\n0 0", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\ncurtain\n\nSummer is coming soon. You decide to redecorate your room for the summer. It is expected that the sun will be very strong this summer, and it will be a difficult season for you who are not good at dazzling. So ... | [{"type": "stdin_stdout", "input": "4\n0 0\n10 0\n10 10\n0 10\n0 0\n5 0\n5 10\n0 10\n6\n0 0\n10 0\n10 5\n5 5\n5 10\n0 10\n2 0\n8 0\n8 10\n2 10\n12\n1 1\n1 3\n-1 3\n-1 1\n-3 1\n-3 -1\n-1 -1\n-1 -3\n1 -3\n1 -1\n3 -1\n3 1\n2 2\n-2 2\n-2 -2\n2 -2\n4\n20000 20000\n-20000 20000\n-20000 -20000\n20000 -20000\n1000 1000\n-1000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProof of knowledge\n\nThe entrance door of the apartment you live in has a password-type lock. This password consists of exactly four digits, ranging from 0 to 9, and you always use the password P given to you by the apar... | [{"type": "stdin_stdout", "input": "[+c[+a[^bd]]]\n0404\n[*b[*[*cd]a]]\n15341\n[^[^ab][^cd]]\n1295\na\n9876\n[^dd]\n9090\n.", "output": "0 10\n0 8895\n15 544\n9 1000\n0 10000\n"}, {"type": "stdin_stdout", "input": "[+c[+a[^bd]]]\n0404\n[*b[*[*cd]a]]\n15341\n[^[^ab][^cd]]\n1295\na\n4682\n[^dd]\n1131\n.", "output": "0 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are $ N $ Amidakuji with 3 vertical lines.\nNo matter which line you start from, the Amidakuji that ends at the starting line is considered a good Amidakuji.\nYou can select one or more Amidakuji and conn... | [{"type": "stdin_stdout", "input": "3\n3 -1 0\n0 1\n1 2 -1 1 2 0", "output": "yes\n"}, {"type": "stdin_stdout", "input": "3\n3 -1 0\n0 1\n1 2 -1 1 2 1", "output": "yes\n"}, {"type": "stdin_stdout", "input": "3\n3 -1 0\n0 1\n1 2 -1 1 3 1", "output": "yes\n"}, {"type": "stdin_stdout", "input": "3\n3 -1 0\n0 1\n1 2 -1 2 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which counts and reports the number of each alphabetical letter. Ignore the case of characters.\n\nConstraints\n\n* The number of characters in the sentence < 1200\n\nInput\n\nA sentence in English is give... | [{"type": "stdin_stdout", "input": "This is ` pen.", "output": "a : 0\nb : 0\nc : 0\nd : 0\ne : 1\nf : 0\ng : 0\nh : 1\ni : 2\nj : 0\nk : 0\nl : 0\nm : 0\nn : 1\no : 0\np : 1\nq : 0\nr : 0\ns : 2\nt : 1\nu : 0\nv : 0\nw : 0\nx : 0\ny : 0\nz : 0\n"}, {"type": "stdin_stdout", "input": "This si a pen.", "output": "a : 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe faculty of application management and consulting services (FAMCS) of the Berland State University (BSU) has always been popular among Berland's enrollees. This year, N students attended the entrance exams, but no more... | [{"type": "stdin_stdout", "input": "1\n4 2 3 14\n7 5 7\n10 6 10\n7 10 9\n9 0", "output": "Impossible\n"}, {"type": "stdin_stdout", "input": "1\n4 2 3 14\n7 5 7\n10 6 10\n7 10 9\n9 1", "output": "Impossible\n"}, {"type": "stdin_stdout", "input": "1\n4 2 3 2\n14 7 7\n10 6 7\n7 14 11\n9 9", "output": "Impossible\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya came up with a password to register for EatForces — a string s. The password in EatForces should be a string, consisting of lowercase and uppercase Latin letters and digits.\n\nBut since EatForces takes care of the ... | [{"type": "stdin_stdout", "input": "6\n11b\n4bh\nBeh\nTuY\n1YJ\nP28\n", "output": "A1b\n4Ah\nB1h\n1uY\n1aJ\nPa8\n"}, {"type": "stdin_stdout", "input": "6\n11b\n4bh\nBeh\nTvY\n1YJ\nP28\n", "output": "A1b\n4Ah\nB1h\n1vY\n1aJ\nPa8\n"}, {"type": "stdin_stdout", "input": "6\n11b\n4bh\nBeh\nvTY\n1YJ\nP28\n", "output": "A1b\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has got n books, numbered from 1 to n, arranged in a stack. The topmost book has number a_1, the next one — a_2, and so on. The book at the bottom of the stack has number a_n. All numbers are distinct.\n\nVasya want... | [{"type": "stdin_stdout", "input": "10\n4 7 10 2 1 8 3 5 9 6\n4 2 7 1 8 10 5 3 9 6\n", "output": "1 3 0 1 1 0 2 0 1 1 "}, {"type": "stdin_stdout", "input": "10\n4 7 10 2 1 8 3 5 9 6\n4 2 7 1 8 10 5 3 7 6\n", "output": "1 3 0 1 1 0 2 0 0 2\n"}, {"type": "stdin_stdout", "input": "10\n4 7 10 2 1 8 3 5 9 6\n4 2 7 1 7 10 5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integer numbers.\n\nLet instability of the array be the following value: max_{i = 1}^{n} a_i - min_{i = 1}^{n} a_i.\n\nYou have to remove exactly one element from this array to min... | [{"type": "stdin_stdout", "input": "82\n53931 67166 20637 68570 4855 63080 53128 28375 54407 70564 46622 46903 32659 68966 20614 11381 51217 94774 90448 13368 51098 46518 15907 1090 44331 39269 17316 22813 66082 78034 58245 36364 45200 78881 4933 66406 58312 74413 94780 12718 61328 57754 75973 93986 26719 12938 21718 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe number \"zero\" is called \"love\" (or \"l'oeuf\" to be precise, literally means \"egg\" in French), for example when denoting the zero score in a game of tennis. \n\nAki is fond of numbers, especially those with trai... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000\n", "output": "20833333333333332\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 743008370688\n", "output": "45454545454545452\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 200560490130\n", "output": "33333333333333329\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGildong is experimenting with an interesting machine Graph Traveler. In Graph Traveler, there is a directed graph consisting of n vertices numbered from 1 to n. The i-th vertex has m_i outgoing edges that are labeled as e... | [{"type": "stdin_stdout", "input": "4\n4 -9 -1 -1\n2\n2 3\n1\n2\n3\n2 4 1\n4\n3 1 2 1\n6\n1 -1\n3 -1\n3 -1\n4 -4\n2 1\n1 5\n", "output": "1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "4\n4 -9 -1 -1\n2\n2 3\n1\n2\n3\n2 4 1\n4\n3 1 2 1\n6\n1 -1\n3 0\n3 -1\n4 -4\n2 1\n1 5\n", "output": "1\n1\n1\n1\n1\n1\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHappy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.\n\... | [{"type": "stdin_stdout", "input": "10 12\nsin im gye gap eul bynoeg jeong mu gj gyeong\nyu sul hae jb chuk in myo jin as o li sin\n14\n1\n1\n3\n4\n17\n17\n12\n13\n73\n2016\n32\n2018\n2019\n2020\n", "output": "sinyu\nsinyu\ngyehae\ngapjb\njeongchuk\njeongchuk\nimsin\ngyeyu\ngyeyu\nbynoegsin\nimjin\nmusul\ngjhae\ngyeong... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him — his keyboard will consist of only one row, where all 26 lowercase Latin letters will be arranged in some order.\n\nPoly... | [{"type": "stdin_stdout", "input": "5\nababa\ncodfdoca\ncbada\nzxzytyz\nabcdefghjjkllnopqrstuvwxyza\n", "output": "YES\nabcdefghijklmnopqrstuvwxyz\nYES\nacodfbeghijklmnpqrstuvwxyz\nYES\ncbadefghijklmnopqrstuvwxyz\nYES\ntyzxabcdefghijklmnopqrsuvw\nNO\n"}, {"type": "stdin_stdout", "input": "5\nababa\ncodedoca\nabcda\nzxz... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a colored permutation p_1, p_2, ..., p_n. The i-th element of the permutation has color c_i.\n\nLet's define an infinite path as infinite sequence i, p[i], p[p[i]], p[p[p[i]]] ... where all elements have sam... | [{"type": "stdin_stdout", "input": "3\n4\n1 3 4 2\n1 1 2 3\n5\n2 3 4 5 1\n1 2 5 10 3\n8\n7 4 5 6 1 8 3 2\n5 3 4 4 12 5 8 9\n", "output": "1\n5\n4\n"}, {"type": "stdin_stdout", "input": "3\n4\n1 3 4 2\n1 2 2 3\n5\n2 3 4 5 1\n1 2 10 4 5\n8\n7 4 5 6 1 8 3 2\n5 3 6 4 7 5 8 4\n", "output": "1\n5\n2\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGottfried learned about binary number representation. He then came up with this task and presented it to you.\n\nYou are given a collection of n non-negative integers a_1, …, a_n. You are allowed to perform the following ... | [{"type": "stdin_stdout", "input": "37\n1048575 327657 1046479 686078 513773 589787 387035 736754 1038077 1048056 59263 753353 784318 647131 519679 294910 185560 604141 456668 849789 521404 782287 6137 1047551 849874 523933 521721 278491 1042415 581468 1013705 439526 1011709 917469 655311 327646 917499\n", "output": "2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n segments [l_1, r_1], [l_2, r_2], ..., [l_n, r_n]. Each segment has one of two colors: the i-th segment's color is t_i.\n\nLet's call a pair of segments i and j bad if the following two conditions are met:\... | [{"type": "stdin_stdout", "input": "13\n3 7 2\n7 7 2\n5 12 2\n1 8 1\n10 12 1\n3 7 1\n10 12 1\n11 13 2\n2 3 2\n11 12 1\n1 12 2\n11 13 1\n9 11 1\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "13\n3 7 2\n7 7 2\n5 12 2\n1 8 1\n10 12 1\n3 7 2\n10 12 1\n11 13 2\n2 3 2\n11 12 1\n1 12 2\n11 13 1\n9 11 1\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've... | [{"type": "stdin_stdout", "input": "40\n1 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4\n", "output": "13\n4 3 2 \n4 3 2 \n4 3 1 \n4 2 1 \n3 2 1 \n4 3 2 \n4 3 1 \n4 2 1 \n3 2 1 \n4 3 2 \n4 3 1 \n4 2 1 \n3 2 1 \n"}, {"type": "stdin_stdout", "input": "40\n1 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a directed acyclic graph (a directed graph that does not contain cycles) of n vertices and m arcs. The i-th arc leads from the vertex x_i to the vertex y_i and has the weight w_i.\n\nYour task is to select a... | [{"type": "stdin_stdout", "input": "18 50\n10 3 14\n5 16 64931\n12 1 34517\n6 7 18587\n8 4 9\n5 1 29\n8 1 4538\n13 11 16087\n3 16 101\n12 15 49\n5 4 5\n12 4 1\n8 11 24\n12 3 1\n9 8 51757\n9 11 81\n18 6 8141\n16 6 8\n17 14 15\n5 11 2337\n13 17 1553\n5 18 15\n15 7 14\n10 11 2798\n8 15 9\n9 3 1\n4 18 36637\n18 14 1\n9 18 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence a, initially consisting of n integers.\n\nYou want to transform this sequence so that all elements in it are equal (i. e. it contains several occurrences of the same element).\n\nTo achieve this, ... | [{"type": "stdin_stdout", "input": "5\n3\n1 1 1\n5\n1 2 3 4 5\n5\n1 2 3 2 1\n7\n1 2 3 1 2 3 1\n11\n2 2 1 2 3 2 1 2 3 1 2\n", "output": "\n0\n1\n1\n2\n3\n"}, {"type": "stdin_stdout", "input": "5\n3\n1 1 1\n5\n1 2 3 4 5\n5\n1 2 3 2 1\n7\n1 2 3 1 2 4 1\n11\n2 2 1 2 3 2 1 2 3 1 2\n", "output": "0\n1\n1\n2\n3\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNezzar has n balls, numbered with integers 1, 2, …, n. Numbers a_1, a_2, …, a_n are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that a_i ≤ a_{i+1} for all 1 ≤ i < n.\n... | [{"type": "stdin_stdout", "input": "5\n6\n1 1 1 2 3 4\n5\n1 1 2 2 3\n4\n2 2 2 2\n3\n1 2 3\n1\n1\n", "output": "\n3\n2\n4\n1\n1\n"}, {"type": "stdin_stdout", "input": "5\n6\n1 1 1 2 3 4\n5\n1 1 2 2 3\n4\n2 2 2 2\n3\n2 2 3\n1\n1\n", "output": "3\n2\n4\n2\n1\n"}, {"type": "stdin_stdout", "input": "5\n6\n1 1 1 2 3 3\n5\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe input contains two integers N, M (1 ≤ N ≤ 1024, 2 ≤ M ≤ 16), separated by a single space.\n\nOutput\n\nOutput \"YES\" or \"NO\".\n\nExamples\n\nInput\n\n\n2 3\n\n\nOutput\n\n\nYES\n\n\nInput\n\n\n3 2\n\n\... | [{"type": "stdin_stdout", "input": "33 16\n", "output": "\nYES\n"}, {"type": "stdin_stdout", "input": "11 11\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "12 16\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "11 20\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "15 11\n", "output": "Y... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n cities in Shaazzzland, numbered from 0 to n-1. Ghaazzzland, the immortal enemy of Shaazzzland, is ruled by AaParsa.\n\nAs the head of the Ghaazzzland's intelligence agency, AaParsa is carrying out the most imp... | [{"type": "stdin_stdout", "input": "10 10\n0 6 997411747\n1 0 999893123\n2 6 999733804\n3 7 999612727\n4 6 999688283\n5 7 997515369\n6 5 995899470\n7 0 999851011\n8 6 999094306\n9 4 999864664\n", "output": "0 997411752 997411753 997411754 997411755 997411756 997411747 997411748 997411749 997411750\n999893123 0 99989312... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n stone quarries in Petrograd.\n\nEach quarry owns mi dumpers (1 ≤ i ≤ n). It is known that the first dumper of the i-th quarry has xi stones in it, the second dumper has xi + 1 stones in it, the third has xi + ... | [{"type": "stdin_stdout", "input": "30\n53 12\n13 98\n21 60\n76 58\n39 5\n62 58\n73 80\n13 75\n37 45\n44 86\n1 85\n13 33\n17 50\n12 26\n97 48\n52 40\n2 71\n95 79\n38 76\n24 54\n91 39\n97 92\n94 80\n50 61\n33 56\n22 91\n39 94\n31 56\n28 16\n20 44\n", "output": "tolik\n"}, {"type": "stdin_stdout", "input": "30\n53 12\n13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem's actual name, \"Lexicographically Largest Palindromic Subsequence\" is too long to fit into the page headline.\n\nYou are given string s consisting of lowercase English letters only. Find its lexicographical... | [{"type": "stdin_stdout", "input": "zzzzzzzzzz\n", "output": "zzzzzzzzzz\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaa\n", "output": "aaaaaaaaaa\n"}, {"type": "stdin_stdout", "input": "zzzzzzzazz\n", "output": "zzzzzzzzz\n"}, {"type": "stdin_stdout", "input": "abbbbbbbbb\n", "output": "bbbbbbbbb\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA film festival is coming up in the city N. The festival will last for exactly n days and each day will have a premiere of exactly one film. Each film has a genre — an integer from 1 to k.\n\nOn the i-th day the festival ... | [{"type": "stdin_stdout", "input": "129 37\n15 22 28 15 30 16 11 20 4 26 14 37 29 17 15 15 14 18 1 9 16 22 13 32 5 18 25 11 6 33 33 22 17 9 1 5 27 27 37 4 6 1 3 18 17 33 6 17 2 24 23 1 1 37 35 21 21 17 18 6 31 17 29 18 10 10 30 31 8 3 25 20 34 11 12 12 24 13 5 27 20 31 28 1 36 2 4 13 14 9 33 25 4 26 36 6 2 7 15 9 20 33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKsusha is a beginner coder. Today she starts studying arrays. She has array a1, a2, ..., an, consisting of n positive integers.\n\nHer university teacher gave her a task. Find such number in the array, that all array elem... | [{"type": "stdin_stdout", "input": "5\n506904227 214303304 136194869 838256937 183952885\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5\n238711016 214303304 136194869 838256937 183952885\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5\n310947607 214303304 136194869 838256937 183952885\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence BDF is a subsequence of ABCDE... | [{"type": "stdin_stdout", "input": "UAYQUMTSNGMYBORUYXJJQZVAGBRVDWUTGUYYYOTWAHVKGGOHADXULFUFQULSAGDWFJCSDKPWBROYZIFRGGRVZQMEHKHCKNHTQSMK\nSVKVTPUZOBRKGLEASXMIUSRISOTDIFFUCODYGNYIPSWEEBHGNWRZETXAVVMQTRBVFZMYHOHUCMLBUXBMPMSNCSHFZTAFUVTMQFGL\nTNICVANBEBOQASUEJJAOJXWNMDGAAVYNHRPSMKGMXZDJHCZHFHRRMIDWUOQCZSBKDPLSGHNHFKFYDRGV... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. \n\nIn this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the ... | [{"type": "stdin_stdout", "input": "16199 5506872\n", "output": "5498774 10997548 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProf. Vasechkin wants to represent positive integer n as a sum of addends, where each addends is an integer number containing only 1s. For example, he can represent 121 as 121=111+11+–1. Help him to find the least number ... | [{"type": "stdin_stdout", "input": "768617061415848\n", "output": "390\n"}, {"type": "stdin_stdout", "input": "973546235465729\n", "output": "263\n"}, {"type": "stdin_stdout", "input": "898453513288965\n", "output": "248\n"}, {"type": "stdin_stdout", "input": "694855944531976\n", "output": "348\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you know, an undirected connected graph with n nodes and n - 1 edges is called a tree. You are given an integer d and a tree consisting of n nodes. Each node i has a value ai associated with it.\n\nWe call a set S of t... | [{"type": "stdin_stdout", "input": "300 34\n777 497 1099 1221 1255 733 1119 533 1130 822 1000 1272 1104 575 1012 1137 1125 733 1036 823 845 923 1271 949 709 766 935 1226 1088 765 1269 475 1709 977\n5 18\n5 8\n1 20\n2 25\n4 19\n11 34\n6 9\n14 23\n21 22\n12 30\n7 11\n3 12\n18 21\n1 4\n2 6\n1 2\n11 15\n2 31\n4 13\n25 28\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Happy Farm 5 creators decided to invent the mechanism of cow grazing. The cows in the game are very slow and they move very slowly, it can even be considered that they stand still. However, carnivores should always be... | [{"type": "stdin_stdout", "input": "60\n-20 179\n-68 0\n-110 68\n-22 177\n47 140\n-49 -4\n-106 38\n-23 22\n20 193\n47 173\n-23 22\n-100 32\n-97 29\n47 124\n-49 -4\n20 193\n-20 179\n-50 149\n-59 -7\n4 193\n-23 22\n-97 29\n-23 22\n-66 133\n47 167\n-61 138\n-49 -4\n-91 108\n-110 84\n47 166\n-110 77\n-99 100\n-23 22\n-59 -... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.