messages
listlengths
1
1
ground_truth
stringlengths
88
726k
dataset
stringclasses
1 value
[ { "content": "Solve the following coding problem using the programming language python:\n\nStudents of Winter Informatics School are going to live in a set of houses connected by underground passages. Teachers are also going to live in some of these houses, but they can not be accommodated randomly. For safety ...
[{"type": "stdin_stdout", "input": "5\n8 14\n7 2\n7 1\n2 3\n6 2\n3 4\n6 8\n4 5\n2 4\n7 8\n3 6\n5 6\n5 3\n8 4\n4 1\n9 10\n6 5\n6 9\n5 8\n3 5\n3 2\n9 1\n4 9\n6 2\n9 8\n9 7\n8 14\n3 7\n8 4\n7 6\n1 7\n6 1\n5 2\n4 1\n1 3\n4 5\n5 1\n5 7\n7 2\n2 1\n4 2\n9 13\n8 7\n8 2\n8 4\n9 4\n3 4\n9 3\n1 9\n5 8\n9 7\n3 5\n6 2\n4 5\n4 6\n8 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWinters are just damn freezing cold in Nvodsk! That's why a group of n friends prefers to take a taxi, order a pizza and call girls. The phone numbers in the city consist of three pairs of digits (for example, 12-34-56). ...
[{"type": "stdin_stdout", "input": "10\n5 eeleGlOFWbcnIPPtnll\n55-55-55\n00-00-00\n98-65-32\n76-43-10\n98-76-54\n2 DMBiqRyQJkFvHPJNJp\n28-97-50\n87-64-10\n4 bAfmtnKHohIX\n61-58-93\n77-77-77\n53-17-51\n96-43-10\n3 cDX\n22-22-22\n77-77-77\n63-30-64\n1 HCeHJ\n44-44-44\n6 HgSpfAolwoaBQ\n96-93-53\n98-53-10\n33-33-33\n66-66-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA string s of length n (1 ≀ n ≀ 26) is called alphabetical if it can be obtained using the following algorithm:\n\n * first, write an empty string to s (i.e. perform the assignment s := \"\"); \n * then perform the next...
[{"type": "stdin_stdout", "input": "11\na\nba\nab\nbac\nihfcbadeg\nz\naa\nca\nacb\nxyz\nddcba\n", "output": "YES\nYES\nYES\nYES\nYES\nNO\nNO\nNO\nNO\nNO\nNO\n"}, {"type": "stdin_stdout", "input": "11\na\nba\nab\ncac\nihfcbadeg\nz\nab\nca\nbca\nxyz\nddcba\n", "output": "YES\nYES\nYES\nNO\nYES\nNO\nYES\nNO\nNO\nNO\nNO\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHamming distance between strings a and b of equal length (denoted by h(a, b)) is equal to the number of distinct integers i (1 ≀ i ≀ |a|), such that ai β‰  bi, where ai is the i-th symbol of string a, bi is the i-th symbol ...
[{"type": "stdin_stdout", "input": "5728 5729 5750\n5631 5768\n9163\n", "output": "10321\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA coordinate line has n segments, the i-th segment starts at the position li and ends at the position ri. We will denote such a segment as [li, ri].\n\nYou have suggested that one of the defined segments covers all others...
[{"type": "stdin_stdout", "input": "55\n3 4\n6 8\n9 10\n3 9\n9 9\n2 5\n4 8\n3 8\n8 10\n1 1\n4 9\n10 10\n6 6\n8 8\n1 8\n5 5\n4 5\n5 9\n2 2\n3 10\n4 6\n3 6\n1 6\n1 7\n6 10\n2 6\n3 7\n2 4\n4 4\n5 10\n1 4\n2 9\n1 3\n7 9\n7 8\n1 9\n1 10\n2 8\n8 9\n6 7\n1 2\n6 9\n7 7\n4 7\n3 3\n2 7\n4 10\n7 10\n2 3\n2 10\n5 7\n3 5\n5 8\n1 5\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n \n HAI \n I HAS A TUX \n GIMMEH TUX \n I HAS A FOO ITS 0 \n I HAS A BAR ITS 0 \n I HAS A BAZ ITS 0 \n I HAS A QUZ ITS 1 \n TUX IS NOW A NUMBR \n IM IN YR LOOP NERFIN YR TUX TIL BOT...
[{"type": "stdin_stdout", "input": "9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n", "output": "0.000000\n"}, {"type": "stdin_stdout", "input": "9\n1\n0\n0\n0\n0\n1\n1\n1\n1\n", "output": "1.000000\n"}, {"type": "stdin_stdout", "input": "9\n0\n0\n0\n0\n0\n0\n0\n0\n1\n", "output": "0.111111\n"}, {"type": "stdin_stdout", "input": "9\n1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one...
[{"type": "stdin_stdout", "input": "20 20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"}, {"type": "stdin_stdout", "input": "20 20\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0\n", "output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle Chris is very keen on his toy blocks. His teacher, however, wants Chris to solve more problems, so he decided to play a trick on Chris.\n\nThere are exactly s blocks in Chris's set, each block has a unique number f...
[{"type": "stdin_stdout", "input": "10\n1 100000 199999 299998 399997 499996 599995 699994 799993 899992\n", "output": "10\n1000000 900001 800002 700003 600004 500005 400006 300007 200008 100009 "}, {"type": "stdin_stdout", "input": "10\n1 100000 149136 299998 399997 499996 599995 699994 799993 899992\n", "output": "10...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAndrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players.\n\nGiven a group of n non-empty strings. During the game two players build the word together, initially the word is empty. ...
[{"type": "stdin_stdout", "input": "5 6\nabas\ndsfdf\nabacaba\ndartsidius\nkolobok\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "5 6\nabas\ndsfdf\nabacaba\ndartsidius\nkobolok\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "5 6\nabas\ndsfdf\nabacaba\ndadtsirius\nkolobok\n", "output": "Seco...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nUser ainta has a permutation p1, p2, ..., pn. As the New Year is coming, he wants to make his permutation as pretty as possible.\n\nPermutation a1, a2, ..., an is prettier than permutation b1, b2, ..., bn, if and only if ...
[{"type": "stdin_stdout", "input": "15\n6 1 2 7 9 13 14 8 4 5 3 12 10 15 11\n000100100100100\n000010010010010\n000001001001001\n100000100100100\n010000010010010\n001000001001001\n100100000100100\n010010000010010\n001001000001001\n100100100000100\n010010010000010\n001001001000001\n100100100100000\n010010010010000\n00100...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnya loves to fold and stick. Today she decided to do just that.\n\nAnya has n cubes lying in a line and numbered from 1 to n from left to right, with natural numbers written on them. She also has k stickers with exclamat...
[{"type": "stdin_stdout", "input": "25 16 13326087796\n157576937 627434432 942652043 706432863 631136945 714549755 465703470 663358517 695561723 249240606 833566455 396564536 758483017 253748999 978210764 530023233 193812243 317718202 184788435 892848108 150420430 330992298 780787784 196460118 674015883\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, c...
[{"type": "stdin_stdout", "input": "4 4 4\n1 2\n2 3\n3 4\n1 3\n1 2 3\n1 3 4\n1 2 4\n1 3 2\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 4 2\n1 2\n2 3\n3 4\n1 3\n1 2 3\n1 3 4\n", "output": "4\n1 3 2 3 4\n"}, {"type": "stdin_stdout", "input": "4 4 1\n1 2\n2 3\n3 4\n1 3\n1 3 4\n", "output": "3\n1 2 3 4\n"}, ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are n sharks who grow flowers for Wet Shark. They are all sitting around the table, such that sharks i and i + 1 are neighbours for all i from 1 to n - 1. Sharks n and 1 are neighbours too.\n\nEach shark will grow s...
[{"type": "stdin_stdout", "input": "20 636133251\n999999936 999999937\n999999937 999999938\n999999936 1505993613\n999999937 999999938\n999999936 710191351\n817684461 999999938\n999999936 999999937\n999999937 1039935639\n999999936 999999937\n999999937 999999938\n999999936 392813179\n999999937 999999938\n999999936 999999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOn the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings β€” 5 work days and then 2 days off. Your task is to determine the minimum possible and the ma...
[{"type": "stdin_stdout", "input": "1000000\n", "output": "285714 285715"}, {"type": "stdin_stdout", "input": "677212\n", "output": "193488 193490\n"}, {"type": "stdin_stdout", "input": "435344\n", "output": "124384 124384\n"}, {"type": "stdin_stdout", "input": "390668\n", "output": "111618 111620\n"}, {"type": "stdin_...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive decimal number x.\n\nYour task is to convert it to the \"simple exponential notation\".\n\nLet x = aΒ·10b, where 1 ≀ a < 10, then in general case the \"simple exponential notation\" looks like \"aE...
[{"type": "stdin_stdout", "input": "2206815224318443962208128404511577750057653265995300414539703580103256087275661997018352502651118684\n", "output": "2.206815224318443962208128404511577750057653265995300414539703580103256087275661997018352502651118684E99\n"}, {"type": "stdin_stdout", "input": "11366003383538245834519...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) and '<image>' (square root). Initially, the number 2 is displayed on the screen. There are n + 1 levels in ...
[{"type": "stdin_stdout", "input": "7816\n", "output": "2\n17\n46\n97\n176\n289\n442\n641\n892\n1201\n1574\n2017\n2536\n3137\n3826\n4609\n5492\n6481\n7582\n8801\n10144\n11617\n13226\n14977\n16876\n18929\n21142\n23521\n26072\n28801\n31714\n34817\n38116\n41617\n45326\n49249\n53392\n57761\n62362\n67201\n72284\n77617\n8320...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe input contains a single integer a (1 ≀ a ≀ 30).\n\nOutput\n\nOutput a single integer.\n\nExample\n\nInput\n\n3\n\n\nOutput\n\n27\n\nThe input will be given via stdin and the output should be printed to st...
[{"type": "stdin_stdout", "input": "011\n", "output": "274\n"}, {"type": "stdin_stdout", "input": "010\n", "output": "265\n"}, {"type": "stdin_stdout", "input": "19\n", "output": "454\n"}, {"type": "stdin_stdout", "input": "20\n", "output": "483\n"}, {"type": "stdin_stdout", "input": "13\n", "output": "346\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArpa is researching the Mexican wave.\n\nThere are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0. \n\n * At time 1, the first spectator stands. \n * At time 2, the second specta...
[{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000 1400000000\n", "output": "600000000\n"}, {"type": "stdin_stdout", "input": "1100000000 1000000000 1400000000\n", "output": "700000000\n"}, {"type": "stdin_stdout",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.\n\nSome long and uninteresting story was removed...\n\nThe alphabet of Bookland is so l...
[{"type": "stdin_stdout", "input": "10 10\n8 1 1 6 10 2 2 9 7\n6 2 7 1 9 5 10\n1 5\n7 3 6 9 6 3 7 6\n10 3 9 10 3 6 7 10 6 9 6\n10 4 4 9 8 2 10 3 6 2 9\n8 4 8 6 4 6 4 8 6\n2 7 5\n6 8 6 2 1 9 8\n3 10 2 10\n", "output": "Yes\n3\n1 2 5 \n"}, {"type": "stdin_stdout", "input": "10 10\n8 1 1 6 10 2 2 9 7\n6 2 7 1 9 5 10\n1 5\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVasya writes his own library for building graphical user interface. Vasya called his creation VTK (VasyaToolKit). One of the interesting aspects of this library is that widgets are packed in each other. \n\nA widget is so...
[{"type": "stdin_stdout", "input": "20\nVBox hykl\nVBox enwv\nenwv.pack(hykl)\nVBox dlepf\ndlepf.pack(hykl)\nenwv.set_border(30)\nWidget mjrrik(54,21)\nhykl.set_border(2)\ndlepf.set_border(22)\nenwv.set_border(3)\nenwv.pack(dlepf)\ndlepf.pack(mjrrik)\nhykl.set_spacing(96)\nenwv.set_border(32)\ndlepf.set_border(72)\nWid...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDima is a beginner programmer. During his working process, he regularly has to repeat the following operation again and again: to remove every second element from the array. One day he has been bored with easy solutions o...
[{"type": "stdin_stdout", "input": "12 12\n10\n11\n5\n3\n11\n2\n8\n6\n4\n4\n12\n1\n", "output": "9\n6\n3\n2\n6\n7\n12\n8\n10\n10\n11\n1\n"}, {"type": "stdin_stdout", "input": "12 12\n9\n11\n5\n3\n11\n2\n8\n4\n4\n4\n12\n1\n", "output": "5\n6\n3\n2\n6\n7\n12\n10\n10\n10\n11\n1\n"}, {"type": "stdin_stdout", "input": "12 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLittle girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:\n\n * if the last digit o...
[{"type": "stdin_stdout", "input": "1000000000 0\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1559848638 5\n", "output": "1559848633\n"}, {"type": "stdin_stdout", "input": "1100000000 0\n", "output": "1100000000\n"}, {"type": "stdin_stdout", "input": "1086932676 10\n", "output": "108693264\n"}, {"t...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a vector \\vec{v} = (x, y), define |v| = √{x^2 + y^2}.\n\nAllen had a bit too much to drink at the bar, which is at the origin. There are n vectors \\vec{v_1}, \\vec{v_2}, β‹…β‹…β‹…, \\vec{v_n}. Allen will make n moves. As ...
[{"type": "stdin_stdout", "input": "9\n1000000 0\n0 -999999\n600000 600000\n600000 600000\n600000 600000\n-600000 -600000\n600000 600000\n600000 600000\n-700000 710000\n", "output": "-1 -1 -1 -1 1 -1 -1 1 -1 \n"}, {"type": "stdin_stdout", "input": "9\n1000000 0\n0 -999999\n600000 600000\n600000 600000\n600000 600000\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nToday Oz is playing a new game. He has an array arr[] of N distinct integers . In each turn he is will follow two actions - \n1) He select a random number from arr[]. Say value of this element is X.\n2) He will remove X f...
[{"type": "stdin_stdout", "input": "1\n6\n291 292 295 297 298 299\n\nSAMPLE", "output": "4\n"}, {"type": "stdin_stdout", "input": "1\n6\n291 292 295 297 158 299\n\nSAMPLE", "output": "5\n"}, {"type": "stdin_stdout", "input": "1\n6\n559 292 295 297 158 299\n\nSAMPLE", "output": "6\n"}, {"type": "stdin_stdout", "input": ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProfessor Hatim is researching the sexual behavior of a rare species of lizard. He assumes that they feature two different genders and that they only interact with lizard of the opposite gender. Each lizard has a integer ...
[{"type": "stdin_stdout", "input": "2\n3 3\n1 3\n2 3\n1 3\n4 2\n1 2\n3 4\n\nSAMPLE", "output": "No suspicious lizards found!\nNo suspicious lizards found!\n"}, {"type": "stdin_stdout", "input": "2\n3 3\n1 2\n2 3\n1 3\n4 2\n1 2\n3 4\n\nSAMPLE", "output": "Suspicious lizards found!\nNo suspicious lizards found!\n"}, {"ty...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere is a street by the name of colorful street in the Pretty Town. The residents of the house have decided that they will paint their houses in either Pink, Orange or Yellow color and not other. They have also decided t...
[{"type": "stdin_stdout", "input": "85\n16\n26 706 353\n465 364 754\n744 391 582\n268 741 93\n593 587 575\n998 442 171\n985 965 590\n332 483 101\n791 157 40\n581 717 93\n59 60 724\n609 882 587\n903 287 931\n950 421 469\n879 21 630\n131 214 832\n5\n656 194 278\n290 480 714\n700 316 303\n483 977 1\n333 200 435\n11\n25 80...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nXenny had N cubes. Each cube had six faces and each face had a Latin character on each of it's sides. \nXenny's friend Asdoc had an interesting activity in mind. He gave Xenny a string S and asked him to use the cubes to ...
[{"type": "stdin_stdout", "input": "10 7\nf a b d g a\nc g e f a g\nf c c a c c\nd e e b f e\nf f g g e g\ne c e b d c\nf e d g b b\nf c g f f e\nc c a c d d\nd c a d f d\nfcfdfeffcd", "output": "861144\n"}, {"type": "stdin_stdout", "input": "10 7\nf a b d g a\nc g e g a g\nf c c a c c\nd e e b f e\nf f g g e g\ne c e ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and...
[{"type": "stdin_stdout", "input": "10 4\n17 13 13 12 15 20 10 13 17 11", "output": "32.000000000000"}, {"type": "stdin_stdout", "input": "10 4\n17 21 13 12 15 20 10 13 17 11", "output": "33.5000000000\n"}, {"type": "stdin_stdout", "input": "10 4\n15 21 13 12 15 20 10 13 17 11", "output": "32.5000000000\n"}, {"type": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is going to set a 3-character password.\n\nHow many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?\n\nConstraints\n\n* 1 \\leq N \\leq 9\n* N is an integer.\n...
[{"type": "stdin_stdout", "input": "-109", "output": "-1295029\n"}, {"type": "stdin_stdout", "input": "-61", "output": "-226981\n"}, {"type": "stdin_stdout", "input": "-57", "output": "-185193\n"}, {"type": "stdin_stdout", "input": "-68", "output": "-314432\n"}, {"type": "stdin_stdout", "input": "-95", "output": "-8573...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAn integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.\n\nGiven an integer N, determine whether it is a Harshad number.\n\nConstraints\n\n* 1?N...
[{"type": "stdin_stdout", "input": "112", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "224", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "133", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "162", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "190", "output": "Yes\n"}, {"type": "stdi...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFennec and Snuke are playing a board game.\n\nOn the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reach...
[{"type": "stdin_stdout", "input": "7\n3 6\n2 2\n3 1\n7 4\n5 7\n1 4", "output": "Fennec\n"}, {"type": "stdin_stdout", "input": "7\n3 6\n2 2\n3 1\n7 4\n4 7\n1 4", "output": "Fennec\n"}, {"type": "stdin_stdout", "input": "7\n3 6\n1 2\n3 2\n7 4\n5 7\n1 4", "output": "Fennec\n"}, {"type": "stdin_stdout", "input": "7\n3 6\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSnuke has decided to play a game using cards. He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.\n\nHe will perform the operation described below zero or more times, so that the...
[{"type": "stdin_stdout", "input": "15\n0 -4 1 8 0 1 -1 -25 49 -3 -35 -2 -8 2 -9", "output": "13\n"}, {"type": "stdin_stdout", "input": "15\n1 2 9 -1 0 12 1 -1 1 11 -2 4 13 4 3", "output": "11\n"}, {"type": "stdin_stdout", "input": "15\n1 1 9 -1 0 12 1 -1 0 11 -1 2 13 2 3", "output": "9\n"}, {"type": "stdin_stdout", "i...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCreate a program that outputs the surface area S of a square cone with a height of h, with a square with one side x as the base. However, assume that the line segment connecting the apex and the center of the base is orth...
[{"type": "stdin_stdout", "input": "6\n5\n-1\n2\n0\n0", "output": "105.971422738\n-3.12310562562\n"}, {"type": "stdin_stdout", "input": "6\n5\n14\n4\n0\n0", "output": "105.971422738\n421.743216952\n"}, {"type": "stdin_stdout", "input": "6\n5\n14\n3\n0\n0", "output": "105.971422738\n409.241646964\n"}, {"type": "stdin_st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nA project is underway to build a new viewing tower in Bange town called β€œBange Hills Tower” whose selling point will be the gorgeous view of the entire main keep of Wakamatsu Castle from top to bottom. Therefore, the view...
[{"type": "stdin_stdout", "input": "20 12\n1 11\n7 0\n13 1", "output": "132.000000\n"}, {"type": "stdin_stdout", "input": "29 16\n1 11\n7 0\n23 1", "output": "176.000000\n"}, {"type": "stdin_stdout", "input": "6 19\n-1 -1\n16 2\n4 0", "output": "19.000000\n"}, {"type": "stdin_stdout", "input": "29 11\n1 6\n12 1\n10 1",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time, there was a traveler.\n\nHe plans to travel using stagecoaches (horse wagons). His starting point and destination are fixed, but he cannot determine his route. Your job in this problem is to write a prog...
[{"type": "stdin_stdout", "input": "3 4 3 1 4\n3 1 2\n1 2 10\n2 3 30\n3 4 20\n2 4 4 2 1\n3 1\n2 3 3\n1 1 3\n4 1 2\n4 2 5\n2 4 3 4 1\n5 5\n1 2 10\n2 3 10\n3 4 10\n1 2 0 1 1\n0\n8 5 10 1 5\n2 13 1 8 4 5 6 3\n1 2 5\n3 3 4\n3 4 7\n4 5 3\n1 3 25\n2 4 23\n3 5 22\n1 4 45\n2 5 51\n1 5 99\n0 0 0 0 0", "output": "30.0000000000\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven an undirected weighted graph G, you should find one of spanning trees specified as follows.\n\nThe graph G is an ordered pair (V, E), where V is a set of vertices {v1, v2, ... , vn} and E is a set of undirected edge...
[{"type": "stdin_stdout", "input": "6 5\n1 2 3\n1 3 5\n1 2 6\n2 4 7\n3 4 6\n4 6\n1 2 10\n1 3 100\n1 4 105\n3 3 20\n2 4 70\n3 4 40\n2 1\n1 1 1\n3 0\n3 1\n1 2 1\n6 3\n1 0 2\n2 3 5\n1 3 6\n5 10\n1 2 110\n2 3 138\n1 1 130\n1 5 223\n4 3 110\n2 4 98\n2 9 130\n3 2 120\n3 5 110\n4 5 15\n5 10\n1 2 9384\n1 3 887\n1 5 2778\n1 5 6...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAt University A, there were many mistakes in entering IDs.\nTherefore, University A decided to issue a new ID to prevent typos.\nThere is a way to check if the new ID is correct to prevent typos.\n\n\n\n・ Calculate the su...
[{"type": "stdin_stdout", "input": "15\n2***9*2*6*1199*\n9\n0 1 2 3 4 6 7 8 9", "output": "478297"}, {"type": "stdin_stdout", "input": "5\n5**75\n-1\n-1 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n5**75\n-2\n-1 2", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n5**65\n-2\n-1 2", "output": "0\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGhosts line up in a straight line from left to right with $ N $ people.\nAt first, the $ i $ th ghost from the left is facing left if $ U_i $ is'L', and facing right if it is'R'.\n\nThey are so timid that I don...
[{"type": "stdin_stdout", "input": "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 16\n4 2 16\n1 5 2\n3 5 10", "output": "8\n"}, {"type": "stdin_stdout", "input": "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 16\n4 2 16\n1 2 2\n3 5 10", "output": "8\n"}, {"type": "stdin_stdout", "input": "5 5\nRLRLL\n9 5 1 3 10\n1 3 5\n2 4 16\n4 2 16\n2 2 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given polygon g, computes the area of the polygon.\n\ng is represented by a sequence of points p1, p2,..., pn where line segments connecting pi and pi+1 (1 ≀ i ≀ n-1) are sides of g. The line segment connecting pn a...
[{"type": "stdin_stdout", "input": "4\n-1 -2\n-1 0\n-1 14\n-5 2", "output": "32.0\n"}, {"type": "stdin_stdout", "input": "4\n-1 -2\n-1 0\n-1 17\n-5 2", "output": "38.0\n"}, {"type": "stdin_stdout", "input": "4\n0 -1\n10 -3\n71 0\n0 11", "output": "502.0\n"}, {"type": "stdin_stdout", "input": "4\n0 -4\n-1 0\n-1 14\n-6 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a sequence of integers $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ and rotate specified elements by a list of the following operation:\n\n* rotate($b, m, e$): For each integer $k$ ($0 \\leq k < (e -...
[{"type": "stdin_stdout", "input": "11\n1 2 3 4 5 6 7 16 18 10 11\n1\n2 6 9", "output": "1 2 7 16 18 3 4 5 6 10 11\n"}, {"type": "stdin_stdout", "input": "11\n2 2 1 4 6 16 7 10 32 10 1\n1\n4 6 9", "output": "2 2 1 4 7 10 32 6 16 10 1\n"}, {"type": "stdin_stdout", "input": "11\n2 2 1 4 6 9 10 10 48 10 1\n1\n4 6 9", "out...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings s and t. The string s consists of lowercase Latin letters and at most one wildcard character '*', the string t consists only of lowercase Latin letters. The length of the string s equals n, the l...
[{"type": "stdin_stdout", "input": "5 102\neyw*y\neywsnxcwslfyiqbbeoaawtmioksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdveqguyfk\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5 102\ndyw*y\neywsnxcwslfyiqbbeoaawtmioksfdndptxxcwzfmrpcixjbzvicijofjrbcvzaedglifuoczgjlqylddnsvsjfmfsccxbdv...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are playing a strange game with Li Chen. You have a tree with n nodes drawn on a piece of paper. All nodes are unlabeled and distinguishable. Each of you independently labeled the vertices from 1 to n. Neither of you ...
[{"type": "stdin_stdout", "input": "2\n6\n5 3 2 4 1 6\n1 2\n1 3\n1 4\n4 5\n4 6\n4\n1 3 4 5\n3\n3 5 2\n6\n5 3 2 4 1 6\n1 2\n1 3\n1 4\n4 5\n4 6\n3\n1 2 3\n3\n4 1 6\n", "output": "B 4\nA 4\nC -1\nB 2\nA 1\nC -1\n"}, {"type": "stdin_stdout", "input": "2\n6\n5 3 2 4 1 6\n1 2\n1 3\n1 4\n4 5\n4 6\n4\n1 3 4 5\n3\n3 5 2\n0\n5 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIvan unexpectedly saw a present from one of his previous birthdays. It is array of n numbers from 1 to 200. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its neighbou...
[{"type": "stdin_stdout", "input": "37\n52 52 66 149 149 130 47 47 26 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 -1 92 92 5 25 48 79 79\n", "output": "903952722\n"}, {"type": "stdin_stdout", "input": "37\n52 52 66 149 149 130 47 47 17 110 185 -1 73 73 65 -1 -1 130 -1 -1 -1 94 97 190 -1 -1 49 49 54 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nArkady invited Anna for a dinner to a sushi restaurant. The restaurant is a bit unusual: it offers n pieces of sushi aligned in a row, and a customer has to choose a continuous subsegment of these sushi to buy.\n\nThe pie...
[{"type": "stdin_stdout", "input": "100\n2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 1 1 1 1 1 1 1 1 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": "54\n"}, {"type": "stdin_stdout", "input": "100\n1 2 2 2 2 2 2 2 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of points x_1, x_2, ..., x_n on the number line.\n\nTwo points i and j can be matched with each other if the following conditions hold:\n\n * neither i nor j is matched with any other point; \n * |x_...
[{"type": "stdin_stdout", "input": "100 13\n11 28 21 7 6 23 26 31 26 32 34 17 19 1 13 1 28 30 28 8 23 36 17 20 5 37 32 23 14 1 20 23 3 39 20 14 2 12 15 3 1 27 7 25 15 39 10 6 8 37 6 22 7 29 6 17 17 9 16 3 39 23 2 34 20 12 28 29 32 2 38 27 36 27 29 18 7 14 27 25 33 18 29 40 22 9 9 6 21 7 23 35 33 26 31 31 39 36 27 27\n"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers b and w. You have a chessboard of size 10^9 Γ— 10^9 with the top left cell at (1; 1), the cell (1; 1) is painted white.\n\nYour task is to find a connected component on this chessboard that conta...
[{"type": "stdin_stdout", "input": "1\n417 201\n", "output": "YES\n3 3\n4 3\n5 3\n6 3\n7 3\n8 3\n9 3\n10 3\n11 3\n12 3\n13 3\n14 3\n15 3\n16 3\n17 3\n18 3\n19 3\n20 3\n21 3\n22 3\n23 3\n24 3\n25 3\n26 3\n27 3\n28 3\n29 3\n30 3\n31 3\n32 3\n33 3\n34 3\n35 3\n36 3\n37 3\n38 3\n39 3\n40 3\n41 3\n42 3\n43 3\n44 3\n45 3\n46...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nHanh lives in a shared apartment. There are n people (including Hanh) living there, each has a private fridge. \n\nn fridges are secured by several steel chains. Each steel chain connects two different fridges and is prot...
[{"type": "stdin_stdout", "input": "10\n10 10\n8 9 2 10 3 8 10 9 1 10\n10 10\n3 10 3 13 12 14 3 3 4 4\n10 5\n7 13 10 14 5 12 5 5 7 11\n10 10\n12 13 3 6 12 9 6 6 5 7\n10 10\n4 10 15 13 13 15 9 8 8 14\n10 10\n2 3 8 5 9 7 11 12 7 9\n10 10\n12 15 11 10 1 8 10 3 4 2\n10 5\n8 11 7 14 7 9 5 2 8 9\n10 10\n4 9 9 9 10 4 1 12 13 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp is sad β€” New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands.\n\nThe local store introduced a new service thi...
[{"type": "stdin_stdout", "input": "11\n1000000000 500000000 500000000\n1000000000 500000000 499999999\n1000000000 499999999 499999999\n500000000 1000000000 500000000\n500000000 1000000000 499999999\n499999999 1000000000 499999999\n500000000 500000000 1000000000\n500000000 499999999 1000000000\n499999999 499999999 1000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nCatherine received an array of integers as a gift for March 8. Eventually she grew bored with it, and she started calculated various useless characteristics for it. She succeeded to do it for each one she came up with. Bu...
[{"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 44 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 41 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 115 86 87 88 89 90 91 92 93 94 95 13...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nNastya just made a huge mistake and dropped a whole package of rice on the floor. Mom will come soon. If she sees this, then Nastya will be punished.\n\nIn total, Nastya dropped n grains. Nastya read that each grain weigh...
[{"type": "stdin_stdout", "input": "5\n7 20 3 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1\n", "output": "Yes\nNo\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "5\n7 20 0 101 18\n11 11 10 234 2\n8 9 7 250 122\n19 41 21 321 10\n3 10 8 6 1\n", "output": "NO\nNO\nYES\nNO\nYES\n"}, {"type": "st...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nShubham has an array a of size n, and wants to select exactly x elements from it, such that their sum is odd. These elements do not have to be consecutive. The elements of the array are not guaranteed to be distinct.\n\nT...
[{"type": "stdin_stdout", "input": "4\n3 1\n16 11 12\n10 3\n13 12 9 1 9 8 4 19 16 19\n3 2\n3 2 6\n9 7\n11 14 1 6 3 12 3 20 16\n", "output": "YES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n3 1\n16 11 12\n10 3\n13 12 9 1 9 8 4 19 16 19\n3 2\n3 2 6\n9 7\n11 14 1 6 3 12 3 30 16\n", "output": "YES\nYES\nYES\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nEvery year Santa Claus gives gifts to all children. However, each country has its own traditions, and this process takes place in different ways. For example, in Berland you need to solve the New Year's puzzle.\n\nPolycar...
[{"type": "stdin_stdout", "input": "3\n\n5 2\n2 2\n1 2\n\n10 2\n2 2\n2 3\n\n7 4\n2 1\n2 3\n2 4\n2 10\n", "output": "YES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "3\n\n8 2\n2 2\n1 2\n\n10 2\n2 2\n2 3\n\n7 4\n2 1\n2 3\n2 4\n2 10\n", "output": "YES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "3\n\n5 2\n2 2\n1 2...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have a board represented as a grid with 2 Γ— n cells.\n\nThe first k_1 cells on the first row and first k_2 cells on the second row are colored in white. All other cells are colored in black.\n\nYou have w white domino...
[{"type": "stdin_stdout", "input": "9\n1 1 2\n0 -1\n2 1 2\n0 -1\n2 0 2\n0 1\n0 -1 1\n1 -1\n0 -1 1\n2 0\n0 -1 1\n1 0\n1 -1 -1\n1 -1\n3 -1 1\n0 0\n1 -1 0\n1 0\n", "output": "YES\nYES\nYES\nNO\nNO\nNO\nNO\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "9\n1 1 2\n0 -1\n2 1 2\n1 -1\n2 0 2\n0 1\n0 -1 1\n1 -1\n0 -1 1\n2 0\n0...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nThis is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is limited to 6 β‹… 10^4.\n\nPo...
[{"type": "stdin_stdout", "input": "10111 20\n0\n1\n", "output": "? 1 5056\n? 1 2528\n? 1 3792\n? 1 4424\n? 1 4740\n? 1 4898\n? 1 4977\n? 1 5017\n? 1 5037\n? 1 5047\n? 1 5052\n? 1 5054\n? 1 5055\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 5056\n! 50...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe King of Flatland will organize a knights' tournament! The winner will get half the kingdom and the favor of the princess of legendary beauty and wisdom. The final test of the applicants' courage and strength will be a...
[{"type": "stdin_stdout", "input": "847094637 -152905363 -1000000000 -1000000000\n", "output": "FIRST\n-152905363\n"}, {"type": "stdin_stdout", "input": "-1000000000 1000000000 1230987 17135570\n", "output": "FIRST\n-983588156\n"}, {"type": "stdin_stdout", "input": "547686188 61562151 -496372503 -115242932\n", "output"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's consider one interesting word game. In this game you should transform one word into another through special operations. \n\nLet's say we have word w, let's split this word into two non-empty parts x and y so, that w...
[{"type": "stdin_stdout", "input": "dkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjijdkjij\ndddkikjjidkkidijjjjkkjjikjdikiidijjikikjijjiijdikkjjjiddjjijkkkjkiijijki...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given undirected weighted graph. Find the length of the shortest cycle which starts from the vertex 1 and passes throught all the edges at least once. Graph may contain multiply edges between a pair of vertices an...
[{"type": "stdin_stdout", "input": "15 32\n15 9 8860\n12 4 9045\n12 12 8221\n9 6 8306\n11 14 9052\n13 14 8176\n14 5 8857\n6 8 8835\n3 9 8382\n10 14 8212\n13 13 9061\n2 14 8765\n4 13 9143\n13 13 8276\n13 11 8723\n7 10 8775\n8 15 8965\n15 5 8800\n4 5 9317\n5 13 9178\n1 7 9031\n4 10 9114\n10 4 8628\n9 1 8584\n5 7 8701\n6 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day Ms Swan bought an orange in a shop. The orange consisted of nΒ·k segments, numbered with integers from 1 to nΒ·k. \n\nThere were k children waiting for Ms Swan at home. The children have recently learned about the o...
[{"type": "stdin_stdout", "input": "30 30\n455 723 796 90 7 881 40 736 147 718 560 619 468 363 161 767 282 19 111 369 443 850 871 242 713 789 208 435 135 411\n", "output": "455 1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 20 21 22 23 24 25 26 27 28 29 30 31 \n723 32 33 34 35 36 37 38 39 41 42 43 44 45 46 47 48 49 50 51 5...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nSome large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. \n\nFor...
[{"type": "stdin_stdout", "input": "40\n313 97063\n372 23668\n377 56079\n428 88458\n435 57330\n454 88869\n456 75553\n466 87607\n468 4542\n469 30243\n471 8958\n472 59745\n473 90985\n474 32247\n475 71576\n476 14016\n477 91574\n478 38345\n479 93280\n480 89902\n481 41828\n482 3233\n483 66725\n484 23523\n485 46772\n486 9568...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban β€” an abacus d...
[{"type": "stdin_stdout", "input": "1116434957\n", "output": "-O|OO-OO\n-O|-OOOO\n-O|OOOO-\nO-|OOOO-\nO-|OOO-O\nO-|OOOO-\n-O|O-OOO\nO-|O-OOO\nO-|O-OOO\nO-|O-OOO\n"}, {"type": "stdin_stdout", "input": "1603481361\n", "output": "O-|O-OOO\n-O|O-OOO\nO-|OOO-O\nO-|O-OOO\n-O|OOO-O\nO-|OOOO-\nO-|OOO-O\nO-|-OOOO\n-O|O-OOO\nO-|...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPiegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she thinks it would make a good...
[{"type": "stdin_stdout", "input": "1000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000\n11111111111111111111111111111111111...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nValery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! \n\nHowever, there is no reason for disappointment, as Valery has found anot...
[{"type": "stdin_stdout", "input": "112 1867 1261 1606\n0 7 17 43 67 70 87 112 129 141 148 162 179 180 189 202 211 220 231 247 250 277 308 311 327 376 400 406 409 417 418 444 480 512 514 515 518 547 572 575 578 587 612 617 654 684 701 742 757 761 788 821 825 835 841 843 850 858 869 872 881 936 939 969 970 971 997 1026 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nLet's define the sum of two permutations p and q of numbers 0, 1, ..., (n - 1) as permutation <image>, where Perm(x) is the x-th lexicographically permutation of numbers 0, 1, ..., (n - 1) (counting from zero), and Ord(p)...
[{"type": "stdin_stdout", "input": "84\n83 4 68 34 24 2 48 38 22 51 5 62 31 67 66 53 49 70 9 71 46 41 30 8 50 17 28 79 15 80 32 43 14 74 29 42 81 60 56 65 23 0 77 76 58 78 1 11 37 27 75 35 18 73 54 20 57 33 36 6 61 69 64 55 39 10 3 45 13 26 59 82 21 25 63 52 16 44 47 72 19 12 7 40\n63 41 80 52 36 45 17 69 22 66 37 21 4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFord Prefect got a job as a web developer for a small company that makes towels. His current work task is to create a search engine for the website of the company. During the development process, he needs to write a subro...
[{"type": "stdin_stdout", "input": "10\ncdcddbacdb\naababacabc\n", "output": "8\n7 8\n"}, {"type": "stdin_stdout", "input": "10\ncdcddbacdc\naababacabc\n", "output": "7\n7 8\n"}, {"type": "stdin_stdout", "input": "10\ncdaddbccdc\naababacabc\n", "output": "6\n3 6\n"}, {"type": "stdin_stdout", "input": "10\ncdaddbccdc\na...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nVanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one p...
[{"type": "stdin_stdout", "input": "3+9+3+1+6+4+7+9+5+8+2+6+1+4+4+5+1+7+5+4+6+4+3+1*9+7+7+4+5+2+3+2+6+5+5+8+7+8+2+3*3+8+3+4+9+8*5+9+2+8+2+8+6+6+9+6+4+2+5+3+1+2+6+6+2+4+6+4+2+7+2+7+6+9+9+3+6+7+8+3+3+2+3+7+9+7+8+5+5+5*1+3+2+5+8+5*6+5+4*6+2+5+5+4+9+8+3+5+1+3+1+6+2+2+1+3+2+3+3+3+2+8+3+2+8+8+5+2+6+6+3+1+1+5+5*1+5+7+5+8+4+1*...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of n integers a1, a2, ..., an. \n\nDetermine a real number x such that the weakness of the sequence a1 - x, a2 - x, ..., an - x is as small as possible.\n\nThe weakness of a sequence is defined as...
[{"type": "stdin_stdout", "input": "20\n-16 -23 29 44 -40 -50 -41 34 -38 30 -12 28 -44 -49 15 50 -28 38 -2 0\n", "output": "113.87500000314321\n"}, {"type": "stdin_stdout", "input": "20\n-16 -23 29 44 -40 -50 -41 34 -38 30 -12 28 -44 -49 15 50 -28 38 -4 0\n", "output": "112.6250000000"}, {"type": "stdin_stdout", "input...
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\nInput\n\nThe first line contains three integers x1, y1, r1 ( - 109 ≀ x1, y1 ≀ 109, 1 ≀ r1 ≀ 109) β€” the position of the center and the radius of the first ...
[{"type": "stdin_stdout", "input": "368831644 125127030 959524552\n690900461 -368007601 1000000000\n", "output": "1877639096067727828.62500000000000000000"}, {"type": "stdin_stdout", "input": "808468733 166975547 650132512\n807140196 169714842 655993403\n", "output": "1327864139649690571.00000000000000000000"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nOne day student Vasya was sitting on a lecture and mentioned a string s1s2... sn, consisting of letters \"a\", \"b\" and \"c\" that was written on his desk. As the lecture was boring, Vasya decided to complete the picture...
[{"type": "stdin_stdout", "input": "15 84\n11 9\n3 11\n13 10\n2 12\n5 9\n1 7\n14 4\n14 2\n14 1\n11 8\n1 8\n14 10\n4 15\n10 5\n5 12\n13 11\n6 14\n5 7\n12 11\n9 1\n10 15\n2 6\n7 15\n14 9\n9 7\n11 14\n8 15\n12 7\n13 6\n2 9\n9 6\n15 3\n12 15\n6 15\n4 6\n4 1\n9 12\n10 7\n6 1\n11 10\n2 3\n5 2\n13 2\n13 3\n12 6\n4 3\n5 8\n12 ...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have recently fallen through a hole and, after several hours of unconsciousness, have realized you are in an underground city. On one of your regular, daily walks through the unknown, you have encountered two unusuall...
[{"type": "stdin_stdout", "input": "11\nfghdgrakmnq\n8\nfgh 4\ngh 3\nh 10\nhdg 6\nhdgra 7\nakm 12\nrakm 5\na 15\n3\n", "output": "52\n"}, {"type": "stdin_stdout", "input": "11\nfghdgrakmnq\n8\nfgh 4\ngh 3\nh 10\nhdg 6\nargdh 7\nakm 12\nrakm 5\na 15\n3\n", "output": "52\n"}, {"type": "stdin_stdout", "input": "11\nfghdgr...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nDue to the increase in the number of students of Berland State University it was decided to equip a new computer room. You were given the task of buying mouses, and you have to spend as little as possible. After all, the ...
[{"type": "stdin_stdout", "input": "37 80 100\n31\n901706521 USB\n555265160 PS/2\n547038505 PS/2\n644436873 PS/2\n105558073 USB\n915082057 PS/2\n913113815 USB\n953413471 PS/2\n252912707 PS/2\n830344497 USB\n781593007 USB\n610659875 PS/2\n177755858 PS/2\n496444729 PS/2\n617569418 USB\n304908147 PS/2\n188649950 PS/2\n705...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAnton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale:\n\n\"Once upon a time, there lived an emperor. He was very rich and had much grain. O...
[{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1100000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 999999999999999999\n", "output": "...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal ...
[{"type": "stdin_stdout", "input": "5\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n162133301 999999998 999999998 999999999\n", "output": "899999999100000001\n449999999550000002\n899999999100000001\n449999...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nJohn has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is reachable from any other city....
[{"type": "stdin_stdout", "input": "4\n1 2\n2 3\n3 4\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n1 3\n3 4\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n2 3\n2 4\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "4\n1 4\n2 3\n3 4\n", "output": "24\n"}, {"type": "stdin_std...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining points are located on one side of the OY axis.\n\nInput\n\nThe first line contains a sin...
[{"type": "stdin_stdout", "input": "23\n-1 1\n-1 2\n-2 4\n-7 -8\n-3 3\n-9 -14\n-5 3\n-6 2\n-7 11\n-4 4\n-8 5\n1 1\n-1 -1\n-1 -2\n-2 -4\n-7 8\n-3 -3\n-9 14\n-5 -3\n-6 -2\n-7 -11\n-4 -4\n-8 -5\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "4\n-1000000000 -1000000000\n1000000000 1000000000\n-1000000000 1000000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nPolycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequences [42], [5, 5, 5], [2, 11...
[{"type": "stdin_stdout", "input": "4\n1 1000000000 1000000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4\n1 1000000000 1010000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4\n0 1000000000 1010000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nStatement: Sourav and his friends are in kolkata city and they are\nplanning for a city tour. So, they booked a TUBER cab \n(Stop Giggling). Please help them to find the estimated fare\naccording to the fare evaluator sys...
[{"type": "stdin_stdout", "input": "3\n13 1\n12 0\n18 3\n\nSAMPLE", "output": "184\n170\n248\n"}, {"type": "stdin_stdout", "input": "3\n10 1\n17 0\n15 4\n\nEMPMAS", "output": "148\n230\n214\n"}, {"type": "stdin_stdout", "input": "3\n13 1\n14 0\n18 3\n\nSAMPLE", "output": "184\n194\n248\n"}, {"type": "stdin_stdout", "in...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMahabir loves matrix and likes to rotate things a lot.\n\nToday he is rotating an array in clock-wise direction. He gives you an array of size N X N and an positive integer Q.\n\nEach Q number of integers contains an ang...
[{"type": "stdin_stdout", "input": "3 3\n1 8 5 \n7 14 12 \n4 1 15 \n90\n180\n450\n\nSAMPLE", "output": "4 7 1 \n1 14 8 \n15 12 5 \n\n15 1 4 \n12 14 7 \n5 8 1 \n\n4 7 1 \n1 14 8 \n15 12 5 \n\n"}, {"type": "stdin_stdout", "input": "3 3\n1 8 4 \n7 14 12 \n4 1 15 \n90\n180\n450\n\nSAMPLE", "output": "4 7 1 \n1 14 8 \n15 12...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nShil got an array of N integers as a present on his birthday. But he didn't liked it. Shil wants to make this array beautiful. Shil considers an array A1,A2,A3 . . . AN beautiful if A1 > AN. Inorder to make it beautiful ...
[{"type": "stdin_stdout", "input": "10000\n9384 887 2778 6916 7794 8336 5387 493 6650 1422 2363 28 8691 60 7764 3927 541 3427 9173 5737 5212 5369 2568 6430 5783 1531 2863 5124 4068 3136 3930 9803 4023 3059 3070 8168 1394 8457 5012 8043 6230 7374 4422 4920 3785 8538 6869 4325 8316 4371 6414 3527 6092 8981 9957 1874 6863...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThe Hound and his brother the Mountain are engaged in a fight against each other in King's Landing. At the end of the fight, one dies and the other wins. They both are given a decimal number each in the 8 bit binary repre...
[{"type": "stdin_stdout", "input": "25\n01100000 00000010\n00101011 00110111\n00101100 00000011 \n01000101 10001010\n01010110 10100101\n01000001 11001100\n00101101 11011010\n00101010 10101010\n01010111 10001001\n11011111 10001011\n01110011 00011000\n00110000 10001110\n00001110 01010100\n11010010 11010001\n10111100 1001...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nXsquare loves to play with strings a lot. Today, he has two strings S1 and S2 both consisting of lower case alphabets. Xsquare listed all subsequences of string S1 on a paper and all subsequences of string S2 on a separat...
[{"type": "stdin_stdout", "input": "2\nphackerekarthj\njhakckerearthp\nhello\nbuy\n\n\nSAMPLE", "output": "Yes\nNo\n"}, {"type": "stdin_stdout", "input": "2\nphackerekarthj\njiakckerearthp\nhello\nbuy\n\n\nSAMPLE", "output": "Yes\nNo\n"}, {"type": "stdin_stdout", "input": "2\nphackerekarthj\njiakckerearthp\noellh\nbuy\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nGiven is a positive integer N. Consider repeatedly applying the operation below on N:\n\n* First, choose a positive integer z satisfying all of the conditions below:\n* z can be represented as z=p^e, where p is a prime nu...
[{"type": "stdin_stdout", "input": "1336021909504", "output": "7\n"}, {"type": "stdin_stdout", "input": "1130063570614", "output": "4\n"}, {"type": "stdin_stdout", "input": "1051373943064", "output": "5\n"}, {"type": "stdin_stdout", "input": "1387260696878", "output": "5\n"}, {"type": "stdin_stdout", "input": "10116303...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nTakahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.\nThe problem has N test cases, all of which must be passed to get an AC verdict.\nTakahashi's submission has passed...
[{"type": "stdin_stdout", "input": "-1 -102", "output": "No\n"}, {"type": "stdin_stdout", "input": "-2 -102", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 -2", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-4 -10", "output": "No\n"}, {"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the valu...
[{"type": "stdin_stdout", "input": "4\n13 21 11 26\n-1 30 11 10", "output": "30\n"}, {"type": "stdin_stdout", "input": "4\n13 21 11 26\n-1 19 11 10", "output": "32\n"}, {"type": "stdin_stdout", "input": "4\n13 21 11 26\n-1 15 13 10", "output": "36\n"}, {"type": "stdin_stdout", "input": "4\n13 21 11 19\n-1 30 6 10", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nThree people, A, B and C, are trying to communicate using transceivers. They are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively. Two people can directly communicat...
[{"type": "stdin_stdout", "input": "-1 000 -1 15", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 100 -1 15", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 100 -1 12", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 100 -1 13", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 1...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings s and t consisting of lowercase English letters and an integer L.\n\nWe will consider generating a string of length L by concatenating one or more copies of s and t. Here, it is allowed to use th...
[{"type": "stdin_stdout", "input": "8\ncoding\nfestiual", "output": "festiual\n"}, {"type": "stdin_stdout", "input": "8\ngnicoc\nfisteual", "output": "fisteual\n"}, {"type": "stdin_stdout", "input": "8\ngoicdm\neisteual", "output": "eisteual\n"}, {"type": "stdin_stdout", "input": "8\nmdciog\nlauetsie", "output": "lauet...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWe will call a string that can be obtained by concatenating two equal strings an even string. For example, `xyzxyz` and `aaaaaa` are even, while `ababab` and `xyzxy` are not.\n\nYou are given an even string S consisting o...
[{"type": "stdin_stdout", "input": "akasakaakasakasaka`kas", "output": "14\n"}, {"type": "stdin_stdout", "input": "akasakaakasakasakb`kas", "output": "14\n"}, {"type": "stdin_stdout", "input": "akasakaakasakasakaakas", "output": "14"}, {"type": "stdin_stdout", "input": "akakasaakasakasakaakas", "output": "4\n"}, {"type...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou have an integer variable x. Initially, x=0.\n\nSome person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by ...
[{"type": "stdin_stdout", "input": "7\nIIDDIDD", "output": "2\n"}, {"type": "stdin_stdout", "input": "7\nDIDDIID", "output": "0\n"}, {"type": "stdin_stdout", "input": "7\nIIIDDDD", "output": "3\n"}, {"type": "stdin_stdout", "input": "7\nDIIDDID", "output": "1\n"}, {"type": "stdin_stdout", "input": "7\nDIIDIDD", "output...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nMr. Takahashi has a string s consisting of lowercase English letters. He repeats the following operation on s exactly K times.\n\n* Choose an arbitrary letter on s and change that letter to the next alphabet. Note that th...
[{"type": "stdin_stdout", "input": "codefestival\n101", "output": "aaaafeaaiaal\n"}, {"type": "stdin_stdout", "input": "cdoeffstival\n101", "output": "aaaaffaaiaal\n"}, {"type": "stdin_stdout", "input": "cdoeffstival\n111", "output": "aaaaafativam\n"}, {"type": "stdin_stdout", "input": "lavitsffeodc\n111", "output": "a...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n<image>\n\n\nYou know the merry-go-round in the amusement park. Vehicles such as horses and carriages are fixed on a large disk, and it is a standard playset that the vehicle swings up and down at the same time as the dis...
[{"type": "stdin_stdout", "input": "0 3 1 1 0 -1 -1 2\n1 1 5 3 -1 3 0 -1", "output": "1 4 1 2 1 2 1 4\n1 2 1 4 1 4 1 2\n"}, {"type": "stdin_stdout", "input": "0 2 0 1 0 -1 -1 2\n1 1 5 3 -1 3 0 -1", "output": "1 2 1 2 1 4 1 4\n1 2 1 4 1 4 1 2\n"}, {"type": "stdin_stdout", "input": "0 2 1 1 0 -1 -1 2\n1 1 5 3 -1 0 0 -1",...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn Square Town, where many people who love squares live, a festival is held to color the town with illuminations that combine square lightning boards. This electric board emits light when electricity is applied, and the p...
[{"type": "stdin_stdout", "input": "3\n1\n0 -1 0 1 1 1 1 -1\n2\n0 0 0 1 1 1 1 0\n100 100 100 200 200 200 200 100\n2\n0 0 0 100 100 100 100 0\n10 10 10 11 20 20 20 10\n2\n1\n30 40 40 50 40 20 20 10\n1\n30 40 40 50 40 20 20 10\n0", "output": "1\n2\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "3\n1\n-1 0 -1 1 1 1 1 -1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nIn 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...
[{"type": "stdin_stdout", "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"}, {"type": "stdin_stdout", "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"}, {"type": "stdin_stdout", "input": "3\n1 2 10\n11 3 6\n12 9 15\n3\n1 11 3\n13 11 9\n7 8 1\...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nThe International Clown and Pierrot Competition (ICPC), is one of the most distinguished and also the most popular events on earth in the show business.\n\nOne of the unique features of this contest is the grea...
[{"type": "stdin_stdout", "input": "3\n1000\n342\n-1\n5\n-1\n2\n18\n11\n932\n5\n420\n1100\n0\n200\n685\n8\n353\n143\n402\n274\n283\n31\n402\n523\n0", "output": "342\n10\n435\n309\n"}, {"type": "stdin_stdout", "input": "3\n1000\n342\n0\n5\n2\n2\n11\n11\n932\n5\n148\n1000\n0\n200\n400\n8\n353\n242\n1097\n274\n283\n107\n4...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nI started a part-time job at the rental DVD shop \"NEO\". First of all, I decided to study the fee system of this store.\n\nThere are three types of rental DVDs, old, semi-new, and new, and the rental fee for o...
[{"type": "stdin_stdout", "input": "135 100 340 4 200\n1 1 4\n70 100 351 5 200\n0 1 3\n70 100 340 6 343\n1 1 3\n0 0 0 0 0", "output": "1035\n1000\n1190\n"}, {"type": "stdin_stdout", "input": "135 100 340 5 200\n1 1 4\n70 100 351 5 200\n0 1 3\n70 100 340 6 343\n1 1 3\n0 0 0 0 0", "output": "1135\n1000\n1190\n"}, {"type"...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAlice wants to send an email to Miku on her mobile phone.\n\nThe only buttons that can be used for input on mobile phones are number buttons. Therefore, in order to input characters, the number buttons are pressed several...
[{"type": "stdin_stdout", "input": "5\n110\n100\n222220\n44033055505550666011011111090666077705550301110\n000555555550000330000444000080000200004440000", "output": ",\n.\nb\nhello, world!\nkeitai\n"}, {"type": "stdin_stdout", "input": "5\n40\n220\n222220\n44033055505550666011011111090666077705550301110\n000555555550000...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nYou are a programmer on the development team for new recording media. This recording medium can be randomly accessed for reading and erasing data. On the other hand, when writing data, access is always performed in order ...
[{"type": "stdin_stdout", "input": "6\nW 0 2\nW 0 2\nD 0\nW 2 1\nR 3\nR 2\n1\nR 1000000000\n0", "output": "-1\n-1\n\n-1\n\n"}, {"type": "stdin_stdout", "input": "6\nW 0 3\nW 0 2\nD 0\nW 2 1\nR 4\nR 1\n1\nR 1000000000\n0", "output": "-1\n-1\n\n-1\n\n"}, {"type": "stdin_stdout", "input": "6\nW 0 2\nW 0 2\nD 0\nW 3 1\nR 3...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n8\n-10 0\n-10 5\n-5 5\n-5 0\n10 0\n10 -5\n5 -5\n5 0\n\n\nOutput\n\n50\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing...
[{"type": "stdin_stdout", "input": "8\n-18 1\n-10 2\n-10 8\n-27 -1\n11 0\n22 -5\n4 -8\n5 0", "output": "137\n"}, {"type": "stdin_stdout", "input": "8\n-18 1\n-10 2\n-10 8\n-27 -1\n11 0\n22 -7\n4 -8\n5 0", "output": "144\n"}, {"type": "stdin_stdout", "input": "8\n-18 1\n-10 2\n-10 8\n-7 -1\n11 0\n22 -14\n4 -8\n5 0", "ou...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nI: Ravage\n\nSanta Claus was caught in the illuminations of the city and broke it.\n\nThere are N light bulbs in the illumination, and the $ i $ th light bulb only comes on when the voltage is above $ A_i $ and below $ B_...
[{"type": "stdin_stdout", "input": "4\n-1 2\n3 2\n-1 4\n-1 15", "output": "3\n"}, {"type": "stdin_stdout", "input": "4\n-4 2\n0 10\n3 7\n-2 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "4\n-4 2\n0 10\n3 2\n-2 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "4\n-4 2\n0 10\n3 2\n-4 2", "output": "3\n"}...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nWrite a program which prints the central coordinate ($cx$,$cy$) and the radius $r$ of a incircle of a triangle which is constructed by three points ($x_1$, $y_1$), ($x_2$, $y_2$) and ($x_3$, $y_3$) on the plane surface.\n...
[{"type": "stdin_stdout", "input": "1 -2\n3 2\n-2 0", "output": "0.53907943898209422325 -0.26437392711448356856 1.18845545916395465278"}, {"type": "stdin_stdout", "input": "0 3\n4 0\n0 0", "output": "1.00000000000000000000 1.00000000000000000000 1.00000000000000000000"}, {"type": "stdin_stdout", "input": "1 6\n-1 -3\n-...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nFor a given sequence $A = \\\\{a_0, a_1, ..., a_{n-1}\\\\}$ which is sorted by ascending order, find the lower bound for a specific value $k$ given as a query.\n\n* lower bound: the place pointing to the first element gre...
[{"type": "stdin_stdout", "input": "4\n-1 0 -1 3\n14\n0\n23\n2", "output": "3\n4\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n3\n"}, {"type": "stdin_stdout", "input": "4\n5 0 1 0\n12\n3\n23\n-2", "output": "4\n4\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n-2 1 0 20\n10\n7\n4\n-1", "output": "3\n3\n1\n...
code_stdio
[ { "content": "Solve the following coding problem using the programming language python:\n\nAs we all know, F.C. Barcelona is the best soccer team of our era! Their entangling and mesmerizing game style usually translates into very high ball possession, consecutive counter-attack plays and goals. Lots of goals, ...
[{"type": "stdin_stdout", "input": "2\n28 3\n8 2", "output": "198073708\n86\n"}, {"type": "stdin_stdout", "input": "2\n28 3\n8 1", "output": "198073708\n1\n"}, {"type": "stdin_stdout", "input": "2\n28 3\n8 0", "output": "198073708\n0\n"}, {"type": "stdin_stdout", "input": "2\n16 3\n8 2", "output": "10761681\n86\n"}, {"...
code_stdio