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 integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same... | [{"type": "stdin_stdout", "input": "150607 162", "output": "1606122089\n"}, {"type": "stdin_stdout", "input": "101525 92", "output": "2687492591\n"}, {"type": "stdin_stdout", "input": "101525 162", "output": "491806259\n"}, {"type": "stdin_stdout", "input": "35897 92", "output": "118638000\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSquare1001 has seen an electric bulletin board displaying the integer 1.\nHe can perform the following operations A and B to change this value:\n - Operation A: The displayed value is doubled.\n - Operation B: The display... | [{"type": "stdin_stdout", "input": "10\n-32", "output": "-16128\n"}, {"type": "stdin_stdout", "input": "10\n-23", "output": "-11520\n"}, {"type": "stdin_stdout", "input": "10\n-37", "output": "-18688\n"}, {"type": "stdin_stdout", "input": "10\n-42", "output": "-21248\n"}, {"type": "stdin_stdout", "input": "10\n-33", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDZY loves Physics, and he enjoys calculating density.\n\nAlmost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of the graph have some values) as follows: \n\n<image> w... | [{"type": "stdin_stdout", "input": "20 20\n265918 744212 196368 74731 293587 679367 460805 632939 453630 565881 835276 606327 181087 721045 219431 849838 370939 582350 335676 32244\n2 16 989\n14 19 628\n1 9 483\n5 8 733\n13 19 556\n10 17 911\n1 7 599\n13 17 390\n10 20 965\n17 11 449\n3 15 310\n3 6 557\n14 18 225\n1 18 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty substring of s and shift all its letters 'z' $\\rightarrow$ 'y' $\\rightarrow$ 'x' $\\rightarrow \\ldots \... | [{"type": "stdin_stdout", "input": "abbbbbbbabbbbbbbbbbbbbbbbbbbbbbbabbabbbbbabbbbbbbbbbbabbbbbbbbabbabbbbbbbbbbbbbbabbabbbaababbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbbbbbbbbabbbbabbbbbbbbbbbbbbbabbbbbbbbbaababbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbbbbbbbbabbbabbbbbaabbabbbbbbbbb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday, Chef woke up to find that he had no clean socks. Doing laundry is such a turn-off for Chef, that in such a situation, he always buys new socks instead of cleaning the old dirty ones. He arrived at the fashion store... | [{"type": "stdin_stdout", "input": "1 2 3\n\n\n", "output": "Unlucky Chef\n"}, {"type": "stdin_stdout", "input": "-1 4 14", "output": "Unlucky Chef\n"}, {"type": "stdin_stdout", "input": "1 2 6\n\n\n", "output": "Lucky Chef\n"}, {"type": "stdin_stdout", "input": "1 2 11", "output": "Unlucky Chef\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 Γ n in size, when viewed from above. This rectangle is divided into n equal s... | [{"type": "stdin_stdout", "input": "100\n1 2 3 7 5 6 10 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 30 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 1 82 83 84 85 86 87 88 89 90 91 92 93 94 100 5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.\n\nIn total, Nastya dropped $n$ grains. Nastya read that each grain wei... | [{"type": "stdin_stdout", "input": "5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1\n", "output": "Yes\nNo\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1\n", "output": "Yes\nNo\nYes\nNo\nYes\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Happy Farm 5 creators decided to invent the mechanism of cow grazing. The cows in the game are very slow and they move very slowly, it can even be considered that they stand still. However, carnivores should always be... | [{"type": "stdin_stdout", "input": "60\n-20 179\n-68 0\n-110 68\n-22 177\n47 140\n-49 -4\n-106 38\n-23 22\n20 193\n47 173\n-23 22\n-100 32\n-97 29\n47 124\n-49 -4\n20 193\n-20 179\n-50 149\n-59 -7\n4 193\n-23 22\n-97 29\n-23 22\n-66 133\n47 167\n-61 138\n-49 -4\n-91 108\n-110 84\n47 166\n-110 77\n-99 100\n-23 22\n-59 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoder Inc. holds a contest every Saturday.\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\nThe company holds these two types of contests alternately: an ARC follows an ABC a... | [{"type": "stdin_stdout", "input": "ABC\n", "output": "ARC\n"}, {"type": "stdin_stdout", "input": "ARC\n", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "ARC\n", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "ARC\n", "output": "ABC\n"}, {"type": "stdin_stdout", "input": "ABC", "output": "ARC"}] | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive ch... | [{"type": "stdin_stdout", "input": "sakahashi", "output": "sak\n"}, {"type": "stdin_stdout", "input": "sbkahashi", "output": "sbk\n"}, {"type": "stdin_stdout", "input": "ihsahakbs", "output": "ihs\n"}, {"type": "stdin_stdout", "input": "hhsaiakbr", "output": "hhs\n"}, {"type": "stdin_stdout", "input": "rbkaiashh", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut found a string $s$. The string consists of lowercase Latin letters. The Nut is a curious guy, so he wants to find the number of strictly increasing sequences $p_1, p_2, \\ldots, p_k$, such that: For each $i... | [{"type": "stdin_stdout", "input": "babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab\n", "output": "813881762\n"}, {"type": "stdin_stdout", "input": "babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabbaaabaaaaababaaaabaaab\n", "output": "45... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$N$ persons visited a restaurant. The restaurant is open from 0 to $T$. The $i$-th person entered the restaurant at $l_i$ and left at $r_i$. Find the maximum number of persons during the business hours.\n\nConstraints\n\n... | [{"type": "stdin_stdout", "input": "0 12\n1 -1\n1 4\n0 8\n0 11\n6 19\n7 21", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 12\n0 -1\n1 4\n0 8\n0 11\n6 19\n7 21", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 12\n1 0\n1 14\n0 0\n0 11\n6 19\n7 32", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen Darth Vader gets bored, he sits down on the sofa, closes his eyes and thinks of an infinite rooted tree where each node has exactly n sons, at that for each node, the distance between it an its i-th left child equals... | [{"type": "stdin_stdout", "input": "97 78153\n2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2\n", "output": "620983468\n"}, {"type": "stdin_stdout", "input": "97 78153\n2 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation of 1,2,...,N: p_1,p_2,...,p_N. Determine if the state where p_i=i for every i can be reached by performing the following operation any number of times:\n - Choose three elements p_{i-1},p_{i},p... | [{"type": "stdin_stdout", "input": "7\n3\n2\n1\n6\n5\n4\n7\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "7\n4\n2\n1\n6\n5\n4\n14", "output": "No\n"}, {"type": "stdin_stdout", "input": "7\n4\n2\n1\n11\n5\n4\n7", "output": "No\n"}, {"type": "stdin_stdout", "input": "7\n4\n2\n1\n6\n5\n4\n7", "output": "No\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are playing a fun game of tree tag.\n\nThe game is played on a tree of $n$ vertices numbered from $1$ to $n$. Recall that a tree on $n$ vertices is an undirected, connected graph with $n-1$ edges.\n\nInitial... | [{"type": "stdin_stdout", "input": "10\n10 9 10 6 6\n6 1\n7 6\n4 2\n6 10\n5 1\n9 5\n6 8\n3 4\n4 10\n2 1 2 1 1\n2 1\n9 7 4 2 3\n5 1\n2 4\n4 8\n8 6\n8 9\n7 8\n1 8\n1 3\n11 1 11 6 8\n1 10\n6 11\n8 2\n11 3\n1 7\n11 4\n5 8\n11 7\n1 9\n1 8\n5 3 2 1 1\n3 1\n2 1\n4 5\n1 5\n2 1 2 1 1\n2 1\n2 2 1 1 1\n2 1\n2 2 1 1 1\n1 2\n2 2 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBizon the Champion is called the Champion for a reason. \n\nBizon the Champion has recently got a present β a new glass cupboard with n shelves and he decided to put all his presents there. All the presents can be divided... | [{"type": "stdin_stdout", "input": "100 100 100\n100 100 100\n100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 100 100\n100 100 100\n100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 100 100\n101 100 100\n100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 100 000\n101 ... | 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": "WBWBWBWBWB\n", "output": "9\n"}, {"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", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the minimum prime number greater than or equal to X.\n\n-----Notes-----\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\nFor example, 2, 3, and ... | [{"type": "stdin_stdout", "input": "100000\n", "output": "100003\n"}, {"type": "stdin_stdout", "input": "99992\n", "output": "100003\n"}, {"type": "stdin_stdout", "input": "64993\n", "output": "64997\n"}, {"type": "stdin_stdout", "input": "90371\n", "output": "90371\n"}, {"type": "stdin_stdout", "input": "92227\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCalculate the value of the sum: n mod 1 + n mod 2 + n mod 3 + ... + n mod m. As the result can be very large, you should print the value modulo 10^9 + 7 (the remainder when divided by 10^9 + 7).\n\nThe modulo operator a m... | [{"type": "stdin_stdout", "input": "10000000000000 10000000000000\n", "output": "869957328\n"}, {"type": "stdin_stdout", "input": "10000000000000 10000000000000\n", "output": "869957328\n"}, {"type": "stdin_stdout", "input": "7244641009859 6300054748096\n", "output": "955368330\n"}, {"type": "stdin_stdout", "input": "3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk.\n\nUnfortunately, internet is not that f... | [{"type": "stdin_stdout", "input": "100000 99999 4\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000 1 10000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "10028 13 10000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "100000 99999 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two popular keyboard layouts in Berland, they differ only in letters positions. All the other keys are the same. In Berland they use alphabet with 26 letters which coincides with English alphabet.\n\nYou are giv... | [{"type": "stdin_stdout", "input": "buneohqdgxjsafrmwtzickvlpy\nzblwamjxifyuqtnrgdkchpoves\n4RZf8YivG6414X1GdDfcCbc10GA0Wz8514LI9D647XzPb66UNh7lX1rDQv0hQvJ7aqhyh1Z39yABGKn24g185Y85ER5q9UqPFaQ2JeK97wHZ78CMSuU8Zf091mePl2OX61BLe5KdmUWodt4BXPiseOZkZ4SZ27qtBM4hT499mCirjy6nB0ZqjQie4Wr3uhW2mGqBlHyEZbW7A6QnsNX9d3j5aHQN0H6GF8J0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMany students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. \n\nThere is only one shower and there are multiple students who wish to have a sho... | [{"type": "stdin_stdout", "input": "0 14299 32984 96001 30445\n77723 0 75669 14101 55389\n30897 17295 0 52675 29987\n36518 108118 11343 0 64020\n91242 50085 86272 62454 0\n", "output": "747422\n"}, {"type": "stdin_stdout", "input": "0 14299 32984 96001 30445\n77723 0 75669 14101 55389\n30897 17295 0 52675 29987\n36518 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's solve the puzzle by programming.\n\nThe numbers n x n are arranged in a grid pattern. Some of the numbers are circled and we will call them the starting point. The rules of the puzzle are as follows:\n\n* Draw one l... | [{"type": "stdin_stdout", "input": "3\n-3 1 1\n2 -4 1\n2 1 -1\n3\n-2 1 1\n1 0 -6\n1 -5 3\n4\n-8 11 -2 1\n2 -7 -2 2\n1 -1 1 2\n1 1 1 -1\n6\n2 0 3 -7 0 2\n1 -10 1 1 4 2\n2 10 5 2 -6 0\n2 4 -23 2 1 8\n3 3 -8 2 3 7\n-7 2 5 2 -3 -18\n6\n3 2 3 -7 1 2\n1 -10 1 0 3 2\n2 6 5 0 -6 1\n0 4 -23 2 2 5\n4 3 -2 2 3 5\n-7 2 4 1 -5 -12\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSasha and Ira are two best friends. But they arenβt just friends, they are software engineers and experts in artificial intelligence. They are developing an algorithm for two bots playing a two-player game. The game is co... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "627314155\n"}, {"type": "stdin_stdout", "input": "1000000\n", "output": "627314155\n"}, {"type": "stdin_stdout", "input": "999999\n", "output": "192151599\n"}, {"type": "stdin_stdout", "input": "524287\n", "output": "295397547\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's finally summer in Chefland! So our chef is looking forward to prepare some of the best \"beat-the-heat\" dishes to attract more customers. He summons the Wizard of Dessert to help him with one such dish.\nThe wizard ... | [{"type": "stdin_stdout", "input": "2\n5\n1 -1 0 1 10\n4\n2 1 -2 -1", "output": "12\n6\n"}, {"type": "stdin_stdout", "input": "2\n5\n0 0 3 10 5\n4\n4 1 0 -5", "output": "18\n10\n"}, {"type": "stdin_stdout", "input": "2\n5\n1 2 3 11 10\n4\n2 1 0 -1", "output": "25\n4\n"}, {"type": "stdin_stdout", "input": "2\n5\n1 2 3 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an Amidakuji that consists of w vertical bars and has a height (the number of steps to which horizontal bars can be added) of h. w is an even number. Of the candidates for the place to add the horizontal bar of t... | [{"type": "stdin_stdout", "input": "10 8 10\n10 4\n4 4\n5 1\n6 2\n3 3\n1 3\n2 4\n8 2\n7 5\n7 1", "output": "1\n2\n3\n7\n8\n5\n4\n6\n"}, {"type": "stdin_stdout", "input": "10 6 10\n10 4\n4 4\n5 1\n4 2\n7 3\n1 3\n2 4\n8 2\n3 5\n7 1", "output": "1\n4\n3\n5\n6\n2\n"}, {"type": "stdin_stdout", "input": "10 6 10\n10 4\n4 4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two arithmetic progressions: a_1k + b_1 and a_2l + b_2. Find the number of integers x such that L β€ x β€ R and x = a_1k' + b_1 = a_2l' + b_2, for some integers k', l' β₯ 0.\n\n\n-----Input-----\n\nThe only lin... | [{"type": "stdin_stdout", "input": "1789433851 -633540112 1286318222 -1728151682 1438333624 1538194890\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1789433851 -633540112 1286318222 -1728151682 1438333624 1538194890\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1955378240 -837482305 1743607821 -16... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence $a_1, a_2, \\dots, a_n$, consisting of integers.\n\nYou can apply the following operation to this sequence: choose some integer $x$ and move all elements equal to $x$ either to the beginning, or t... | [{"type": "stdin_stdout", "input": "3\n7\n3 1 6 6 3 1 1\n8\n1 1 4 4 4 7 8 8\n7\n4 2 5 2 6 2 7\n", "output": "2\n0\n1\n"}, {"type": "stdin_stdout", "input": "3\n7\n3 1 6 6 3 1 1\n8\n1 1 4 4 4 7 8 8\n7\n4 2 5 2 6 2 5\n", "output": "2\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\n7\n3 1 6 6 3 1 1\n8\n1 1 4 4 4 7 8 8\n7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is th... | [{"type": "stdin_stdout", "input": "1000 1000 1000\n", "output": "655056222.989098310000"}, {"type": "stdin_stdout", "input": "999 997 998\n", "output": "650782658.915145640000"}, {"type": "stdin_stdout", "input": "709 328 709\n", "output": "157775455.683012100000"}, {"type": "stdin_stdout", "input": "982 948 879\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nScreen resolution of Polycarp's monitor is $a \\times b$ pixels. Unfortunately, there is one dead pixel at his screen. It has coordinates $(x, y)$ ($0 \\le x < a, 0 \\le y < b$). You can consider columns of pixels to be n... | [{"type": "stdin_stdout", "input": "6\n8 8 0 0\n1 11 0 3\n17 10 10 4\n2 4 0 0\n4 10 3 9\n15 18 3 12\n", "output": "56\n7\n100\n6\n36\n198\n"}, {"type": "stdin_stdout", "input": "6\n8 8 0 0\n1 11 0 3\n17 10 10 4\n2 4 0 0\n4 10 3 6\n15 18 3 12\n", "output": "56\n7\n100\n6\n30\n198\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree (an undirected connected acyclic graph) consisting of $n$ vertices and $n - 1$ edges. A number is written on each edge, each number is either $0$ (let's call such edges $0$-edges) or $1$ (those are $1... | [{"type": "stdin_stdout", "input": "7\n2 1 1\n3 2 0\n4 2 1\n5 2 0\n6 7 1\n7 2 1\n", "output": "34\n"}, {"type": "stdin_stdout", "input": "7\n2 1 1\n3 2 0\n4 2 1\n5 4 0\n6 7 1\n7 2 1\n", "output": "32\n"}, {"type": "stdin_stdout", "input": "7\n2 1 1\n3 2 1\n4 2 1\n5 2 0\n6 7 1\n7 2 1\n", "output": "37\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds. In each round, Andrew and Jerry draw randomly without replacement from a jar containing n balls, each labeled with a di... | [{"type": "stdin_stdout", "input": "20\n11 37 81 56 61 2 26 27 59 69 24 7 71 76 45 54 89 17 95 20\n", "output": "0.1931218837\n"}, {"type": "stdin_stdout", "input": "20\n12 37 81 56 61 2 26 27 59 69 24 7 71 76 45 54 89 17 95 20\n", "output": "0.1930989940\n"}, {"type": "stdin_stdout", "input": "20\n12 37 81 56 61 2 36 ... | code_stdio |
[
{
"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\nThe fearless Ikta has finally hunted down the infamous Count Big Bridge! Count Bigbridge is now trapped in a rectangular room w meters wide and h meters deep, waiting for his end.\n\nIf you select a corner of the room and... | [{"type": "stdin_stdout", "input": "1 3 1000 1000 1 0 0 4", "output": "1047197552288\n"}, {"type": "stdin_stdout", "input": "1 2 1000 1000 1 0 0 4", "output": "1570796325024\n"}, {"type": "stdin_stdout", "input": "1 3 1000 1000 0 0 0 4", "output": "1047197542296\n"}, {"type": "stdin_stdout", "input": "1 3 1001 1000 1 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe circle line of the Roflanpolis subway has $n$ stations.\n\nThere are two parallel routes in the subway. The first one visits stations in order $1 \\to 2 \\to \\ldots \\to n \\to 1 \\to 2 \\to \\ldots$ (so the next sto... | [{"type": "stdin_stdout", "input": "100 26 63 60 23\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 26 63 60 20\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 26 77 60 20\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 45 77 77 20\n", "output": "YES\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOrac is studying number theory, and he is interested in the properties of divisors.\n\nFor two positive integers $a$ and $b$, $a$ is a divisor of $b$ if and only if there exists an integer $c$, such that $a\\cdot c=b$.\n\... | [{"type": "stdin_stdout", "input": "5\n497347 19283\n2568 1000000000\n499979 123987\n93 19\n13 5\n", "output": "536584\n2000002568\n1247930\n132\n34\n"}, {"type": "stdin_stdout", "input": "5\n497347 19283\n2568 1000000000\n499979 123987\n93 19\n13 5\n", "output": "536584\n2000002568\n1247930\n132\n34\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nYou can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png)\n\nInput\n\nThe only line of the input is a... | [{"type": "stdin_stdout", "input": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\n", "output": "-1300\n"}, {"type": "stdin_stdout", "input": "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzyzzzzzzzzzzzzzzzzzz\n", "output": "-1299\n"}, {"type": "stdin_stdout", "input": "zzzzzzyzzzzzzzzzzzzzzzzzzzzzzzzyzzzzzzzzzzzzzzzzzz\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGrigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.\n\nEmbosser is a special devise th... | [{"type": "stdin_stdout", "input": "dqcpcobpcobnznamznamzlykxkxlxlylzmaobnaobpbnanbpcoaobnboaoboanzlymzmykylymylzlylymanboanaocqdqesfrfs\n", "output": "1236\n"}, {"type": "stdin_stdout", "input": "uhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuh\n", "output": "1293\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it w... | [{"type": "stdin_stdout", "input": "29 -999961 689169\n-999960 689169\n-999927 -938525\n-999735 -989464\n-993714 -997911\n-870186 -999686\n-796253 -999950\n-139940 -999968\n969552 -999972\n985446 -999398\n992690 -997295\n999706 -973137\n999898 -848630\n999997 -192297\n999969 773408\n999495 960350\n999143 981671\n998324... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNastya received one more array on her birthday, this array can be used to play a traditional Byteland game on it. However, to play the game the players should first select such a subsegment of the array that $\\frac{p}{s}... | [{"type": "stdin_stdout", "input": "94 58\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 29 58 1 1 1 29 58 58 1 1 29 1 1 1 1 2 1 58 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 29 1 1 1 1 1 58 1 29 1 1 1 1 1 1 1 1 1 1 1 1 58 1 1 1 1 1 2 1 1 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "94 58\n1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTonight is brain dinner night and all zombies will gather together to scarf down some delicious brains. The artful Heidi plans to crash the party, incognito, disguised as one of them. Her objective is to get away with at ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "1001000000\n", "output": "500500000\n"}, {"type": "stdin_stdout", "input": "1393488002\n", "output": "696744001\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe administration of the Tomsk Region firmly believes that it's time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decided to achieve its goal by expa... | [{"type": "stdin_stdout", "input": "30 505231\n-18 16 88130\n-10 16 15693\n16 -32 660\n-27 17 19042\n30 -37 6680\n36 19 299674\n-45 21 3300\n11 27 76\n-49 -34 28649\n-1 11 31401\n25 42 20858\n-40 6 455660\n-29 43 105001\n-38 10 6042\n19 -45 65551\n20 -9 148533\n-5 -24 393442\n-43 2 8577\n-39 18 97059\n12 28 39189\n35 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSince most contestants do not read this part, I have to repeat that Bitlandians are quite weird. They have their own jobs, their own working method, their own lives, their own sausages and their own games!\n\nSince you ar... | [{"type": "stdin_stdout", "input": "3\n184 222 102\n", "output": "BitAryo\n"}, {"type": "stdin_stdout", "input": "3\n101 186 223\n", "output": "BitAryo\n"}, {"type": "stdin_stdout", "input": "3\n101 186 223\n", "output": "BitAryo\n"}, {"type": "stdin_stdout", "input": "3\n184 222 102\n", "output": "BitAryo\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA non-empty string is called palindrome, if it reads the same from the left to the right and from the right to the left. For example, \"abcba\", \"a\", and \"abba\" are palindromes, while \"abab\" and \"xy\" are not.\n\nA... | [{"type": "stdin_stdout", "input": "21\narozauprlanalapuazoaa\n", "output": "aaaaaaaallnoopprruuzz\n"}, {"type": "stdin_stdout", "input": "21\narozbuprlanalapuazoaa\n", "output": "aaaaaaabllnoopprruuzz\n"}, {"type": "stdin_stdout", "input": "21\narozbuarlpnalapuayoaa\n", "output": "aaaaaaabllnoopprruuyz\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a 32-bit real type with 7 bits from the right as the decimal part, the following 24 bits as the integer part, and the leftmost 1 bit as the sign part as shown below (b1, ..., b32). Represents 0 or 1).\n\n<image>\... | [{"type": "stdin_stdout", "input": "8\n00101110\n66920828\n00000080\n00000040\n000000c0\n00100110\n45306216\n07f00009", "output": "8226.125\n13444112.3125\n1.0\n0.5\n1.5\n8194.125\n9068740.171875\n1040384.0703125\n"}, {"type": "stdin_stdout", "input": "8\n00100100\n45780507\n00000080\n00000040\n0c000000\n00000101\n1533... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce a Mathematician was trapped by military people during a world war with his forty colleagues. The colleagues were without any weapons, only the mathematician had a knife. And with no weapons they were not able to figh... | [{"type": "stdin_stdout", "input": "952\n2320756\n29322199\n69962176\n35597905\n77503600\n16044585\n78680494\n87353756\n46901578\n54533600\n56732835\n52356252\n3139727\n67375042\n39918429\n47546657\n55270670\n75055313\n37482942\n4607646\n3592454\n42195046\n6958164\n92680150\n74100365\n67455070\n78497675\n79514245\n3736... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3\n()(()((\n))()()(()\n)())(())\n\n\nOutput\n\nYes\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Python code to solve ... | [{"type": "stdin_stdout", "input": "3\n()(()((\n))()(((()\n)())(())", "output": "No\n"}, {"type": "stdin_stdout", "input": "3\n()(()((\n))()(((()\n))(())()", "output": "No\n"}, {"type": "stdin_stdout", "input": "3\n()(()((\n))()(((()\n)())((*)", "output": "No\n"}, {"type": "stdin_stdout", "input": "3\n()(()((\n))()((((... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a number $n$ (divisible by $3$) and an array $a[1 \\dots n]$. In one move, you can increase any of the array elements by one. Formally, you choose the index $i$ ($1 \\le i \\le n$) and replace $a_i$ with $a_... | [{"type": "stdin_stdout", "input": "4\n6\n0 2 5 5 4 1\n6\n2 0 2 0 0 0\n9\n14 1 3 4 2 10 3 1 12\n6\n1 1 2 3 4 5\n", "output": "1\n2\n1\n2\n"}, {"type": "stdin_stdout", "input": "4\n6\n0 2 1 4 4 1\n6\n0 0 2 1 0 0\n9\n7 1 3 0 2 12 2 13 5\n6\n1 0 2 10 1 8\n", "output": "3\n3\n0\n2\n"}, {"type": "stdin_stdout", "input": "4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nAn equation is an equality containing one or more variables. Solving the equation consists of determining which values of the variables make the equali... | [{"type": "stdin_stdout", "input": "2\n3\n20 4 14\n4\n15 72 -1 12", "output": "-1 15 5\n17 -40 33 20\n"}, {"type": "stdin_stdout", "input": "2\n3\n20 4 14\n4\n15 72 -1 8", "output": "-1 15 5\n16 -41 32 23\n"}, {"type": "stdin_stdout", "input": "2\n3\n20 4 14\n4\n4 72 -1 12", "output": "-1 15 5\n25 -43 30 17\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a very long bench. The bench is divided into M sections, where M is a very large integer.\n\nInitially, the bench is vacant. Then, M people come to the bench one by one, and perform the following action:\n\n* We ... | [{"type": "stdin_stdout", "input": "100\n-X-X-X--X-X--X--X-X--X-X-X--X-X-X--X--X-X-X-X--X--X-X-X-X-X-X-X-X-X-X-X-X-X-X-X--X-X-X-X-X-X-X-X-X-X", "output": "0 0 435664291\n"}, {"type": "stdin_stdout", "input": "100\nX-X-X-X-X-X-X-X-X-X--X-X-X-X-X-X-X-X-X-X-X-X-X-X-X--X--X-X-X-X--X--X-X-X--X-X-X--X-X--X--X-X--X-X-X-", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[Chopsticks (singular: chopstick) are short, frequently tapered sticks used in pairs of equal length, which are used as the traditional eating utensils of China, Japan, Korea and Vietnam. Originated in ancient China, they... | [{"type": "stdin_stdout", "input": "5 3\n13\n-2\n3\n9\n1", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 3\n13\n-3\n3\n9\n1", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 3\n13\n-3\n3\n1\n1", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 4\n17\n-1\n3\n9\n2", "output": "1\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter defeating a Blacklist Rival, you get a chance to draw $1$ reward slip out of $x$ hidden valid slips. Initially, $x=3$ and these hidden valid slips are Cash Slip, Impound Strike Release Marker and Pink Slip of Rival'... | [{"type": "stdin_stdout", "input": "10\n0.1000 0.1000 0.8000 0.5460931614544986\n0.1111 0.1111 0.7778 0.1111\n0.0001 0.0001 0.9998 1.174827513717328\n0.8000 0.1000 0.1000 0.1000\n0.1000 0.8000 0.1000 0.992075111118174\n0.9000 0.0999 0.0001 0.9000\n0.0999 0.9000 0.0001 0.9000\n0.3333 0.6666 0.0001 0.873181103672425\n0.6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nThere is a tree consisting of $ N $ vertices $ N-1 $ edges, and the $ i $ th edge connects the $ u_i $ and $ v_i $ vertices.\n\nEach vertex has a button, and the button at the $ i $ th vertex is calle... | [{"type": "stdin_stdout", "input": "4\n1 2\n2 3\n1 4\n1 3 2 -1\n-5 2 9 -1", "output": "33\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n2 3\n1 4\n0 3 0 -1\n-4 2 5 -1", "output": "23\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n1 4\n3 4\n-1 3 2 0\n-8 4 8 -1", "output": "27\n"}, {"type": "stdin_stdout", "input": "4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given array a with n elements and the number m. Consider some subsequence of a and the value of least common multiple (LCM) of its elements. Denote LCM as l. Find any longest subsequence of a with the value l β€ m.... | [{"type": "stdin_stdout", "input": "100 343\n999 284 486 785 176 742 856 415 992 601 600 122 460 214 338 92 627 913 376 835 384 914 335 179 409 957 96 784 531 43 584 206 971 799 592 801 870 978 437 517 466 952 1 327 731 689 816 681 383 969 452 298 114 687 314 436 267 154 827 197 805 207 284 550 351 700 94 567 524 329 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDenis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally... Denis asks her to be to... | [{"type": "stdin_stdout", "input": "10 10\n1101001\n0110000\n0111010\n0010000\n1010000\n0111000\n1011011\n1010010\n1101011\n1111110\n", "output": "9941743758\n"}, {"type": "stdin_stdout", "input": "10 10\n0101111\n0000000\n1111011\n1011011\n1011011\n1111011\n0010010\n1010010\n1101111\n0000000\n", "output": "8993391761\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a long corridor which can be divided into $n$ square cells of size $1 \\times 1$. These cells are numbered from $1$ to $n$ from left to right.\n\nThere are two people in this corridor, a hooligan and a security g... | [{"type": "stdin_stdout", "input": "3\n25 2 3 5\n2 7\n11 2 11 10\n1 1\n4 2 3 6\n4 4\n", "output": "1\n0\n1\n"}, {"type": "stdin_stdout", "input": "3\n11 2 3 20\n4 4\n7 2 3 -1\n5 1\n1 2 4 10\n0 1\n", "output": "2\n2\n2\n"}, {"type": "stdin_stdout", "input": "3\n13 2 3 1\n1 8\n7 2 1 6\n13 2\n7 2 3 12\n2 4\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is well known that Berland has n cities, which form the Silver ring β cities i and i + 1 (1 β€ i < n) are connected by a road, as well as the cities n and 1. The goverment have decided to build m new roads. The list of ... | [{"type": "stdin_stdout", "input": "100 50\n79 24\n65 69\n44 6\n49 53\n26 22\n24 76\n10 2\n19 44\n44 10\n87 82\n91 87\n23 92\n69 66\n95 30\n90 24\n95 20\n76 36\n82 24\n63 80\n70 72\n34 76\n42 40\n17 100\n66 64\n85 96\n34 30\n36 69\n45 56\n36 62\n26 38\n31 28\n79 64\n78 69\n41 62\n36 40\n64 67\n21 13\n90 88\n28 30\n59 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has sha... | [{"type": "stdin_stdout", "input": "1000 1000\n999 999\n1 1000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "808 1000\n583 676\n527 416\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "965 1000\n606 895\n533 394\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "958 1000\n326 461\n836 674... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nΠΠ° ΡΡΠ΅Π½ΠΈΡΠΎΠ²ΠΊΡ ΠΏΠΎ ΠΏΠΎΠ΄Π³ΠΎΡΠΎΠ²ΠΊΠ΅ ΠΊ ΡΠΎΡΠ΅Π²Π½ΠΎΠ²Π°Π½ΠΈΡΠΌ ΠΏΠΎ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠΈΡΠΎΠ²Π°Π½ΠΈΡ ΠΏΡΠΈΡΠ»ΠΈ n ΠΊΠΎΠΌΠ°Π½Π΄. Π’ΡΠ΅Π½Π΅Ρ Π΄Π»Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠΉ ΠΊΠΎΠΌΠ°Π½Π΄Ρ ΠΏΠΎΠ΄ΠΎΠ±ΡΠ°Π» ΡΡΠ΅Π½ΠΈΡΠΎΠ²ΠΊΡ, ΠΊΠΎΠΌΠΏΠ»Π΅ΠΊΡ Π·Π°Π΄Π°Ρ Π΄Π»Ρ i-ΠΉ ΠΊΠΎΠΌΠ°Π½Π΄Ρ Π·Π°Π½ΠΈΠΌΠ°Π΅Ρ a_{i} ΡΡΡΠ°Π½ΠΈΡ. Π ΡΠ°ΡΠΏΠΎΡΡΠΆΠ΅Π½ΠΈΠΈ ΡΡΠ΅Π½Π΅ΡΠ° Π΅ΡΡΡ x Π»ΠΈΡΡΠΎΠ² Π±... | [{"type": "stdin_stdout", "input": "100 1019 35\n34 50 60 47 49 49 59 60 37 51 3 86 93 33 78 31 75 87 26 74 32 30 52 57 44 10 33 52 78 16 36 77 53 49 98 82 93 85 16 86 19 57 17 24 73 93 37 46 27 87 35 76 33 91 96 55 34 65 97 66 7 30 45 68 18 51 77 43 99 76 35 47 6 1 83 49 67 85 89 17 20 7 49 33 43 59 53 71 86 71 3 47 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is playing with N cards.\n\nThe i-th card has an integer X_i on it.\n\nTakahashi is trying to create as many pairs of cards as possible satisfying one of the following conditions:\n\n* The integers on the two ca... | [{"type": "stdin_stdout", "input": "15 10\n1 5 6 10 11 11 11 20 21 25 25 26 99 124 99", "output": "6\n"}, {"type": "stdin_stdout", "input": "15 10\n0 5 6 10 11 11 11 20 21 25 25 26 99 131 99", "output": "5\n"}, {"type": "stdin_stdout", "input": "15 10\n0 5 6 10 11 11 11 20 21 46 25 26 99 131 99", "output": "5\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are an N \\times N matrix and an integer K. The entry in the i-th row and j-th column of this matrix is denoted as a_{i, j}. This matrix contains each of 1, 2, \\dots, N^2 exactly once.\nSigma can repeat the followi... | [{"type": "stdin_stdout", "input": "49 4643\n1 50 99 148 197 246 295 344 393 442 491 540 589 638 687 736 785 834 883 932 981 1030 1079 1128 1177 1226 1275 1324 1373 1422 1471 1520 1569 1618 1667 1716 1765 1814 1863 1912 1961 2010 2059 2108 2157 2185 2255 2304 2353\n2 51 742 149 198 247 296 345 394 443 1148 541 590 639 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ block towers in a row, where tower $i$ has a height of $a_i$. You're part of a building crew, and you want to make the buildings look as nice as possible. In a single day, you can perform the following opera... | [{"type": "stdin_stdout", "input": "3\n3\n10 14 10\n4\n4 1 1 2\n5\n2 1 3 1 10\n", "output": "1\n0\n1\n"}, {"type": "stdin_stdout", "input": "3\n3\n10 10 10\n4\n3 2 1 2\n5\n1 2 3 1 5\n", "output": "0\n0\n1\n"}, {"type": "stdin_stdout", "input": "3\n3\n10 10 10\n4\n3 2 0 2\n5\n1 2 3 1 5\n", "output": "0\n1\n1\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a complete graph of m vertices. Initially, the edges of the complete graph are uncolored. Sunuke did the following for each i (1 β€ i β€ n): Select ai vertices from the complete graph and color all edges connecting... | [{"type": "stdin_stdout", "input": "5\n2\n3\n4\n10\n6", "output": "17\n"}, {"type": "stdin_stdout", "input": "5\n2\n3\n3\n5\n6", "output": "11\n"}, {"type": "stdin_stdout", "input": "5\n2\n3\n5\n5\n6", "output": "13\n"}, {"type": "stdin_stdout", "input": "5\n2\n3\n3\n2\n6", "output": "9\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are two strings S and T.\nLet us change some of the characters in S so that T will be a substring of S.\nAt least how many characters do we need to change?\nHere, a substring is a consecutive subsequence. For exampl... | [{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three integers, A, B and C.\n\nAmong them, two are the same, but the remaining one is different from the rest.\n\nFor example, when A=5,B=7,C=5, A and C are the same, but B is different.\n\nFind the one that... | [{"type": "stdin_stdout", "input": "-100 100 100\n", "output": "-100\n"}, {"type": "stdin_stdout", "input": "-123 100 100", "output": "-123\n"}, {"type": "stdin_stdout", "input": "-157 100 100", "output": "-157\n"}, {"type": "stdin_stdout", "input": "-100 100 100", "output": "-100"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer sequence of length n, a_1, ..., a_n. Let us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\n1. Append a_i to the end of b.\n2. Revers... | [{"type": "stdin_stdout", "input": "6\n-1 22 1 75 15 0", "output": "0 75 22 -1 1 15\n"}, {"type": "stdin_stdout", "input": "6\n2 20 0 59 10 1", "output": "1 59 20 2 0 10\n"}, {"type": "stdin_stdout", "input": "6\n2 20 0 59 10 0", "output": "0 59 20 2 0 10\n"}, {"type": "stdin_stdout", "input": "6\n2 20 0 59 12 0", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the number of integers between 1 and K (inclusive) satisfying the following condition, modulo 10^9 + 7:\n\n* The sum of the digits in base ten is a multiple of D.\n\nConstraints\n\n* All values in input are integers.... | [{"type": "stdin_stdout", "input": "98765432109876543210\n66", "output": "678072802\n"}, {"type": "stdin_stdout", "input": "98765432109876543210\n18", "output": "852803440\n"}, {"type": "stdin_stdout", "input": "98765432109876543210\n11", "output": "501683936\n"}, {"type": "stdin_stdout", "input": "98765432109876543210... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Dwango Co., Ltd., there is a content distribution system named 'Dwango Media Cluster', and it is called 'DMC' for short.\nThe name 'DMC' sounds cool for Niwango-kun, so he starts to define DMC-ness of a string.\n\nGive... | [{"type": "stdin_stdout", "input": "54\nDIALUPWIDEAREADETWORKGAMINGOPERATIONCORPORATIONLIMITEN\n3\n20 30 40", "output": "0\n2\n3\n"}, {"type": "stdin_stdout", "input": "54\nDIALUPWIDEAREADETWORKGAMINGOPERATIONCORPORATIONLIMITEN\n3\n20 38 40", "output": "0\n3\n3\n"}, {"type": "stdin_stdout", "input": "54\nDIALUPWIDEAREA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese here \n\n------ Problem Statement ------ \n\nMaxim likes dividers of the numbers. Also Maxim is fond of lucky numbers of small elephant from Lviv city.\nΒ \nIf you remember, luc... | [{"type": "stdin_stdout", "input": "10\n1\n2\n1\n10\n5\n11\n10\n8\n14\n4", "output": "0\n0\n0\n0\n0\n0\n0\n1\n2\n1\n"}, {"type": "stdin_stdout", "input": "10\n2\n2\n1\n7\n5\n13\n14\n8\n18\n5", "output": "0\n0\n0\n1\n0\n0\n2\n1\n0\n0\n"}, {"type": "stdin_stdout", "input": "10\n2\n2\n1\n10\n5\n11\n7\n8\n14\n4", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA complete binary tree is a binary tree in which every internal node has two children and all leaves have the same depth. A binary tree in which if last level is not completely filled but all nodes (leaves) are pushed acr... | [{"type": "stdin_stdout", "input": "5\n-3 -1 -1 1 -3", "output": "node 1: key = -3, left key = -1, right key = -1, \nnode 2: key = -1, parent key = -3, left key = 1, right key = -3, \nnode 3: key = -1, parent key = -3, \nnode 4: key = 1, parent key = -1, \nnode 5: key = -3, parent key = -1, \n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShe is an extraordinary girl. She works for a library. Since she is young and cute, she is forced to do a lot of laborious jobs. The most annoying job for her is to put returned books into shelves, carrying them by a cart... | [{"type": "stdin_stdout", "input": "2\n2\nYYZNNNNY\n4\nNNNYYNYNNNYYONYN", "output": "6\n10\n"}, {"type": "stdin_stdout", "input": "2\n2\nYYZNYNNN\n4\nNNNYYNYNNNYYNNYN", "output": "5\n10\n"}, {"type": "stdin_stdout", "input": "2\n2\nYYZNNNNY\n4\nNNNYNNYNYNYYONYN", "output": "6\n11\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.\n\nFilya is given an array of non-negative integers a_1, a_2, ..., a_{n}. Fir... | [{"type": "stdin_stdout", "input": "10\n1 1 1 1 1 2 2 2 2 2\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 1 1 2 2 2 2 2\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 1 1 3 2 2 2 2\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "3\n99999999 1 50000000\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoder Mart sells 1000000 of each of the six items below:\n\n* Riceballs, priced at 100 yen (the currency of Japan) each\n* Sandwiches, priced at 101 yen each\n* Cookies, priced at 102 yen each\n* Cakes, priced at 103 ye... | [{"type": "stdin_stdout", "input": "386", "output": "0\n"}, {"type": "stdin_stdout", "input": "115", "output": "0\n"}, {"type": "stdin_stdout", "input": "173", "output": "0\n"}, {"type": "stdin_stdout", "input": "145", "output": "0\n"}, {"type": "stdin_stdout", "input": "192", "output": "0\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nForgotten languages (also known as extinct languages) are languages that are no longer in use. Such languages were, probably, widely used before and no one could have ever imagined that they will become extinct at some po... | [{"type": "stdin_stdout", "input": "2\n3 2\npiygu ezyfo rzotm\n1 piygu\n6 tefwz tefwz piygu ezyfo tefwz piygu\n4 1\nkssdy tjzhy ljzym kegqz\n4 kegqz kegqz kegqz vxvzj", "output": "YES YES NO \nNO NO NO YES \n"}, {"type": "stdin_stdout", "input": "2\n3 2\npiygu ezyfo rzotm\n1 piygu\n6 tefwz zwfet piygu ezyfo tefwz piygu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following mo... | [{"type": "stdin_stdout", "input": "10\n100000000 200000000 300000000 400000000 500000000 600000000 555489806 1596475927 1262387014 1000000000\n", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "10\n100000000 200000000 300000000 400000000 500000000 600000000 555489806 1596475927 1262387014 1000000100\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nReal stupidity beats artificial intelligence every time.\n\nβ Terry Pratchett, Hogfather, Discworld\n\nYou are given a string $s$ of length $n$ and a number $k$. Let's denote by $rev(s)$ the reversed string $s$ (i.e. $rev... | [{"type": "stdin_stdout", "input": "4\n3 2\naab\n3 3\naab\n7 1\nabacaba\n2 0\nab\n", "output": "2\n2\n1\n1\n"}, {"type": "stdin_stdout", "input": "1\n4 1\nabcd\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n4 2\nabca\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n3 1\naab\n", "output": "2\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya had three strings $a$, $b$ and $s$, which consist of lowercase English letters. The lengths of strings $a$ and $b$ are equal to $n$, the length of the string $s$ is equal to $m$. \n\nVasya decided to choose a substr... | [{"type": "stdin_stdout", "input": "100 200\ndddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ndddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\nddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike is building a time machine in his spare time. To finish the work, he needs a resistor with a certain resistance value.\n\nHowever, all Mike has is lots of identical resistors with unit resistance R_0 = ... | [{"type": "stdin_stdout", "input": "999999999999999999 1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "999999999999999999 1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "999999999999999991 1000000000000000000\n", "output": "11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has n positive integers a_1, a_2, ..., a_{n}. \n\nHis friend Vasya decided to joke and replaced all digits in Petya's numbers with a letters. He used the lowercase letters of the Latin alphabet from 'a' to 'j' and r... | [{"type": "stdin_stdout", "input": "50\ng\nha\nhd\ndi\nac\nfdhhb\ng\nhgeag\nafafb\nb\nb\najjj\ncaiadi\nhciifa\nhb\ncaih\ncdbbi\ngjff\nbfe\neddci\ndijfie\nacjj\nef\ng\njdc\nahg\ne\nhbbh\ncdc\njifdc\ne\nffaehj\nhjhi\ng\neag\nfbbc\nchg\njhahfg\nbb\njd\njchh\nbefifj\nejac\ne\nh\njfhb\nedhe\nf\nag\nca\n", "output": "2673136... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $a$ and $b$.\n\nIn one move, you can choose some integer $k$ from $1$ to $10$ and add it to $a$ or subtract it from $a$. In other words, you choose an integer $k \\in [1; 10]$ and perform $a := ... | [{"type": "stdin_stdout", "input": "11\n5 5\n13 42\n18 4\n1337 420\n123456789 1000000000\n100500 9000\n5 5\n13 42\n18 4\n2524 420\n123456789 1000000000\n", "output": "0\n3\n2\n92\n87654322\n9150\n0\n3\n2\n211\n87654322\n"}, {"type": "stdin_stdout", "input": "11\n10 5\n4 42\n17 4\n1337 420\n123456789 1000000000\n100500 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode laptop consumes P1 watt per minute. T1 minutes after Tom moved the mouse or touched the keyboard for the last time... | [{"type": "stdin_stdout", "input": "30 3 50 32 1 18\n46 60\n66 94\n99 141\n162 239\n309 334\n400 550\n594 630\n659 663\n664 701\n735 736\n741 755\n756 801\n823 854\n865 915\n937 964\n984 986\n990 1007\n1008 1031\n1052 1064\n1073 1080\n1190 1191\n1192 1254\n1265 1266\n1272 1273\n1274 1277\n1284 1302\n1308 1312\n1358 138... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is same as the next one, but has smaller constraints.\n\nIt was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). Af... | [{"type": "stdin_stdout", "input": "42\n-5391 -2932\n-5391 -2868\n-5391 1744\n-5391 2236\n-5391 4148\n-5391 5217\n-5391 6188\n-3584 -2932\n-3584 -2868\n-3584 1744\n-3584 2236\n-3584 4148\n-3584 5217\n-3584 6188\n-1657 -2932\n-1657 -2868\n-1657 1744\n-1657 2236\n-1657 4148\n-1657 5217\n-1657 6188\n3218 -2932\n3218 -2868... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one... | [{"type": "stdin_stdout", "input": "20 20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"}, {"type": "stdin_stdout", "input": "20 20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1\n", "output": "2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is organizing a party.\nAt the party, each guest will receive one or more snack pieces.\nTakahashi predicts that the number of guests at this party will be A or B.\nFind the minimum number of pieces that can be ... | [{"type": "stdin_stdout", "input": "100000 99999\n", "output": "9999900000\n"}, {"type": "stdin_stdout", "input": "110000 99999", "output": "10999890000\n"}, {"type": "stdin_stdout", "input": "110001 118998", "output": "4363299666\n"}, {"type": "stdin_stdout", "input": "110000 138162", "output": "7598910000\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA widely known among some people Belarusian sport programmer Yura possesses lots of information about cars. That is why he has been invited to participate in a game show called \"Guess That Car!\".\n\nThe game show takes ... | [{"type": "stdin_stdout", "input": "10 10\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 1585 1564 3603 1095 1364 1029 3189 1331\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 1749\n0 3495 1540 641 1093 702 2249 983 1218 2108\n0 1397 1105 3119 1194 839 1286 2979 2941 1911\n0 1818 2264... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ cities in Berland and some pairs of them are connected by two-way roads. It is guaranteed that you can pass from any city to any other, moving along the roads. Cities are numerated from $1$ to $n$.\n\nTwo fa... | [{"type": "stdin_stdout", "input": "3\n7 7 3 5\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 5\n4 5 2 3\n1 2\n2 3\n3 4\n4 1\n4 2\n4 3 2 1\n1 2\n2 3\n4 1\n", "output": "4\n0\n1\n"}, {"type": "stdin_stdout", "input": "3\n7 7 3 5\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 5\n4 5 2 3\n1 2\n2 3\n4 4\n4 1\n4 2\n4 3 2 1\n1 2\n2 3\n4 1\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConstanze is the smartest girl in her village but she has bad eyesight.\n\nOne day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For examp... | [{"type": "stdin_stdout", "input": "nnnnnnnnnnnnnnnnnnnnnuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunnnnnnnnnnnnnnnnnnnnnuuuuuuuuuunnunnu\n", "output": "281595619\n"}, {"type": "stdin_stdout", "input": "nnnnnnnnnnnnnnnnnnnnnuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunnnnnnnnnnnnnnnnnnnnnuuuuuuuuuunnunnu\n", "output": "28... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLengths are measures in Baden in inches and feet. To a length from centimeters it is enough to know that an inch equals three centimeters in Baden and one foot contains 12 inches.\n\nYou are given a length equal to n cent... | [{"type": "stdin_stdout", "input": "10000\n", "output": "277 9\n"}, {"type": "stdin_stdout", "input": "18864\n", "output": "524 0\n"}, {"type": "stdin_stdout", "input": "13473\n", "output": "374 3\n"}, {"type": "stdin_stdout", "input": "25368\n", "output": "704 8\n"}, {"type": "stdin_stdout", "input": "9999\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVery soon there will be a parade of victory over alien invaders in Berland. Unfortunately, all soldiers died in the war and now the army consists of entirely new recruits, many of whom do not even know from which leg they... | [{"type": "stdin_stdout", "input": "10\n18 18\n71 471\n121 362\n467 107\n138 254\n13 337\n499 373\n337 387\n147 417\n76 417\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n18 18\n71 471\n121 362\n467 107\n138 254\n13 337\n499 373\n337 387\n147 417\n76 417\n", "output": "4\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nICPC Ranking\n\nYour mission in this problem is to write a program which, given the submission log of an ICPC (International Collegiate Programming Contest), determines team rankings.\n\nThe log is a sequence of records o... | [{"type": "stdin_stdout", "input": "300 19 8 5\n50 5 2 1\n70 5 2 0\n75 1 1 0\n100 3 1 0\n150 2 2 0\n240 5 5 7\n50 1 1 0\n60 2 2 0\n41 2 3 0\n90 1 3 0\n120 3 5 0\n196 4 1 0\n150 2 4 1\n180 3 5 4\n15 2 2 1\n20 2 2 1\n25 2 2 0\n60 1 1 0\n120 5 5 4\n15 5 4 1\n20 5 4 0\n40 1 1 0\n40 2 2 0\n120 2 3 4\n30 1 1 0\n40 2 1 0\n13 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has a favorite sequence $a[1 \\dots n]$ consisting of $n$ integers. He wrote it out on the whiteboard as follows:\n\nhe wrote the number $a_1$ to the left side (at the beginning of the whiteboard);\n\nhe wrote th... | [{"type": "stdin_stdout", "input": "6\n7\n1324 4 5 2 9 1 1\n4\n9 2 7 1\n11\n8 4 3 1 2 7 8 7 9 4 2\n1\n42\n2\n11 7\n8\n1 1 1 1 1 1 1 1\n", "output": "1324 1 4 1 5 9 2 \n9 1 2 7 \n8 2 4 4 3 9 1 7 2 8 7 \n42 \n11 7 \n1 1 1 1 1 1 1 1 \n"}, {"type": "stdin_stdout", "input": "6\n7\n1324 4 5 2 9 1 1\n4\n9 2 7 1\n11\n8 4 3 1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA bracketed sequence is called correct (regular) if by inserting \"+\" and \"1\" you can get a well-formed mathematical expression from it. For example, sequences \"(())()\", \"()\" and \"(()(()))\" are correct, while \")... | [{"type": "stdin_stdout", "input": "100\n)()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "101\n(())))))()))()())(()))((())))((())(()()()(()()((()()((()((())))((()))()(())(()(())((()))(()))()(((()(\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA mischievous notice has arrived from the primitive slow-life organization \"Akaruda\". Akaruda is famous for mischief such as throwing a pie at the face of a VIP, but recently it has become more radical, such as using gu... | [{"type": "stdin_stdout", "input": "4\n03:05\n05:11\n11:54\n10:40", "output": "warning\nwarning\nwarning\nwarning\n"}, {"type": "stdin_stdout", "input": "4\n03:25\n10:61\n11:65\n10:41", "output": "warning\nwarning\nalert\nwarning\n"}, {"type": "stdin_stdout", "input": "4\n12:15\n10:50\n11:44\n10:40", "output": "warning... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree with n nodes, numerated from 0 to n-1. For each k between 0 and n, inclusive, you have to count the number of unordered pairs (u,v), u β v, such that the MEX of all the node labels in the shortest pat... | [{"type": "stdin_stdout", "input": "2\n4\n0 1\n0 2\n2 3\n2\n1 0\n", "output": "\n1 2 1 1 1 \n0 0 1 \n"}, {"type": "stdin_stdout", "input": "2\n4\n0 1\n1 2\n2 3\n2\n1 0\n", "output": "3 0 1 1 1\n0 0 1\n"}, {"type": "stdin_stdout", "input": "2\n4\n0 1\n1 2\n1 3\n2\n1 0\n", "output": "3 0 2 1 0\n0 0 1\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards. \nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the ... | [{"type": "stdin_stdout", "input": "1 13\n", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "11 11\n", "output": "Draw\n"}, {"type": "stdin_stdout", "input": "-1 -4", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "-2 -3", "output": "Alice\n"}, {"type": "stdin_stdout", "input": "-2 -4", "output": "Ali... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of $n$ high school students numbered from $1$ to $n$. Initially, each student $i$ is on position $i$. Each student... | [{"type": "stdin_stdout", "input": "30\n61 23\n30 93\n4 18\n34 97\n63 77\n45 95\n51 13\n41 8\n86 19\n38 24\n2 67\n20 61\n95 48\n95 1\n28 26\n92 110\n6 78\n64 28\n1 82\n61 37\n77 35\n152 21\n10 24\n52 12\n80 63\n64 61\n16 87\n118 19\n21 34\n54 49\n", "output": "29529\n"}, {"type": "stdin_stdout", "input": "30\n61 23\n30... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nB: Parentheses Number\n\nproblem\n\nDefine the correct parenthesis string as follows:\n\n* The empty string is the correct parenthesis string\n* For the correct parenthesis string S, `(` S `)` is the correct parenthesis s... | [{"type": "stdin_stdout", "input": "2\n2 -107", "output": ":(\n"}, {"type": "stdin_stdout", "input": "2\n2 -187", "output": ":(\n"}, {"type": "stdin_stdout", "input": "2\n2 -155", "output": ":(\n"}, {"type": "stdin_stdout", "input": "2\n2 -142", "output": ":(\n"}, {"type": "stdin_stdout", "input": "2\n2 -100", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a_1, a_2, \\dots, a_n$ of integer numbers.\n\nYour task is to divide the array into the maximum number of segments in such a way that:\n\n each element is contained in exactly one segment; each s... | [{"type": "stdin_stdout", "input": "100\n1065 362 1002 1071 502 252 1401 1824 887 1803 1572 1571 502 1408 1699 1750 1785 1507 1616 1458 372 323 939 1208 1639 1517 1145 319 935 1507 1094 156 1062 39 1884 1470 646 917 1699 631 39 789 1030 1589 1700 17 495 32 506 574 1458 206 1091 211 279 1617 1624 1183 572 1496 1014 2007... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke and Ciel went to a strange stationery store. Each of them got a transparent graph paper with H rows and W columns.\n\nSnuke painted some of the cells red in his paper. Here, the cells painted red were 4-connected, t... | [{"type": "stdin_stdout", "input": "7 13\n.............\n.###.###.###.\n.#.#.#...#...\n.###.#...#...\n...#.#.#.#.#.\n.#.#.###.###.\n.............", "output": "############.\n####.###.###.\n############.\n####.#...#...\n############.\n##.#.###.###.\n############.\n............#\n.############\n.#.#.#...#..#\n.##########... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an integer $n$, find the maximum value of integer $k$ such that the following condition holds:\n\n$n$ & ($n-1$) & ($n-2$) & ($n-3$) & ... ($k$) = $0$\n\nwhere & denotes the bitwise AND operation. \n-----Input-----\n... | [{"type": "stdin_stdout", "input": "1\n168457447\n", "output": "134217727\n"}, {"type": "stdin_stdout", "input": "1\n276490162\n", "output": "268435455\n"}, {"type": "stdin_stdout", "input": "1\n109011159\n", "output": "67108863\n"}, {"type": "stdin_stdout", "input": "1\n99888383\n", "output": "67108863\n"}, {"type": "... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.