messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 1
value |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a prime number p, n integers a_1, a_2, β¦, a_n, and an integer k. \n\nFind the number of pairs of indexes (i, j) (1 β€ i < j β€ n) for which (a_i + a_j)(a_i^2 + a_j^2) β‘ k mod p.\n\nInput\n\nThe first line cont... | [{"type": "stdin_stdout", "input": "7 7 3\n4 0 5 3 1 2 6\n", "output": "0"}, {"type": "stdin_stdout", "input": "6 11 2\n1 2 3 4 5 6\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "6 10 2\n1 2 3 4 5 6\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "6 10 2\n1 2 3 4 5 0\n", "output": "1\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAsterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.\n\nA little later they found a string s, ... | [{"type": "stdin_stdout", "input": "btbdpnzdenxueteteytvkwnegodyhmdwhmrmbftrifytzudumzlacwytsuzefqfpjesdblxhpcsidgksisjdmhyxmmugrjmtfcgxmcgpmvbxbyszdugvmoyjeeqsywcvuqskcjotyhvdijyslgfvyujxthngnonasgnbzzygyikheelirdfsvuicbiazfdeqecbtbdpnzdenxueteteytvkwnegodyhmdwhmrmbftrifytzudumzlacwytsuzefqfpjesdblxhpcsidgksisjdmhyxmm... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[3R2 as DJ Mashiro - Happiness Breeze](https://open.spotify.com/track/2qGqK8GRS65Wlf20qUBEak)\n\n[Ice - DJ Mashiro is dead or alive](https://soundcloud.com/iceloki/dj-mashiro-is-dead-or-alive)\n\nNEKO#Ξ¦ΟΞ¦ has just got a n... | [{"type": "stdin_stdout", "input": "10 83\n1 3\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n1 4\n2 2\n2 3\n2 3\n2 3\n2 3\n2 3\n2 3\n1 4\n1 5\n1 7\n2 2\n2 2\n1 5\n2 2\n1 3\n2 1\n2 6\n1 5\n2 6\n2 9\n1 2\n2 5\n1 2\n2 5\n2 4\n2 4\n1 2\n1 2\n1 4\n2 6\n2 6\n2 4\n2 4\n1 2\n1 2\n2 4\n2 4\n2 3\n2 3\n1 2\n2 9\n1 2\n1 2\n1 2\n2 6\n2 6\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a_1, a_2, ... , a_n. Array is good if for each pair of indexes i < j the condition j - a_j β i - a_i holds. Can you shuffle this array so that it becomes good? To shuffle an array means to reorder i... | [{"type": "stdin_stdout", "input": "3\n1\n7\n4\n1 1 3 5\n6\n3 2 1 5 6 4\n", "output": "7\n5 3 1 1\n6 5 4 3 2 1\n"}, {"type": "stdin_stdout", "input": "3\n1\n7\n4\n1 1 3 5\n6\n3 2 1 5 6 4\n", "output": "7\n5 3 1 1\n6 5 4 3 2 1\n"}, {"type": "stdin_stdout", "input": "3\n1\n7\n4\n0 1 3 5\n6\n3 2 1 5 6 4\n", "output": "7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define the following recurrence: $$$a_{n+1} = a_{n} + minDigit(a_{n}) β
maxDigit(a_{n}).$$$\n\nHere minDigit(x) and maxDigit(x) are the minimal and maximal digits in the decimal representation of x without leading z... | [{"type": "stdin_stdout", "input": "8\n1 4\n487 1\n487 2\n487 3\n487 4\n487 5\n937 6\n487 1\n", "output": "42\n487\n519\n528\n544\n564\n1000\n487\n"}, {"type": "stdin_stdout", "input": "8\n1 4\n487 1\n487 2\n487 3\n487 4\n487 5\n487 6\n487 10\n", "output": "42\n487\n519\n528\n544\n564\n588\n716\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a_1, a_2, ... , a_n consisting of integers from 0 to 9. A subarray a_l, a_{l+1}, a_{l+2}, ... , a_{r-1}, a_r is good if the sum of elements of this subarray is equal to the length of this subarray (... | [{"type": "stdin_stdout", "input": "11\n1\n0\n1\n1\n1\n2\n1\n3\n1\n4\n1\n5\n1\n6\n1\n7\n1\n8\n1\n9\n26\n11140000000090000000002111\n", "output": "0\n1\n0\n0\n0\n0\n0\n0\n0\n0\n37\n"}, {"type": "stdin_stdout", "input": "11\n1\n0\n1\n1\n1\n2\n1\n3\n1\n0\n1\n5\n1\n6\n1\n7\n1\n8\n1\n9\n26\n11140000000090000000002111\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLindsey Buckingham told Stevie Nicks [\"Go your own way\"](https://www.youtube.com/watch?v=6ul-cZyuYq4). Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.\n\nConsider a h... | [{"type": "stdin_stdout", "input": "2\n-3 1\n1 3 5 7 9 11\n1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "18\n1000000000000000000\n"}, {"type": "stdin_stdout", "input": "2\n-3 1\n1 3 5 7 9 11\n1000000000 1000000000\n1000000000 1000000000 1000000000 1000000000 110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time in the Kingdom of Far Far Away lived Sam the Farmer. Sam had a cow named Dawn and he was deeply attached to her. Sam would spend the whole summer stocking hay to feed Dawn in winter. Sam scythed hay and p... | [{"type": "stdin_stdout", "input": "1987385827\n", "output": "3123034907 15899086625\n"}, {"type": "stdin_stdout", "input": "1286843196\n", "output": "1286843244 10294745577\n"}, {"type": "stdin_stdout", "input": "1600010311\n", "output": "1936854671 12800082497\n"}, {"type": "stdin_stdout", "input": "1856589245\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a graph of n rows and 10^6 + 2 columns, where rows are numbered from 1 to n and columns from 0 to 10^6 + 1:\n\n<image>\n\nLet's denote the node in the row i and column j by (i, j).\n\nInitially for each i the i-t... | [{"type": "stdin_stdout", "input": "4\n2 3 1\n999999 1000000\n2 3 2\n999999 1000000\n2 3 1\n1000000 1584412\n2 3 1\n100 1000000\n", "output": "1\n2\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n2 3 1\n285716 1000000\n2 3 2\n999999 1000000\n2 3 1\n1000000 1584412\n2 3 1\n100 1000000\n", "output": "0\n2\n0\n0\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn array is called beautiful if all the elements in the array are equal.\n\nYou can transform an array using the following steps any number of times: \n\n 1. Choose two indices i and j (1 β€ i,j β€ n), and an integer x (1 ... | [{"type": "stdin_stdout", "input": "5\n0 11 12 13 14\n", "output": "\n120"}, {"type": "stdin_stdout", "input": "5\n0 12 1 13 14\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "5\n1 3 0 13 48\n", "output": "120\n"}, {"type": "stdin_stdout", "input": "5\n1 18 2 13 26\n", "output": "24\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn some country live wizards. They love to ride trolleybuses.\n\nA city in this country has a trolleybus depot with n trolleybuses. Every day the trolleybuses leave the depot, one by one and go to the final station. The f... | [{"type": "stdin_stdout", "input": "10 7 8\n2 4\n3 13\n4 7\n5 1\n9 16\n10 9\n12 18\n16 4\n17 16\n20 10\n", "output": "4.285714285714286\n4.511857892036909\n5.642857142857143\n13.071428571428573\n13.071428571428573\n13.071428571428573\n13.51185789203691\n18.28571428571429\n18.511857892036907\n21.514285714285712\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus has a ribbon, its length is n. He wants to cut the ribbon in a way that fulfils the following two conditions: \n\n * After the cutting each ribbon piece should have length a, b or c. \n * After the cutting th... | [{"type": "stdin_stdout", "input": "3043 317 1141 2438\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "3399 2035 2 3334\n", "output": "683\n"}, {"type": "stdin_stdout", "input": "4000 500 1000 2000\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "4000 500 1000 1671\n", "output": "8\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThose days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thou... | [{"type": "stdin_stdout", "input": "yufkkfwyhhvcjntsgsvpzbhqtmtgyxifqoewmuplphykmptfdebjxuaxigomjtwgtljwdjhjernkitifbomifbhysnmadtnyn\n", "output": "CHAT WITH HER!\n"}, {"type": "stdin_stdout", "input": "yufkkfwyhhvcjntsgsvpzbhqtmtgyxifqoewmuplphykmptfdebjxuaxigomjtwgtljwdjhjernkitifbomifbhxsnmadtnyn\n", "output": "CHA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe board has got a painted tree graph, consisting of n nodes. Let us remind you that a non-directed graph is called a tree if it is connected and doesn't contain any cycles.\n\nEach node of the graph is painted black or ... | [{"type": "stdin_stdout", "input": "50\n1 574339\n0 409333\n0 330634\n0 420557\n0 323095\n0 63399\n0 69999\n1 82396\n1 90197\n0 265793\n0 65065\n1 38496\n1 43632\n1 95792\n1 61780\n1 87623\n1 31246\n0 48483\n1 76824\n1 81693\n1 66004\n1 72826\n1 146477\n1 12359\n1 27042\n1 12542\n0 81514\n0 28986\n1 73958\n1 8219\n0 56... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFarmer John has just given the cows a program to play with! The program contains two integer variables, x and y, and performs the following operations on a sequence a1, a2, ..., an of positive integers:\n\n 1. Initially,... | [{"type": "stdin_stdout", "input": "98\n94 24 17 133 275858941 58 91 57 13 468038892 42 195790073 494005784 8 468106970 518962936 33 27 67 72 42 206673418 10 82 23 34 29 77 90 39 9 67 34 71 29 95 49 48 60 69 86 71 94 77 48 74 19 96700186 5 67 867418949 663483223 64 64 78 23 8 60 7 17 96 71 70 20 5 63 35 34 63 30 86 76 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nReforms continue entering Berland. For example, during yesterday sitting the Berland Parliament approved as much as n laws (each law has been assigned a unique number from 1 to n). Today all these laws were put on the tab... | [{"type": "stdin_stdout", "input": "98 24\n52 20 12 75 44 22 22 25 28 100 8 41 31 47 95 87 5 54 7 49 32 46 42 37 45 22 29 11 54 98 46 94 10 47 114 2 15 108 17 82 46 22 32 62 89 37 30 26 92 77 69 11 59 78 24 66 88 10 32 93 46 14 57 20 5 69 53 99 81 94 67 22 54 31 49 52 46 51 49 4 53 31 4 66 28 38 103 5 40 75 15 52 87 16... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya often uses public transport. The transport in the city is of two types: trolleys and buses. The city has n buses and m trolleys, the buses are numbered by integers from 1 to n, the trolleys are numbered by integers ... | [{"type": "stdin_stdout", "input": "680 871 347 800\n10 100\n872 156 571 136 703 201 832 213 15 333\n465 435 870 173 660 237 694 594 423 405 27 866 325 490 255 989 128 345 278 125 708 210 771 848 961 448 871 190 745 343 532 174 103 999 874 221 252 500 886 129 185 208 137 425 758 34 696 15 198 981 91 50 545 885 194 583 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja showed an interesting game to his friends. The game goes like that. Initially, there is a table with an empty cup and n water mugs on it. Then all players take turns to move. During a move, a player takes a non-emp... | [{"type": "stdin_stdout", "input": "100 1000\n10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA and B are preparing themselves for programming contests.\n\nAfter several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also developed rather... | [{"type": "stdin_stdout", "input": "-2 -2 2 1 4 0 -2 4 5 4 -5 -5 2 1 1 -1 0 -5 -2 3 -2 4 5 2 3 -5\nqgzhbkitmqwttdyoyvcbxincwjryzknubpacsngorexaldfurondbednowemnnlphhboycfavsovisrmfaefusoobingjhsmrukx\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "-2 -2 2 1 4 0 -2 4 5 4 -5 -5 2 1 1 -1 0 -5 -2 3 -2 6 5 2 3 -5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this task you need to process a set of stock exchange orders and use them to create order book.\n\nAn order is an instruction of some participant to buy or sell stocks on stock exchange. The order number i has price pi... | [{"type": "stdin_stdout", "input": "3 3\nB 16671 5044\nS 23924 4895\nS 76276 1905\n", "output": "S 76276 1905\nS 23924 4895\nB 16671 5044\n"}, {"type": "stdin_stdout", "input": "3 3\nB 16671 5006\nS 23924 4895\nS 76276 1905\n", "output": "S 76276 1905\nS 23924 4895\nB 16671 5006\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArya has n opponents in the school. Each day he will fight with all opponents who are present this day. His opponents have some fighting plan that guarantees they will win, but implementing this plan requires presence of ... | [{"type": "stdin_stdout", "input": "1 100\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolandBall is playing a game with EnemyBall. The rules are simple. Players have to say words in turns. You cannot say a word which was already said. PolandBall starts. The Ball which can't say a new word loses.\n\nYou're ... | [{"type": "stdin_stdout", "input": "2 2\nkremowka\nwadowicka\nkremowka\nwiedenska\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2 2\nkremowak\nwadowicka\nkremowka\nwiedenska\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "2 2\nkremowak\nwadowicka\nkremowka\nwiedanske\n", "output": "NO\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMolly Hooper has n different kinds of chemicals arranged in a line. Each of the chemicals has an affection value, The i-th of them has affection value ai.\n\nMolly wants Sherlock to fall in love with her. She intends to d... | [{"type": "stdin_stdout", "input": "89 -7\n5972 4011 3914 670 3727 2913 6935 6927 2118 6645 7141 3585 9811 2859 459 8870 6578 8667 468 5152 3241 7455 7323 8817 4866 1040 5102 9146 621 5002 396 4967 9822 4200 3899 4416 5225 9415 9606 4802 5589 1798 9094 5453 7163 264 1026 6187 3918 4237 -17 4306 8960 3321 2927 9205 6248... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOkabe needs to renovate the Future Gadget Laboratory after he tried doing some crazy experiments! The lab is represented as an n by n square grid of integers. A good lab is defined as a lab in which every number not equal... | [{"type": "stdin_stdout", "input": "10\n3 2 6 5 1 2 1 1 2 1\n1 2 2 3 1 4 1 1 1 1\n1 1 3 1 2 2 2 1 1 1\n1 3 1 2 1 2 1 1 1 1\n12 1 4 3 3 1 1 1 2 1\n8 1 1 1 1 3 6 5 1 3\n1 1 1 2 4 1 3 2 1 1\n1 1 1 1 1 1 1 2 1 1\n1 2 1 1 1 1 1 1 1 1\n2 1 1 1 1 1 1 1 1 2\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "10\n3 2 6 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDoubly linked list is one of the fundamental data structures. A doubly linked list is a sequence of elements, each containing information about the previous and the next elements of the list. In this problem all lists hav... | [{"type": "stdin_stdout", "input": "100\n0 0\n0 0\n0 0\n97 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 29\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n12 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.\n\nk expe... | [{"type": "stdin_stdout", "input": "10 4\n1 0 1 0\n1 0 0 1\n1 1 0 1\n1 0 1 1\n1 1 0 1\n1 0 1 0\n0 0 0 0\n0 0 1 0\n1 0 1 0\n0 0 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 4\n0 0 1 1\n0 0 1 1\n0 0 1 1\n0 0 1 1\n0 0 1 1\n0 0 1 1\n0 0 1 1\n0 0 1 1\n0 0 1 1\n1 1 0 0\n", "output": "YES\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree consisting of n vertices. Each vertex has a number written on it; number ai is written on vertex i.\n\nLet's denote d(i, j) as the distance between vertices i and j in the tree (that is, the nu... | [{"type": "stdin_stdout", "input": "5 2\n1 3 2 3 5\n2 3\n5 1\n3 4\n4 1\n2\n1 2\n2 3\n", "output": "2\n5\n"}, {"type": "stdin_stdout", "input": "5 2\n1 3 2 3 5\n2 3\n5 2\n3 4\n4 1\n2\n1 2\n2 3\n", "output": "2\n5\n"}, {"type": "stdin_stdout", "input": "5 2\n1 3 3 3 5\n2 3\n5 2\n3 4\n4 1\n2\n1 2\n2 3\n", "output": "3\n1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two positive integer numbers a and b. Permute (change order) of the digits of a to construct maximal number not exceeding b. No number in input and/or output can start with the digit 0.\n\nIt is allowed to l... | [{"type": "stdin_stdout", "input": "1000000000000000000\n1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n1000000000100000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "999999999999999999\n1000000000000000000\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMusicians of a popular band \"Flayer\" have announced that they are going to \"make their exit\" with a world tour. Of course, they will visit Berland as well.\n\nThere are n cities in Berland. People can travel between c... | [{"type": "stdin_stdout", "input": "7 7\n1 6 745325\n2 3 3581176\n2 4 19\n3 6 71263060078\n5 4 170098\n7 4 163953\n5 6 15994\n1 297404206755 82096176217 14663411 187389745 21385 1317789\n", "output": "1 393607 7555959 393569 53373 21385 721475\n"}, {"type": "stdin_stdout", "input": "7 7\n1 6 745325\n2 3 3581176\n2 4 19... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nN boys are sitting in a circle. Each of them have some apples in their hand. You find that the total number of the apples can be divided by N. So you want to divide the apples equally among all the boys. But they are so l... | [{"type": "stdin_stdout", "input": "4\n0 3 10 3\n\nR@LOLF", "output": "10\n"}, {"type": "stdin_stdout", "input": "4\n1 3 13 7\n\nEAPMLS", "output": "12\n"}, {"type": "stdin_stdout", "input": "4\n1 3 33 7\n\nELMOAS", "output": "32\n"}, {"type": "stdin_stdout", "input": "4\n1 3 17 7\n\nRANPMG", "output": "16\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nβCan you answer this million dollar question ?β said the presenter to Little Achraf. \nβYesβ, he responded. \nβOk β¦ here is the questionβ. \n\nWe define a sequence A of strings of order L as follows:\n\nA[n] = \\sum\\limi... | [{"type": "stdin_stdout", "input": "3 11\n5 5 r\n13 10 N\n39 10 y\n482 13 O\n51 11 K\n67 10 v\n5298 20 7\n591 20 i\n7126 17 8\n430 13 W\n155 11 z", "output": "0\n"}, {"type": "stdin_stdout", "input": "3 11\n5 5 r\n13 10 N\n39 10 y\n482 13 O\n51 11 K\n67 10 v\n5298 20 7\n574 20 i\n7126 17 8\n430 13 W\n155 11 z", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOur monk loves food. Hence,he took up position of a manager at Sagar,a restaurant that serves people with delicious food packages. It is a very famous place and people are always queuing up to have one of those packages.... | [{"type": "stdin_stdout", "input": "6\n1\n2 -1\n2 11\n2 10\n1\n1\n\nSANPKE", "output": "No Food\n10\n11\n"}, {"type": "stdin_stdout", "input": "6\n1\n2 -1\n2 17\n2 10\n1\n1\n\nSANPKE", "output": "No Food\n10\n17\n"}, {"type": "stdin_stdout", "input": "6\n1\n2 -1\n2 10\n2 10\n1\n1\n\nELPLAS", "output": "No Food\n10\n10\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a non-negative integer K, we define a fractal of level K as follows:\n\n* A fractal of level 0 is a grid with just one white square.\n* When K > 0, a fractal of level K is a 3^K \\times 3^K grid. If we divide this gri... | [{"type": "stdin_stdout", "input": "2\n3 2 7 8\n12 3 1 15", "output": "10\n23\n"}, {"type": "stdin_stdout", "input": "2\n0 2 7 8\n12 3 1 15", "output": "13\n23\n"}, {"type": "stdin_stdout", "input": "2\n0 2 10 8\n6 3 1 15", "output": "16\n17\n"}, {"type": "stdin_stdout", "input": "2\n15 2 4 4\n7 6 1 26", "output": "13\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j... | [{"type": "stdin_stdout", "input": "10000000019", "output": "10000000018"}, {"type": "stdin_stdout", "input": "6069423871", "output": "23434326\n"}, {"type": "stdin_stdout", "input": "65898355", "output": "13179674\n"}, {"type": "stdin_stdout", "input": "68833649", "output": "68833648\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an arithmetic progression with L terms: s_0, s_1, s_2, ... , s_{L-1}.\n\nThe initial term is A, and the common difference is B. That is, s_i = A + B \\times i holds.\n\nConsider the integer obtained by concatenat... | [{"type": "stdin_stdout", "input": "107 10000000000007 1000000000000007 1055093371", "output": "58425676\n"}, {"type": "stdin_stdout", "input": "107 10000000000007 1000000000000007 498250141", "output": "152045046\n"}, {"type": "stdin_stdout", "input": "107 17664785118816 1000000000000007 498250141", "output": "2402025... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet us consider a grid of squares with 10^9 rows and N columns. Let (i, j) be the square at the i-th column (1 \\leq i \\leq N) from the left and j-th row (1 \\leq j \\leq 10^9) from the bottom.\n\nSnuke has cut out some ... | [{"type": "stdin_stdout", "input": "9\n17 18 51 18 28 45 112 45 23", "output": "917046249"}, {"type": "stdin_stdout", "input": "9\n17 18 51 18 34 45 112 45 23", "output": "938229436"}, {"type": "stdin_stdout", "input": "9\n17 18 51 18 34 45 190 45 23", "output": "353713429"}, {"type": "stdin_stdout", "input": "9\n17 18... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane. In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoD... | [{"type": "stdin_stdout", "input": "2\n-3 4 1\n111 4 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "2\n5 2 3\n100 0 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2\n5 2 2\n100 1 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "2\n5 2 1\n111 1 0", "output": "Yes\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given N items.\nThe value of the i-th item (1 \\leq i \\leq N) is v_i.\nYour have to select at least A and at most B of these items.\nUnder this condition, find the maximum possible arithmetic mean of the values o... | [{"type": "stdin_stdout", "input": "5 1 5\n1000000000000000 999999999999999 999999999999998 455140417295801 999999999999996", "output": "1000000000000000.00000000\n1\n"}, {"type": "stdin_stdout", "input": "5 1 5\n1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996", "output": "1000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo foxes Jiro and Saburo are playing a game called 1D Reversi. This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of t... | [{"type": "stdin_stdout", "input": "WBWBWBBBWW", "output": "6\n"}, {"type": "stdin_stdout", "input": "WWBBCWBWBV", "output": "7\n"}, {"type": "stdin_stdout", "input": "XWBBCWBWBV", "output": "8\n"}, {"type": "stdin_stdout", "input": "XWVBCWBWCB", "output": "9\n"}, {"type": "stdin_stdout", "input": "WWBBBWBWBW", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeen from above, there is a grid-like square shaped like Figure 1. The presence or absence of \"walls\" on each side of this grid is represented by a sequence of 0s and 1s. Create a program that stands at point A, puts yo... | [{"type": "stdin_stdout", "input": "1111\n00001\n0110\n11111\n1010\n00011\n1010\n01011\n1111", "output": "RRRRDDDDLLLLRULRDRRULRULULDLUDRURRDDDRUUUULLLL\n"}, {"type": "stdin_stdout", "input": "1111\n01001\n0010\n11101\n1110\n00111\n1110\n10001\n1110", "output": "RRRRDDDDUUUULLLDDRURLDRDLLLDRRRLLLURRULLUDRUUL\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBlackjack is a type of card game played in casinos, where the game is played using cards with numbers from 1 to 13. The score of each card is decided as follows.\n\n* 1 is 1 point or 11 points\n* From 2 to 9, the score is... | [{"type": "stdin_stdout", "input": "1\n3 7 4\n13 7 13\n10 2\n10 1 1\n0", "output": "11\n14\n0\n12\n12\n"}, {"type": "stdin_stdout", "input": "1\n11 3 4\n1 7 8\n2 1\n10 3 1\n0", "output": "11\n17\n16\n13\n14\n"}, {"type": "stdin_stdout", "input": "1\n7 7 3\n11 10 8\n8 1\n10 2 1\n0", "output": "11\n17\n0\n19\n13\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHave you ever had an infinite loop when you ran a hard-working program? It would be convenient to be able to determine in advance whether a program will stop executing without having to execute it.\n\nUnfortunately, it is... | [{"type": "stdin_stdout", "input": "6\n10 SET d 1\n20 SET h 5\n100 ADD s s i\n110 SUB i i c\n120 IF i 100\n124 HALT", "output": "c=0\nd=1\nh=5\ni=0\ns=0\n"}, {"type": "stdin_stdout", "input": "6\n10 SET c 1\n20 SET h 5\n100 ADD s s i\n110 SUB i i c\n209 IF j 100\n200 HALT", "output": "c=1\nh=5\ni=0\nj=0\ns=0\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJOI is playing with a nail in the board. As shown in the figure below, JOI stabbed nails in the shape of an equilateral triangle with N sides. A nails are lined up in the ath line (1 β€ a β€ N) from the top. The bth nail (1... | [{"type": "stdin_stdout", "input": "5 2\n2 1 1\n2 1 3", "output": "10\n"}, {"type": "stdin_stdout", "input": "9 2\n2 1 1\n2 1 3", "output": "10\n"}, {"type": "stdin_stdout", "input": "5 2\n2 2 1\n2 1 3", "output": "12"}, {"type": "stdin_stdout", "input": "1 2\n2 1 1\n2 1 3", "output": "0\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolygons are the most fundamental objects in geometric processing. Complex figures are often represented and handled as polygons with many short sides. If you are interested in the processing of geometric data, you'd bett... | [{"type": "stdin_stdout", "input": "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n-1 20\n3 33\n0 70\n100 40\n100 -1\n\n0", "output": "1 9.5\n2 5426.0\n"}, {"type": "stdin_stdout", "input": "3\n1 1\n3 4\n6 -1\n\n7\n1 -1\n10 10\n-1 20\n3 33\n0 40\n100 40\n100 0\n\n0", "output": "1 9.5\n2 3921.5\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n500-yen Saving\n\n\"500-yen Saving\" is one of Japanese famous methods to save money. The method is quite simple; whenever you receive a 500-yen coin in your change of shopping, put the coin to your 500-yen saving box. Ty... | [{"type": "stdin_stdout", "input": "4\n800\n700\n1600\n600\n4\n300\n1205\n1600\n30\n4\n300\n700\n1600\n650\n3\n1001\n2000\n638\n3\n250\n250\n1000\n4\n1251\n1466\n698\n299\n0", "output": "2 2900\n4 3135\n3 3250\n2 1639\n3 1500\n4 3714\n"}, {"type": "stdin_stdout", "input": "4\n800\n700\n1600\n600\n4\n300\n1205\n1600\n30... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet S be the sum of divisors of an integer N excluding the number itself. When N = S, N is called a perfect number, when N> S, N is called a defendant number, and when N <S, N is called an abundant number. Create a progra... | [{"type": "stdin_stdout", "input": "1\n2\n2\n1\n1\n14\n16\n27\n66290451\n187711252\n124798312\n100001000\n0", "output": "deficient number\ndeficient number\ndeficient number\ndeficient number\ndeficient number\ndeficient number\ndeficient number\ndeficient number\ndeficient number\ndeficient number\ndeficient number\na... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro came to a square to look for treasure. There are many treasures buried in this square, but Taro has the latest machines, so he knows everything about where the treasures are buried. Since the square is very wide Taro... | [{"type": "stdin_stdout", "input": "5 5\n10 7\n-3 -8\n2 11\n6 0\n-1 3\n-3 1 3 13\n-1 -1 9 5\n-3 -16 10 11\n-1 0 5 4\n-1 -13 15 10", "output": "2\n2\n5\n1\n3\n"}, {"type": "stdin_stdout", "input": "5 5\n10 7\n-3 -8\n2 11\n10 0\n-1 3\n-3 1 3 13\n-1 -1 9 5\n-3 -16 12 11\n0 0 5 4\n-1 -13 15 10", "output": "2\n1\n5\n0\n3\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBroken crypto generator\n\nJAG (Japanese Alumni Group) is a mysterious organization composed of many programmers, and in order to enter the building where the headquarters of this organization is located, it is necessary ... | [{"type": "stdin_stdout", "input": "A+A++A\nZ-Z--Z+-Z\n[ESRVEER]\nJ---?---J\n++++++++A+++Z-----------A+++Z\n[[++-+--?[--++-?++-+++L]][-+-----+-O]]++++---+L\n.", "output": "ABC\nZYXZ\nREEVRSE\nJAG\nICPC\nJAPAN\n"}, {"type": "stdin_stdout", "input": "A+A++A\nZ-ZZ--+-Z\n[ESRVEER]\nJ---?---J\n++++++++A+++Z-----------A+++Z\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nB-Mansion and courier\n\nProblem Statement\n\nTaro lives alone in a mansion. Taro, who loves studying, intends to study in his study in the house today. Taro can't concentrate outside the study, so he always studies in th... | [{"type": "stdin_stdout", "input": "1 1 110\n18", "output": "108\n"}, {"type": "stdin_stdout", "input": "1 0 110\n11", "output": "110\n"}, {"type": "stdin_stdout", "input": "1 3 110\n18", "output": "104\n"}, {"type": "stdin_stdout", "input": "1 0 192\n16", "output": "192\n"}, {"type": "stdin_stdout", "input": "1 1 192\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nGiven a sequence $ a_i $ of length $ N $. Output all integers $ K (1 \\ le K \\ le N) $ that satisfy the following conditions.\n\nCondition: Well sorted $ a_1, \\ cdots, a_K $ matches $ a_ {N-K + 1}, \\ cdots, ... | [{"type": "stdin_stdout", "input": "8\n0 1 1 -24 -1 1 1 0", "output": "1 2 3 5 6 7 8\n"}, {"type": "stdin_stdout", "input": "8\n-1 0 12 16 3 1 0 -1", "output": "1 2 6 7 8\n"}, {"type": "stdin_stdout", "input": "8\n-1 0 12 8 3 1 0 -1", "output": "1 2 6 7 8\n"}, {"type": "stdin_stdout", "input": "8\n5 2 4 9 4 9 2 5", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShell Sort\n\nShell Sort is a generalization of Insertion Sort to arrange a list of $n$ elements $A$.\n\n\n1 insertionSort(A, n, g)\n2 for i = g to n-1\n3 v = A[i]\n4 j = i - g\n5 while j ... | [{"type": "stdin_stdout", "input": "5\n10\n1\n5\n9\n1", "output": "2\n4 1\n1\n1\n1\n5\n9\n10\n"}, {"type": "stdin_stdout", "input": "5\n10\n1\n5\n7\n1", "output": "2\n4 1\n1\n1\n1\n5\n7\n10\n"}, {"type": "stdin_stdout", "input": "5\n6\n1\n10\n7\n1", "output": "2\n4 1\n4\n1\n1\n6\n7\n10\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a $ n \\times m$ matrix $A$ and a $m \\times 1$ vector $b$, and prints their product $Ab$.\n\nA column vector with m elements is represented by the following equation.\n\n\\\\[ b = \\left( \\be... | [{"type": "stdin_stdout", "input": "3 4\n1 4 -2 1\n0 3 0 -1\n4 1 0 0\n0\n-2\n3\n0", "output": "-14\n-6\n-2\n"}, {"type": "stdin_stdout", "input": "3 4\n0 7 -13 0\n0 0 0 1\n4 2 2 0\n1\n1\n3\n-1", "output": "-32\n-1\n12\n"}, {"type": "stdin_stdout", "input": "3 4\n0 7 -13 0\n0 0 0 1\n4 2 2 0\n1\n2\n3\n-1", "output": "-25... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem we consider a very simplified model of Barcelona city.\n\nBarcelona can be represented as a plane with streets of kind x = c and y = c for every integer c (that is, the rectangular grid). However, there is... | [{"type": "stdin_stdout", "input": "912738218 530309782 -939253776\n592805323 -930297022 -567581994 -829432319\n", "output": "1218437463.3854325\n"}, {"type": "stdin_stdout", "input": "912738218 530309782 -939253776\n592805323 -930297022 -567581994 -31761631\n", "output": "1677516792.7100685\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice's hair is growing by leaps and bounds. Maybe the cause of it is the excess of vitamins, or maybe it is some black magic...\n\nTo prevent this, Alice decided to go to the hairdresser. She wants for her hair length to... | [{"type": "stdin_stdout", "input": "4 20 1000000000\n1000000000 1000000000 1000000000 1000000000\n1 1 1\n1 4 1\n0\n1 1 1000000000\n1 4 1000000000\n0\n1 1 1000000000\n1 4 1000000000\n1 1 1000000000\n1 4 1000000000\n1 1 1000000000\n1 4 1000000000\n1 1 1000000000\n1 4 1000000000\n0\n1 2 1\n0\n1 3 1\n0\n1 2 1\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call an array good if there is an element in the array that equals to the sum of all other elements. For example, the array a=[1, 3, 3, 7] is good because there is the element a_4=7 which equals to the sum 1 + 3 + 3... | [{"type": "stdin_stdout", "input": "4\n500000 500000 1000000 1000000\n", "output": "2\n3 4\n"}, {"type": "stdin_stdout", "input": "4\n500000 251993 1000000 1000000\n", "output": "0\n\n"}, {"type": "stdin_stdout", "input": "6\n4 7 1 1 1 1\n", "output": "5\n2 3 4 5 6\n"}, {"type": "stdin_stdout", "input": "4\n2 1000000 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an n Γ m table, consisting of characters Β«AΒ», Β«GΒ», Β«CΒ», Β«TΒ». Let's call a table nice, if every 2 Γ 2 square contains all four distinct characters. Your task is to find a nice table (also consisting of Β«AΒ», Β«... | [{"type": "stdin_stdout", "input": "3 5\nAGCAG\nAGCAG\nAGCAG\n", "output": "AGCTC\nCTAGA\nAGCTC\n"}, {"type": "stdin_stdout", "input": "3 5\nGACGA\nAGCAG\nAGCAG\n", "output": "AGCGA\nCTATC\nAGCGA\n"}, {"type": "stdin_stdout", "input": "3 5\nAGGAC\nGACGA\nGACGA\n", "output": "AGAGC\nCTCTA\nAGAGC\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRamesses came to university to algorithms practice, and his professor, who is a fairly known programmer, gave him the following task.\n\nYou are given two matrices A and B of size n Γ m, each of which consists of 0 and 1 ... | [{"type": "stdin_stdout", "input": "10 10\n1 1 1 0 1 1 0 0 0 1\n1 1 1 1 0 0 0 0 0 1\n0 1 0 0 0 0 0 0 1 0\n0 0 0 0 0 1 0 0 0 0\n0 1 1 1 0 1 1 1 0 0\n0 0 0 1 1 1 0 1 0 0\n0 0 0 0 1 1 0 0 1 1\n0 0 0 1 1 0 1 1 1 1\n1 1 0 1 1 0 1 1 0 0\n1 0 0 0 0 0 0 0 1 0\n0 1 0 1 0 1 1 1 0 0\n0 1 1 0 0 0 0 0 0 1\n0 1 0 0 0 1 0 0 0 0\n0 1 ... | 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\nIf you write a solution in Python, then prefer to send it in PyPy to speed up execution time.\n\nA session has begun at Beland State University. Many s... | [{"type": "stdin_stdout", "input": "10 50\n10 10 10 10 10 10 10 10 10 10\n", "output": "0 0 0 0 0 1 2 3 4 5 \n"}, {"type": "stdin_stdout", "input": "10 71\n10 10 10 10 10 10 10 10 10 10\n", "output": "0 0 0 0 0 0 0 1 2 3\n"}, {"type": "stdin_stdout", "input": "10 71\n10 10 10 10 10 10 10 10 10 14\n", "output": "0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the city of Saint Petersburg, a day lasts for 2^{100} minutes. From the main station of Saint Petersburg, a train departs after 1 minute, 4 minutes, 16 minutes, and so on; in other words, the train departs at time 4^k ... | [{"type": "stdin_stdout", "input": "1000010011100010111000001101000011001010011101011001101100000001011011000000101101101011101111011011\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "output": "50\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n positive integers a_1, β¦, a_n, and an integer k β₯ 2. Count the number of pairs i, j such that 1 β€ i < j β€ n, and there exists an integer x such that a_i β
a_j = x^k.\n\nInput\n\nThe first line contains two... | [{"type": "stdin_stdout", "input": "100 4\n94 94 83 27 80 73 61 38 34 95 72 96 59 36 52 15 122 78 39 22 21 57 54 59 9 32 81 64 51 90 67 41 18 58 93 76 44 62 77 61 31 70 39 73 111 57 43 31 27 85 36 26 58 48 35 23 124 53 3 14 40 67 53 19 70 81 98 12 91 15 92 90 89 86 58 30 67 73 72 69 68 47 30 7 89 41 17 97 45 6 4 23 13 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBees Alice and Alesya gave beekeeper Polina famous card game \"Set\" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shapes, shape, sh... | [{"type": "stdin_stdout", "input": "24 4\nSETS\nETES\nSSST\nESTE\nTSES\nSSES\nTESS\nSEEE\nETEE\nETSS\nSSEE\nESTT\nSTSS\nTTTT\nTEEE\nTSEE\nESET\nTTTE\nETTT\nSTEE\nSTTE\nESSS\nTEET\nTETE\n", "output": "31\n"}, {"type": "stdin_stdout", "input": "24 4\nSETS\nETES\nSSST\nESTE\nTSES\nSSES\nTESS\nEESE\nETEE\nETSS\nSSEE\nESTT\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBessie has way too many friends because she is everyone's favorite cow! Her new friend Rabbit is trying to hop over so they can play! \n\nMore specifically, he wants to get from (0,0) to (x,0) by making multiple hops. He ... | [{"type": "stdin_stdout", "input": "1\n19 1000000000\n15 8 22 12 10 16 2 17 14 7 20 23 9 18 3 19 21 11 1\n", "output": "43478261\n"}, {"type": "stdin_stdout", "input": "1\n19 1000000000\n15 8 22 12 10 16 2 17 14 7 20 23 9 14 3 19 21 11 1\n", "output": "43478261\n"}, {"type": "stdin_stdout", "input": "1\n19 1000000000\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe sequence of m integers is called the permutation if it contains all integers from 1 to m exactly once. The number m is called the length of the permutation.\n\nDreamoon has two permutations p_1 and p_2 of non-zero len... | [{"type": "stdin_stdout", "input": "6\n5\n1 4 3 2 1\n6\n2 4 1 3 3 1\n4\n2 1 1 2\n4\n1 3 3 1\n12\n2 1 3 5 5 6 7 8 9 1 10 2\n3\n1 2 1\n", "output": "2\n1 4\n4 1\n0\n1\n2 2\n0\n0\n2\n1 2\n2 1\n"}, {"type": "stdin_stdout", "input": "6\n5\n1 4 3 2 1\n6\n2 4 1 3 2 1\n4\n2 1 1 3\n4\n1 3 3 1\n12\n2 1 3 4 5 6 7 8 9 1 10 2\n3\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n models in the shop numbered from 1 to n, with sizes s_1, s_2, β¦, s_n.\n\nOrac will buy some of the models and will arrange them in the order of increasing numbers (i.e. indices, but not sizes).\n\nOrac thinks ... | [{"type": "stdin_stdout", "input": "4\n23\n3198 4895 1585 3916 2650 5552 876 2731 1971 126 2152 6910 1096 4103 1074 2594 2897 3983 3830 3460 729 576 3281\n1\n0000000010\n2\n1 1\n100\n1 2 3 4 5 2 7 10 9 14 11 12 13 14 24 16 17 33 19 20 21 22 23 24 25 26 27 28 29 41 31 32 56 34 35 36 37 38 39 40 41 42 43 44 45 46 54 48 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNaman has two binary strings s and t of length n (a binary string is a string which only consists of the characters \"0\" and \"1\"). He wants to convert s into t using the following operation as few times as possible.\n\... | [{"type": "stdin_stdout", "input": "12\n011001010101\n111001010101\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12\n011101010101\n101001010101\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "12\n011101010101\n111001010101\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "10\n1111100000\n11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\... | [{"type": "stdin_stdout", "input": "86451 754 85 84\n", "output": "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a matrix a consisting of positive integers. It has n rows and m columns.\n\nConstruct a matrix b consisting of positive integers. It should have the same size as a, and the following conditions should be met... | [{"type": "stdin_stdout", "input": "2 3\n16 16 11\n16 16 16\n", "output": "720720 786256 720720\n786256 720720 786256\n"}, {"type": "stdin_stdout", "input": "2 3\n12 16 16\n13 14 16\n", "output": "720720 786256 720720\n749281 720720 786256\n"}, {"type": "stdin_stdout", "input": "2 3\n16 16 15\n12 21 16\n", "output": "7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has recently bought some land and decided to surround it with a wooden fence.\n\nHe went to a company called \"Wooden board\" that produces wooden boards for fences. Vasya read in the catalog of products that the co... | [{"type": "stdin_stdout", "input": "100 3000\n1 4\n2 1\n3 3\n1 1\n5 4\n4 1\n2 1\n5 4\n1 1\n3 3\n4 3\n3 4\n4 2\n2 4\n1 2\n3 4\n5 3\n1 4\n2 4\n4 5\n1 2\n5 2\n2 2\n3 2\n4 4\n1 4\n5 5\n3 4\n4 1\n3 3\n5 2\n3 3\n4 1\n1 5\n4 3\n5 3\n4 2\n3 3\n3 5\n5 1\n5 1\n3 3\n4 3\n1 3\n4 1\n2 3\n1 3\n1 2\n5 5\n5 2\n1 5\n4 2\n1 1\n1 1\n1 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKirito is stuck on a level of the MMORPG he is playing now. To move on in the game, he's got to defeat all n dragons that live on this level. Kirito and the dragons have strength, which is represented by an integer. In th... | [{"type": "stdin_stdout", "input": "9983 34\n6626 5976\n4448 3568\n2794 2309\n3741 8806\n4754 129\n2780 9275\n5785 9243\n3915 6159\n2609 4331\n238 6756\n6987 3887\n3384 5711\n4349 5563\n1135 4483\n9151 1584\n1500 766\n1608 4440\n7768 5005\n7205 2360\n9088 2933\n3923 7814\n7538 9372\n7504 165\n5277 1636\n2061 4384\n7668... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera considers a number beautiful, if it equals 2k or -2k for some integer k (k β₯ 0). Recently, the math teacher asked Valera to represent number n as the sum of beautiful numbers. As Valera is really greedy, he wants t... | [{"type": "stdin_stdout", "input": "10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDo you remember how Kai constructed the word \"eternity\" using pieces of ice as components?\n\nLittle Sheldon plays with pieces of ice, each piece has exactly one digit between 0 and 9. He wants to construct his favourit... | [{"type": "stdin_stdout", "input": "2559\n52555995269265555695922255525995255259555259252562655622526292929555265526255252526255555296956995596262965522222225655655262255226222259622295225295525265995566255556225522559559295225625559595222652\n", "output": "48\n"}, {"type": "stdin_stdout", "input": "2569\n0962996596622... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nΒ«BersoftΒ» company is working on a new version of its most popular text editor β Bord 2010. Bord, like many other text editors, should be able to print out multipage documents. A user keys a sequence of the document page n... | [{"type": "stdin_stdout", "input": "713,572,318,890,577,657,646,146,373,783,392,229,455,871,20,593,573,336,26,381,280,916,907,732,820,713,111,840,570,446,184,711,481,399,788,647,492,15,40,530,549,506,719,782,126,20,778,996,712,761,9,74,812,418,488,175,103,585,900,3,604,521,509,513,145,708,990,361,682,827,791,22,596,780... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDZY loves planting, and he enjoys solving tree problems.\n\nDZY has a weighted tree (connected undirected graph without cycles) containing n nodes (they are numbered from 1 to n). He defines the function g(x, y) (1 β€ x, y... | [{"type": "stdin_stdout", "input": "10\n1 10 4313\n2 6 2842\n3 6 7059\n4 6 3007\n5 6 6195\n7 6 3962\n8 6 3413\n9 6 7658\n10 6 8049\n3\n3\n2\n1\n4\n4\n5\n2\n1\n1\n", "output": "7059\n"}, {"type": "stdin_stdout", "input": "10\n2 1 8760\n3 1 3705\n4 1 1862\n5 2 7332\n6 3 7015\n7 5 4866\n8 3 4465\n9 7 8886\n10 3 9362\n2\n5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGeorge has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory. \n\nGeorge and Alex want to live i... | [{"type": "stdin_stdout", "input": "100\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\n0 0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation is a sequence of integers from 1 to n of length n containing each number exactly once. For example, (1), (4, 3, 5, 1, 2), (3, 2, 1) are permutations, and (1, 1), (4, 3, 1), (2, 3, 4) are not. \n\nThere are m... | [{"type": "stdin_stdout", "input": "100\n9 6 3 28 10 2 2 11 2 1 25 3 13 5 14 13 4 14 2 16 12 27 8 1 7 9 8 19 33 23 4 1 15 6 7 12 2 8 30 4 1 31 6 1 15 5 18 3 2 24 7 3 1 20 10 8 26 22 3 3 9 6 1 10 1 5 1 3 7 6 11 10 1 16 19 5 9 4 4 4 2 18 12 21 11 5 2 32 17 29 2 4 8 1 7 5 3 2 17 1\n", "output": "12\n1 1 1 1 1 1 2 1 3 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting of n square cells (that is, on a 1 Γ n table).\n\nAt the beginning of the game Alice puts k ships on the fie... | [{"type": "stdin_stdout", "input": "50 1 1\n50\n1 13 21 37 30 48 23 19 6 49 36 14 9 24 44 10 41 28 20 2 15 11 45 3 25 33 50 38 35 47 31 4 12 46 32 8 42 26 5 7 27 16 29 43 39 22 17 34 40 18\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "50 7 3\n50\n17 47 1 12 21 25 6 5 49 27 34 8 16 38 11 44 48 9 2 20 3 22 33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how does the professor look like, at least. Danil was very bored on this lesson until the teacher gave the ... | [{"type": "stdin_stdout", "input": "8\n", "output": "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n+*+*+*+*+... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya started working in a machine vision company of IT City. Vasya's team creates software and hardware for identification of people by their face.\n\nOne of the project's know-how is a camera rotating around its optical... | [{"type": "stdin_stdout", "input": "-1315489005576995761\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "-1287027209222040878\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "-1503133216326740481\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "-1638150760258347909\n", "output": "1\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland has n cities connected by m bidirectional roads. No road connects a city to itself, and each pair of cities is connected by no more than one road. It is not guaranteed that you can get from any city to any other o... | [{"type": "stdin_stdout", "input": "10 45\n3 5\n2 3\n4 8\n2 5\n6 8\n10 7\n2 1\n3 7\n5 10\n6 1\n9 8\n3 1\n2 10\n6 7\n1 7\n7 9\n6 9\n9 3\n4 2\n2 6\n5 6\n5 8\n3 4\n10 8\n7 8\n4 6\n9 1\n5 5\n7 4\n1 10\n9 2\n2 8\n6 10\n9 8\n1 5\n7 2\n10 3\n3 8\n2 10\n1 1\n10 7\n1 3\n1 8\n10 2\n4 10\n", "output": "0\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSomeone gave Alyona an array containing n positive integers a1, a2, ..., an. In one operation, Alyona can choose any element of the array and decrease it, i.e. replace with any positive integer that is smaller than the cu... | [{"type": "stdin_stdout", "input": "10\n1 1 1 10000000 10000000 10000000 10000000 10000000 10000000 10000000\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 10000000 10000000 10000000 10000000 10000000 10000000 11000000\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "15\n1 2 2 20 23 25 28 60... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.\n\nHulk likes the Inception s... | [{"type": "stdin_stdout", "input": "100\n", "output": "I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I hate that I love that I... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe organizers of a programming contest have decided to present t-shirts to participants. There are six different t-shirts sizes in this problem: S, M, L, XL, XXL, XXXL (sizes are listed in increasing order). The t-shirts... | [{"type": "stdin_stdout", "input": "14 12 3 8 4 14\n30\nS,M\nS,M\nXL\nXXXL\nXXL,XXXL\nXXL,XXXL\nXXXL\nS,M\nXXL,XXXL\nM,L\nXXL\nXXL,XXXL\nXL,XXL\nL,XL\nXXL,XXXL\nM\nS,M\nXXXL\nXXL,XXXL\nXXL,XXXL\nM\nM,L\nS,M\nS,M\nXXL,XXXL\nXL,XXL\nXXL,XXXL\nXXL,XXXL\nS,M\nM,L\n", "output": "YES\nS\nS\nXL\nXXXL\nXXL\nXXL\nXXXL\nS\nXXL\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInzane finally found Zane with a lot of money to spare, so they together decided to establish a country of their own.\n\nRuling a country is not an easy job. Thieves and terrorists are always ready to ruin the country's p... | [{"type": "stdin_stdout", "input": "11 1 5\n6\n1 2\n2 3\n3 4\n4 5\n5 6\n6 11\n7 8\n8 9\n9 10\n10 11\n", "output": "0\n\n"}, {"type": "stdin_stdout", "input": "11 1 5\n6\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n10 11\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10 1 5\n5\n1 2\n1 3\n1 4\n1 5\n10 6\n10 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation p of size n is an array such that every integer from 1 to n occurs exactly once in this array.\n\nLet's call a permutation an almost identity permutation iff there exist at least n - k indices i (1 β€ i β€ n) ... | [{"type": "stdin_stdout", "input": "1000 4\n", "output": "373086956251\n"}, {"type": "stdin_stdout", "input": "800 4\n", "output": "152620985001\n"}, {"type": "stdin_stdout", "input": "792 4\n", "output": "146597632567\n"}, {"type": "stdin_stdout", "input": "850 4\n", "output": "194577888126\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter the Tatvik Hiring Challenge, Karan's NLP professor has given him another homework. Since Manhattan Associates Hiring Challenge is round the corner and Karan is busy preparing for it, he turns to you for help.\n\nGiv... | [{"type": "stdin_stdout", "input": "10\n`abbccdkkeffgxhhiijjdellmmnnooqpqprrstttuvuvwxxfyyzz\naaaabaaaaaaaaaaa`aaaaaaaaaaaab`aaabaaaabaa\nabcdefghijrlmnopqkstuvwxyz\n-..............................aaaaaa`aaaaaabaaaaaaba\n,........a..........,,,,+,.,,,,,,,,,,,,,,aaaaaaaab.aba\nwwwlllllllllmklvwvvvuvuvvkkkkkkkkkkkkdddddd... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA young mischievous boy Harsh, got into a trouble when his mechanical workshop teacher\ntold him to cut Iron rods.\nThe rod cutting algorithm is as follows:\n\nStep 1. If the rod can be divided into two equal parts, cut ... | [{"type": "stdin_stdout", "input": "1000\n637440000\n497933618\n104308126\n54379600\n735895362\n146758511\n172457069\n786824866\n792402682\n2932951\n280042089\n190772473\n647479785\n613419369\n465129597\n173755079\n611820068\n311399952\n18559\n244257083\n243465884\n889140268\n511454427\n656283414\n5014973\n74313994\n43... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have three boxes A, B, and C, each of which contains an integer.\nCurrently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.\nWe will now do the operations below in order. Find the content of each... | [{"type": "stdin_stdout", "input": "111 110 110", "output": "110 111 110\n"}, {"type": "stdin_stdout", "input": "110 110 110", "output": "110 110 110\n"}, {"type": "stdin_stdout", "input": "110 110 111", "output": "111 110 110\n"}, {"type": "stdin_stdout", "input": "100 100 100", "output": "100 100 100"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi and Aoki are training for long-distance races in an infinitely long straight course running from west to east.\n\nThey start simultaneously at the same point and moves as follows towards the east:\n\n* Takahashi... | [{"type": "stdin_stdout", "input": "30901 15700\n2647944172 11366428589\n5864465524 4464634034", "output": "23\n"}, {"type": "stdin_stdout", "input": "12000 15700\n3390000000 3810000000\n5550000000 2130000000", "output": "113"}, {"type": "stdin_stdout", "input": "30901 15700\n8541952587 11366428589\n5864465524 44646340... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two non-negative integers L and R. We will choose two integers i and j such that L \\leq i < j \\leq R. Find the minimum possible value of (i \\times j) \\mbox{ mod } 2019.\n\nConstraints\n\n* All values in ... | [{"type": "stdin_stdout", "input": "2020 3053", "output": "0\n"}, {"type": "stdin_stdout", "input": "2845 3053", "output": "1\n"}, {"type": "stdin_stdout", "input": "1022 3053", "output": "0\n"}, {"type": "stdin_stdout", "input": "1022 2650", "output": "0\n"}, {"type": "stdin_stdout", "input": "1022 4340", "output": "0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given positive integers A and B.\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nConstraints\n\n* All values in input are integers.\n* 1 \\leq A \\leq B \\leq 20\n\nInput\n\nInput is given from ... | [{"type": "stdin_stdout", "input": "10 111", "output": "101\n"}, {"type": "stdin_stdout", "input": "110 40", "output": "-70\n"}, {"type": "stdin_stdout", "input": "111 40", "output": "-71\n"}, {"type": "stdin_stdout", "input": "111 62", "output": "-49\n"}, {"type": "stdin_stdout", "input": "111 68", "output": "-43\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N people. The name of the i-th person is S_i.\n\nWe would like to choose three people so that the following conditions are met:\n\n* The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`.\n* Ther... | [{"type": "stdin_stdout", "input": "5\nMASHIKE\nRUMOI\nOBIRA\nOROBAH\nHOROKANAI", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\nMASHIKE\nIOMUR\nOBIRA\nOROBAH\nHOROKANAI", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\nMASHIKE\nIOMUR\nARIBO\nOROBAH\nHOROKANAI", "output": "1\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAoki is in search of Takahashi, who is missing in a one-dimentional world. Initially, the coordinate of Aoki is 0, and the coordinate of Takahashi is known to be x, but his coordinate afterwards cannot be known to Aoki.\n... | [{"type": "stdin_stdout", "input": "101\n-1", "output": "-5100.000000000000\n"}, {"type": "stdin_stdout", "input": "101\n-2", "output": "-2550.000000000000\n"}, {"type": "stdin_stdout", "input": "101\n141", "output": "36.170212765957\n"}, {"type": "stdin_stdout", "input": "101\n233", "output": "21.888412017167\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week.\n\nWrite ... | [{"type": "stdin_stdout", "input": "291", "output": "158467928000\n"}, {"type": "stdin_stdout", "input": "188", "output": "1040975000\n"}, {"type": "stdin_stdout", "input": "214", "output": "3701387000\n"}, {"type": "stdin_stdout", "input": "190", "output": "1147676000\n"}, {"type": "stdin_stdout", "input": "143", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday is the ticket release date for Aizu Entertainment's recommended idol group \"Akabeko & Koboushi\". There are four types of tickets:\n\nS seat 6000 yen\nA seat 4000 yen\nB seat 3000 yen\nC seat 2000 yen\n\nYou, the s... | [{"type": "stdin_stdout", "input": "3 57\n1 4\n1 -2\n1 2", "output": "171000\n24000\n-12000\n12000\n"}, {"type": "stdin_stdout", "input": "3 57\n1 3\n1 -2\n1 2", "output": "171000\n18000\n-12000\n12000\n"}, {"type": "stdin_stdout", "input": "3 16\n1 4\n1 -2\n1 5", "output": "48000\n24000\n-12000\n30000\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Dango's family has an extremely huge number of members. Once it had about 100 members, and now it has as many as population of a city. It is jokingly guessed that the member might fill this planet in the near future.\... | [{"type": "stdin_stdout", "input": "12 2\n0 2 2\n0 2 2\n2 1\n0 1 100\n2 1\n0 1 -1\n2 1\n0 1 -1\n0 0", "output": "0\n100\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "3 2\n0 2 2\n0 2 1\n2 1\n0 1 100\n2 1\n0 1 -1\n2 1\n0 1 -1\n0 0", "output": "0\n100\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "3 2\n1 2 2\n0 2 1\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-... | [{"type": "stdin_stdout", "input": "5 35\n.a....a....a....a....f....f....f...\nbc#.#cd#.#de#.#eb#.#cb#.#dc#.#ed#.\n.#..f.#....#....#....#....#....#...\n..e##..............................\n.b#................................", "output": "Yes"}, {"type": "stdin_stdout", "input": "5 60\n.a....a....a....a....f....f....f..... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's solve the geometric problem\n\nMr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.\n\nFloating-point error is the error caused by th... | [{"type": "stdin_stdout", "input": "128 205", "output": "205\n"}, {"type": "stdin_stdout", "input": "110 161", "output": "161\n"}, {"type": "stdin_stdout", "input": "13 204", "output": "102\n"}, {"type": "stdin_stdout", "input": "11 251", "output": "251\n"}, {"type": "stdin_stdout", "input": "10 103", "output": "103\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ candy boxes in front of Tania. The boxes are arranged in a row from left to right, numbered from $1$ to $n$. The $i$-th box contains $r_i$ candies, candies have the color $c_i$ (the color can take one of thr... | [{"type": "stdin_stdout", "input": "50 49 1000\n30 37 34 31 26 44 32 12 36 15 5 5 31 24 17 24 43 19 17 23 45 2 24 17 23 48 20 44 46 44 13 4 29 49 33 41 14 25 46 43 7 47 28 25 2 30 37 37 19 32\nGBBBRBGRBRBRGRGRBBGBGRRBGGRBGRBRRRRRRRBRGRGGGGBRGG\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "50 37 500\n25 43 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe number obtained by multiplying 1 by 2, 3, 5 several times (0 or more times) is called the Hamming numbers. For example\n\n* 1\n* 1 x 2 x 2 = 4\n* 1 x 2 x 2 x 3 x 5 x 5 = 300\n\n\n\nEtc. are humming numbers, but 11, 13... | [{"type": "stdin_stdout", "input": "3 16\n2 35\n1 140\n0", "output": "10\n18\n39\n"}, {"type": "stdin_stdout", "input": "6 16\n2 35\n1 140\n0", "output": "7\n18\n39\n"}, {"type": "stdin_stdout", "input": "6 9\n10 36\n1 172\n0", "output": "3\n12\n43\n"}, {"type": "stdin_stdout", "input": "3 8\n2 27\n1 140\n0", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all.\n\nAnvils come in different siz... | [{"type": "stdin_stdout", "input": "90\n1 1\n2 1\n3 1\n4 1\n5 1\n6 1\n7 1\n8 1\n9 1\n1 2\n2 2\n3 2\n4 2\n5 2\n6 2\n7 2\n8 2\n9 2\n1 3\n2 3\n3 3\n4 3\n5 3\n6 3\n7 3\n8 3\n9 3\n1 4\n2 4\n3 4\n4 4\n5 4\n6 4\n7 4\n8 4\n9 4\n1 5\n2 5\n3 5\n4 5\n5 5\n6 5\n7 5\n8 5\n9 5\n1 6\n2 6\n3 6\n4 6\n5 6\n6 6\n7 6\n8 6\n9 6\n1 7\n2 7\n... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.