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\nToday an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya!\n\nSonya is an owl and she sleeps during the day and stay awake from minute l_1 to minute r_1 inclusive. Also,... | [{"type": "stdin_stdout", "input": "519325240668210886 776112702001665034 360568516809443669 875594219634943179 994594983925273138\n", "output": "256787461333454149\n"}, {"type": "stdin_stdout", "input": "700062402405871919 762322967106512617 297732773882447821 747309903322652819 805776739998108178\n", "output": "47247... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe process of mammoth's genome decoding in Berland comes to its end!\n\nOne of the few remaining tasks is to restore unrecognized nucleotides in a found chain s. Each nucleotide is coded with a capital letter of English ... | [{"type": "stdin_stdout", "input": "252\n???????GCG??T??TT?????T?C???C?CCG???GA???????AC??A???AAC?C?CC??CCC??A??TA?CCC??T???C??CA???CA??G????C?C?C????C??C??A???C?T????C??ACGC??CC?A?????A??CC?C??C?CCG?C??C??A??CG?A?????A?CT???CC????CCC?CATC?G??????????A???????????????TCCCC?C?CA??AC??GC????????\n", "output": "AAAAAAAGCGA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIlya is an experienced player in tic-tac-toe on the 4 × 4 field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The friends became tired and didn't finish the last game. It was ... | [{"type": "stdin_stdout", "input": "xx..\n.oo.\nx...\noox.\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "x..x\n..oo\no...\nx.xo\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": ".xox\no.x.\nx.o.\n..o.\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "o.oo\n.x.o\nx.x.\n.x..\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has an array a consisting of positive integer numbers. Vasya wants to divide this array into two non-empty consecutive parts (the prefix and the suffix) so that the sum of all elements in the first part equals to th... | [{"type": "stdin_stdout", "input": "100\n27 95 57 29 91 85 83 36 72 86 39 5 79 61 78 93 100 97 73 23 82 66 41 92 38 92 100 96 48 56 66 47 5 32 69 13 95 23 46 62 99 83 57 66 98 82 81 57 37 37 81 64 45 76 72 43 99 76 86 22 37 39 93 80 99 36 53 83 3 32 52 9 78 34 47 100 33 72 19 40 29 56 77 32 79 72 15 88 100 98 56 50 22 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA few years ago, Hitagi encountered a giant crab, who stole the whole of her body weight. Ever since, she tried to avoid contact with others, for fear that this secret might be noticed.\n\nTo get rid of the oddity and rec... | [{"type": "stdin_stdout", "input": "100 5\n175 30 124 0 12 111 6 0 119 108 0 38 127 3 151 114 95 54 4 128 91 11 168 120 80 107 18 21 149 169 0 141 195 20 78 157 33 118 17 69 105 130 197 57 74 110 138 84 71 172 132 93 191 44 152 156 24 101 146 26 2 36 143 122 104 42 103 97 39 116 115 0 155 87 53 85 7 43 65 196 136 154 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Duck song\n\nFor simplicity, we'll assume that there are only three types of grapes: green grapes, purple grapes and black grapes.\n\nAndrew, Dmitry and Michal are all grapes' lovers, however their preferences of grap... | [{"type": "stdin_stdout", "input": "100000 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "99999 100000 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100000 99999 100000\n100000 100000 100000\n", "output": "YES\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile swimming at the beach, Mike has accidentally dropped his cellphone into the water. There was no worry as he bought a cheap replacement phone with an old-fashioned keyboard. The keyboard has only ten digital equal-si... | [{"type": "stdin_stdout", "input": "9\n123456789\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "9\n103481226\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "9\n246112056\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "9\n289887167\n", "output": "YES\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSummer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assis... | [{"type": "stdin_stdout", "input": "50 2\n74 90\n68 33\n49 88\n52 13\n73 21\n77 63\n27 62\n8 52\n60 57\n42 83\n98 15\n79 11\n77 46\n55 91\n72 100\n70 86\n50 51\n57 39\n20 54\n64 95\n66 22\n79 64\n31 28\n11 89\n1 36\n13 4\n75 62\n16 62\n100 35\n43 96\n97 54\n86 33\n62 63\n94 24\n19 6\n20 58\n38 38\n11 76\n70 40\n44 24\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is a balmy spring afternoon, and Farmer John's n cows are ruminating about link-cut cacti in their stalls. The cows, labeled 1 through n, are arranged so that the i-th cow occupies the i-th stall from the left. However... | [{"type": "stdin_stdout", "input": "100000 100000\n", "output": "4999950000\n"}, {"type": "stdin_stdout", "input": "100000 40000\n", "output": "4799960000\n"}, {"type": "stdin_stdout", "input": "100000 50000\n", "output": "4999950000\n"}, {"type": "stdin_stdout", "input": "100000 50001\n", "output": "4999950000\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan is collecting coins. There are only $N$ different collectible coins, Ivan has $K$ of them. He will be celebrating his birthday soon, so all his $M$ freinds decided to gift him coins. They all agreed to three terms: ... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "-1"}, {"type": "stdin_stdout", "input": "530897800469409942 582203276934671957 137373076313041391 377446491430894140\n", "output": "-1"}, {"type": "stdin_stdout", "input": "2130100001149023... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's \"Black Square\", Polycarp wants to paint minimum possible number of whit... | [{"type": "stdin_stdout", "input": "20 10\nWWBWWWBBWW\nWWWWWBWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWBBBWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWWWWWWWWWW\nWBWWWWWBWW\nWBWWBWWWBW\nWWBWBWWWWW\nWWWBWWBBWW\nWWBBWBWBWW\nBBWWWWWBWW\nWWBWWBBBWW\nWWWBWBBWWW\nWWWBBWBWWW\nWWWWWWWWWW\nWWWBWWWWWW\nWWWWWWWWWW\n", "output": "-1\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a beautiful garden of stones in Innopolis.\n\nIts most beautiful place is the $n$ piles with stones numbered from $1$ to $n$.\n\nEJOI participants have visited this place twice. \n\nWhen they first visited it, th... | [{"type": "stdin_stdout", "input": "50\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\n1000 1000 1000 1000 1000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice got many presents these days. So she decided to pack them into boxes and send them to her friends.\n\nThere are $n$ kinds of presents. Presents of one kind are identical (i.e. there is no way to distinguish two gift... | [{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "751201557"}, {"type": "stdin_stdout", "input": "185182737 683516583\n", "output": "568113155"}, {"type": "stdin_stdout", "input": "798664260 289720442\n", "output": "405748370"}, {"type": "stdin_stdout", "input": "118448079 385479325\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKatya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segments o... | [{"type": "stdin_stdout", "input": "987654323\n", "output": "487730530870294164 487730530870294165"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "499999999000000000 499999999000000001"}, {"type": "stdin_stdout", "input": "999999937\n", "output": "499999937000001984 499999937000001985"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImp is watching a documentary about cave painting. [Image] \n\nSome numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of a number ... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "763169499725761451 488954176053755860\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "199398459594277592 452260924647536414\n", "output": "No\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKuro has recently won the \"Most intelligent cat ever\" contest. The three friends then decided to go to Katie's home to celebrate Kuro's winning. After a big meal, they took a small break then started playing games.\n\nK... | [{"type": "stdin_stdout", "input": "50 1\n-1 -1 -1 -1 -1 0 -1 -1 -1 0 1 0 -1 0 1 -1 -1 -1 1 0 1 -1 0 1 0 1 0 0 1 1 -1 1 -1 -1 1 1 -1 -1 0 -1 -1 1 -1 1 -1 1 1 0 0 -1\n", "output": "279519499"}, {"type": "stdin_stdout", "input": "50 1\n-1 -1 1 0 1 1 0 -1 1 0 -1 -1 0 0 -1 -1 0 1 1 -1 1 0 -1 1 1 -1 -1 -1 1 -1 -1 0 -1 0 -1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe mayor of the Central Town wants to modernize Central Street, represented in this problem by the $(Ox)$ axis.\n\nOn this street, there are $n$ antennas, numbered from $1$ to $n$. The $i$-th antenna lies on the position... | [{"type": "stdin_stdout", "input": "40 100000\n8644 429\n97881 2766\n98955 25663\n8679 187\n54897 23213\n64306 4647\n46280 23471\n31464 3\n35532 2\n95998 1352\n28824 3\n99405 3856\n47271 13832\n66959 7\n50599 11\n70318 293\n84159 236\n10893 1914\n54437 15065\n4468 3\n91940 32106\n87980 50\n81589 378\n8783 23\n11417 690... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a set of items, each having some integer weight not greater than $8$. You denote that a subset of items is good if total weight of items in the subset does not exceed $W$.\n\nYou want to calculate the maximum pos... | [{"type": "stdin_stdout", "input": "263313949370306890\n4140164751166140 6614205360468614 8773811688442168 7305250350819495 9250632788512985 7714928459050216 8422821279105776 5352796431133309\n", "output": "263313949370306890\n"}, {"type": "stdin_stdout", "input": "94517213607565382\n9730010615245182 9582835010066942 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSomeone gave Alyona an array containing n positive integers a_1, a_2, ..., a_{n}. In one operation, Alyona can choose any element of the array and decrease it, i.e. replace with any positive integer that is smaller than t... | [{"type": "stdin_stdout", "input": "10\n1 1 1 10000000 10000000 10000000 10000000 10000000 10000000 10000000\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "15\n1 2 2 20 23 25 28 60 66 71 76 77 79 99 100\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "20\n1 1 1 1 1 1 1 1 1 1 8 8 8 8 8 8 8 8 8 8\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Vasya found a golden ticket — a sequence which consists of $n$ digits $a_1a_2\\dots a_n$. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For ... | [{"type": "stdin_stdout", "input": "100\n0809740931424957283280264749151125408689778966769781910603952566405858112111930579193115510555198933\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100\n4360837235306857829226262079948050131795231482102447137288804547991971660484969090651046154392003840\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThose days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thou... | [{"type": "stdin_stdout", "input": "yufkkfwyhhvcjntsgsvpzbhqtmtgyxifqoewmuplphykmptfdebjxuaxigomjtwgtljwdjhjernkitifbomifbhysnmadtnyn\n", "output": "CHAT WITH HER!\n"}, {"type": "stdin_stdout", "input": "vlhrpzezawyolhbmvxbwhtjustdbqggexmzxyieihjlelvwjosmkwesfjmramsikhkupzvfgezmrqzudjcalpjacmhykhgfhrjx\n", "output": "I... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis morning, Roman woke up and opened the browser with $n$ opened tabs numbered from $1$ to $n$. There are two kinds of tabs: those with the information required for the test and those with social network sites. Roman de... | [{"type": "stdin_stdout", "input": "100 47\n-1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 1 -1\n", "output": "19\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nR3D3 spent some time on an internship in MDCS. After earning enough money, he decided to go on a holiday somewhere far, far away. He enjoyed suntanning, drinking alcohol-free cocktails and going to concerts of popular loc... | [{"type": "stdin_stdout", "input": "100000000 100000000 100000000\n", "output": "266578227200000000\n"}, {"type": "stdin_stdout", "input": "100000000 50000000 100000000\n", "output": "191720992950000000\n"}, {"type": "stdin_stdout", "input": "100000000 50000000 100000000\n", "output": "191720992950000000\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe circle line of the Roflanpolis subway has $n$ stations.\n\nThere are two parallel routes in the subway. The first one visits stations in order $1 \\to 2 \\to \\ldots \\to n \\to 1 \\to 2 \\to \\ldots$ (so the next sto... | [{"type": "stdin_stdout", "input": "100 26 63 60 23\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 2 97 84 89\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 43 55 42 15\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "47 15 45 28 38\n", "output": "YES\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUnlucky year in Berland is such a year that its number n can be represented as n = x^{a} + y^{b}, where a and b are non-negative integer numbers. \n\nFor example, if x = 2 and y = 3 then the years 4 and 17 are unlucky (4 ... | [{"type": "stdin_stdout", "input": "433333986179614514 1000000000000000000 433333986179614515 726628630292055493\n", "output": "293294644112440978\n"}, {"type": "stdin_stdout", "input": "650233444262690661 556292951587380938 715689923804218376 898772439356652923\n", "output": "183082515552434548\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBeroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them.\n\nBeroffice works only with small English letters (... | [{"type": "stdin_stdout", "input": "bddabcdfaccdabcdfadddabcdfabbdabcdfacddabcdfacdbabcdfacbbabcdfacbcabcdfacbdabcdfadbbabcdfabdbabcdfabdcabcdfabbcabcdfabccabcdfabbbabcdfaddcabcdfaccbabcdfadbdabcdfacccabcdfadcdabcdfadcbabcdfabcbabcdfadbcabcdfacdcabcdfabcdabcdfadccabcdfaddb\n", "output": "bd dabc dfacc dabc dfadddabc df... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare n potions.\n\nAnton has a special kettle, that can prepare one potions in x seconds.... | [{"type": "stdin_stdout", "input": "256 22 22\n45 42\n21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42\n21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42\n21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42\n21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecall that a binary search tree is a rooted binary tree, whose nodes each store a key and each have at most two distinguished subtrees, left and right. The key in each node must be greater than any key stored in the left... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "360561\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "699049\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "699047\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "699050\n", "output": "1\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou might have heard about the next game in Lara Croft series coming out this year. You also might have watched its trailer. Though you definitely missed the main idea about its plot, so let me lift the veil of secrecy.\n... | [{"type": "stdin_stdout", "input": "636553724 546535019 115079316355948443\n", "output": "425992073 546535018\n"}, {"type": "stdin_stdout", "input": "548492800 434105920 179638683192075937\n", "output": "134679777 434105920\n"}, {"type": "stdin_stdout", "input": "595261150 794915864 332353903994901365\n", "output": "17... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday, Osama gave Fadi an integer $X$, and Fadi was wondering about the minimum possible value of $max(a, b)$ such that $LCM(a, b)$ equals $X$. Both $a$ and $b$ should be positive integers.\n\n$LCM(a, b)$ is the smallest ... | [{"type": "stdin_stdout", "input": "1000000000000\n", "output": "4096 244140625\n"}, {"type": "stdin_stdout", "input": "999999999989\n", "output": "1 999999999989\n"}, {"type": "stdin_stdout", "input": "999966000289\n", "output": "1 999966000289\n"}, {"type": "stdin_stdout", "input": "991921850317\n", "output": "1 9919... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland annual chess tournament is coming!\n\nOrganizers have gathered 2·n chess players who should be divided into two teams with n people each. The first team is sponsored by BerOil and the second team is sponsored by B... | [{"type": "stdin_stdout", "input": "100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of n elements, you must make it a co-prime array in as few moves as possible.\n\nIn each move you can insert any positive integral number you want not greater than 10^9 in any place in the array.\n\... | [{"type": "stdin_stdout", "input": "100\n591 417 888 251 792 847 685 3 182 461 102 348 555 956 771 901 712 878 580 631 342 333 285 899 525 725 537 718 929 653 84 788 104 355 624 803 253 853 201 995 536 184 65 205 540 652 549 777 248 405 677 950 431 580 600 846 328 429 134 983 526 103 500 963 400 23 276 704 570 757 410 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of N integers: A_1, A_2, \\cdots, A_N.\nYou can perform the following operation between 0 and K times (inclusive):\n - Choose two integers i and j such that i \\neq j, each between 1 and N (inclusive). ... | [{"type": "stdin_stdout", "input": "500 1000000000\n1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat.\n\nAssume that ... | [{"type": "stdin_stdout", "input": "699050\n", "output": "19\n1 2 4 6 8 10 12 14 16 18 "}, {"type": "stdin_stdout", "input": "349525\n", "output": "19\n0 1 3 5 7 9 11 13 15 17 "}, {"type": "stdin_stdout", "input": "174762\n", "output": "17\n1 2 4 6 8 10 12 14 16 "}, {"type": "stdin_stdout", "input": "87381\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLuba thinks about watering her garden. The garden can be represented as a segment of length k. Luba has got n buckets, the i-th bucket allows her to water some continuous subsegment of garden of length exactly a_{i} each ... | [{"type": "stdin_stdout", "input": "100 100\n2 46 24 18 86 90 31 38 84 49 58 28 15 80 14 24 87 56 62 87 41 87 55 71 87 32 41 56 91 32 24 75 43 42 35 30 72 53 31 26 54 61 87 85 36 75 44 31 7 38 77 57 61 54 70 77 45 96 39 57 11 8 91 42 52 15 42 30 92 41 27 26 34 27 3 80 32 86 26 97 63 91 30 75 14 7 19 23 45 11 8 43 44 73... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he ... | [{"type": "stdin_stdout", "input": "100 20\n.....G.#.#..................#.........##....#...................#.#..........#...#.#.T..#.......#...\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 33\nG..................................................................................................T\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several advan... | [{"type": "stdin_stdout", "input": "111724 287004 931554 512877 139642 23002\n", "output": "257255.6532044368\n"}, {"type": "stdin_stdout", "input": "246310 320553 585881 278070 443362 23788\n", "output": "197686.6564327557\n"}, {"type": "stdin_stdout", "input": "435582 479389 540004 905521 413521 1624\n", "output": "4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! \n\nEvery day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, ... | [{"type": "stdin_stdout", "input": "117864695669097197 53280311324979856 171825292362519668\n", "output": "172505577730962281\n"}, {"type": "stdin_stdout", "input": "64058874468711639 248004345115813505 265277488186534632\n", "output": "218491756788544118\n"}, {"type": "stdin_stdout", "input": "100040306518636197 10004... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings a and b. You have to remove the minimum possible number of consecutive (standing one after another) characters from string b in such a way that it becomes a subsequence of string a. It can happen... | [{"type": "stdin_stdout", "input": "bbbbaabbababbaaaaababbaaabbbbaaabbbababbbbabaabababaabaaabbbabababbbabababaababaaaaa\nbbabaaaabaaaabbaaabbbabaaabaabbbababbbbbbbbbbabbababbaababbbaaabababababbbbaaababaaaaab\n", "output": "bbbbbbbabbababbaababbbaaabababababbbbaaababaaaaab\n"}, {"type": "stdin_stdout", "input": "aaeoj... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a pile, that consists of some number of stones. $n$ times he either took one stone from the pile or added one stone to the pile. The pile was non-empty before each operation of taking one stone from the pile.\n\... | [{"type": "stdin_stdout", "input": "100\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n", "output": "100"}, {"type": "stdin_stdout", "input": "100\n-+-+-+-+-+-+-+-+-+-+-+-+-+-+++++++++++++++-++++++++++++++++++++++++++++++++++-++++++++++++++++++++++\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more comp... | [{"type": "stdin_stdout", "input": "999999999999999999\n999999999000000000\n900000000000000000\n899999999999999999\n", "output": "100000000000000000\n"}, {"type": "stdin_stdout", "input": "100000000000000000\n100000000000000001\n1000000000000000\n999999999999999\n", "output": "99000000000000001\n"}, {"type": "stdin_std... | 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 9 1\n1 10\n", "output": "105 2"}, {"type": "stdin_stdout", "input": "10\n1 10\n9 5 7 6 1 2 3 9 8 4\n", "output": "105 1"}, {"type": "stdin_stdout", "input": "10\n9 8 7 6 2 3 5 4 10 1\n1 9\n", "output": "103 1"}, {"type": "stdin_stdout", "input": "10\n3 7 10 8\n7 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password ... | [{"type": "stdin_stdout", "input": "c7jqaudcqmv8o7zvb5x_gp6zcgl6nwr7tz5or!28.tj8s1m2.wxz5a4id03!rq07?662vy.7.p5?vk2f2mc7ag8q3861rgd0rmbr\n", "output": "Too weak\n"}, {"type": "stdin_stdout", "input": "i6a.,8jb,n0kv4.1!7h?p.96pnhhgy6cl7dg7e4o6o384ys3z.t71kkq,,w,oqi4?u,,m5!rzu6wym_4hm,ohjy!.vvksl?pt,,1\n", "output": "Too... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Berland each high school student is characterized by academic performance — integer value between 1 and 5.\n\nIn high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exac... | [{"type": "stdin_stdout", "input": "100\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine a city with n horizontal streets crossing m vertical streets, forming an (n - 1) × (m - 1) grid. In order to increase the traffic flow, mayor of the city has decided to make each street one way. This means in each... | [{"type": "stdin_stdout", "input": "20 20\n><<><<<<<<<>>><>>><<\n^^^^^^^^vvvv^vv^vvvv\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "20 20\n<>>>>>>>><>>><>><<<>\nvv^^vv^^^^v^vv^v^^^^\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "20 20\n>>><<<<<>>><><><<><<\n^^^vvv^^^v^^v^^v^vvv\n", "output": "Y... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImplication is a function of two logical arguments, its value is false if and only if the value of the first argument is true and the value of the second argument is false. \n\nImplication is written by using character '$... | [{"type": "stdin_stdout", "input": "200\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have two variables a and b. Consider the following sequence of actions performed with these variables: If a = 0 or b = 0, end the process. Otherwise, go to step 2; If a ≥ 2·b, then set the value of a to a - 2·b, and r... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "1000000000000000000 1000000000000000000\n"}, {"type": "stdin_stdout", "input": "17174219820754872 61797504734333370\n", "output": "17174219820754872 27449065092823626\n"}, {"type": "stdin_stdout", "input": "31960284556200 8515664... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x that a ≤ x ≤ b and x is divisible by k.\n\n\n-----Input-----\n\nThe only line contains thre... | [{"type": "stdin_stdout", "input": "1 -1000000000000000000 1000000000000000000\n", "output": "2000000000000000001\n"}, {"type": "stdin_stdout", "input": "2 -1000000000000000000 1000000000000000000\n", "output": "1000000000000000001\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 -1000000000000000000 1000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 1234567891011121314151617181920212223242526272829303... | [{"type": "stdin_stdout", "input": "10000\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "10000\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "2878\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "2879\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "2880\n", "output": "6\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA telephone number is a sequence of exactly $11$ digits such that its first digit is 8.\n\nVasya and Petya are playing a game. Initially they have a string $s$ of length $n$ ($n$ is odd) consisting of digits. Vasya makes ... | [{"type": "stdin_stdout", "input": "109\n8800880880088088880888808880888088800880888088088088888080880000080000800000808008008800080008000888000808880\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "95\n00008080008880080880888888088800008888000888800800000808808800888888088080888808880080808088008\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey thinks he is truly a successful developer, but in reality he didn't know about the binary search algorithm until recently. After reading some literature Andrey understood that this algorithm allows to quickly find ... | [{"type": "stdin_stdout", "input": "1000 1000 999\n", "output": "756641425\n"}, {"type": "stdin_stdout", "input": "1000 501 501\n", "output": "646597996\n"}, {"type": "stdin_stdout", "input": "1000 888 888\n", "output": "644649893\n"}, {"type": "stdin_stdout", "input": "1000 500 500\n", "output": "646597996\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey received a postcard from Irina. It contained only the words \"Hello, Andrey!\", and a strange string consisting of lowercase Latin letters, snowflakes and candy canes. Andrey thought that this string is an encrypte... | [{"type": "stdin_stdout", "input": "uduzhzchjkaddukfwqngffblohjmqbgyfrzomuznircygatbxoyfxflurhoewioptyqlpoozlksyxrntwsqozghcamszlgeawisninpntpwpuemybjwmhwmpqkurkrnjzfoppmoopwrmpylvhtntghxkavveeyfmdqsvuqiflyemklnshfrtskmyhkbzhwmlaqcasjbw\n200\n", "output": "uduzhzchjkaddukfwqngffblohjmqbgyfrzomuznircygatbxoyfxflurhoewio... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya started working in a machine vision company of IT City. Vasya's team creates software and hardware for identification of people by their face.\n\nOne of the project's know-how is a camera rotating around its optical... | [{"type": "stdin_stdout", "input": "-999999999999999340\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "-999999999999999325\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "-999999999999999326\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "-999999999999999415\n", "output": "3\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCarl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform two spheres of the same color into one sphere of any other color. To make a spell that has never been seen befo... | [{"type": "stdin_stdout", "input": "1000000 1000000 1000000\n1000000 1000000 1000000\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1000000 500000 1000000\n500000 1000000 500000\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1000000 1000000 499999\n500000 500000 1000000\n", "output": "No\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmr doesn't like Maths as he finds it really boring, so he usually sleeps in Maths lectures. But one day the teacher suspected that Amr is sleeping and asked him a question to make sure he wasn't.\n\nFirst he gave Amr two... | [{"type": "stdin_stdout", "input": "1000 100 777767777\n", "output": "577920877"}, {"type": "stdin_stdout", "input": "472 44 364550669\n", "output": "122479316"}, {"type": "stdin_stdout", "input": "510 76 811693420\n", "output": "546301720"}, {"type": "stdin_stdout", "input": "783 30 602209107\n", "output": "279682329"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudents in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces m... | [{"type": "stdin_stdout", "input": "1000000 1000000\n", "output": "3000000\n"}, {"type": "stdin_stdout", "input": "1000000 999999\n", "output": "2999998\n"}, {"type": "stdin_stdout", "input": "999999 1000000\n", "output": "3000000\n"}, {"type": "stdin_stdout", "input": "1000000 666667\n", "output": "2500000\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya and Vasya decided to play a game. They have n cards (n is an even number). A single integer is written on each card.\n\nBefore the game Petya will choose an integer and after that Vasya will choose another integer (... | [{"type": "stdin_stdout", "input": "100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\n100\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDaenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains a_{i} soldiers. She wants to bring her army to the other side of the sea to get the Iron Throne. She has recently bought an airpla... | [{"type": "stdin_stdout", "input": "10000 100\n800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSalem gave you $n$ sticks with integer positive lengths $a_1, a_2, \\ldots, a_n$.\n\nFor every stick, you can change its length to any other positive integer length (that is, either shrink or stretch it). The cost of chan... | [{"type": "stdin_stdout", "input": "113\n86 67 31 33 72 100 88 63 16 12 79 80 76 45 31 96 44 10 24 33 53 11 56 100 23 57 9 48 28 73 18 48 12 89 73 9 51 11 82 94 90 92 34 99 54 58 33 67 35 87 58 90 94 64 57 80 87 99 84 99 20 1 63 12 16 40 50 95 33 58 7 23 71 89 53 15 95 29 71 16 65 21 66 89 82 30 6 45 6 66 58 32 27 78 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nКарта звёздного неба представляет собой прямоугольное поле, состоящее из n строк по m символов в каждой строке. Каждый символ — это либо «.» (означает пустой участок неба), либо «*» (означает то, что в этом месте на небе ... | [{"type": "stdin_stdout", "input": "7 10\n..........\n......*...\n....**..*.\n...**.....\n...*......\n..........\n..**.*....\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "3 9\n.........\n......*..\n.........\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 5\n....*\n....*\n....*\n..*..\n..*.*\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA girl named Sonya is studying in the scientific lyceum of the Kingdom of Kremland. The teacher of computer science (Sonya's favorite subject!) invented a task for her.\n\nGiven an array $a$ of length $n$, consisting only... | [{"type": "stdin_stdout", "input": "98 207942770\n0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 0 0 0 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 0 1 1 1 0 0 1 0 1 1 1 0 1\n", "output": "357313797"}, {"type": "stdin_stdout", "input": "100 1000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMemory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain an equilateral triangle of side lengt... | [{"type": "stdin_stdout", "input": "100000 25000\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "100000 9999\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "38578 32201\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "65310 32879\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "19684 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe determinant of a matrix 2 × 2 is defined as follows:$\\operatorname{det} \\left(\\begin{array}{ll}{a} & {b} \\\\{c} & {d} \\end{array} \\right) = a d - b c$\n\nA matrix is called degenerate if its determinant is equal... | [{"type": "stdin_stdout", "input": "1000000000 -1000000000\n1000000000 1000000000\n", "output": "1000000000.0000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n1000000000 -1000000000\n", "output": "1000000000.0000000000\n"}, {"type": "stdin_stdout", "input": "876432079 -414820618\n-816514132 -9145... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a small restaurant there are a tables for one person and b tables for two persons. \n\nIt it known that n groups of people come today, each consisting of one or two people. \n\nIf a group consist of one person, it is s... | [{"type": "stdin_stdout", "input": "30 10 10\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "20 4 3\n2 2 2 2 2 2 2 2 1 2 1 1 2 2 1 2 2 2 1 2\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "15 5 5\n1 1 1 1 1 1 1 1 1 1 2 2 2 2 2\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach student eagerly awaits the day he would pass the exams successfully. Thus, Vasya was ready to celebrate, but, alas, he didn't pass it. However, many of Vasya's fellow students from the same group were more successful... | [{"type": "stdin_stdout", "input": "100 100 100 100\n", "output": "-1"}, {"type": "stdin_stdout", "input": "100 100 100 0\n", "output": "-1"}, {"type": "stdin_stdout", "input": "100 100 0 100\n", "output": "-1"}, {"type": "stdin_stdout", "input": "100 0 100 100\n", "output": "-1"}, {"type": "stdin_stdout", "input": "0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPasha has a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of the stick. Each part must have some positive integer length and the sum of these lengths will obvious... | [{"type": "stdin_stdout", "input": "2000000000\n", "output": "499999999\n"}, {"type": "stdin_stdout", "input": "1924704072\n", "output": "481176017\n"}, {"type": "stdin_stdout", "input": "1925088820\n", "output": "481272204\n"}, {"type": "stdin_stdout", "input": "1925473570\n", "output": "481368392\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut likes kvass very much. On his birthday parents presented him $n$ kegs of kvass. There are $v_i$ liters of kvass in the $i$-th keg. Each keg has a lever. You can pour your glass by exactly $1$ liter pulling th... | [{"type": "stdin_stdout", "input": "4 4\n1000000000 1000000000 1000000000 1000000000\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "15 56\n38 47 84 28 67 40 15 24 64 37 68 30 74 41 62\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "2 1000000000\n99999999 1000000000\n", "output": "49999999\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h_1 cm from the ground. On the height h_2 cm (h_2 > h_1) on the same tree... | [{"type": "stdin_stdout", "input": "43951 66098\n1604 35654\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "35413 75637\n4087 30166\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "28473 80380\n2568 95212\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "7245 77828\n6224 92468\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with the same task if you... | [{"type": "stdin_stdout", "input": "930064129 32726326 25428197 83013449 64501049\n", "output": "363523396\n"}, {"type": "stdin_stdout", "input": "951102310 39876134 24967176 70096104 43888451\n", "output": "539219654\n"}, {"type": "stdin_stdout", "input": "925819493 47350513 28377591 83230978 49881078\n", "output": "5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n employees in Alternative Cake Manufacturing (ACM). They are now voting on some very important question and the leading world media are trying to predict the outcome of the vote.\n\nEach of the employees belong... | [{"type": "stdin_stdout", "input": "100\nRDRRDRDDDDRDRRDDRDRRDDRRDDRRRDRRRDDDRDDRDDRRDRDRRRDRDRRRDRRDDDRDDRRRDRDRRRDDRDRDDDDDDDRDRRDDDDDDRRDD\n", "output": "D\n"}, {"type": "stdin_stdout", "input": "100\nRRDRRDDDDDDDRDRRRDRDRDDDRDDDRDDRDRRDRRRDRRDRRRRRRRDRRRRRRDDDRRDDRRRDRRRDDRRDRRDDDDDRRDRDDRDDRRRDRRDD\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than $a$ and screen height not greater than $b$. Mono... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 999999866000004473 999999822000007597\n", "output": "1000000063\n"}, {"type": "stdin_stdo... | 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 470184984576\n", "output": "33333333333333332\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 743008370688\n", "output": "45454545454545452\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA frog is initially at position $0$ on the number line. The frog has two positive integers $a$ and $b$. From a position $k$, it can either jump to position $k+a$ or $k-b$.\n\nLet $f(x)$ be the number of distinct integers ... | [{"type": "stdin_stdout", "input": "952549276 31416 33000\n", "output": "1718466614644254\n"}, {"type": "stdin_stdout", "input": "1000000000 1 2019\n", "output": "500000001500000001\n"}, {"type": "stdin_stdout", "input": "881706694 5710 56529\n", "output": "680741853146475\n"}, {"type": "stdin_stdout", "input": "995676... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhere do odds begin, and where do they end? Where does hope emerge, and will they ever break?\n\nGiven an integer sequence a_1, a_2, ..., a_{n} of length n. Decide whether it is possible to divide it into an odd number of... | [{"type": "stdin_stdout", "input": "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 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne spring day on his way to university Lesha found an array A. Lesha likes to split arrays into several parts. This time Lesha decided to split the array A into several, possibly one, new arrays so that the sum of elemen... | [{"type": "stdin_stdout", "input": "60\n-288 -213 -213 -23 496 489 137 -301 -219 -296 -577 269 -153 -52 -505 -138 -377 500 -256 405 588 274 -115 375 -93 117 -360 -160 429 -339 502 310 502 572 -41 -26 152 -203 562 -525 -179 -67 424 62 -329 -127 352 -474 417 -30 518 326 200 -598 471 107 339 107 -9 -244\n", "output": "YES... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't contain leading zeroes.\n\nYour task is to determine if it is possible in this case to remove some of the digit... | [{"type": "stdin_stdout", "input": "1946374341357914632311595531429723377642197432217137651552992479954116463332543456759911377223599715\n", "output": "YES\n16\n"}, {"type": "stdin_stdout", "input": "8147522776919916277306861346922924221557534659480258977017038624458370459299847590937757625791239188\n", "output": "YES\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a building where Polycarp lives there are equal number of flats on each floor. Unfortunately, Polycarp don't remember how many flats are on each floor, but he remembers that the flats are numbered from 1 from lower to ... | [{"type": "stdin_stdout", "input": "50 70\n3 3\n80 80\n23 23\n11 11\n87 87\n7 7\n63 63\n61 61\n67 67\n53 53\n9 9\n43 43\n55 55\n27 27\n5 5\n1 1\n99 99\n65 65\n37 37\n60 60\n32 32\n38 38\n81 81\n2 2\n34 34\n17 17\n82 82\n26 26\n71 71\n4 4\n16 16\n19 19\n39 39\n51 51\n6 6\n49 49\n64 64\n83 83\n10 10\n56 56\n30 30\n76 76\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBishwock is a chess figure that consists of three squares resembling an \"L-bar\". This figure can be rotated by 90, 180 and 270 degrees so it can have four possible states:\n\n \n\nXX XX .X X.\n\nX. .X XX XX\... | [{"type": "stdin_stdout", "input": "0000X0XX000X0XXXX0X0XXXX000X0X0XX000XXX0X00XX00XX00X0000XX0XX00X0X00X0X00X0XX000XX00XXXXXXXXXXXXXXX0\nX00XX0XX00XXXX00XXXX00XX0000000000XXX0X00XX0XX00XXX00X00X0XX0000X00XXXXXXX00X00000XXX00XXX00XXX0X0XX\n", "output": "18"}, {"type": "stdin_stdout", "input": "0000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters.\n\nLet A be a set of positions in the string. Let's call it pretty if followin... | [{"type": "stdin_stdout", "input": "200\nrsgraosldglhdoorwhkrsehjpuxrjuwgeanjgezhekprzarelduuaxdnspzjuooguuwnzkowkuhzduakdrzpnslauejhrrkalwpurpuuswdgeadlhjwzjgegwpknepazwwleulppwrlgrgedlwdzuodzropsrrkxusjnuzshdkjrxxpgzanzdrpnggdwxarpwohxdepJ\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "200\nMkuxcDWdcnqsrlT... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence a consisting of n integers. You may partition this sequence into two sequences b and c in such a way that every element belongs exactly to one of these sequences. \n\nLet B be the sum of elements ... | [{"type": "stdin_stdout", "input": "100\n-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\nA bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning ... | [{"type": "stdin_stdout", "input": "1000000 1000000 500000 10000\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "1000000 1000000000 999999 10000\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1000000 1500000 500000 10000\n", "output": "9998\n"}, {"type": "stdin_stdout", "input": "1000000 1000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.\n\nFor example, the string \"Hello\" for p = 2, q = 3 can be split to the two strings \"Hel\" and \"lo\" or to t... | [{"type": "stdin_stdout", "input": "100 1 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "100\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\na\nb\nb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sportsman starts from point x_{start} = 0 and runs to point with coordinate x_{finish} = m (on a straight line). Also, the sportsman can jump — to jump, he should first take a run of length of not less than s meters (in... | [{"type": "stdin_stdout", "input": "100 1000 1 4\n228 420 360 642 442 551 940 343 24 83 928 110 663 548 704 461 942 799 283 746 371 204 435 209 986 489 918 526 496 321 233 643 208 717 806 18 291 431 521 631 3 450 711 602 401 60 680 930 625 891 161 279 510 529 546 338 473 925 446 786 384 952 260 649 865 916 789 71 103 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)?\n\n\n-----Input-----\n\nThe first line of the input contains two integers s and x (2 ≤ ... | [{"type": "stdin_stdout", "input": "549755813887 549755813887\n", "output": "549755813886\n"}, {"type": "stdin_stdout", "input": "549755813888 549755813886\n", "output": "274877906944\n"}, {"type": "stdin_stdout", "input": "547616456703 547599679487\n", "output": "68719476736\n"}, {"type": "stdin_stdout", "input": "274... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLong story short, shashlik is Miroslav's favorite food. Shashlik is prepared on several skewers simultaneously. There are two states for each skewer: initial and turned over.\n\nThis time Miroslav laid out $n$ skewers par... | [{"type": "stdin_stdout", "input": "153 0\n", "output": "153\n1 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 83 84 85 86 87 88 89 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define a function $f(p)$ on a permutation $p$ as follows. Let $g_i$ be the greatest common divisor (GCD) of elements $p_1$, $p_2$, ..., $p_i$ (in other words, it is the GCD of the prefix of length $i$). Then $f(p)$ ... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "943169120"}, {"type": "stdin_stdout", "input": "524288\n", "output": "948408574"}, {"type": "stdin_stdout", "input": "786431\n", "output": "973886300"}, {"type": "stdin_stdout", "input": "217292\n", "output": "936105571"}, {"type": "stdin_stdout", "input": "261... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the stri... | [{"type": "stdin_stdout", "input": "VRPHBNWNWVWBWMFJJDCTJQJDJBKSJRZLVQRVVFLTZFSGCGDXCWQVWWWMFVCQHPKXXVRKTGWGPSMQTPKNDQJHNSKLXPCXDJDQDZZD\n", "output": "101"}, {"type": "stdin_stdout", "input": "SGDDFCDRDWGPNNFBBZZJSPXFYMZKPRXTCHVJSJJBWZXXQMDZBNKDHRGSRLGLRKPMWXNSXJPNJLDPXBSRCQMHJKPZNTPNTZXNPCJC\n", "output": "76"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou may have heard of the pie rule before. It states that if two people wish to fairly share a slice of pie, one person should cut the slice in half, and the other person should choose who gets which slice. Alice and Bob ... | [{"type": "stdin_stdout", "input": "50\n100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got a positive integer sequence a_1, a_2, ..., a_{n}. All numbers in the sequence are distinct. Let's fix the set of variables b_1, b_2, ..., b_{m}. Initially each variable b_{i} (1 ≤ i ≤ m) contains the value of z... | [{"type": "stdin_stdout", "input": "23\n26988535 53977070 107954140 161931210 323862420 215908280 431816560 647724840 269885350 242896815 755678980 485793630 863633120 404828025 539770700 134942675 593747770 377839490 917610190 809656050 620736305 971587260 458805095\n", "output": "7\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.\n\nFilya is given an array of non-negative integers a_1, a_2, ..., a_{n}. Fir... | [{"type": "stdin_stdout", "input": "10\n1 1 1 1 1 2 2 2 2 2\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "3\n99999999 1 50000000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2\n100000001 100000003\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "8\n1 1 1 1 1 1 2 3\n", "output": "YES... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are numbe... | [{"type": "stdin_stdout", "input": "100000 99999\n", "output": "50000\n"}, {"type": "stdin_stdout", "input": "100000 23458\n", "output": "38272\n"}, {"type": "stdin_stdout", "input": "100000 23457\n", "output": "11729\n"}, {"type": "stdin_stdout", "input": "92480 43074\n", "output": "24704\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. Master Heidi needs to select the Jedi Knights who will go on peacekeeping missions throughout th... | [{"type": "stdin_stdout", "input": "100 100\n52 93 36 69 49 37 48 42 63 27 16 60 16 63 80 37 69 24 86 38 73 15 43 65 49 35 39 98 91 24 20 35 12 40 75 32 54 4 76 22 23 7 50 86 41 9 9 91 23 18 41 61 47 66 1 79 49 21 99 29 87 94 42 55 87 21 60 67 36 89 40 71 6 63 65 88 17 12 89 32 79 99 34 30 63 33 53 56 10 11 66 80 73 50... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in a wonderful sunny morning, walking around blocks of ice, Mishka met her friend Chris, and they star... | [{"type": "stdin_stdout", "input": "100\n4 3\n3 4\n5 1\n2 5\n5 3\n1 5\n6 3\n2 4\n5 2\n2 6\n5 2\n1 5\n6 3\n1 5\n6 3\n3 4\n5 2\n1 5\n6 1\n1 5\n4 2\n3 5\n6 3\n2 6\n6 3\n1 4\n6 2\n3 4\n4 1\n3 6\n5 1\n2 4\n5 1\n3 4\n6 2\n3 5\n4 1\n2 6\n4 3\n2 6\n5 2\n3 6\n6 2\n3 5\n4 3\n1 5\n5 3\n3 6\n4 2\n3 4\n6 1\n3 4\n5 2\n2 6\n5 2\n2 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted ... | [{"type": "stdin_stdout", "input": "21 10\n62637783*1\n23*51**531\n35*7*6.**.\n.*3***581*\n2.32*745**\n83*7*6*6*5\n*74.**6**3\n323*6**7*6\n3454*67.*1\n**63265*6*\n3725*4553*\n24****5**4\n23.34****4\n55257*1*4*\n4*3253*456\n**.3*45488\n*7318**4*5\n234.*4557*\n12..21*.*3\n286.225*4*\n834*11*.3*\n", "output": "NO"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter passing a test, Vasya got himself a box of $n$ candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies ... | [{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "39259424579862572\n"}, {"type": "stdin_stdout", "input": "999999999999999973\n", "output": "39259424579862572\n"}, {"type": "stdin_stdout", "input": "999999999999999998\n", "output": "39259424579862572\n"}, {"type": "stdin_stdout", "input": "9999999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one. $0$ \n\nYou can remove a link or a pearl and insert it between two other existing links or p... | [{"type": "stdin_stdout", "input": "--o---o----------o----o----------o--o-o-----o-oo---oo--oo---o-------------oo-----o-------------o---o\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "----------------------------------------------------------------------------------------------------\n", "output": "YES\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nn hobbits are planning to spend the night at Frodo's house. Frodo has n beds standing in a row and m pillows (n ≤ m). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as po... | [{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000000 999834114 93836827\n", "output": "29998\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 500000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a_1, a_2, \\dots , a_n$ and two integers $m$ and $k$.\n\nYou can choose some subarray $a_l, a_{l+1}, \\dots, a_{r-1}, a_r$. \n\nThe cost of subarray $a_l, a_{l+1}, \\dots, a_{r-1}, a_r$ is equal to... | [{"type": "stdin_stdout", "input": "44 2 531595322\n926215961 -385821837 -278841122 -422772006 -509196878 -81824369 -101501043 -33095577 -520514931 402836017 48602657 881104200 -110528684 52550046 -208588735 -814534121 -548420443 410430115 -636402169 -848516069 -70639158 775203498 -679440929 -427359667 33598904 6568726... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangular grid of lattice points from (0, 0) to (n, m) inclusive. You have to choose exactly 4 different points to build a polyline possibly with self-intersections and self-touching. This polyline shoul... | [{"type": "stdin_stdout", "input": "1000 1000\n", "output": "0 1\n1000 1000\n0 0\n999 1000\n"}, {"type": "stdin_stdout", "input": "1000 999\n", "output": "0 1\n1000 999\n0 0\n1000 998\n"}, {"type": "stdin_stdout", "input": "999 1000\n", "output": "1 0\n999 1000\n0 0\n998 1000\n"}, {"type": "stdin_stdout", "input": "100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNot so long ago company R2 bought company R1 and consequently, all its developments in the field of multicore processors. Now the R2 laboratory is testing one of the R1 processors.\n\nThe testing goes in n steps, at each ... | [{"type": "stdin_stdout", "input": "100 99 1 2\n2 1 1 1 2 2 1 1 1 2 2 2 1 2 1 1 2 1 1 2 1 2 2 1 2 1 2 1 2 1 2 2 2 2 1 1 1 1 1 2 1 2 2 1 2 2 2 1 1 1 1 1 2 2 2 2 1 2 2 1 1 1 2 1 1 2 1 1 2 1 2 1 2 1 1 1 1 2 1 1 1 1 1 2 2 2 1 1 1 1 2 2 2 2 1 1 2 2 2\n", "output": "Correct\n"}, {"type": "stdin_stdout", "input": "91 75 1 10\... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.