messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each cell must be filled with ... | [{"type": "stdin_stdout", "input": "15\n6 7 11 8 13 11 4 20 17 12 9 15 18 13 9\n", "output": "15\n3 5\n4 11 17 8 13\n13 6 11 18 9\n9 15 7 12 20\n"}, {"type": "stdin_stdout", "input": "15\n9 13 29 10 17 15 21 7 7 7 13 4 5 16 2\n", "output": "15\n3 5\n7 2 13 17 9\n10 7 4 15 21\n29 13 7 5 16\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N squares arranged in a row.\nThe squares are numbered 1, 2, ..., N, from left to right.\nSnuke is painting each square in red, green or blue.\nAccording to his aesthetic sense, the following M conditions must a... | [{"type": "stdin_stdout", "input": "300 299\n95 150 2\n20 24 1\n187 206 2\n137 225 3\n43 57 1\n173 234 3\n56 71 2\n1 94 2\n150 176 2\n192 212 2\n214 217 1\n188 190 1\n236 245 1\n24 41 2\n134 147 2\n196 208 2\n75 151 2\n135 135 1\n213 232 1\n159 174 2\n93 131 2\n121 132 2\n7 11 1\n108 117 1\n80 94 2\n187 226 2\n231 250 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor integers b (b \\geq 2) and n (n \\geq 1), let the function f(b,n) be defined as follows:\n - f(b,n) = n, when n < b\n - f(b,n) = f(b,\\,{\\rm floor}(n / b)) + (n \\ {\\rm mod} \\ b), when n \\geq b\nHere, {\\rm floor}... | [{"type": "stdin_stdout", "input": "100000000000\n100000000000\n", "output": "100000000001\n"}, {"type": "stdin_stdout", "input": "100000000000\n50000000000\n", "output": "50000000001\n"}, {"type": "stdin_stdout", "input": "99999515529\n49999757765\n", "output": "49999757765\n"}, {"type": "stdin_stdout", "input": "9999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi ... | [{"type": "stdin_stdout", "input": "fzezbxdbwzbqzxdlkqpcheqlhlfkohdekflklzxpxodqexwewpfbobcdlxowlqzxkqdobwodoxdhcohfdzhlfzbzhcobhewxzodzqfxfbokxkqexwzdfxwhwfeocxobxkocphcofwlkzkcqpblclblbecbwozldhxfdekpwxocfhbzkxqwhkofcxzqlwhpdzkdcedxwkqpqpfchfeclcxeqxfcbzfkophefxkqclxwfoxdfpbeowxpxfdwpolkczlpcdhkhkhohplbfzkolqlzfbhfzl... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nNauuo is a girl who loves random picture websites.\n\nOne day she made a random picture website by herself which includes $n$ pictures.\n\nWhen Nauuo v... | [{"type": "stdin_stdout", "input": "46 50\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\n29 22 30 33 13 31 19 11 12 21 5 4 24 21 20 6 28 16 27 18 21 11 3 24 21 8 8 33 24 7 34 12 13 32 26 33 33 22 18 2 3 7 24 17 9 30\n", "output": "265429165\n98093399\n859759619\n646262275\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence BDF is a subsequence of ABCDE... | [{"type": "stdin_stdout", "input": "KOROXDDWEUVYWJIXSFPEJFYZJDDUXISOFJTIFJSBTWIJQHMTQWLAGGMXTFALRXYCMGZNKYQRCDVTPRQDBAALTWAXTNLDPYWNSFKE\nNHZGRZFMFQGSAYOJTFKMMUPOOQXWCPPAIVRJHINJPHXTTBWRIYNOHMJKBBGXVXYZDBVBBTQRXTOFLBBCXGNICBKAAGOKAYCCJYCW\nXCXLBESCRBNKWYGFDZFKWYNLFAKEWWGRUIAQGNCFDQXCHDBEQDSWSNGVKUFOGGSPFFZWTXGZQMMFJXDW... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA monster is attacking the Cyberland!\n\nMaster Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (HP), offensive power (ATK) and defensive power (DEF).\n\nDuring the bat... | [{"type": "stdin_stdout", "input": "100 100 100\n100 100 100\n100 100 100\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "50 100 51\n100 100 100\n1 100 100\n", "output": "1384\n"}, {"type": "stdin_stdout", "input": "100 100 1\n100 100 100\n1 100 100\n", "output": "1891\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a pro... | [{"type": "stdin_stdout", "input": "+--+--+------+++++++-+-+++--++---+--+-+---+--+++-+++-------+++++-+-++++--+-+-+++++++----+----+++----+-+++-+++-----+++-+-++-+-+++++-+--++----+--+-++-----+-+-++++---+++---+-+-+-++++--+--+++---+++++-+---+-----+++-++--+++---++-++-+-+++-+-+-+---+++--+--++++-+-+--++-------+--+---++-----+++... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it w... | [{"type": "stdin_stdout", "input": "29 -999961 689169\n-999960 689169\n-999927 -938525\n-999735 -989464\n-993714 -997911\n-870186 -999686\n-796253 -999950\n-139940 -999968\n969552 -999972\n985446 -999398\n992690 -997295\n999706 -973137\n999898 -848630\n999997 -192297\n999969 773408\n999495 960350\n999143 981671\n998324... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive integer length of side. Limak has infinitely many blocks of each side length.\n\nA block with side a has volume a^... | [{"type": "stdin_stdout", "input": "1000000000000000\n", "output": "18 999999993541753\n"}, {"type": "stdin_stdout", "input": "1000000000000000\n", "output": "18 999999993541753\n"}, {"type": "stdin_stdout", "input": "999999993700000\n", "output": "18 999999993541753\n"}, {"type": "stdin_stdout", "input": "385925923480... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya's friends made him a birthday present — a bracket sequence. Petya was quite disappointed with his gift, because he dreamed of correct bracket sequence, yet he told his friends nothing about his dreams and decided to... | [{"type": "stdin_stdout", "input": "500\n())()())((()(()((())())(())())()((()(()()))())())))()())())())()())))(()))))((((())(((()(())))()()(()))())(((((()()(((())()((()((())()))()())()))))()))()(((()(())((()()((()())()))((((())(())))()(()(())((((((()()()())))((()())(((((()()(((()))((()((()))())(((())((((()))))))))()()(... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSIHanatsuka - EMber SIHanatsuka - ATONEMENT\n\nBack in time, the seven-year-old Nora used to play lots of games with her creation ROBO_Head-02, both to have fun and enhance his abilities.\n\nOne day, Nora's adoptive fathe... | [{"type": "stdin_stdout", "input": "60\n51 18 41 48 9 10 7 2 34 23 31 55 28 29 47 42 14 30 60 43 16 21 1 33 6 36 58 35 50 19 40 27 26 25 20 38 8 53 22 13 45 4 24 49 56 39 15 3 57 17 59 11 52 5 44 54 37 46 32 12\n", "output": "133605669\n"}, {"type": "stdin_stdout", "input": "59\n43 38 39 8 13 54 3 51 28 11 46 41 14 20 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the research on properties of the greatest common divisor (GCD) of a set of numbers, Ildar, a famous mathematician, introduced a brand new concept of the weakened common divisor (WCD) of a list of pairs of integers... | [{"type": "stdin_stdout", "input": "30\n3 3\n2 2\n4 4\n8 8\n16 16\n32 32\n64 64\n128 128\n256 256\n512 512\n1024 1024\n2048 2048\n4096 4096\n8192 8192\n16384 16384\n32768 32768\n65536 65536\n131072 131072\n262144 262144\n524288 524288\n1048576 1048576\n2097152 2097152\n4194304 4194304\n8388608 8388608\n16777216 1677721... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a tree with N vertices. Vertex 1 is the root of the tree, and the parent of Vertex i (2 \\leq i \\leq N) is Vertex P_i.\nTo each vertex in the tree, Snuke will allocate a color, either black or white, and a non-ne... | [{"type": "stdin_stdout", "input": "1000\n1 1 2 3 4 5 5 7 8 9 10 11 12 12 14 14 15 16 18 19 20 19 20 23 24 24 25 27 28 29 30 31 32 32 32 35 36 36 38 39 39 41 42 42 43 45 45 47 48 49 50 50 52 52 53 55 56 57 57 59 59 61 62 62 64 64 66 67 67 69 70 70 71 72 73 73 76 77 78 79 79 81 82 83 83 84 86 87 87 88 90 91 91 92 94 95 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn \"Takahashi-ya\", a ramen restaurant, basically they have one menu: \"ramen\", but N kinds of toppings are also offered. When a customer orders a bowl of ramen, for each kind of topping, he/she can choose whether to pu... | [{"type": "stdin_stdout", "input": "1263 230932693\n", "output": "229248792\n"}, {"type": "stdin_stdout", "input": "2955 992093419\n", "output": "500531329\n"}, {"type": "stdin_stdout", "input": "2976 430005833\n", "output": "172511512\n"}, {"type": "stdin_stdout", "input": "2993 575559499\n", "output": "520246596\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $a$ and $b$. Moreover, you are given a sequence $s_0, s_1, \\dots, s_{n}$. All values in $s$ are integers $1$ or $-1$. It's known that sequence is $k$-periodic and $k$ divides $n+1$. In other wo... | [{"type": "stdin_stdout", "input": "904132655 827386249 118827660 334\n+++-+++++--+++----+-+-+-+-+--+-+---++--++--++--+-+-+++-+++--+-+-+----+-+-++++-----+--++++------+++-+-+-++-++++++++-+-++-+++--+--++------+--+-+++--++--+---++-++-+-+-++---++-++--+-+-++-+------+-+----+++-+++--+-+-+--+--+--+------+--+---+--+-++--+++---+... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a tree with N vertices numbered 1 to N, and N-1 edges numbered 1 to N-1.\nEdge i connects Vertex a_i and b_i bidirectionally and has a length of 1.\nSnuke will paint each vertex white or black.\nThe niceness of a... | [{"type": "stdin_stdout", "input": "10104\n5741 6080\n3408 7811\n5930 5446\n2841 6030\n7143 6678\n5930 3686\n3091 5609\n9185 6802\n8673 6440\n593 5930\n4271 5808\n3292 3568\n2712 5673\n10008 5082\n421 4874\n5930 7228\n5005 6587\n2254 9793\n8397 7976\n8682 4699\n8396 5930\n7253 1069\n1980 6577\n8066 4032\n2303 3724\n370... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNauuo is a girl who loves playing cards.\n\nOne day she was playing cards but found that the cards were mixed with some empty ones.\n\nThere are $n$ cards numbered from $1$ to $n$, and they were mixed with another $n$ emp... | [{"type": "stdin_stdout", "input": "20\n15 10 6 0 0 11 19 17 0 0 0 0 0 1 14 0 3 4 0 12\n20 7 0 0 0 0 0 0 5 8 2 16 18 0 0 13 9 0 0 0\n", "output": "30"}, {"type": "stdin_stdout", "input": "20\n0 0 0 0 5 6 7 8 0 0 11 12 13 14 15 16 17 18 0 0\n20 9 19 0 0 0 0 0 0 10 0 0 0 0 0 0 1 2 3 4\n", "output": "37"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings $s$ and $t$. The string $s$ consists of lowercase Latin letters and at most one wildcard character '*', the string $t$ consists only of lowercase Latin letters. The length of the string $s$ equal... | [{"type": "stdin_stdout", "input": "5 102\neyw*y\neywsnxcwslfyiqbbeoaawtmioksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdveqguyfk\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1 17\n*\nthisisabadproblem\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "6 10\ncode*s\ncodeforce... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fiends — t... | [{"type": "stdin_stdout", "input": "100\n0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn vacations n pupils decided to go on excursion and gather all together. They need to overcome the path with the length l meters. Each of the pupils will go with the speed equal to v_1. To get to the excursion quickly, i... | [{"type": "stdin_stdout", "input": "10000 1000000000 999999999 1000000000 10000\n", "output": "1.0000000000\n"}, {"type": "stdin_stdout", "input": "10000 1000000000 999999999 1000000000 3\n", "output": "1.0000000010\n"}, {"type": "stdin_stdout", "input": "10000 1000000000 999999999 1000000000 1\n", "output": "1.0000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJeff got 2n real numbers a_1, a_2, ..., a_2n as a birthday present. The boy hates non-integer numbers, so he decided to slightly \"adjust\" the numbers he's got. Namely, Jeff consecutively executes n operations, each of t... | [{"type": "stdin_stdout", "input": "10\n8003.867 4368.000 2243.000 3340.287 5384.000 1036.456 3506.000 4463.000 1477.000 2420.314 9391.000 1696.000 5857.833 244.000 8220.000 5879.000 5424.482 2631.197 7111.000 9157.536\n", "output": "0.028\n"}, {"type": "stdin_stdout", "input": "10\n8003.867 4368.000 2243.298 3340.000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp takes part in a quadcopter competition. According to the rules a flying robot should:\n\n start the race from some point of a field, go around the flag, close cycle returning back to the starting point. \n\nPo... | [{"type": "stdin_stdout", "input": "-100 -100\n-100 100\n", "output": "406\n"}, {"type": "stdin_stdout", "input": "-100 -100\n100 -100\n", "output": "406\n"}, {"type": "stdin_stdout", "input": "100 -100\n-100 -100\n", "output": "406\n"}, {"type": "stdin_stdout", "input": "-100 100\n-100 -100\n", "output": "406\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers $1$, $5$, $10$ and $50$ respectively. The use of other roman digits is not allowed.\n\nNumbers ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "48999999753\n"}, {"type": "stdin_stdout", "input": "500000000\n", "output": "24499999753\n"}, {"type": "stdin_stdout", "input": "600000000\n", "output": "29399999753\n"}, {"type": "stdin_stdout", "input": "709000900\n", "output": "34741043853\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA has a string consisting of some number of lowercase English letters 'a'. He gives it to his friend B who appends some number of letters 'b' to the end of this string. Since both A and B like the characters 'a' and 'b', ... | [{"type": "stdin_stdout", "input": "aaaaabbbbbb\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "aabbaacccc\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "bbbabacca\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "aabcbcaca\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "abababccc... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing. Having returned to the castle, Twilight Sparkle became interested in the dice that were used in the game.\n... | [{"type": "stdin_stdout", "input": "100000 100000\n", "output": "99999.418033254507\n"}, {"type": "stdin_stdout", "input": "50000 100000\n", "output": "49999.843487110789\n"}, {"type": "stdin_stdout", "input": "99999 100000\n", "output": "99998.418042461126\n"}, {"type": "stdin_stdout", "input": "51520 73331\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the snake exhibition, there are $n$ rooms (numbered $0$ to $n - 1$) arranged in a circle, with a snake in each room. The rooms are connected by $n$ conveyor belts, and the $i$-th conveyor belt connects the rooms $i$ an... | [{"type": "stdin_stdout", "input": "36\n2\n--\n2\n>-\n2\n<-\n2\n->\n2\n>>\n2\n<>\n2\n-<\n2\n><\n2\n<<\n3\n---\n3\n>--\n3\n<--\n3\n->-\n3\n>>-\n3\n<>-\n3\n-<-\n3\n><-\n3\n<<-\n3\n-->\n3\n>->\n3\n<->\n3\n->>\n3\n>>>\n3\n<>>\n3\n-<>\n3\n><>\n3\n<<>\n3\n--<\n3\n>-<\n3\n<-<\n3\n-><\n3\n>><\n3\n<><\n3\n-<<\n3\n><<\n3\n<<<\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!\n\nThe Mayor thinks that one of the main city streets could be considerably widened on account of law... | [{"type": "stdin_stdout", "input": "10\n21005 10850\n27020 13372\n28183 3724\n22874 13564\n27446 11493\n22522 10012\n24819 11529\n24166 11084\n24539 9211\n24152 9235\n", "output": "71869\n31855 31856 31857 31858 31859 31860 31861 31862 31863 31864 \n"}, {"type": "stdin_stdout", "input": "2\n1000000 1000000\n1000000 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWelcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. \n\nFrom the window in your room, you see the sequence of n hills, where i-th of them has height a_{i}. T... | [{"type": "stdin_stdout", "input": "100\n1777 339 1249 1644 785 810 228 549 1892 464 1067 639 65 1653 981 1858 863 1980 1174 427 1710 345 309 826 31 1898 255 661 951 443 802 195 177 752 979 1842 1689 399 568 1906 129 1571 1263 696 911 810 1877 1932 1389 1128 112 619 184 434 22 1269 386 324 1635 1440 705 300 455 1635 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, ... | [{"type": "stdin_stdout", "input": "01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja has an n × m rectangular table a, each cell of the table contains a zero or a number one. Sereja wants his table to meet the following requirement: each connected component of the same values forms a rectangle with... | [{"type": "stdin_stdout", "input": "21 10 8\n1 1 1 0 0 1 1 1 1 1\n1 1 1 0 0 1 1 1 1 1\n1 1 1 0 0 1 1 1 1 1\n1 1 1 0 0 1 1 1 1 1\n1 1 1 0 0 1 1 1 1 1\n0 0 1 1 1 0 0 0 0 0\n0 0 0 1 1 0 0 0 0 0\n1 1 1 0 0 1 1 1 1 1\n0 0 0 1 1 0 0 0 0 0\n1 1 1 0 0 1 1 1 1 1\n1 1 1 0 0 1 1 1 1 1\n0 0 0 1 1 0 0 0 0 0\n1 0 1 0 0 1 1 1 1 1\n0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSasha grew up and went to first grade. To celebrate this event her mother bought her a multiplication table $M$ with $n$ rows and $n$ columns such that $M_{ij}=a_i \\cdot a_j$ where $a_1, \\dots, a_n$ is some sequence of ... | [{"type": "stdin_stdout", "input": "10\n0 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n1000000000 0 1 1 1 1 1 1 1 1\n1000000000 1 0 1 1 1 1 1 1 1\n1000000000 1 1 0 1 1 1 1 1 1\n1000000000 1 1 1 0 1 1 1 1 1\n1000000000 1 1 1 1 0 1 1 1 1\n1000000000 1 1 1 1 1 0 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nElections in Berland are coming. There are only two candidates — Alice and Bob.\n\nThe main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each... | [{"type": "stdin_stdout", "input": "54\n10 13\n10 45\n10 51\n01 44\n10 24\n10 26\n10 39\n10 38\n10 41\n10 33\n10 18\n10 12\n10 38\n10 30\n11 31\n10 46\n11 50\n00 26\n00 29\n00 50\n10 16\n10 40\n10 50\n00 43\n10 48\n10 32\n10 18\n10 8\n10 24\n10 32\n10 52\n00 41\n10 37\n10 38\n10 49\n00 35\n10 52\n00 44\n10 41\n10 36\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSoon there will be held the world's largest programming contest, but the testing system still has m bugs. The contest organizer, a well-known university, has no choice but to attract university students to fix all the bug... | [{"type": "stdin_stdout", "input": "40 50 70\n4 5 8 7 3 9 9 2 10 5 7 4 8 1 6 2 6 5 4 7 8 9 6 8 10 8 5 9 4 9 3 4 9 10 1 1 6 3 3 3 7 3 8 8 3 5 1 10 7 6\n2 5 3 4 1 1 4 6 8 9 11 4 3 10 5 6 10 7 4 11 9 1 3 7 8 9 9 2 1 11 9 9 10 10 3 6 11 7 1 8\n26 7 12 28 6 29 30 29 27 30 17 32 9 9 14 30 27 0 17 13 18 25 28 8 32 18 26 34 33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan places knights on infinite chessboard. Initially there are $n$ knights. If there is free cell which is under attack of at least $4$ knights then he places new knight in this cell. Ivan repeats this until there are no... | [{"type": "stdin_stdout", "input": "79\n", "output": "0 0\n1 0\n1 3\n2 0\n3 0\n3 3\n4 0\n5 0\n5 3\n6 0\n7 0\n7 3\n8 0\n9 0\n9 3\n10 0\n11 0\n11 3\n12 0\n13 0\n13 3\n14 0\n15 0\n15 3\n16 0\n17 0\n17 3\n18 0\n19 0\n19 3\n20 0\n21 0\n21 3\n22 0\n23 0\n23 3\n24 0\n25 0\n25 3\n26 0\n27 0\n27 3\n28 0\n29 0\n29 3\n30 0\n31 0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must.\n\nLittle Tommy finds an old polynomial and cleaned it up by taking it modulo another. But now he regrets doing thi... | [{"type": "stdin_stdout", "input": "1000000000000000000 2\n", "output": "61\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 1 0 0 1\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 3\n", "output": "39\n1 0 0 0 2 0 2 2 0 2 0 0 1 1 1 2 1 1 1 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool programmer, he needs at least p experience points, and a desired flat in Moscow costs q dollars. Mikha... | [{"type": "stdin_stdout", "input": "10 468662 93838\n589910 727627\n279516 867207\n470524 533177\n467834 784167\n295605 512137\n104422 629804\n925609 728473\n922365 500342\n998983 958315\n425628 935048\n", "output": "0.469139114479426\n"}, {"type": "stdin_stdout", "input": "6 1000000 999999\n999999 1\n999995 999994\n99... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEdogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number a_{i} written on it.\n\nThey take turns play... | [{"type": "stdin_stdout", "input": "10\n38282 53699 38282 38282 38282 38282 38282 38282 38282 38282\n", "output": "Conan\n"}, {"type": "stdin_stdout", "input": "10\n50165 50165 50165 50165 50165 50165 50165 50165 50165 50165\n", "output": "Agasa\n"}, {"type": "stdin_stdout", "input": "10\n32093 36846 32093 32093 36846 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers A and B.\nPrint a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:\n - Let the size of the grid be h \\times w... | [{"type": "stdin_stdout", "input": "209 499\n", "output": "100 100\n.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#\n####################################################################################################\n.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNearly each project of the F company has a whole team of developers working on it. They often are in different rooms of the office in different cities and even countries. To keep in touch and track the results of the proj... | [{"type": "stdin_stdout", "input": "100 5\n- 60\n- 58\n+ 25\n- 32\n+ 86\n", "output": "95\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30 31 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 59 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays $a$ and $b$ of positive integers, with length $n$ and $m$ respectively. \n\nLet $c$ be an $n \\times m$ matrix, where $c_{i,j} = a_i \\cdot b_j$. \n\nYou need to find a subrectangle of the matrix ... | [{"type": "stdin_stdout", "input": "235 1\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... | 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": "302 4\nabdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdcbdc... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"Duel!\"\n\nBetting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.\n\nThere are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are... | [{"type": "stdin_stdout", "input": "30 19\n000000000010110000101111111111\n", "output": "quailty\n"}, {"type": "stdin_stdout", "input": "20 18\n10010000011111110101\n", "output": "tokitsukaze\n"}, {"type": "stdin_stdout", "input": "20 15\n00000001010001101100\n", "output": "tokitsukaze\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going through $n \\cdot k$ cities. The cities are numerated from $1$ to $n \\cdot k$, the distance between the neighboring cities is exact... | [{"type": "stdin_stdout", "input": "98752 97209\n41218 39020\n", "output": "21427641 3199861056\n"}, {"type": "stdin_stdout", "input": "65536 32768\n6427 13573\n", "output": "67108864 1073741824\n"}, {"type": "stdin_stdout", "input": "100000 100000\n10 1\n", "output": "10000000000 10000000000\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has an integer sequence, a, of length N. The i-th element of a (1-indexed) is a_{i}.\nHe can perform the following operation any number of times:\n - Operation: Choose integers x and y between 1 and N (inclusive), a... | [{"type": "stdin_stdout", "input": "50\n-1000000 -1000000 -1000000 1 -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... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is c_{i}. The price of the chocolate is k, so Pari will take a subset of her coins with sum equal to k and give it to Arya.\n... | [{"type": "stdin_stdout", "input": "15 388\n33 232 106 369 266 135 22 169 367 37 14 181 232 25 154\n", "output": "59\n0 14 22 25 33 37 39 47 51 58 59 62 70 72 84 135 149 157 160 168 169 172 174 181 182 183 186 191 193 194 195 197 202 205 206 207 214 216 219 220 228 231 239 253 304 316 318 326 329 330 337 341 349 351 35... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have $n$ coins, each of the same value of $1$.\n\nDistribute them into packets such that any amount $x$ ($1 \\leq x \\leq n$) can be formed using some (possibly one or all) number of these packets.\n\nEach packet may ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "30"}, {"type": "stdin_stdout", "input": "946942894\n", "output": "30"}, {"type": "stdin_stdout", "input": "781222222\n", "output": "30"}, {"type": "stdin_stdout", "input": "723061816\n", "output": "30"}, {"type": "stdin_stdout", "input": "108461089\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMany years have passed, and n friends met at a party again. Technologies have leaped forward since the last meeting, cameras with timer appeared and now it is not obligatory for one of the friends to stand with a camera, ... | [{"type": "stdin_stdout", "input": "10\n489 685\n857 870\n736 221\n687 697\n166 360\n265 200\n738 519\n393 760\n66 176\n798 160\n", "output": "3231747\n"}, {"type": "stdin_stdout", "input": "10\n864 874\n534 702\n73 363\n856 895\n827 72\n435 468\n888 921\n814 703\n648 715\n384 781\n", "output": "4909752\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most x_{i} boxes on its top (we'll call x_{i} the strength of the box). \n\nSince all ... | [{"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\nYou are given N points (x_i,y_i) located on a two-dimensional plane.\nConsider a subset S of the N points that forms a convex polygon.\nHere, we say a set of points S forms a convex polygon when there exists a convex poly... | [{"type": "stdin_stdout", "input": "200\n6961 9533\n1847 2184\n9391 1072\n8146 7944\n3403 1703\n2280 4570\n8872 8035\n9417 8677\n8552 1719\n6602 3237\n6223 2519\n654 7141\n8494 2638\n7204 8528\n1352 3164\n1638 4388\n1102 7239\n3795 5213\n6836 786\n9662 2985\n6241 9368\n1325 8963\n1237 5004\n8000 5104\n9833 4105\n8543 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an array a_1, a_2, ..., a_{n} of n integers, find the largest number in the array that is not a perfect square.\n\nA number x is said to be a perfect square if there exists an integer y such that x = y^2.\n\n\n-----... | [{"type": "stdin_stdout", "input": "71\n908209 289 44521 240100 680625 274576 212521 91809 506944 499849 3844 15376 592900 58081 240100 984064 732736 257049 600625 180625 130321 580644 261121 75625 46225 853776 485809 700569 817216 268324 293764 528529 25921 399424 175561 99856 295936 20736 611524 13924 470596 574564 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSasha and Kolya decided to get drunk with Coke, again. This time they have k types of Coke. i-th type is characterised by its carbon dioxide concentration $\\frac{a_{i}}{1000}$. Today, on the party in honour of Sergiy of ... | [{"type": "stdin_stdout", "input": "971 108\n706 706 991 706 988 997 996 997 991 996 706 706 996 706 996 984 1000 991 996 1000 724 724 997 991 997 984 997 1000 984 996 996 997 724 997 997 1000 997 724 984 997 996 988 997 706 706 997 1000 991 706 988 997 724 988 706 996 706 724 997 988 996 991 1000 1000 724 988 996 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKuro and Shiro are playing with a board composed of n squares lining up in a row.\nThe squares are numbered 1 to n from left to right, and Square s has a mark on it.\nFirst, for each square, Kuro paints it black or white ... | [{"type": "stdin_stdout", "input": "7775\n", "output": "499126064\n499126064\n796234435\n114971967\n891826170\n38460928\n746758804\n102098624\n582205169\n762199467\n509915249\n602954502\n392594249\n215817236\n170876474\n643293880\n150463555\n628074695\n355316779\n513918741\n157394975\n757039573\n277888730\n825789360\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA positive integer $a$ is given. Baron Munchausen claims that he knows such a positive integer $n$ that if one multiplies $n$ by $a$, the sum of its digits decreases $a$ times. In other words, $S(an) = S(n)/a$, where $S(x... | [{"type": "stdin_stdout", "input": "43\n", "output": "93023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953488372093023255813953... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBike is interested in permutations. A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, [0, 2, 1] is a permutation of length 3 while both [0, ... | [{"type": "stdin_stdout", "input": "25\n", "output": "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 \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 \n0 2 4 6 8 10 12 14 16 18 20 22 24 1 3 5 7 9 11 13 15 17 19 21 23 \n"}, {"type": "stdin_stdout", "input": "23\n", "output": "0 1 2 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCountry of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process.\n\nThere ar... | [{"type": "stdin_stdout", "input": "10 10 1\n351 0 3 7\n214 0 9 9\n606 0 7 8\n688 0 9 3\n188 3 0 9\n994 0 1 7\n372 5 0 8\n957 0 3 6\n458 8 0 7\n379 0 4 7\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 10 1\n988 0 1 1\n507 1 0 9\n798 1 0 9\n246 0 3 7\n242 1 0 8\n574 4 0 7\n458 0 4 9\n330 0 2 9\n303 2 0 8\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are parallel to the coordinate... | [{"type": "stdin_stdout", "input": "217708 823289 162\n", "output": "128074702873.298310000\n"}, {"type": "stdin_stdout", "input": "925659 774524 134\n", "output": "587010971679.470460000\n"}, {"type": "stdin_stdout", "input": "938133 287232 156\n", "output": "182978083107.739690000\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFox Ciel is playing a card game with her friend Jiro.\n\nJiro has n cards, each one has two attributes: position (Attack or Defense) and strength. Fox Ciel has m cards, each one has these two attributes too. It's known th... | [{"type": "stdin_stdout", "input": "36 30\nATK 116\nATK 120\nATK 122\nATK 120\nATK 116\nATK 118\nATK 123\nDEF 2564\nATK 123\nDEF 1810\nATK 124\nATK 120\nDEF 2598\nATK 119\nDEF 2103\nATK 123\nATK 118\nATK 118\nATK 123\nDEF 1988\nATK 122\nATK 120\nDEF 2494\nATK 122\nATK 124\nATK 117\nATK 121\nATK 118\nATK 117\nATK 122\nA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA popular reality show is recruiting a new cast for the third season! $n$ candidates numbered from $1$ to $n$ have been interviewed. The candidate $i$ has aggressiveness level $l_i$, and recruiting this candidate will cos... | [{"type": "stdin_stdout", "input": "34 5\n2 2 5 4 3 1 3 5 3 1 3 1 3 5 5 2 1 3 3 3 1 1 1 4 5 1 3 2 5 5 2 1 2 2\n1357 797 4642 4072 3953 4020 207 344 1412 4061 400 214 708 389 567 3294 1336 3746 1513 3539 4220 4720 329 4516 1741 1744 2537 3963 4941 664 1169 4512 3358 4144\n-4668 -1085 109 -899 769 -1132 -2587 1503 760 -2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalent in one of the two cases: They are equal. If we split string a into two h... | [{"type": "stdin_stdout", "input": "yhwepqwyhwepqwyhwepqweahnqtueahnqtueahnqtuyhwepqwyhwepqwyhwepqwyhwepqweahnqtueahnqtuyhwepqweahnqtueahnqtueahnqtueahnqtueahnqtueahnqtu\neahnqtueahnqtueahnqtuyhwepqweahnqtuyhwepqwyhwepqweahnqtuyhwepqweahnqtuyhwepqweahnqtueahnqtuyhwepqweahnqtueahnqtuyhwepqwyhwepqwyhwepqw\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeyyed and MoJaK are friends of Sajjad. Sajjad likes a permutation. Seyyed wants to change the permutation in a way that Sajjad won't like it. Seyyed thinks more swaps yield more probability to do that, so he makes MoJaK ... | [{"type": "stdin_stdout", "input": "8\n", "output": "YES\n3 4\n1 3\n2 4\n2 3\n1 4\n1 2\n7 8\n5 7\n6 8\n6 7\n5 8\n5 6\n4 7\n3 7\n4 6\n1 6\n2 8\n3 8\n2 7\n2 6\n4 5\n4 8\n1 7\n1 8\n3 5\n3 6\n2 5\n1 5\n"}, {"type": "stdin_stdout", "input": "5\n", "output": "YES\n3 5\n3 4\n4 5\n1 3\n2 4\n2 3\n1 4\n1 5\n1 2\n2 5\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is a beginner programmer. He is studying how to use a command line.\n\nPolycarp faced the following problem. There are n files in a directory and he needs to delete some of them. Polycarp wants to run a single de... | [{"type": "stdin_stdout", "input": "2 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac\n1\n", "output": "Yes\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer sequence of length N: A_1, A_2, \\cdots, A_N.\nAn integer sequence X, which is also of length N, will be chosen randomly by independently choosing X_i from a uniform distribution on the integers 1, 2, ... | [{"type": "stdin_stdout", "input": "6\n680824625 680824626 680824626 680824624 680824626 680824624\n", "output": "655804632\n"}, {"type": "stdin_stdout", "input": "6\n612348318 612348320 612348320 612348319 612348318 612348317\n", "output": "110656261\n"}, {"type": "stdin_stdout", "input": "6\n101617840 101617840 10161... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet N be an even number.\nThere is a tree with N vertices.\nThe vertices are numbered 1, 2, ..., N.\nFor each i (1 \\leq i \\leq N - 1), the i-th edge connects Vertex x_i and y_i.\nSnuke would like to decorate the tree wi... | [{"type": "stdin_stdout", "input": "5000\n4206 692\n4206 446\n4088 4206\n4206 4283\n4206 4534\n4206 2619\n4206 2629\n721 4206\n4206 4889\n4206 2380\n1560 4206\n4206 3871\n4206 1378\n186 4206\n398 4206\n4206 2747\n2444 4206\n3343 4206\n2456 4206\n4018 4206\n542 4206\n4206 3533\n1776 4206\n2270 4206\n1903 4206\n4206 377\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Oldtown to train at the Citadel to become a maester, so he can return and... | [{"type": "stdin_stdout", "input": "1125899906842623 1125899906742623 1125899906842623\n", "output": "100001\n"}, {"type": "stdin_stdout", "input": "95173251245550 106288351347530 106288351372022\n", "output": "16565\n"}, {"type": "stdin_stdout", "input": "33534354842198 32529564319236 32529564342569\n", "output": "222... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArseny likes to organize parties and invite people to it. However, not only friends come to his parties, but friends of his friends, friends of friends of his friends and so on. That's why some of Arseny's guests can be u... | [{"type": "stdin_stdout", "input": "22 80\n8 22\n5 18\n17 18\n10 22\n9 15\n12 10\n4 21\n2 12\n21 16\n21 7\n13 6\n5 21\n20 1\n11 4\n19 16\n18 16\n17 5\n22 20\n18 4\n6 14\n3 4\n16 11\n1 12\n16 20\n19 4\n17 8\n1 9\n12 3\n8 6\n8 9\n7 1\n7 2\n14 8\n4 12\n20 21\n21 13\n11 7\n15 19\n12 20\n17 13\n13 22\n15 4\n19 12\n18 11\n20... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with siz... | [{"type": "stdin_stdout", "input": "50\n840868705 387420489 387420489 795385082 634350497 206851546 536870912 536870912 414927754 387420489 387420489 536870912 387420489 149011306 373106005 536870912 700746206 387420489 777952883 847215247 176645254 576664386 387420489 230876513 536870912 536870912 536870912 387420489 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYaroslav has an array, consisting of (2·n - 1) integers. In a single operation Yaroslav can change the sign of exactly n elements in the array. In other words, in one operation Yaroslav can select exactly n array elements... | [{"type": "stdin_stdout", "input": "27\n-401 -840 -583 -612 -298 -384 798 366 -922 -443 -972 -271 127 -201 992 -748 -351 925 -177 -528 355 5 131 -779 833 -382 -990 -379 -816 681 650 660 624 -112 -652 406 446 -999 259 -778 452 -705 -374 -710 -751 -852 119 -689 -789 96 -984 186 70\n", "output": "28653\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', 'c', 'd'... | [{"type": "stdin_stdout", "input": "6 36\nbf f\nbb d\nff f\nac a\nad c\nbd e\ndd a\naa c\nab a\nba b\naf a\nda c\nce f\nea c\nde a\nca f\ndc f\nec b\ncc a\nae b\nbe b\nbc c\nee e\ncb b\nfb a\ncd d\ndb a\nef a\ncf d\neb c\ndf b\nfd a\ned a\nfe c\nfa b\nfc a\n", "output": "15314\n"}, {"type": "stdin_stdout", "input": "6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Johnny has recently learned about set theory. Now he is studying binary relations. You've probably heard the term \"equivalence relation\". These relations are very important in many areas of mathematics. For examp... | [{"type": "stdin_stdout", "input": "2000\n", "output": "323848720\n"}, {"type": "stdin_stdout", "input": "4000\n", "output": "341934157\n"}, {"type": "stdin_stdout", "input": "2345\n", "output": "832335061\n"}, {"type": "stdin_stdout", "input": "2500\n", "output": "544067513\n"}, {"type": "stdin_stdout", "input": "2780... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a polyline going through points (0, 0) – (x, x) – (2x, 0) – (3x, x) – (4x, 0) – ... - (2kx, 0) – (2kx + x, x) – .... \n\nWe know that the polyline passes through the point (a, b). Find minimum positive value x su... | [{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "1000000000.000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 111111111\n", "output": "111111111.099999990000\n"}, {"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "999999999.500000000000\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.\n\nThere are n schools numerated from 1 to n. One can travel... | [{"type": "stdin_stdout", "input": "100000\n", "output": "49999\n"}, {"type": "stdin_stdout", "input": "100000\n", "output": "49999\n"}, {"type": "stdin_stdout", "input": "43670\n", "output": "21834\n"}, {"type": "stdin_stdout", "input": "31809\n", "output": "15904\n"}, {"type": "stdin_stdout", "input": "40873\n", "out... | 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\n\n[Image]\n\nNephren is playing a game with little leprechauns.\n\nShe gives them an infinite array of strings, f_{0... ∞}.\n\nf_0 is \"What... | [{"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\nYou are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer n. The goal is to replace each question mark with some posit... | [{"type": "stdin_stdout", "input": "? + ? + ? - ? + ? - ? - ? - ? - ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? - ? + ? - ? + ? + ? + ? - ? - ? - ? + ? - ? - ? + ? - ? - ? + ? - ? + ? + ? - ? + ? - ? - ? + ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? + ? - ? - ? - ? - ? - ? - ? - ? - ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider an N \\times N matrix. Let us denote by a_{i, j} the entry in the i-th row and j-th column. For a_{i, j} where i=1 or j=1 holds, its value is one of 0, 1 and 2 and given in the input. The remaining entries are de... | [{"type": "stdin_stdout", "input": "902\n0 1 1 2 0 2 0 2 2 0 2 0 0 1 0 2 1 0 0 1 1 1 2 0 0 2 0 2 1 2 0 2 2 0 1 2 0 0 2 1 1 0 2 0 0 1 2 0 0 1 0 0 1 1 2 0 0 0 2 2 0 2 1 0 0 2 2 0 0 2 2 1 0 2 2 2 2 0 0 0 1 1 2 0 2 0 1 2 1 1 0 0 1 2 2 2 1 0 2 0 1 2 2 1 2 2 0 0 2 0 1 0 1 0 2 0 0 2 0 0 2 1 2 1 0 2 2 1 1 2 0 2 1 0 1 2 0 0 2 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPanic is rising in the committee for doggo standardization — the puppies of the new brood have been born multi-colored! In total there are 26 possible colors of puppies in the nature and they are denoted by letters from '... | [{"type": "stdin_stdout", "input": "27\nmnpsweykjdvaxyiqtgcuzhbfrlo\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "27\nabcdefghijklmnopqrstuvwxyza\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "26\nadtopxgnculmhfkezrwsvqbiyj\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "15\nnrnuugrur... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle penguin Polo loves his home village. The village has n houses, indexed by integers from 1 to n. Each house has a plaque containing an integer, the i-th house has a plaque containing integer p_{i} (1 ≤ p_{i} ≤ n).\n... | [{"type": "stdin_stdout", "input": "1000 8\n", "output": "339760446\n"}, {"type": "stdin_stdout", "input": "1000 1\n", "output": "760074701\n"}, {"type": "stdin_stdout", "input": "1000 2\n", "output": "675678679\n"}, {"type": "stdin_stdout", "input": "1000 3\n", "output": "330155123\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a table of size $n \\times m$, initially fully white. Rows are numbered $1$ through $n$ from top to bottom, columns $1$ through $m$ from left to right. Some square inside the table with odd side length was painte... | [{"type": "stdin_stdout", "input": "96 1\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nB\nW\nW\nW\nW\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.\n\nAlice received a set of Toy Train™ from Bob. It consists of one train and a co... | [{"type": "stdin_stdout", "input": "100 50\n29 35\n10 75\n29 34\n10 87\n29 13\n29 38\n41 21\n10 6\n29 94\n10 47\n31 27\n41 24\n41 8\n10 93\n41 52\n41 36\n31 32\n85 81\n31 32\n41 79\n41 99\n85 88\n41 25\n31 68\n41 93\n10 87\n85 97\n41 85\n10 64\n10 68\n85 22\n10 45\n85 15\n10 16\n10 21\n41 66\n29 68\n41 96\n29 34\n10 22... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCrazy Town is a plane on which there are n infinite line roads. Each road is defined by the equation a_{i}x + b_{i}y + c_{i} = 0, where a_{i} and b_{i} are not both equal to the zero. The roads divide the plane into conne... | [{"type": "stdin_stdout", "input": "841746 527518\n595261 331297\n10\n-946901 129987 670374\n-140388 -684770 309555\n-302589 415564 -387435\n-565799 -72069 -395358\n-523453 -511446 854898\n-846967 -749453 -341866\n-622388 434663 264157\n-638453 625357 344195\n-255265 -676356 -772398\n-824723 -319141 33585\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArtsem has a friend Saunders from University of Chicago. Saunders presented him with the following problem.\n\nLet [n] denote the set {1, ..., n}. We will also write f: [x] → [y] when a function f is defined in integer po... | [{"type": "stdin_stdout", "input": "10\n4 4 4 4 4 4 4 4 4 4\n", "output": "1\n1 1 1 1 1 1 1 1 1 1\n4\n"}, {"type": "stdin_stdout", "input": "7\n7 3 3 5 5 7 7\n", "output": "3\n3 1 1 2 2 3 3\n3 5 7\n"}, {"type": "stdin_stdout", "input": "6\n1 2 3 4 5 5\n", "output": "5\n1 2 3 4 5 5\n1 2 3 4 5\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs a tradition, every year before IOI all the members of Natalia Fan Club are invited to Malek Dance Club to have a fun night together. Malek Dance Club has 2^{n} members and coincidentally Natalia Fan Club also has 2^{n}... | [{"type": "stdin_stdout", "input": "0110011110111000001101001010101000011011101001001101000000111101010101111101010011101001111010111001\n", "output": "416862683\n"}, {"type": "stdin_stdout", "input": "0111001111110010000001111100110100111110001100100001111111110000010010111010010010010111000110001111\n", "output": "77... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA remote island chain contains n islands, labeled 1 through n. Bidirectional bridges connect the islands to form a simple cycle — a bridge connects islands 1 and 2, islands 2 and 3, and so on, and additionally a bridge co... | [{"type": "stdin_stdout", "input": "10\n6 2 3 8 0 4 9 1 5 7\n2 3 8 4 0 9 1 5 7 6\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10\n2 4 8 3 6 1 9 0 5 7\n3 6 1 9 0 5 7 2 8 4\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10\n2 0 1 6 4 9 8 5 3 7\n6 4 9 0 5 3 7 2 1 8\n", "output": "NO\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou need to execute several tasks, each associated with number of processors it needs, and the compute power it will consume.\n\nYou have sufficient number of analog computers, each with enough processors for any task. Ea... | [{"type": "stdin_stdout", "input": "50\n83 43 73 75 11 53 6 43 67 38 83 12 70 27 60 13 9 79 61 30 29 71 10 11 95 87 26 26 19 99 13 47 66 93 91 47 90 75 68 3 22 29 59 12 44 41 64 3 99 100\n31 36 69 25 18 33 15 70 12 91 41 44 1 96 80 74 12 80 16 82 88 25 87 17 53 63 3 42 81 6 50 78 34 68 65 78 94 14 53 14 41 97 63 44 21 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently a serious bug has been found in the FOS code. The head of the F company wants to find the culprit and punish him. For that, he set up an organizational meeting, the issue is: who's bugged the code? Each of the n ... | [{"type": "stdin_stdout", "input": "10 2\n10 2\n9 3\n9 4\n7 2\n4 6\n10 1\n9 2\n3 10\n7 1\n5 1\n", "output": "43\n"}, {"type": "stdin_stdout", "input": "10 3\n6 3\n6 10\n2 5\n5 7\n6 2\n9 2\n8 1\n10 5\n5 10\n7 6\n", "output": "34\n"}, {"type": "stdin_stdout", "input": "10 1\n4 9\n8 9\n7 6\n1 5\n3 6\n4 3\n4 6\n10 1\n1 8\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have an array a with length n, you can perform operations. Each operation is like this: choose two adjacent elements from a, say x and y, and replace one of them with gcd(x, y), where gcd denotes the greatest common d... | [{"type": "stdin_stdout", "input": "15\n10 10 10 10 10 10 21 21 21 21 21 21 21 21 21\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "15\n10 10 10 10 10 10 10 10 10 10 10 10 15 15 21\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "13\n10 10 10 15 15 15 15 15 15 15 15 21 21\n", "output": "21\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFirst-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most talented students in this university. The education is not easy because you need to have fundamental knowledge ... | [{"type": "stdin_stdout", "input": "affviytdmexpwfqplpyrlniprbdphrcwlboacoqec\n", "output": "67\nac\naco\nbd\nbdp\nbo\nboa\nco\ncoq\ncw\ncwl\ndm\ndme\ndp\ndph\nec\nex\nexp\nfq\nfqp\nhr\nhrc\nip\nipr\nlb\nlbo\nln\nlni\nlp\nlpy\nme\nmex\nni\nnip\noa\noac\noq\nph\nphr\npl\nplp\npr\nprb\npw\npwf\npy\npyr\nqec\nqp\nqpl\nrb\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe famous global economic crisis is approaching rapidly, so the states of Berman, Berance and Bertaly formed an alliance and allowed the residents of all member states to freely pass through the territory of any of them.... | [{"type": "stdin_stdout", "input": "10 10\n##.#..#.#2\n...###....\n#..#....##\n.....#....\n.#........\n.....#####\n...#..#...\n....###...\n###.##...#\n.#...1#.3.\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 10\n#...33.#.#\n#.#.33.#1.\n2.....#.11\n222#.#.#..\n####...#.#\n#.........\n.#....#...\n..#..#.##... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA bracketed sequence is called correct (regular) if by inserting \"+\" and \"1\" you can get a well-formed mathematical expression from it. For example, sequences \"(())()\", \"()\" and \"(()(()))\" are correct, while \")... | [{"type": "stdin_stdout", "input": "101\n(())))))()))()())(()))((())))((())(()()()(()()((()()((()((())))((()))()(())(()(())((()))(()))()(((()(\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "100\n)()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBigData Inc. is a corporation that has n data centers indexed from 1 to n that are located all over the world. These data centers provide storage for client data (you can figure out that client data is really big!).\n\nMa... | [{"type": "stdin_stdout", "input": "10 30 7\n5 4 2 3 3 2 5 0 1 6\n7 2\n2 4\n9 3\n3 5\n5 2\n7 10\n6 5\n10 1\n9 8\n10 8\n3 4\n10 4\n4 2\n7 6\n2 8\n1 10\n5 10\n5 6\n5 6\n6 2\n6 5\n9 10\n8 6\n2 4\n9 7\n1 9\n10 4\n6 10\n9 3\n2 7\n", "output": "8\n10 7 2 4 3 9 8 5 "}, {"type": "stdin_stdout", "input": "10 30 10\n7 9 1 5 4 6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understands the subject fairly well, and so he began to behave like he already got PhD in that area.\n\nTo prove his ski... | [{"type": "stdin_stdout", "input": "100000 100000\n", "output": "870472905\n"}, {"type": "stdin_stdout", "input": "86821 24538\n", "output": "1000000005\n"}, {"type": "stdin_stdout", "input": "99999 100000\n", "output": "758107445\n"}, {"type": "stdin_stdout", "input": "100000 99999\n", "output": "758107445\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call an array consisting of n integer numbers a_1, a_2, ..., a_{n}, beautiful if it has the following property:\n\n consider all pairs of numbers x, y (x ≠ y), such that number x occurs in the array a and number y ... | [{"type": "stdin_stdout", "input": "58 38\n6384 48910\n97759 90589\n28947 5031\n45169 32592\n85656 26360\n88538 42484\n44042 88351\n42837 79021\n96022 59200\n485 96735\n98000 3939\n3789 64468\n10894 58484\n26422 26618\n25515 95617\n37452 5250\n39557 66304\n79009 40610\n80703 60486\n90344 37588\n57504 61201\n62619 79797... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBessie the cow has just intercepted a text that Farmer John sent to Burger Queen! However, Bessie is sure that there is a secret message hidden inside.\n\nThe text is a string $s$ of lowercase Latin letters. She considers... | [{"type": "stdin_stdout", "input": "abcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcde... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denomination... | [{"type": "stdin_stdout", "input": "100000000000000000\n", "output": "33333333333333334\n"}, {"type": "stdin_stdout", "input": "99999999999999997\n", "output": "33333333333333333\n"}, {"type": "stdin_stdout", "input": "99999999999999999\n", "output": "3703703703703704\n"}, {"type": "stdin_stdout", "input": "97626528902... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNote that girls in Arpa’s land are really attractive.\n\nArpa loves overnight parties. In the middle of one of these parties Mehrdad suddenly appeared. He saw n pairs of friends sitting around a table. i-th pair consisted... | [{"type": "stdin_stdout", "input": "26\n8 10\n52 21\n2 33\n18 34\n30 51\n5 19\n22 32\n36 28\n42 16\n13 49\n11 17\n31 39\n43 37\n50 15\n29 20\n35 46\n47 23\n3 1\n44 7\n9 27\n6 48\n40 24\n26 14\n45 4\n12 25\n41 38\n", "output": "2 1\n1 2\n2 1\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n2 1\n1 2\n1 2\n1 2\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1.\n\nYou are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you... | [{"type": "stdin_stdout", "input": "97205\n", "output": "17 15 14 13 12 10 9 8 6 5 3 1\n"}, {"type": "stdin_stdout", "input": "97593\n", "output": "17 15 14 13 12 11 9 6 5 4 1\n"}, {"type": "stdin_stdout", "input": "32728\n", "output": "15 14 13 12 11 10 9 8 7 5 4\n"}, {"type": "stdin_stdout", "input": "85371\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKolya has a string s of length n consisting of lowercase and uppercase Latin letters and digits.\n\nHe wants to rearrange the symbols in s and cut it into the minimum number of parts so that each part is a palindrome and ... | [{"type": "stdin_stdout", "input": "115\nz9c2f5fxz9z999c9z999f9f9x99559f5Vf955c59E9ccz5fcc99xfzcEx29xuE55f995u592xE58Exc9zVff885u9cf59cV5xc999fx5x55u992fx9x\n", "output": "5\n22555555555555555555522 89999999999899999999998 999999EEVccEccVEE999999 ccccfffffffVfffffffcccc uuxxxxxxzzzzzzzxxxxxxuu "}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus takes part in the \"Field of Wonders\" TV show. The participants of the show have to guess a hidden word as fast as possible. Initially all the letters of the word are hidden.\n\nThe game consists of several tu... | [{"type": "stdin_stdout", "input": "16\nx*d**s******xd*u\n22\nxfdeoshogyqjxdmu\nxvdvdsnwfwakxdyu\nxfdjoshftykjxdmu\nxfdcoshfwyajxdmu\nxfdfoshkmyajxdmu\nxfdyoshpoycjxdmu\nxmdhcswqnhxjxdtu\nxxdxwsoogqzwxdcu\nxxdhhsxqzciuxdfu\nxddcmswqzksqxdhu\nxfdtoshioyvjxdmu\nxsdxmsfmgjbyxdgu\nxadfssplfnlbxdru\nxndcasykmqmbxdru\nxrdxgs... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInstructors of Some Informatics School make students go to bed.\n\nThe house contains n rooms, in each room exactly b students were supposed to sleep. However, at the time of curfew it happened that many students are not ... | [{"type": "stdin_stdout", "input": "100 3 30\n20 10 8 3 97 20 40 4 58 24 105 56 26 21 66 1 126 4 21 46 8 2 9 21 0 13 24 53 58 23 3 107 1 22 189 3 31 4 31 0 3 0 9 43 19 74 92 7 71 22 46 26 31 49 18 3 10 9 9 110 30 2 40 21 33 4 11 14 47 4 1 37 3 19 18 63 10 53 19 35 11 57 8 3 11 27 23 5 45 15 127 27 23 48 3 8 20 33 5 28\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number is another matter. It is aesthetically pleasing, and it has a number of r... | [{"type": "stdin_stdout", "input": "10000 239\n", "output": "1168638\n"}, {"type": "stdin_stdout", "input": "10000 10000\n", "output": "40\n"}, {"type": "stdin_stdout", "input": "5858 674\n", "output": "71118\n"}, {"type": "stdin_stdout", "input": "620 35\n", "output": "251262\n"}, {"type": "stdin_stdout", "input": "10... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.