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\nVanya walks late at night along a straight street of length l, lit by n lanterns. Consider the coordinate system with the beginning of the street corresponding to the point 0, and its end corresponding to the point l. The... | [{"type": "stdin_stdout", "input": "46 615683844\n431749087 271781274 274974690 324606253 480870261 401650581 13285442 478090364 266585394 425024433 588791449 492057200 391293435 563090494 317950 173675329 473068378 356306865 311731938 192959832 321180686 141984626 578985584 512026637 175885185 590844074 47103801 21221... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numbered from 1 to n, each node i having an initial value a_{i}. The root of the tree is node 1.... | [{"type": "stdin_stdout", "input": "10 10\n418 45 865 869 745 901 177 773 854 462\n4 8\n1 4\n3 6\n1 5\n1 10\n5 9\n1 2\n4 7\n1 3\n2 2\n1 6 246\n1 4 296\n1 2 378\n1 8 648\n2 6\n1 5 288\n1 6 981\n1 2 868\n2 7\n", "output": "45\n1147\n-119\n"}, {"type": "stdin_stdout", "input": "10 10\n418 45 865 869 745 901 177 773 854 46... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the capital city of Berland, Bertown, demonstrations are against the recent election of the King of Berland. Berland opposition, led by Mr. Ovalny, believes that the elections were not fair enough and wants to organize... | [{"type": "stdin_stdout", "input": "100 10\n9199\n89 409 428 408 309 400 259 393 212 273 472 654 533 774 663 484 695 801 587 518 521 578 767 644 532 785 500 944 582 680 899 882 589 601 614 633 877 543 770 614 852 715 932 627 639 658 765 957 898 545 977 751 740 869 885 831 834 702 934 954 500 626 605 921 755 661 707 952... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 β€ i β€ |a|), such that ai β bi, where ai is the i-th symbol of string a, bi is the i-th symbol ... | [{"type": "stdin_stdout", "input": "5728 5729 5750\n5631 5768\n9209\n", "output": "10344\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis contest is `CODE FESTIVAL`. However, Mr. Takahashi always writes it `CODEFESTIVAL`, omitting the single space between `CODE` and `FESTIVAL`.\n\nSo he has decided to make a program that puts the single space he omitte... | [{"type": "stdin_stdout", "input": "ETAUDARGTSOP", "output": "ETAU DARGTSOP\n"}, {"type": "stdin_stdout", "input": "AACDEFGHIJKL", "output": "AACD EFGHIJKL\n"}, {"type": "stdin_stdout", "input": "COCEFESTIVAL", "output": "COCE FESTIVAL\n"}, {"type": "stdin_stdout", "input": "POSTGRADUATF", "output": "POST GRADUATF\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have N coins each of which has a value ai. Find the number of combinations that result when you choose K different coins in such a way that the total value of the coins is greater than or equal to L and less than or e... | [{"type": "stdin_stdout", "input": "5 4 7 19\n1 10 2 2 -1", "output": "4\n"}, {"type": "stdin_stdout", "input": "5 6 7 19\n1 10 2 2 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 4 13 19\n1 5 1 2 -1", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 6 10 7\n1 10 2 2 -1", "output": "0\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHave you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox... | [{"type": "stdin_stdout", "input": "11 59 59 11 12\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "12 12 12 11 12\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "11 59 59 12 11\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "12 12 12 11 12\n", "output": "YES\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.\n\nYou can choose a real number D and move each ... | [{"type": "stdin_stdout", "input": "19\n449447997 711296339\n530233434 692216537\n535464528 613140435\n535533467 100893188\n530498867 -265063956\n519107979 -271820709\n482156929 -287792333\n-303730271 -287970295\n-416935204 -263348201\n-443613873 -249980523\n-453444829 -173903413\n-462102798 -80789280\n-462064673 -1322... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively.\nWe will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms ... | [{"type": "stdin_stdout", "input": "10\n2 0\n2 -1\n-1 -1\n1 20\n0 -1\n-18 -1\n1 -1\n1 1\n-5 -1\n4 0", "output": "399\n"}, {"type": "stdin_stdout", "input": "10\n2 0\n0 0\n-1 2\n-1 13\n-2 -26\n-11 -1\n2 -1\n0 1\n0 0\n0 4", "output": "161\n"}, {"type": "stdin_stdout", "input": "10\n2 -1\n0 0\n-1 2\n-1 13\n0 -26\n-16 -1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone number. ... | [{"type": "stdin_stdout", "input": "91537\n", "output": "27651\n"}, {"type": "stdin_stdout", "input": "13542\n", "output": "84443\n"}, {"type": "stdin_stdout", "input": "32036\n", "output": "82432\n"}, {"type": "stdin_stdout", "input": "71232\n", "output": "10151\n"}, {"type": "stdin_stdout", "input": "10000\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city ai.\n\nToday the... | [{"type": "stdin_stdout", "input": "10 5 1000000000\n1 1 1 2 2 1 2 2 2 2\n", "output": "10000000000\n"}, {"type": "stdin_stdout", "input": "10 5 1000000000\n1 1 1 2 2 1 2 2 3 2\n", "output": "10000000000\n"}, {"type": "stdin_stdout", "input": "10 5 1000000000\n1 1 1 2 0 1 2 2 3 2\n", "output": "10000000000\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.\nIn Taknese, the plural form of a noun is spelled based on the following rules:\n - If a noun's singular form does not... | [{"type": "stdin_stdout", "input": "upruskhsmeicaqqesyyvopepmvdosibrvqoghdeikbpqbfgrufxdsqchjkuxpxngebxrmqdgqjsosencrbwknllvucvubyozfmttxtlsrrnrqavshaszrenhlbzpnpjgqftvwgukjwsekfcgllbzlnvmosmvqubtwsgltvmmzmslqdxqiifzkaqhsxzguseuexlycgubhdnwhrssyiybitcoowlhmmrdpgtrdwalvffknwibhwhacqfjcmwupoxonavvxwsvprpymskznabsquwssucx... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are cons... | [{"type": "stdin_stdout", "input": "50\nGRBGGRBRGRBGGBBBBBGGGBBBBRBRGBRRBRGBBBRBBRRGBGGGRB\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "50\nRBGGBGGRBGRBBBGBBGRBBBGGGRBBBGBBBGRGGBGGBRBGBGRRGG\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "50\nGGGBBRGGGGGRRGGRBGGRGBBRBRRBGRGBBBGBRBGRGBBGRGGBRB\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA boy Valera registered on site Codeforces as Valera, and wrote his first Codeforces Round #300. He boasted to a friend Arkady about winning as much as x points for his first contest. But Arkady did not believe his friend... | [{"type": "stdin_stdout", "input": "230 125 175 124 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "230 125 221 124 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "230 195 221 124 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "375 6 133 267 19 36\n", "output": "NO\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 Γ 8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from t... | [{"type": "stdin_stdout", "input": "S......A\n.SS..S..\nS....S..\nSSS...S.\n.SS.STS.\n.S.SS...\n..S..S..\nM.SS....\n", "output": "LOSE\n"}, {"type": "stdin_stdout", "input": "SSSSSSSA\n......S.\n/.....S.\n.....SS.\n....SS..\n...SS...\n..SS....\nMSS.....\n", "output": "LOSE\n"}, {"type": "stdin_stdout", "input": "S..SSS... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N balls and N+1 holes in a line. Balls are numbered 1 through N from left to right. Holes are numbered 1 through N+1 from left to right. The i-th ball is located between the i-th hole and (i+1)-th hole. We denot... | [{"type": "stdin_stdout", "input": "1000 100 100", "output": "649620280.957660079002380"}, {"type": "stdin_stdout", "input": "1110 100 110", "output": "894375868.485796213150\n"}, {"type": "stdin_stdout", "input": "1110 101 110", "output": "894383190.732867240906\n"}, {"type": "stdin_stdout", "input": "1110 111 100", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Berland Armed Forces System consists of n ranks that are numbered using natural numbers from 1 to n, where 1 is the lowest rank and n is the highest rank.\n\nOne needs exactly di years to rise from rank i to rank i + ... | [{"type": "stdin_stdout", "input": "100\n63 65 21 41 95 23 3 4 12 23 95 50 75 63 58 34 71 27 75 31 23 94 96 74 69 34 43 25 25 55 44 19 43 86 68 17 52 65 36 29 72 96 84 25 84 23 71 54 6 7 71 7 21 100 99 58 93 35 62 47 36 70 68 9 75 13 35 70 76 36 62 22 52 51 2 87 66 41 54 35 78 62 30 35 65 44 74 93 78 37 96 70 26 32 71 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangular parallelepiped with sides of positive integer lengths $A$, $B$ and $C$. \n\nFind the number of different groups of three integers ($a$, $b$, $c$) such that $1\\leq a\\leq b\\leq c$ and parallel... | [{"type": "stdin_stdout", "input": "10\n9 6 8\n5 5 2\n8 9 2\n2 7 9\n6 4 10\n1 1 5\n2 15 1\n10 2 3\n12 5 4\n17 6 4\n", "output": "41\n6\n21\n12\n39\n2\n8\n14\n30\n22\n"}, {"type": "stdin_stdout", "input": "10\n9 6 8\n5 5 2\n8 9 2\n2 7 9\n6 4 10\n1 1 5\n2 8 1\n10 2 3\n12 5 4\n17 5 4\n", "output": "41\n6\n21\n12\n39\n2\n7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe final match of the Berland Football Cup has been held recently. The referee has shown $n$ yellow cards throughout the match. At the beginning of the match there were $a_1$ players in the first team and $a_2$ players i... | [{"type": "stdin_stdout", "input": "1000\n1000\n1000\n1000\n1999999\n", "output": "1999 1999\n"}, {"type": "stdin_stdout", "input": "1000\n1000\n1000\n1000\n2000000\n", "output": "2000 2000\n"}, {"type": "stdin_stdout", "input": "1000\n1000\n1000\n1000\n2000000\n", "output": "2000 2000\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nN players will participate in a tennis tournament. We will call them Player 1, Player 2, \\ldots, Player N.\nThe tournament is round-robin format, and there will be N(N-1)/2 matches in total.\nIs it possible to schedule t... | [{"type": "stdin_stdout", "input": "171\n158 2 11 40 53 51 26 89 135 78 167 25 123 157 100 152 72 35 39 126 124 119 68 105 162 150 84 82 59 109 28 70 34 110 85 136 57 145 134 47 99 20 83 95 154 98 73 138 48 29 120 116 66 58 96 18 102 24 153 127 125 61 32 129 16 131 50 46 10 113 91 75 13 86 65 45 146 133 122 103 128 93 ... | 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\nTsumugi brought $n$ delicious sweets to the Light Music Club. They are numbered from $1$ to $n$, where the $i$-th sweet has a sugar concentration described by an integer $a_i$.\n\nYui loves sweets, but she can eat at most... | [{"type": "stdin_stdout", "input": "37 13\n164823 8992 21818 77521 130870 83201 174985 168799 9565 84443 105083 54131 130813 42829 98759 60103 198520 125068 59611 45609 124003 106143 54167 179002 103755 152802 146640 74767 91309 11941 131534 32533 67324 27272 49166 129157 41630\n", "output": "8992 18557 30498 52316 795... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLunar New Year is approaching, and Bob received a gift from his friend recently β a recursive sequence! He loves this sequence very much and wants to play with it.\n\nLet f_1, f_2, β¦, f_i, β¦ be an infinite sequence of pos... | [{"type": "stdin_stdout", "input": "26\n150393140 360409816 380562806 954731482 34457876 66727907 376298532 679315200 260466665 597680044 95770656 948689469 209020313 926343072 66801160 426280560 927872284 389224547 492602065 324416078 776983298 191080523 167234113 791882865 365749226 28861923\n755656155 336170357\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlex enjoys performing magic tricks. He has a trick that requires a deck of n cards. He has m identical decks of n different cards each, which have been mixed together. When Alex wishes to perform the trick, he grabs n ca... | [{"type": "stdin_stdout", "input": "999 504\n", "output": "0.0019990178729991604\n"}, {"type": "stdin_stdout", "input": "614 123\n", "output": "0.0032414781922363548\n"}, {"type": "stdin_stdout", "input": "723 1000\n", "output": "0.002762959403995896\n"}, {"type": "stdin_stdout", "input": "975 504\n", "output": "0.0020... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer and his friend TopCoDeer is playing a game.\nThe game consists of N turns.\nIn each turn, each player plays one of the two gestures, Rock and Paper, as in Rock-paper-scissors, under the following conditi... | [{"type": "stdin_stdout", "input": "ggppgggpgg\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "ggpgggppgg", "output": "2\n"}, {"type": "stdin_stdout", "input": "ggggggpppg", "output": "2\n"}, {"type": "stdin_stdout", "input": "ggppgpgggg", "output": "2\n"}, {"type": "stdin_stdout", "input": "ggppggpggg", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHaiku is a genre of Japanese traditional poetry.\n\nA haiku poem consists of 17 syllables split into three phrases, containing 5, 7 and 5 syllables correspondingly (the first phrase should contain exactly 5 syllables, the... | [{"type": "stdin_stdout", "input": "aaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\naaaaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\naaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are different. They divide cards between them in some manner, it's possible that they have different n... | [{"type": "stdin_stdout", "input": "10\n9 8 7 6 2 3 5 4 10 1\n1 9\n", "output": "103 1\n"}, {"type": "stdin_stdout", "input": "10\n1 10\n9 5 7 6 1 2 3 9 8 4\n", "output": "105 1\n"}, {"type": "stdin_stdout", "input": "10\n9 8 7 6 2 3 5 4 9 1\n1 10\n", "output": "105 2\n"}, {"type": "stdin_stdout", "input": "10\n9 8 7 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nn soldiers stand in a circle. For each soldier his height ai is known. A reconnaissance unit can be made of such two neighbouring soldiers, whose heights difference is minimal, i.e. |ai - aj| is minimal. So each of them w... | [{"type": "stdin_stdout", "input": "88\n1000 1000 1000 1000 1000 998 998 1000 1000 1000 1000 999 999 1000 1000 1000 999 1000 997 999 997 1000 999 998 1000 999 1000 1000 1000 999 1000 999 999 1000 1000 999 1000 999 1000 1000 998 1000 1000 1000 998 998 1000 1000 999 1000 1000 1000 1000 1000 1000 1000 998 1000 1000 1000 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\nHere, a ACGT string is a string that contains no characters other than A,... | [{"type": "stdin_stdout", "input": "TTTTTTTTTT\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "BBBBBBBBBB\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "GACGCTCCAV\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "CTTAHTGACT\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "TGMJCTTDAA\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYaroslav has an array that consists of n integers. In one second Yaroslav can swap two neighboring array elements. Now Yaroslav is wondering if he can obtain an array where any two neighboring elements would be distinct i... | [{"type": "stdin_stdout", "input": "100\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a three-digit positive integer N.\n\nDetermine whether N is a palindromic number.\n\nHere, a palindromic number is an integer that reads the same backward as forward in decimal notation.\n\n-----Constraints-... | [{"type": "stdin_stdout", "input": "575\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "171\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "123\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "812\n", "output": "No\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$, consisting only of characters '0' or '1'. Let $|s|$ be the length of $s$.\n\nYou are asked to choose some integer $k$ ($k > 0$) and find a sequence $a$ of length $k$ such that:\n\n$1 \\le a_1 <... | [{"type": "stdin_stdout", "input": "1\n0000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n0000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100\n", "output": "NO\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Simpson got up with a slight feeling of tiredness. It was the start of another day of hard work. A bunch of papers were waiting for his inspection on his desk in his office. The papers contained his students' answers ... | [{"type": "stdin_stdout", "input": "a+b+c\n(a+b)+c\na- (b-c)+2\n.\n4ab\n(a - b) (0-b+a) - 1a ^ 2 - b ^ 3\n2 b 2 a\n.\n108 a\n2 2 3 3 3 a\n4 a^1 27\n.\n.", "output": "yes\nno\n.\nno\nyes\n.\nyes\nyes\n.\n"}, {"type": "stdin_stdout", "input": "a+b+c\n(a+b)+c\na- (b-c)+2\n.\n4ab\n(a - b) (0-b+a) - 1a ^ 4 - b ^ 3\n2 b 2 a\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Berland road network consists of n cities and of m bidirectional roads. The cities are numbered from 1 to n, where the main capital city has number n, and the culture capital β number 1. The road network is set up so ... | [{"type": "stdin_stdout", "input": "34 53\n9 6\n25 28\n27 24\n15 18\n34 33\n27 30\n1 4\n4 7\n11 9\n11 8\n30 26\n15 12\n26 23\n17 15\n29 26\n11 15\n7 10\n14 12\n5 9\n8 5\n2 1\n24 21\n3 5\n14 17\n23 20\n25 22\n32 29\n8 6\n3 6\n33 31\n5 2\n21 18\n16 19\n19 22\n17 21\n14 11\n23 27\n3 1\n34 32\n32 30\n26 24\n17 20\n18 20\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nThere are 100 houses located on a straight line. The first house is numbered 1 and the last one is numbered 100. Some M houses out of these 100 are occ... | [{"type": "stdin_stdout", "input": "3\n4 7 8\n12 52 56 8\n2 10 2\n21 75\n2 5 8\n10 49", "output": "0\n18\n11\n"}, {"type": "stdin_stdout", "input": "3\n4 7 3\n3 52 56 8\n2 10 2\n21 75\n2 5 8\n10 49", "output": "24\n18\n11\n"}, {"type": "stdin_stdout", "input": "3\n4 7 8\n19 52 56 8\n2 20 2\n21 34\n2 5 8\n10 29", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nGiven the lengths of $ 2 $ sides that are not the hypotenuse of a right triangle, $ A $ and $ B $. The side of length $ A $ overlaps the $ x $ axis, and the side of length $ B $ overlaps the $ y $ axis.\n\nDo t... | [{"type": "stdin_stdout", "input": "-23 -12", "output": "-7238.229473871\n"}, {"type": "stdin_stdout", "input": "-26 -9", "output": "-3053.628059289\n"}, {"type": "stdin_stdout", "input": "-74 -8", "output": "-2144.660584851\n"}, {"type": "stdin_stdout", "input": "-11 -4", "output": "-268.082573106\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process a... | [{"type": "stdin_stdout", "input": "7 2\n1\n106\n966369\n10\n12\n40177\n11", "output": "3\n"}, {"type": "stdin_stdout", "input": "7 4\n1\n106\n966369\n10\n12\n40177\n11", "output": "1\n"}, {"type": "stdin_stdout", "input": "7 4\n1\n106\n966369\n10\n18\n40177\n11", "output": "0\n"}, {"type": "stdin_stdout", "input": "7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N points in a D-dimensional space.\nThe coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).\nThe distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \\sqrt{... | [{"type": "stdin_stdout", "input": "10 10\n8 -14 -14 -20 18 -1 -3 18 -1 10\n-9 2 4 -13 13 5 14 -9 20 -18\n-19 -19 -19 20 -3 20 -2 -18 -7 -11\n5 7 3 -11 12 -9 -10 10 20 -19\n-12 -8 -20 -13 12 13 17 17 -6 0\n-4 -14 -15 -15 18 19 -8 -1 -20 -2\n-7 11 -10 -16 3 -5 -12 15 6 -2\n12 18 -3 -15 -20 17 9 9 10 -10\n10 -2 9 -16 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLuntik has decided to try singing. He has $a$ one-minute songs, $b$ two-minute songs and $c$ three-minute songs. He wants to distribute all songs into two concerts such that every song should be included to exactly one co... | [{"type": "stdin_stdout", "input": "4\n2 4 1\n4 2 0\n10 4 5\n1 1 2\n", "output": "1\n0\n1\n1\n"}, {"type": "stdin_stdout", "input": "4\n2 2 0\n4 2 0\n10 4 5\n1 1 2\n", "output": "0\n0\n1\n1\n"}, {"type": "stdin_stdout", "input": "4\n2 4 0\n4 2 0\n10 4 5\n1 1 2\n", "output": "0\n0\n1\n1\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlicia has an array, $a_1, a_2, \\ldots, a_n$, of non-negative integers. For each $1 \\leq i \\leq n$, she has found a non-negative integer $x_i = max(0, a_1, \\ldots, a_{i-1})$. Note that for $i=1$, $x_i = 0$.\n\nFor exa... | [{"type": "stdin_stdout", "input": "35\n15 13 -25 -7 -18 -16 4 -15 2 -23 0 -3 -26 -27 -24 -27 -22 1 -52 -19 -16 -15 -29 -43 -18 -27 -11 -20 -2 -11 -20 -30 -1 -13 -46\n", "output": "15 28 3 21 10 12 32 17 34 11 34 31 8 7 10 7 12 35 -17 16 19 20 6 -8 17 8 24 15 33 24 15 5 34 22 -11 "}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet p (i) be the i-th prime number from the smallest. For example, 7 is the fourth prime number from the smallest, 2, 3, 5, 7, so p (4) = 7.\n\nGiven n, the sum of p (i) from i = 1 to n s\n\ns = p (1) + p (2) + .... + p (... | [{"type": "stdin_stdout", "input": "2\n219\n0", "output": "5\n136114\n"}, {"type": "stdin_stdout", "input": "2\n279\n0", "output": "5\n231208\n"}, {"type": "stdin_stdout", "input": "2\n195\n0", "output": "5\n105540\n"}, {"type": "stdin_stdout", "input": "2\n199\n0", "output": "5\n110364\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA bracketed sequence is called correct (regular) if by inserting \"+\" and \"1\" you can get a well-formed mathematical expression from it. For example, sequences \"(())()\", \"()\" and \"(()(()))\" are correct, while \")... | [{"type": "stdin_stdout", "input": "101\n(())))))()))()())(()))((())))((())(()()()(()()((()()((()((())))((()))()(())(()(())((()))(()))()(((()(\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "100\n)()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDaniel has a string s, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replacement as the following sequence of steps: find a substring \"..\" (two consecutive peri... | [{"type": "stdin_stdout", "input": "2 7\nab\n1 w\n2 w\n1 c\n2 .\n2 .\n1 .\n2 b\n", "output": "0\n0\n0\n0\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "2 7\nab\n1 w\n2 w\n1 c\n2 .\n2 .\n1 .\n2 b\n", "output": "0\n0\n0\n0\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "2 7\nab\n2 w\n2 w\n1 c\n2 .\n2 .\n1 .\n2 b\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thoug... | [{"type": "stdin_stdout", "input": "-16 2\n", "output": "5/6\n"}, {"type": "stdin_stdout", "input": "-16 3\n", "output": "2/3\n"}, {"type": "stdin_stdout", "input": "-12 2\n", "output": "5/6\n"}, {"type": "stdin_stdout", "input": "3 -12\n", "output": "2/3\n"}, {"type": "stdin_stdout", "input": "-12 3\n", "output": "2/3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGreg has an array a = a_1, a_2, ..., a_{n} and m operations. Each operation looks as: l_{i}, r_{i}, d_{i}, (1 β€ l_{i} β€ r_{i} β€ n). To apply operation i to the array means to increase all array elements with numbers l_{i}... | [{"type": "stdin_stdout", "input": "4 3 6\n2 2 3 4\n1 2 2\n2 3 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3\n", "output": "10 22 31 20\n"}, {"type": "stdin_stdout", "input": "4 3 6\n2 2 3 4\n1 2 2\n3 3 2\n3 4 4\n1 2\n1 3\n2 3\n1 2\n1 3\n2 3\n", "output": "10 10 31 20\n"}, {"type": "stdin_stdout", "input": "4 3 6\n2 2 3 4\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string $s$ consisting of $n$ lowercase Latin letters. Polycarp wants to remove exactly $k$ characters ($k \\le n$) from the string $s$. Polycarp uses the following algorithm $k$ times:\n\n if there is at ... | [{"type": "stdin_stdout", "input": "26 1\nabcdefghijklmnopqrstuvwxyz\n", "output": "bcdefghijklmnopqrstuvwxyz\n"}, {"type": "stdin_stdout", "input": "26 1\nabcdefghijklmnopqrsuuvwxyz\n", "output": "bcdefghijklmnopqrsuuvwxyz\n"}, {"type": "stdin_stdout", "input": "26 2\nabcdefghijklmnopqrstuvwxyz\n", "output": "cdefghij... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of positive integers a1, a2, ..., an Γ T of length n Γ T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of the given array.\n\nInput\... | [{"type": "stdin_stdout", "input": "100 10000000\n300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 300 30... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter finding and moving to the new planet that supports human life, discussions started on which currency should be used. After long negotiations, Bitcoin was ultimately chosen as the universal currency.\n\nThese were th... | [{"type": "stdin_stdout", "input": "10\n1 10 100 1000 10000 100000 1000000 10000000 100000000 1000000001\n1000000000 999999999\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "10\n1 10 100 1000 10000 100000 1000000 11000000 100000000 1000000001\n1000000000 999999999\n", "output": "999999999\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou and your n - 1 friends have found an array of integers a_1, a_2, ..., a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the person at the front of... | [{"type": "stdin_stdout", "input": "4\n6 4 2\n3 9 2 3 8 4\n4 3 1\n1 13 60 4\n4 1 3\n1 0 2 1\n2 2 2\n1 2\n", "output": "8\n60\n1\n2\n"}, {"type": "stdin_stdout", "input": "4\n6 4 2\n2 7 4 5 8 7\n4 4 1\n8 13 111 4\n4 1 2\n1 2 2 1\n2 2 1\n2 3\n", "output": "7\n8\n1\n3\n"}, {"type": "stdin_stdout", "input": "4\n6 4 2\n2 7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and the hard version is the constraint on $n$.\n\nYou are given an undirected complete graph on $n$ vertices. A complete graph is a graph where each pair of vertices is connected by an... | [{"type": "stdin_stdout", "input": "1337\n", "output": "520628749\n"}, {"type": "stdin_stdout", "input": "1000\n", "output": "756980810\n"}, {"type": "stdin_stdout", "input": "3000\n", "output": "596853783\n"}, {"type": "stdin_stdout", "input": "4500\n", "output": "299551211\n"}, {"type": "stdin_stdout", "input": "100\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the world of Latin Alphabets, there seemed to be a catastrophe! All the vowels went missing. The other alphabets got disturbed and began the search operation.\nWhile searching they stumbled upon a garbage of letters. C... | [{"type": "stdin_stdout", "input": "10000\nmrbbmoswthlzegrlsoygzcjaenksbbdtecgljyvcbpjxizzsksmdhnrsnteptajetyewidaxiekcabocistqjkohfqypiydmgoqrqrdisjyrzykgvkggyqmqvyhhwzzxhyalielptfgqvgypjtsbaieljbanvksvnnjajcdinjtknhwfclefcvalsarpxcnfivyayqeslwpgxnevbksldcrfdddlxqirbdcatiiwxyssnmvwgtikarylhejqzrtbztzstpbdfefttscpeivrb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe winter in Berland lasts n days. For each day we know the forecast for the average air temperature that day. \n\nVasya has a new set of winter tires which allows him to drive safely no more than k days at any average a... | [{"type": "stdin_stdout", "input": "100 50\n-7 -3 9 2 16 -19 0 -10 3 -11 17 7 -7 -10 -14 -14 -7 -15 -15 -8 8 -18 -17 -5 -19 -15 -14 0 8 -3 -19 -13 -3 11 -3 -16 16 -16 -12 -2 -17 7 -16 -14 -10 0 -10 -18 -16 -11 -2 -12 -15 -8 -1 -11 -3 -17 -14 -6 -9 -15 -14 -11 -20 -20 -4 -20 -14 -2 0 -2 -20 17 -17 2 0 1 2 6 -5 -13 -16 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \\ldots, Dish N) once.\nThe i-th dish (1 \\leq i \\leq N) he ate was Dish A_i.\nWhen he eats Dish i (1 \\leq i \\leq ... | [{"type": "stdin_stdout", "input": "20\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\n", "output": "1950\n"}, {"type": "stdin_stdout", "input": "20\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEasy and hard versions are actually different problems, so we advise you to read both statements carefully.\n\nYou are given a weighted rooted tree, vertex 1 is the root of this tree. Also, each edge has its own cost.\n\n... | [{"type": "stdin_stdout", "input": "4\n4 18\n2 1 9 2\n3 2 4 1\n4 1 1 2\n3 20\n2 1 8 1\n3 1 7 2\n5 50\n1 3 100 1\n1 5 10 2\n2 3 123 2\n5 4 55 1\n2 000\n1 2 409 2\n", "output": "0\n0\n11\n18\n"}, {"type": "stdin_stdout", "input": "4\n4 18\n2 1 18 2\n3 2 4 1\n4 1 2 2\n3 20\n2 1 2 1\n3 1 8 2\n5 50\n1 3 100 1\n1 5 10 2\n2 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n* 1 \\leq x,y,z\n* x^2 + y^2 + z^2 + xy + yz + zx = n\n\n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,... | [{"type": "stdin_stdout", "input": "743", "output": "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n0\n0\n0\n1\n6\n0\n3\n0\n0\n0\n0\n0\n3\n3\n6\n0\n0\n3\n0\n0\n0\n0\n3\n3\n6\n0\n6\n0\n0\n0\n3\n0\n0\n1\n6\n0\n6\n6\n0\n0\n6\n0\n0\n0\n0\n3\n3\n3\n6\n0\n6\n3\n6\n0\n0\n0\n6\n0\n0\n0\n3\n3\n9\n0\n6\n3\n6\n0\n3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou already know that Valery's favorite sport is biathlon. Due to your help, he learned to shoot without missing, and his skills are unmatched at the shooting range. But now a smaller task is to be performed, he should le... | [{"type": "stdin_stdout", "input": "20 20 2\nbaaaaaaaaaaaaaaaaaaa\nbfffffffacfffffffffa\nbgggggggaccgggggggga\nbhhhhhhhaccchhhhhhha\nbiiiiiiiacccciiiiiia\nbjjjjjjjacccccjjjjja\nbkkkkkkkacccccckkkka\nblllllllacccccccllla\nbbbbbbbbSccccccccmma\nbddddddddddcccccccna\nbodddddddcccccccccca\nbppddddddddTaaaaaaaa\nbqqqddddddd... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta Claus is the first who came to the Christmas Olympiad, and he is going to be the first to take his place at a desk! In the classroom there are n lanes of m desks each, and there are two working places at each of the... | [{"type": "stdin_stdout", "input": "10000 10000 199999999\n", "output": "10000 10000 L\n"}, {"type": "stdin_stdout", "input": "10000 10000 200000000\n", "output": "10000 10000 R\n"}, {"type": "stdin_stdout", "input": "10000 10000 199999999\n", "output": "10000 10000 L\n"}, {"type": "stdin_stdout", "input": "10000 10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ points on a coordinate axis $OX$. The $i$-th point is located at the integer point $x_i$ and has a speed $v_i$. It is guaranteed that no two points occupy the same coordinate. All $n$ points move with the co... | [{"type": "stdin_stdout", "input": "5\n2 1 4 3 5\n2 2 2 3 4\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "5\n2 1 4 3 5\n0 2 2 3 4\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "5\n2 1 4 3 5\n2 2 2 3 4\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "3\n1 3 2\n-100 2 10\n", "output": "3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nSometimes mysteries happen. Chef found a directed graph with N vertices and M edges in his kitchen! \nThe evening was boring and chef has nothing else to do, ... | [{"type": "stdin_stdout", "input": "12 7\n1 2 \n4 2\n3 4\n7 12\n2 2\n9 9\n10 1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12 7\n1 2 \n4 2\n3 4\n8 12\n2 2\n9 9\n10 1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12 7\n1 2 \n4 2\n3 4\n7 7\n2 1\n11 2\n11 1", "output": "-1\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are walking through a parkway near your house. The parkway has $n+1$ benches in a row numbered from $1$ to $n+1$ from left to right. The distance between the bench $i$ and $i+1$ is $a_i$ meters.\n\nInitially, you have... | [{"type": "stdin_stdout", "input": "1\n100 7773\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... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nOne day, Taro, who lives in JOI town, decided to take a walk as a daily routine to improve his health. In JOI town, where Taro lives, he runs in the east-west direction as shown in the figure (H + 1). The road ... | [{"type": "stdin_stdout", "input": "3 4 2\n1 -1 1 1\n0 1 1 -2\n0 0 -1 1\n0 0 0", "output": "4 1\n"}, {"type": "stdin_stdout", "input": "3 4 3\n1 0 1 1\n0 1 -1 -1\n1 0 1 1\n0 0 0", "output": "1 5\n"}, {"type": "stdin_stdout", "input": "3 4 3\n1 0 1 1\n0 1 1 -2\n0 0 -1 1\n0 0 0", "output": "1 5\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSlime has a sequence of positive integers $a_1, a_2, \\ldots, a_n$.\n\nIn one operation Orac can choose an arbitrary subsegment $[l \\ldots r]$ of this sequence and replace all values $a_l, a_{l + 1}, \\ldots, a_r$ to the... | [{"type": "stdin_stdout", "input": "5\n5 3\n1 5 2 6 1\n1 6\n6\n3 2\n1 2 3\n4 3\n3 1 2 3\n10 3\n1 2 3 4 5 6 7 8 9 10\n", "output": "no\nyes\nyes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "5\n5 3\n1 5 2 6 1\n1 6\n6\n3 2\n1 2 3\n4 3\n3 1 2 3\n10 3\n1 2 3 4 8 6 7 8 9 10\n", "output": "no\nyes\nyes\nno\nyes\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAizu is famous for its buckwheat. There are many people who make buckwheat noodles by themselves.\n\nOne day, you went shopping to buy buckwheat flour. You can visit three shops, A, B and C. The amount in a bag and its un... | [{"type": "stdin_stdout", "input": "500\n1000\n0", "output": "850\n1520\n"}, {"type": "stdin_stdout", "input": "500\n1100\n0", "output": "850\n1950\n"}, {"type": "stdin_stdout", "input": "500\n2200\n0", "output": "850\n3390"}, {"type": "stdin_stdout", "input": "500\n0000\n-12", "output": "850\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe famous joke programming language HQ9+ has only 4 commands. In this problem we will explore its subset β a language called HQ...\n\n\n-----Input-----\n\nThe only line of the input is a string between 1 and 10^6 charact... | [{"type": "stdin_stdout", "input": "HQQQQQQQHQQQQHQHQQQHHQHHHQQHQQQQHHQHHQHHHHHHQQQQQQQQHHQQQQQHHQQQQHHHQQQQQQQQHQQQHQHQQQQQQHHHQHHQHQHHQQQQQHQQHQHQQQHQHQHHHHQQHQHQQQQQHQQQHQQQHQQHQHQQHQQQQQQ\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "HQQQQQQQHQQQQHQHQQQHHQHHHQQHQQQQHHQHHQHHHHHHQQQQQQQQHHQQQQQHHQQQQHHHQQ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is same as the next one, but has smaller constraints.\n\nShiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, her house is too small, so... | [{"type": "stdin_stdout", "input": "10\n30518 30518 30518 30518 30518 30518 30518 30518 30518 30518\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n30518 96518 74071 59971 50121 4862 43967 73607 19138 90754\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n63649 14562 779 31060 84730 3390 1402... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are working as a night watchman in an office building. Your task is to check whether all the lights in the building are turned off after all the office workers in the building have left the office. If there are lights... | [{"type": "stdin_stdout", "input": "1 1 1\n0\n2 2 1\n1 1\n1 1\n3 2 1\n1 0 1\n0 1 -1\n3 3 1\n1 0 0\n0 1 0\n1 0 1\n4 4 2\n1 1 0 1\n0 0 0 1\n1 0 1 1\n1 0 0 0\n5 5 1\n1 1 1 0 1\n0 1 0 1 0\n1 0 1 0 1\n0 1 1 1 0\n1 0 1 0 0\n5 1 2\n0 0 0 0 0\n0 0 0 0 0\n0 0 1 0 0\n0 0 0 0 0\n0 0 0 0 1\n11 11 3\n0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nThere is an unsigned $ 2 $ decimal integer $ X $ with $ N $ in digits including Leading-zeros. Output the largest non-negative integer that can be expressed in $ 2 $ base in $ N $ digits where the Ham... | [{"type": "stdin_stdout", "input": "5\n00001\n4", "output": "11111\n"}, {"type": "stdin_stdout", "input": "5\n00000\n3", "output": "11100\n"}, {"type": "stdin_stdout", "input": "5\n00001\n1", "output": "10001\n"}, {"type": "stdin_stdout", "input": "5\n10001\n1", "output": "11001\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings $s$ and $t$. The string $s$ consists of lowercase Latin letters and at most one wildcard character '*', the string $t$ consists only of lowercase Latin letters. The length of the string $s$ equal... | [{"type": "stdin_stdout", "input": "5 102\neyw*y\neywsnxcwslfyiqbbeoaawtmioksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdveqguyfk\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 102\neyw*y\neywsnxcwslfyiqbbeoaawtmioksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdv... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\nACM\n\n\nOutput\n\n0\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve this problem. Your program sho... | [{"type": "stdin_stdout", "input": "ABM", "output": "0\n"}, {"type": "stdin_stdout", "input": "BIB", "output": "2\n"}, {"type": "stdin_stdout", "input": "1MI", "output": "1\n"}, {"type": "stdin_stdout", "input": "MCA", "output": "0\n"}, {"type": "stdin_stdout", "input": "MAC", "output": "0\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe programming competition season has already started and it's time to train for ICPC. Sereja coaches his teams for a number of year and he knows that to get ready for the training session it's not enough to prepare only... | [{"type": "stdin_stdout", "input": "100\n56 22 13 79 28 73 16 55 34 0 97 19 22 36 22 80 30 19 36 92 9 38 24 10 61 43 19 12 18 34 21 36 1 17 0 97 72 37 74 70 51 34 33 87 27 33 45 97 38 56 2 32 88 92 64 51 74 94 86 98 57 62 83 3 87 61 9 65 57 13 64 10 50 35 7 75 41 3 70 66 6 55 69 42 91 75 14 22 68 93 2 53 22 98 45 2 78 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle penguin Polo loves his home village. The village has n houses, indexed by integers from 1 to n. Each house has a plaque containing an integer, the i-th house has a plaque containing integer p_{i} (1 β€ p_{i} β€ n).\n... | [{"type": "stdin_stdout", "input": "1000 8\n", "output": "339760446\n"}, {"type": "stdin_stdout", "input": "1000 1\n", "output": "760074701\n"}, {"type": "stdin_stdout", "input": "1000 2\n", "output": "675678679\n"}, {"type": "stdin_stdout", "input": "1000 3\n", "output": "330155123\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter you had helped George and Alex to move in the dorm, they went to help their friend Fedor play a new computer game Β«Call of Soldiers 3Β».\n\nThe game has (m + 1) players and n types of soldiers in total. Players Β«Call... | [{"type": "stdin_stdout", "input": "13 27 7\n1893\n370\n7320\n5753\n4418\n2146\n2702\n5013\n5959\n1929\n7611\n7013\n540\n3454\n4271\n2887\n4724\n3520\n2111\n5845\n1868\n7659\n3040\n3775\n6507\n4917\n7506\n2515\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "13 27 7\n1893\n370\n7320\n5753\n4418\n2146\n2702\n50... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNowadays the one-way traffic is introduced all over the world in order to improve driving safety and reduce traffic jams. The government of Berland decided to keep up with new trends. Formerly all n cities of Berland were... | [{"type": "stdin_stdout", "input": "50\n30 34 48\n11 30 15\n11 5 179\n4 5 57\n43 4 21\n14 43 74\n14 19 52\n45 19 60\n45 28 52\n24 28 94\n24 26 2\n48 26 34\n48 13 53\n13 42 7\n42 37 23\n37 17 70\n17 7 29\n20 7 93\n33 20 21\n33 2 53\n21 2 83\n49 21 33\n46 49 28\n18 46 1\n36 18 99\n47 36 52\n47 29 41\n41 29 40\n31 41 45\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCatherine received an array of integers as a gift for March 8. Eventually she grew bored with it, and she started calculated various useless characteristics for it. She succeeded to do it for each one she came up with. Bu... | [{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 15 11 10 11 5 13 14 15 16 17 18 19 20 3 22 23 24 16 26 27 28 29 29 43 32 33 34 35 36 37 38 39 40 41 76 43 44 45 46 47 48 41 50 51 52 53 54 55 97 57 58 59 60 61 62 63 64 65 66 67 68 30 70 71 72 73 74 75 76 77 78 79 80 81 88 83 84 85 86 87 88 265 90 91 92 93 94 95 96... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the following two conditions are satisfied:\n\n * a12 + a22 + ... + an2 β₯ x\n * a1 + a2 + ... + an β€ y\n\nInput\n\nThe first l... | [{"type": "stdin_stdout", "input": "45678 783917268558 931068\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect.\n\nThe interior of the square is consider... | [{"type": "stdin_stdout", "input": "-17 -91 -17 -27 -81 -27 -81 -91\n-48 -21 -12 -57 -48 -93 -84 -57\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-17 -91 -17 -27 -81 -27 -81 -91\n-48 -21 -12 -57 -48 -93 -84 -57\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-100 -100 -100 -99 -99 -99 -99 -100\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvery great chef knows that lucky numbers are positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. \n\nOur chef has rec... | [{"type": "stdin_stdout", "input": "5\n6\n21\n18\n2\n10", "output": "-1\n21\n14\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "5\n9\n2\n14\n2\n25", "output": "-1\n-1\n14\n-1\n21\n"}, {"type": "stdin_stdout", "input": "5\n40\n5\n35\n1\n15", "output": "28\n-1\n35\n-1\n7\n"}, {"type": "stdin_stdout", "input": "5\n40\n5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere is a mysterious device $ M $, and if you put Tanuki and Fox in this device, one animal will come out from the device (hereinafter, Tanuki will be $ T $ and Fox will be $ F $).\n\n$ M (x, y) $ represents a... | [{"type": "stdin_stdout", "input": "3\nF S T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nF R T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nG S T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nG R T", "output": "T\n"}, {"type": "stdin_stdout", "input": "3\nH R T", "output": "T\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer $x$ and an array of integers $a_1, a_2, \\ldots, a_n$. You have to determine if the number $a_1! + a_2! + \\ldots + a_n!$ is divisible by $x!$.\n\nHere $k!$ is a factorial of $k$ β the product of ... | [{"type": "stdin_stdout", "input": "79 6\n2 2 4 3 5 1 2 2 1 5 5 3 2 1 3 4 2 1 2 1 2 2 3 1 6 6 6 3 1 3 6 3 4 5 1 2 2 3 1 5 3 4 1 3 1 3 1 1 5 2 3 3 2 2 3 1 3 5 5 1 1 3 3 4 3 1 5 4 1 4 4 1 3 1 2 1 1 1 1\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "10 5\n4 3 2 1 4 3 2 4 3 4\n", "output": "No\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGeorge decided to prepare a Codesecrof round, so he has prepared m problems for the round. Let's number the problems with integers 1 through m. George estimates the i-th problem's complexity by integer b_{i}.\n\nTo make t... | [{"type": "stdin_stdout", "input": "29 100\n20 32 41 67 72 155 331 382 399 412 465 644 484 511 515 529 690 637 679 715 733 763 826 843 862 903 276 979 989\n15 15 15 17 18 22 19 20 21 21 22 8 25 26 26 27 28 31 32 32 37 42 38 39 39 40 41 42 43 43 35 45 46 47 49 49 50 50 50 51 52 53 53 55 56 57 24 59 59 60 60 62 62 63 63 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn vacations n pupils decided to go on excursion and gather all together. They need to overcome the path with the length l meters. Each of the pupils will go with the speed equal to v1. To get to the excursion quickly, it... | [{"type": "stdin_stdout", "input": "10010 1000000000 999999999 1000000000 1\n", "output": "1.0000000009999002\n"}, {"type": "stdin_stdout", "input": "10000 1000000000 999999999 1000000000 10000\n", "output": "1.000000000"}, {"type": "stdin_stdout", "input": "10010 1000000000 1 1000000000 10000\n", "output": "2.99999999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1. \n\nYour task is to find out if it is possible to rearr... | [{"type": "stdin_stdout", "input": "xxxxxxxxxxfxxxxxxxxxxxxxxxxxxxxxxxxxxxrxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxexxxxmxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxexxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxtxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxuxxxx... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A... | [{"type": "stdin_stdout", "input": "2\n101\n010\n1111\n1010\n", "output": "Lucky Chef\n2\nUnlucky Chef\n"}, {"type": "stdin_stdout", "input": "2\n101\n011\n1111\n1010", "output": "Lucky Chef\n1\nUnlucky Chef\n"}, {"type": "stdin_stdout", "input": "2\n001\n111\n1111\n1010", "output": "Lucky Chef\n2\nUnlucky Chef\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSuppose you have two polynomials <image> and <image>. Then polynomial <image> can be uniquely represented in the following way:\n\n<image>\n\nThis can be done using [long division](https://en.wikipedia.org/wiki/Polynomial... | [{"type": "stdin_stdout", "input": "150\n", "output": "150\n1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a string S of length N consisting of lowercase English letters. On this string, he will perform the following operation K times:\n\n* Let T be the string obtained by reversing S, and U be the string obtained... | [{"type": "stdin_stdout", "input": "10 2\nbbbabbbaaa", "output": "aaaaaaaaaa\n"}, {"type": "stdin_stdout", "input": "10 3\nbbaabbbaab", "output": "aaaaaaaabb\n"}, {"type": "stdin_stdout", "input": "10 2\nbaabbbaabb", "output": "aaaabbbaab\n"}, {"type": "stdin_stdout", "input": "10 2\nbaabbaaabb", "output": "aaaaaabbbb\... | 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\nSuppose you are living with two cats: A and B. There are $n$ napping spots where both cats usually sleep.\n\nYour cats like to sleep and also like all these spots, so they change napping spot each hour cyclically:\n\nCat ... | [{"type": "stdin_stdout", "input": "7\n2 1\n2 2\n3 1\n3 2\n3 3\n5 5\n69 1337\n", "output": "\n1\n2\n1\n3\n2\n2\n65\n"}, {"type": "stdin_stdout", "input": "7\n2 1\n2 2\n3 1\n3 2\n3 3\n5 5\n69 1337\n", "output": "1\n2\n1\n3\n2\n2\n65\n"}, {"type": "stdin_stdout", "input": "7\n2 1\n2 2\n3 1\n3 2\n3 3\n5 5\n69 1154\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N squares arranged in a row from left to right.\nThe height of the i-th square from the left is H_i.\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as t... | [{"type": "stdin_stdout", "input": "9449\n43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505 43482505... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two sequences $a_1, a_2, \\dots, a_n$ and $b_1, b_2, \\dots, b_n$. Each element of both sequences is either $0$, $1$ or $2$. The number of elements $0$, $1$, $2$ in the sequence $a$ is $x_1$, $y_1$, $z_1$ re... | [{"type": "stdin_stdout", "input": "1\n45094381 58629867 47778466\n33028864 48902149 69571701\n", "output": "46602292\n"}, {"type": "stdin_stdout", "input": "1\n45094381 58629867 47778466\n33028864 48902149 69571701\n", "output": "46602292\n"}, {"type": "stdin_stdout", "input": "3\n2 3 2\n3 3 1\n4 0 1\n2 3 0\n0 0 1\n0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDraw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm.\n\n\n\n........#\n........#\n........#\n........#\n\n\n\nConstr... | [{"type": "stdin_stdout", "input": "5 7\n2 1\n17 12\n0 0", "output": "#######\n#.....#\n#.....#\n#.....#\n#######\n\n#\n#\n\n############\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\n#..........#\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program to find the remainder when an integer A is divided by an integer B.\n\n-----Input-----\n\nThe first line contains an integer T, the total number of test cases. Then T lines follow, each line contains two I... | [{"type": "stdin_stdout", "input": "3 \n1 4\n111 1167\n12 36", "output": "1\n111\n12\n"}, {"type": "stdin_stdout", "input": "3 \n1 4\n111 1167\n20 36", "output": "1\n111\n20\n"}, {"type": "stdin_stdout", "input": "3 \n2 4\n111 1167\n20 65", "output": "2\n111\n20\n"}, {"type": "stdin_stdout", "input": "3\n1 2\n100 200\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet there be an array $b_1, b_2, \\ldots, b_k$. Let there be a partition of this array into segments $[l_1; r_1], [l_2; r_2], \\ldots, [l_c; r_c]$, where $l_1 = 1$, $r_c = k$, and for any $2 \\leq i \\leq c$ holds that $r... | [{"type": "stdin_stdout", "input": "30\n1\n0\n2\n0 0\n2\n0 1\n2\n1 0\n1\n1000000000\n2\n1000000000 1000000000\n2\n999999999 1000000000\n2\n1000000000 999999999\n5\n0 1 2 3 4\n5\n4 3 2 1 0\n5\n1 0 0 0 2\n1\n0\n5\n0 0 0 3 0\n1\n1\n1\n0\n1\n0\n1\n1\n2\n2 2\n5\n4 4 5 5 3\n4\n2 1 1 1\n5\n2 1 2 0 2\n1\n0\n1\n0\n4\n0 1 0 0\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLucy likes letters. She studied the definition of the lexicographical order at school and plays with it.\n\nAt first, she tried to construct the lexicographically smallest word out of given letters. It was so easy! Then s... | [{"type": "stdin_stdout", "input": "100 1 92\nxwcbimztwcyuckyappbkrddnxgnxqvmobveinzvvnseqxooecwrrdeuwzfzxvfkvguqrsofbbnhfcscxggpxzmruycgqfmnnoovd\n", "output": "a\nb\nb\nb\nb\nb\nc\nc\nc\nc\nc\nc\nc\nd\nd\nd\nd\ne\ne\ne\ne\nf\nf\nf\nf\nf\ng\ng\ng\ng\ng\nh\ni\ni\nk\nk\nk\nm\nm\nm\nm\nn\nn\nn\nn\nn\nn\nn\no\no\no\no\no\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAcacius is studying strings theory. Today he came with the following problem.\n\nYou are given a string $s$ of length $n$ consisting of lowercase English letters and question marks. It is possible to replace question mark... | [{"type": "stdin_stdout", "input": "6\n7\nabacaba\n7\n???????\n11\naba?abaaabc\n11\nabacaba?aba\n15\nrewq???f???fdsa\n11\ncbaaabacaba\n", "output": "yes\nabacaba\nyes\nabacaba\nyes\nabacabaaabc\nyes\nabacabazaba\nno\nyes\ncbaaabacaba\n"}, {"type": "stdin_stdout", "input": "6\n7\nabacaba\n7\n???????\n11\naba?abaaabc\n11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDue to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given the task of buying mouses, and you have to spend as little as possible. After all, the ... | [{"type": "stdin_stdout", "input": "37 80 100\n31\n901706521 USB\n555265160 PS/2\n547038505 PS/2\n644436873 PS/2\n105558073 USB\n915082057 PS/2\n913113815 USB\n953413471 PS/2\n252912707 PS/2\n830344497 USB\n781593007 USB\n610659875 PS/2\n177755858 PS/2\n496444729 PS/2\n617569418 USB\n304908147 PS/2\n188649950 PS/2\n705... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Red Kingdom is attacked by the White King and the Black King!\n\nThe Kingdom is guarded by $n$ castles, the $i$-th castle is defended by $a_i$ soldiers. To conquer the Red Kingdom, the Kings have to eliminate all the ... | [{"type": "stdin_stdout", "input": "10\n6 3 4 5\n2 3 2 3 1 3\n1 5 4 3\n10\n4 4 2 3\n0 10 14 5\n2 2 1 4\n8 5\n3 5 3 5\n9 2 10\n4 5 5 5\n2 10 2 2\n2 3 1 4\n1 10\n3 1 5 3\n11 8 7\n2 5 4 5\n8 8\n3 5 1 4\n5 2 10\n", "output": "0\n2\n3\n2\n5\n12\n5\n0\n0\n2\n"}, {"type": "stdin_stdout", "input": "10\n6 3 4 5\n2 3 2 3 1 3\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef likes rectangles. Among all possible rectangles, he loves rectangles that can be drawn like a grid, such that they have N rows and M columns. Grids are common in Byteland. Hence, Chef has drawn such a rectangle and p... | [{"type": "stdin_stdout", "input": "3\n1 10 2\n4 2 2\n1 9 -2", "output": "2\n1\n-2\n"}, {"type": "stdin_stdout", "input": "3\n2 14 2\n4 2 2\n1 9 -2", "output": "1\n1\n-2\n"}, {"type": "stdin_stdout", "input": "3\n2 18 2\n4 2 3\n1 4 -1", "output": "1\n2\n-1\n"}, {"type": "stdin_stdout", "input": "3\n2 2 1\n3 1 2\n1 5 12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an infinite sequence consisting of all positive integers in the increasing order: p = {1, 2, 3, ...}. We performed n swap operations with this sequence. A swap(a, b) is an operation of swapping the elements of th... | [{"type": "stdin_stdout", "input": "30\n1 200000\n2 199999\n3 199998\n4 199997\n5 199996\n200001 399996\n200002 399997\n200003 399998\n200004 399999\n200005 400000\n400001 599998\n400002 599999\n400003 600000\n400004 599996\n400005 599995\n600001 800000\n600002 799999\n600003 799998\n600004 799997\n600005 799996\n60000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a garden consisting entirely of grass and weeds. Your garden is described by an n Γ m grid, with rows numbered 1 to n from top to bottom, and columns 1 to m from left to right. Each cell is identified by a pair (... | [{"type": "stdin_stdout", "input": "3 150\nGGGWGGGGWWGGGGGGGGGGGGGWGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGWGGGGGGGWGGGGGGGGGGGGGGGGGWGGGGGGGGGGGGGGGGGGW\nGGGGGGGGGGGGWGGGGGGGGGWGGGGGGGGGGGGWGGGGGWGGGGGGGWGGGGGGGWGGGGGWGGGGGGGGGGGGGGGGGGGGGGGGWGGGGWGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nInput\n\nThe input contains two integers row, col (0 β€ row, col β€ 63), separated by a single space.\n\nOutput\n\nOutput \"IN\" or \"OUT\".\n\nExamples\n\nInput\n\n\n0 0\n\n\nOutput\n\n\nOUT\n\n\nInput\n\n\n27 0... | [{"type": "stdin_stdout", "input": "27 36\n", "output": "OUT\n"}, {"type": "stdin_stdout", "input": "0 45\n", "output": "OUT\n"}, {"type": "stdin_stdout", "input": "53 27\n", "output": "IN\n"}, {"type": "stdin_stdout", "input": "0 18\n", "output": "OUT\n"}, {"type": "stdin_stdout", "input": "51 1\n", "output": "OUT\n"}... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.