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\nProblem C: Seishun 18 Kippu\n\nA student at R University, sirokurostone, was about to attend a training camp at Atsu University. Other members plan to use the Shinkansen, but sirokurostone was going to use the Seishun 18 ... | [{"type": "stdin_stdout", "input": "4 4\nA B G\nA B 34 3\nB C 80 -1\nA G 40 0\nB G 80 -1\n10 6\nKusatsu Tokyo Aizu\nTokyo Nagoya 120 3\nKusatsu Nagoya 40 0\nKusatsu Kanazawa 40 0\nKanazawa Aizu 67 1\nTojyo Kanazawa 40 0\nTpkyo @jzu 80 4\n0 0", "output": "3\n17\n"}, {"type": "stdin_stdout", "input": "4 4\nA B G\nA B 34 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHakone Ekiden is one of the Japanese New Year's traditions. In Hakone Ekiden, 10 runners from each team aim for the goal while connecting the sashes at each relay station. In the TV broadcast, the ranking change from the ... | [{"type": "stdin_stdout", "input": "10\nU\nD\nU\nD\nU\nD\nU\nD\nU\nD", "output": "608"}, {"type": "stdin_stdout", "input": "8\nT\nD\nD\nD\nD\nD\nD\nC", "output": "0\n"}, {"type": "stdin_stdout", "input": "8\nT\nD\nD\nD\nD\nD\nC\nC", "output": "0\n"}, {"type": "stdin_stdout", "input": "8\nT\nD\nD\nD\nD\nE\nC\nC", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nHere are N mysteriously shaped vases. The i-th jar is a shape in which K_i right-sided cylinders are vertically connected in order from the bottom. The order in which they are connected cannot be chan... | [{"type": "stdin_stdout", "input": "2 15\n3 3 4 13 3\n1 11 0 1 2", "output": "4.230769\n"}, {"type": "stdin_stdout", "input": "2 15\n3 3 4 10 3\n1 11 0 1 2", "output": "4.300000\n"}, {"type": "stdin_stdout", "input": "2 13\n3 3 4 10 3\n1 11 0 1 2", "output": "4.100000\n"}, {"type": "stdin_stdout", "input": "2 13\n3 3 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a non-negative decimal integer $x$, convert it to binary representation $b$ of 32 bits. Then, print the result of the following operations to $b$ respecitvely.\n\n* Inversion: change the state of each bit to the opp... | [{"type": "stdin_stdout", "input": "-10", "output": "11111111111111111111111111110110\n00000000000000000000000000001001\n11111111111111111111111111101100\n01111111111111111111111111111011\n"}, {"type": "stdin_stdout", "input": "-12", "output": "11111111111111111111111111110100\n00000000000000000000000000001011\n1111111... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of n lowercase Latin letters. n is even.\n\nFor each position i (1 β€ i β€ n) in string s you are required to change the letter on this position either to the previous letter in alphabeti... | [{"type": "stdin_stdout", "input": "50\n6\nbxyxcz\n4\nzzcy\n2\nzb\n2\nyb\n6\nzzbxyx\n4\nbxzb\n4\naaca\n4\nbzyx\n4\nxaac\n2\nbb\n2\nzb\n6\ncabcbb\n6\nyxzbbb\n2\nxz\n2\ncc\n6\nazcaza\n4\nyyaa\n2\nxb\n2\nyb\n6\nzaxxxz\n4\nbyab\n4\naxxz\n2\nay\n2\nyb\n2\ncx\n4\nzyab\n6\nybcyya\n6\nxayzaz\n4\nzacx\n6\nzzyxbz\n2\ncc\n4\nbycx... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOur brave travelers reached an island where pirates had buried treasure. However as the ship was about to moor, the captain found out that some rat ate a piece of the treasure map.\n\nThe treasure map can be represented a... | [{"type": "stdin_stdout", "input": "20 20\n####################\n############.####.##\n#######..####..#####\n######............##\n######.....#...###.#\n#####E..........##.#\n#.##.#.........#####\n##NR....KO.....#####\n##B........#...#####\n#Y.W...H.......#####\n#####Z.....#...#####\n######...#.#...#####\n#A.......#.#.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n people sitting in a circle, numbered from 1 to n in the order in which they are seated. That is, for all i from 1 to n-1, the people with id i and i+1 are adjacent. People with id n and 1 are adjacent as well.... | [{"type": "stdin_stdout", "input": "735134400\n", "output": "1 367567202 735134403 1102701604 1470268805 1837836006 2205403207 2572970408 2940537609 3308104810 3675672011 4043239212 4410806413 4778373614 5145940815 5513508016 5881075217 6248642418 6983776820 7351344021 7718911222 8454045624 8821612825 9189180026 955674... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer n (n β₯ 0) represented with k digits in base (radix) b. So,\n\n$$$n = a_1 β
b^{k-1} + a_2 β
b^{k-2} + β¦ a_{k-1} β
b + a_k.$$$\n\nFor example, if b=17, k=3 and a=[11, 15, 7] then n=11β
17^2+15β
17+7=3... | [{"type": "stdin_stdout", "input": "97 100\n93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet s be some string consisting of symbols \"0\" or \"1\". Let's call a string t a substring of string s, if there exists such number 1 β€ l β€ |s| - |t| + 1 that t = s_l s_{l+1} β¦ s_{l + |t| - 1}. Let's call a substring t ... | [{"type": "stdin_stdout", "input": "99985 45273\n", "output": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile playing with geometric figures Alex has accidentally invented a concept of a n-th order rhombus in a cell grid.\n\nA 1-st order rhombus is just a square 1 Γ 1 (i.e just a cell).\n\nA n-th order rhombus for all n β₯ 2... | [{"type": "stdin_stdout", "input": "100\n", "output": "19801\n"}, {"type": "stdin_stdout", "input": "72\n", "output": "10225\n"}, {"type": "stdin_stdout", "input": "94\n", "output": "17485\n"}, {"type": "stdin_stdout", "input": "77\n", "output": "11705\n"}, {"type": "stdin_stdout", "input": "86\n", "output": "14621\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor years, the Day of city N was held in the most rainy day of summer. New mayor decided to break this tradition and select a not-so-rainy day for the celebration. The mayor knows the weather forecast for the n days of su... | [{"type": "stdin_stdout", "input": "100 7 7\n1656 322 975 921 115 647 61 232 127 277 839 797 261 968 788 381 191 117 663 959 475 166 471 984 17 473 57 809 65 881 1109 725 587 933 466 537 1017 706 927 173 636 372 644 82 835 893 792 494 808 977 479 109 1858 21 625 104 626 569 524 504 16 257 274 285 404 629 247 609 521 60... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn addition to complaints about lighting, a lot of complaints about insufficient radio signal covering has been received by Bertown city hall recently. n complaints were sent to the mayor, all of which are suspiciosly sim... | [{"type": "stdin_stdout", "input": "10 15 50 10\n10 12\n6 8\n4 14\n6 14\n10 15\n1 14\n1 11\n3 11\n2 10\n7 13\n6 17\n18 45\n25 31\n6 42\n9 39\n6 25\n20 42\n11 12\n38 44\n8 49\n5 21\n12 46\n5 21\n15 31\n10 46\n5 15\n2 14\n7 8\n9 13\n4 7\n3 11\n4 15\n8 15\n7 10\n3 10\n", "output": "8 17\n1 4 6 10 11 12 13 14 "}, {"type": ... | 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": "52702 64157\n", "output": "1000000005\n"}, {"type": "stdin_stdout", "input": "24538 86821\n", "output": "1000000005\n"}, {"type": "stdin_stdout", "input": "99999 100000\n", "output": "758107445\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call an array t dominated by value v in the next situation.\n\nAt first, array t should have at least 2 elements. Now, let's calculate number of occurrences of each number num in t and define it as occ(num). Then t ... | [{"type": "stdin_stdout", "input": "4\n1\n1\n6\n1 2 3 4 5 1\n9\n4 1 2 4 5 4 3 2 1\n4\n3 3 3 3\n", "output": "-1\n6\n3\n2\n"}, {"type": "stdin_stdout", "input": "4\n1\n1\n6\n1 2 3 4 5 2\n9\n4 1 2 4 5 4 3 2 1\n4\n3 3 3 3\n", "output": "-1\n5\n3\n2\n"}, {"type": "stdin_stdout", "input": "4\n1\n1\n6\n1 2 3 4 5 2\n9\n4 1 4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnu has created her own function f: f(x, y) = (x | y) - y where | denotes the [bitwise OR operation](https://en.wikipedia.org/wiki/Bitwise_operation#OR). For example, f(11, 6) = (11|6) - 6 = 15 - 6 = 9. It can be proved t... | [{"type": "stdin_stdout", "input": "100\n8650752 65536 131072 134217728 2112 8 0 0 0 0 0 1 0 0 268435456 1024 0 18890756 0 0 0 135364608 6291464 0 0 0 0 0 32 0 16384 0 0 0 0 33554560 256 0 16 0 0 536870912 536870912 0 0 128 0 0 4096 2048 0 0 0 0 268435456 64 1 0 0 262144 524288 0 8192 0 0 0 2 2 512 131072 0 0 67108864 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.\n\nThe pair of topics i and j (i < j) is called good if ... | [{"type": "stdin_stdout", "input": "14\n137698508 528184026 54130884 239033739 1038011779 720680829 605286542 89272810 284191042 179359950 186766648 570400677 107541072 25121211\n195343970 709242622 422954170 980941827 265963618 812646456 943660193 344102432 295006337 221455256 203711937 632473368 334173424 49206958\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecall that the sequence b is a a subsequence of the sequence a if b can be derived from a by removing zero or more elements without changing the order of the remaining elements. For example, if a=[1, 2, 1, 3, 1, 2, 1], t... | [{"type": "stdin_stdout", "input": "10\n10\n-1 5 10 2 -8 -7 -6 5 -3 -1\n10\n2 2 1 4 5 6 12 3 9 10\n1\n6\n1\n-7\n11\n5 -4 1 2 3 -5 -7 -10 -2 1 12\n4\n-4 -5 -6 1\n7\n1 2 6 1 2 -6 -2\n5\n-1 -5 4 -2 -9\n1\n9\n3\n1 -1 1\n", "output": "7\n12\n6\n-7\n14\n-3\n4\n1\n9\n1\n"}, {"type": "stdin_stdout", "input": "10\n10\n-1 5 17 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVivek has encountered a problem. He has a maze that can be represented as an n Γ m grid. Each of the grid cells may represent the following:\n\n * Empty β '.' \n * Wall β '#' \n * Good person β 'G' \n * Bad person β '... | [{"type": "stdin_stdout", "input": "5\n2 5\nB.GGG\n.B.G.\n3 6\nBB#.GG\nB.#B.G\n.#.#G.\n3 2\n..\n..\n..\n1 4\nBBB.\n4 9\n###B##.B#\n.####.##G\n##.###.#.\n...B#.B#.\n", "output": "Yes\nYes\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "5\n2 5\nB.GGG\n.B.G.\n3 6\nBB#.GG\nB.#B.G\n.#.#G.\n3 2\n..\n..\n..\n1 4\nBBB.\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s[1 ... n] consisting of lowercase Latin letters. It is guaranteed that n = 2^k for some integer k β₯ 0.\n\nThe string s[1 ... n] is called c-good if at least one of the following three conditions is... | [{"type": "stdin_stdout", "input": "6\n8\nbbdcaaaa\n8\nasdfghjk\n8\nceaaaabb\n8\nbbaaddcc\n1\nz\n2\nac\n", "output": "0\n7\n4\n5\n1\n1\n"}, {"type": "stdin_stdout", "input": "6\n8\nbbdcaaaa\n8\nasdfghjk\n8\nceaaaabb\n8\nbbaaddcc\n1\nz\n2\nbc\n", "output": "0\n7\n4\n5\n1\n1\n"}, {"type": "stdin_stdout", "input": "6\n8\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIgor had a sequence d_1, d_2, ..., d_n of integers. When Igor entered the classroom there was an integer x written on the blackboard.\n\nIgor generated sequence p using the following algorithm: \n\n 1. initially, p = [x]... | [{"type": "stdin_stdout", "input": "50\n-3950\n900000000 180000000 900000000 -360000000 360000000 -180000000 -540000000 720000000 540000000 900000000 335247004 -900000000 -180000000 -360000000 0 -1290903016 540000000 540000000 -180000000 -900000000 -540000000 360000000 180000000 0 540000000 -540000000 360000000 -900000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them f... | [{"type": "stdin_stdout", "input": "64 28\n+54\n+44\n+55\n-3\n+33\n-54\n-54\n-7\n+33\n+54\n+54\n+26\n-54\n+14\n-54\n-47\n+25\n-54\n-54\n-54\n-52\n+54\n+54\n+54\n+54\n+20\n+7\n+54\n+4\n+32\n+46\n-54\n-47\n+15\n+32\n-54\n+7\n+62\n-16\n-54\n+3\n+54\n+54\n+54\n+54\n-54\n+54\n-54\n+54\n-52\n+27\n-7\n+54\n-5\n-54\n-18\n+1\n+... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series.\n\nThere a... | [{"type": "stdin_stdout", "input": "10 50 200\n10 1 22\n2 9 6\n4 2 98\n6 6 38\n5 1 67\n6 7 17\n10 4 29\n6 5 97\n3 8 51\n1 6 31\n5 9 72\n4 5 50\n2 1 3\n10 2 27\n1 10 78\n9 9 48\n8 7 81\n5 8 64\n9 4 78\n7 5 90\n9 8 83\n7 1 99\n5 5 43\n1 2 37\n3 3 6\n4 3 61\n9 6 25\n1 3 46\n2 10 18\n1 4 68\n2 4 75\n3 10 67\n7 8 82\n5 7 1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nQwerty the Ranger took up a government job and arrived on planet Mars. He should stay in the secret lab and conduct some experiments on bacteria that have funny and abnormal properties. The job isn't difficult, but the sa... | [{"type": "stdin_stdout", "input": "1000000 1000000 1000000 1000000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "1000000 1000000 1000000 1010000\n", "output": "1000000\n"}, {"type": "stdin_stdout", "input": "100000 100000 1000000 1000000\n", "output": "999999\n"}, {"type": "stdin_stdout", "input": "12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has an array, consisting of n integers a1, a2, ..., an. Polycarpus likes it when numbers in an array match. That's why he wants the array to have as many equal numbers as possible. For that Polycarpus performs ... | [{"type": "stdin_stdout", "input": "100\n968 793 -628 -416 942 -308 977 168 728 -879 952 781 -425 -475 -480 738 -740 142 -319 -116 -701 -183 41 324 -918 -391 -176 781 763 888 475 -617 134 -802 -133 -211 855 -869 -236 503 550 387 137 -221 -957 -800 -56 -673 440 -791 -217 -959 -892 886 -593 427 890 223 -425 -342 -262 693... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is,... | [{"type": "stdin_stdout", "input": "1 10010000\n", "output": "20020001\n"}, {"type": "stdin_stdout", "input": "3 15787624\n", "output": "10525083\n"}, {"type": "stdin_stdout", "input": "2 10001000\n", "output": "10001001\n"}, {"type": "stdin_stdout", "input": "1 10010001\n", "output": "20020003\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe'll call a set of positive integers a beautiful if the following condition fulfills: for any prime p, if <image>, then <image>. In other words, if one number from the set is divisible by prime p, then at least half of n... | [{"type": "stdin_stdout", "input": "5000\n", "output": "50000000 49916790 49912500 49896000 49808682 49803600 49787136 49766400 49674240 49612500 49603708 49601160 49561600 49545216 49520625 49509306 49500000 49413375 49412580 49397040 49392000 49305564 49280000 49268736 49218750 49207500 49193760 49172480 49152000 491... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFox Ciel wants to write a task for a programming contest. The task is: \"You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between ve... | [{"type": "stdin_stdout", "input": "524125987\n", "output": "262\nNNYYNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNYYNYNNYNNNYNNNNNNYNNNNNNNYNNNNNNNNYNNNNNNNNNYNNNNNNNNNNNYNNNNNNNNNNNNYNNNNNNNNNNNNNNNNNYNNNNNNNNNNNNNNNNNNYNNNNNNNNNNNNNNNNNNNYNNNNNNNNNNNNNNNNNNNNNNYNNNNNNNNNNNNNNNNNNNNNNNNNNYNNNNNNNNNNNNNNNNNNN... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important things were lost, in particular the favorite set of Picks.\n\nFortunately, Picks remembers someth... | [{"type": "stdin_stdout", "input": "134596 17540\n", "output": "16924\n17540 17539 17538 17537 17536 17535 17534 17533 17532 17531 17530 17529 17528 17527 17526 17525 17524 17523 17522 17521 17520 17519 17518 17517 17516 17515 17514 17513 17512 17511 17510 17509 17508 17507 17506 17505 17504 17503 17502 17501 17500 174... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a history lesson the teacher asked Vasya to name the dates when n famous events took place. He doesn't remembers the exact dates but he remembers a segment of days [li, ri] (inclusive) on which the event could have tak... | [{"type": "stdin_stdout", "input": "10\n10 10\n13 15\n6 14\n10 15\n4 15\n11 12\n11 15\n8 15\n1 11\n1 9\n", "output": "10 14 6 12 4 11 13 8 2 1\n"}, {"type": "stdin_stdout", "input": "10\n10 10\n13 15\n6 14\n10 15\n4 15\n11 12\n11 15\n5 15\n1 11\n1 9\n", "output": "10 14 6 12 4 11 13 5 2 1\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a n Γ m field consisting only of periods ('.') and asterisks ('*'). Your task is to count all right triangles with two sides parallel to the square sides, whose vertices are in the centers of '*'-cells. A ri... | [{"type": "stdin_stdout", "input": "14 29\n**.*************..*.*********\n**..****.*********.**.*.****.\n********.**..*..*...*....**..\n****.**.***.*.***..*..***.*..\n***.****.***..*.***.*.****.*.\n*.*..***.***********.*.*.****\n****.*.***.*..****.**.**..***\n.*******..**...***.*.********\n*...**********...**...*.***.*... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves computer games. Finally a game that he's been waiting for so long came out!\n\nThe main character of this game has n different skills, each of which is characterized by an integer ai from 0 to 100. The higher ... | [{"type": "stdin_stdout", "input": "100 10000\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 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya likes everything infinite. Now he is studying the properties of a sequence s, such that its first element is equal to a (s1 = a), and the difference between any two neighbouring elements is equal to c (si - si - 1 =... | [{"type": "stdin_stdout", "input": "-1000000000 1000000000 1000000000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-1000000000 1001000000 1000000000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "119057893 -516914539 -39748277\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-19889377... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a description of a depot. It is a rectangular checkered field of n Γ m size. Each cell in a field can be empty (\".\") or it can be occupied by a wall (\"*\"). \n\nYou have one bomb. If you lay the bomb at t... | [{"type": "stdin_stdout", "input": "10 20\n....................\n.........*..........\n....................\n....................\n....................\n....................\n....................\n....................\n...*..............*.\n.........*..........\n", "output": "YES\n9 10\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a pack of 54 cards (52 standard cards and 2 distinct jokers). That is all he has at the moment. Not to die from boredom, Vasya plays Solitaire with them.\n\nVasya lays out nm cards as a rectangle n Γ m. If there... | [{"type": "stdin_stdout", "input": "13 4\nAH TC J2 4D\nQD 4S 3C KS\n6S 8S 5S 9H\n2D JS 7H JD\nKD QS JC 6C\nAD 3S 8C 7D\nAS 2S 9C KC\n3D J1 9D 8D\n4H 7C TH 4C\n9S QC QH 2C\n2H 6H KH TD\n3H 8H 5C TS\nAC 5D 5H JH\n", "output": "Solution exists.\nReplace J1 with 6D and J2 with 7S.\nPut the first square to (1, 1).\nPut the ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you have noticed, there are lovely girls in Arpaβs land.\n\nPeople in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th person's crush is person with the number crushi.\n\n<image>\n\nSomeday Ar... | [{"type": "stdin_stdout", "input": "100\n84 94 72 32 61 90 61 2 76 42 35 82 90 29 51 27 65 99 38 41 44 73 100 58 56 64 54 31 14 58 57 64 90 49 73 80 74 19 31 86 73 44 39 43 28 95 23 5 85 5 74 81 34 44 86 30 50 57 94 56 53 42 53 87 92 78 53 49 78 60 37 63 41 19 15 68 25 77 87 48 23 100 54 27 68 84 43 92 76 55 2 94 100 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Timofey likes integers a lot. Unfortunately, he is very young and can't work with very big integers, so he does all the operations modulo his favorite prime m. Also, Timofey likes to look for arithmetical progressi... | [{"type": "stdin_stdout", "input": "239 100\n95 225 152 10 96 20 192 51 150 138 105 206 33 41 29 127 53 75 118 9 21 43 119 52 174 139 86 161 207 19 203 215 228 30 66 64 32 44 217 54 131 0 74 117 22 129 109 171 172 141 181 237 107 151 193 140 142 85 55 182 160 42 185 106 11 97 65 163 195 63 128 226 194 184 173 216 84 13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nIt's the end of July β the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed... | [{"type": "stdin_stdout", "input": "433 3\nFZDDHMJGBZCHFUXBBPIEBBEFDWOMXXEPOMDGSMPIUZOMRZQNSJAVNATGIWPDFISKFQXJNVFXPHOZDAEZFDAHDXXQKZMGNSGKQNWGNGJGJZVVITKNFLVCPMZSDMCHBTVAWYVZLIXXIADXNYILEYNIQHKMOGMVOCWGHCWIYMPEPADSJAAKEGTUSEDWAHMNYJDIHBKHVUHLYGNGZDBULRXLSAJHPCMNWCEAAPYMHDTYWPADOTJTXTXUKLCHWKUSZRHEKQEFPVJEJJHRWCKYOIWAL... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya learned a new programming language CALPAS. A program in this language always takes one non-negative integer and returns one non-negative integer as well.\n\nIn the language, there are only three commands: apply a bi... | [{"type": "stdin_stdout", "input": "10\n^ 59\n& 1021\n& 510\n^ 470\n& 1022\n& 251\n& 760\n& 1016\n| 772\n| 515\n", "output": "3\n& 1023\n| 775\n^ 232\n"}, {"type": "stdin_stdout", "input": "10\n^ 59\n& 1021\n& 510\n^ 34\n& 1022\n& 251\n& 760\n& 1016\n| 772\n| 515\n", "output": "3\n& 1023\n| 775\n^ 24\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enume... | [{"type": "stdin_stdout", "input": "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n2 1 15 1\n7 1 4 1\n10 1 7 1\n2 1 7 1\n3 1 2 1\n5 1 2 1\n10 1 5 1\n6 1 9 1\n", "output": "3\n4\n6\n3\n3\n4\n3\n3\n4\n3\n"}, {"type": "stdin_stdout", "input": "10 10 1 8 4\n10\n2 3 4 5 6 7 8 9\n10\n1 1 3 1\n2 1 7 1\n2 1 15 1\n7 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of n lowercase Latin letters. You have to type this string using your keyboard.\n\nInitially, you have an empty string. Until you type the whole string, you may perform the following op... | [{"type": "stdin_stdout", "input": "100\nyeywsnxcwslfyiqbbeoaawtmioksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdveqgu\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100\nyeywsnxcwslfyiqbbeoiawtmaoksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdveqgu\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one.\n\n<image>\n\nYou can remove a link or a pearl and insert it between two other existing link... | [{"type": "stdin_stdout", "input": "-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "o----------o----------o----------o----------o----------o----------o----------o----------o----------o\n", "output": "YES\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thoug... | [{"type": "stdin_stdout", "input": "-16 2\n", "output": "5/6\n"}, {"type": "stdin_stdout", "input": "-16 3\n", "output": "2/3\n"}, {"type": "stdin_stdout", "input": "-12 2\n", "output": "5/6\n"}, {"type": "stdin_stdout", "input": "3 -12\n", "output": "2/3\n"}, {"type": "stdin_stdout", "input": "-12 3\n", "output": "2/3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem:\n\nN boxes are arranged systematically in a circle and numbered from 1 to N in increasing order in clockwise direction. There will be Q queries asking you whether boxes i and j can be connected by a straight rod ... | [{"type": "stdin_stdout", "input": "60 5\n60 28\n32 38\n31 44\n48 30\n14 34", "output": "YES\nYES\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "60 5\n60 28\n32 38\n31 44\n48 30\n14 4", "output": "YES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "60 5\n60 28\n32 38\n31 44\n48 30\n25 4", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Arjit is in love with Deepa. They have always thought of themselves as the ideal couple - the best, possible match they could've managed. (No kidding!) And like every other couple, they promised each other not to f... | [{"type": "stdin_stdout", "input": "2\n2\n16\n\nELMPBS", "output": "Arjit\nDeepa\n"}, {"type": "stdin_stdout", "input": "2\n2\n16\n\nELLPBS", "output": "Arjit\nDeepa\n"}, {"type": "stdin_stdout", "input": "2\n4\n10\n\nSBMPLE", "output": "Deepa\nDeepa\n"}, {"type": "stdin_stdout", "input": "2\n4\n14\n\nSAMQLE", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRajat is a guy who always wants to live in a fantasy world. In his world,\na deck consists of X cards, where X is a multiple of 4.\nThere are four types of cards namely spade , heart , club and diamond with\neach type hav... | [{"type": "stdin_stdout", "input": "98\n100026500 100010776 19170 diamond\n100024464 99996319 5706 heart\n100005436 99990832 32392 diamond\n100000292 99982871 12383 spade\n100019912 99993613 25668 club\n100004664 99996953 15142 heart\n100006868 99979224 25548 diamond\n100012316 99990126 3036 diamond\n100000288 99991248... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe cat Snuke wants to play a popular Japanese game called Γ
tCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"ζ¬\" follows the number. The pronunciation of this wo... | [{"type": "stdin_stdout", "input": "-10", "output": "pon\n"}, {"type": "stdin_stdout", "input": "151", "output": "pon\n"}, {"type": "stdin_stdout", "input": "-20", "output": "pon\n"}, {"type": "stdin_stdout", "input": "-15", "output": "hon\n"}, {"type": "stdin_stdout", "input": "115", "output": "hon\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a maze, which is a grid of H \\times W squares with H horizontal rows and W vertical columns.\n\nThe square at the i-th row from the top and the j-th column is a \"wall\" square if S_{ij} is `#`, and a \"roa... | [{"type": "stdin_stdout", "input": "-1 13\n-.,#/\n/#/$.\n.$./,", "output": "0\n"}, {"type": "stdin_stdout", "input": "-1 13\n-/,#.\n/#/$.\n.$./,", "output": "0\n"}, {"type": "stdin_stdout", "input": "-2 13\n-/,#.\n/#/$.\n.$./,", "output": "0\n"}, {"type": "stdin_stdout", "input": "-2 19\n-/,#.\n/#/$.\n.$./,", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition:\n\n* There exists a partition of S into K non-empty strings S=S_1S_2...S_K such that... | [{"type": "stdin_stdout", "input": "aaaccacabaababb", "output": "11\n"}, {"type": "stdin_stdout", "input": "abbccacabaababa", "output": "13\n"}, {"type": "stdin_stdout", "input": "abbccaaabaababc", "output": "12\n"}, {"type": "stdin_stdout", "input": "`abab`cbbba`c`b", "output": "14\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe restaurant AtCoder serves the following five dishes:\n\n* ABC Don (rice bowl): takes A minutes to serve.\n* ARC Curry: takes B minutes to serve.\n* AGC Pasta: takes C minutes to serve.\n* APC Ramen: takes D minutes to... | [{"type": "stdin_stdout", "input": "123\n123\n161\n123\n123", "output": "681\n"}, {"type": "stdin_stdout", "input": "123\n123\n161\n123\n163", "output": "721\n"}, {"type": "stdin_stdout", "input": "123\n123\n161\n123\n263", "output": "821\n"}, {"type": "stdin_stdout", "input": "123\n123\n123\n123\n123", "output": "643"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNiwango-kun has \\\\(N\\\\) chickens as his pets. The chickens are identified by numbers \\\\(1\\\\) to \\\\(N\\\\), and the size of the \\\\(i\\\\)-th chicken is a positive integer \\\\(a_i\\\\).\n\n\\\\(N\\\\) chickens ... | [{"type": "stdin_stdout", "input": "4\n3 12 6 4", "output": "18\n"}, {"type": "stdin_stdout", "input": "4\n2 9 3 8", "output": "12\n"}, {"type": "stdin_stdout", "input": "4\n2 5 3 11", "output": "2\n"}, {"type": "stdin_stdout", "input": "4\n2 9 3 11", "output": "2\n"}, {"type": "stdin_stdout", "input": "4\n2 0 2 10", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the following game:\n\n* The game is played using a row of N squares and many stones.\n* First, a_i stones are put in Square i\\ (1 \\leq i \\leq N).\n* A player can perform the following operation as many time a... | [{"type": "stdin_stdout", "input": "36 17", "output": "644469316\n"}, {"type": "stdin_stdout", "input": "36 18", "output": "653755501\n"}, {"type": "stdin_stdout", "input": "36 22", "output": "667405665\n"}, {"type": "stdin_stdout", "input": "59 22", "output": "723249007\n"}, {"type": "stdin_stdout", "input": "49 17", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEnter a positive integer n of 4,000 or less, with a pair of integers a, b, c, d in the range 0-1000.\n\n\na + b + c + d = n\n\n\nCreate a program that outputs the number of combinations that satisfy the conditions.\n\n\n\... | [{"type": "stdin_stdout", "input": "2\n-1\n207", "output": "10\n0\n1521520\n"}, {"type": "stdin_stdout", "input": "2\n-1\n254", "output": "10\n0\n2796160\n"}, {"type": "stdin_stdout", "input": "2\n-1\n326", "output": "10\n0\n5881204\n"}, {"type": "stdin_stdout", "input": "2\n-1\n100", "output": "10\n0\n176851\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe screen that displays digital numbers that you often see on calculators is called a \"7-segment display\" because the digital numbers consist of seven parts (segments).\n\nThe new product to be launched by Wakamatsu wi... | [{"type": "stdin_stdout", "input": "3\n0\n5\n1\n1\n1\n-1", "output": "0111111\n1010010\n1101011\n0000110\n"}, {"type": "stdin_stdout", "input": "3\n0\n9\n1\n1\n0\n-1", "output": "0111111\n1010000\n1101001\n0111111\n"}, {"type": "stdin_stdout", "input": "3\n0\n5\n1\n1\n2\n-1", "output": "0111111\n1010010\n1101011\n10110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.\n\n* If sage $i$ is right-handed and a left-handed s... | [{"type": "stdin_stdout", "input": "5\n1 1 0 1 0\n1 3 1 -2 4", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5\n1 1 0 1 0\n1 3 1 -1 4", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n1 1 0 0 2\n1 3 0 2 13", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n1 0 0 1 0\n2 3 6 1 2", "output": "3\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Asimov, a robotics researcher, loves to research, but hates houseworks and his house were really dirty. So, he has developed a cleaning robot.\n\nAs shown in the following figure, his house has 9 rooms, where each roo... | [{"type": "stdin_stdout", "input": "1\nC A C\n1\nE C A\n10\nF A B\n0", "output": "0.00000000\n0.00000000\n0.07220459\n"}, {"type": "stdin_stdout", "input": "1\nC A C\n2\nE C A\n10\nF A B\n0", "output": "0.00000000\n0.12500000\n0.07220459\n"}, {"type": "stdin_stdout", "input": "1\nC A C\n1\nF C A\n10\nF A B\n0", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider car trips in a country where there is no friction. Cars in this country do not have engines. Once a car started to move at a speed, it keeps moving at the same speed. There are acceleration devices on some points... | [{"type": "stdin_stdout", "input": "2 0\n1 1\n5 4\n2 5\n2 2 1 1\n2 3 2 2\n3 4 2 2\n4 5 2 1\n6 6\n1 6\n1 2 2 1\n2 3 2 1\n3 6 2 2\n1 4 2 30\n6 5 3 23\n5 6 2 30\n11 7\n1 6\n1 2 1 30\n2 3 1 30\n3 1 1 30\n3 4 100 30\n4 5 2 30\n5 6 1 30\n6 4 1 30\n0 0", "output": "unreachable\n5.0000000000\n6.0000000000\n12.4692246782\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPrincess in Danger\n\nPrincess crisis\n\nEnglish text is not available in this practice contest.\n\nA brave princess in a poor country's tomboy is married to another country for a political marriage. However, a villain wh... | [{"type": "stdin_stdout", "input": "2 1 0 1 0 1\n0 1 2\n3 1 1 2 0 1\n2\n1 2 1\n1 2 1\n3 2 1 2 0 1\n2\n0 2 1\n1 2 1\n4 4 1 4 1 3\n2\n0 1 2\n1 2 4\n0 2 1\n5 0 3\n5 3 2 6 0 3\n1 2\n2 1 2\n1 0 1\n3 4 1\n2 4 1\n4 1 2\n3 0 2\n5 1 2 6 0 3\n1 2\n4 2 4\n2 2 1\n4 3 2\n0 -1 5\n1 4 2\n2 0 1\n0 0 0 0 0 0", "output": "Help!\nHelp!\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nWe played an AI soccer match between Country A and Country B. You have a table that records the player who had the ball at a certain time and its position. The table consists of N rows, and the i-th r... | [{"type": "stdin_stdout", "input": "5\n0 1 0 3 4\n30 1 0 3 4\n90 2 0 6 8\n120 1 1 1 1\n132 2 1 2 2", "output": "5.00000000 1.00000000\n1.41421356 0.20000000"}, {"type": "stdin_stdout", "input": "5\n0 2 0 3 4\n16 1 0 1 4\n155 2 0 6 13\n103 1 1 1 1\n132 -1 1 1 2", "output": "10.295630 2.316667\n1.000000 0.483333\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nC: Mod! Mod!\n\nstory\n\nThat's right! I'm looking for eyewitness testimony! A phantom thief has appeared in Aizu! Everyone's horse stick was stolen! Who is the culprit! ?? Unravel! Mod! Mod!\n\nProblem statement\n\n\"Eye... | [{"type": "stdin_stdout", "input": "6\n1 25 1 10 1 3", "output": "4\n"}, {"type": "stdin_stdout", "input": "6\n0 15 1 10 2 3", "output": "6\n"}, {"type": "stdin_stdout", "input": "6\n0 15 0 10 2 3", "output": "6\n"}, {"type": "stdin_stdout", "input": "6\n0 15 0 10 2 4", "output": "6\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nI want to put as many rectangular tiles as possible on a rectangular wall with a size of $ h $ in height and $ w $ in width, and a size of $ a $ in height and $ b $ in width.\n\nThe following conditions must be... | [{"type": "stdin_stdout", "input": "87 15\n12 66", "output": "1305\n"}, {"type": "stdin_stdout", "input": "87 29\n12 66", "output": "2523\n"}, {"type": "stdin_stdout", "input": "27 27\n16 16", "output": "473\n"}, {"type": "stdin_stdout", "input": "27 32\n16 16", "output": "352\n"}, {"type": "stdin_stdout", "input": "-1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given weighted directed graph G(V, E), find the distance of the shortest route that meets the following criteria:\n\n* It is a closed cycle where it ends at the same point it starts.\n* It visits each vertex exactly... | [{"type": "stdin_stdout", "input": "2 -1\n-1 2 8\n-1 15 4\n-1 0 12\n1 -2 3\n-1 0 4\n3 -1 1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2 -1\n-1 2 8\n-1 10 4\n-1 0 12\n1 -2 3\n-1 0 4\n3 -1 1", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2 -1\n-1 2 8\n-1 10 4\n-1 0 12\n1 -2 3\n-1 0 4\n3 -1 2", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given integers m and n, compute mn (mod 1,000,000,007). Here, A (mod M) is the remainder when A is divided by M.\n\nConstraints\n\n* 1 β€ m β€ 100\n* 1 β€ n β€ 109\n\nInput\n\n\nm n\n\n\nTwo integers m and n are given in ... | [{"type": "stdin_stdout", "input": "-1 1", "output": "1000000006\n"}, {"type": "stdin_stdout", "input": "-2 1", "output": "1000000005\n"}, {"type": "stdin_stdout", "input": "-4 1", "output": "1000000003\n"}, {"type": "stdin_stdout", "input": "-3 1", "output": "1000000004\n"}, {"type": "stdin_stdout", "input": "-5 1", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim so... | [{"type": "stdin_stdout", "input": "5 2\n11 4 10 2 -1\n", "output": "8.333333333333334\n"}, {"type": "stdin_stdout", "input": "5 2\n11 4 10 1 -1\n", "output": "8.333333333333334\n"}, {"type": "stdin_stdout", "input": "5 2\n11 4 10 1 0\n", "output": "8.333333333333334\n"}, {"type": "stdin_stdout", "input": "5 3\n1 7 15 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMedicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\\% of applicants are girls and majority of them are going to live in the university dormitory for the next 4 (hop... | [{"type": "stdin_stdout", "input": "10\n5620 2478 4051 7060 10510 2170 6912 2031 1781 7454\n1 1 1 1 1 1 1 1 1 1\n", "output": "5620\n"}, {"type": "stdin_stdout", "input": "10\n5620 1555 4051 7060 10510 2170 6912 2031 1781 7454\n1 1 1 1 1 1 1 1 1 1\n", "output": "5620\n"}, {"type": "stdin_stdout", "input": "10\n6870 354... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFormula 1 officials decided to introduce new competition. Cars are replaced by space ships and number of points awarded can differ per race.\n\nGiven the current ranking in the competition and points distribution for the ... | [{"type": "stdin_stdout", "input": "4 2\n29 16 13 10\n20 10 10 -1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "4 3\n50 30 20 10\n15 10 7 10\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "4 4\n29 16 13 10\n20 10 8 -1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "4 3\n51 30 20 10\n15 10 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerkomnadzor β Federal Service for Supervision of Communications, Information Technology and Mass Media β is a Berland federal executive body that protects ordinary residents of Berland from the threats of modern internet... | [{"type": "stdin_stdout", "input": "35\n-0.0.0.47\n+0.0.0.39/32\n+0.0.0.23\n+0.0.0.6/31\n-0.0.0.2\n+0.0.0.8/32\n+0.0.0.54/32\n-0.0.0.43\n-0.0.0.31/32\n-0.0.0.0\n+0.0.0.26/32\n-0.0.0.42\n+0.0.0.52\n-0.0.0.10/31\n+0.0.0.53\n+0.0.0.28/32\n-0.0.0.19/32\n-0.0.0.12\n-0.0.0.16/31\n-0.0.0.35/32\n+0.0.0.51\n+0.0.0.24/31\n-0.0.0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is a duck. He wants to get to Alice's nest, so that those two can duck!\n\n<image> Duck is the ultimate animal! (Image courtesy of See Bang)\n\nThe journey can be represented as a straight line, consisting of n segmen... | [{"type": "stdin_stdout", "input": "10\n324839129156 133475576222 1946579156099 185514358673 88712073883 243757012712 950854402304 21947060440 598567289966 674328002732\nGLLLLLLLLW\n", "output": "26365097587258\n"}, {"type": "stdin_stdout", "input": "10\n324839129156 133475576222 987711341463 185514358673 88712073883 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The i-th page contains some mystery that will be explained on... | [{"type": "stdin_stdout", "input": "17\n15 4 3 6 5 11 8 8 9 10 15 12 13 14 17 16 17\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "17\n16 4 3 6 7 6 10 8 9 10 11 12 13 14 15 16 17\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "17\n9 4 3 6 7 6 10 8 9 10 11 12 13 14 15 16 17\n", "output": "8\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis morning Tolik has understood that while he was sleeping he had invented an incredible problem which will be a perfect fit for Codeforces! But, as a \"Discuss tasks\" project hasn't been born yet (in English, well), h... | [{"type": "stdin_stdout", "input": "782 19\n", "output": "1 1\n782 19\n1 2\n782 18\n1 3\n782 17\n1 4\n782 16\n1 5\n782 15\n1 6\n782 14\n1 7\n782 13\n1 8\n782 12\n1 9\n782 11\n1 10\n782 10\n1 11\n782 9\n1 12\n782 8\n1 13\n782 7\n1 14\n782 6\n1 15\n782 5\n1 16\n782 4\n1 17\n782 3\n1 18\n782 2\n1 19\n782 1\n2 1\n781 19\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a country with n citizens. The i-th of them initially has a_{i} money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a receip... | [{"type": "stdin_stdout", "input": "10\n7 9 4 4 7 6 3 7 9 8\n10\n1 3 2\n1 10 5\n1 5 3\n1 5 2\n1 2 9\n1 2 9\n1 2 10\n1 5 7\n1 6 10\n1 10 9\n", "output": "7 10 2 4 7 10 3 7 9 9\n"}, {"type": "stdin_stdout", "input": "10\n7 9 4 4 7 6 3 7 9 8\n10\n1 3 2\n1 10 5\n1 5 3\n1 5 2\n1 2 9\n1 2 7\n1 2 10\n1 5 7\n1 6 10\n1 10 9\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume that the bottom left corner of the tabl... | [{"type": "stdin_stdout", "input": "676584 172869 696986 939949\n217531 247380 771662 973703\n630670 592931 1018961 967883\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "347722 718484 584813 736820\n280059 317406 1617512 588815\n388486 281361 399827 854715\n", "output": "YES\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the Catowice city next weekend the cat contest will be held. However, the jury members and the contestants haven't been selected yet. There are n residents and n cats in the Catowice, and each resident has exactly one ... | [{"type": "stdin_stdout", "input": "5\n4 6\n1 1\n3 3\n1 2\n2 2\n4 4\n4 2\n\n6 6\n3 4\n2 3\n3 2\n1 1\n3 3\n4 4\n\n6 8\n1 1\n3 1\n2 2\n3 3\n3 2\n1 2\n4 4\n2 4\n\n5 8\n4 4\n3 5\n3 4\n5 5\n1 3\n3 3\n2 2\n1 1\n\n5 10\n5 2\n2 3\n4 4\n2 1\n4 4\n3 1\n2 3\n3 3\n5 5\n1 1\n", "output": "Yes\n1 3\n2 \n1 3 4 \nYes\n1 5\n1 \n2 3 4 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call two numbers similar if their binary representations contain the same number of digits equal to 1. For example:\n\n * 2 and 4 are similar (binary representations are 10 and 100); \n * 1337 and 4213 are similar... | [{"type": "stdin_stdout", "input": "97\n1363 1365 1366 1369 1370 1372 1379 1381 1382 1385 1386 1388 1427 1429 1430 1433 1434 1436 1443 1445 1446 1449 1450 1452 1619 1621 1622 1625 1626 1628 1635 1637 1638 1641 1642 1644 1683 1685 1686 1689 1690 1692 1699 1701 1702 1705 1706 1708 2387 2389 2390 2393 2394 2396 2403 2405 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe just discovered a new data structure in our research group: a suffix three!\n\nIt's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which language a s... | [{"type": "stdin_stdout", "input": "30\nmnidamnida\nopmnida\nadinm_masu\nus`m_masu\nuseddesu\nadinmmasu\nmnida_po\ndnmnida\nmasumnida\nusam_po\nmnidadesu\nuted_masu\nmnida_mnida\nadinm_mnida\nusammasu\nmasu_desu\nvsammnida\ngenki_desu\nmm_mnida\nadinmmnida\nop_mnida\nadinm_desu\nused_desu\nusam_desu\nadinmdesu\nsarangh... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three strings a, b and c of the same length n. The strings consist of lowercase English letters only. The i-th letter of a is a_i, the i-th letter of b is b_i, the i-th letter of c is c_i.\n\nFor every i (1 ... | [{"type": "stdin_stdout", "input": "4\naaa\nbbb\nccc\nabc\nbca\nbca\naabb\nbbaa\nbaba\nimi\nmii\niim\n", "output": "NO\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "4\naaa\nbbb\nccc\nabc\nbca\ncca\naabb\nbbaa\nbaba\niim\nmii\niim\n", "output": "NO\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\naa`\ncb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe guessed a permutation p consisting of n integers. The permutation of length n is the array of length n where each element from 1 to n appears exactly once. This permutation is a secret for you.\n\nFor each position r f... | [{"type": "stdin_stdout", "input": "5\n6\n3 2 5 6\n2 4 6\n3 1 3 4\n2 1 3\n4 1 2 4 6\n5\n2 2 3\n2 1 2\n2 1 4\n2 4 5\n7\n3 1 2 6\n4 1 3 5 6\n2 1 2\n3 4 5 7\n6 1 2 3 4 5 6\n3 1 3 6\n2\n2 1 2\n5\n2 2 5\n3 2 3 5\n4 2 3 4 5\n5 1 2 3 4 5\n", "output": "3 1 4 6 2 5 \n3 2 1 4 5 \n2 1 6 3 5 4 7 \n1 2 \n2 5 3 4 1 \n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZookeeper is playing a game. In this game, Zookeeper must use bombs to bomb a string that consists of letters 'A' and 'B'. He can use bombs to bomb a substring which is either \"AB\" or \"BB\". When he bombs such a substr... | [{"type": "stdin_stdout", "input": "3\nAAA\nBABA\nAABBBABBBB\n", "output": "3\n2\n0\n"}, {"type": "stdin_stdout", "input": "3\nAAA\nAABA\nAABBBABBBB\n", "output": "3\n2\n0\n"}, {"type": "stdin_stdout", "input": "3\nAAB\nBABA\nAABBBABBBB\n", "output": "1\n2\n0\n"}, {"type": "stdin_stdout", "input": "3\nAAB\nBABA\nBBBBAB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAshish has two strings a and b, each of length n, and an integer k. The strings only contain lowercase English letters.\n\nHe wants to convert string a into string b by performing some (possibly zero) operations on a.\n\n... | [{"type": "stdin_stdout", "input": "4\n3 3\nabc\nbcd\n4 2\nabba\nazza\n2 1\nzz\naa\n6 2\naaabba\nddddcc\n", "output": "\nNo\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "4\n1 3\nabc\nbcd\n4 2\nabba\nazza\n2 1\nzz\naa\n6 2\naaabba\nddddcc\n", "output": "NO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt the school where Vasya is studying, preparations are underway for the graduation ceremony. One of the planned performances is a ball, which will be attended by pairs of boys and girls.\n\nEach class must present two co... | [{"type": "stdin_stdout", "input": "3\n12 6 4\n2 1 2 4\n1 1 2 3\n2 1 1\n1\n1\n3 15 4\n1 1 2 2\n1 2 1 2\n", "output": "4\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\n12 6 4\n2 1 2 4\n1 1 3 3\n2 1 1\n1\n1\n3 15 4\n1 1 2 2\n1 2 1 2\n", "output": "3\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\n12 6 4\n2 1 2 7\n1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n robots driving along an OX axis. There are also two walls: one is at coordinate 0 and one is at coordinate m.\n\nThe i-th robot starts at an integer coordinate x_i~(0 < x_i < m) and moves either left (towards ... | [{"type": "stdin_stdout", "input": "1\n20 170\n4 6 8 9 10 13 14 16 18 20 23 28 30 32 33 38 42 43 45 46\nL L L L L L L L L L R R R L L R R L R R\n", "output": "5 5 9 11 9 11 15 15 19 19 5 137 1 1 5 137 126 169 169 126\n"}, {"type": "stdin_stdout", "input": "1\n20 170\n4 1 8 9 10 13 14 16 18 20 23 28 30 32 33 38 42 43 45... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFibonacci strings are defined as follows: \n\n * f1 = Β«aΒ» \n * f2 = Β«bΒ» \n * fn = fn - 1 fn - 2, n > 2\n\n\n\nThus, the first five Fibonacci strings are: \"a\", \"b\", \"ba\", \"bab\", \"babba\".\n\nYou are given a Fib... | [{"type": "stdin_stdout", "input": "50 100\na\na\nb\na\na\nb\nb\nb\na\na\nb\nb\na\na\na\na\nb\nb\na\nb\nb\nb\na\na\na\na\na\na\nb\nb\na\nb\na\nb\na\nb\na\nb\nb\nb\na\na\nb\na\na\na\nb\na\nb\na\na\na\nb\na\nb\na\na\nb\na\na\nb\na\na\na\na\nb\na\nb\na\nb\nb\na\nb\nb\nb\na\nb\nb\nb\nb\nb\nb\nb\nb\nb\nb\na\na\na\nb\nb\nb\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEveryone knows that 2010 FIFA World Cup is being held in South Africa now. By the decision of BFA (Berland's Football Association) next World Cup will be held in Berland. BFA took the decision to change some World Cup reg... | [{"type": "stdin_stdout", "input": "4\nTeMnHVvWKpwlpubwyhzqvc\nAWJwc\nbhbxErlydiwtoxy\nEVASMeLpfqwjkke\nAWJwc-TeMnHVvWKpwlpubwyhzqvc 43:73\nbhbxErlydiwtoxy-TeMnHVvWKpwlpubwyhzqvc 38:99\nbhbxErlydiwtoxy-AWJwc 33:84\nEVASMeLpfqwjkke-TeMnHVvWKpwlpubwyhzqvc 79:34\nEVASMeLpfqwjkke-AWJwc 243:7\nEVASMeLpfqwjkke-bhbxErlydiwtox... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 β€ k1 < k2 < ... < k|x| β€ |s|).\n\nYou've got two strings β s and t. Let's consider all subseq... | [{"type": "stdin_stdout", "input": "ctkhagrifaztmnxhmqztzibnmzzkojiztvrkfeoqegvwtbxlvvjhebshqaicsovtkcdovytimjggglyxlvglgunbohnkxargymbqvzgsnvjzgxivdgnaesgxqcruaopjuqsyyorrobnelehjnxcetveehlbmeskptivsuhuqupbieumycwczxyqjtwfofehfkpqmjngygwxkaviuyouiippgvlxjgtkxmhcwtzacbllsybgiujyryngapfwjkkyapfgxtcdpc\nctkhagrifaztmnxhm... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima and his friends have been playing hide and seek at Dima's place all night. As a result, Dima's place got messy. In the morning they decided that they need to clean the place.\n\nTo decide who exactly would clean the ... | [{"type": "stdin_stdout", "input": "100\n4 4 2 5 4 2 2 3 4 4 3 2 3 3 1 3 4 3 3 4 1 3 1 4 5 3 4 3 1 1 1 3 3 2 3 4 3 4 2 2 1 5 1 4 5 1 1 1 3 3 1 1 3 2 5 4 2 5 2 4 5 4 4 1 1 2 1 1 4 5 1 1 5 3 3 2 5 5 5 1 4 1 4 1 1 3 2 3 4 4 2 5 5 2 5 1 1 3 5 3\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "100\n3 3 1 4 2 4 4 3 1... | 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 2n members and coincidentally Natalia Fan Club also has 2n membe... | [{"type": "stdin_stdout", "input": "0111001111110010000001111100110100111110001100100001111111110000010010111010010010010111000110001111\n", "output": "777947548\n"}, {"type": "stdin_stdout", "input": "0110011110111000001101001010101000011011101001001101000000111101010101111101010011101001111010111001\n", "output": "41... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima, Inna and Seryozha have gathered in a room. That's right, someone's got to go. To cheer Seryozha up and inspire him to have a walk, Inna decided to cook something. \n\nDima and Seryozha have n fruits in the fridge. E... | [{"type": "stdin_stdout", "input": "88 10\n6 64 43 1 1 1 8 15 39 1 95 2 1 80 36 40 25 2 52 24 29 26 16 45 96 99 1 91 16 97 67 1 39 91 1 41 72 67 93 84 1 12 67 53 26 1 14 39 94 92 28 75 10 16 81 97 77 22 1 1 41 90 51 49 90 74 5 61 1 45 88 1 40 7 4 59 16 33 6 4 92 1 38 20 4 53 10 80\n70 45 1 73 52 1 20 78 68 98 1 95 2 61... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo chess pieces, a rook and a knight, stand on a standard chessboard 8 Γ 8 in size. The positions in which they are situated are known. It is guaranteed that none of them beats the other one.\n\nYour task is to find the ... | [{"type": "stdin_stdout", "input": "a1\nb2\n", "output": "44\n"}, {"type": "stdin_stdout", "input": "a8\nd4\n", "output": "38\n"}, {"type": "stdin_stdout", "input": "c1\nd2\n", "output": "42\n"}, {"type": "stdin_stdout", "input": "g1\ne6\n", "output": "39\n"}, {"type": "stdin_stdout", "input": "h8\ng2\n", "output": "43... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNot so long ago as a result of combat operations the main Berland place of interest β the magic clock β was damaged. The cannon's balls made several holes in the clock, that's why the residents are concerned about the rep... | [{"type": "stdin_stdout", "input": "1000 -1000\n", "output": "white\n"}, {"type": "stdin_stdout", "input": "0000 -1000\n", "output": "black\n"}, {"type": "stdin_stdout", "input": "-1059 -929\n", "output": "black\n"}, {"type": "stdin_stdout", "input": "-215 -996\n", "output": "black\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmr is a young coder who likes music a lot. He always wanted to learn how to play music but he was busy coding so he got an idea.\n\nAmr has n instruments, it takes ai days to learn i-th instrument. Being busy, Amr dedica... | [{"type": "stdin_stdout", "input": "100 10000\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 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famous Stolp's gears, puzzles that are as famous as the Rubik's cube once was.\n\nIts most important ... | [{"type": "stdin_stdout", "input": "100\n15 86 17 88 19 90 21 92 23 94 25 96 27 98 29 0 31 2 33 4 35 6 37 8 39 10 41 12 43 14 45 16 47 18 49 20 51 22 53 24 55 26 57 28 59 30 61 32 63 34 65 36 67 38 69 40 71 42 73 44 75 46 77 48 79 50 81 52 83 54 85 56 87 58 89 60 91 62 93 64 95 66 97 68 99 70 1 72 3 74 5 76 7 78 9 80 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudents in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces m... | [{"type": "stdin_stdout", "input": "1000000 1000000\n", "output": "3000000\n"}, {"type": "stdin_stdout", "input": "1000000 999999\n", "output": "2999998\n"}, {"type": "stdin_stdout", "input": "1000000 666667\n", "output": "2500000\n"}, {"type": "stdin_stdout", "input": "999999 1000000\n", "output": "3000000\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the programming classes Vasya was assigned a difficult problem. However, he doesn't know how to code and was unable to find the solution in the Internet, so he asks you to help.\n\nYou are given a sequence a, consi... | [{"type": "stdin_stdout", "input": "10\n991309218 517452607 870021923 978357992 136426010 10601767 302627526 883615372 163475700 600546765\n", "output": "991309218 517452607 870021923 517452607 136426010 136426010 978357992 302627526 870021923 "}, {"type": "stdin_stdout", "input": "10\n991309218 517452607 870021923 978... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMisha and Vanya have played several table tennis sets. Each set consists of several serves, each serve is won by one of the players, he receives one point and the loser receives nothing. Once one of the players scores exa... | [{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "2"}, {"type": "stdin_stdout", "input": "2 1000000000 1000000000\n", "output": "1000000000"}, {"type": "stdin_stdout", "input": "1 1000000000 1000000000\n", "output": "2000000000"}, {"type": "stdin_stdout", "input": "999999999 1000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDo you remember a kind cartoon \"Beauty and the Beast\"? No, no, there was no firing from machine guns or radiation mutants time-travels!\n\nThere was a beauty named Belle. Once she had violated the Beast's order and visi... | [{"type": "stdin_stdout", "input": "08:17\n", "output": "248.5 102\n"}, {"type": "stdin_stdout", "input": "08:31\n", "output": "255.5 186\n"}, {"type": "stdin_stdout", "input": "19:55\n", "output": "237.5 330\n"}, {"type": "stdin_stdout", "input": "20:45\n", "output": "262.5 270\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.\n\nWhen V... | [{"type": "stdin_stdout", "input": "999999 1000000\n", "output": "Equal\n"}, {"type": "stdin_stdout", "input": "999997 1000000\n", "output": "Dasha\n"}, {"type": "stdin_stdout", "input": "1000000 999993\n", "output": "Masha\n"}, {"type": "stdin_stdout", "input": "999997 1000001\n", "output": "Dasha\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMishka has got n empty boxes. For every i (1 β€ i β€ n), i-th box is a cube with side length ai.\n\nMishka can put a box i into another box j if the following conditions are met:\n\n * i-th box is not put into another box;... | [{"type": "stdin_stdout", "input": "100\n981 288 186 186 292 876 341 288 663 360 783 907 292 186 341 292 360 1510 360 360 1230 398 783 288 366 398 876 981 398 907 133 360 288 981 907 186 360 288 186 981 186 288 907 876 288 907 876 360 341 292 907 694 907 783 284 981 907 292 876 398 895 876 154 341 876 33 288 186 981 34... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a system of n water taps all pouring water into the same container. The i-th water tap can be set to deliver any amount of water from 0 to ai ml per second (this amount may be a real number). The water delivered ... | [{"type": "stdin_stdout", "input": "20 30\n48 97 14 31 83 22 83 56 19 87 59 7 7 89 24 82 34 40 6 24\n10 4 47 46 11 18 32 55 16 32 53 37 43 32 41 46 57 14 60 44\n", "output": "878.2222222222222\n"}, {"type": "stdin_stdout", "input": "20 30\n48 97 14 31 83 22 83 56 19 87 59 7 7 89 24 82 34 40 6 24\n10 4 85 46 11 18 32 55... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSaMer has written the greatest test case of all time for one of his problems. For a given array of integers, the problem asks to find the minimum number of groups the array can be divided into, such that the product of an... | [{"type": "stdin_stdout", "input": "80\n8861 -8846 -3257 8263 -8045 4549 9626 -6582 5755 -3559 5813 -7411 9151 -1847 2441 4201 2381 4651 -6571 199 -6737 -6333 -9433 -4967 9041 -9319 6801 5813 -2731 -8599 7681 -1303 -7333 6067 -1847 -6333 6047 -7907 -7333 8677 -937 829 2441 -5702 -8045 -3037 -4882 -7703 9001 -5702 -2039... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn one very old text file there was written Great Wisdom. This Wisdom was so Great that nobody could decipher it, even Phong β the oldest among the inhabitants of Mainframe. But still he managed to get some information fr... | [{"type": "stdin_stdout", "input": "35 13\n", "output": "2690352397519398400\n"}, {"type": "stdin_stdout", "input": "35 1\n", "output": "3116285494907301262\n"}, {"type": "stdin_stdout", "input": "35 22\n", "output": "194766400194871296\n"}, {"type": "stdin_stdout", "input": "35 7\n", "output": "3116285483787165100\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N boxes .The i^th box contains ai candies . The frog Om Nom is sitting in box number 1 .Om Nom wants to collect as many candies as he can . However , Om Nom jumps in a peculiar fashion . Om Nom can jump from box... | [{"type": "stdin_stdout", "input": "148\n73761 46895 80132 64100 77363 71933 148262 20265 47228 96450 44190 46966 61774 11261 4900 8339 1432 35044 30970 96225 60061 44983 46365 66010 75670 308 137 72235 2456 45330 86317 65055 82950 3531 72441 155789 95196 21416 64165 125814 24346 83918 63079 19045 55998 77371 58574 874... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.