messages
listlengths
1
1
ground_truth
stringlengths
156
726k
dataset
stringclasses
1 value
[ { "content": "Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to $1$ meter movement in the south, north, west or east direction respectively).\n\nIt is known that if he moves along a previously unvisited segment of a path (i.e. this seg...
[{"input": "1\nENNNNNNNNNNNSSSSSSSSSSSEEEEEEEEEEN\n", "output": "126\n"}, {"input": "1\nNEEEEEEEEEEEWWWWWWWWWWWNNNNNNNNNNE\n", "output": "126\n"}, {"input": "1\nENNNNNNNNNNNSSSSSSSNSSSEEEEEEEEEES\n", "output": "126\n"}, {"input": "1\nNNNNNNNNNNNESSSSSSSNSSSEEEEEEEEEES\n", "output": "162\n"}, {"input": "1\nNNNNSNNNNNNES...
code_stdio
[ { "content": "Balph is learning to play a game called Buma. In this game, he is given a row of colored balls. He has to choose the color of one new ball and the place to insert it (between two balls, or to the left of all the balls, or to the right of all the balls).\n\nWhen the ball is inserted the following h...
[{"input": "WWWOONOOOWWW\n", "output": "0\n"}, {"input": "WWWOONOOOVWW\n", "output": "0\n"}, {"input": "WVWOONOOOVWW\n", "output": "0\n"}, {"input": "WOWOONVOOVWW\n", "output": "0\n"}, {"input": "WOWONOVOOVWW\n", "output": "0\n"}, {"input": "WWVOOVONOWOW\n", "output": "0\n"}, {"input": "WWVPOVONOWOW\n", "output": "0\n"...
code_stdio
[ { "content": "Every day, N passengers arrive at Takahashi Airport. The i-th passenger arrives at time T_i.\n\nEvery passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers. Naturally, a passenger cannot take a bus that departs earlier than the airplane arri...
[{"input": "6 4 3\n11\n6\n2\n13\n17\n5", "output": "4\n"}, {"input": "6 4 3\n11\n9\n2\n13\n17\n5", "output": "4\n"}, {"input": "6 3 3\n7\n6\n2\n13\n17\n5", "output": "4\n"}, {"input": "6 3 3\n7\n6\n2\n13\n10\n6", "output": "3\n"}, {"input": "6 3 6\n7\n6\n2\n13\n10\n6", "output": "2\n"}, {"input": "6 3 6\n7\n6\n2\n22\n1...
code_stdio
[ { "content": "One day, at the \"Russian Code Cup\" event it was decided to play football as an out of competition event. All participants was divided into n teams and played several matches, two teams could not play against each other more than once.\n\nThe appointed Judge was the most experienced member β€” Pave...
[{"input": "263 51\n", "output": "13413\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 18\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n1 25\n1 26\n1 27\n1 28\n1 29\n1 30\n1 31\n1 32\n1 33\n1 34\n1 35\n1 36\n1 37\n1 38\n1 39\n1 40\n1 41\n1 42\n1 43\n1 44\n1 45\n1 46\n1 47\n1 48\n1 49\...
code_stdio
[ { "content": "$n$ robots have escaped from your laboratory! You have to find them as soon as possible, because these robots are experimental, and their behavior is not tested yet, so they may be really dangerous!\n\nFortunately, even though your robots have escaped, you still have some control over them. First ...
[{"input": "4\n2\n-1 -2 0 0 0 0\n-1 -2 0 0 0 0\n3\n1 5 1 1 1 1\n2 5 0 0 0 1\n4 5 1 0 0 1\n2\n754 1337 0 1 1 1\n1336 1337 1 1 0 1\n1\n3 5 1 1 1 1\n", "output": "1 -1 -2\n1 2 -100000\n1 754 -100000\n1 -100000 -100000\n"}, {"input": "4\n2\n-1 -2 0 0 0 0\n-1 -2 0 0 0 0\n3\n1 5 1 1 1 1\n2 5 0 0 0 1\n4 5 1 0 0 1\n2\n754 1337...
code_stdio
[ { "content": "Given a square table sized NxN (3 ≀ N ≀ 5,000; rows and columns are indexed from 1) with a robot on it. The robot has a mission of moving from cell (1, 1) to cell (N, N) using only the directions \"right\" or \"down\". You are requested to find the number of different ways for the robot using exac...
[{"input": "2 4\n0 3\n3 9\n0 0", "output": "712406685\n49980002\n436378119\n"}, {"input": "2 2\n0 3\n3 9\n0 0", "output": "774058230\n49980002\n436378119\n"}, {"input": "2 2\n4 33\n6 3\n0 0", "output": "774058230\n361127130\n32\n"}, {"input": "2 2\n4 33\n5 3\n0 0", "output": "774058230\n361127130\n18\n"}, {"input": "2 ...
code_stdio
[ { "content": "Vasya is interested in arranging dominoes. He is fed up with common dominoes and he uses the dominoes of different heights. He put n dominoes on the table along one axis, going from left to right. Every domino stands perpendicular to that axis so that the axis passes through the center of its base...
[{"input": "10\n34 9\n-41 26\n-101 32\n1 10\n105 14\n92 7\n-45 35\n75 19\n-23 2\n-46 8\n", "output": "1 2 1 1 1 1 3 2 1 4\n"}, {"input": "10\n34 9\n-41 26\n-101 17\n1 10\n105 14\n92 7\n-45 35\n75 19\n-23 2\n-46 8\n", "output": "1 2 1 1 1 1 3 2 1 4\n"}, {"input": "10\n64 9\n-41 26\n-101 17\n1 10\n105 14\n92 7\n-45 35\n7...
code_stdio
[ { "content": "William really likes the cellular automaton called \"Game of Life\" so he decided to make his own version. For simplicity, William decided to define his cellular automaton on an array containing $n$ cells, with each cell either being alive or dead.\n\nEvolution of the array in William's cellular a...
[{"input": "4\n10 1\n1111111111\n9 4\n000000000\n9 4\n000000000\n9 4\n000000000\n", "output": "1111111111\n000000000\n000000000\n000000000\n"}, {"input": "4\n10 1\n1111111111\n9 4\n000000000\n9 4\n000000000\n9 4\n000000000\n", "output": "1111111111\n000000000\n000000000\n000000000\n"}, {"input": "4\n10 1\n1111111111\n9...
code_stdio
[ { "content": "In the Jambo Amusement Garden (JAG), you sell colorful drinks consisting of multiple color layers. This colorful drink can be made by pouring multiple colored liquids of different density from the bottom in order.\n\nYou have already prepared several colored liquids with various colors and densiti...
[{"input": "4\nred 3444\nred 3018\nred 3098\nred 3319\n4\nred\nred\nrec\nred", "output": "No\n"}, {"input": "4\nred 3444\nder 3018\nred 3098\nred 3319\n4\nred\nred\nrec\nred", "output": "No\n"}, {"input": "4\nred 2133\nder 3018\nred 3098\nred 3319\n4\nred\nred\nrec\nred", "output": "No\n"}, {"input": "4\nred 2133\nder ...
code_stdio
[ { "content": "There are N squares numbered 1 to N from left to right. Each square has a character written on it, and Square i has a letter s_i. Besides, there is initially one golem on each square.\n\nSnuke cast Q spells to move the golems.\n\nThe i-th spell consisted of two characters t_i and d_i, where d_i is...
[{"input": "10 15\nSNCZWRCEWB\nB R\nR R\nE R\nW R\nZ L\nS R\nQ L\nW L\nB R\nC L\nA L\nN L\nE R\nZ L\nR L", "output": "7\n"}, {"input": "10 15\nBWECRWZCNS\nB R\nR R\nE R\nW R\nZ L\nS R\nQ L\nW L\nB R\nC L\nA L\nN L\nE R\nZ L\nR L", "output": "9\n"}, {"input": "10 0\nSNCZWRCEWB\nB R\nR R\nE R\nX R\nZ L\nS R\nQ L\nW L\nB ...
code_stdio
[ { "content": "Pashmak decided to give Parmida a pair of flowers from the garden. There are n flowers in the garden and the i-th of them has a beauty number b_{i}. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers necessarily. She wants to have those pairs of flowers that ...
[{"input": "10\n1000000000 1100000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000010000 1000000000\n", "output": "100000000 8\n"}, {"input": "10\n1000000000 1100000000 1000000100 1000000000 1000000000 1000000000 1000000000 1000000000 1000010000 1000000000\n", "output": "100000000 7\n"}, {"inp...
code_stdio
[ { "content": "As Sherlock Holmes was investigating another crime, he found a certain number of clues. Also, he has already found direct links between some of those clues. The direct links between the clues are mutual. That is, the direct link between clues A and B and the direct link between clues B and A is th...
[{"input": "30 70 288262020\n27 18\n5 19\n23 17\n16 17\n29 17\n1 22\n23 5\n10 13\n22 26\n14 3\n8 3\n29 9\n9 1\n3 9\n16 4\n9 22\n10 22\n20 1\n3 7\n23 19\n26 8\n24 1\n5 7\n28 29\n20 11\n16 12\n6 9\n24 29\n30 4\n5 26\n18 21\n5 21\n30 6\n12 13\n16 23\n28 14\n30 1\n7 27\n7 19\n27 17\n5 30\n30 27\n28 30\n12 28\n27 9\n30 26\n...
code_stdio
[ { "content": "You are given the current time in 24-hour format hh:mm. Find and print the time after a minutes.\n\nNote that you should find only the time after a minutes, see the examples to clarify the problem statement.\n\nYou can read more about 24-hour format here https://en.wikipedia.org/wiki/24-hour_clock...
[{"input": "12:34\n10000\n", "output": "11:14\n"}, {"input": "00:00\n10000\n", "output": "22:40\n"}, {"input": "00:00\n10000\n", "output": "22:40\n"}, {"input": "12:34\n10000\n", "output": "11:14\n"}, {"input": "00:00\n00000\n", "output": "00:00\n"}, {"input": "14:32\n10000\n", "output": "13:12\n"}, {"input": "00:00\n0...
code_stdio
[ { "content": "Problem statement\n\nThere is a positive integer sequence $ a_1, a_2, \\ ldots, a_N $ of length $ N $.\n\nConsider the following game, which uses this sequence and is played by $ 2 $ players on the play and the play.\n\n* Alternately select one of the following operations for the first move and th...
[{"input": "2\n10 -2", "output": "Second\n"}, {"input": "2\n-1 10", "output": "First\n"}, {"input": "2\n-2 2", "output": "Second\n"}, {"input": "2\n-2 4", "output": "Second\n"}, {"input": "2\n-2 8", "output": "Second\n"}, {"input": "2\n0 -2", "output": "Second\n"}, {"input": "2\n0 10", "output": "Second\n"}, {"input": ...
code_stdio
[ { "content": "Given a positive integer $k$, two arrays are called $k$-similar if:\n\nthey are strictly increasing;\n\nthey have the same length;\n\nall their elements are positive integers between $1$ and $k$ (inclusive);\n\nthey differ in exactly one position.\n\nYou are given an integer $k$, a strictly increa...
[{"input": "6 5 15\n2 5 6 7 8 15\n1 2\n1 1\n5 5\n5 6\n4 5\n", "output": "15\n14\n14\n19\n13\n"}, {"input": "6 5 15\n2 5 6 4 8 15\n1 2\n1 1\n5 5\n5 6\n4 5\n", "output": "15\n14\n14\n19\n16\n"}, {"input": "6 5 13\n2 4 6 7 8 12\n1 4\n1 3\n3 5\n2 2\n5 5\n", "output": "11\n12\n10\n12\n12\n"}, {"input": "6 5 20\n2 5 6 7 8 9\...
code_stdio
[ { "content": "Stepan has a very big positive integer.\n\nLet's consider all cyclic shifts of Stepan's integer (if we look at his integer like at a string) which are also integers (i.e. they do not have leading zeros). Let's call such shifts as good shifts. For example, for the integer 10203 the good shifts are ...
[{"input": "8460711003592660299377170851036141857177105821455679225940496548902563144980707248030407967017317182\n13315371\n", "output": "16290\n"}, {"input": "8460711003592660299377170851036141857177105821455679225940496548902563144980707248030407967017317182\n6886527\n", "output": "136104\n"}, {"input": "846071100359...
code_stdio
[ { "content": "Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n Γ— m grid, there's exactly one bear in each cell. We denote the bear standing in column number j of row number i by (i, j). Mike's hands are on his ears (since he's the judge) and each...
[{"input": "5 5 30\n0 1 1 1 0\n1 1 0 1 1\n0 1 1 1 1\n0 0 1 1 0\n0 0 0 0 0\n3 2\n2 2\n2 2\n4 3\n1 4\n3 2\n4 1\n2 4\n1 4\n2 1\n5 2\n4 1\n4 1\n5 1\n2 4\n2 4\n4 4\n1 2\n3 1\n4 5\n1 2\n2 3\n1 1\n5 1\n3 4\n1 1\n5 4\n1 5\n5 4\n2 2\n", "output": "3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n5\n5\n5\n5\n5\n5\n4\n3\n3\n...
code_stdio
[ { "content": "Vasya is very upset that many people on the Net mix uppercase and lowercase letters in one word. That's why he decided to invent an extension for his favorite browser that would change the letters' register in every word so that it either only consisted of lowercase letters or, vice versa, only of...
[{"input": "XHRPXZEGHSOCJPICUIXSKFrZUPYTSGJSDIYBCMNMNBPNDBXLXBzhbfnqvwcffvUdhtickyqhupmcehlsyvncqmfhautvxudqdhgg\n", "output": "xhrpxzeghsocjpicuixskfrzupytsgjsdiybcmnmnbpndbxlxbzhbfnqvwcffvudhtickyqhupmcehlsyvncqmfhautvxudqdhgg\n"}, {"input": "RJIQZMJzIMSNDBOHBRAWIENODSALETAKGKPYUFGVEFGCBRENZGAdkcetqjljtmttlonpekcovdz...
code_stdio
[ { "content": "Takahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\n-----Constraints-----\n - 1 \\leq K \\leq 100\n - 1 \\leq X \\leq 10^5\n\n-----Input-----\nInput is given from Standard Input in the following format:\nK X\n\n...
[{"input": "100 100000\n", "output": "No\n"}, {"input": "84 42001\n", "output": "No\n"}, {"input": "13 6498\n", "output": "Yes\n"}, {"input": "4 2000\n", "output": "Yes\n"}, {"input": "13 1282", "output": "Yes\n"}, {"input": "10 1282", "output": "Yes\n"}, {"input": "2 900\n", "output": "Yes\n"}, {"input": "1 500\n", "o...
code_stdio
[ { "content": "Pupils Alice and Ibragim are best friends. It's Ibragim's birthday soon, so Alice decided to gift him a new puzzle. The puzzle can be represented as a matrix with $2$ rows and $n$ columns, every element of which is either $0$ or $1$. In one move you can swap two values in neighboring cells.\n\nMor...
[{"input": "50\n0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0\n0 0 0 1 0 1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1\n0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 1 0 0 1 0 0 0\n1...
code_stdio
[ { "content": "Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers ma...
[{"input": "1000000000000000000 100000000000000000\n", "output": "899999999999999991\n"}, {"input": "1000000000000000000 200000000000000000\n", "output": "799999999999999991\n"}, {"input": "1000000000000000000 100000000000000000\n", "output": "899999999999999991\n"}, {"input": "1000000000000000000 200000000000000000\n"...
code_stdio
[ { "content": "Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called \"Black Square\" on his super cool touchscreen phone.\n\nIn this game, the phone's screen is divided into four vertical strips. Each second, a black square appears on some of the strips...
[{"input": "1809 1302 7164 6122\n3144121413113111223311232232114144321414421243443243422322144324121433444342231344234443332241322442\n", "output": "420780\n"}, {"input": "1809 1302 7164 6122\n3144121413113111223311232232114144321414421243443243422322144324121433444342231344234443332241322442\n", "output": "420780\n"},...
code_stdio
[ { "content": "Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.\n\nNow he wonders what is an average value of sum of digits of the number A written in all bases from 2 to A - 1...
[{"input": "1209\n", "output": "263450/1207\n"}, {"input": "1869\n", "output": "627063/1867\n"}, {"input": "1865\n", "output": "623876/1863\n"}, {"input": "1343\n", "output": "325366/1341\n"}, {"input": "1440\n", "output": "371753/1438\n"}, {"input": "1109\n", "output": "222215/1107\n"}, {"input": "1030\n", "output": "...
code_stdio
[ { "content": "This is the hard version of the problem. The only difference is that in this version 1 ≀ q ≀ 10^5. You can make hacks only if both versions of the problem are solved.\n\nThere is a process that takes place on arrays a and b of length n and length n-1 respectively. \n\nThe process is an infinite se...
[{"input": "3\n2 3 9\n0 1\n5\n-1 0 0 -100000 000000\n", "output": "120\n119\n119\n120\n119\n"}, {"input": "3\n2 3 9\n0 1\n5\n0 0 0 -100000 000000\n", "output": "119\n119\n119\n120\n119\n"}, {"input": "3\n4 5 4\n2 1\n5\n-1 0 1 -100000 100100\n", "output": "146\n113\n51\n150\n0\n"}, {"input": "3\n5 4 4\n2 1\n5\n-1 0 1 -1...
code_stdio
[ { "content": "Ania 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 contain any leading zeroes and it'll be minimal possible. What integer will Ani...
[{"input": "400 224\n34034718296316650556302576767095880542740697596682657060609028712014739414658241556774411582749368771597248873201583574900424227251655547840887764275893533353440635216728376201808545879398359535670372855472971530695051695650262058940466340529417646357776899296790403916961389072619545914097176242329...
code_stdio
[ { "content": "The Robot is in a rectangular maze of size n Γ— m. Each cell of the maze is either empty or occupied by an obstacle. The Robot can move between neighboring cells on the side left (the symbol \"L\"), right (the symbol \"R\"), up (the symbol \"U\") or down (the symbol \"D\"). The Robot can move to th...
[{"input": "20 20 118\n..............*.....\n........*.........*.\n............*.......\n*...................\n....*......*..*.....\n................*...\n....................\n...............*....\n.......*..........*.\n.*..........*.......\n.*..............*..X\n....................\n...............*....\n..............
code_stdio
[ { "content": "Difference of Big Integers\n\nGiven two integers $A$ and $B$, compute the difference, $A - B$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the difference in a line.\n\nConstraints\n\n* $-1 \\times 10^{100000} \\leq A, B \\leq 10^{1000...
[{"input": "-2 -1280", "output": "1278\n"}, {"input": "-2 -1243", "output": "1241\n"}, {"input": "-2 -2265", "output": "2263\n"}, {"input": "-1 -2265", "output": "2264\n"}, {"input": "-1 -2368", "output": "2367\n"}, {"input": "-1 -2335", "output": "2334\n"}, {"input": "-2 -2335", "output": "2333\n"}, {"input": "0 -2335...
code_stdio
[ { "content": "The weight of a sequence is defined as the number of unordered pairs of indexes $(i,j)$ (here $i \\lt j$) with same value ($a_{i} = a_{j}$). For example, the weight of sequence $a = [1, 1, 2, 2, 1]$ is $4$. The set of unordered pairs of indexes with same value are $(1, 2)$, $(1, 5)$, $(2, 5)$, and...
[{"input": "2\n4\n2 2 2 2\n4\n1 3 3 4\n", "output": "15\n4\n"}, {"input": "2\n4\n2 2 2 2\n4\n1 4 3 4\n", "output": "15\n2\n"}, {"input": "2\n4\n2 2 2 2\n4\n1 2 3 4\n", "output": "15\n0\n"}, {"input": "2\n4\n1 2 3 1\n4\n1 4 11 4\n", "output": "1\n2\n"}, {"input": "2\n4\n1 6 4 2\n4\n1 10 1 4\n", "output": "0\n2\n"}, {"in...
code_stdio
[ { "content": "For a permutation P[1... N] of integers from 1 to N, function f is defined as follows:\n\n $f(i, j) = \\left\\{\\begin{array}{ll}{P [ i ]} & {\\text{if} j = 1} \\\\{f(P [ i ], j - 1)} & {\\text{otherwise}} \\end{array} \\right.$ \n\nLet g(i) be the minimum positive integer j such that f(i, j) = i....
[{"input": "10 7 5\n", "output": "2 3 4 5 1 7 8 9 10 6 "}, {"input": "10 7 5\n", "output": "2 3 4 5 1 7 8 9 10 6 "}, {"input": "9 2 5\n", "output": "2 1 4 3 6 7 8 9 5 "}, {"input": "9 7 9\n", "output": "2 3 4 5 6 7 8 9 1 "}, {"input": "9 2 5\n", "output": "2 1 4 3 6 7 8 9 5 "}, {"input": "9 7 9\n", "output": "2 3 4 5 6...
code_stdio
[ { "content": "Given 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 be symmetric, and all digits on the main diagonal must be zeroes.\n\nIn an und...
[{"input": "191 1 1\n", "output": "YES\n01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n101000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
code_stdio
[ { "content": "One day, Taro received a strange email with only the number \"519345213244\" in the text. The email was from my cousin, who was 10 years older than me, so when I called and asked, \"Oh, I sent it with a pocket bell because I was in a hurry. It's convenient. Nice to meet you!\" I got it. You know t...
[{"input": "341143514535\n158\n143565553551655311343411652235654535651124615163\n551544654451431564\n4\n3411\n6363636363\n153414", "output": "naruto\nNA\ndo you wanna go to aizu?\nyes sure!\nNA\nna\n?????\nend\n"}, {"input": "341143514535\n158\n143565553551655311343411652235654535651124615163\n551544654451431564\n4\n29...
code_stdio
[ { "content": "The only difference between easy and hard versions is that you should complete all the projects in easy version but this is not necessary in hard version.\n\nPolycarp is a very famous freelancer. His current rating is $r$ units.\n\nSome very rich customers asked him to complete some projects for t...
[{"input": "50 15000\n142 -300\n20 -298\n560 -300\n1815 -292\n282 -297\n92 -293\n34 -284\n555 -299\n408 -293\n504 -284\n278 -284\n139 -291\n64 -298\n311 -293\n130 -293\n89 -298\n129 -294\n385 -295\n136 -288\n41 -293\n112 -290\n416 -295\n178 -294\n154 -300\n110 -300\n346 -299\n209 -294\n1394 -295\n209 -299\n16 -297\n592...
code_stdio
[ { "content": "[3R2 as DJ Mashiro - Happiness Breeze](https://open.spotify.com/track/2qGqK8GRS65Wlf20qUBEak)\n\n[Ice - DJ Mashiro is dead or alive](https://soundcloud.com/iceloki/dj-mashiro-is-dead-or-alive)\n\nNEKO#ΦωΦ has just got a new maze game on her PC!\n\nThe game's main puzzle is a maze, in the forms of ...
[{"input": "10 83\n1 3\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n2 2\n1 4\n2 2\n2 3\n2 3\n2 3\n2 3\n2 3\n2 3\n1 4\n1 5\n1 7\n2 2\n2 2\n1 5\n2 2\n1 3\n2 1\n2 6\n1 5\n2 6\n2 9\n1 2\n2 5\n1 2\n2 5\n2 4\n2 4\n1 2\n1 2\n1 4\n2 6\n2 6\n2 4\n2 4\n1 2\n1 2\n2 4\n2 4\n2 3\n2 3\n1 2\n2 9\n1 2\n1 2\n1 2\n2 6\n2 6\n2 4\n2 4\n2 3\n2 5\n2 5\n2...
code_stdio
[ { "content": "Here, we want to solve path planning for a mobile robot cleaning a rectangular room floor with furniture.\n\nConsider the room floor paved with square tiles whose size fits the cleaning robot (1 Γ— 1). There are 'clean tiles' and 'dirty tiles', and the robot can change a 'dirty tile' to a 'clean ti...
[{"input": "7 5\n.......\n.o...*.\n.......\n.*...*.\n.......\n15 13\n.......x.......\n...o...x....*..\n.......x.......\n.......x.......\n.......x.......\n.-.............\nxxxxx.....xxxxx\n...............\n.......x.......\n.......x.......\n.......x.......\n..*....x....*..\n.......x.......\n10 10\n..........\n..o.......\...
code_stdio
[ { "content": "A newspaper is published in Walrusland. Its heading is s1, it consists of lowercase Latin letters. Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to get one big string. After that walrus erase several letters from this string...
[{"input": "ehfjaabjfedhddejjfcfijagefhkeahjcddhchahjbagi\nfbfdjbjhibjgjgaaajgdbcfdbhjcajcbbieijhcjgajhgaa\n", "output": "10\n"}, {"input": "ehfjaabjfedhddejjfcfijagefhkeahjcddhchahjbagi\naaghjagjchjieibbcjacjhbdfcbdgjaaagjgjbihjbjdfbf\n", "output": "10\n"}, {"input": "ehfjabbjfedhddejjfcfijagefhkeahjcddhchahjbagi\nfbf...
code_stdio
[ { "content": "An array $a$ is good if for all pairs of adjacent elements, $a_i$ and $a_{i+1}$ ($1\\le i \\lt n$) are of different parity. Note that an array of size $1$ is trivially good.\n\nYou are given an array of size $n$.\n\nIn one operation you can select any pair of adjacent elements in which both elemen...
[{"input": "30\n1\n1\n1\n2\n2\n1 1\n2\n1 2\n2\n2 1\n2\n2 2\n3\n1 1 1\n3\n1 1 2\n3\n1 2 1\n3\n1 2 2\n3\n2 1 1\n3\n2 1 2\n3\n2 2 1\n3\n2 2 2\n4\n1 1 1 1\n4\n1 1 1 2\n4\n1 1 2 1\n4\n1 1 2 2\n4\n1 2 1 1\n4\n1 2 1 2\n4\n1 2 2 1\n4\n1 2 2 2\n4\n2 1 1 1\n4\n2 1 1 2\n4\n2 1 2 1\n4\n2 1 2 2\n4\n2 2 1 1\n4\n2 2 1 2\n4\n2 2 2 1\n...
code_stdio
[ { "content": "Mancala is a game famous in the Middle East. It is played on a board that consists of 14 holes. [Image] \n\nInitially, each hole has $a_i$ stones. When a player makes a move, he chooses a hole which contains a positive number of stones. He takes all the stones inside it and then redistributes the...
[{"input": "297857621 238127103 749085829 139033277 597985489 202617713 1366784327 117968155 278551059 297781685 330124279 338959601 682874531 259895291\n", "output": "5305874892\n"}, {"input": "404418821 993626161 346204297 122439813 461187221 628048227 625919459 628611733 938993057 701270099 398043779 684205961 63097...
code_stdio
[ { "content": "We have N weights indexed 1 to N. The mass of the weight indexed i is W_i.\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the forme...
[{"input": "100\n15 62 67 2 22 89 88 68 100 14 35 3 81 6 26 81 13 90 17 53 60 82 6 84 31 76 26 64 74 41 33 93 29 99 89 85 34 56 62 64 100 85 65 67 95 28 49 100 9 53 18 31 37 3 37 37 24 71 91 47 73 86 42 71 90 63 98 50 75 82 67 61 48 30 35 29 41 37 1 58 85 91 19 40 85 68 36 48 52 73 6 8 100 47 82 3 17 88 28 94\n", "outp...
code_stdio
[ { "content": "Roman and Denis are on the trip to the programming competition. Since the trip was long, they soon got bored, and hence decided to came up with something. Roman invented a pizza's recipe, while Denis invented a string multiplication. According to Denis, the result of multiplication (product) of st...
[{"input": "4\nqe\nnd\niqryhukieskfvaeettersinksrmazelxtgvartuz\nvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...
code_stdio
[ { "content": "Several ages ago Berland was a kingdom. The King of Berland adored math. That's why, when he first visited one of his many palaces, he first of all paid attention to the floor in one hall. The floor was tiled with hexagonal tiles.\n\nThe hall also turned out hexagonal in its shape. The King walked...
[{"input": "1000 1100 1000\n", "output": "3196901\n"}, {"input": "1000 0100 1000\n", "output": "1197901\n"}, {"input": "1000 1000 1000\n", "output": "2997001"}, {"input": "998 999 1001\n", "output": "2993002\n"}, {"input": "1143 998 467\n", "output": "2137954\n"}, {"input": "998 137 1000\n", "output": "1269592\n"}, {"i...
code_stdio
[ { "content": "Phoenix is picking berries in his backyard. There are $n$ shrubs, and each shrub has $a_i$ red berries and $b_i$ blue berries.\n\nEach basket can contain $k$ berries. But, Phoenix has decided that each basket may only contain berries from the same shrub or berries of the same color (red or blue). ...
[{"input": "20 4\n0 1\n0 2\n0 0\n1 2\n3 2\n1 3\n1 3\n2 0\n3 1\n0 2\n3 3\n2 3\n2 0\n3 2\n1 2\n1 1\n1 1\n1 2\n0 0\n1 3\n", "output": "14\n"}, {"input": "20 4\n0 1\n0 2\n0 0\n1 2\n3 2\n1 3\n1 3\n2 0\n3 1\n0 2\n3 3\n2 3\n2 0\n3 2\n1 2\n1 1\n1 1\n1 2\n0 0\n1 3\n", "output": "14\n"}, {"input": "20 4\n0 1\n0 2\n0 0\n1 2\n3 2\...
code_stdio
[ { "content": "The BFS algorithm is defined as follows. Consider an undirected graph with vertices numbered from $1$ to $n$. Initialize $q$ as a new queue containing only vertex $1$, mark the vertex $1$ as used. Extract a vertex $v$ from the head of the queue $q$. Print the index of vertex $v$. Iterate in ar...
[{"input": "11\n1 2\n2 8\n3 7\n4 9\n5 10\n5 11\n6 4\n6 5\n7 1\n1 6\n1 6 7 2 5 4 3 8 11 10 9\n", "output": "Yes\n"}, {"input": "11\n1 2\n2 8\n3 7\n4 9\n5 10\n5 11\n11 4\n6 5\n7 1\n1 6\n1 6 7 2 5 4 3 8 11 10 9\n", "output": "No\n"}, {"input": "11\n1 2\n2 8\n3 7\n4 9\n5 10\n5 11\n11 4\n8 5\n7 1\n1 6\n1 6 7 2 5 4 3 8 11 10...
code_stdio
[ { "content": "We have N clocks. The hand of the i-th clock (1≀i≀N) rotates through 360Β° in exactly T_i seconds.\n\nInitially, the hand of every clock stands still, pointing directly upward.\n\nNow, Dolphin starts all the clocks simultaneously.\n\nIn how many seconds will the hand of every clock point directly u...
[{"input": "100\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999999999999999967\n999...
code_stdio
[ { "content": "$n$ people gathered to hold a jury meeting of the upcoming competition, the $i$-th member of the jury came up with $a_i$ tasks, which they want to share with each other.\n\nFirst, the jury decides on the order which they will follow while describing the tasks. Let that be a permutation $p$ of numb...
[{"input": "1\n74\n15 4 1 8 1 4 -1 5 9 1 6 3 1 16 2 1 3 6 7 4 1 6 8 9 21 4 0 6 6 4 22 1 8 7 0 1 6 6 4 1 8 9 16 4 10 5 9 2 20 10 0 5 3 8 1 7 7 0 2 10 2 4 8 4 6 9 2 4 9 8 1 11 3 0\n", "output": "210389544\n"}, {"input": "1\n74\n15 4 1 8 1 4 0 5 9 1 6 3 1 16 2 1 3 6 7 4 1 6 8 9 21 4 0 6 6 4 22 1 8 7 0 1 6 6 4 1 8 9 16 4 1...
code_stdio
[ { "content": "Given an array A1,A2...AN, you have to print the size of the largest contiguous subarray such that \nGCD of all integers in that subarray is 1.\n\nFormally,\nFor a subarray Ai,Ai+1...Aj where 1 ≀ i < j ≀ N to be valid: GCD(Ai,Ai+1...Aj) should be 1. You have to print the size of the largest valid ...
[{"input": "2\n1\n16 2\n3\n2 4 16", "output": "-1\n-1\n"}, {"input": "2\n1\n12 2\n3\n2 4 4", "output": "-1\n-1\n"}, {"input": "2\n1\n6 4\n2\n2 12 2", "output": "-1\n-1\n"}, {"input": "2\n1\n12 2\n3\n2 4 8", "output": "-1\n-1\n"}, {"input": "2\n1\n6 4\n2\n2 10 2", "output": "-1\n-1\n"}, {"input": "2\n1\n6 4\n2\n2 12 4",...
code_stdio
[ { "content": "You are a paparazzi working in Manhattan.\n\nManhattan has r south-to-north streets, denoted by numbers 1, 2,…, r in order from west to east, and r west-to-east streets, denoted by numbers 1,2,…,r in order from south to north. Each of the r south-to-north streets intersects each of the r west-to-e...
[{"input": "500 10\n69 477 122\n73 186 235\n341 101 145\n372 77 497\n404 117 440\n494 471 37\n522 300 498\n682 149 379\n821 486 359\n855 157 386\n", "output": "3\n"}, {"input": "500 10\n69 477 111\n73 186 235\n341 101 145\n372 77 497\n404 117 440\n494 471 37\n522 300 498\n682 149 379\n821 486 359\n855 157 386\n", "outp...
code_stdio
[ { "content": "We have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\n-----Constraints-----\n - ...
[{"input": "10\n1 1 2 -3 2 8 1 218 -1 8", "output": "16\n"}, {"input": "10\n0 1 0 -2 4 34 1 34 0 4", "output": "136\n"}, {"input": "10\n-1 2 12 15 3 1 0 18 1 1", "output": "0\n"}, {"input": "10\n-2 2 12 1 4 2 1 41 -1 1", "output": "2\n"}, {"input": "10\n0 2 12 13 3 1 0 18 3 1", "output": "3\n"}, {"input": "10\n-1 2 12 ...
code_stdio
[ { "content": "Galois is one of the strongest chess players of Byteforces. He has even invented a new variant of chess, which he named Β«PawnChessΒ».\n\nThis new game is played on a board consisting of 8 rows and 8 columns. At the beginning of every game some black and white pawns are placed on the board. The numb...
[{"input": "........\n........\n.B....B.\n....W...\n........\n..W.....\n........\n........\n", "output": "A\n"}, {"input": "..B.....\n..W.....\n......B.\n........\n.....W..\n......B.\n........\n........\n", "output": "B\n"}, {"input": ".BB.B.B.\nB..B..B.\n.B.BB...\nBB.....B\nBBB....B\nB..BB...\nBB.B...B\n....WWW.\n", "...
code_stdio
[ { "content": "Write a program which finds a pattern $p$ in a ring shaped text $s$.\n\n\n<image>\n\nConstraints\n\n* $1 \\leq $ length of $p \\leq $ length of $s \\leq 100$\n* $s$ and $p$ consists of lower-case letters\n\nInput\n\nIn the first line, the text $s$ is given.\nIn the second line, the pattern $p$ is ...
[{"input": "vanceknowledgetoad\nbdvanced", "output": "No\n"}, {"input": "vanceknowledgetoad\ncdvanced", "output": "No\n"}, {"input": "vanceknowmedgetoad\ncdvanced", "output": "No\n"}, {"input": "vbnceknowmedgetoad\ncdvanced", "output": "No\n"}, {"input": "vbnceknowledgetoad\ncdvanced", "output": "No\n"}, {"input": "vbn...
code_stdio
[ { "content": "Let $f(i)$ denote the minimum positive integer $x$ such that $x$ is not a divisor of $i$.\n\nCompute $\\sum_{i=1}^n f(i)$ modulo $10^9+7$. In other words, compute $f(1)+f(2)+\\dots+f(n)$ modulo $10^9+7$.\n\n\n-----Input-----\n\nThe first line contains a single integer $t$ ($1\\leq t\\leq 10^4$), t...
[{"input": "6\n1\n4\n3\n4\n10\n10000000000000000\n", "output": "2\n10\n7\n10\n26\n366580019\n"}, {"input": "6\n1\n2\n3\n4\n10\n10000000000000000\n", "output": "2\n5\n7\n10\n26\n366580019\n"}, {"input": "6\n1\n2\n3\n4\n10\n10000000000000000\n", "output": "2\n5\n7\n10\n26\n366580019\n"}, {"input": "1\n5897090464090076\n"...
code_stdio
[ { "content": "Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.\n\nLet's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters \"a\", \"e\", \"i\", \"o\", \"u\" are considered ...
[{"input": "7 3\nferwljzwakxedlgwl\noerwljzwakxedlgwl\nhyqombizhuhxedprb\netptjrizhuhxedprb\nurtuckar\ndkartmwramklcmi\nrurtuckar\nnurartmwramklcmi\niraziomsv\nsaziomsv\nbprapiqpayzurgij\nusyemayzurgij\nztstmeecvmkvuu\nquexlecvmkvuu\nrlhwecvmkvuu\nzecvmkvuu\niikymgbncljtub\nqiikymgbncljtub\nbcavhexqamyszgfya\nojexqamys...
code_stdio
[ { "content": "The Third Doctor Who once correctly said that travel between parallel universes is \"like travelling sideways\". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never be more than 250.\n\nHeidi recently got her hands on a...
[{"input": "18 16 20 4\n0 0\n0 1\n1 7\n1 7\n", "output": "18 16\n17 15\n18 16\n19 17\n"}, {"input": "18 16 20 4\n0 0\n0 1\n1 7\n1 6\n", "output": "18 16\n17 15\n18 16\n19 17\n"}, {"input": "18 8 20 4\n1 1\n0 1\n1 7\n1 7\n", "output": "19 9\n18 8\n19 9\n20 10\n"}, {"input": "18 5 20 4\n1 4\n0 11\n1 7\n1 7\n", "output": ...
code_stdio
[ { "content": "Notes\n\nTemplate in C\n\nConstraints\n\n2 ≀ the number of operands in the expression ≀ 100\n1 ≀ the number of operators in the expression ≀ 99\n-1 Γ— 109 ≀ values in the stack ≀ 109\n\nInput\n\nAn expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space...
[{"input": "1 1 + 5 11 - *", "output": "-12\n"}, {"input": "0 0 + 6 21 - +", "output": "-15\n"}, {"input": "1 12 + 3 8 - *", "output": "-65\n"}, {"input": "1 0 + 6 21 - +", "output": "-14\n"}, {"input": "1 12 + 3 5 - *", "output": "-26\n"}, {"input": "2 0 + 6 21 - +", "output": "-13\n"}, {"input": "0 11 + 2 5 - *", "ou...
code_stdio
[ { "content": "Santa Claus decided to disassemble his keyboard to clean it. After he returned all the keys back, he suddenly realized that some pairs of keys took each other's place! That is, Santa suspects that each key is either on its place, or on the place of another key, which is located exactly where the f...
[{"input": "dofbgdppdvmwjwtdyphhmqliydxyjfxoopxiscevowleccmhwybrxitvujkfliamvqinlrpytyaqdlbywccprukoisyaseibuqbfqjcabkieimsggsakpnqliwhehnemewhychqrfiuyaecoydnromrh\ndofbgdppdvmwjwtdyphhmqliydxyjfxoopxiscevowleccmhwybsxitvujkfliamvqinlrpytyaqdlbywccprukoisyaseibuqbfqjcabkieimsggsakpnqliwhehnemewhychqrfiuyaecoydnromrh\n...
code_stdio
[ { "content": "Petya works as a PR manager for a successful Berland company BerSoft. He needs to prepare a presentation on the company income growth since 2001 (the year of its founding) till now. Petya knows that in 2001 the company income amounted to a1 billion bourles, in 2002 β€” to a2 billion, ..., and in the...
[{"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 97 98 99 100\n", "output...
code_stdio
[ { "content": "Problem Statement\n\nMr. Takatsuki, who is planning to participate in the Aizu training camp, is enthusiastic about studying and has been studying English recently. She tries to learn as many English words as possible by playing the following games on her mobile phone. The mobile phone she has is ...
[{"input": "6\nZI?U -1\nLINFR 14\nKNGE -1\nLCL -1\n@S 2\nKFHD 15\nBSKA\nILIC\nPZRH\nEDLU\n1", "output": "0\n"}, {"input": "6\n[I?U -1\nLINFR 14\nKNGE -1\nLCL -1\n@S 2\nKFHD 15\nBSKA\nILIC\nPZRH\nEDLU\n1", "output": "0\n"}, {"input": "6\n[I?U -1\nRFNIL 14\nKNGE -1\nLCL -1\n@S 2\nKFHD 15\nBSKA\nILIC\nPZRH\nEDLU\n1", "out...
code_stdio
[ { "content": "You have a robot that can move along a number line. At time moment $0$ it stands at point $0$.\n\nYou give $n$ commands to the robot: at time $t_i$ seconds you command the robot to go to point $x_i$. Whenever the robot receives a command, it starts moving towards the point $x_i$ with the speed of ...
[{"input": "8\n3\n1 5\n3 0\n6 4\n3\n1 5\n2 4\n10 -5\n5\n2 -5\n3 1\n4 1\n5 1\n6 1\n4\n3 3\n5 -3\n9 2\n12 0\n8\n1 1\n2 -6\n7 2\n8 3\n12 -9\n14 2\n18 -1\n23 9\n5\n1 -4\n4 -7\n6 -1\n7 -3\n8 -7\n2\n1 2\n2 -2\n6\n3 10\n5 5\n8 0\n12 -4\n14 -7\n19 -5\n", "output": "\n1\n2\n0\n2\n1\n1\n0\n2\n"}, {"input": "8\n3\n1 5\n3 0\n6 4\n...
code_stdio
[ { "content": "Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating their skills in watering. It is extremely expensive to host such an olympiad, so after the first $n$ olym...
[{"input": "100 74 20\n9 15 16 18 55 41 64 44 5 1 27 31 36 25 71 28 71 35 47 40 21 53 31 11 24 1 69 67 58 16 19 52 33 17 63 1 49 28 17 52 46 60 53 21 21 60 19 63 11 61 10 27 3 22 38 31 45 69 61 18 58 22 8 71 17 1 64 70 56 10 66 47 70 1 45 8 66 8 66 25 39 45 47 7 41 24 41 72 16 42 28 7 15 10 38 29 50 4 37 11\n123\n140\n...
code_stdio
[ { "content": "You are given a sequence $a=[a_1,a_2,\\dots,a_n]$ consisting of $n$ positive integers.\n\nLet's call a group of consecutive elements a segment. Each segment is characterized by two indices: the index of its left end and the index of its right end. Denote by $a[l,r]$ a segment of the sequence $a$ w...
[{"input": "4\n6\n55 45 30 30 40 100\n4\n10 23 7 13\n5\n10 55 35 30 65\n6\n4 1 1 1 1 4\n", "output": "3\n4\n2\n3\n"}, {"input": "5\n4\n18 6 6 6\n5\n5 5 5 5 5\n3\n12 6 6\n2\n1 1\n1\n1\n", "output": "3\n1\n2\n1\n1\n"}, {"input": "4\n3\n6 6 12\n4\n18 6 6 6\n5\n1 1 1 1 1\n3\n12 6 6\n", "output": "2\n3\n1\n2\n"}, {"input": ...
code_stdio
[ { "content": "Snuke is giving cookies to his three goats.\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\nYour task is to determine whether Snuke can give cookies to his three goats s...
[{"input": "-4 -10", "output": "Impossible\n"}, {"input": "-1 14", "output": "Impossible\n"}, {"input": "-2 28", "output": "Impossible\n"}, {"input": "-2 40", "output": "Impossible\n"}, {"input": "-1 -1", "output": "Impossible\n"}, {"input": "-2 -2", "output": "Impossible\n"}, {"input": "11 -1", "output": "Impossible\n...
code_stdio
[ { "content": "There are five people playing a game called \"Generosity\". Each person gives some non-zero number of coins b as an initial bet. After all players make their bets of b coins, the following operation is repeated for several times: a coin is passed from one player to some other player.\n\nYour task ...
[{"input": "100 100 100 100 100\n", "output": "100\n"}, {"input": "100 100 100 100 100\n", "output": "100\n"}, {"input": "180 100 100 100 100\n", "output": "116\n"}, {"input": "203 100 101 000 101\n", "output": "101\n"}, {"input": "100 000 100 100 100\n", "output": "80\n"}, {"input": "180 000 100 100 100\n", "output": ...
code_stdio
[ { "content": "Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According ...
[{"input": "-155221108 -190475340 -155221108 -819044368\n-155221108 -190475340 -155875856 -190475340\n-155875856 -190475340 -155875856 -819044368\n-155875856 -819044368 -155221108 -819044368\n", "output": "YES\n"}, {"input": "-985236057 -809433993 -985236057 -225363622\n-484344733 -225363622 -484344733 -225363622\n-985...
code_stdio
[ { "content": "1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n - the dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n - the dogs...
[{"input": "1000000000000001\n", "output": "gbdpxgrzxjm\n"}, {"input": "530000050000000\n", "output": "csoypdctwnh\n"}, {"input": "95678123450002\n", "output": "qpdjiixlxb\n"}, {"input": "1000000000\n", "output": "cfdgsxl\n"}, {"input": "1000000001\n", "output": "cfdgsxm\n"}, {"input": "321272416\n", "output": "aaaaaaj...
code_stdio
[ { "content": "Little Bolek has found a picture with n mountain peaks painted on it. The n painted peaks are represented by a non-closed polyline, consisting of 2n segments. The segments go through 2n + 1 points with coordinates (1, y1), (2, y2), ..., (2n + 1, y2n + 1), with the i-th segment connecting the point...
[{"input": "100 20\n2 3 0 4 0 1 0 6 3 4 3 6 4 6 0 9 0 6 2 7 3 8 7 10 2 9 3 9 5 6 5 10 3 7 1 5 2 8 3 7 2 3 1 6 0 8 3 8 0 4 1 8 3 7 1 9 5 9 5 8 7 8 5 6 5 8 1 9 8 9 8 10 7 10 5 8 6 10 2 6 3 9 2 6 3 10 5 9 3 10 1 3 2 11 8 9 8 10 1 8 7 11 0 9 5 8 4 5 0 7 3 7 5 9 5 10 1 7 1 9 1 6 3 8 2 4 1 4 2 6 0 4 2 4 2 7 6 9 -1 1 0 4 0 4 ...
code_stdio
[ { "content": "As it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a subsequence. Help Heidi assess whether the given piece is true, but please be di...
[{"input": "sjvmovplbrnakthytvanvvbscgdcdkdkbgginnbiyczyrkywcuvbgolznifdyiilonvqblbywxzgjnntldeuhhlecubshirsdxugezholvufotprjovwqiitypvaghlcxlrajrtufmysbpegjfvdboewogamnunalynjvwiopqfhndupfqxfatbpklpzdsdmzwvtitvdxkefremodmlferuxyisxmvjydjthekokldjkwoiffmhlquulcbogdnnzqaisoxqpgztuzvbleiitrqbzljbbjzugwthffpsolefofaqrpkce...
code_stdio
[ { "content": "In your garden, there is a long and narrow flowerbed that stretches infinitely to the east. You have decided to plant N kinds of flowers in this empty flowerbed. For convenience, we will call these N kinds of flowers Flower 1, 2, …, N. Also, we will call the position that is p centimeters from the...
[{"input": "1 1000000000\n1000000000000000000 1000000000", "output": "1999999999000000000"}, {"input": "3 17\n22 15\n10 10\n17 10", "output": "70\n"}, {"input": "3 17\n22 19\n10 10\n17 10", "output": "77\n"}, {"input": "3 27\n22 19\n10 10\n1 10", "output": "110\n"}, {"input": "3 27\n22 35\n10 10\n1 10", "output": "120\...
code_stdio
[ { "content": "The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = k_{i}Β·x + b_{i}. It was necessary to determine whether there is at least one point of interse...
[{"input": "10\n22290 75956\n-66905 -22602\n-88719 12654\n-191 -81032\n0 -26057\n-39609 0\n0 51194\n2648 88230\n90584 15544\n0 23060\n-29107 26878\n", "output": "NO\n"}, {"input": "10\n22290 75956\n-66905 -22602\n-88719 12654\n-191 -81032\n0 -26057\n-39609 0\n0 51194\n4903 88230\n90584 15544\n0 23060\n-29107 26878\n", ...
code_stdio
[ { "content": "C --Misawa's rooted tree\n\nProblem Statement\n\nYou noticed that your best friend Misawa's birthday was near, and decided to give him a rooted binary tree as a gift. Here, the rooted binary tree has the following graph structure. (Figure 1)\n\n* Each vertex has exactly one vertex called the paren...
[{"input": "((()[1]())[2]())[5](((()[2]())[6](()[3]()))[8]()(\n(()[4]())[3](((()[2]())[1]())[8](()[4]')))", "output": "(()[6]())[8](((()[4]())[7]())[16]())\n"}, {"input": "((()[8]())[2]())[5](((()[3]())[6](()[3]()))[2]())\n(()[4]())[2](((()[2]())[1]())[8](()[3]())(", "output": "(()[6]())[7](((()[5]())[7]())[10]())\n"},...
code_stdio
[ { "content": "The fundamental idea in the JPEG compression algorithm is to sort coeffi- cient of given image by zigzag path and encode it. In this problem, we don’t discuss about details of the algorithm, but you are asked to make simple pro- gram. You are given single integer N , and you must output zigzag pat...
[{"input": "3\n9\n0", "output": "Case 1:\n 1 2 6\n 3 5 7\n 4 8 9\nCase 2:\n 1 2 6 7 15 16 28 29 45\n 3 5 8 14 17 27 30 44 46\n 4 9 13 18 26 31 43 47 60\n 10 12 19 25 32 42 48 59 61\n 11 20 24 33 41 49 58 62 71\n 21 23 34 40 50 57 63 70 72\n 22 35 39 51 56 64 69 73 78\n 36 38 52 55 65 68 74 77 79\n 37 ...
code_stdio
[ { "content": "The bear decided to store some raspberry for the winter. He cunningly found out the price for a barrel of honey in kilos of raspberry for each of the following n days. According to the bear's data, on the i-th (1 ≀ i ≀ n) day, the price for one barrel of honey is going to is x_{i} kilos of raspber...
[{"input": "100 9\n66 71 37 41 23 38 77 11 74 13 51 26 93 56 81 17 12 70 85 37 54 100 14 99 12 83 44 16 99 65 13 48 92 32 69 33 100 57 58 88 25 45 44 85 5 41 82 15 37 18 21 45 3 68 33 9 52 64 8 73 32 41 87 99 26 26 47 24 79 93 9 44 11 34 85 26 14 61 49 38 25 65 49 81 29 82 28 23 2 64 38 13 77 68 67 23 58 57 83 46\n", "...
code_stdio
[ { "content": "You are an all-powerful being and you have created a rectangular world. In fact, your world is so bland that it could be represented by a r Γ— c grid. Each cell on the grid represents a country. Each country has a dominant religion. There are only two religions in your world. One of the religions i...
[{"input": "4\n7 8\nAAPAAAAA\nAAAAPPPP\nPPPPAAAA\nAPAAPPPP\nAPAPPAPP\nAAAAPPAP\nAAAAPPAA\n6 5\nAAAAA\nAAAAA\nAAPAA\nAAPAP\nAAAPP\nAAAPP\n4 4\nPPPP\nPPPP\nPPPP\nPPPP\n3 4\nPPPP\nPAAP\nPPPP\n", "output": "2\n1\nMORTAL\n4\n"}, {"input": "4\n7 8\nAAPABAAA\nPPPPAAAA\nPPPPAAAA\nAQAAPPPP\nAPAPPAPP\nAAAAPPAP\nAAABPPAA\n6 5\nAA...
code_stdio
[ { "content": "There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is a_{i} liters. [Image] \n\nInitially, all the vessels are empty. In some vessels ...
[{"input": "50\n57 122 98 44 22 63 5 65 36 69 49 54 61 15 58 79 50 30 43 155 18 105 46 92 72 67 67 51 34 40 50 77 91 53 79 72 72 34 91 75 83 67 71 93 11 51 85 20 6 2\n20\n2 40\n1 14 102\n2 4\n2 15\n2 43\n1 29 532\n2 27\n2 47\n1 24 107\n1 20 720\n1 21 315\n2 20\n1 2 787\n1 27 909\n2 38\n1 32 445\n1 38 17\n1 26 450\n2 40...
code_stdio
[ { "content": "The number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\n-----Constraints-----\n - N is an integer between 1 and 200 (inclusive).\n\n-----Input-----\nInp...
[{"input": "105\n", "output": "1\n"}, {"input": "104\n", "output": "0\n"}, {"input": "134\n", "output": "1\n"}, {"input": "135\n", "output": "2\n"}, {"input": "164\n", "output": "2\n"}, {"input": "165\n", "output": "3\n"}, {"input": "188\n", "output": "3\n"}, {"input": "189\n", "output": "4\n"}, {"input": "194\n", "out...
code_stdio
[ { "content": "You are given a positive integer N. Find the number of the pairs of integers u and v (0≦u,v≦N) such that there exist two non-negative integers a and b satisfying a xor b=u and a+b=v. Here, xor denotes the bitwise exclusive OR. Since it can be extremely large, compute the answer modulo 10^9+7.\n\nC...
[{"input": "1000000001000000000", "output": "999867657\n"}, {"input": "1100000001000000000", "output": "355035671\n"}, {"input": "1100000001000010000", "output": "391646023\n"}, {"input": "1100000001001010000", "output": "103347644\n"}, {"input": "1100000011001010000", "output": "194416284\n"}, {"input": "1100000001001...
code_stdio
[ { "content": "You are given an array $a_1, a_2, \\dots , a_n$ consisting of integers from $0$ to $9$. A subarray $a_l, a_{l+1}, a_{l+2}, \\dots , a_{r-1}, a_r$ is good if the sum of elements of this subarray is equal to the length of this subarray ($\\sum\\limits_{i=l}^{r} a_i = r - l + 1$).\n\nFor example, if ...
[{"input": "11\n1\n0\n1\n1\n1\n2\n1\n3\n1\n4\n1\n5\n1\n6\n1\n7\n1\n8\n1\n9\n26\n11140000000090000000002111\n", "output": "0\n1\n0\n0\n0\n0\n0\n0\n0\n0\n37\n"}, {"input": "11\n1\n0\n1\n1\n1\n2\n1\n3\n1\n4\n1\n5\n1\n6\n1\n7\n1\n8\n1\n9\n26\n11140000000090000000002111\n", "output": "0\n1\n0\n0\n0\n0\n0\n0\n0\n0\n37\n"}, {...
code_stdio
[ { "content": "You will be given a contest schedule for D days. For each d=1,2,\\ldots,D, calculate the satisfaction at the end of day d.\n\n\n\nInput\n\nInput is given from Standard Input in the form of the input of Problem A followed by the output of Problem A.\n\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \...
[{"input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 121\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 ...
code_stdio
[ { "content": "Chef has decided to arrange the free shuttle service for his employees. City of Bhiwani has a strange layout - all of its N shuttle boarding points are arranged in a circle, numbered from 1 to N in clockwise direction. Chef's restaurant is at boarding point number 1. There is a single ring road th...
[{"input": "3\n2\n181\n2", "output": "1\n180\n1\n"}, {"input": "3\n2\n132\n1", "output": "1\n40\n1\n"}, {"input": "3\n2\n166\n1", "output": "1\n82\n1\n"}, {"input": "3\n2\n1\n106", "output": "1\n1\n52\n"}, {"input": "3\n4\n1\n106", "output": "2\n1\n52\n"}, {"input": "3\n5\n1\n106", "output": "4\n1\n52\n"}, {"input": "3...
code_stdio
[ { "content": "Let's call the string beautiful if it does not contain a substring of length at least $2$, which is a palindrome. Recall that a palindrome is a string that reads the same way from the first character to the last and from the last character to the first. For example, the strings a, bab, acca, bcabc...
[{"input": "10 3\naaabababaa\n1 1\n2 10\n1 2\n", "output": "0\n6\n1\n"}, {"input": "10 3\naaabababaa\n1 1\n3 10\n1 2\n", "output": "0\n5\n1\n"}, {"input": "10 3\naaabababaa\n1 1\n2 10\n1 4\n", "output": "0\n6\n2\n"}, {"input": "10 3\naaabababaa\n1 1\n2 10\n1 8\n", "output": "0\n6\n5\n"}, {"input": "10 3\naaabababaa\n1 ...
code_stdio
[ { "content": "Petya studies at university. The current academic year finishes with $n$ special days. Petya needs to pass $m$ exams in those special days. The special days in this problem are numbered from $1$ to $n$.\n\nThere are three values about each exam: $s_i$ β€” the day, when questions for the $i$-th exam...
[{"input": "100 43\n76 77 1\n24 25 1\n2 3 1\n85 86 1\n49 50 1\n15 16 1\n30 31 1\n78 79 1\n54 55 1\n58 59 1\n17 18 1\n67 68 1\n21 22 1\n80 81 1\n35 36 1\n8 9 1\n83 84 1\n44 45 1\n62 63 1\n64 65 1\n72 73 1\n27 28 1\n56 57 1\n12 13 1\n40 41 1\n32 33 1\n52 53 1\n70 71 1\n97 98 1\n37 38 1\n87 88 1\n46 47 1\n89 90 1\n4 5 1\n...
code_stdio
[ { "content": "The only difference between the easy and hard versions are the locations you can teleport to.\n\nConsider the points $0,1,\\dots,n+1$ on the number line. There is a teleporter located on each of the points $1,2,\\dots,n$. At point $i$, you can do the following:\n\nMove left one unit: it costs $1$ ...
[{"input": "1\n100 123\n398 282 403 364 468 174 143 360 217 340 354 195 84 253 114 421 494 370 104 214 149 469 446 362 108 106 115 402 253 461 483 59 365 94 281 84 248 321 228 196 96 360 321 357 151 250 496 207 425 397 114 345 252 489 30 345 182 310 440 392 111 361 49 307 328 84 201 339 351 459 372 50 72 223 246 215 46...
code_stdio
[ { "content": "Since I got tired to write long problem statements, I decided to make this problem statement short. For given positive integer L, how many pairs of positive integers a, b (a ≀ b) such that LCM(a, b) = L are there? Here, LCM(a, b) stands for the least common multiple of a and b.\n\nConstraints\n\n*...
[{"input": "12\n7\n24\n0", "output": "8\n2\n11\n"}, {"input": "12\n11\n2\n0", "output": "8\n2\n2\n"}, {"input": "12\n15\n2\n0", "output": "8\n5\n2\n"}, {"input": "12\n11\n4\n0", "output": "8\n2\n3\n"}, {"input": "12\n15\n1\n0", "output": "8\n5\n1\n"}, {"input": "12\n16\n4\n0", "output": "8\n5\n3\n"}, {"input": "12\n11\...
code_stdio
[ { "content": "Min Element\n\nGiven the sequence a_1, a_2, .., a_N.\n\nFind the minimum number in this sequence.\n\nIf the minimum value is in more than one place, answer the one with the lowest number.\n\ninput\n\n\nN\na_1 a_2 ... a_N\n\n\noutput\n\nOutput the smallest i such that a_i is the minimum value in th...
[{"input": "6\n10 17 3 2 6 -1", "output": "6\n"}, {"input": "6\n3 33 0 2 10 -1", "output": "6\n"}, {"input": "6\n3 55 0 2 10 -1", "output": "6\n"}, {"input": "6\n3 55 0 4 10 -1", "output": "6\n"}, {"input": "6\n10 59 0 0 10 1", "output": "3\n"}, {"input": "6\n10 37 0 0 10 1", "output": "3\n"}, {"input": "6\n10 60 0 0 1...
code_stdio
[ { "content": "Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called \"chizhik\". One has to pay in chizhiks to buy a coconut now.\n\nSasha and Masha are about to buy some coconuts which are sold at ...
[{"input": "500000000000000000 500000000000000000 1000000000000000000\n", "output": "1 500000000000000000\n"}, {"input": "500000000000000000 500000000000000000 1000000000000000000\n", "output": "1 500000000000000000\n"}, {"input": "350919308160677995 916982339945800203 1000000000000001000\n", "output": "1 8301766005420...
code_stdio
[ { "content": "Vasya claims that he had a paper square. He cut it into two rectangular parts using one vertical or horizontal cut. Then Vasya informed you the dimensions of these two rectangular parts. You need to check whether Vasya originally had a square. In other words, check if it is possible to make a squa...
[{"input": "3\n2 3\n3 1\n3 2\n1 3\n3 3\n1 3\n", "output": "Yes\nYes\nNo\n"}, {"input": "3\n2 3\n3 1\n3 2\n1 3\n3 6\n1 3\n", "output": "Yes\nYes\nNo\n"}, {"input": "3\n2 3\n3 1\n3 2\n1 3\n3 6\n1 0\n", "output": "Yes\nYes\nNo\n"}, {"input": "3\n2 3\n3 1\n3 2\n1 3\n3 3\n1 3\n", "output": "Yes\nYes\nNo\n"}, {"input": "3\n2...
code_stdio
[ { "content": "In the advanced algorithm class, n2 students sit in n rows and n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right hand. What is the height of the ...
[{"input": "3\n1 2 5\n11 3 6\n12 5 9\n3\n1 11 3\n13 11 14\n4 8 6\n0", "output": "5\n11\n"}, {"input": "3\n2 1 3\n4 2 11\n7 0 4\n3\n1 4 12\n14 10 18\n4 8 10\n0", "output": "2\n10\n"}, {"input": "3\n1 2 10\n11 3 6\n12 9 15\n3\n1 11 3\n13 11 9\n7 8 1\n0", "output": "9\n9\n"}, {"input": "3\n2 1 3\n4 2 1\n7 -1 4\n3\n0 4 12\...
code_stdio
[ { "content": "You are given $n$ positive integers $a_1, \\ldots, a_n$, and an integer $k \\geq 2$. Count the number of pairs $i, j$ such that $1 \\leq i < j \\leq n$, and there exists an integer $x$ such that $a_i \\cdot a_j = x^k$.\n\n\n-----Input-----\n\nThe first line contains two integers $n$ and $k$ ($2 \\...
[{"input": "100 3\n94 94 149 27 80 73 61 38 34 139 72 96 59 36 113 15 83 78 39 22 21 57 54 20 9 32 81 64 55 90 67 41 18 57 93 76 44 62 77 66 31 70 39 73 81 57 43 31 20 104 62 26 44 26 23 23 66 53 3 14 10 170 53 19 43 81 98 12 91 15 122 90 89 86 58 30 67 73 46 69 68 47 30 7 89 35 17 93 45 6 4 23 73 36 10 34 73 25 45 27\...
code_stdio
[ { "content": "You are given a regular polygon with $n$ vertices labeled from $1$ to $n$ in counter-clockwise order. The triangulation of a given polygon is a set of triangles such that each vertex of each triangle is a vertex of the initial polygon, there is no pair of triangles such that their intersection has...
[{"input": "500\n", "output": "41666498\n"}, {"input": "497\n", "output": "40920990\n"}, {"input": "494\n", "output": "40184428\n"}, {"input": "491\n", "output": "39456758\n"}, {"input": "488\n", "output": "38737926\n"}, {"input": "485\n", "output": "38027878\n"}, {"input": "482\n", "output": "37326560\n"}, {"input": "...
code_stdio
[ { "content": "A binary string is a string that consists of characters $0$ and $1$. A bi-table is a table that has exactly two rows of equal length, each being a binary string.\n\nLet $\\operatorname{MEX}$ of a bi-table be the smallest digit among $0$, $1$, or $2$ that does not occur in the bi-table. For example...
[{"input": "4\n7\n0001000\n1101100\n5\n01001\n10110\n2\n01\n01\n6\n010000\n011111\n", "output": "10\n10\n2\n10\n"}, {"input": "4\n7\n0101000\n1100100\n5\n01100\n10101\n2\n01\n01\n6\n000100\n111111\n", "output": "10\n8\n2\n10\n"}, {"input": "4\n7\n0001000\n1101100\n5\n01001\n10101\n2\n01\n01\n6\n010000\n001111\n", "outp...
code_stdio
[ { "content": "A tutorial for this problem is now available on our blog. Click here to read it. \n\nYou are asked to calculate factorials of some small positive integers.\n\n------ Input ------ \n\nAn integer t, 1≀t≀100, denoting the number of testcases, followed by t lines, each containing a single integer n, ...
[{"input": "4\n1\n2\n4\n57", "output": "1\n2\n24\n40526919504877216755680601905432322134980384796226602145184481280000000000000\n"}, {"input": "4\n5\n3\n10\n29", "output": "120\n6\n3628800\n8841761993739701954543616000000\n"}, {"input": "4\n5\n4\n4\n29", "output": "120\n24\n24\n8841761993739701954543616000000\n"}, {"in...
code_stdio
[ { "content": "There are N people, conveniently numbered 1 through N.\nWe want to divide them into some number of groups, under the following two conditions:\n - Every group contains between A and B people, inclusive.\n - Let F_i be the number of the groups containing exactly i people. Then, for all i, either F_...
[{"input": "1000 1 1000 1 1000\n", "output": "465231251\n"}, {"input": "1000 1 1000 2 1000", "output": "860178665\n"}, {"input": "1000 1 1000 3 1000", "output": "980205027\n"}, {"input": "1000 1 1000 1 1001", "output": "465231251\n"}, {"input": "1000 1 1001 5 1010", "output": "354813907\n"}, {"input": "1000 1 1000 3 10...
code_stdio
[ { "content": "Today in the scientific lyceum of the Kingdom of Kremland, there was a biology lesson. The topic of the lesson was the genomes. Let's call the genome the string \"ACTG\".\n\nMaxim was very boring to sit in class, so the teacher came up with a task for him: on a given string $s$ consisting of upper...
[{"input": "50\nROWGGKNUITVHOBMKZXOZNBZMQGSFERNCZDFKLRBCFVVDXJEFLP\n", "output": "13\n"}, {"input": "50\nALWLSFLXYPQYMIWXMYMXFYMIVFYJDTJAIGVOAUDAIIAHKNNVTX\n", "output": "13\n"}, {"input": "50\nHKKUWHLYYKBLLEHKVNIRYAPVFTAPRIFUZELKGRDXZNCNWHSAFG\n", "output": "14\n"}, {"input": "50\nVKRGXLUWYURTRNGAODFLYCKAPHGPHGDLWIGXE...
code_stdio
[ { "content": "You wrote down all integers from $0$ to $10^n - 1$, padding them with leading zeroes so their lengths are exactly $n$. For example, if $n = 3$ then you wrote out 000, 001, ..., 998, 999.\n\nA block in an integer $x$ is a consecutive segment of equal digits that cannot be extended to the left or to...
[{"input": "2352\n", "output": "388795058 433322746 541969001 523323201 867893102 537695799 837561050 990678065 688882179 577079614 937069914 960273782 761665782 282484628 787581089 314410468 983373531 353249698 130693309 82500826 144964998 247781749 108001361 947489703 358119467 770902487 739563471 529518967 368034134...
code_stdio
[ { "content": "Yaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≀ i, j ≀ n), such that s_{i} > w_{i} and s_{j} < w_{j}. Here sign s_{i} represents the i-th digit of string s, similarly, w_{j} represents the j-th digit of st...
[{"input": "10\n?8?528?91?\n1???60??54\n", "output": "1000000000\n"}, {"input": "10\n?8?258?91?\n1???60??54\n", "output": "1000000000\n"}, {"input": "10\n0????19?01\n????164759\n", "output": "1000000000\n"}, {"input": "10\n219?85??8?\n45??06???1\n", "output": "1000000000\n"}, {"input": "10\n???0?19?01\n957461????\n", "...
code_stdio
[ { "content": "You are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.\nAccording to the regulation, the immigrant should be allowed entry to the kingdom if and only if the ...
[{"input": "100\n768 125 109 300 471 697 999 760 529 42 373 15 59 387 75 823 850 330 756 661 700 610 99 156 367 481 720 588 477 65 513 600 569 531 970 97 456 223 963 625 823 612 421 633 774 529 190 835 245 263 861 456 893 293 762 270 955 457 65 941 787 700 617 813 550 70 807 217 683 935 732 320 815 821 397 445 807 439 ...
code_stdio
[ { "content": "Nearly each project of the F company has a whole team of developers working on it. They often are in different rooms of the office in different cities and even countries. To keep in touch and track the results of the project, the F company conducts shared online meetings in a Spyke chat.\n\nOne da...
[{"input": "100 5\n- 60\n- 58\n+ 25\n- 32\n+ 86\n", "output": "95\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30 31 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 59 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 87 88 89 90 91 92 9...
code_stdio
[ { "content": "There is a 120 minute videotape with standard recording. When I set the VCR counter to 00:00:00 with the tape completely rewound and recorded in standard recording mode, I got a certain counter value. Enter this counter value (hours, minutes, seconds), find the length of the remaining tape (record...
[{"input": "1 36 0\n-1 -1 -1", "output": "00:24:00\n01:12:00\n"}, {"input": "0 30 0\n-1 -1 -1", "output": "01:30:00\n04:30:00\n"}, {"input": "0 32 0\n-1 -1 -1", "output": "01:28:00\n04:24:00\n"}, {"input": "1 16 0\n-1 -1 -1", "output": "00:44:00\n02:12:00\n"}, {"input": "0 36 0\n-1 -1 -1", "output": "01:24:00\n04:12:00...
code_stdio
[ { "content": "The zombies are gathering in their secret lair! Heidi will strike hard to destroy them once and for all. But there is a little problem... Before she can strike, she needs to know where the lair is. And the intel she has is not very good.\n\nHeidi knows that the lair can be represented as a rectang...
[{"input": "10\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0012100000\n0024200000\n0012100000\n0000000000\n", "output": "Yes\n"}, {"input": "10\n0000000000\n0122210000\n0244420100\n0122210000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n0000000000\n", "output": "No\n"}, {"in...
code_stdio
[ { "content": "The start of the new academic year brought about the problem of accommodation students into dormitories. One of such dormitories has a a Γ— b square meter wonder room. The caretaker wants to accommodate exactly n students there. But the law says that there must be at least 6 square meters per stude...
[{"input": "1000000000 1000000000 1000000000\n", "output": "1000000000000000000\n1000000000 1000000000\n"}, {"input": "1000000000 1000000000 1000000000\n", "output": "1000000000000000000\n1000000000 1000000000\n"}, {"input": "1000001000 1000000000 1000000000\n", "output": "1000000000000000000\n1000000000 1000000000\n"}...
code_stdio
[ { "content": "N programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals.\n\nThe preliminary stage consists of several rounds, which will take place as follows:\n\n* All the N contestants will participa...
[{"input": "3\n1 0\n0 10\n7 2", "output": "12\n"}, {"input": "3\n1 0\n0 17\n7 2", "output": "19\n"}, {"input": "3\n1 1\n0 17\n7 2", "output": "20\n"}, {"input": "3\n1 0\n0 27\n7 2", "output": "29\n"}, {"input": "3\n1 1\n0 10\n7 2", "output": "13\n"}, {"input": "3\n1 0\n1 17\n7 2", "output": "21\n"}, {"input": "3\n1 2\n...
code_stdio
[ { "content": "There are n points on the plane, the i-th of which is at (x_i, y_i). Tokitsukaze wants to draw a strange rectangular area and pick all the points in the area.\n\nThe strange area is enclosed by three lines, x = l, y = a and x = r, as its left side, its bottom side and its right side respectively, ...
[{"input": "35\n8 1\n6 8\n4 1\n1 2\n1 4\n5 10\n10 8\n9 1\n9 9\n10 2\n6 5\n8 8\n7 6\n10 6\n9 4\n4 9\n3 2\n1 8\n3 9\n7 3\n3 7\n2 7\n3 8\n3 1\n2 2\n5 5\n7 2\n4 10\n6 3\n5 1\n8 10\n4 3\n9 8\n9 7\n3 10\n", "output": "316"}, {"input": "35\n4 2\n9 6\n3 10\n2 5\n7 9\n6 9\n10 7\n6 6\n5 4\n4 10\n5 9\n8 1\n2 4\n9 9\n5 7\n6 5\n10 ...
code_stdio