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\nIn Berland a bus travels along the main street of the capital. The street begins from the main square and looks like a very long segment. There are n bus stops located along the street, the i-th of them is located at the ... | [{"type": "stdin_stdout", "input": "6\n2 3 5 7 9 11\n11\n1 2 2 3 3 4 4 5 5 5 6\n", "output": " 18\n"}, {"type": "stdin_stdout", "input": "6\n2 3 5 7 11 13\n9\n1 2 2 3 3 4 5 5 6\n", "output": " 16\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the spirit of the holidays, Saitama has given Genos two grid paths of length n (a weird gift even by Saitama's standards). A grid path is an ordered sequence of neighbouring squares in an infinite grid. Two squares are... | [{"type": "stdin_stdout", "input": "200\nNESENEESEESWWWNWWSWSWNWNNWNNESWSWNNWNWNENESENNESSWSESWWSSSEEEESSENNNESSWWSSSSESWSWWNNEESSWWNNWSWSSWWNWNNEENNENWWNESSSENWNESWNESWNESEESSWNESSSSSESESSWNNENENESSWWNNWWSWWNESEENWWWWNWWNWWNENESESSWWSWWSES\nNWNESESSENNNESWNWWSWWWNWSESSSWWNWWNNWSENWSWNENNNWWSWWSWNNNESWWWSSESSWWWSSENWSE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFamil Door wants to celebrate his birthday with his friends from Far Far Away. He has n friends and each of them can come to the party in a specific range of days of the year from ai to bi. Of course, Famil Door wants to ... | [{"type": "stdin_stdout", "input": "40\nM 55 363\nF 117 252\nM 157 282\nF 322 345\nM 330 363\nF 154 231\nF 216 352\nF 357 365\nM 279 292\nF 353 359\nF 82 183\nM 78 297\nM 231 314\nM 107 264\nF 34 318\nM 44 244\nF 42 339\nM 253 307\nM 128 192\nF 119 328\nM 135 249\nF 303 358\nF 348 352\nF 8 364\nF 126 303\nM 226 346\nF ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: \n\n * ti < ti + 1 for each odd i < n; \n * ti > ti + 1 for each even i < n. \n... | [{"type": "stdin_stdout", "input": "50\n11836 28308 72527 92281 139289 93797 134555 148444 40866 111317 21564 87813 65466 20541 99238 2287 74647 128071 18163 61672 39766 55589 138385 147443 138100 142683 60703 15444 52566 72976 147412 116006 115986 110545 79993 100440 9876 71470 75209 62443 64906 88987 72232 2246 63160... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem. In the output section below you will see the information about flushing the output.\n\nBear Limak thinks of some hidden number β an integer from interval [2, 100]. Your task is to say if th... | [{"type": "stdin_stdout", "input": "no\nyes\nno\nno\nno\n", "output": "2\n3\n5\n7\n11\n13\n17\n19\n23\n29\n31\n37\n41\n43\n47\n4\n9\n25\n49\nprime\n"}, {"type": "stdin_stdout", "input": "no\nyse\nno\nno\nno\n", "output": "2\n3\n5\n7\n11\n13\n17\n19\n23\n29\n31\n37\n41\n43\n47\n4\n9\n25\n49\nprime\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has the square chessboard of size n Γ n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.\n\nThe cell of the field is under rook's attack, if there... | [{"type": "stdin_stdout", "input": "500 43\n176 85\n460 171\n233 260\n73 397\n474 35\n290 422\n309 318\n280 415\n485 169\n106 22\n355 129\n180 301\n205 347\n197 93\n263 318\n336 382\n314 350\n476 214\n367 277\n333 166\n500 376\n236 17\n94 73\n116 204\n166 50\n168 218\n144 369\n340 91\n274 360\n171 360\n41 251\n262 478\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the ... | [{"type": "stdin_stdout", "input": "80 63\n17 59 54 75 131 69 69 67 62 77 65 78 54 69 59 73 68 57 65 54 66 46 68 68 11 65 72 39 62 63 53 78 72 62 78 34 74 68 78 35 79 60 64 56 73 76 66 44 43 69 74 75 44 66 71 78 41 75 71 77 59 56 78 52 61 64 64 53 79 34 79 79 65 45 79 67 65 78 68 74\n", "output": "1 43\n17 1 2 3 4 5 6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHongcow likes solving puzzles.\n\nOne day, Hongcow finds two identical puzzle pieces, with the instructions \"make a rectangle\" next to them. The pieces can be described by an n by m grid of characters, where the charact... | [{"type": "stdin_stdout", "input": "1 500\n.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. ... | [{"type": "stdin_stdout", "input": "8 10\n100\n200\n300\n400\n500\n600\n700\n800\n900\n1000\n", "output": "11\n13\n14\n15\n16\n16\n17\n18\n19\n20\n"}, {"type": "stdin_stdout", "input": "8 10\n100\n200\n300\n400\n500\n600\n700\n862\n900\n1000\n", "output": "11\n13\n14\n15\n16\n16\n17\n19\n19\n20\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA positive integer number n is written on a blackboard. It consists of not more than 105 digits. You have to transform it into a beautiful number by erasing some of the digits, and you want to erase as few digits as possi... | [{"type": "stdin_stdout", "input": "53684795681792590016697187295561462737810600000146840941336328677293748561247888801665863139922929397968535048060292988802347668853531069156825523164438370977880256909710958836918627008217572514193873141535365258436916984535972865113877338591947508645026570682995314540038481160747606... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSagheer is playing a game with his best friend Soliman. He brought a tree with n nodes numbered from 1 to n and rooted at node 1. The i-th node has ai apples. This tree has a special property: the lengths of all paths fro... | [{"type": "stdin_stdout", "input": "21\n6194737 6429360 6047962 1014039 9196042 2483033 9232471 5444322 4437778 6614229 4791649 7417126 7679607 790939 3062370 174847 8404336 832859 2083127 9041108 3074902\n1 2 3 4 4 6 7 2 9 10 9 12 12 1 15 1 17 1 19 19\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "23\n795895... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour security guard friend recently got a new job at a new security company. The company requires him to patrol an area of the city encompassing exactly N city blocks, but they let him choose which blocks. That is, your f... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "718351\n", "output": "3392\n"}, {"type": "stdin_stdout", "input": "246206\n", "output": "1986\n"}, {"type": "stdin_stdout", "input": "607443\n", "output": "3118\n"}, {"type": "stdin_stdout", "input": "999999\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Luba bought a very interesting book. She knows that it will take t seconds to read the book. Luba wants to finish reading as fast as she can.\n\nBut she has some work to do in each of n next days. The number of s... | [{"type": "stdin_stdout", "input": "100 1000000\n0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 1 0 0 1 -1 -1 0 0 0 0 0 0 0 1 0 0 0 0 0 -1 -1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 0 0 0 0 -1 0 0 0\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "100 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCarol is currently curling.\n\nShe has n disks each with radius r on the 2D plane. \n\nInitially she has all these disks above the line y = 10100.\n\nShe then will slide the disks towards the line y = 0 one by one in orde... | [{"type": "stdin_stdout", "input": "5 300\n939 465 129 611 532\n", "output": "300 667.8641053432639 1164.9596695962555 1522.2774553276686 2117.0538839123933\n"}, {"type": "stdin_stdout", "input": "5 300\n594 465 129 611 532\n", "output": "300 885.9684291836891 1383.0639934366804 1740.3817791680935 2335.1582077528183\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle walrus Fangy loves math very much. That's why when he is bored he plays with a number performing some operations.\n\nFangy takes some positive integer x and wants to get a number one from it. While x is not equal t... | [{"type": "stdin_stdout", "input": "1000101100110000000001111010110000000010001001111110011011000011101011001001010010111\n", "output": "133\n"}, {"type": "stdin_stdout", "input": "1000101100100000000001111010110000000010001001111110011011000011101011001001010010111\n", "output": "134\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a new order of english alphabets (a to z), that we are not aware of.\nWhat we have though, dictionary of words, ordered according to the new order.\n\nOur task is to give each alphabet a rank, ordered list of wor... | [{"type": "stdin_stdout", "input": "6\naaabc\naaade\nbcad\ncde\ncda\ncca\n\nSAMPLE", "output": "e\na\nb\nd\nc\n"}, {"type": "stdin_stdout", "input": "6\naaabc\naaade\nbacd\ncde\ncda\ncca\n\nSAMPLE", "output": "e\na\nb\nd\nc"}, {"type": "stdin_stdout", "input": "6\naaabc\naaade\ndacb\ncde\ncda\ncca\n\nELPMAS", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFlip the world is a game. In this game a matrix of size N*M is given, which consists of numbers. Each number can be 1 or 0 only.\nThe rows are numbered from 1 to N, and the columns are numbered from 1 to M.\n\nFollowing s... | [{"type": "stdin_stdout", "input": "30\n1 1\n1\n1 1\n0\n4 4\n0000\n1110\n0101\n1011\n4 4\n1100\n0010\n1010\n1101\n4 4\n1111\n1110\n0000\n0100\n4 4\n1000\n1110\n0011\n1110\n4 4\n0011\n0110\n0101\n1000\n4 4\n0010\n0111\n1100\n0100\n4 4\n0100\n1111\n1001\n0000\n4 4\n0001\n0011\n0111\n0100\n4 4\n0111\n1101\n1111\n0101\n4 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike has a huge guitar collection which the whole band is jealous of. Brad, the lead guitarist of the band, gave Mike a challenge so that he can't use all his guitars. The band is on a world tour and Brad told Mike to ass... | [{"type": "stdin_stdout", "input": "3\n2\n0\n14\n-1 -1\n4\n-1 1 2\n\nSAMPKE", "output": "1\n3\n5\n"}, {"type": "stdin_stdout", "input": "3\n1\n8\n2\n-1 -1\n12\n1 2 -1\n\nRAKPME", "output": "2\n3\n5\n"}, {"type": "stdin_stdout", "input": "3\n2\n11\n10\n-1 0\n3\n1 3 0\n\nSAMPKE", "output": "2\n2\n4\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A Γ floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real n... | [{"type": "stdin_stdout", "input": "35 10 3", "output": "10\n"}, {"type": "stdin_stdout", "input": "20 10 3", "output": "6\n"}, {"type": "stdin_stdout", "input": "56 12 1", "output": "4\n"}, {"type": "stdin_stdout", "input": "11 11 9", "output": "9\n"}, {"type": "stdin_stdout", "input": "-2 2 1", "output": "-1\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet us consider a grid of squares with N rows and N columns. You want to put some domino pieces on this grid. Each domino piece covers two squares that have a common side. Each square can be covered by at most one piece.\... | [{"type": "stdin_stdout", "input": "311", "output": "aacd.......................................................................................................................................................................................................................................................................... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if the number of non-negative integers i satisfying the following condition is finite, and find the maximum value of such i if the number is... | [{"type": "stdin_stdout", "input": "aa\naaaaaaa", "output": "-1"}, {"type": "stdin_stdout", "input": "abcabab\nab", "output": "3"}, {"type": "stdin_stdout", "input": "aa\nabaaaaa", "output": "0"}, {"type": "stdin_stdout", "input": "abcaabb\nab", "output": "1"}, {"type": "stdin_stdout", "input": "aa\naaaaaba", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKurohashi has never participated in AtCoder Beginner Contest (ABC).\n\nThe next ABC to be held is ABC N (the N-th ABC ever held). Kurohashi wants to make his debut in some ABC x such that all the digits of x in base ten a... | [{"type": "stdin_stdout", "input": "426", "output": "444\n"}, {"type": "stdin_stdout", "input": "101", "output": "111\n"}, {"type": "stdin_stdout", "input": "638", "output": "666\n"}, {"type": "stdin_stdout", "input": "268", "output": "333\n"}, {"type": "stdin_stdout", "input": "457", "output": "555\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Finite Encyclopedia of Integer Sequences (FEIS), all integer sequences of lengths between 1 and N (inclusive) consisting of integers between 1 and K (inclusive) are listed.\n\nLet the total number of sequences listed i... | [{"type": "stdin_stdout", "input": "0 39", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "0 28", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "13 27", "output": "7 7 7 7 7 7 7 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Tanaka died leaving the orchard of HW Earl. The orchard is divided into H x W plots in the north, south, east, and west directions, and apples, oysters, and oranges are planted in each plot. Mr. Tanaka left such a wil... | [{"type": "stdin_stdout", "input": "10 10\n####*****@\n*#*#@@@@#@\n@##***@@@*\n#****#*@**\n##@*#@@*##\n*@@@@*@@@#\n***#@*@##*\n*@@@*@@##@\n*@*#*@##**\n@****#@@#@\n0 0", "output": "33\n"}, {"type": "stdin_stdout", "input": "10 10\n####*****@\n@#@@@@#*#*\n@##***@@@*\n#****#*@**\n##@*#@@*##\n*@@@@*@@@#\n***#@*@##*\n*@@@*@... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWelcome to PC Koshien, players. This year marks the 10th anniversary of Computer Koshien, but the number of questions and the total score will vary from year to year. Scores are set for each question according to the diff... | [{"type": "stdin_stdout", "input": "1\n2\n-1\n-9\n-1\n2\n-1\n-32\n-1\n1", "output": "-39\n"}, {"type": "stdin_stdout", "input": "1\n2\n0\n-38\n-1\n1\n-1\n-17\n0\n1", "output": "-52\n"}, {"type": "stdin_stdout", "input": "1\n2\n0\n-38\n-1\n1\n-1\n-32\n0\n1", "output": "-67\n"}, {"type": "stdin_stdout", "input": "1\n2\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr .: Peter, do you know \"Yes, I have a number\"?\n\nPeter: I used to do it on TV the other day. You remember something by the number of characters in each word contained in a sentence. \"Yes, I have a number\", so it me... | [{"type": "stdin_stdout", "input": "Yes I have a number\nHow I wish I could calculate an unused bolor for space\nThank you\nEND OF INPUT", "output": "31416\n31415926535\n53\n"}, {"type": "stdin_stdout", "input": "Yes I have a rebmun\nHow I wish I could calculate an unused bolor for space\nThank you\nEND OF INPUT", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJim is planning to visit one of his best friends in a town in the mountain area. First, he leaves his hometown and goes to the destination town. This is called the go phase. Then, he comes back to his hometown. This is ca... | [{"type": "stdin_stdout", "input": "3 6\n3 1\n1 2 1\n2 3 1\n3 3 1\n2 1 1\n1 3 4\n3 1 4\n3 6\n8 1\n1 2 1\n2 3 2\n3 2 1\n2 1 1\n1 3 4\n1 1 4\n4 5\n3 1\n3 1\n2 4 10\n2 3 5\n3 4 9\n4 2 5\n3 2 5\n2 1\n2 1 1\n0 0", "output": "8\n13\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "3 6\n3 1\n1 2 1\n2 3 0\n3 2 2\n2 1 1\n1 3 7\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBackground\n\nThe kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves darts as much as programming. Yu-kun was addicted... | [{"type": "stdin_stdout", "input": "4 3 4 2\n3 1\n0 1\n3 3\n1 5\n4 2\n2 0\n5 0\n4 0\n3 2\n3 3\n4 3\n6 0\n6 10\n4 1\n3 4\n4 4\n5 10\n2 9", "output": "0.7490695671\n"}, {"type": "stdin_stdout", "input": "4 3 4 2\n3 1\n0 1\n3 3\n1 5\n4 2\n3 0\n5 0\n4 0\n3 2\n3 0\n4 3\n6 0\n6 10\n4 1\n3 4\n4 4\n5 10\n2 9", "output": "0.400... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the International System of Units (SI), various physical quantities are expressed in the form of \"numerical value + prefix + unit\" using prefixes such as kilo, mega, and giga. For example, \"3.5 kilometers\", \"5.1 m... | [{"type": "stdin_stdout", "input": "7\n12.729479136172973 kilo metfrt\n0.45 mega sttaw\n0.000000000000000000000001 yotta mrags\n1000000000000000000000000 yocto seconds\n42 amperes\n0.951642419825234 joulfs\n1234.56789012345678901234567890 hecto pascals", "output": "1.2729479136172973 * 10^4 metfrt\n4.5 * 10^5 sttaw\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nH - RLE Replacement\n\nProblem Statement\n\nIn JAG Kingdom, ICPC (Intentionally Compressible Programming Code) is one of the common programming languages. Programs in this language only contain uppercase English letters a... | [{"type": "stdin_stdout", "input": "R 100 L 20 E 10 \\$\nR 5 L 10 \\$\nX 20 \\$", "output": "R 95 X 20 L 10 E 10 \\$"}, {"type": "stdin_stdout", "input": "R 100 K 20 E 10 \\$\nS 1 L 11 \\#\nX 20 \\$", "output": "R 100 K 20 E 10 \\ 0 $\n"}, {"type": "stdin_stdout", "input": "R 100 L 20 D 10 \\$\nS 1 L 11 \\%\nW 20 \\$",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA: four tea\n\nproblem\n\nTea is indispensable for programming contests. Tea has the effect of relieving constant tension [citation needed]\n\nThere are N players participating in the contest, so I would like to prepare t... | [{"type": "stdin_stdout", "input": "10\n1 2 10 2\n0 0 0 15", "output": "2\n"}, {"type": "stdin_stdout", "input": "10\n1 1 3 2\n0 2 3 16", "output": "2\n"}, {"type": "stdin_stdout", "input": "10\n0 1 3 2\n1 2 3 16", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n0 1 6 1\n0 0 1 50", "output": "1\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGag\n\nSegtree has $ N $ of \"gags\", each with a value of $ V_i $.\n\nSegtree decided to publish all the gags in any order.\n\nHere, the \"joy\" you get when you publish the $ i $ th gag to the $ j $ th is expressed as $... | [{"type": "stdin_stdout", "input": "1\n114525", "output": "114524\n"}, {"type": "stdin_stdout", "input": "1\n105905", "output": "105904\n"}, {"type": "stdin_stdout", "input": "1\n196252", "output": "196251\n"}, {"type": "stdin_stdout", "input": "1\n127413", "output": "127412\n"}, {"type": "stdin_stdout", "input": "1\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given array $a_1, a_2, a_3, ... , a_N$ of $N$ elements and $Q$ integers $x_i$ as queries, for each query, print the number of combinations of two integers $(l, r)$ which satisfies the condition: $1 \\leq l \\leq r \... | [{"type": "stdin_stdout", "input": "6 5\n1 2 3 2 7 6\n12 12 12 21 15", "output": "14\n14\n14\n21\n18\n"}, {"type": "stdin_stdout", "input": "6 5\n1 4 3 2 12 6\n10 1 22 25 23", "output": "11\n1\n18\n19\n19\n"}, {"type": "stdin_stdout", "input": "6 5\n1 4 3 2 12 1\n10 1 22 25 23", "output": "11\n2\n20\n21\n21\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of n segments on the axis Ox, each segment has integer endpoints between 1 and m inclusive. Segments may intersect, overlap or even coincide with each other. Each segment is characterized by two intege... | [{"type": "stdin_stdout", "input": "100 100\n1 2\n1 3\n1 3\n2 3\n1 1\n1 2\n1 1\n1 2\n1 3\n1 2\n1 2\n1 5\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 2\n1 1\n1 1\n1 2\n2 2\n1 1\n1 5\n1 4\n1 1\n2 2\n2 9\n1 1\n1 5\n2 3\n2 3\n1 5\n1 2\n2 2\n2 2\n1 2\n1 2\n3 4\n1 5\n1 1\n1 1\n1 1\n1 1\n2 2\n1 3\n1 2\n1 2\n1 2\n1 1\n2 2\n1 4\n1 3\n1 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n blocks, each of them is of the form [color_1|value|color_2], where the block can also be flipped to get [color_2|value|color_1]. \n\nA sequence of blocks is called valid if the touching endpoints of neighb... | [{"type": "stdin_stdout", "input": "40\n2 99891 4\n1 29593 4\n4 12318 1\n1 40460 3\n1 84340 2\n3 33349 4\n3 2121 4\n3 50068 3\n2 72029 4\n4 52319 3\n4 60726 2\n1 30229 1\n3 1887 2\n2 56145 4\n3 53121 1\n2 54227 4\n2 70016 3\n1 93754 4\n4 68567 3\n1 70373 2\n4 52983 3\n2 27467 2\n4 56860 2\n2 12665 2\n3 11282 3\n2 18731... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have unlimited number of coins with values 1, 2, β¦, n. You want to select some set of coins having the total value of S. \n\nIt is allowed to have multiple coins with the same value in the set. What is the minimum num... | [{"type": "stdin_stdout", "input": "100000 1000000000\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "1 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1 1010000000\n", "output": "1010000000\n"}, {"type": "stdin_stdout", "input": "1 1452428327\n", "output": "1452428327\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has a simple graph (that is, a graph without loops or multiple edges) consisting of n vertices and m edges.\n\nThe weight of the i-th vertex is a_i.\n\nThe weight of the i-th edge is w_i.\n\nA subgraph of a graph is... | [{"type": "stdin_stdout", "input": "20 10\n487490574 766859182 860731945 956220596 584871933 815478522 698429627 781975977 485357256 396825095 566947997 680691964 834523631 323163346 665972495 5503804 738797202 410201497 91359028 708811641\n16 15 598574211\n8 7 332007499\n11 1 942159718\n3 1 24779817\n20 4 192862192\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integer numbers.\n\nYou have to color this array in k colors in such a way that: \n\n * Each element of the array should be colored in some color; \n * For each i from 1 to k the... | [{"type": "stdin_stdout", "input": "50 20\n1 1 1 1 1 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\n", "output": "YES\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 2 3 4 5 6 7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSasha and Dima want to buy two n-tier cakes. Each cake should consist of n different tiers: from the size of 1 to the size of n. Tiers should go in order from the smallest to the biggest (from top to bottom).\n\nThey live... | [{"type": "stdin_stdout", "input": "10\n8 8 3 9 7 1 9 6 10 6 4 2 7 3 4 10 5 5 1 2\n", "output": "123\n"}, {"type": "stdin_stdout", "input": "9\n1 3 6 1 4 9 2 8 3 4 8 7 5 7 2 5 9 6\n", "output": "89\n"}, {"type": "stdin_stdout", "input": "8\n4 5 7 8 2 7 6 3 6 1 1 3 5 8 4 2\n", "output": "74\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBertown has n junctions and m bidirectional roads. We know that one can get from any junction to any other one by the existing roads. \n\nAs there were more and more cars in the city, traffic jams started to pose real pro... | [{"type": "stdin_stdout", "input": "21 78\n12 2\n21 13\n17 5\n11 1\n12 17\n12 7\n21 8\n16 18\n3 2\n5 10\n6 7\n13 8\n3 16\n20 7\n16 1\n17 20\n2 13\n21 17\n9 19\n19 11\n12 14\n2 17\n6 12\n6 13\n7 18\n18 13\n3 12\n17 8\n16 19\n21 9\n17 10\n12 16\n8 10\n12 15\n14 13\n5 7\n13 7\n3 5\n4 2\n18 14\n4 5\n19 7\n19 5\n14 7\n5 14\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe legendary Farmer John is throwing a huge party, and animals from all over the world are hanging out at his house. His guests are hungry, so he instructs his cow Bessie to bring out the snacks! Moo!\n\nThere are n snac... | [{"type": "stdin_stdout", "input": "100000 12\n8 11\n1 9\n5 4\n11 12\n7 11\n3 4\n6 5\n12 15\n15 13\n13 14\n7 11\n11 14\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "100000 12\n8 10\n1 9\n5 4\n11 12\n7 11\n3 4\n3 5\n12 15\n15 13\n13 14\n7 8\n11 14\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's introduce some definitions that will be needed later.\n\nLet prime(x) be the set of prime divisors of x. For example, prime(140) = \\{ 2, 5, 7 \\}, prime(169) = \\{ 13 \\}.\n\nLet g(x, p) be the maximum possible int... | [{"type": "stdin_stdout", "input": "1000000000 1000000000000000000\n", "output": "997440007\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000010000000\n", "output": "778038345\n"}, {"type": "stdin_stdout", "input": "1000001001 1000000000010000000\n", "output": "141474221\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[Sakuzyo - Imprinting](https://www.youtube.com/watch?v=55Ca6av1kAY)\n\nA.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, there is a staircase connec... | [{"type": "stdin_stdout", "input": "1\n100 52 99\n51 69 42 32 34 62 12 75 88 18 57 47 40 91 100 81 72 15 26 14 93 68 6 50 5 24 97 52 10 20 54 9 56 39 21 55 7 98 59 87 77 17 29 13 30 46 37 76 71 78 96 82 49 64 84 60 67 19 2 25 85 89 38 41 11 90 35 48 27 28 70 65 66 16 79 3 80 44 36 43 61 99 22 33 86 4 83 94 74 31 73 95 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTired of boring office work, Denis decided to open a fast food restaurant.\n\nOn the first day he made a portions of dumplings, b portions of cranberry juice and c pancakes with condensed milk.\n\nThe peculiarity of Denis... | [{"type": "stdin_stdout", "input": "7\n1 4 1\n0 0 0\n16 0 1\n2 2 2\n2 3 2\n3 2 2\n0 4 4\n", "output": "3\n0\n2\n4\n5\n5\n3\n"}, {"type": "stdin_stdout", "input": "7\n0 1 1\n0 0 0\n11 1 1\n2 2 4\n3 3 3\n4 2 3\n0 6 1\n", "output": "2\n0\n3\n5\n6\n5\n2\n"}, {"type": "stdin_stdout", "input": "7\n1 2 1\n0 0 0\n16 1 1\n2 2 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nYou are given a sequence a consisting of n positive integers.\n\nLet's define a three blocks palindrome as the sequence, consisting of at most two dist... | [{"type": "stdin_stdout", "input": "6\n8\n1 1 2 10 3 2 1 1\n3\n2 4 3\n4\n2 10 11 1\n1\n26\n2\n1 1\n3\n2 1 1\n", "output": "6\n1\n1\n1\n2\n2\n"}, {"type": "stdin_stdout", "input": "6\n8\n1 1 2 2 3 2 1 1\n3\n1 3 3\n4\n1 10 10 1\n1\n26\n2\n2 1\n3\n1 1 1\n", "output": "7\n2\n4\n1\n1\n3\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDue to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the ... | [{"type": "stdin_stdout", "input": "5\n2 1\n1 3\n2 2\n1 3\n5 4\n", "output": "1\n2\n2\n2\n10\n"}, {"type": "stdin_stdout", "input": "2\n461 5299\n118 177\n", "output": "1221420\n10443\n"}, {"type": "stdin_stdout", "input": "2\n461 5299\n176 177\n", "output": "1221420\n15576\n"}, {"type": "stdin_stdout", "input": "5\n5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have n gifts and you want to give all of them to children. Of course, you don't want to offend anyone, so all gifts should be equal between each other. The i-th gift consists of a_i candies and b_i oranges.\n\nDuring ... | [{"type": "stdin_stdout", "input": "5\n3\n3 5 12\n3 2 3\n5\n1 2 3 4 5\n5 4 1 2 1\n3\n1 1 1\n2 2 2\n6\n1 1000000000 1000000000 1000000000 1000000000 1000000000\n1 1 2 1 1 1\n3\n10 24 8\n7 5 4\n", "output": "12\n16\n0\n4999999995\n19\n"}, {"type": "stdin_stdout", "input": "5\n3\n3 5 12\n3 2 3\n5\n1 2 6 4 5\n5 4 1 2 1\n3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome time ago Lesha found an entertaining string s consisting of lowercase English letters. Lesha immediately developed an unique algorithm for this string and shared it with you. The algorithm is as follows.\n\nLesha cho... | [{"type": "stdin_stdout", "input": "ggaaaawwwxxxxxxrrrrrrrrwwwwwwwwggggggggjjusszzzzqqqqqsssssssbbwwwwwwmmmmtttttttvvvvvvvvssssppppppggggsrrrrrrzzzzzzzyyyyyccccccchhhhhhhhjjrrrrhhhhhhhheeeeeeeaaaaaaaiiiiiuuuuuuuvvvvvjjjjjjjjffbbbbbbbbrrrrrllllllllggggggggooooollssvvvvvvvvvvnnnnnnnnuuuuuuuucccccyyyyyyyyyyzzzzzzzkkkkuuuu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the hard version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem.\n\nYou are ... | [{"type": "stdin_stdout", "input": "5\n2 2\n10\n11\n3 3\n011\n101\n010\n4 4\n1111\n0110\n0110\n1111\n5 5\n01011\n11001\n00010\n11011\n10000\n2 3\n011\n101\n", "output": "1\n1 1 2 1 2 2 \n5\n1 2 1 3 2 2 \n2 1 2 2 3 2 \n2 2 3 2 2 3 \n2 2 2 3 3 3 \n3 2 2 3 3 3 \n8\n1 1 1 2 2 1 \n1 3 1 4 2 3 \n2 1 2 2 3 1 \n3 1 4 1 3 2 \n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the easy version of the problem. The only difference is that in this version q = 1. 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 l... | [{"type": "stdin_stdout", "input": "100\n45 21 34 56 15 0 46 59 40 39 78 83 29 77 19 30 60 39 90 64 11 47 10 47 35 79 30 13 21 31 26 68 0 67 52 43 29 94 100 76 16 61 74 34 62 63 4 41 78 31 77 21 90 2 43 70 53 15 53 29 47 87 33 20 23 30 55 57 13 25 19 89 10 17 92 24 47 6 4 91 52 9 11 25 81 14 82 75 46 49 66 62 28 84 88 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordinates [(k - 1)m, (k - 1)m + l], and l < m. Grasshopper Bob starts to jump along the platfor... | [{"type": "stdin_stdout", "input": "1000000 1000000 1000000 999999\n", "output": "1000000000000\n"}, {"type": "stdin_stdout", "input": "615188 948759 924417 924407\n", "output": "183286007415\n"}, {"type": "stdin_stdout", "input": "593287 923881 864740 864733\n", "output": "121078300574\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got table a, consisting of n rows, numbered from 1 to n. The i-th line of table a contains ci cells, at that for all i (1 < i β€ n) holds ci β€ ci - 1. \n\nLet's denote s as the total number of cells of table a, that... | [{"type": "stdin_stdout", "input": "4\n40 40 24 5\n56 14 59 76 92 34 43 96 33 44 72 37 81 27 42 5 7 95 22 4 60 18 61 103 74 84 93 55 3 62 70 82 77 51 86 102 29 67 91 9\n71 53 21 64 17 45 46 101 97 30 109 100 57 16 80 87 28 12 94 23 39 98 32 52 54 10 19 41 90 11 66 65 99 89 40 36 58 20 78 108\n35 88 73 75 104 63 79 31 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPermutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers, each of them doesn't exceed n. We'll denote the i-th element of permutation p as pi. We'll call number n the size or... | [{"type": "stdin_stdout", "input": "1000 900\n", "output": "301804159\n"}, {"type": "stdin_stdout", "input": "1000 998\n", "output": "583666213\n"}, {"type": "stdin_stdout", "input": "1000 700\n", "output": "642759746\n"}, {"type": "stdin_stdout", "input": "1000 500\n", "output": "979041279\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasyaβs elder brother Petya loves playing computer games. In one of his favourite computer games Petya reached the final level where a fight with the boss take place.\n\nWhile playing the game Petya found spell scrolls an... | [{"type": "stdin_stdout", "input": "70 1000 1\n91 2\n43 1\n100 1\n79 2\n26 1\n68 2\n4 2\n64 1\n100 1\n80 2\n20 2\n70 1\n25 1\n99 1\n64 1\n35 2\n60 1\n63 2\n93 1\n40 2\n100 1\n54 1\n100 1\n15 2\n72 1\n28 1\n5 1\n93 1\n100 2\n39 2\n54 2\n100 1\n55 1\n43 1\n20 1\n28 2\n21 1\n100 2\n98 1\n35 1\n12 2\n50 2\n7 2\n7 2\n12 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere always is something to choose from! And now, instead of \"Noughts and Crosses\", Inna choose a very unusual upgrade of this game. The rules of the game are given below:\n\nThere is one person playing the game. Befor... | [{"type": "stdin_stdout", "input": "13\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\nXXXXXXXXXXXX\n", "output": "6 1x12 2x6 3x4 4x3 6x2 12x1 \n6 1x12 2x6 3x4 4x3 6x2 12x1 \n6 1x12 2x6 3x4 4x3 6x2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of the prisoners to a prison located in another city.\n\nFor this reason, he made the n prison... | [{"type": "stdin_stdout", "input": "57 3 9\n4 5 2 7 12 1 1 3 2 9 4 9 0 6 12 5 -1 6 11 1 0 0 -1 3 1 0 5 1 0 31 8 8 0 1 7 3 1 13 4 4 5 1 4 -2 1 7 1 1 1 4 5 1 24 5 1 9 6\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "57 3 9\n4 5 2 7 12 1 1 0 2 9 4 9 0 6 12 5 -1 6 11 1 0 0 -1 3 1 0 5 1 0 31 8 8 0 1 7 3 1 13 4 4 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.\n\nFor example, there is a statement called the \"Go... | [{"type": "stdin_stdout", "input": "1440245\n", "output": "9 1440236\n"}, {"type": "stdin_stdout", "input": "1292186\n", "output": "4 1292182\n"}, {"type": "stdin_stdout", "input": "1805804\n", "output": "4 1805800\n"}, {"type": "stdin_stdout", "input": "1865135\n", "output": "9 1865126\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar.\n\n<image>\n\nSo, if he... | [{"type": "stdin_stdout", "input": "999983\n651224 992349\n803017 393514\n258455 402487\n888310 244420\n", "output": "126531\n"}, {"type": "stdin_stdout", "input": "999983\n420528 808305\n387096 497121\n596163 353326\n47177 758204\n", "output": "548500\n"}, {"type": "stdin_stdout", "input": "999961\n744938 661980\n8459... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.\n\nVitaly... | [{"type": "stdin_stdout", "input": "100 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 0\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n0 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 0\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph that consists of n vertices and m edges. Initially, each edge is colored either red or blue. Each turn a player picks a single vertex and switches the color of all edges incident to it. T... | [{"type": "stdin_stdout", "input": "11 7\n1 2 B\n1 3 R\n3 2 R\n4 5 R\n6 7 R\n8 9 R\n10 11 R\n", "output": "5\n3 4 6 8 10 \n"}, {"type": "stdin_stdout", "input": "11 7\n1 2 B\n1 3 R\n3 2 R\n3 5 R\n6 7 R\n8 9 R\n10 11 R\n", "output": "4\n3 6 8 10 "}, {"type": "stdin_stdout", "input": "11 7\n1 2 B\n1 3 R\n3 2 R\n3 5 R\n6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Mike was very busy with studying for exams and contests. Now he is going to chill a bit by doing some sight seeing in the city.\n\nCity consists of n intersections numbered from 1 to n. Mike starts walking from ... | [{"type": "stdin_stdout", "input": "98\n17 17 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 90 90 90 90 90 90 90 90 90 90 90 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 92 95 95 95 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Vlad is fond of popular computer game Bota-2. Recently, the developers announced the new add-on named Bota-3. Of course, Vlad immediately bought only to find out his computer is too old for the new game and needs t... | [{"type": "stdin_stdout", "input": "100\n955 479 355 759 257 497 690 598 275 446 439 787 257 326 584 713 322 5 253 781 434 307 164 154 241 381 38 942 771 906 240 11 431 478 628 1892 346 74 493 964 455 1105 950 41 585 549 892 687 264 41 487 676 63 453 861 980 620 844 80 907 285 506 772 748 773 743 44 925 529 685 845 313... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and decided to continue their competitions in peaceful game of Credit Cards.\n\nRules of this game are simple: ea... | [{"type": "stdin_stdout", "input": "200\n89017372169770060638462517044634884577600285180365791227828841983192945639410766634962149214165390392679430585962408483864914959904870801002680423351144765728677610509881245693518626747873607530273392\n40898854086720755346440245259380080903151813657455435756392575099352741552156... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nErelong Leha was bored by calculating of the greatest common divisor of two factorials. Therefore he decided to solve some crosswords. It's well known that it is a very interesting occupation though it can be very difficu... | [{"type": "stdin_stdout", "input": "26 26\nabcdefghijklmnopqrstuvwxyz\nffffffffffffffffffffffffff\n", "output": "25\n1 2 3 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 \n"}, {"type": "stdin_stdout", "input": "26 26\nabcdefghijkkmnopqrstuvwxyz\nffffffffffffffffffffffffff\n", "output": "25\n1 2 3 4 5 7 8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEven if the world is full of counterfeits, I still regard it as wonderful.\n\nPile up herbs and incense, and arise again from the flames and ashes of its predecessor β as is known to many, the phoenix does it like this.\n... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000100000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1000000000001000000 1000000000100000000\n", "output": "0\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudents Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order a pizza. In this problem pizza is a circle of some radius. The pizza was delivered already cut into ... | [{"type": "stdin_stdout", "input": "222\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJamie is preparing a Codeforces round. He has got an idea for a problem, but does not know how to solve it. Help him write a solution to the following problem:\n\nFind k integers such that the sum of two to the power of e... | [{"type": "stdin_stdout", "input": "10 19228\n", "output": "Yes\n-10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no ... | [{"type": "stdin_stdout", "input": "100\n6072 8210 6405 1191 2533 8552 7594 8793 2207 8855 7415 6252 3433 2339 5532 3118 3054 5750 3690 9843 3881 1390 936 8611 7099 988 7730 3835 7065 5030 6932 6936 5531 5173 1331 8975 5454 1592 8516 328 1091 4368 8275 6462 8638 4002 5534 113 6295 5960 1688 3668 6604 9632 4214 8687 795... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is a regular participant at programming contests and is already experienced in finding important sentences in long statements. Of course, numbers constraints are important β factorization of a number less than 10000... | [{"type": "stdin_stdout", "input": "2684354990\n", "output": "2684354990\n"}, {"type": "stdin_stdout", "input": "2539579656\n", "output": "2539579656\n"}, {"type": "stdin_stdout", "input": "9663677133\n", "output": "9663677133\n"}, {"type": "stdin_stdout", "input": "6530347911\n", "output": "6530347911\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Arihant has always wanted to be the best Pokemon trainer in this world. And he thinks he has achieved his goal, so he wants to quickly go and meet Professor Oak and verify this fact. But like all Pokemon trainers, ... | [{"type": "stdin_stdout", "input": "10001\n100028 100028 100028 2289 1226 3868 100028 100028 1231 1861 100028 1604 4238 100028 100028 3575 100028 100028 100028 100028 2423 100028 4927 100028 100028 100028 3565 1182 100028 100028 100028 100028 100028 100028 1113 4408 3507 161 1482 2957 2449 100028 100028 1444 3741 10002... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter minting loads of money from innocent people by using the psychic powers (As we saw in the previous question!) - little Jhool managed to woo his girlfriend big Jhool! And now, he's in love - madly, madly in love with... | [{"type": "stdin_stdout", "input": "eeflaegzqpdlxswgunhnlglqhycorbcwdfhclmcrwekkzsvoosmfblljeenwfjyoifcvxihhhbeyhmhlkvtsekeglaovjnsi", "output": "I love you, too!\n"}, {"type": "stdin_stdout", "input": "isnjvoalgekestvklhmhyebhhhixvcfioyjfwneejllbfmsoovszkkewrcmlchfdwcbrocyhqlglnhnugwsxldpqzgealfee", "output": "I love ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSee Russian Translation\n\nIt's a fine sunny afternoon today in California. Looking at the pleasant weather, Sumit is all ready to go out and play with his friend Rohil. Unfortunately, Rohil is down with fever. Seeing tha... | [{"type": "stdin_stdout", "input": "24\nabcd\nabdc\nacbd\nacdb\nadbc\nadcb\nbacd\nbadc\nbcad\nbcda\nbdac\nbdca\ncabd\ncadb\ncbad\ncbda\ncdab\ncdba\ndabc\ndacb\ndbac\ndbca\ndcab\ndcba", "output": "12\n"}, {"type": "stdin_stdout", "input": "24\nabcd\nabdc\nacbd\nacdb\nadbc\nadcb\nbacd\nbadc\nbcad\nbcda\ncadb\nbdca\ncabd\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n* 1 \\leq a \\leq 10\n* a is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\n\na\n\n\nOutput\n\nPrint th... | [{"type": "stdin_stdout", "input": "1109", "output": "1365169019\n"}, {"type": "stdin_stdout", "input": "488", "output": "116452904\n"}, {"type": "stdin_stdout", "input": "762", "output": "443032134\n"}, {"type": "stdin_stdout", "input": "767", "output": "451806719\n"}, {"type": "stdin_stdout", "input": "853", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a tree G with N vertices numbered 1 to N. The i-th edge of G connects Vertex a_i and Vertex b_i.\n\nConsider adding zero or more edges in G, and let H be the graph resulted.\n\nFind the number of graphs H that sat... | [{"type": "stdin_stdout", "input": "19\n2 4\n15 8\n1 16\n1 3\n12 19\n1 18\n7 11\n11 15\n12 9\n1 6\n7 14\n18 2\n13 12\n13 5\n16 13\n7 1\n11 10\n7 17", "output": "78732"}, {"type": "stdin_stdout", "input": "19\n2 4\n15 8\n1 16\n0 3\n12 19\n1 18\n7 11\n11 15\n12 9\n1 6\n7 14\n18 2\n13 12\n13 5\n16 13\n7 1\n11 10\n7 17", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to t... | [{"type": "stdin_stdout", "input": "20\nxxzaffeeeeedfkkkkllq", "output": "10\n"}, {"type": "stdin_stdout", "input": "20\nxfzaffeeeeedxkkkkllq", "output": "11\n"}, {"type": "stdin_stdout", "input": "20\nxfzaffeeeeedxkkkkmlq", "output": "12\n"}, {"type": "stdin_stdout", "input": "20\nxfzaffedeeedxkkkkmlq", "output": "14\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke found a random number generator. It generates an integer between 0 and 2^N-1 (inclusive). An integer sequence A_0, A_1, \\cdots, A_{2^N-1} represents the probability that each of these integers is generated. The int... | [{"type": "stdin_stdout", "input": "4\n337 780 799 18 796 875 331 223 1804 67 268 483 390 565 116 355", "output": "0\n870892872\n738673049\n866136893\n809360917\n134965576\n496873404\n200938352\n392063026\n225113281\n769068776\n945265000\n612087551\n845908556\n726467732\n606029955\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKenkoooo is planning a trip in Republic of Snuke. In this country, there are n cities and m trains running. The cities are numbered 1 through n, and the i-th train connects City u_i and v_i bidirectionally. Any city can b... | [{"type": "stdin_stdout", "input": "8 12 5 5\n2 8 685087149 1569714306\n6 1 298270585 209942236\n2 4 346080035 234079976\n1 5 131857300 40131411\n1 8 30723332 173476334\n2 6 447829832 706415811\n1 4 181424400 548830121\n4 4 30593148 195056405\n7 8 211146752 588024753\n1 6 127300821 203530153\n3 1 336869679 115858230\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N sticks with negligible thickness. The length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. F... | [{"type": "stdin_stdout", "input": "10\n1 1 2 -3 2 8 1 218 -1 8", "output": "16\n"}, {"type": "stdin_stdout", "input": "10\n0 1 0 -2 4 34 1 34 0 4", "output": "136\n"}, {"type": "stdin_stdout", "input": "10\n-1 2 12 15 3 1 0 18 1 1", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n-2 2 12 1 4 2 1 41 -1 1", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvery 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. Natural... | [{"type": "stdin_stdout", "input": "6 4 3\n11\n6\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 4 3\n11\n9\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 3 3\n7\n6\n2\n13\n17\n5", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 3 3\n7\n6\n2\n13\n10\n6", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N rabbits on a number line. The rabbits are conveniently numbered 1 through N. The coordinate of the initial position of rabbit i is x_i.\n\nThe rabbits will now take exercise on the number line, by performing s... | [{"type": "stdin_stdout", "input": "5\n0 1 3 6 10\n3 10\n2 3 4", "output": "0.0\n3.0\n7.0\n8.0\n10.0"}, {"type": "stdin_stdout", "input": "5\n-1 1 3 -1 17\n3 10\n4 4 3", "output": "-1\n1\n3\n-1\n17\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 2 1 10\n3 10\n2 3 4", "output": "-1\n-2\n7\n7\n10\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a puzzle to complete by combining 14 numbers from 1 to 9. Complete by adding another number to the given 13 numbers.\n\nThe conditions for completing the puzzle are\n\n* You must have one combination of the same ... | [{"type": "stdin_stdout", "input": "3649596966777\n4672433573317\n9118992346175\n9643871425498\n7755542764533\n1133557799246", "output": "2 3 5 8\n1 2 4 5 7\n1 2 3 4 5 6 7 8 9\n7 8 9\n1 2 3 4 6 7 8\n0\n"}, {"type": "stdin_stdout", "input": "3649596966777\n4672433573317\n9118992346175\n9643871425498\n7755542764533\n1079... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDecimal numbers are a common notation system currently in use and use ten symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 to represent all numbers.\n\nBinary numbers are a popular notation in the computer world and use two symbo... | [{"type": "stdin_stdout", "input": "7\n4\n0\n24\n10\n10010\n-1", "output": "13\n10\n0\n120\n22\n2130122\n"}, {"type": "stdin_stdout", "input": "7\n4\n1\n24\n10\n10010\n-1", "output": "13\n10\n1\n120\n22\n2130122\n"}, {"type": "stdin_stdout", "input": "7\n4\n0\n12\n16\n10000\n-1", "output": "13\n10\n0\n30\n100\n2130100\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe appearance of the sun is called \"sunrise\" and the hiding is called \"sunset\". What is the exact time when the sun is on the horizon?\n\nAs shown in the figure below, we will represent the sun as a circle and the ho... | [{"type": "stdin_stdout", "input": "-12 3", "output": "-1\n"}, {"type": "stdin_stdout", "input": "-15 3", "output": "-1\n"}, {"type": "stdin_stdout", "input": "-23 3", "output": "-1\n"}, {"type": "stdin_stdout", "input": "-10 6", "output": "-1\n"}, {"type": "stdin_stdout", "input": "-2 -1", "output": "-1\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs the first step in algebra, students learn quadratic formulas and their factorization. Often, the factorization is a severe burden for them. A large number of students cannot master the factorization; such students cann... | [{"type": "stdin_stdout", "input": "2 5 4\n1 0 1\n10 -7 -1\n2 0 -5\n0 0 0", "output": "Impossible\nImpossible\nImpossible\nImpossible\n"}, {"type": "stdin_stdout", "input": "4 5 2\n1 1 1\n11 -10 0\n1 0 -3\n0 0 0", "output": "Impossible\nImpossible\n11 -10 1 0\nImpossible\n"}, {"type": "stdin_stdout", "input": "4 5 4\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProfessor Pathfinder is a distinguished authority on the structure of hyperlinks in the World Wide Web. For establishing his hypotheses, he has been developing software agents, which automatically traverse hyperlinks and ... | [{"type": "stdin_stdout", "input": "5 6\n/home/ACM/index.html\nlmth.xedni/CPCI/\n/ICPC/general.html\n/ICPC/japanese/index.html\n/ICPC/secret/confidential/2005/index.html\n/home/ACM/\n/ho/e/ICPC/..mACM/\n/ICPC/secret/\n/ICPC/secret/index.html\n/ICPC\n/ICPC/../ICPC/index.html\n/ICPC\n/ICPC/general.html\n/ICPC/japanese/..... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLook for the Winner!\n\nThe citizens of TKB City are famous for their deep love in elections and vote counting. Today they hold an election for the next chairperson of the electoral commission. Now the voting has just bee... | [{"type": "stdin_stdout", "input": "1\nA\n4\nA A B B\n5\nL M N L N\n6\nK K K K K K\n6\nX X X Y Z X\n10\nB A A B A C A C C B\n10\nV U U U U W V W V W\n0", "output": "A 1\nTIE\nTIE\nK 4\nX 5\nA 10\nU 10\n"}, {"type": "stdin_stdout", "input": "1\nA\n4\nA A B B\n5\nL M N L N\n6\nK K K K K K\n6\nX X X Y Z X\n10\nB A A B A C... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInternational Car Production Company (ICPC), one of the largest automobile manufacturers in the world, is now developing a new vehicle called \"Two-Wheel Buggy\". As its name suggests, the vehicle has only two wheels. Qui... | [{"type": "stdin_stdout", "input": "1 1\n180 253 3\n1 1\n180 180 19\n2 10\n694 -351 7\n-24 360 8\n3 2\n100 60 2\n-72 -72 10\n-59 -413 5\n0 0", "output": "-7.91148452\n5.59128446\n0.00000000\n59.69026042\n-16.09771605\n5.86169674\n-6.89851214\n-10.76376689\n"}, {"type": "stdin_stdout", "input": "1 2\n180 253 2\n1 2\n180... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe University of Aizu Elementary School (Aizu University and Small) is famous as one of Japan's leading competition programmer training schools. Of course, it is essential to practice the algorithm even when attending an... | [{"type": "stdin_stdout", "input": "3 9 89\n2 0 2\n1 0 3\n2 1 1\n2 0 3\n0 1 1\n0 1 2\n1 2 3\n0 1 1\n1 0 2", "output": "34\n1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 0\n"}, {"type": "stdin_stdout", "input": "3 9 89\n2 0 2\n1 0 3\n2 1 1\n2 0 3\n0 1 1\n0 1 2\n1 2 3\n0 1 1\n1 0 0", "output": "34\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nIn the headquarter building of ICPC (International Company of Plugs & Connectors), there are $M$ light bulbs and they are controlled by $N$ switches. Each light bulb can be turned on or off by exactly... | [{"type": "stdin_stdout", "input": "3 10 3\n000 0000000000\n110 0000001011\n101 1111111100\n2 6 0\n1 2 0\n2 1 1\n01 1\n11 11 10\n10000000000 10000000000\n11000000000 00000000000\n01100000000 00100000000\n00110000000 00010000000\n00011000000 00001000000\n00001100000 00000100000\n01000110000 00000010000\n00000011000 0000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\njfen\n\nThere is a one-person game to play on the H Γ W board. This game is a game to move 0 or 1 balls in each cell. You were playing this game and found it difficult to move the ball accurately from cell to cell because... | [{"type": "stdin_stdout", "input": "b1/1b\n1 1 1 2\nb5/bbbbbb\n2 4 1 5\nb2b2b/7\n1 0 2 11\n#", "output": "1b/1b\nb3b1/bbb1bb\nb2b2b/7\n"}, {"type": "stdin_stdout", "input": "b1/1b\n1 1 1 2\nb5/bbbbbb\n2 4 1 4\nb2b2b/7\n1 4 2 6\n#", "output": "1b/1b\nb2b2/bbb1bb\nb5b/5b1\n"}, {"type": "stdin_stdout", "input": "b1/1b\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGeneralized leap year\n\nNormally, whether or not the year x is a leap year is defined as follows.\n\n1. If x is a multiple of 400, it is a leap year.\n2. Otherwise, if x is a multiple of 100, it is not a leap year.\n3. O... | [{"type": "stdin_stdout", "input": "3 295 2014\n695\n100\n4\n1 1000 1999\n1\n2 1111 4526\n1\n2\n6 2000 3409\n5\n11\n21\n9\n3\n13\n0 0 0", "output": "414\n1000\n3416\n1159\n"}, {"type": "stdin_stdout", "input": "3 295 2014\n695\n100\n4\n1 1000 1999\n1\n2 1111 4526\n1\n2\n6 2000 3409\n9\n11\n21\n9\n3\n13\n0 0 0", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are $ N $ streetlights on a two-dimensional square of $ W \\ times H $.\nGaccho wants to start with $ (1,1) $ and go to $ (W, H) $.\nGaccho is afraid of dark places, so he only wants to walk in the square... | [{"type": "stdin_stdout", "input": "43 16 2\n4 7\n-1 8\n10 0", "output": "48\n"}, {"type": "stdin_stdout", "input": "19 21 2\n0 3\n-1 11\n1 1", "output": "30\n"}, {"type": "stdin_stdout", "input": "12 31 1\n5 2\n-1 1\n14 0", "output": "36\n"}, {"type": "stdin_stdout", "input": "34 50 1\n9 1\n0 1\n-2 -1", "output": "74\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer and prints sum of its digits.\n\n\n\nInput\n\nThe input consists of multiple datasets. For each dataset, an integer x is given in a line. The number of digits in x does not exceed 10... | [{"type": "stdin_stdout", "input": "123\n158\n1100\n0", "output": "6\n14\n2\n"}, {"type": "stdin_stdout", "input": "123\n181\n1111\n0", "output": "6\n10\n4\n"}, {"type": "stdin_stdout", "input": "123\n418\n1100\n0", "output": "6\n13\n2\n"}, {"type": "stdin_stdout", "input": "123\n418\n1110\n0", "output": "6\n13\n3\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLira is now very keen on compiler development. :) \nShe knows that one of the most important components of a compiler, is its parser.\nA parser is, in simple terms, a software component that processes text, and checks it'... | [{"type": "stdin_stdout", "input": "3\n<<>>\n><\n<>>>", "output": "4\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\n<<>>\n<>\n<>>>", "output": "4\n2\n2\n"}, {"type": "stdin_stdout", "input": "3\n><<>\n<>\n<>>>", "output": "0\n2\n2\n"}, {"type": "stdin_stdout", "input": "3\n><<>\n><\n<>>>", "output": "0\n0\n2\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a beautiful garden of stones in Innopolis.\n\nIts most beautiful place is the n piles with stones numbered from 1 to n.\n\nEJOI participants have visited this place twice. \n\nWhen they first visited it, the numb... | [{"type": "stdin_stdout", "input": "50\n1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\n1000 1000 1000 1000 1000 1000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays a and b of positive integers, with length n and m respectively. \n\nLet c be an n Γ m matrix, where c_{i,j} = a_i β
b_j. \n\nYou need to find a subrectangle of the matrix c such that the sum of it... | [{"type": "stdin_stdout", "input": "235 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is reading a e-book. The file of the book consists of n pages, numbered from 1 to n. The screen is currently displaying the contents of page x, and Vasya wants to read the page y. There are two buttons on the book w... | [{"type": "stdin_stdout", "input": "5\n20 10 2 9\n1000000000 2 89 4\n1000000000 2 89 8\n1000000000 142 1 1000000000\n1000000000 1000000000 4 3\n", "output": "4\n23\n12\n1\n333333332\n"}, {"type": "stdin_stdout", "input": "5\n20 10 2 9\n1000000000 2 89 4\n1000000000 2 89 5\n1000000000 142 1 1000000000\n1000000000 100000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n segments [l_i, r_i] for 1 β€ i β€ n. You should divide all segments into two non-empty groups in such way that there is no pair of segments from different groups which have at least one common point, or say that... | [{"type": "stdin_stdout", "input": "3\n2\n5 5\n2 3\n3\n3 5\n2 3\n2 3\n3\n3 3\n4 4\n5 5\n", "output": "2 1 \n-1\n1 2 2 \n"}, {"type": "stdin_stdout", "input": "3\n2\n4 10\n2 3\n3\n2 10\n1 5\n0 3\n3\n3 3\n4 4\n5 4\n", "output": "2 1\n-1\n1 2 2\n"}, {"type": "stdin_stdout", "input": "3\n2\n10 10\n2 2\n3\n1 5\n1 5\n0 3\n3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. ... | [{"type": "stdin_stdout", "input": "AanbDfbZNlUodtBQlvPMyomStKNhgvSGhSbTdabxGFGGXCdpsJDimsAykKjfBDPMulkhBMsqLmVKLDoesHZsRAEEdEzqigueXInY\ncwfyjoppiJNrjrOLNZkqcGimrpTsiyFBVgMWEPXsMrxLJDDbtYzerXiFGuLBcQYitLdqhGHBpdjRnkUegmnwhGHAKXGyFtscWDSI\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "sSvpcITJAwghVfJaLKBmyjO... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen little Petya grew up and entered the university, he started to take part in ΠΠ‘Π contests. Later he realized that he doesn't like how the ΠΠ‘Π contests are organised: the team could only have three members (and he coul... | [{"type": "stdin_stdout", "input": "16 25\nbBZ\nEr\nZ\nrYJmfZLgmx\nPaJNrF\naHtRqSxOO\nD\nhsagsG\nMDuBOXrmWH\nSgjMQZ\nYXgWq\nxDwpppG\nSDY\nJwZWx\ncOzrgrBaE\nFJYX\nYXgWq SgjMQZ\nSDY PaJNrF\nFJYX rYJmfZLgmx\nhsagsG Er\nxDwpppG rYJmfZLgmx\naHtRqSxOO rYJmfZLgmx\nhsagsG bBZ\nJwZWx hsagsG\nFJYX cOzrgrBaE\nSDY YXgWq\nFJYX Z\nJ... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.