messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob got very bored during a long car trip so they decided to play a game. From the window they can see cars of different colors running past them. Cars are going one after another.\n\nThe game rules are like thi... | [{"type": "stdin_stdout", "input": "30 1\n2 2 2 2 2 3 3 3 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 1 1 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "19 3\n1 2 3 1 2 3 1 2 3 5 5 5 5 5 5 5 5 2 3\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "15 1\n2 5 5 1 2 1 5 2 1 5 2 1 5 1 5\n", "output": "5\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and a_{i} is the l... | [{"type": "stdin_stdout", "input": "10 1\n5 78 3 87 4 9 5 8 9 1235\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "4 1660\n1505 13 37 100\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1 10000\n10000\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5 10\n1 2 2 4 5\n", "output": "NO\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have unlimited number of coins with values $1, 2, \\ldots, n$. You want to select some set of coins having the total value of $S$. \n\nIt is allowed to have multiple coins with the same value in the set. What is the m... | [{"type": "stdin_stdout", "input": "1 1000000000\n", "output": "1000000000"}, {"type": "stdin_stdout", "input": "100000 1000000000\n", "output": "10000"}, {"type": "stdin_stdout", "input": "2 1000000000\n", "output": "500000000"}, {"type": "stdin_stdout", "input": "31859 629091638\n", "output": "19747"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string is called palindrome if it reads the same from left to right and from right to left. For example \"kazak\", \"oo\", \"r\" and \"mikhailrubinchikkihcniburliahkim\" are palindroms, but strings \"abb\" and \"ij\" ar... | [{"type": "stdin_stdout", "input": "wrwrwfrrfrffrrwwwffffwrfrrwfrrfrwwfwfrwfwfwffwrrwfrrrwwwfrrrwfrrfwrwwrwrrrffffwrrrwrwfffwrffrwwwrwww\n", "output": "fffffffffffffffrrrrrrrrrrrrrrrrrrwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrrrrrrrrrrrrrrrrrrfffffffffffffff\n"}, {"type": "stdin_stdout", "input": "zzzzazazazazazznnznznnznnzn... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA and B are preparing themselves for programming contests.\n\nTo train their logical thinking and solve problems better, A and B decided to play chess. During the game A wondered whose position is now stronger.\n\nFor eac... | [{"type": "stdin_stdout", "input": "...QK...\n........\n........\n........\n........\n........\n........\n...rk...\n", "output": "White\n"}, {"type": "stdin_stdout", "input": "rppppppr\n...k....\n........\n........\n........\n........\nK...Q...\n........\n", "output": "Black\n"}, {"type": "stdin_stdout", "input": "....... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJumbo Takahashi will play golf on an infinite two-dimensional grid.\nThe ball is initially at the origin (0, 0), and the goal is a grid point (a point with integer coordinates) (X, Y). In one stroke, Jumbo Takahashi can p... | [{"type": "stdin_stdout", "input": "4\n9 9\n", "output": "5\n1 3\n4 2\n4 6\n6 8\n9 9\n"}, {"type": "stdin_stdout", "input": "137273866\n-75883 -100000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "896454475\n-75982 -100000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "162957408\n69008 -80583\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBad news came to Mike's village, some thieves stole a bunch of chocolates from the local factory! Horrible! \n\nAside from loving sweet things, thieves from this area are known to be very greedy. So after a thief takes hi... | [{"type": "stdin_stdout", "input": "1000000000000000\n", "output": "4949100894494448\n"}, {"type": "stdin_stdout", "input": "999999999999997\n", "output": "4949100894494440\n"}, {"type": "stdin_stdout", "input": "999999999999996\n", "output": "4949100894494432\n"}, {"type": "stdin_stdout", "input": "999999999999995\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two circles. Find the area of their intersection.\n\n\n-----Input-----\n\nThe first line contains three integers x_1, y_1, r_1 ( - 10^9 β€ x_1, y_1 β€ 10^9, 1 β€ r_1 β€ 10^9) β the position of the center and the... | [{"type": "stdin_stdout", "input": "368831644 125127030 959524552\n690900461 -368007601 1000000000\n", "output": "1877639096067727828.75000000000000000000\n"}, {"type": "stdin_stdout", "input": "-11786939 388749051 844435993\n-11696460 388789113 844535886\n", "output": "2240182216213578196.25000000000000000000\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChouti was doing a competitive programming competition. However, after having all the problems accepted, he got bored and decided to invent some small games.\n\nHe came up with the following game. The player has a positiv... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "158260522\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "641009859\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "802593587\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "524125987\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBandits appeared in the city! One of them is trying to catch as many citizens as he can.\n\nThe city consists of $n$ squares connected by $n-1$ roads in such a way that it is possible to reach any square from any other sq... | [{"type": "stdin_stdout", "input": "100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n0 0 63 70 92 75 4 96 52 33 86 57 53 85 91 62 23 0 28 37 41 69 26 64 7 100 41 19 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnalyzing the mistakes people make while typing search queries is a complex and an interesting work. As there is no guaranteed way to determine what the user originally meant by typing some query, we have to use different... | [{"type": "stdin_stdout", "input": "250\niiffiehchidfgigdbcciahdehjjfacbbaaadagaibjjcehjcbjdhaadebaejiicgidbhajfbfejcdicgfbcchgbahfccbefdcddbjjhejigiafhdjbiiehadfficicbebeeegcebideijidbgdecffeaegjfjbbcfiabfbaiddbjgidebdiccfcgfbcbbfhaejaibeicghecchjbiaceaibfgibhgcfgifiedcbhhfadhccfdhejeggcah\njbadcfjffcfabbecfabgcafgfcg... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlthough Inzane successfully found his beloved bone, Zane, his owner, has yet to return. To search for Zane, he would need a lot of money, of which he sadly has none. To deal with the problem, he has decided to hack the b... | [{"type": "stdin_stdout", "input": "10\n-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000\n10 3\n7 4\n2 6\n9 2\n5 10\n1 8\n7 8\n7 2\n10 6\n", "output": "-999999998"}, {"type": "stdin_stdout", "input": "10\n-2 -1000000000 -2 -1000000000 -2 -5 -3 -1 -2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe three friends, Kuro, Shiro, and Katie, met up again! It's time for a party...\n\nWhat the cats do when they unite? Right, they have a party. Since they wanted to have as much fun as possible, they invited all their fr... | [{"type": "stdin_stdout", "input": "1000 843\n", "output": "157\n"}, {"type": "stdin_stdout", "input": "1000 488\n", "output": "488\n"}, {"type": "stdin_stdout", "input": "543 110\n", "output": "110\n"}, {"type": "stdin_stdout", "input": "924 576\n", "output": "348\n"}, {"type": "stdin_stdout", "input": "1000 972\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHongcow likes solving puzzles.\n\nOne day, Hongcow finds two identical puzzle pieces, with the instructions \"make a rectangle\" next to them. The pieces can be described by an n by m grid of characters, where the charact... | [{"type": "stdin_stdout", "input": "1 500\n.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of o... | [{"type": "stdin_stdout", "input": "1000000000 -1000000000\n1000000000 1000000000\n-1000000000 -1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "-422276230 -422225325\n-422276230 -544602611\n-282078856 -544602611\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "-636111887 -755135651\n-4114777... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn undirected graph is called k-regular, if the degrees of all its vertices are equal k. An edge of a connected graph is called a bridge, if after removing it the graph is being split into two connected components.\n\nBui... | [{"type": "stdin_stdout", "input": "7\n", "output": "YES\n18 63\n1 10\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n2 8\n2 9\n2 4\n2 5\n2 6\n2 7\n3 8\n3 9\n3 4\n3 5\n3 6\n3 7\n4 8\n4 9\n4 6\n4 7\n5 8\n5 9\n5 6\n5 7\n6 8\n6 9\n7 8\n7 9\n8 9\n10 11\n10 12\n10 13\n10 14\n10 15\n10 16\n11 17\n11 18\n11 13\n11 14\n11 15\n11 16\n12 17\n12 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings $s$ and $t$, both consisting only of lowercase Latin letters.\n\nThe substring $s[l..r]$ is the string which is obtained by taking characters $s_l, s_{l + 1}, \\dots, s_r$ without changing the or... | [{"type": "stdin_stdout", "input": "11 3 66\nssszzzzsssz\nsss\n1 1\n1 2\n2 2\n1 3\n2 3\n3 3\n1 4\n2 4\n3 4\n4 4\n1 5\n2 5\n3 5\n4 5\n5 5\n1 6\n2 6\n3 6\n4 6\n5 6\n6 6\n1 7\n2 7\n3 7\n4 7\n5 7\n6 7\n7 7\n1 8\n2 8\n3 8\n4 8\n5 8\n6 8\n7 8\n8 8\n1 9\n2 9\n3 9\n4 9\n5 9\n6 9\n7 9\n8 9\n9 9\n1 10\n2 10\n3 10\n4 10\n5 10\n6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nQuite recently a creative student Lesha had a lecture on trees. After the lecture Lesha was inspired and came up with the tree of his own which he called a k-tree.\n\nA k-tree is an infinite rooted tree where:\n\n each v... | [{"type": "stdin_stdout", "input": "100 100 1\n", "output": "988185646\n"}, {"type": "stdin_stdout", "input": "100 50 50\n", "output": "661237556\n"}, {"type": "stdin_stdout", "input": "100 13 11\n", "output": "883875774\n"}, {"type": "stdin_stdout", "input": "90 100 30\n", "output": "697322870\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a Γ b squares, and each square is colored white or black. There are integers to the left of the rows and to th... | [{"type": "stdin_stdout", "input": "100\nWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWB\n", "output": "50\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "}, {"type": "stdin_stdout", "input": "100\nBWWWBWBWBBBBBWB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Polycarp started to develop a text editor that works only with correct bracket sequences (abbreviated as CBS). \n\nNote that a bracket sequence is correct if it is possible to get a correct mathematical expressio... | [{"type": "stdin_stdout", "input": "86 11 62\n(((())())(((()())())()()())(()())(()()())()())((()()())())(((())()())((())(()())())())\nDLDLRLRLRRR\n", "output": "(((())())(((()())())()()())(()())(()()())()())((()()())())((()())((())(()())())())\n"}, {"type": "stdin_stdout", "input": "100 57 80\n(((())(()))(()())())(((((... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA TV show called \"Guess a number!\" is gathering popularity. The whole Berland, the old and the young, are watching the show.\n\nThe rules are simple. The host thinks of an integer y and the participants guess it by aski... | [{"type": "stdin_stdout", "input": "8\n< -1000000000 Y\n< -1000000000 Y\n< -1000000000 Y\n< -1000000000 Y\n< -1000000000 Y\n< -1000000000 Y\n< -1000000000 Y\n< -1000000000 Y\n", "output": "-1998638045\n"}, {"type": "stdin_stdout", "input": "10\n>= 18 Y\n<= -32 N\n>= 85 N\n<= 98 Y\n<= -43 N\n<= -79 N\n>= 97 N\n< -38 N\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $a$ uppercase Latin letters 'A' and $b$ letters 'B'.\n\nThe period of the string is the smallest such positive integer $k$ that $s_i = s_{i~mod~k}$ ($0$-indexed) for each $i$. Note that this implies that $k$... | [{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "1999936805\n"}, {"type": "stdin_stdout", "input": "1000000000 956817411\n", "output": "1956733985\n"}, {"type": "stdin_stdout", "input": "1000000000 839933539\n", "output": "1839852485\n"}, {"type": "stdin_stdout", "input": "956817411 1000000000\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob ... | [{"type": "stdin_stdout", "input": "50 2\nYES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES\n", "output": "Ab Ac Ad Ae Af Ag Ah Ai Aj Ak Al Am An Ao Ap Aq Ar As At Au Av Aw A... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo little greedy bears have found two pieces of cheese in the forest of weight a and b grams, correspondingly. The bears are so greedy that they are ready to fight for the larger piece. That's where the fox comes in and ... | [{"type": "stdin_stdout", "input": "100000007 800000011\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "900000011 800000011\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "900000011 999900017\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "536870912 387420489\n", "output": "47\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA group of $n$ dancers rehearses a performance for the closing ceremony. The dancers are arranged in a row, they've studied their dancing moves and can't change positions. For some of them, a white dancing suit is already... | [{"type": "stdin_stdout", "input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 0 1 1 2\n", "output": "413\n"}, {"type": "stdin_stdout", "input": "20 53 32\n0 0 1 1 1 2 2 2 2 2 2 1 1 1 2 0 2 2 0 0\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "19 75 14\n2 2 2 2 0 2 1 0 0 0 0 1 1 1 2 0 2 0 1\n", "output": "-1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a cube of size k Γ k Γ k, which consists of unit cubes. Two unit cubes are considered neighbouring, if they have common face.\n\nYour task is to paint each of k^3 unit cubes one of two colours (black or whit... | [{"type": "stdin_stdout", "input": "6\n", "output": "bbbbbb\nbwwwwb\nbwbbwb\nbwbbwb\nbwwwwb\nbbbbbb\n\nwwwwww\nwbbbbw\nwbwwbw\nwbwwbw\nwbbbbw\nwwwwww\n\nbbbbbb\nbwwwwb\nbwbbwb\nbwbbwb\nbwwwwb\nbbbbbb\n\nwwwwww\nwbbbbw\nwbwwbw\nwbwwbw\nwbbbbw\nwwwwww\n\nbbbbbb\nbwwwwb\nbwbbwb\nbwbbwb\nbwwwwb\nbbbbbb\n\nwwwwww\nwbbbbw\nw... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integer a > 1 such that a^2 is a divisor of x. [Image] \n\nMalek has a number store! In his store, he has... | [{"type": "stdin_stdout", "input": "817634153013\n", "output": "817634153013\n"}, {"type": "stdin_stdout", "input": "734337660466\n", "output": "734337660466\n"}, {"type": "stdin_stdout", "input": "808453785117\n", "output": "808453785117\n"}, {"type": "stdin_stdout", "input": "294809951965\n", "output": "294809951965\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBajtek, known for his unusual gifts, recently got an integer array $x_0, x_1, \\ldots, x_{k-1}$.\n\nUnfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. After hours spent ... | [{"type": "stdin_stdout", "input": "100\n57 81 176 211 251 311 346 404 469 506 563 587 682 717 757 817 852 910 975 1012 1069 1093 1188 1223 1263 1323 1358 1416 1481 1518 1575 1599 1694 1729 1769 1829 1864 1922 1987 2024 2081 2105 2200 2235 2275 2335 2370 2428 2493 2530 2587 2611 2706 2741 2781 2841 2876 2934 2999 3036 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA positive integer is called a 2-3-integer, if it is equal to 2^{x}Β·3^{y} for some non-negative integers x and y. In other words, these integers are such integers that only have 2 and 3 among their prime divisors. For exa... | [{"type": "stdin_stdout", "input": "1088391168 1934917632\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "1088391167 1934917632\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "1088391169 1934917632\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "1088391168 1934917631\n", "output": "16\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach evening after the dinner the SIS's students gather together to play the game of Sport Mafia. \n\nFor the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs ... | [{"type": "stdin_stdout", "input": "1000000000 315152540\n", "output": "999948715"}, {"type": "stdin_stdout", "input": "1000000000 846040702\n", "output": "999939239"}, {"type": "stdin_stdout", "input": "999999994 108004280\n", "output": "999952921"}, {"type": "stdin_stdout", "input": "999999999 497659085\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImp likes his plush toy a lot.\n\n [Image] \n\nRecently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, ... | [{"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "779351061 773124120\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "453462237 167520068\n", "output": "Yes\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves computer games. Finally a game that he's been waiting for so long came out!\n\nThe main character of this game has n different skills, each of which is characterized by an integer a_{i} from 0 to 100. The high... | [{"type": "stdin_stdout", "input": "100 10000\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\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\nIvan has number $b$. He is sorting through the numbers $a$ from $1$ to $10^{18}$, and for every $a$ writes $\\frac{[a, \\,\\, b]}{a}$ on blackboard. Here $[a, \\,\\, b]$ stands for least common multiple of $a$ and $b$. Iv... | [{"type": "stdin_stdout", "input": "10000000000\n", "output": "121"}, {"type": "stdin_stdout", "input": "9133684560\n", "output": "1920"}, {"type": "stdin_stdout", "input": "6983776800\n", "output": "2304"}, {"type": "stdin_stdout", "input": "5587021440\n", "output": "2048"}, {"type": "stdin_stdout", "input": "46558512... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bump... | [{"type": "stdin_stdout", "input": "100\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length l_{i}.\n\nIlya decided to make... | [{"type": "stdin_stdout", "input": "100\n4116 4116 4117 4117 4117 4117 4118 4119 4119 4119 4119 4120 4120 4120 4120 4121 4122 4123 4123 4123 4123 4124 4124 4124 4124 4125 4126 4126 4126 4126 4127 4127 4127 4127 4128 4128 4128 4128 4129 4129 4130 4130 4131 4132 4133 4133 4134 4134 4135 4135 4136 4137 4137 4137 4138 4139... | 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\nThere was an epidemic in Monstropolis and all monsters became sick. To recover, all monsters lined up in queue for an appointment to the only doctor in the city.\n\nSoon, monsters became hungry and began to eat each other... | [{"type": "stdin_stdout", "input": "22\n3 2 3 3 3 1 1 2 1 2 1 1 1 2 2 3 1 2 3 3 3 3\n5\n5 16 5 5 15\n", "output": "YES\n1 R\n4 R\n4 R\n4 R\n4 R\n4 R\n4 L\n3 L\n6 L\n5 L\n4 L\n5 L\n7 L\n6 L\n5 R\n5 R\n5 R\n"}, {"type": "stdin_stdout", "input": "10\n30518 196518 274071 359971 550121 204862 843967 173607 619138 690754\n3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Rebel fleet is afraid that the Empire might want to strike back again. Princess Heidi needs to know if it is possible to assign R Rebel spaceships to guard B bases so that every base has exactly one guardian and each ... | [{"type": "stdin_stdout", "input": "10 10\n8530 -3814\n-9330 -6035\n3951 -217\n-9276 8291\n636 -3118\n5024 -2403\n4601 7977\n-3620 -1428\n4954 -9632\n-9852 6553\n-3457 5430\n-8866 -7343\n1020 -5748\n5043 -3820\n-2832 1528\n-5058 -825\n2406 -3530\n9152 -7463\n-8547 7108\n2492 8953\n", "output": "Yes\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nΠΠΎΠ»ΠΈΠΊΠ°ΡΠΏ ΠΌΠ΅ΡΡΠ°Π΅Ρ ΡΡΠ°ΡΡ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠΈΡΡΠΎΠΌ ΠΈ ΡΠ°Π½Π°ΡΠ΅Π΅Ρ ΠΎΡ ΡΡΠ΅ΠΏΠ΅Π½Π΅ΠΉ Π΄Π²ΠΎΠΉΠΊΠΈ. Π‘ΡΠ΅Π΄ΠΈ Π΄Π²ΡΡ
ΡΠΈΡΠ΅Π» Π΅ΠΌΡ Π±ΠΎΠ»ΡΡΠ΅ Π½ΡΠ°Π²ΠΈΡΡΡ ΡΠΎ, ΠΊΠΎΡΠΎΡΠΎΠ΅ Π΄Π΅Π»ΠΈΡΡΡ Π½Π° Π±ΠΎΠ»ΡΡΡΡ ΡΡΠ΅ΠΏΠ΅Π½Ρ ΡΠΈΡΠ»Π° 2. \n\nΠΠΎ Π·Π°Π΄Π°Π½Π½ΠΎΠΉ ΠΏΠΎΡΠ»Π΅Π΄ΠΎΠ²Π°ΡΠ΅Π»ΡΠ½ΠΎΡΡΠΈ ΡΠ΅Π»ΡΡ
ΠΏΠΎΠ»ΠΎΠΆΠΈΡΠ΅Π»ΡΠ½ΡΡ
ΡΠΈΡΠ΅Π» a_1, a_... | [{"type": "stdin_stdout", "input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the displayed number by... | [{"type": "stdin_stdout", "input": "9999 10000\n", "output": "5000\n"}, {"type": "stdin_stdout", "input": "9999 10000\n", "output": "5000\n"}, {"type": "stdin_stdout", "input": "9998 10000\n", "output": "4999\n"}, {"type": "stdin_stdout", "input": "9102 9103\n", "output": "4552\n"}, {"type": "stdin_stdout", "input": "9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs the name of the task implies, you are asked to do some work with segments and trees.\n\nRecall that a tree is a connected undirected graph such that there is exactly one simple path between every pair of its vertices.\... | [{"type": "stdin_stdout", "input": "20\n20 22\n9 11\n32 36\n8 12\n14 16\n4 6\n28 30\n29 37\n15 18\n33 35\n27 31\n21 25\n2 7\n19 23\n10 39\n34 40\n5 13\n24 38\n17 26\n1 3\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "20\n11 13\n21 38\n29 33\n10 18\n4 9\n2 6\n26 28\n15 39\n12 17\n8 19\n27 36\n20 22\n14 16\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe get more and more news about DDoS-attacks of popular websites.\n\nArseny is an admin and he thinks that a website is under a DDoS-attack if the total number of requests for a some period of time exceeds $100 \\cdot t$,... | [{"type": "stdin_stdout", "input": "100\n70 111 5 73 69 22 79 62 101 99 249 88 75 31 27 49 7 36 37 62 61 77 75 38 203 61 81 43 98 224 114 48 98 8 67 46 80 83 81 64 15 72 95 39 79 93 79 140 27 65 67 44 294 170 89 97 73 48 18 53 31 49 47 13 88 70 5 46 256 81 26 9 89 38 43 28 219 30 10 71 96 95 241 96 98 96 82 29 219 85 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWell, the series which Stepan watched for a very long time, ended. In total, the series had n episodes. For each of them, Stepan remembers either that he definitely has watched it, or that he definitely hasn't watched it,... | [{"type": "stdin_stdout", "input": "100 100\n????????????????????????????????????????????????????????????????????????????????????????????????????\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 34\n?NNNN??N???NNNN?NNN?N???N?N????NNNNNNN?N??N???NNNN???N?N?NN?NNNNN?NNN???N??NN??Y??NNN??N?NNN???NN?NN\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an integer sequence A of length N, where A_1 = X, A_{i+1} = A_i + D (1 \\leq i < N ) holds.\nTakahashi will take some (possibly all or none) of the elements in this sequence, and Aoki will take all of the others.... | [{"type": "stdin_stdout", "input": "199903 -42042635 15996643\n", "output": "1331394274247808\n"}, {"type": "stdin_stdout", "input": "199937 46898475 97994148\n", "output": "1332073730358274\n"}, {"type": "stdin_stdout", "input": "199903 2748118 -84690464\n", "output": "1331394274247808\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCodeforces user' handle color depends on his ratingΒ β it is red if his rating is greater or equal to 2400; it is orange if his rating is less than 2400 but greater or equal to 2200, etc. Each time participant takes part i... | [{"type": "stdin_stdout", "input": "9\nmwAz9lQ 1786 -1631\nnYgYFXZQfY -1849 -1775\nKU4jF -1773 -3376\nopR 3752 2931\nGl -1481 -1002\nR -1111 3778\n0i9B21DC 3650 289\nQ8L2dS0 358 -3305\ng -2662 3968\n", "output": "NO"}, {"type": "stdin_stdout", "input": "5\nzMSBcOUf -2883 -2238\nYN -3314 -1480\nfHpuccQn06 -1433 -589\naM... | 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 t... | [{"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\nLet's assume that we are given a matrix b of size x Γ y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ y matrix c which has the following properties:\n\n the upper half of matri... | [{"type": "stdin_stdout", "input": "8 20\n0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0\n0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1\n1 0 1 0 1 0 0 0 0 1 0 1 0 1 1 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA restaurant received n orders for the rental. Each rental order reserve the restaurant for a continuous period of time, the i-th order is characterized by two time values β the start time l_{i} and the finish time r_{i} ... | [{"type": "stdin_stdout", "input": "20\n22 77\n13 50\n55 64\n16 52\n67 96\n49 51\n59 95\n2 25\n69 91\n2 24\n4 46\n50 74\n45 63\n39 55\n31 33\n9 33\n6 72\n14 67\n56 98\n69 94\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "19\n24 63\n23 86\n5 89\n10 83\n31 92\n8 96\n21 63\n1 83\n2 100\n5 96\n18 98\n9 77\n11 91\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova has taken his summer practice this year and now he should write a report on how it went.\n\nVova has already drawn all the tables and wrote down all the formulas. Moreover, he has already decided that the report will... | [{"type": "stdin_stdout", "input": "94 3\n4 2 1 6 1 1 1 5 1 3 3 3 6 1 6 6 3 5 3 1 4 1 3 6 4 5 3 4 6 5 5 2 1 5 4 5 6 5 2 2 6 5 4 6 1 3 5 1 2 5 5 2 1 3 4 5 6 4 3 1 4 4 1 5 4 4 2 2 2 4 4 3 6 2 6 1 5 6 1 3 5 5 1 3 5 3 5 2 6 1 3 6 1 5\n5 6 3 5 4 1 4 6 3 1 4 4 3 3 6 2 1 1 4 6 4 2 4 1 3 1 5 3 6 2 5 6 1 6 6 2 2 2 2 5 2 6 1 4 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n100 years have passed since the last victory of the man versus computer in Go. Technologies made a huge step forward and robots conquered the Earth! It's time for the final fight between human and robot that will decide t... | [{"type": "stdin_stdout", "input": "68 -9959\n-3666\n-3501\n9169\n5724\n1478\n-643\n-3039\n-5537\n-4295\n-1856\n-6720\n6827\n-39\n-9509\n-7005\n1942\n-5173\n-4564\n2390\n4604\n-6098\n-9847\n-9708\n2382\n7421\n8716\n9718\n9895\n-4553\n-8275\n4771\n1538\n-8131\n9912\n-4334\n-3702\n7035\n-106\n-1298\n-6190\n1321\n332\n767... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob begin their day with a quick game. They first choose a starting number X_0 β₯ 3 and try to reach one million by the process described below. \n\nAlice goes first and then they take alternating turns. In the i... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "998677\n"}, {"type": "stdin_stdout", "input": "959806\n", "output": "239958\n"}, {"type": "stdin_stdout", "input": "166320\n", "output": "110879\n"}, {"type": "stdin_stdout", "input": "221760\n", "output": "110880\n"}, {"type": "stdin_stdout", "input": "277200\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya will fancy any number as long as it is an integer power of two. Petya, on the other hand, is very conservative and only likes a single integer $p$ (which may be positive, negative, or zero). To combine their tastes,... | [{"type": "stdin_stdout", "input": "1000000000 -1000\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "1000000000 1000\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "332639425 -399\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "12345678 -123\n", "output": "12\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnia has a large integer $S$. Its decimal representation has length $n$ and doesn't contain any leading zeroes. Ania is allowed to change at most $k$ digits of $S$. She wants to do it in such a way that $S$ still won't co... | [{"type": "stdin_stdout", "input": "400 224\n34034718296316650556302576767095880542740697596682657060609028712014739414658241556774411582749368771597248873201583574900424227251655547840887764275893533353440635216728376201808545879398359535670372855472971530695051695650262058940466340529417646357776899296790403916961389... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOur bear's forest has a checkered field. The checkered field is an n Γ n table, the rows are numbered from 1 to n from top to bottom, the columns are numbered from 1 to n from left to right. Let's denote a cell of the fie... | [{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000 100 -100 1000000000000000000\n", "output": "969796608 969796608"}, {"type": "stdin_stdout", "input": "546978166 115293871 313560296 -33 54 215761558342792301\n", "output": "353006839 497349709"}, {"type": "stdin_stdout", "input": "907122235 107269653 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In partic... | [{"type": "stdin_stdout", "input": "EJMGJAXCHXYIKZSQKUGRCLSTWDLNCVZIGXGWILAVFBEIGOHWGVEPRJTHWEDQRPOVZUQOSRVTIHFFHJMCLOWGHCIGJBCAAVBJFMJEFTEGFXZFVRZOXAFOFVXRAIZEWIKILFLYDZVDADYWYWYJXAGDFGNZBQKKKTGWPINLCDBZVULROGAKEKXXTWNYKQBMLQMQRUYOWUTWMNTJVGUXENHXWMFWMSBKVNGXSNFFTRTTGEGBBHMFZTKNJQDYUQOXVDWTDHZCCQNYYIOFPMKYQIGEEYBCKBAY... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns... | [{"type": "stdin_stdout", "input": "5 93\n00000000000000000000000000000000000000000000000000000000100000000000000000000000000000000001010\n00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n000000100000000000000000000000000000000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMedicine faculty of Berland State University has just finished their admission campaign. As usual, about $80\\%$ of applicants are girls and majority of them are going to live in the university dormitory for the next $4$ ... | [{"type": "stdin_stdout", "input": "10\n7846 8354 1188 6898 8046 7561 8043 8588 8684 3699\n1 1 2 3 4 5 6 7 8 9\n", "output": "7846\n"}, {"type": "stdin_stdout", "input": "10\n1337 4359 5138 5246 7859 8111 1154 8455 3711 1737\n1 1 2 3 4 1 6 7 8 9\n", "output": "1337\n"}, {"type": "stdin_stdout", "input": "10\n6870 3547 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to n. Entrance n and entrance 1 are adjacent.\n\nToday Vasya got bored and decided to take a walk in the yard. Vasya lives in e... | [{"type": "stdin_stdout", "input": "100 37 -100\n", "output": "37\n"}, {"type": "stdin_stdout", "input": "100 54 100\n", "output": "54\n"}, {"type": "stdin_stdout", "input": "100 1 -1\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "97 37 -92\n", "output": "42\n"}, {"type": "stdin_stdout", "input": "87 65 -76... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus develops an interesting theory about the interrelation of arithmetic progressions with just everything in the world. His current idea is that the population of the capital of Berland changes over time like an a... | [{"type": "stdin_stdout", "input": "20\n-1 32 37 -1 -1 -1 57 -1 -1 40 31 33 -1 -1 39 47 43 -1 35 32\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "19\n23 26 -1 -1 35 38 41 -1 -1 -1 53 -1 59 62 6 7 8 9 -1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "18\n21 19 -1 -1 -1 48 50 -1 54 -1 5 1 -1 -1 -1 37... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHigh school student Vasya got a string of length n as a birthday present. This string consists of letters 'a' and 'b' only. Vasya denotes beauty of the string as the maximum length of a substring (consecutive subsequence)... | [{"type": "stdin_stdout", "input": "100 10\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100 30\nbbaabaaabbbbbbbbbbaababababbbbbbaabaabbbbbbbbabbbbbabbbbabbbbbbbbaabbbbbbbbbabbbbbabbbbbbbbbaaaaabba\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice is the leader of the State Refactoring Party, and she is about to become the prime minister. \n\nThe elections have just taken place. There are $n$ parties, numbered from $1$ to $n$. The $i$-th party has received $a... | [{"type": "stdin_stdout", "input": "100\n100 48 48 22 21 27 51 43 53 34 54 37 45 37 27 53 39 53 37 44 55 44 56 36 55 47 45 23 40 32 55 54 40 38 30 25 28 20 39 32 53 50 41 26 29 37 42 55 23 27 51 30 39 50 24 30 22 50 56 32 60 45 50 43 27 25 52 59 47 58 28 56 49 39 33 52 26 46 23 42 45 58 42 50 49 25 28 30 46 43 26 32 40... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n3R2 - Standby for Action\n\nOur dear Cafe's owner, JOE Miller, will soon take part in a new game TV-show \"1 vs. $n$\"!\n\nThe game goes in rounds, where in each round the host asks JOE and his opponents a common question... | [{"type": "stdin_stdout", "input": "100000\n", "output": "12.090146129863\n"}, {"type": "stdin_stdout", "input": "99999\n", "output": "12.090136129863\n"}, {"type": "stdin_stdout", "input": "40862\n", "output": "11.195183715959\n"}, {"type": "stdin_stdout", "input": "71229\n", "output": "11.750878002343\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta Claus has n candies, he dreams to give them as gifts to children.\n\nWhat is the maximal number of children for whose he can give candies if Santa Claus want each kid should get distinct positive integer number of c... | [{"type": "stdin_stdout", "input": "1000\n", "output": "44\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 54 \n"}, {"type": "stdin_stdout", "input": "990\n", "output": "44\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe following problem is well-known: given integers n and m, calculate $2^{n} \\operatorname{mod} m$, \n\nwhere 2^{n} = 2Β·2Β·...Β·2 (n factors), and $x \\operatorname{mod} y$ denotes the remainder of division of x by y.\n\n... | [{"type": "stdin_stdout", "input": "100000000\n100000000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "99999999\n100000000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "98765432\n23456789\n", "output": "23456789\n"}, {"type": "stdin_stdout", "input": "99812399\n93172892\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVictor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.\n\nVictor thinks that if a word contains two consecutive vowels, then it's kinda weird an... | [{"type": "stdin_stdout", "input": "90\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"}, {"type": "stdin_stdout", "input": "85\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ consecutive seat places in a railway carriage. Each place is either empty or occupied by a passenger.\n\nThe university team for the Olympiad consists of $a$ student-programmers and $b$ student-athletes. Det... | [{"type": "stdin_stdout", "input": "64 59 2\n.*.***......****.*..**..**..****.*.*.*.**...**..***.***.*..*..*.\n", "output": "23\n"}, {"type": "stdin_stdout", "input": "20 5 5\n.*.*.........*......\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "20 5 5\n.*.*.............*..\n", "output": "10\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMelody Pond was stolen from her parents as a newborn baby by Madame Kovarian, to become a weapon of the Silence in their crusade against the Doctor. Madame Kovarian changed Melody's name to River Song, giving her a new id... | [{"type": "stdin_stdout", "input": "250877914575\n", "output": "1 125438957286\n"}, {"type": "stdin_stdout", "input": "540024979445\n", "output": "1 270012489721\n"}, {"type": "stdin_stdout", "input": "962623690081\n", "output": "1 481311845039\n"}, {"type": "stdin_stdout", "input": "426262703497\n", "output": "1 21313... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are quite a lot of ways to have fun with inflatable balloons. For example, you can fill them with water and see what happens.\n\nGrigory and Andrew have the same opinion. So, once upon a time, they went to the shop ... | [{"type": "stdin_stdout", "input": "10\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\n", "output": "1\n1\n"}, {"type": "stdin_stdout", "input": "10\n26 723 970 13 422 968 875 329 234 983\n", "output": "1\n4\n"}, {"type": "stdin_stdout", "input": "9\n665 646 152 829 190 64 555 536 321\n", "output": "1\n6\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has his favourite number $n$. He wants to split it to some non-zero digits. It means, that he wants to choose some digits $d_1, d_2, \\ldots, d_k$, such that $1 \\leq d_i \\leq 9$ for all $i$ and $d_1 + d_2 + \\ldot... | [{"type": "stdin_stdout", "input": "246\n", "output": "246\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA tuple of positive integers {x_1, x_2, ..., x_{k}} is called simple if for all pairs of positive integers (i, j) (1 β€ i < j β€ k), x_{i} + x_{j} is a prime.\n\nYou are given an array a with n positive integers a_1, ... | [{"type": "stdin_stdout", "input": "100\n314 905 555 526 981 360 424 104 920 814 143 872 741 592 105 573 837 962 220 692 560 493 889 824 145 491 828 960 889 87 375 486 609 423 386 323 124 830 206 446 899 522 514 696 786 783 268 483 318 261 675 445 1000 896 812 277 131 264 860 514 701 678 792 394 324 244 483 357 69 931 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Luba learned about a special kind of numbers that she calls beautiful numbers. The number is called beautiful iff its binary representation consists of k + 1 consecutive ones, and then k consecutive zeroes.\n\nSo... | [{"type": "stdin_stdout", "input": "32640\n", "output": "32640\n"}, {"type": "stdin_stdout", "input": "97920\n", "output": "32640\n"}, {"type": "stdin_stdout", "input": "12096\n", "output": "2016\n"}, {"type": "stdin_stdout", "input": "38304\n", "output": "2016\n"}, {"type": "stdin_stdout", "input": "89408\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least a_{i} candies.\n\nJzzhu asks children to line up. Initia... | [{"type": "stdin_stdout", "input": "100 20\n21 19 61 70 54 97 98 14 61 72 25 94 24 56 55 25 12 80 76 11 35 17 80 26 11 94 52 47 84 61 10 2 74 25 10 21 2 79 55 50 30 75 10 64 44 5 60 96 52 16 74 41 20 77 20 44 8 86 74 36 49 61 99 13 54 64 19 99 50 43 12 73 48 48 83 55 72 73 63 81 30 27 95 9 97 82 24 3 89 90 33 14 47 88 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAllen has a LOT of money. He has $n$ dollars in the bank. For security reasons, he wants to withdraw it in cash (we will not disclose the reasons here). The denominations for dollar bills are $1$, $5$, $10$, $20$, $100$. ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "10000000\n"}, {"type": "stdin_stdout", "input": "999999999\n", "output": "10000009\n"}, {"type": "stdin_stdout", "input": "163565555\n", "output": "1635659\n"}, {"type": "stdin_stdout", "input": "152541908\n", "output": "1525423\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPermutation p is an ordered set of integers p_1, p_2, ..., p_{n}, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as p_{i}. We'll call number n ... | [{"type": "stdin_stdout", "input": "1000 500\n", "output": "979041279\n"}, {"type": "stdin_stdout", "input": "1000 700\n", "output": "642759746\n"}, {"type": "stdin_stdout", "input": "1000 900\n", "output": "301804159\n"}, {"type": "stdin_stdout", "input": "1000 998\n", "output": "583666213\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArkady decided to buy roses for his girlfriend.\n\nA flower shop has white, orange and red roses, and the total amount of them is n. Arkady thinks that red roses are not good together with white roses, so he won't buy a b... | [{"type": "stdin_stdout", "input": "30 15\n7926 577 5009 7237 4395 3239 8994 4429 8126 2925 139 320 4442 3397 1292 2800 9505 6043 5946 8058 4031 6871 4689 1977 73 440 5320 5290 4707 387\nOOWOWWORRWOWORWRRRRWORROOWWROW\n", "output": "91633\n"}, {"type": "stdin_stdout", "input": "20 5\n3747 219 7826 7713 6886 466 1136 70... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA continued fraction of height n is a fraction of form $a_{1} + \\frac{1}{a_{2} + \\frac{1}{\\ldots + \\frac{1}{a_{n}}}}$. You are given two rational numbers, one is represented as [Image] and the other one is represented... | [{"type": "stdin_stdout", "input": "633468529243155234 4\n90\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "742143496299253703 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen new students come to the Specialized Educational and Scientific Centre (SESC) they need to start many things from the beginning. Sometimes the teachers say (not always unfairly) that we cannot even count. So our teac... | [{"type": "stdin_stdout", "input": "|||||||||||||||||||||||||||||||||||||||||||||||||||+|||||||||||||||||||||||||||||||||||||||||||||||||||=||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n", "output": "||||||||||||||||||||||||||||||||||||||||||||||||||+|||||||||||||... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet us define the oddness of a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n} as \\sum_{i = 1}^n |i - p_i|.\nFind the number of permutations of {1,\\ 2,\\ ...,\\ n} of oddness k, modulo 10^9+7.\n\n----... | [{"type": "stdin_stdout", "input": "49 1200\n", "output": "366641438\n"}, {"type": "stdin_stdout", "input": "50 1250\n", "output": "472467292\n"}, {"type": "stdin_stdout", "input": "38 716\n", "output": "810790165\n"}, {"type": "stdin_stdout", "input": "31 344\n", "output": "996412950\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke is introducing a robot arm with the following properties to his factory:\n - The robot arm consists of m sections and m+1 joints. The sections are numbered 1, 2, ..., m, and the joints are numbered 0, 1, ..., m. Sec... | [{"type": "stdin_stdout", "input": "1000\n-199608894 -95827813\n192129982 -290497057\n619193545 581985918\n-240647380 -782918271\n-20836366 993912949\n644932933 281088744\n776095873 -802895072\n-327192692 423250197\n821541354 184311001\n-687128964 -892770221\n119967014 206438789\n956160749 -88861874\n-800477414 9381499... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters.\n\nThere is a filler wor... | [{"type": "stdin_stdout", "input": "100\nggogogoooggogooggoggogggggogoogoggooooggooggoooggogoooggoggoogggoogoggogggoooggoggoggogggogoogggoooo\n", "output": "gg***oogg***oggoggoggggg******ggooooggooggooogg***ooggoggoogggo***ggogggoooggoggoggoggg***ogggoooo\n"}, {"type": "stdin_stdout", "input": "100\ngoogoggggogggoooggo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's introduce some definitions that will be needed later.\n\nLet $prime(x)$ be the set of prime divisors of $x$. For example, $prime(140) = \\{ 2, 5, 7 \\}$, $prime(169) = \\{ 13 \\}$.\n\nLet $g(x, p)$ be the maximum po... | [{"type": "stdin_stdout", "input": "1000000000 1000000000000000000\n", "output": "997440007\n"}, {"type": "stdin_stdout", "input": "688829161 296569860304026304\n", "output": "388155331\n"}, {"type": "stdin_stdout", "input": "666010979 443570624148538441\n", "output": "886507301\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the breaks between competitions, top-model Izabella tries to develop herself and not to be bored. For example, now she tries to solve Rubik's cube 2x2x2.\n\nIt's too hard to learn to solve Rubik's cube instantly, s... | [{"type": "stdin_stdout", "input": "5 3 5 3 2 5 2 5 6 2 6 2 4 4 4 4 1 1 1 1 6 3 6 3\n", "output": "YES"}, {"type": "stdin_stdout", "input": "2 2 1 1 5 5 5 5 3 3 4 4 1 4 1 4 2 3 2 3 6 6 6 6\n", "output": "YES"}, {"type": "stdin_stdout", "input": "1 1 1 1 5 5 3 3 4 4 4 4 3 3 2 2 6 6 5 5 2 2 6 6\n", "output": "YES"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNot so long ago the Codecraft-17 contest was held on Codeforces. The top 25 participants, and additionally random 25 participants out of those who got into top 500, will receive a Codeforces T-shirt.\n\nUnfortunately, you... | [{"type": "stdin_stdout", "input": "200 16031 15842\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "186 18666 18329\n", "output": "23\n"}, {"type": "stdin_stdout", "input": "424 10906 10346\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "406 16527 16314\n", "output": "22\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWinnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are winding paths between each pair... | [{"type": "stdin_stdout", "input": "100\n100\n100\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "75\n54\n76\n66\n", "output": "3996\n"}, {"type": "stdin_stdout", "input": "73\n71\n69\n66\n", "output": "4755\n"}, {"type": "stdin_stdout", "input": "83\n58\n88\n16\n", "output": "1354\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a given picture with size $w \\times h$. Determine if the given picture has a single \"+\" shape or not. A \"+\" shape is described below:\n\n A \"+\" shape has one center nonempty cell. There should be some (a... | [{"type": "stdin_stdout", "input": "10 10\n..........\n..........\n....*.....\n....*.....\n.*******..\n....*.....\n....*.....\n..........\n....*.....\n..........\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10 10\n..........\n..........\n....*.....\n....*.....\n.*******..\n....*.....\n....*.....\n............ | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven three numbers $n, a, b$. You need to find an adjacency matrix of such an undirected graph that the number of components in it is equal to $a$, and the number of components in its complement is $b$. The matrix must b... | [{"type": "stdin_stdout", "input": "6 1 1\n", "output": "YES\n010000\n101000\n010100\n001010\n000101\n000010\n"}, {"type": "stdin_stdout", "input": "5 1 1\n", "output": "YES\n01000\n10100\n01010\n00101\n00010\n"}, {"type": "stdin_stdout", "input": "5 1 2\n", "output": "YES\n00111\n00011\n10001\n11001\n11110\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe finalists of the \"Russian Code Cup\" competition in 2214 will be the participants who win in one of the elimination rounds.\n\nThe elimination rounds are divided into main and additional. Each of the main elimination... | [{"type": "stdin_stdout", "input": "100 100\n100 100\n100\n", "output": "9900\n"}, {"type": "stdin_stdout", "input": "10 100\n100 100\n99\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "35 28\n35 60\n44\n", "output": "2065\n"}, {"type": "stdin_stdout", "input": "19 76\n91 91\n87\n", "output": "1729\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLetβs define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the same letter written on the... | [{"type": "stdin_stdout", "input": "ABCDEFGHIJKLMNOPQRSGTUVWXYZ\n", "output": "YXWVUTGHIJKLM\nZABCDEFSRQPON\n"}, {"type": "stdin_stdout", "input": "UTEDBZRVWLOFUASHCYIPXGJMKNQ\n", "output": "PIYCHSAUTEDBZ\nXGJMKNQFOLWVR\n"}, {"type": "stdin_stdout", "input": "ZWMFLTCQIAJEVUPODMSGXKHRNYB\n", "output": "HKXGSMFLTCQIA\nRN... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYear 2118. Androids are in mass production for decades now, and they do all the work for humans. But androids have to go to school to be able to solve creative tasks. Just like humans before.\n\nIt turns out that high sch... | [{"type": "stdin_stdout", "input": "1000000000 1000000000\n", "output": "=\n"}, {"type": "stdin_stdout", "input": "1000000000 999999999\n", "output": "<\n"}, {"type": "stdin_stdout", "input": "987654321 123456987\n", "output": "<\n"}, {"type": "stdin_stdout", "input": "987654321 123456789\n", "output": "<\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya takes part in the orienteering competition. There are n checkpoints located along the line at coordinates x_1, x_2, ..., x_{n}. Vasya starts at the point with coordinate a. His goal is to visit at least n - 1 checkp... | [{"type": "stdin_stdout", "input": "97 -13\n-17 -11 -20 -16 -11 -18 -17 -14 -19 -13 -11 -19 -15 -17 -11 -20 -10 -19 -10 -18 -11 -14 -11 -15 -13 -13 -11 -18 -18 -18 -11 -14 -20 -19 -10 -17 -18 -19 -17 -11 -11 -11 -20 -19 -16 -15 -18 -15 -15 -20 -19 -20 -16 -13 -17 -11 -13 -18 -10 -13 -10 -14 -12 -17 -20 -10 -11 -19 -19 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's consider equation:x^2 + s(x)Β·x - n = 0, \n\nwhere x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.\n\nYou are given an integer n, find the small... | [{"type": "stdin_stdout", "input": "160000001600000000\n", "output": "400000000\n"}, {"type": "stdin_stdout", "input": "250000002500000000\n", "output": "500000000\n"}, {"type": "stdin_stdout", "input": "360000003600000000\n", "output": "600000000\n"}, {"type": "stdin_stdout", "input": "490000004900000000\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGeorge woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t. \n\nHelp George! Write a program that will, given time s and t, determine the time p when George went to ... | [{"type": "stdin_stdout", "input": "05:50\n05:44\n", "output": "00:06\n"}, {"type": "stdin_stdout", "input": "00:00\n01:00\n", "output": "23:00\n"}, {"type": "stdin_stdout", "input": "00:01\n00:00\n", "output": "00:01\n"}, {"type": "stdin_stdout", "input": "23:59\n23:59\n", "output": "00:00\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given array $a_1, a_2, \\dots, a_n$. Find the subsegment $a_l, a_{l+1}, \\dots, a_r$ ($1 \\le l \\le r \\le n$) with maximum arithmetic mean $\\frac{1}{r - l + 1}\\sum\\limits_{i=l}^{r}{a_i}$ (in floating-point nu... | [{"type": "stdin_stdout", "input": "101\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "69\n2 3 4 5 6 7 8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn his free time, Chouti likes doing some housework. He has got one new task, paint some bricks in the yard.\n\nThere are $n$ bricks lined in a row on the ground. Chouti has got $m$ paint buckets of different colors at ha... | [{"type": "stdin_stdout", "input": "1411 1081 1082\n", "output": "238077838\n"}, {"type": "stdin_stdout", "input": "1841 1185 1765\n", "output": "773828348\n"}, {"type": "stdin_stdout", "input": "2000 1234 1800\n", "output": "550745740\n"}, {"type": "stdin_stdout", "input": "2000 2000 1999\n", "output": "694730459\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA magic number is a number formed by concatenation of numbers 1, 14 and 144. We can use each of these numbers any number of times. Therefore 14144, 141414 and 1411 are magic numbers but 1444, 514 and 414 are not.\n\nYou'r... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "144144144\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "141414141\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "114114144\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "11111111... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima and Inna are doing so great! At the moment, Inna is sitting on the magic lawn playing with a pink pony. Dima wanted to play too. He brought an n Γ m chessboard, a very tasty candy and two numbers a and b.\n\nDima put... | [{"type": "stdin_stdout", "input": "1000000 99999 12345 23456 23 54\n", "output": "Poor Inna and pony!\n"}, {"type": "stdin_stdout", "input": "50000 100000 500 1000 500 2000\n", "output": "Poor Inna and pony!\n"}, {"type": "stdin_stdout", "input": "1000000 1000000 1000000 1000000 1000000 1000000\n", "output": "0\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from a... | [{"type": "stdin_stdout", "input": "58 5\n1 6 9 18 34 41 82 99 164 179 183 204 240 396 636 1224 2023 2856 4488 4705 5712 9180 9266 18360 18850 20270 23086 60810 190701 197064 211140 214200 222970 243240 263510 314442 425670 486480 708288 789888 1009800 1025349 1054040 1094580 1325184 1579776 1748076 2050698 2635100 289... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe tram in Berland goes along a straight line from the point 0 to the point s and back, passing 1 meter per t_1 seconds in both directions. It means that the tram is always in the state of uniform rectilinear motion, ins... | [{"type": "stdin_stdout", "input": "600 443 587\n260 1000\n548 -1\n", "output": "144000\n"}, {"type": "stdin_stdout", "input": "1000 812 761\n230 1000\n696 -1\n", "output": "51000\n"}, {"type": "stdin_stdout", "input": "1000 394 798\n155 673\n954 -1\n", "output": "271560\n"}, {"type": "stdin_stdout", "input": "799 254 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains number i Γ j. The rows and columns are numbered starting from 1.\n\nYou are given a posi... | [{"type": "stdin_stdout", "input": "100000 1000000000\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "100000 183783600\n", "output": "438\n"}, {"type": "stdin_stdout", "input": "100000 551350800\n", "output": "392\n"}, {"type": "stdin_stdout", "input": "100000 479001600\n", "output": "254\n"}, {"type": "stdin... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.