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\nThe translation from the Berland language into the Birland language is not an easy task. Those languages are very similar: a berlandish word differs from a birlandish word with the same meaning a little: it is spelled (an... | [{"type": "stdin_stdout", "input": "vxpqullmcbegsdskddortcvxyqlbvxmmkhevovnezubvpvnrcajpxraeaxizgaowtfkzywvhnbgzsxbhkaipcmoumtikkiyyaivg\ngviayyikkitmuomcpiakhbxszgbnhvwyzkftwoagzixaearxpjacrnvpvbuzenvovehkmmxvblqyxvctroddksdsgebcmlluqpxv\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "dgxmzbqofstzcdgthbaewb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of sharing the remaining fruit mor... | [{"type": "stdin_stdout", "input": "420196140727489673 679891637638612258\n", "output": "1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B1A1B\n"}, {"type": "stdin_stdout", "input": "420196140727489673 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \\dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \\dots, [bl_n, br_n]$.\n\nInitially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all se... | [{"type": "stdin_stdout", "input": "3\n3 5\n1 2\n3 4\n2 1000000000\n1 1\n999999999 999999999\n10 3\n5 10\n7 8\n", "output": "7\n2000000000\n0\n"}, {"type": "stdin_stdout", "input": "3\n3 5\n1 2\n3 4\n1 1000000000\n1 1\n999999999 999999999\n10 3\n5 10\n7 8\n", "output": "7\n2000000000\n0\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is a balmy spring afternoon, and Farmer John's n cows are ruminating about link-cut cacti in their stalls. The cows, labeled 1 through n, are arranged so that the i-th cow occupies the i-th stall from the left. However... | [{"type": "stdin_stdout", "input": "100000 100000\n", "output": "4999950000\n"}, {"type": "stdin_stdout", "input": "100000 100000\n", "output": "4999950000\n"}, {"type": "stdin_stdout", "input": "100000 40000\n", "output": "4799960000\n"}, {"type": "stdin_stdout", "input": "100000 50000\n", "output": "4999950000\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a part to play in the Wars to Come.\n\nAs everyone knows, Lord Stannis Baratheon (First of His Name, King of the Andals and the First Men, Lord of the Seven Kingdoms and Protector of the Realm) is one true king. ... | [{"type": "stdin_stdout", "input": "1000\n84 87 78 16 94 36 87 93 50 22 63 28 91 60 64 27 41 27 73 37 12 69 68 30 83 31 63 24 68 36 30 3 23 59 70 68 94 57 12 43 30 74 22 20 85 38 99 25 16 71 14 27 92 81 57 74 63 71 97 82 6 26 85 28 37 6 47 30 14 58 25 96 83 46 15 68 35 65 44 51 88 9 77 79 89 85 4 52 55 100 33 61 77 69 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAsterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.\n\nA little later they found a string s, ... | [{"type": "stdin_stdout", "input": "btbdpnzdenxueteteytvkwnegodyhmdwhmrmbftrifytzudumzlacwytsuzefqfpjesdblxhpcsidgksisjdmhyxmmugrjmtfcgxmcgpmvbxbyszdugvmoyjeeqsywcvuqskcjotyhvdijyslgfvyujxthngnonasgnbzzygyikheelirdfsvuicbiazfdeqecbtbdpnzdenxueteteytvkwnegodyhmdwhmrmbftrifytzudumzlacwytsuzefqfpjesdblxhpcsidgksisjdmhyxmm... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In partic... | [{"type": "stdin_stdout", "input": "LLVYUOXHBHUZSAPUMQEKWSQAFRKSMEENXDQYOPQFXNNFXSRBGXFUIRBFJDSDKQIDMCPPTWRJOZCRHZYZPBVUJPQXHNALAOCJDTTBDZWYDBVPMNSQNVMLHHUJAOIWFSEJEJSRBYREOZKHEXTBAXPTISPGIPOYBFFEJNAKKXAEPNGKWYGEJTNEZIXAWRSCEIRTKNEWSKSGKNIKDEOVXGYVEVFRGTNDFNWIFDRZQEJQZYIWNZXCONVZAKKKETPTPPXZMIVDWPGXOFODRNJZBATKGXAPXYHT... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation is a sequence of integers from 1 to n of length n containing each number exactly once. For example, (1), (4, 3, 5, 1, 2), (3, 2, 1) are permutations, and (1, 1), (4, 3, 1), (2, 3, 4) are not. \n\nThere are m... | [{"type": "stdin_stdout", "input": "100\n9 6 3 28 10 2 2 11 2 1 25 3 13 5 14 13 4 14 2 16 12 27 8 1 7 9 8 19 33 23 4 1 15 6 7 12 2 8 30 4 1 31 6 1 15 5 18 3 2 24 7 3 1 20 10 8 26 22 3 3 9 6 1 10 1 5 1 3 7 6 11 10 1 16 19 5 9 4 4 4 2 18 12 21 11 5 2 32 17 29 2 4 8 1 7 5 3 2 17 1\n", "output": "12\n1 1 1 1 1 1 2 1 3 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBarney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2i + 1 for eve... | [{"type": "stdin_stdout", "input": "10\n2 37526406560905229 37526426361107171\n2 37526424114740747 18763396439955441\n2 300485276957081578 301492476099962199\n1 75035386466351570 441803674395985082 642312512\n2 300197522144700185 220954108245114486\n1 150105696341181576 559187296 100113944\n1 300197522135707767 1502426... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya got really tired of these credits (from problem F) and now wants to earn the money himself! He decided to make a contest to gain a profit.\n\nVasya has $n$ problems to choose from. They are numbered from $1$ to $n$.... | [{"type": "stdin_stdout", "input": "22 936\n20 743\n55 46\n83 282\n157 3\n168 979\n241 338\n293 113\n312 292\n333 509\n339 632\n345 149\n347 109\n384 846\n420 151\n619 923\n647 336\n706 935\n726 600\n760 45\n804 126\n810 739\n906 341\n", "output": " 3371\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation p consisting of n integers 1, 2, ..., n (a permutation is an array where each element from 1 to n occurs exactly once).\n\nLet's call an array a bipartite if the following undirected graph is b... | [{"type": "stdin_stdout", "input": "4\n3\n1 2 1\n6\n1 3 2 6 2 4\n4\n4 1 3 2\n8\n3 2 1 6 7 8 2 4\n", "output": "YES\n-1 -2 1\nYES\n-1 -3 2 6 2 4\nYES\n-4 -1 -3 2\nYES\n-3 -2 1 6 7 -8 2 4\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 2 3\n6\n1 0 2 6 5 4\n4\n4 1 3 2\n8\n3 2 1 6 7 8 5 4\n", "output": "YES\n1 2 3\nYES\n-1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\n-----Constraints-----\n - 2 ≤ N ≤ 200000\n - 1 ≤ A_i ≤ 10^9\n - All values in input are intege... | [{"type": "stdin_stdout", "input": "2\n10000000 10000000\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "2\n10000100 10000000", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2\n10000100 10001000", "output": "YES\n"}, {"type": "stdin_stdout", "input": "2\n10000100 10101000", "output": "YES\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTokitsukaze has two colorful tapes. There are $n$ distinct colors, numbered $1$ through $n$, and each color appears exactly once on each of the two tapes. Denote the color of the $i$-th position of the first tape as $ca_i... | [{"type": "stdin_stdout", "input": "1\n50\n4 50 11 27 15 29 2 9 12 39 31 1 6 17 32 28 7 24 36 3 18 49 37 35 33 21 48 19 26 5 20 45 14 13 34 40 42 16 44 43 41 25 38 23 30 10 22 8 47 46\n10 43 29 5 47 12 39 26 31 15 33 18 13 21 11 22 44 4 38 30 41 25 1 24 14 8 27 36 20 45 23 48 2 42 46 19 32 17 7 50 40 49 37 9 3 35 28 6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLena is the most economical girl in Moscow. So, when her dad asks her to buy some food for a trip to the country, she goes to the best store — \"PriceFixed\". Here are some rules of that store:\n\nThe store has an infini... | [{"type": "stdin_stdout", "input": "15\n1 18646259228611\n1 76062756486449\n1 5817259716888\n1 22110867828535\n1 100627485465221\n1 40799537235509\n1 56529154503793\n1 56148198559428\n1 77940886559829\n1 74079407528201\n1 6574734766207\n1 79264199999788\n1 19171266033881\n1 38437872037474\n1 34320923862986\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not les... | [{"type": "stdin_stdout", "input": "1074", "output": "1024\n"}, {"type": "stdin_stdout", "input": "1023", "output": "1000\n"}, {"type": "stdin_stdout", "input": "1298", "output": "1296\n"}, {"type": "stdin_stdout", "input": "1357", "output": "1331\n"}, {"type": "stdin_stdout", "input": "1746", "output": "1728\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHaving read half of the book called \"Storm and Calm\" on the IT lesson, Innocentius was absolutely determined to finish the book on the maths lessons. All was fine until the math teacher Ms. Watkins saw Innocentius readi... | [{"type": "stdin_stdout", "input": "DaABYAOivguEueXufuoUeoiLiuEuEIeZAdoPgaUIIrUtoodAALPESiUaEbqitAphOIIEAogrjUBZLnIALGbazIermGEiAAdDAOFaaizopuUuuEugOHsXTAelFxAyZXWQXiEEKkGiIVdUmwiThDOiEyiuOEaiIAAjEQyaEuOiUGOuuzvaIEUEAhXEuOliOeEkJuJaUaszUKePiQuwXSuoQYEeUOgOeuyvOwhUuitEEKDVOaUaoiaIyiAEkyXeuiEkUorUYCaOXEAiUYPnUMaURebouLUO... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob and Alice are often participating in various programming competitions. Like many competitive programmers, Alice and Bob have good and bad days. They noticed, that their lucky and unlucky days are repeating with some p... | [{"type": "stdin_stdout", "input": "372839920 992839201 1000000000\n100293021 1262614379 999999993\n", "output": "619999282\n"}, {"type": "stdin_stdout", "input": "372839920 992839201 1000000000\n100293021 773829394 999999993\n", "output": "619999282\n"}, {"type": "stdin_stdout", "input": "372839920 992839201 100000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOf course our child likes walking in a zoo. The zoo has n areas, that are numbered from 1 to n. The i-th area contains a_{i} animals in it. Also there are m roads in the zoo, and each road connects two distinct areas. Nat... | [{"type": "stdin_stdout", "input": "10 19\n13637 26970 19043 3616 12880 19387 12539 25190 2452 1261\n1 2\n1 3\n1 4\n2 5\n3 6\n6 7\n3 8\n5 9\n3 10\n4 10\n9 3\n2 8\n4 3\n2 3\n7 10\n7 8\n5 10\n5 6\n7 4\n", "output": "8241.4222222222\n"}, {"type": "stdin_stdout", "input": "10 19\n15704 19758 26631 25050 22778 15041 8487 26... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDice Stamp\n\nDice stamp\n\nAt a local fair, you found a game store you've never seen before. This is a game in which N 6-sided dice are dropped and rolled on the board. More precisely, N buttons are tied to N dice on a o... | [{"type": "stdin_stdout", "input": "1\n0 0\n1 2 3 4 5 6\nRRRRBBBBLLLLFFFF\n2\n0 0\n1 1 1 1 1 1\nRRR\n2 2\n100 100 100 100 100 101\nFFF\n1\n1010 -1000\n1 2 3 4 5 6\nLFRB\n4\n-3 -4\n1 2 3 4 5 6\nBBBBBBBB\n4 -3\n11 12 13 14 15 16\nLLLLLLLL\n3 4\n21 22 23 24 25 26\nFFFFFFFF\n-4 3\n31 32 33 34 35 36\nRRRRRRRR\n3\n-2 -2\n9 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given sequence A = {a0, a1, ... , an-1}, find the length of the longest increasing subsequnece (LIS) in A.\n\nAn increasing subsequence of A is defined by a subsequence {ai0, ai1, ... , aik} where 0 ≤ i0 < i1 < ... ... | [{"type": "stdin_stdout", "input": "5\n5\n1\n2\n-1\n10", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n5\n1\n0\n-1\n10", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n5\n1\n0\n-1\n11", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n8\n1\n0\n-1\n11", "output": "2\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya is a beginner programmer. He has already mastered the basics of the C++ language and moved on to learning algorithms. The first algorithm he encountered was insertion sort. Petya has already written the code that im... | [{"type": "stdin_stdout", "input": "150\n48 115 13 9 105 117 41 136 123 32 84 95 62 50 140 106 145 91 57 141 139 35 45 27 129 63 137 10 37 60 44 30 101 119 138 78 22 103 39 134 49 36 25 12 28 67 69 99 148 26 16 87 146 65 8 74 14 38 47 89 81 19 40 11 64 43 110 66 102 3 122 124 100 2 125 42 97 73 121 7 52 23 29 109 1 70 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a certain meeting of a ruling party \"A\" minister Pavel suggested to improve the sewer system and to create a new pipe in the city.\n\nThe city is an n × m rectangular squared field. Each square of the field is either... | [{"type": "stdin_stdout", "input": "9 37\n.......#................#.##...#.....\n..#......................##..........\n..#......#.........#.................\n..........#..#..#..#...........#.....\n...#............#..##.#.....##.......\n......................#..............\n......#........##....#......#........\n........ | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya decided to learn to play chess. Classic chess doesn't seem interesting to him, so he plays his own sort of chess.\n\nThe queen is the piece that captures all squares on its vertical, horizontal and diagonal lines. I... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "white\n1 2\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "white\n1 2\n"}, {"type": "stdin_stdout", "input": "1000000010\n", "output": "white\n1 2\n"}, {"type": "stdin_stdout", "input": "1823733270\n", "output": "white\n1 2\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus is sure that his life fits the description: \"first there is a white stripe, then a black one, then a white one again\". So, Polycarpus is sure that this rule is going to fulfill during the next n days. Polycar... | [{"type": "stdin_stdout", "input": "4000 2000 2219\n", "output": " 865711019"}, {"type": "stdin_stdout", "input": "4000 1244 4000\n", "output": " 344837886"}, {"type": "stdin_stdout", "input": "4000 1244 2881\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArkady wants to water his only flower. Unfortunately, he has a very poor watering system that was designed for $n$ flowers and so it looks like a pipe with $n$ holes. Arkady can only use the water that flows from the firs... | [{"type": "stdin_stdout", "input": "10 300 100\n35 25 110 40 60 7 44 145 23 96\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10 300 100\n35 42 110 40 60 7 44 145 23 96\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "10 300 100\n35 42 110 40 60 7 26 145 23 96\n", "output": "6\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the street and stay silent for a moment, con... | [{"type": "stdin_stdout", "input": "20 5750 12756 15\n", "output": "YES\n224.57771408997397\n"}, {"type": "stdin_stdout", "input": "20 2910 12756 15\n", "output": "YES\n113.65585182640422\n"}, {"type": "stdin_stdout", "input": "20 2726 12756 15\n", "output": "YES\n106.46936497552505\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland year consists of $m$ months with $d$ days each. Months are numbered from $1$ to $m$. Berland week consists of $w$ days. The first day of the year is also the first day of the week. Note that the last week of the y... | [{"type": "stdin_stdout", "input": "5\n6 7 1\n10 12 11\n12 30 6\n1 1 1\n3247834 10298779 625324\n", "output": "15\n45\n6\n0\n116461800\n"}, {"type": "stdin_stdout", "input": "5\n6 7 4\n10 9 16\n12 17 4\n0 1 1\n7341628 25065973 296620\n", "output": "6\n16\n66\n0\n359753922\n"}, {"type": "stdin_stdout", "input": "5\n6 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are b blocks of digits. Each one consisting of the same n digits, which are given to you in the input. Wet Shark must choose exactly one digit from each block and concatenate all of those digits together to form one... | [{"type": "stdin_stdout", "input": "100 1000000000 42 97\n2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2 5 1 8 8 1 5 2 1 2\n", "output": "590949100\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya has recently started attending a programming club. Naturally he is facing the problem of choosing a programming language. After long considerations he realized that Java is the best choice. The main argument ... | [{"type": "stdin_stdout", "input": "14391752689956519300788497161416904648305096969559656916798920426154191397931561980203179360129309381\n", "output": "BigInteger\n"}, {"type": "stdin_stdout", "input": "11271203439111662452647816080492937379011458047735472400976277474953429583477559167812276320735634783\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMany cats live on the campus of a school. Natsume's daily routine is to pet those cats. However, the cats may be capricious and go for a walk off campus.\n\nThe campus site is a rectangle with each side parallel to the x-... | [{"type": "stdin_stdout", "input": "2\n1 3 20 10\n4\n21 13\n1 15\n10 10\n41 10\n1 3 20 10\n4\n21 13\n1 15\n10 10\n25 10", "output": "2\n2\n"}, {"type": "stdin_stdout", "input": "2\n1 3 20 10\n4\n21 13\n1 15\n10 10\n55 10\n1 3 20 10\n4\n21 13\n1 15\n10 10\n25 10", "output": "2\n2\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $ n $ acitivities with start times $ \\\\ {s_i \\\\} $ and finish times $ \\\\ {t_i \\\\} $. Assuming that a person can only work on a single activity at a time, find the maximum number of activities that can be... | [{"type": "stdin_stdout", "input": "5\n1 2\n10 2\n-1 4\n1 2\n3 12", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n1 2\n10 2\n-2 4\n1 2\n3 12", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n1 2\n12 2\n-2 4\n1 2\n3 12", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n1 2\n10 2\n0 4\n1 2\n3 12"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call an array $t$ dominated by value $v$ in the next situation.\n\nAt first, array $t$ should have at least $2$ elements. Now, let's calculate number of occurrences of each number $num$ in $t$ and define it as $occ(... | [{"type": "stdin_stdout", "input": "4\n1\n1\n6\n1 2 3 4 5 1\n9\n4 1 2 4 5 4 3 2 1\n4\n3 3 3 3\n", "output": "-1\n6\n3\n2\n"}, {"type": "stdin_stdout", "input": "4\n1\n1\n6\n1 2 3 4 5 2\n9\n4 1 2 4 5 4 3 2 1\n4\n3 3 3 3\n", "output": "-1\n5\n3\n2\n"}, {"type": "stdin_stdout", "input": "4\n1\n1\n6\n1 2 3 4 5 2\n9\n4 1 4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has n rows of seats. There are 4 seats in each row, and the seats are separated into pairs b... | [{"type": "stdin_stdout", "input": "61\nOX|XX\nOX|XX\nOX|XX\nXO|XO\nXX|XO\nXX|XX\nXX|XX\nOX|XX\nXO|XO\nOX|XO\nXO|OX\nXX|XX\nXX|XX\nOX|OX\nXX|OX\nOX|XO\nOX|XO\nXO|OX\nXO|XX\nOX|XX\nOX|XX\nXO|OX\nXO|XX\nXO|XX\nOX|XX\nXX|XX\nXX|XO\nXO|XX\nXX|XX\nXO|OX\nXX|XO\nXO|XX\nXO|XO\nXO|OX\nXX|OX\nXO|OX\nOX|XX\nXX|OX\nXX|XX\nOX|XO\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a given weighted graph G(V, E) and a source r, find the source shortest path to each vertex from the source (SSSP: Single Source Shortest Path).\n\nConstraints\n\n* 1 ≤ |V| ≤ 100000\n* 0 ≤ di ≤ 10000\n* 0 ≤ |E| ≤ 5000... | [{"type": "stdin_stdout", "input": "8 6 1\n0 1 1\n0 2 4\n2 0 1\n0 2 2\n3 1 1\n3 2 5", "output": "INF\n0\nINF\nINF\nINF\nINF\nINF\nINF\n"}, {"type": "stdin_stdout", "input": "8 6 1\n0 1 1\n0 2 4\n0 0 1\n1 2 2\n3 0 2\n3 2 5", "output": "INF\n0\n2\nINF\nINF\nINF\nINF\nINF\n"}, {"type": "stdin_stdout", "input": "8 6 2\n0 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToad Pimple has an array of integers $a_1, a_2, \\ldots, a_n$.\n\nWe say that $y$ is reachable from $x$ if $x<y$ and there exists an integer array $p$ such that $x = p_1 < p_2 < \\ldots < p_k=y$, and $a_{p_i}\\, \\&\\, a_... | [{"type": "stdin_stdout", "input": "5 3\n1 3 -1 2 -1\n1 2\n2 5\n1 4\n", "output": "Shi\nShi\nShi\n"}, {"type": "stdin_stdout", "input": "5 3\n1 3 -1 2 -1\n1 2\n2 5\n1 5\n", "output": "Shi\nShi\nShi\n"}, {"type": "stdin_stdout", "input": "5 3\n1 3 -1 2 1\n1 3\n2 4\n1 4\n", "output": "Shi\nShi\nShi\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ consisting of $n$ integers. For each $i$ ($1 \\le i \\le n$) the following inequality is true: $-2 \\le a_i \\le 2$.\n\nYou can remove any number (possibly $0$) of elements from the beginning of... | [{"type": "stdin_stdout", "input": "1\n100\n2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2\n", "output": "0 4\n"}, {"type": "stdin_stdout", "input": "5\n4\n1 2 -1 2\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the 2050 Conference, some people from the competitive programming community meet together and are going to take a photo. The n people form a line. They are numbered from 1 to n from left to right. Each of them either h... | [{"type": "stdin_stdout", "input": "3\n5\n1 2 3 1 2\n4\n11 2 28 5\n1\n998244353\n", "output": "11\n8\n1\n"}, {"type": "stdin_stdout", "input": "3\n5\n1 2 3 0 1\n4\n11 3 28 5\n1\n998244353\n", "output": "10\n8\n1\n"}, {"type": "stdin_stdout", "input": "3\n5\n1 2 3 1 2\n4\n11 2 15 5\n1\n998244353\n", "output": "11\n7\n1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nTaro bought 10 books. Later, I tried to find out the price based on the receipt, but the receipt was dirty and I could not read the price of a book. We decided to calculate the price of the book from the total ... | [{"type": "stdin_stdout", "input": "9850\n1050\n800\n420\n380\n600\n1164\n2400\n3134\n980\n0", "output": "-1078\n"}, {"type": "stdin_stdout", "input": "9850\n1050\n800\n420\n380\n600\n1164\n2400\n3265\n980\n0", "output": "-1209\n"}, {"type": "stdin_stdout", "input": "9850\n1050\n800\n481\n380\n600\n1164\n2400\n3265\n98... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Yamada Springfield Tanaka was appointed as Deputy Deputy Director of the National Land Readjustment Business Bureau. Currently, his country is in the midst of a major land readjustment, and if this land readjustment c... | [{"type": "stdin_stdout", "input": "2\n-100 -20 100 20\n-20 -100 18 100\n2\n-100 -20 -20 -100\n20 100 100 20\n0", "output": "4\n3\n"}, {"type": "stdin_stdout", "input": "2\n-100 -20 100 20\n-20 -100 20 100\n2\n-100 -34 -20 -100\n20 100 100 20\n0", "output": "4\n3\n"}, {"type": "stdin_stdout", "input": "2\n-100 -20 100 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs usual, Sereja has array a, its elements are integers: a[1], a[2], ..., a[n]. Let's introduce notation:\n\n$f(a, l, r) = \\sum_{i = l}^{r} a [ i ] ; m(a) = \\operatorname{max}_{1 \\leq l \\leq r \\leq n} f(a, l, r)$\n\n... | [{"type": "stdin_stdout", "input": "116 10\n477 -765 -756 376 -48 -75 768 -658 263 -207 362 -535 96 -960 630 -686 609 -830 889 57 -239 346 -298 -18 -107 853 -607 -443 -517 371 657 105 479 498 -47 432 503 -917 -656 610 -466 216 -747 -587 -163 -174 493 -882 853 -582 -774 -477 -386 610 -58 557 968 196 69 610 -38 366 -79 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile playing yet another strategy game, Mans has recruited $n$ Swedish heroes, whose powers which can be represented as an array $a$.\n\nUnfortunately, not all of those mighty heroes were created as capable as he wanted,... | [{"type": "stdin_stdout", "input": "11\n559227829 -118401759 491756598 -50857099 491152214 -500410377 141179566 -414122877 144131087 -460846619 791017750\n", "output": "3779030445\n"}, {"type": "stdin_stdout", "input": "11\n559227829 -118401759 491756598 -50857099 491152214 -500410377 141179566 -723654625 144131087 -46... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are 2^N players, numbered 1, 2, ..., 2^N. They decided to hold a tournament.\n\nThe tournament proceeds as follows:\n\n* Choose a permutation of 1, 2, ..., 2^N: p_1, p_2, ..., p_{2^N}.\n* The players stand in a row ... | [{"type": "stdin_stdout", "input": "16 16\n5489 5490 5491 5492 5493 5494 5495 5497 18993 18995 18997 18999 19000 19001 19002 19003", "output": "816646464"}, {"type": "stdin_stdout", "input": "4 2\n12 14 -1", "output": "217967722\n"}, {"type": "stdin_stdout", "input": "4 2\n10 14 0", "output": "866591435\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new Berland businessman Vitaly is going to open a household appliances' store. All he's got to do now is to hire the staff.\n\nThe store will work seven days a week, but not around the clock. Every day at least k people... | [{"type": "stdin_stdout", "input": "1000 2 1363\n", "output": "2726\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... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan wants to play a game with you. He picked some string $s$ of length $n$ consisting only of lowercase Latin letters. \n\nYou don't know this string. Ivan has informed you about all its improper prefixes and suffixes (i... | [{"type": "stdin_stdout", "input": "18\nd\nh\ndj\nxh\ndjs\njxh\ndjsh\nzjxh\ndjshf\nkzjxh\ndjshfk\nhkzjxh\ndjshfkj\nkhkzjxh\ndjshfkje\nskhkzjxh\ndjshfkjeh\ndskhkzjxh\ndjshfkjehd\nhdskhkzjxh\ndjshfkjehds\nehdskhkzjxh\ndjshfkjehdsk\njehdskhkzjxh\ndjshfkjehdskh\nkjehdskhkzjxh\ndjshfkjehdskhk\nfkjehdskhkzjxh\ndjshfkjehdskhk... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings a and b. You have to remove the minimum possible number of consecutive (standing one after another) characters from string b in such a way that it becomes a subsequence of string a. It can happen... | [{"type": "stdin_stdout", "input": "bbbbaabbababbaaaaababbaaabbbbaaabbbababbbbabaabababaabaaabbbabababbbabababaababaaaaa\nbbabaaaabaaaabbaaabbbabaaabaabbbababbbbbbbbbbabbababbaababbbaaabababababbbbaaababaaaaab\n", "output": "bbbbbbbabbababbaababbbaaabababababbbbaaababaaaaab\n"}, {"type": "stdin_stdout", "input": "bbbba... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Aizu Wakamatsu city office decided to lay a hot water pipeline covering the whole area of the city to heat houses. The pipeline starts from some hot springs and connects every district in the city. The pipeline can fo... | [{"type": "stdin_stdout", "input": "3 5\n12 15 70 19 44\n16 13 16 0 17\n20 14 16 10 22\n17 27 18 16\n9 7 0\n19 5\n21\n0 0", "output": "43\n"}, {"type": "stdin_stdout", "input": "3 5\n12 15 70 19 44\n30 13 16 0 17\n20 14 16 10 22\n17 27 18 16\n9 7 0\n19 5\n21\n0 0", "output": "43\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIndian summer is such a beautiful time of the year! A girl named Alyona is walking in the forest and picking a bouquet from fallen leaves. Alyona is very choosy — she doesn't take a leaf if it matches the color and the sp... | [{"type": "stdin_stdout", "input": "17\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbltscqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq tosqzw\njtbctslqq ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently a top secret mission to Mars has taken place. As a result, scientists managed to obtain some information about the Martian DNA. Now we know that any Martian DNA contains at most m different nucleotides, numbered ... | [{"type": "stdin_stdout", "input": "853332331434235 35 77\nBy\nhs\nzB\njs\nIr\nEa\nHG\nxb\nxG\nFp\nAC\nDt\nwo\nFB\nzh\nim\ntx\nyi\ngC\nkp\njz\ndc\nwE\naa\nsG\nng\ncr\npB\nCg\ncv\nxs\nDn\ndg\nyj\nCd\naC\nIi\ngH\nml\nww\nAD\nir\nti\nEr\nCj\nHt\nAe\nsn\naH\nHv\nan\nDf\nGn\nfC\nay\ngB\nlh\nup\nda\nzs\nbh\nHB\nHd\nmg\nzy\nG... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.\nGiven is a string S. Find the minimum number o... | [{"type": "stdin_stdout", "input": "cgayikejwockvntzlvpsfjtzlqfhoqoiahcodvinogbpuxhvohhcvhzmidloliztdhrntxqurzqjztjmwpylaknjncowkeuikhgc\n", "output": "30\n"}, {"type": "stdin_stdout", "input": "pgfqwbxjygkpqanpkicpaxfgeembvdgtllvtiyamxfpwtknorxxvonpntkwcffyjtvwlqgvvbzmmgfgkwezkemmxpagyihbkqidk\n", "output": "32\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSolve the mystery.\n\nInput\n\nThe first line contains T, the number of test cases.\n\nT lines follow each containing a single integer N.\n\nOutput\n\nOutput the answer for each test case in a new line.\n\nConstraints\n\n... | [{"type": "stdin_stdout", "input": "10000\n66\n139\n189\n235\n50\n229\n303\n83\n204\n64\n250\n338\n168\n228\n129\n157\n204\n319\n146\n144\n94\n271\n286\n188\n277\n197\n343\n259\n105\n286\n113\n78\n335\n116\n100\n51\n20\n272\n336\n23\n129\n50\n74\n219\n19\n232\n252\n100\n236\n140\n65\n54\n127\n268\n29\n273\n110\n180\n22... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWay to go! Heidi now knows how many brains there must be for her to get one. But throwing herself in the midst of a clutch of hungry zombies is quite a risky endeavor. Hence Heidi wonders: what is the smallest number of b... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "231564544\n"}, {"type": "stdin_stdout", "input": "1000000000\n", "output": "231564544\n"}, {"type": "stdin_stdout", "input": "1000000100\n", "output": "231564594\n"}, {"type": "stdin_stdout", "input": "1000010100\n", "output": "231569594\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n3R2 - Standby for Action\n\nOur dear Cafe's owner, JOE Miller, will soon take part in a new game TV-show \"1 vs. $n$\"!\n\nThe game goes in rounds, where in each round the host asks JOE and his opponents a common question... | [{"type": "stdin_stdout", "input": "100000\n", "output": "12.090146129863335\n"}, {"type": "stdin_stdout", "input": "111735\n", "output": "12.201105415046918\n"}, {"type": "stdin_stdout", "input": "178482\n", "output": "12.669461501082823\n"}, {"type": "stdin_stdout", "input": "152946\n", "output": "12.515059130925348\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter years of hard work scientists invented an absolutely new e-reader display. The new display has a larger resolution, consumes less energy and its production is cheaper. And besides, one can bend it. The only inconven... | [{"type": "stdin_stdout", "input": "10\n1101010101\n1110101010\n0111010101\n1011101010\n0101110101\n1010111010\n0101011101\n1010101110\n0101010111\n1010101011\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "10\n1111100000\n0010100000\n0110111000\n0000001000\n1011001010\n0010100001\n0010111000\n0011001010\n00... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle penguin Polo adores integer segments, that is, pairs of integers [l; r] (l ≤ r). \n\nHe has a set that consists of n integer segments: [l_1; r_1], [l_2; r_2], ..., [l_{n}; r_{n}]. We know that no two segments of th... | [{"type": "stdin_stdout", "input": "47 21\n3 5\n-422 -417\n60 60\n-348 -348\n-3 -3\n-364 -361\n-49 -41\n-436 -430\n-250 -244\n-33 -26\n-162 -158\n-90 -88\n-357 -352\n-339 -337\n-25 -19\n-69 -67\n-261 -260\n-292 -283\n12 18\n44 44\n-277 -275\n-301 -293\n-108 -98\n-180 -172\n-327 -318\n-314 -309\n-12 -7\n-134 -130\n33 35... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Berland, $n$ different types of banknotes are used. Banknotes of the $i$-th type have denomination $10^{a_i}$ burles (burles are the currency used in Berland); the denomination of banknotes of the first type is exactly... | [{"type": "stdin_stdout", "input": "4\n3 27\n0 1 2\n2 777\n0 2\n3 255\n0 1 3\n10 1000000000\n0 1 2 3 4 5 6 7 8 9\n", "output": "1099\n67999\n148999\n999999920999999999\n"}, {"type": "stdin_stdout", "input": "4\n3 22\n0 1 4\n2 1121\n0 2\n3 192\n0 1 2\n10 1000000000\n0 1 2 3 4 5 6 7 8 9\n", "output": "149\n102399\n17599\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has a calculator. It has a display and two buttons.\n\nInitially, the display shows an integer x. Snuke wants to change this value into another integer y, by pressing the following two buttons some number of times i... | [{"type": "stdin_stdout", "input": "-10 -23", "output": "15\n"}, {"type": "stdin_stdout", "input": "110 -1", "output": "110\n"}, {"type": "stdin_stdout", "input": "-10 -63", "output": "55\n"}, {"type": "stdin_stdout", "input": "273 -1", "output": "273\n"}, {"type": "stdin_stdout", "input": "141 -1", "output": "141\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEntrance Examination\n\nThe International Competitive Programming College (ICPC) is famous for its research on competitive programming. Applicants to the college are required to take its entrance examination.\n\nThe succe... | [{"type": "stdin_stdout", "input": "5 2 4\n100\n90\n82\n70\n65\n5 2 4\n100\n170\n80\n75\n65\n3 1 2\n5000\n6502\n3000\n4 2 3\n10000\n10100\n8000\n8000\n4 2 3\n10000\n10000\n10000\n8000\n5 2 3\n100\n80\n136\n60\n111\n0 0 0", "output": "3\n2\n2\n2\n3\n3\n"}, {"type": "stdin_stdout", "input": "5 2 3\n100\n161\n82\n70\n65\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach New Year Timofey and his friends cut down a tree of n vertices and bring it home. After that they paint all the n its vertices, so that the i-th vertex gets color ci.\n\nNow it's time for Timofey birthday, and his mo... | [{"type": "stdin_stdout", "input": "10\n5 7\n4 5\n10 2\n4 6\n1 2\n3 4\n8 5\n4 9\n2 3\n15 15 15 15 5 15 26 18 15 15\n", "output": "YES\n5\n"}, {"type": "stdin_stdout", "input": "10\n5 7\n4 5\n10 2\n4 6\n1 2\n3 4\n8 5\n4 9\n2 3\n15 15 15 15 5 15 42 18 15 15\n", "output": "YES\n5\n"}, {"type": "stdin_stdout", "input": "10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s consisting of lowercase Latin letters. Character c is called k-dominant iff each substring of s with length at least k contains this character c.\n\nYou have to find minimum k such that there exis... | [{"type": "stdin_stdout", "input": "gfliflgfhhdkceacdljgkegmdlhcgkcmlelmbbbmdddgdeeljjhgbbffmemmmkhebgkhadkdajabcjkcgbkgbaeacdedlkklfech\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "gfliflgfhhdkceacdljgkegmdlhcgkcmlelmbbbmdddgdeeljjhgbbffmemmmjhebgkhadkdajabcjkcgbkgbaeacdedlkklfech\n", "output": "17\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA prime number is a number which has exactly two distinct divisors: one and itself. For example, numbers 2, 7, 3 are prime, and 1, 6, 4 are not.\n\nThe next prime number after x is the smallest prime number greater than x... | [{"type": "stdin_stdout", "input": "13 17\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "23 29\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "43 47\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "17 19\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "11 13\n", "output": "YES... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n4 different points on the plane Read the coordinates of $ A (x_a, y_a) $, $ B (x_b, y_b) $, $ C (x_c, y_c) $, $ D (x_d, y_d) $ and read those 4 points Create a program that outputs YES if there is no dent in the quadrangl... | [{"type": "stdin_stdout", "input": "1.0,0.0,0.1,0.1,0.0,0.1,0.0,0.0\n0.3,0.1,0.1,1.1,0.0,0.3,0.0,0.0", "output": "YES\nYES\n"}, {"type": "stdin_stdout", "input": "0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.1\n0.3,0.1,0.1,1.1,0.0,0.3,0.0,0.0", "output": "YES\nYES\n"}, {"type": "stdin_stdout", "input": "0.0,0.0,1.0,0.0,1.0,1.0,0.0,0.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings of equal length $s$ and $t$ consisting of lowercase Latin letters. You may perform any number (possibly, zero) operations on these strings.\n\nDuring each operation you choose two adjacent charac... | [{"type": "stdin_stdout", "input": "3\nxabb\naabx\ntechnocup\ntechnocup\na\nz\n", "output": "YES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "3\nxabb\naabx\nteohnccup\ntechnocup\na\nz\n", "output": "YES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "3\nxabb\naabx\ntdohnccup\ntechnocup\na\nz\n", "output": "YES\nYE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA group of university students wants to get to the top of a mountain to have a picnic there. For that they decided to use a cableway.\n\nA cableway is represented by some cablecars, hanged onto some cable stations by a ca... | [{"type": "stdin_stdout", "input": "100 100 100\n", "output": "179"}, {"type": "stdin_stdout", "input": "100 0 100\n", "output": "179"}, {"type": "stdin_stdout", "input": "100 100 0\n", "output": "178"}, {"type": "stdin_stdout", "input": "0 100 100\n", "output": "179"}, {"type": "stdin_stdout", "input": "45 52 14\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter passing a test, Vasya got himself a box of $n$ candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies ... | [{"type": "stdin_stdout", "input": "3345775397705614178\n", "output": "131353216887383264\n"}, {"type": "stdin_stdout", "input": "2750054323692292581\n", "output": "107965550311522536\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "39259424579862572\n"}, {"type": "stdin_stdout", "input": "100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKurt reaches nirvana when he finds the product of all the digits of some positive integer. Greater value of the product makes the nirvana deeper.\n\nHelp Kurt find the maximum possible product of digits among all integers... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "387420489\n"}, {"type": "stdin_stdout", "input": "2000000000\n", "output": "387420489\n"}, {"type": "stdin_stdout", "input": "1382011913\n", "output": "387420489\n"}, {"type": "stdin_stdout", "input": "1999999999\n", "output": "387420489\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe will define Ginkgo numbers and multiplication on Ginkgo numbers.\n\nA Ginkgo number is a pair <m, n> where m and n are integers. For example, <1, 1>, <-2, 1> and <-3,-1> are Ginkgo numbers.\n\nThe multiplication on Gin... | [{"type": "stdin_stdout", "input": "8\n10 -1\n-2 12\n1 3\n6 -1\n1 -40\n-8 0\n-4 1\n2 -1", "output": "P\nC\nC\nP\nP\nC\nP\nP\n"}, {"type": "stdin_stdout", "input": "8\n10 -1\n0 2\n-1 2\n4 0\n0 -25\n-4 0\n-2 -1\n2 -1", "output": "P\nC\nP\nC\nC\nC\nP\nP\n"}, {"type": "stdin_stdout", "input": "8\n10 -1\n-1 4\n0 3\n6 -1\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of positive integers a1, a2, ..., an. Find all such indices i, that the i-th element equals the arithmetic mean of all other elements (that is all elements except for this one).\n\nInput\n\nThe fi... | [{"type": "stdin_stdout", "input": "15\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "15\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n"}, {"type": "stdin_stdout", "input": "10\n3 3 3 3 3 4 3 3 3 2\n", "output": "8\n1 2 3 4 5 7 8 9\n"}, {"type": "stdin_stdout", "input": "10\n15 7 10 7 7 7 4 4 7 2\n", "output": "5\n2 4 5 6 9\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.\n\nk expe... | [{"type": "stdin_stdout", "input": "10 4\n1 0 1 0\n1 0 0 1\n1 1 0 1\n1 0 1 1\n1 1 0 1\n1 0 1 0\n0 0 0 0\n0 0 1 0\n1 0 1 0\n0 0 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 4\n1 0 1 0\n1 0 1 0\n0 1 1 1\n1 0 1 1\n1 1 0 1\n1 0 0 1\n0 1 1 1\n0 0 0 1\n1 1 1 1\n1 0 1 0\n", "output": "YES\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a sequence A of n elements and an integer M, and outputs \"yes\" if you can make M by adding elements in A, otherwise \"no\". You can use an element only once.\n\nYou are given the sequence A a... | [{"type": "stdin_stdout", "input": "5\n-1 5 10 1 21\n8\n1 8 31 11 16 14 001 40", "output": "yes\nno\nyes\nyes\nyes\nyes\nyes\nno\n"}, {"type": "stdin_stdout", "input": "5\n1 5 13 3 21\n8\n0 4 17 11 22 21 010 42", "output": "yes\nyes\nyes\nno\nyes\nyes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "5\n1 5 7 3 21\n8\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCasimir has a rectangular piece of paper with a checkered field of size $n \\times m$. Initially, all cells of the field are white.\n\nLet us denote the cell with coordinates $i$ vertically and $j$ horizontally by $(i, j)... | [{"type": "stdin_stdout", "input": "8\n2 3 1\n*.*\n...\n4 9 2\n*.*.*...*\n.*.*...*.\n..*.*.*..\n.....*...\n4 4 1\n*.*.\n****\n.**.\n....\n5 5 1\n.....\n*...*\n.*.*.\n..*.*\n...*.\n5 5 2\n.....\n*...*\n.*.*.\n..*.*\n...*.\n4 7 1\n*.....*\n.....*.\n..*.*..\n...*...\n3 3 1\n***\n***\n***\n3 5 1\n*...*\n.***.\n.**..\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGildong is playing with his dog, Badugi. They're at a park that has $n$ intersections and $n-1$ bidirectional roads, each $1$ meter in length and connecting two intersections with each other. The intersections are numbere... | [{"type": "stdin_stdout", "input": "3\n3\n1 2\n2 3\n4\n1 2\n2 3\n3 4\n5\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n5 13\n", "output": "2\n3\n4\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 2\n2 3\n4\n1 2\n2 3\n3 4\n4\n1 2\n1 3\n3 4\n1 5\n3 8\n6 13\n5 8\n", "output": "2\n3\n2\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 2\n2 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a directed weighted graph with N vertices. Each vertex has two integers written on it, and the integers written on Vertex i are A_i and B_i.\n\nIn this graph, there is an edge from Vertex x to Vertex y for all pai... | [{"type": "stdin_stdout", "input": "6\n43 35\n97 26\n77 48\n133 16\n110 5\n154 15", "output": "140\n"}, {"type": "stdin_stdout", "input": "6\n43 35\n97 26\n77 48\n133 31\n110 5\n154 15", "output": "155\n"}, {"type": "stdin_stdout", "input": "6\n43 35\n97 26\n77 48\n133 36\n110 5\n154 15", "output": "160\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters + and 1 into this sequence. For example, sequences (())(), () and (()(())) are regular, while )(, (() ... | [{"type": "stdin_stdout", "input": "12\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "12\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n", "output": "YES\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA witch named Marie lived deep in a remote forest. Since she is a witch, she magically covers everything she needs to live, such as food, water, and fuel.\n\nHer magic is activated by drawing a magic circle using some mag... | [{"type": "stdin_stdout", "input": "5 4\n1 2\n2 3\n3 4\n4 5\n4 6\n1 2\n1 3\n1 4\n2 4\n2 4\n3 4\n5 0\n0 0", "output": "yes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "5 4\n1 2\n2 3\n3 4\n4 5\n7 6\n1 2\n1 3\n1 4\n2 4\n2 4\n3 4\n5 0\n0 0", "output": "yes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "5 4\n1 2\n2 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given the strings $a$ and $b$, consisting of lowercase Latin letters. You can do any number of the following operations in any order:\n\nif $|a| > 0$ (the length of the string $a$ is greater than zero), delete the... | [{"type": "stdin_stdout", "input": "5\na\na\nabcd\nbc\nhello\ncodeforces\nhello\nhelo\ndhjakjsnasjhfksafasd\nadjsnasjhfksvdafdser\n", "output": "\n0\n2\n13\n3\n20\n"}, {"type": "stdin_stdout", "input": "5\na\na\nabcd\nbc\nhello\ncodeforces\nhello\nhelo\ndhjakjsnasjhfksafasd\nadjsnasjhfksvdafdser\n", "output": "0\n2\n13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA flower shop has got n bouquets, and the i-th bouquet consists of a_{i} flowers. Vasya, the manager of the shop, decided to make large bouquets from these bouquets. \n\nVasya thinks that a bouquet is large if it is made ... | [{"type": "stdin_stdout", "input": "25\n742168 377547 485672 437223 96307 902863 759104 747933 512899 410317 588598 666688 823202 257684 520631 910066 168864 71499 899972 565350 764848 754913 929040 864132 289976\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "25\n742168 377547 485672 437223 96307 902863 7591... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHeidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked... | [{"type": "stdin_stdout", "input": "11\n1 0 6646\n2 0 8816\n3 2 9375\n4 2 5950\n5 1 8702\n6 2 2657\n7 2 885\n8 7 2660\n9 2 5369\n10 6 3798\n", "output": "18191\n"}, {"type": "stdin_stdout", "input": "11\n1 0 6646\n2 0 8816\n3 2 9375\n4 2 5950\n5 1 8702\n6 2 2657\n7 2 885\n8 7 2660\n9 2 5369\n10 6 3798\n", "output": "18... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a gift — a large snow maker. He plans to make some amount of snow every day. ... | [{"type": "stdin_stdout", "input": "13\n1 1 1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "13\n1 1 1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "1 1 1 1 1 1 1 1 1 1 1 1 1 "}, {"type": "stdin_stdout", "input": "13\n1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order. Find the maximum possible number of occurrences of `AB` in the resulting string.\n\nCons... | [{"type": "stdin_stdout", "input": "9\nBEWPVCRWH\nZQNZYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA", "output": "4\n"}, {"type": "stdin_stdout", "input": "9\nBEWPVCRWH\nZQNZYIJX\nAERVAB\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA", "output": "4\n"}, {"type": "stdin_stdout", "input": "9\nBEWPVCRWH\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvery evening Vitalya sets n alarm clocks to wake up tomorrow. Every alarm clock rings during exactly one minute and is characterized by one integer a_{i} — number of minute after midnight in which it rings. Every alarm c... | [{"type": "stdin_stdout", "input": "100 40 20\n148 120 37 65 188 182 199 131 97 174 157 113 62 63 193 8 72 152 138 5 90 48 133 83 197 118 123 2 181 151 53 115 78 177 144 33 196 19 85 104 77 34 173 198 136 44 3 22 86 200 23 129 68 176 29 58 121 56 79 15 159 183 171 60 141 54 158 106 30 17 116 105 190 59 36 46 169 142 16... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUjan decided to make a new wooden roof for the house. He has $n$ rectangular planks numbered from $1$ to $n$. The $i$-th plank has size $a_i \\times 1$ (that is, the width is $1$ and the height is $a_i$).\n\nNow, Ujan wan... | [{"type": "stdin_stdout", "input": "10\n1\n1\n2\n2 1\n3\n3 1 2\n3\n2 2 2\n4\n4 1 4 2\n5\n5 4 3 4 1\n5\n1 2 3 4 5\n6\n3 2 1 6 2 2\n10\n4 5 2 9 6 10 3 7 1 8\n10\n1 3 2 2 2 9 10 10 9 10\n", "output": "1\n1\n2\n2\n2\n3\n3\n2\n5\n5\n"}, {"type": "stdin_stdout", "input": "10\n1\n1\n2\n2 1\n3\n3 1 2\n3\n2 2 2\n4\n4 1 4 1\n5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"Duel!\"\n\nBetting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.\n\nThere are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are... | [{"type": "stdin_stdout", "input": "30 27\n000000000010110000101111111111\n", "output": "tokitsukaze\n"}, {"type": "stdin_stdout", "input": "30 27\n100000000010110000101111111111\n", "output": "tokitsukaze\n"}, {"type": "stdin_stdout", "input": "30 16\n100000000010110000101111111111\n", "output": "once again\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis time Baby Ehab will only cut and not stick. He starts with a piece of paper with an array a of length n written on it, and then he does the following:\n\n * he picks a range (l, r) and cuts the subsegment a_l, a_{l ... | [{"type": "stdin_stdout", "input": "6 3\n2 3 10 12 5 14\n1 6\n2 4\n3 5\n", "output": "4\n2\n2\n"}, {"type": "stdin_stdout", "input": "6 3\n1 3 10 6 10 14\n1 6\n2 4\n3 5\n", "output": "4\n2\n3\n"}, {"type": "stdin_stdout", "input": "6 3\n1 5 10 6 10 14\n1 6\n2 4\n3 5\n", "output": "5\n3\n3\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend has n cards.\n\nYou know that each card has a lowercase English letter on one side and a digit on the other.\n\nCurrently, your friend has laid out the cards on a table so only one side of each card is visible... | [{"type": "stdin_stdout", "input": "01234567890123456789012345678901234567890123456789\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "qwertyuioplkjhgfdsazxcvbnmqwertyuioplkjhgfdsazxcvb\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "kaq7jyialrfp4ilkni90eq8v3amcbygon7py0hb8z26fbl8ss1\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA few years ago Sajjad left his school and register to another one due to security reasons. Now he wishes to find Amir, one of his schoolmates and good friends.\n\nThere are n schools numerated from 1 to n. One can travel... | [{"type": "stdin_stdout", "input": "120494\n", "output": "60246\n"}, {"type": "stdin_stdout", "input": "116591\n", "output": "58295\n"}, {"type": "stdin_stdout", "input": "110052\n", "output": "55025\n"}, {"type": "stdin_stdout", "input": "101000\n", "output": "50499\n"}, {"type": "stdin_stdout", "input": "150380\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is a harder version of the problem. In this version $n \\le 500\\,000$\n\nThe outskirts of the capital are being actively built up in Berland. The company \"Kernel Panic\" manages the construction of a residential co... | [{"type": "stdin_stdout", "input": "100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 21 77... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta has $n$ candies and he wants to gift them to $k$ kids. He wants to divide as many candies as possible between all $k$ kids. Santa can't divide one candy into parts but he is allowed to not use some candies at all.\n... | [{"type": "stdin_stdout", "input": "5\n5 3\n19 4\n12 7\n10 2\n100001 44619\n", "output": "4\n18\n10\n10\n100001\n"}, {"type": "stdin_stdout", "input": "5\n5 3\n12 4\n12 7\n10 2\n100001 44619\n", "output": "4\n12\n10\n10\n100001\n"}, {"type": "stdin_stdout", "input": "5\n10 2\n1 11\n5 11\n11 1\n110001 90586\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade g... | [{"type": "stdin_stdout", "input": "100\n66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 55 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt first, let's define function $f(x)$ as follows: $$ \\begin{matrix} f(x) & = & \\left\\{ \\begin{matrix} \\frac{x}{2} & \\mbox{if } x \\text{ is even} \\\\ x - 1 & \\mbox{otherwise } \\end{matrix} \\right. \\end{matrix}... | [{"type": "stdin_stdout", "input": "1000000000000000000 1\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 100\n", "output": "31249999999999998\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 10000\n", "output": "244140624999998\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe input consists of a single string of uppercase letters A-Z. The length of the string is between 1 and 10 characters, inclusive.\n\n\n-----Output-----\n\nOutput \"YES\" or \"NO\".\n\n\n-----Examples-... | [{"type": "stdin_stdout", "input": "ALKALINITY\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "ALLALINITY\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "YTINILALLA\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "UNSCRAMBLE\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "ALKAL... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is one apple tree in Arkady's garden. It can be represented as a set of junctions connected with branches so that there is only one way to reach any junctions from any other one using branches. The junctions are enu... | [{"type": "stdin_stdout", "input": "10\n1 1 2 4 2 4 1 8 8\n", "output": "1 1 1 1 1 1 2 2 3 6 \n"}, {"type": "stdin_stdout", "input": "10\n1 2 2 3 3 4 4 5 5\n", "output": "1 1 1 1 1 2 2 3 5 5 \n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 1 1 1 1 1 1\n", "output": "1 1 1 1 1 1 1 1 1 9 \n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Max found an electronic calculator from his grandfather Dovlet's chest. He noticed that the numbers were written with seven-segment indicators (https://en.wikipedia.org/wiki/Seven-segment_display). [Image] \n\nMax st... | [{"type": "stdin_stdout", "input": "222145 353252\n", "output": "3860750\n"}, {"type": "stdin_stdout", "input": "222145 353252\n", "output": "3860750\n"}, {"type": "stdin_stdout", "input": "188883 353252\n", "output": "4803878\n"}, {"type": "stdin_stdout", "input": "188883 240204\n", "output": "1479377\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHamed has recently found a string t and suddenly became quite fond of it. He spent several days trying to find all occurrences of t in other strings he had. Finally he became tired and started thinking about the following... | [{"type": "stdin_stdout", "input": "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\nvvvvvvvv\n", "output": "2728075\n"}, {"type": "stdin_stdout", "input": "vnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssn\nnssnssns\n", "output": "943392\n"}, {"type": "stdin_stdout", "input": "kpjmawawawawawawawawawawawawawawawawa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecall that the bracket sequence is considered regular if it is possible to insert symbols '+' and '1' into it so that the result is a correct arithmetic expression. For example, a sequence \"(()())\" is regular, because ... | [{"type": "stdin_stdout", "input": "9999 41526212\n", "output": "(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNuske has a grid with N rows and M columns of squares. The rows are numbered 1 through N from top to bottom, and the columns are numbered 1 through M from left to right. Each square in the grid is painted in either blue o... | [{"type": "stdin_stdout", "input": "5 5 6\n11010\n01110\n10111\n11111\n01010\n1 1 5 5\n1 2 4 5\n2 3 3 5\n3 3 3 2\n3 1 3 5\n1 1 3 4", "output": "-2\n-2\n0\n0\n2\n1\n"}, {"type": "stdin_stdout", "input": "5 5 6\n11010\n01110\n10111\n11111\n01010\n1 1 5 5\n1 2 4 5\n3 3 3 5\n3 3 3 2\n3 1 3 5\n1 1 3 4", "output": "-2\n-2\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a positive integer X, let f(X) be the number of positive divisors of X.\nGiven a positive integer N, find \\sum_{K=1}^N K\\times f(K).\n\n-----Constraints-----\n - 1 \\leq N \\leq 10^7\n\n-----Input-----\nInput is giv... | [{"type": "stdin_stdout", "input": "10000000\n", "output": "838627288460105\n"}, {"type": "stdin_stdout", "input": "11001000", "output": "1020696029789074\n"}, {"type": "stdin_stdout", "input": "11000000", "output": "1020504841032058\n"}, {"type": "stdin_stdout", "input": "11001001", "output": "1020696117797082\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya wrote down two strings s of length n and t of length m consisting of small English letters 'a' and 'b'. What is more, he knows that string t has a form \"abab...\", namely there are letters 'a' on odd positions and ... | [{"type": "stdin_stdout", "input": "340\nbaa?b?abab??ab??aaabaa???bbbb??abaaaba?a?b?bb?ab?bbaa??aaaa???aaa?b???ba?a??b?bb?bbbabb?bb?a?a?bbbabbba?b?ababbb?b?a??bbb??bb?ababb?abbbbba??aabbaab?aaa??a???bbaa?bb?bb?babaa?bb?a???b?abbb???bb?a?a??b?b?abbba?b??a?bab??baa?aabaabb?abbbab?aa???bbaab?bbab?ba?aab?b?baabb???aaa??bb?... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThree numbers A, B and C are the inputs. Write a program to find second largest among them.\n\n-----Input-----\n\nThe first line contains an integer T, the total number of testcases. Then T lines follow, each line contain... | [{"type": "stdin_stdout", "input": "3\n120 11 400\n10213 312 10\n10 3 450\n", "output": "120\n312\n10\n"}, {"type": "stdin_stdout", "input": "3 \n120 14 400\n10213 312 10\n10 3 450", "output": "120\n312\n10\n"}, {"type": "stdin_stdout", "input": "3 \n117 14 384\n10213 312 10\n10 3 450", "output": "117\n312\n10\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son bea... | [{"type": "stdin_stdout", "input": "100 99 98 97\n", "output": "196\n195\n98\n"}, {"type": "stdin_stdout", "input": "100 50 19 10\n", "output": "100\n50\n19\n"}, {"type": "stdin_stdout", "input": "100 50 19 25\n", "output": "100\n51\n25\n"}, {"type": "stdin_stdout", "input": "100 50 19 30\n", "output": "100\n61\n30\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEfim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Then, he de... | [{"type": "stdin_stdout", "input": "320 142\n2704701300865535.432223312233434114130011113220102420131323010344144201124303144444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444447444444444444444444444444444444615444444482101673308979557675074444444444444446... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.