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\nYou are given an array a of n positive integers.\n\nYou can use the following operation as many times as you like: select any integer 1 β€ k β€ n and do one of two things: \n\n * decrement by one k of the first elements of... | [{"type": "stdin_stdout", "input": "4\n3\n1 2 1\n5\n11 14 9 10 8\n5\n0 3 1 4 1\n4\n5 2 1 10\n", "output": "YES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 2 1\n5\n11 14 9 6 10\n5\n0 3 1 2 1\n4\n5 2 1 10\n", "output": "YES\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n0 2 1\n5\n11 14 9 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n sets of integers. The i-th set contains k_i integers.\n\nTwo sets are called similar if they share at least two common elements, i. e. there exist two integers x and y such that x β y, and they both belong... | [{"type": "stdin_stdout", "input": "10\n2\n5 190511 174892 60413 161099 192095\n2 190511 174892\n2\n2 25224 33915\n2 33915 25224\n2\n2 102801 58269\n2 102801 58269\n2\n2 73575 66574\n2 73575 66574\n2\n2 191259 156476\n2 191259 156476\n2\n2 94903 80911\n2 94903 80911\n2\n2 134838 86551\n2 134838 86551\n2\n2 64258 10995\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string a, consisting of n characters, n is even. For each i from 1 to n a_i is one of 'A', 'B' or 'C'.\n\nA bracket sequence is a string containing only characters \"(\" and \")\". A regular bracket sequen... | [{"type": "stdin_stdout", "input": "28\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nBBBBAC\nABCA\nAABBAC\nCACA\nAABBAC\nCACA\n", "output": "YES\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\nYES\nNO\nNO... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis time Baby Ehab will only cut and not stick. He starts with a piece of paper with an array a of length n written on it, and then he does the following:\n\n * he picks a range (l, r) and cuts the subsegment a_l, a_{l ... | [{"type": "stdin_stdout", "input": "6 3\n2 3 10 7 5 14\n1 6\n2 4\n3 5\n", "output": "\n3\n1\n2\n"}, {"type": "stdin_stdout", "input": "6 3\n2 3 10 12 5 14\n1 6\n2 4\n3 5\n", "output": "4\n2\n2\n"}, {"type": "stdin_stdout", "input": "6 3\n1 3 10 6 10 14\n1 6\n2 4\n3 5\n", "output": "4\n2\n3\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe official capital and the cultural capital of Berland are connected by a single road running through n regions. Each region has a unique climate, so the i-th (1 β€ i β€ n) region has a stable temperature of ti degrees in... | [{"type": "stdin_stdout", "input": "20 102\n73 79 75 27\n13 15 62 47\n74 75 85 86\n49 81 23 69\n43 17 45 27\n35 14 90 35\n51 74 35 33\n54 66 46 24\n33 76 49 3\n34 53 25 76\n69 72 76 31\n41 31 8 48\n49 48 85 24\n19 2 59 83\n19 31 51 86\n31 10 45 76\n56 47 79 86\n49 33 15 1\n77 89 26 64\n7 52 76 77\n", "output": "59201\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is the most boring one you've ever seen. \n\nGiven a sequence of integers a1, a2, ..., an and a non-negative integer h, our goal is to partition the sequence into two subsequences (not necessarily consist of ... | [{"type": "stdin_stdout", "input": "20 10\n12986238 12986234 12986240 12986238 12986234 12986238 12986234 12986234 12986236 12986236 12986232 12986238 12986232 12986239 12986233 18624672 12986237 12986232 12986231 12986235\n", "output": "5638449\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 "}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSquirrel Liss is interested in sequences. She also has preferences of integers. She thinks n integers a1, a2, ..., an are good.\n\nNow she is interested in good sequences. A sequence x1, x2, ..., xk is called good if it s... | [{"type": "stdin_stdout", "input": "49\n10 34 58 72 126 166 176 180 198 200 208 228 238 248 302 332 340 344 350 354 380 406 418 428 438 442 482 532 536 544 546 554 596 626 642 682 684 704 714 792 804 820 862 880 906 946 954 966 970\n", "output": "49"}, {"type": "stdin_stdout", "input": "44\n1 5 37 97 107 147 185 187 19... | 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 pi (1 β€ pi β€ n).\n\nLitt... | [{"type": "stdin_stdout", "input": "1000 2\n", "output": "675678679\n"}, {"type": "stdin_stdout", "input": "1000 1\n", "output": "760074701\n"}, {"type": "stdin_stdout", "input": "1000 8\n", "output": "339760446\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\nIlya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.\n\nYou've got string s = s1s2... sn (n is the length of the string), consisting only of charact... | [{"type": "stdin_stdout", "input": "#..##...#.\n7\n5 9\n6 10\n1 7\n2 10\n2 5\n2 10\n3 4\n", "output": "2\n2\n3\n4\n2\n4\n0\n"}, {"type": "stdin_stdout", "input": "#..##...#.\n7\n5 9\n6 10\n1 7\n2 10\n3 5\n2 10\n3 4\n", "output": "2\n2\n3\n4\n1\n4\n0\n"}, {"type": "stdin_stdout", "input": "#..##...#/\n7\n5 9\n6 10\n1 7\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call an undirected graph of n vertices p-interesting, if the following conditions fulfill: \n\n * the graph contains exactly 2n + p edges; \n * the graph doesn't contain self-loops and multiple edges; \n * for an... | [{"type": "stdin_stdout", "input": "5\n24 228\n24 228\n24 228\n24 228\n24 228\n", "output": "1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 18\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n2 10\n2 11\n2 12\n2 13\n2 14\n2 15\n2 16\n2 17\n2 18\n2 19\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVolodya has recently visited a very odd town. There are N tourist attractions in the town and every two of them are connected by a bidirectional road. Each road has some travel price (natural number) assigned to it and al... | [{"type": "stdin_stdout", "input": "20\n", "output": "0 3 4 6 9 14 22 31 40 54 75 96 129 153 183 213 259 317 375 414\n3 0 5 7 10 15 23 32 41 55 76 97 130 154 184 214 260 318 376 415\n4 5 0 8 11 16 24 33 42 56 77 98 131 155 185 215 261 319 377 416\n6 7 8 0 13 18 26 35 44 58 79 100 133 157 187 217 263 321 379 418\n9 10 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 β€ i β€ n) has a strength si.\n\nIn order to make his dinner more interesting, Mole organizes a version of Β«Hunger GamesΒ» ... | [{"type": "stdin_stdout", "input": "5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5\n", "output": "4\n4\n1\n1\n"}, {"type": "stdin_stdout", "input": "5\n1 5 2 4 2\n4\n1 5\n2 5\n3 5\n4 5\n", "output": "4\n4\n1\n1\n"}, {"type": "stdin_stdout", "input": "5\n1 3 4 4 2\n4\n1 5\n2 5\n3 5\n4 5\n", "output": "4\n4\n2\n1\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Polycarp published a funny picture in a social network making a poll about the color of his handle. Many of his friends started reposting Polycarp's joke to their news feed. Some of them reposted the reposts and s... | [{"type": "stdin_stdout", "input": "10\nkkuLGEiHv reposted POLYcArp\n3oX1AoUqyw1eR3nCADY9hLwd reposted kkuLGeIHV\nwf97dqq5bx1dPIchCoT reposted 3OX1AOuQYW1eR3ncAdY9hLwD\nWANr8h reposted Wf97dQQ5bx1dpIcHcoT\n3Fb736lkljZK2LtSbfL reposted wANR8h\n6nq9xLOn reposted 3fB736lKlJZk2LtSbFL\nWL reposted 3Fb736lKLjZk2LTSbfl\ndvxn4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n cities in Westeros. The i-th city is inhabited by ai people. Daenerys and Stannis play the following game: in one single move, a player chooses a certain town and burns it to the ground. Thus all its residents... | [{"type": "stdin_stdout", "input": "4 4\n391529 1208360 830662 659313\n", "output": "Daenerys\n"}, {"type": "stdin_stdout", "input": "4 4\n194368 347108 1051701 497749\n", "output": "Daenerys\n"}, {"type": "stdin_stdout", "input": "4 4\n391529 1208360 830662 467257\n", "output": "Daenerys\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor the given sequence with n different elements find the number of increasing subsequences with k + 1 elements. It is guaranteed that the answer is not greater than 8Β·1018.\n\nInput\n\nFirst line contain two integer valu... | [{"type": "stdin_stdout", "input": "100 7\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoger is a robot. He has an arm that is a series of n segments connected to each other. The endpoints of the i-th segment are initially located at points (i - 1, 0) and (i, 0). The endpoint at (i - 1, 0) is colored red an... | [{"type": "stdin_stdout", "input": "50 50\n1 41 261\n2 47 324\n1 41 256\n1 31 339\n2 23 116\n2 44 184\n2 32 115\n1 40 301\n2 40 303\n1 29 309\n2 49 348\n2 47 356\n1 41 263\n2 42 276\n1 45 135\n1 33 226\n2 31 166\n1 50 171\n2 47 166\n2 50 146\n2 25 324\n2 48 307\n2 41 176\n1 50 353\n1 45 323\n2 50 343\n1 47 200\n2 48 26... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe zombies are gathering in their secret lair! Heidi will strike hard to destroy them once and for all. But there is a little problem... Before she can strike, she needs to know where the lair is. And the intel she has i... | [{"type": "stdin_stdout", "input": "10\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0012100000\n0024200000\n0012100000\n0000000000\n", "output": "Yes"}, {"type": "stdin_stdout", "input": "10\n0000000000\n0122210000\n0244420100\n0122210000\n0000000001\n0000000000\n0000000000\n0000000000\n0000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.\n\nSerge... | [{"type": "stdin_stdout", "input": "aaaaaaaadbaaabbbbbddaaabdadbbbbbdbbabbbabaabdbbdababbbddddbdaabbddbbbbabbbbbabadaadabaaaadbbabbbaddb\naaaaaaaaaaaaaa\n61 91 5 43 53 81 7 96 6 9 34 78 79 12 8 63 22 76 18 46 41 56 3 20 57 21 75 73 100 94 35 69 32 4 70 95 88 44 68 10 71 98 23 89 36 62 28 51 24 30 74 55 27 80 38 48 93 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan had string s consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string s. Ivan preferred making a new string to finding the old one. \n\nIvan knows some information ... | [{"type": "stdin_stdout", "input": "18\nabacab 2 329 401\nabadabacabae 1 293\nbacab 1 2\nabacabadabacabaga 1 433\nc 1 76\nbaca 1 26\ndab 1 72\nabagabaca 1 445\nabaea 1 397\ndabac 1 280\nab 2 201 309\nca 1 396\nabacabadab 1 497\nac 1 813\ncaba 1 444\nad 1 167\nbadab 1 358\naba 1 421\n", "output": "abacabaaaaaaaaaaaaaaaa... | 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 a1, a2, ..., an of length n. Decide whether it is possible to divide it into an odd number of non-... | [{"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\nThis is an interactive problem.\n\nJury has hidden a permutation p of integers from 0 to n - 1. You know only the length n. Remind that in permutation all integers are distinct.\n\nLet b be the inverse permutation for p, ... | [{"type": "stdin_stdout", "input": "128\n0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 87 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 90 91 92 93 94 95 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhat are you doing at the end of the world? Are you busy? Will you save us?\n\n<image>\n\nNephren is playing a game with little leprechauns.\n\nShe gives them an infinite array of strings, f0... β.\n\nf0 is \"What are you... | [{"type": "stdin_stdout", "input": "10\n100000 873326525630182716\n100000 620513733919162415\n100000 482953375281256917\n100000 485328193417229962\n100000 353549227094721271\n100000 367447590857326107\n100000 627193846053528323\n100000 243833127760837417\n100000 287297493528203749\n100000 70867563577617188\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that she's not the best at games. The game is played on a directed a... | [{"type": "stdin_stdout", "input": "100 1\n92 93 p\n", "output": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"We've tried solitary confinement, waterboarding and listening to Just In Beaver, to no avail. We need something extreme.\"\n\n\"Little Alena got an array as a birthday present...\"\n\nThe array b of length n is obtained... | [{"type": "stdin_stdout", "input": "98\n-99 -98 -95 -90 97 93 96 95 98 98 -94 -92 -99 -92 -91 -87 -83 -84 -87 -88 -90 -79 -79 -82 -77 -76 92 82 91 91 90 91 -69 -72 -65 -68 -65 -58 -59 -63 -56 -57 -59 -53 -55 -45 -51 -52 73 81 75 71 77 72 67 70 60 70 61 64 -34 -41 -41 -41 -37 -39 -36 -33 -36 -36 -33 -36 54 49 53 51 50 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes an... | [{"type": "stdin_stdout", "input": "1111111111111111111111111111111111111111011111111111111111111111111111111111111111111111111111111111\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\n", "output": "YES\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are locked in a room with a door that has a keypad with 10 keys corresponding to digits from 0 to 9. To escape from the room, you need to enter a correct code. You also have a sequence of digits.\n\nSome keys on the k... | [{"type": "stdin_stdout", "input": "10 10\n1 2 3 4 5 6 7 8 9 0\n4 5 6 7 1 2 3 0 9 8\n", "output": "1 2 3 4 5 6 7 8 9 0\n"}, {"type": "stdin_stdout", "input": "10 6\n7 1 2 3 8 0 6 4 5 9\n1 5 8 2 3 6\n", "output": "1 2 3 8 6 5\n"}, {"type": "stdin_stdout", "input": "10 5\n3 7 1 2 4 6 9 0 5 8\n4 3 1 7 9\n", "output": "3 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTired of playing Counter strike at every fest, well we can't do anything about it but we can sure give you a new game to play regardless of the fact that it ain't anything like GTA V or Mad Max but it sure can get you one... | [{"type": "stdin_stdout", "input": "-1 1 24\n\nBLMPSE", "output": "3055532591962383602987227818232998762632568116174555366893504593366676447967190098512548525977684438129178355333844915579515788526047825683253459725914819430492603739367407053309118089423532599518418471268454517780826915117095265098025972721477353954422... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMilly is at the examination hall where she is reading a question paper. She checked the question paper and discovered that there are N questions in that paper. Each question has some score value. Ideally it's like questio... | [{"type": "stdin_stdout", "input": "1000 1000\n3181 31998 4632 1363 7992 5436 19660 27448 19149 7410 12169 2465 32499 10397 4460 23944 32202 1713 2220 24475 27484 24795 5837 20379 31605 649 25878 20226 12725 26796 9542 3816 26595 32444 27267 5415 3716 11517 3731 23742 23468 7170 30542 21875 23573 20847 20563 1725 6766 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA witch of magic-land captured three prisoners who were trying to enter in magic-land without the permission of witch. The prisoners have distinct integral height. She gave them punishment called \"Painful height change\"... | [{"type": "stdin_stdout", "input": "100\n42 688467 12000006334\n26501 689169 12000015724\n11479 699358 12000026962\n24465 675705 12000028145\n23282 686827 12000009961\n492 672995 12000011942\n4828 675436 12000032391\n14605 673902 12000000153\n293 682382 12000017421\n18717 689718 12000019895\n5448 691726 12000014771\n11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:\n\n* Go one meter ... | [{"type": "stdin_stdout", "input": "1329", "output": "120\n"}, {"type": "stdin_stdout", "input": "1162", "output": "180\n"}, {"type": "stdin_stdout", "input": "1369", "output": "360\n"}, {"type": "stdin_stdout", "input": "1527", "output": "120\n"}, {"type": "stdin_stdout", "input": "1874", "output": "180\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi'... | [{"type": "stdin_stdout", "input": "8\n8 2 7 3 5 4 6 1", "output": "8 2 4 6 5 7 3 1 \n"}, {"type": "stdin_stdout", "input": "8\n8 2 7 3 4 5 6 1", "output": "8 2 4 5 6 7 3 1"}, {"type": "stdin_stdout", "input": "5\n2 1 3 4 5", "output": "2 1 3 4 5 \n"}, {"type": "stdin_stdout", "input": "5\n2 1 3 4 5", "output": "2 1 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an infinitely large pond, which we consider as a number line. In this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1. On the lotus at coordinate i, an integer s_i is written.\n\nYou a... | [{"type": "stdin_stdout", "input": "11\n0 -4 0 -99 107 13 -43 -39 207 37 0", "output": "271\n"}, {"type": "stdin_stdout", "input": "11\n0 -4 0 -99 31 14 -26 -39 115 29 0", "output": "140\n"}, {"type": "stdin_stdout", "input": "11\n0 -4 0 -99 31 14 -26 -39 115 27 0", "output": "138\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nE869120's and square1001's 16-th birthday is coming soon.\nTakahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces.\n\nE869120 and square1001 were just about to eat A and B of those piece... | [{"type": "stdin_stdout", "input": "-2 -1", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "-3 -1", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "-6 -1", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "-4 -1", "output": "Yay!\n"}, {"type": "stdin_stdout", "input": "5 -1", "output": "Yay!\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R.\n\n... | [{"type": "stdin_stdout", "input": "0 8 7 1", "output": "Balanced\n"}, {"type": "stdin_stdout", "input": "4 3 5 2", "output": "Balanced\n"}, {"type": "stdin_stdout", "input": "8 3 8 3", "output": "Balanced\n"}, {"type": "stdin_stdout", "input": "3 4 5 2", "output": "Balanced"}, {"type": "stdin_stdout", "input": "12 6 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer has N square tiles. The tiles are numbered 1 through N, and the number given to each tile is written on one side of the tile. Also, each corner of each tile is painted in one of the 1000 colors, which ar... | [{"type": "stdin_stdout", "input": "8\n0 0 0 0\n0 0 1 1\n0 1 0 1\n0 1 1 0\n1 0 0 1\n1 0 1 0\n1 1 0 0\n1 1 1 1", "output": "144"}, {"type": "stdin_stdout", "input": "8\n0 0 1 0\n0 0 1 1\n1 1 0 1\n1 1 1 0\n1 0 0 1\n1 0 1 0\n1 1 -1 1\n1 1 1 1", "output": "16"}, {"type": "stdin_stdout", "input": "8\n0 0 -1 0\n0 0 1 0\n0 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIf you draw a few infinitely long straight lines on an infinitely wide plane, this plane will be divided into several areas. For example, if you draw a straight line, the plane will be divided into two areas. Even if you ... | [{"type": "stdin_stdout", "input": "1\n705", "output": "2\n248866\n"}, {"type": "stdin_stdout", "input": "1\n506", "output": "2\n128272\n"}, {"type": "stdin_stdout", "input": "1\n154", "output": "2\n11936\n"}, {"type": "stdin_stdout", "input": "1\n238", "output": "2\n28442\n"}, {"type": "stdin_stdout", "input": "1\n373... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"Search\" is an operation to obtain the desired information from a large amount of information. Familiar examples include \"finding your own exam number from a large number of exam numbers\" when announcing your success,... | [{"type": "stdin_stdout", "input": "7\n11\n15\n-2\n53\n51\n17\n109\n42\n4\n1\n2\n3\n10\n-1\n0", "output": "3\n2\n"}, {"type": "stdin_stdout", "input": "7\n11\n15\n-2\n53\n51\n17\n109\n42\n4\n1\n2\n3\n10\n-2\n0", "output": "3\n2\n"}, {"type": "stdin_stdout", "input": "7\n11\n15\n-2\n53\n51\n17\n109\n42\n4\n2\n2\n3\n10\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is \"7 rows\" in the game using playing cards. Here we consider a game that simplifies it. Arrange 7 using 13 cards with numbers 1 to 13 written on each. In the match, the game progresses as follows with only two pl... | [{"type": "stdin_stdout", "input": "5\n1 2 3 4 5 6\n1 3 5 6 8 4\n1 2 3 4 6 8\n1 2 3 5 10 11\n1 3 3 6 9 11", "output": "yes\nyes\nyes\nyes\nno\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 4 5 10\n1 3 5 6 12 3\n1 2 3 4 6 8\n1 2 4 5 10 11\n1 4 2 6 9 5", "output": "no\nno\nyes\nyes\nyes\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJOI Park\n\nIn preparation for the Olympic Games in IOI in 20XX, the JOI Park in IOI will be developed. There are N squares in JOI Park, and the squares are numbered from 1 to N. There are M roads connecting the squares, ... | [{"type": "stdin_stdout", "input": "5 0 2\n-1 1 1\n0 2 4\n1 2 2\n2 2 4\n3 10 5", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 0 2\n-1 2 1\n0 2 4\n1 2 2\n2 2 4\n3 10 5", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 5 2\n2 3 1\n3 1 2\n1 4 3\n1 2 4\n2 5 5", "output": "11\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are cubes of the same size and a simple robot named Masato. Initially, all cubes are on the floor. Masato can be instructed to pick up a cube and put it on another cube, to make piles of cubes. Each instruction is o... | [{"type": "stdin_stdout", "input": "3\n1 3\n2 0\n0 0\n8\n4 1\n3 1\n1 2\n0 0\n19\n2 2\n3 1\n4 0\n3 4\n1 1\n0 0\n0", "output": "1\n2\nend\n1\n1\n1\n1\n1\n1\n2\nend\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n2\nend\n"}, {"type": "stdin_stdout", "input": "3\n1 3\n2 0\n0 0\n8\n4 1\n3 1\n1 2\n0 0\n19\n2 2\n2 1\n4 0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGilbert is the network admin of Ginkgo company. His boss is mad about the messy network cables on the floor. He finally walked up to Gilbert and asked the lazy network admin to illustrate how computers and switches are co... | [{"type": "stdin_stdout", "input": "4\n 0 2 2 2\n 2 0 2 2\n 2 2 -1 2\n 2 2 2 0\n4\n -1 2 4 4\n 2 -1 4 4\n 4 4 -1 2\n 4 4 2 0\n2\n 0 12\n 12 0\n0", "output": "4\n2 3 3\n2 2 2 2 2 2 2 2 2 2 2\n"}, {"type": "stdin_stdout", "input": "4\n -1 2 2 2\n 2 0 2 2\n 2 2 -1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFolding a Ribbon\n\nThink of repetitively folding a very long and thin ribbon. First, the ribbon is spread out from left to right, then it is creased at its center, and one half of the ribbon is laid over the other. You c... | [{"type": "stdin_stdout", "input": "4 3 2\n30 578 1954\n59 471605241352156968 431565444592236940\n0 0 0", "output": "LRRR\nLLLLLRLLRLLLLLLLLLLRRRRLRLLLLL\nLRRRLRRLLRRRRLLLLRLLRRRLRRLLRLLLLLLRLRLLRLRLLLRLRLLRLLRRRLL\n"}, {"type": "stdin_stdout", "input": "4 3 2\n20 578 1954\n59 471605241352156968 431565444592236940\n0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe fearless Ikta has finally hunted down the infamous Count Big Bridge! Count Bigbridge is now trapped in a rectangular room w meters wide and h meters deep, waiting for his end.\n\nIf you select a corner of the room and... | [{"type": "stdin_stdout", "input": "1 3 1000 1000 1 0 0 4", "output": "1047197552288\n"}, {"type": "stdin_stdout", "input": "1 2 1000 1000 1 0 0 4", "output": "1570796325024\n"}, {"type": "stdin_stdout", "input": "1 3 1000 1000 0 0 0 4", "output": "1047197542296\n"}, {"type": "stdin_stdout", "input": "1 3 1001 1000 1 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nB: Nakajima, let's do that! --Match Peas War -\n\nproblem\n\nNakajima \"Uhh ...\"\n\nIsono \"Nakajima, are you okay?\"\n\nNakajima \"... I feel like I was having an unpleasant dream.\"\n\nIsono \"What kind of dream do you... | [{"type": "stdin_stdout", "input": "5 1\n2 3", "output": "NAKAJIMA\n"}, {"type": "stdin_stdout", "input": "3 1\n1 0", "output": "NAKAJIMA\n"}, {"type": "stdin_stdout", "input": "2 1\n1 2", "output": "NAKAJIMA\n"}, {"type": "stdin_stdout", "input": "3 2\n1 0", "output": "NAKAJIMA\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere is a grid of $ R \\ times C $ squares with $ (0, 0) $ in the upper left and $ (R-1, C-1) $ in the lower right. When you are in a square ($ e $, $ f $), from there $ (e + 1, f) $, $ (e-1, f) $, $ (e, f + 1... | [{"type": "stdin_stdout", "input": "421 435 361 230 182 16", "output": "196 792283366\n"}, {"type": "stdin_stdout", "input": "421 547 377 188 235 13", "output": "156 501147202\n"}, {"type": "stdin_stdout", "input": "421 435 196 169 388 12", "output": "46 766230083\n"}, {"type": "stdin_stdout", "input": "421 435 196 169... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem, you are given a string of N characters(1-indexed), and an integer D. You perform multiple operations on this string. In the first operation you select the first D characters of the string, ie. the substri... | [{"type": "stdin_stdout", "input": "1\nhhmkl\n-15", "output": "hhmkl\n"}, {"type": "stdin_stdout", "input": "1\nhhlkl\n-15", "output": "hhlkl\n"}, {"type": "stdin_stdout", "input": "1\nfknlg\n-1", "output": "lgnkf\n"}, {"type": "stdin_stdout", "input": "1\nglnkf\n-1", "output": "kfnlg\n"}, {"type": "stdin_stdout", "inp... | 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β€ aβ€ bβ€ c and parallelepiped AΓ BΓ C can be pave... | [{"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\nVasya owns a cornfield which can be defined with two integers n and d. The cornfield can be represented as rectangle with vertices having Cartesian coordinates (0, d), (d, 0), (n, n - d) and (n - d, n).\n\n<image> An exam... | [{"type": "stdin_stdout", "input": "9 3\n100\n0 0\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6\n0 7\n0 8\n0 9\n1 0\n1 1\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n2 0\n2 1\n2 2\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n3 0\n3 1\n3 2\n3 3\n3 4\n3 5\n3 6\n3 7\n3 8\n3 9\n4 0\n4 1\n4 2\n4 3\n4 4\n4 5\n4 6\n4 7\n4 8\n4 9\n5 0\n5 1\n5 2\n5 3\n5 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a chessboard with a width of n and a height of n, rows are numbered from bottom to top from 1 to n, columns are numbered from left to right from 1 to n. Therefore, for each cell of the chessboard, you can assign the co... | [{"type": "stdin_stdout", "input": "1000000000000000000\n1000000000000000010 1000000000000000000\n", "output": "black\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n1100000000000000010 1000000000000000000\n", "output": "black\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n1100000000000001010... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou a captain of a ship. Initially you are standing in a point (x_1, y_1) (obviously, all positions in the sea can be described by cartesian plane) and you want to travel to a point (x_2, y_2). \n\nYou know the weather fo... | [{"type": "stdin_stdout", "input": "0 0\n1000000000 1000000000\n2\nDR\n", "output": "2000000000\n"}, {"type": "stdin_stdout", "input": "0 0\n1000000010 1000000000\n2\nDR\n", "output": "2000000010\n"}, {"type": "stdin_stdout", "input": "1 0\n1010000000 1000000000\n2\nDR\n", "output": "2010000000\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Lynyrd and Skynyrd went to a shop where Lynyrd bought a permutation p of length n, and Skynyrd bought an array a of length m, consisting of integers from 1 to n. \n\nLynyrd and Skynyrd became bored, so they asked... | [{"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 2 3 1 2 3\n1 5\n2 6\n3 5\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 2 3 1 2 3\n1 6\n2 6\n3 5\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "3 6 3\n2 1 3\n1 2 3 2 2 3\n1 5\n2 6\n3 5\n", "output": "100\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring a normal walk in the forest, Katie has stumbled upon a mysterious code! However, the mysterious code had some characters unreadable. She has written down this code as a string c consisting of lowercase English char... | [{"type": "stdin_stdout", "input": "********************************************************************************************************************************************************************************************************************************************************************************************... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUjan has a lot of numbers in his boxes. He likes order and balance, so he decided to reorder the numbers.\n\nThere are k boxes numbered from 1 to k. The i-th box contains n_i integer numbers. The integers can be negative.... | [{"type": "stdin_stdout", "input": "5\n10 -251 650 475 -114 364 -75754 -982 -532 -151 -484\n10 -623 -132 -317561 -438 20 -275 -323 -530089 -311 -587\n10 450900 -519 903 -401 -789 -606529 277 -267 -682 -161\n10 -246 873 -641 838 719 234 789 -74 -287288 -772972\n10 186 741 -927 -866 -855 578 -1057019 202 162962 -458\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne unknown hacker wants to get the admin's password of AtForces testing system, to get problems from the next contest. To achieve that, he sneaked into the administrator's office and stole a piece of paper with a list of... | [{"type": "stdin_stdout", "input": "10\ngzjzzjjjzjzgjgzzgzjjjzzzggjjggggjjzzgzz\nyyyyyyyyyyyyyy\nuuuuuuuuuuuuuuuuuuuuuuuu\nssssssssssssssssssssss\nuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu\ngzjgjzzzjgjzggjjjjjzjzzgjgjzgjgjzzjjggzgjzgjgj\ny\nsssssssssss\ngzjzgjjjzggjgzjzgzzz\nsssssssssssssssssssssssssssssss\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nReturning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings \"pop\", \"noon\", \"x\", and \"kkkkkk\" are pal... | [{"type": "stdin_stdout", "input": "24 17\ngdnaevfczjayllndr\nwmuarvqwpbhuznpxz\nlurusjuzrkxmdvfhw\nyckftntrvdatssgbb\nzxpnzuhbpwqvraumw\nwaxuutbtbtbtuuxaw\ndgwjcwilgyrgpohnr\ntrcttthipihtttcrt\ncmbovzvfgdqlfkfqp\nqbgqnzkhixnnvzvqi\nqiursxnedmveeuxdq\nrdnllyajzcfveandg\nbzwxilleapxzcxmde\ncxcfjzlfdtytldtqf\nyhukzlipwdu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPhoenix has a string s consisting of lowercase Latin letters. He wants to distribute all the letters of his string into k non-empty strings a_1, a_2, ..., a_k such that every letter of s goes to exactly one of the strings... | [{"type": "stdin_stdout", "input": "9\n8 6\nchefspam\n11 7\nmonkeyeight\n8 1\nvcubingx\n6 1\namazed\n4 4\nhecs\n8 1\narolaliv\n9 7\nhiuavidhd\n33 17\ngosubtovcubingxheneedssubscribers\n7 4\nhiimbad\n", "output": "m\nm\nbcginuvx\naademz\ns\naaillorv\ni\nn\nh\n"}, {"type": "stdin_stdout", "input": "9\n8 6\nchefspam\n11 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLee is going to fashionably decorate his house for a party, using some regular convex polygons...\n\nLee thinks a regular n-sided (convex) polygon is beautiful if and only if he can rotate it in such a way that at least o... | [{"type": "stdin_stdout", "input": "4\n3\n4\n12\n1000000000\n", "output": "NO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n4\n12\n1010000000\n", "output": "NO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3\n4\n12\n1110000000\n", "output": "NO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has 6 strings and an infinite number of frets numbered from 1. Fretting the fret number j on the i-th s... | [{"type": "stdin_stdout", "input": "58260522 32004256 2436426 24979445 61648772 23690081\n10\n582107247 906728404 411434947 673536177 411497300 488012525 1035611341 800305059 992325267 138720156\n", "output": "837678839\n"}, {"type": "stdin_stdout", "input": "58260522 32004256 2436426 24979445 12477970 11891566\n10\n58... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob play ping-pong with simplified rules.\n\nDuring the game, the player serving the ball commences a play. The server strikes the ball then the receiver makes a return by hitting the ball back. Thereafter, the ... | [{"type": "stdin_stdout", "input": "12\n1 1\n2 1\n1 7\n1 1\n2 1\n1 7\n1 1\n2 1\n1 7\n1 1\n2 1\n1 7\n", "output": "0 1\n1 1\n0 7\n0 1\n1 1\n0 7\n0 1\n1 1\n0 7\n0 1\n1 1\n0 7\n"}, {"type": "stdin_stdout", "input": "2\n1000100 1110000\n1100000 6\n", "output": "1000099 1110000\n1099999 6\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order: \n\n * if |a| > 0 (the length of the string a is greater than zero), delete the fi... | [{"type": "stdin_stdout", "input": "5\na\na\nabcd\nbc\nhello\ncodeforces\nhello\nhelo\ndhjakjsnasjhfksafasd\nadjsnasjhfksvdafdser\n", "output": "\n0\n2\n13\n3\n20\n"}, {"type": "stdin_stdout", "input": "5\na\na\nabcc\nbc\nhello\ncodeforces\nhello\nhelo\ndhjakjsnasjhfksafasd\nadjsnasjhfksvdafdser\n", "output": "0\n2\n13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya went out for a walk in the yard but there weren't any of his friends outside and he had no one to play touch and run. But the boy didn't lose the high spirits and decided to play touch and run with himself. ... | [{"type": "stdin_stdout", "input": "1000 2000\n226 566\n20\n0 -100\n-100 100\n100 0\n42 0\n-100 -79\n-66 -16\n0 -7\n-1 0\n0 100\n100 91\n99 0\n1 0\n-100 0\n70 -100\n-100 100\n100 1\n66 0\n-100 1\n-47 -100\n-42 0\n", "output": "708\n"}, {"type": "stdin_stdout", "input": "1010 2000\n226 566\n20\n0 -100\n-100 100\n100 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem you have to implement an algorithm to defragment your hard disk. The hard disk consists of a sequence of clusters, numbered by integers from 1 to n. The disk has m recorded files, the i-th file occupies cl... | [{"type": "stdin_stdout", "input": "200 10\n17 110 31 67 40 144 57 90 186 25 112 3 14 12 193 159 26 165\n4 91 1 30 62\n11 64 94 60 49 176 172 54 106 68 51 22\n4 131 114 2 15\n33 58 83 164 190 5 21 17 19 181 46 7 140 29 132 147 6 28 192 27 39 196 101 10 53 156 23 98 48 195 88 126 170 55\n2 81 4\n10 13 16 32 78 119 69 17... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne not particularly beautiful evening Valera got very bored. To amuse himself a little bit, he found the following game.\n\nHe took a checkered white square piece of paper, consisting of n Γ n cells. After that, he start... | [{"type": "stdin_stdout", "input": "10 60\n6 7\n2 4\n3 6\n1 4\n8 7\n2 8\n5 7\n6 4\n5 10\n1 7\n3 9\n3 4\n9 2\n7 1\n3 8\n10 7\n9 7\n9 1\n5 5\n4 7\n5 8\n4 2\n2 2\n9 4\n3 3\n7 5\n7 4\n7 7\n8 2\n8 1\n4 5\n1 10\n9 6\n3 1\n1 3\n3 2\n10 10\n4 6\n5 4\n7 3\n10 1\n3 7\n5 1\n10 9\n4 10\n6 10\n7 10\n5 9\n5 6\n1 2\n7 8\n3 5\n9 8\n9 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes numbers a lot. Recently his mother has presented him a collection of n non-negative integers. There's only one thing Petya likes more than numbers: playing with little Masha. He immediately decided to g... | [{"type": "stdin_stdout", "input": "30\n285 214 1 421 145 3 52 54 62 24 2 245 2 28 8 2 2 20 2 0 3333 171 172 173 174 175 176 666 219 30\n", "output": " 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA car moves from point A to point B at speed v meters per second. The action takes place on the X-axis. At the distance d meters from A there are traffic lights. Starting from time 0, for the first g seconds the green lig... | [{"type": "stdin_stdout", "input": "1001 999 1000 1000 1000\n", "output": "1.00100000\n"}, {"type": "stdin_stdout", "input": "29 12 569 939 259\n", "output": "0.0509666080844\n"}, {"type": "stdin_stdout", "input": "714 474 124 205 491\n", "output": "5.75806451613\n"}, {"type": "stdin_stdout", "input": "772 467 142 356 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following mo... | [{"type": "stdin_stdout", "input": "10\n100000000 200000000 300000000 400000000 500000000 600000000 555489806 1596475927 1262387014 1000000000\n", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "10\n100000000 200000000 300000000 400000000 500000000 600000000 555489806 1596475927 1262387014 1000000100\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInnocentius has a problem β his computer monitor has broken. Now some of the pixels are \"dead\", that is, they are always black. As consequence, Innocentius can't play the usual computer games. He is recently playing the... | [{"type": "stdin_stdout", "input": "8 16\n................\n................\n................\n................\n............w...\n................\n................\n..............w.\n", "output": "................\n................\n................\n................\n...........+w++.\n...........+..+.\n...........+... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points A and B on the plane are 4-connected if and only if:\n\n * the Eucl... | [{"type": "stdin_stdout", "input": "34714265\n", "output": "196373536\n"}, {"type": "stdin_stdout", "input": "31975828\n", "output": "180882596\n"}, {"type": "stdin_stdout", "input": "39099999\n", "output": "221182992\n"}, {"type": "stdin_stdout", "input": "39999996\n", "output": "226274144\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBimokh is Mashmokh's boss. For the following n days he decided to pay to his workers in a new way. At the beginning of each day he will give each worker a certain amount of tokens. Then at the end of each day each worker ... | [{"type": "stdin_stdout", "input": "10 1 100000000\n999999999 1634812359 999999999 999999999 129546129 999999999 999999999 999999999 1815265208 999999999\n", "output": "99999999 34812359 99999999 99999999 29546129 99999999 99999999 99999999 15265208 99999999\n"}, {"type": "stdin_stdout", "input": "10 1 100000000\n99999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPaul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.\n\nP... | [{"type": "stdin_stdout", "input": "333 9\nedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedcedce... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not perfect and sometimes it happens that Geraldionians cannot express a ce... | [{"type": "stdin_stdout", "input": "50\n474421 421097 217233 156339 27075 733996 281778 863492 184707 956857 288561 70997 393786 337382 663642 131184 637 273801 799870 295017 392338 842567 161819 297705 102013 930684 375703 838048 154915 138503 629056 256591 893619 19263 787927 684541 320265 841090 421423 490879 394582... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGennady is one of the best child dentists in Berland. Today n children got an appointment with him, they lined up in front of his office.\n\nAll children love to cry loudly at the reception at the dentist. We enumerate th... | [{"type": "stdin_stdout", "input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 5 82\n9 9 25\n3 2 86\n1 5 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10 "}, {"type": "stdin_stdout", "input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 4 82\n9 9 25\n3 2 86\n1 5 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGenos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as quickly as possible.\n\n... | [{"type": "stdin_stdout", "input": "50\n22 19 14 22 20 11 16 28 23 15 3 23 6 16 30 15 15 10 43 28 19 19 22 30 28 1 27 12 12 14 17 30 17 26 21 26 27 1 11 23 9 30 18 19 17 29 11 20 29 24\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "50\n22 19 14 22 20 11 16 28 38 15 3 23 6 16 30 15 15 10 43 28 19 19 22 30 28 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBtoh yuo adn yuor roomatme lhoate wianshg disehs, btu stlil sdmoeboy msut peorrfm tihs cohre dialy. Oen dya yuo decdie to idourtcne smoe syestm. Yuor rmmotaoe sstgegus teh fooniwllg dael. Yuo argee on tow arayrs of ientgr... | [{"type": "stdin_stdout", "input": "16\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\n0 1 2 3 4 5 6 7 8 9 10 11 13 13 14 15\n", "output": "1.00000\n"}, {"type": "stdin_stdout", "input": "16\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\n0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n", "output": "1.0\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet A = {a1, a2, ..., an} be any permutation of the first n natural numbers {1, 2, ..., n}. You are given a positive integer k and another sequence B = {b1, b2, ..., bn}, where bi is the number of elements aj in A to the ... | [{"type": "stdin_stdout", "input": "130 32\n72 56 81 71 45 17 65 13 87 22 17 75 72 80 68 76 62 35 14 53 49 72 19 55 10 57 28 35 66 59 45 24 37 65 46 31 34 1 30 12 37 13 40 41 39 6 31 28 30 0 2 7 23 32 0 34 21 0 23 3 18 33 7 6 20 19 21 10 27 28 19 23 5 15 22 13 14 1 3 14 0 5 1 14 0 0 7 11 10 1 1 1 6 5 3 3 0 1 0 0 0 0 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n integers a1, a2, ..., an. Find the number of pairs of indexes i, j (i < j) that ai + aj is a power of 2 (i. e. some integer x exists so that ai + aj = 2x).\n\nInput\n\nThe first line contains the single po... | [{"type": "stdin_stdout", "input": "100\n3 6 12 1 16 4 9 5 4 4 5 8 12 4 6 14 5 1 2 2 2 1 7 1 9 10 1 13 7 8 3 11 8 11 7 5 15 6 14 10 4 2 10 9 1 8 14 10 5 11 3 4 1 12 6 14 13 4 8 5 4 13 13 1 3 9 14 7 14 10 7 3 12 8 9 8 6 15 9 10 12 14 15 4 16 8 8 4 8 7 5 10 16 4 10 13 6 16 16 5\n", "output": "536\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are k sensors located in the rectangular room of size n Γ m meters. The i-th sensor is located at point (xi, yi). All sensors are located at distinct points strictly inside the rectangle. \n\nOpposite corners of the... | [{"type": "stdin_stdout", "input": "11 17 10\n1 8\n1 7\n2 3\n3 2\n4 8\n5 3\n2 15\n8 6\n6 3\n3 1\n", "output": "-1\n109\n-1\n-1\n26\n71\n-1\n74\n-1\n69\n"}, {"type": "stdin_stdout", "input": "10 17 10\n1 8\n1 7\n2 3\n7 2\n4 8\n10 3\n2 8\n8 6\n6 3\n3 1\n", "output": "-1\n41\n-1\n-1\n76\n-1\n42\n28\n-1\n103\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe tram in Berland goes along a straight line from the point 0 to the point s and back, passing 1 meter per t1 seconds in both directions. It means that the tram is always in the state of uniform rectilinear motion, inst... | [{"type": "stdin_stdout", "input": "1000 812 976\n230 1000\n1006 -1\n", "output": "164000\n"}, {"type": "stdin_stdout", "input": "1000 394 798\n155 1242\n954 -1\n", "output": "271560\n"}, {"type": "stdin_stdout", "input": "1000 812 976\n230 1000\n696 -1\n", "output": "164000\n"}, {"type": "stdin_stdout", "input": "1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIgor the analyst fell asleep on the work and had a strange dream. In the dream his desk was crowded with computer mice, so he bought a mousetrap to catch them.\n\nThe desk can be considered as an infinite plane, then the ... | [{"type": "stdin_stdout", "input": "4\n17501 63318 51967 74514\n1305 84026 135736 -78504\n41159 81000 -44104 -42722\n31063 65435 25578 33487\n18330 79949 83467 -74531\n", "output": "0.15181873510135294\n"}, {"type": "stdin_stdout", "input": "4\n17501 63318 51967 74514\n1305 84026 135736 -78504\n41159 81000 -44104 -4272... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe all know the problem about the number of ways one can tile a 2 Γ n field by 1 Γ 2 dominoes. You probably remember that it goes down to Fibonacci numbers. We will talk about some other problem below, there you also are ... | [{"type": "stdin_stdout", "input": "101\n", "output": "aaffjjnnrrvvzzddhhllppttxxbbffjjnnrrvvzzddhhllppttxxbbffjjnnrrvvzzddhhllppttxxbbffjjnnrrvvzzddhhllppt\nbbggkkoosswwaaeeiimmqquuyyccggkkoosswwaaeeiimmqquuyyccggkkoosswwaaeeiimmqquuyyccggkkoosswwaaeeiimmqqt\ncddhhllppttxxbbffjjnnrrvvzzddhhllppttxxbbffjjnnrrvvzzddhhll... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a small but very proud high school it was decided to win ACM ICPC. This goal requires to compose as many teams of three as possible, but since there were only 6 students who wished to participate, the decision was to b... | [{"type": "stdin_stdout", "input": "1000 1000 1000 1000 1000 1000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "1000 1001 1000 1000 1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 1001 1000 0000 1000 1000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1000 1000 1000 999 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe preferred way to generate user login in Polygon is to concatenate a prefix of the user's first name and a prefix of their last name, in that order. Each prefix must be non-empty, and any of the prefixes can be the ful... | [{"type": "stdin_stdout", "input": "asdfghjkli ware\n", "output": "asdfghjkliw\n"}, {"type": "stdin_stdout", "input": "asdfghkkli ware\n", "output": "asdfghkkliw\n"}, {"type": "stdin_stdout", "input": "ilkkhgfdsa ware\n", "output": "ilkkhgfdsaw\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaz york\n", "output": "aaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYoung Teodor enjoys drawing. His favourite hobby is drawing segments with integer borders inside his huge [1;m] segment. One day Teodor noticed that picture he just drawn has one interesting feature: there doesn't exist a... | [{"type": "stdin_stdout", "input": "43 1319\n750 1030\n857 946\n941 1203\n407 1034\n1052 1290\n546 585\n630 1201\n133 342\n693 1315\n34 719\n176 1097\n39 931\n198 885\n3 1025\n892 1054\n461 1287\n195 1273\n832 1039\n308 955\n642 866\n770 838\n440 777\n289 948\n98 814\n458 768\n82 265\n300 596\n182 706\n368 1225\n237 62... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Rebel fleet is on the run. It consists of m ships currently gathered around a single planet. Just a few seconds ago, the vastly more powerful Empire fleet has appeared in the same solar system, and the Rebels will nee... | [{"type": "stdin_stdout", "input": "30\n(89+76)/87\n(81+78)/18\n(60+97)/32\n(41+14)/48\n(55+65)/27\n(29+15)/95\n(64+13)/96\n(78+30)/75\n(43+6)/60\n(69+34)/48\n(62+2)/97\n(85+42)/3\n(4+97)/42\n(1+18)/39\n(46+55)/76\n(22+59)/24\n(62+81)/98\n(64+8)/51\n(9+59)/48\n(47+2)/80\n(33+74)/76\n(61+83)/44\n(86+4)/51\n(65+41)/49\n(... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given several queries. Each query consists of three integers p, q and b. You need to answer whether the result of p/q in notation with base b is a finite fraction.\n\nA fraction in notation with base b is finite i... | [{"type": "stdin_stdout", "input": "11\n1 1000000000000000000 10000000\n2 999 9\n2 999 333111\n0 15 14\n17 128 2\n13 311992186885373952 18\n1971402979058461 97576870171850009 100\n14 19 23\n3 21914624432020321 23\n0 21914624432020321 46\n3 21914624432020321 47\n", "output": "Finite\nInfinite\nFinite\nFinite\nFinite\nFi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRahul has recently been obsessed with mathematics, and spends most of his time reading the research notes of his equally eccentric math professor. On one of the pages of the research notes, Rahul finds a scribble that say... | [{"type": "stdin_stdout", "input": "1000\n1838622\n999998\n999997\n999996\n999995\n999994\n999993\n999992\n999991\n999990\n999989\n999988\n999987\n999986\n999985\n999984\n231374\n999982\n999981\n999980\n999979\n999978\n999977\n602335\n999975\n999974\n999973\n999972\n999971\n999970\n999969\n999968\n1152163\n999966\n9999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMilly and her classmates are standing in a queue to attend the morning assembly of her school. According to the rule any student should stand in his/her proper place in order to make the queue completely visible till the ... | [{"type": "stdin_stdout", "input": "3\n4\n2 4 5 7\n1\n1 2 4\n3\n4 6 0\n\nSAMPLE", "output": "-1 -1\n-1 -1\n-1 -1\n"}, {"type": "stdin_stdout", "input": "3\n4\n2 4 5 7\n1\n1 2 4\n3\n4 6 0\n\nSALPLE", "output": "-1 -1\n-1 -1\n-1 -1\n"}, {"type": "stdin_stdout", "input": "3\n4\n2 4 1 7\n3\n1 2 4\n3\n2 3 1\n\nELPMAS", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have been given an integer array A and a number K. Now, you need to find out whether any two different elements of the array A sum to the number K. Two elements are considered to be different if they lie at different ... | [{"type": "stdin_stdout", "input": "5 10\n1 2 3 2 9\n\nSEMPLA", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5 9\n2 2 5 4 10\n\nSAMPLE", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5 10\n1 4 3 1 6\n\nSAMPLE", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5 10\n1 2 3 1 7\n\nELPBMS", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Ashish got a lot of strings as his birthday gift. He does not mind getting so many strings for free; in fact, he loves them. But, on noticing all the strings he received as a gift, Little Ashish, who's also a snob ... | [{"type": "stdin_stdout", "input": "7\naaaaaabbbbbbfgggggdddjjjdjddaaabdggzzzzyyy\nzzzzzzzzzaaaaaaaaaaaabbbbbbbbbbccddppqqrrsstt\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbc\nppqqrrssttuuvvwwxxyyzzaabbccddeeffgghhiijjkkll\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWalter White is on a tour to sell meth. There are N cities.\n\nEach city has a id between 1 and N (both inclusive).\n\nYou are given cost matrix.\n\nIn cost matrix, the j\\;th element in the i\\;th row denotes the cost of... | [{"type": "stdin_stdout", "input": "3\ndelhi\nbengaluru\nhyderabad\n-1 10 20\n10 -1 55\n20 55 1\n4\nbengaluru\ndelhi\nhyderabad\nbengaluru\n\nSALPME", "output": "95\n"}, {"type": "stdin_stdout", "input": "3\ndelhi\nbengaluru\nhyderabad\n-2 10 37\n10 0 55\n20 56 -1\n2\nbengaluru\ndelhi\nhyderabad\nbengaluru\n\nSALPME", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S consisting of digits from `1` through `9`.\n\nFind the number of pairs of integers (i,j) (1 β€ i β€ j β€ |S|) that satisfy the following condition:\n\nCondition: In base ten, the i-th through j-th charact... | [{"type": "stdin_stdout", "input": "14702977823887", "output": "1\n"}, {"type": "stdin_stdout", "input": "11496323319863", "output": "0\n"}, {"type": "stdin_stdout", "input": "17016148553660", "output": "2\n"}, {"type": "stdin_stdout", "input": "28902087906084", "output": "4\n"}, {"type": "stdin_stdout", "input": "3054... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that c... | [{"type": "stdin_stdout", "input": "110000 99999", "output": "10999890000\n"}, {"type": "stdin_stdout", "input": "110001 118998", "output": "4363299666\n"}, {"type": "stdin_stdout", "input": "110000 138162", "output": "7598910000\n"}, {"type": "stdin_stdout", "input": "110000 121574", "output": "6686570000\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drink... | [{"type": "stdin_stdout", "input": "1 100000\n1000000100 100000", "output": "100000010000000\n"}, {"type": "stdin_stdout", "input": "1 100000\n1000000110 100010", "output": "100000011000000\n"}, {"type": "stdin_stdout", "input": "1 100000\n1000000101 100000", "output": "100000010100000\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOur world is one-dimensional, and ruled by two empires called Empire A and Empire B.\n\nThe capital of Empire A is located at coordinate X, and that of Empire B is located at coordinate Y.\n\nOne day, Empire A becomes inc... | [{"type": "stdin_stdout", "input": "4 2 -48 -1\n-20 -102 -91 -23\n-22 75", "output": "War\n"}, {"type": "stdin_stdout", "input": "4 2 -55 -1\n-20 -14 -35 -146\n-22 75", "output": "War\n"}, {"type": "stdin_stdout", "input": "4 -1 -55 -1\n-61 -6 -35 -150\n-22 75", "output": "War\n"}, {"type": "stdin_stdout", "input": "4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke built an online judge to hold a programming contest.\n\nWhen a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring. ... | [{"type": "stdin_stdout", "input": "ACABA", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "ACBAA", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "ACAAA", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "AAACA", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "AAAC@", "output": "Yes\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.\n\nTo create a Haiku, Iroha has come up with three different phrases. These phrases ... | [{"type": "stdin_stdout", "input": "13 4 -2", "output": "NO\n"}, {"type": "stdin_stdout", "input": "13 4 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "20 4 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 -1 3", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 -1 5", "output": "NO\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are league games and tournament games in sports competitions. In soccer league games, points are given to each of the wins, losses, and draws, and the rankings are competed based on the points. The points are win (3... | [{"type": "stdin_stdout", "input": "4\nJapan 1 0 2\nEgypt 1 3 -1\nCanada 0 2 1\nSpain 1 0 1\n3\nJndia -1 2 0\nPoland 1 1 1\nItalx 1 -1 1\n0", "output": "Japan,5\nSpain,4\nEgypt,2\nCanada,1\n\nPoland,4\nItalx,4\nJndia,-3\n"}, {"type": "stdin_stdout", "input": "4\nnapaJ 1 0 0\nEgzpt 0 2 -1\naDaadn 0 2 3\nnibpS 2 0 0\n3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro made a sugoroku so that everyone can play at the children's association event. In order to make the game interesting, I wrote instructions such as \"advance 6\" and \"back 5\" in some of the sugoroku squares other th... | [{"type": "stdin_stdout", "input": "3\n3\n-1\n1\n-1\n3\n0\n4\n2\n0\n-6\n4\n2\n-1\n-7\n0", "output": "OK\nOK\nOK\nOK\n"}, {"type": "stdin_stdout", "input": "3\n3\n0\n1\n-1\n3\n0\n4\n2\n0\n-6\n4\n2\n-1\n-8\n0", "output": "OK\nOK\nOK\nOK\n"}, {"type": "stdin_stdout", "input": "3\n3\n0\n1\n-1\n3\n0\n4\n2\n0\n-6\n4\n2\n-1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nTaro often shop at JOI general stores. At JOI general stores, there are enough coins of 500 yen, 100 yen, 50 yen, 10 yen, 5 yen, and 1 yen, and we always pay the change so that the number of coins is the smalle... | [{"type": "stdin_stdout", "input": "380\n-48\n0", "output": "4\n10\n"}, {"type": "stdin_stdout", "input": "380\n10\n0", "output": "4\n10\n"}, {"type": "stdin_stdout", "input": "380\n12\n0", "output": "4\n13\n"}, {"type": "stdin_stdout", "input": "380\n16\n0", "output": "4\n13\n"}, {"type": "stdin_stdout", "input": "380... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a laboratory, an assistant, Nathan Wada, is measuring weight differences between sample pieces pair by pair. He is using a balance because it can more precisely measure the weight difference between two samples than a ... | [{"type": "stdin_stdout", "input": "2 2\n! 2 2 1\n? 0 2\n3 2\n! 2 2 1\n? 2 1\n4 7\n! 1 2 101\n? 2 3\n! 2 2 100\n? 2 4\n? 2 3\n! 3 3 150\n? 4 1\n0 0", "output": "UNKNOWN\nUNKNOWN\nUNKNOWN\nUNKNOWN\nUNKNOWN\nUNKNOWN\n"}, {"type": "stdin_stdout", "input": "2 2\n! 2 2 1\n? 0 2\n3 2\n! 2 2 1\n? 2 1\n4 7\n! 1 2 101\n? 2 3\n!... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.