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\nYou are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order... | [{"type": "stdin_stdout", "input": "100\n39 77 67 25 81 26 50 11 73 95 86 16 90 33 14 79 12 100 68 64 60 27 41 15 34 24 3 61 83 47 57 65 99 43 40 21 94 72 82 85 23 71 76 32 10 17 30 18 44 59 35 89 6 63 7 69 62 70 4 29 92 87 31 48 36 28 45 97 93 98 56 38 58 80 8 1 74 91 53 55 54 51 96 5 42 52 9 22 78 88 75 13 66 2 37 20... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Ivan noticed an array a while debugging his code. Now Ivan can't remember this array, but the bug he was trying to fix didn't go away, so Ivan thinks that the data from this array might help him to reproduce the ... | [{"type": "stdin_stdout", "input": "50 20\n1 44 48 43\n1 15 24 9\n2 39 44 25\n1 36 48 35\n1 4 30 27\n1 31 44 15\n2 19 38 22\n2 18 43 24\n1 25 35 10\n2 38 43 5\n2 10 22 21\n2 5 19 30\n1 17 35 26\n1 17 31 10\n2 9 21 1\n2 29 34 10\n2 25 44 21\n2 13 33 13\n2 34 38 9\n2 23 43 4\n", "output": "-1\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the winter holidays, the demand for Christmas balls is exceptionally high. Since it's already 2018, the advances in alchemy allow easy and efficient ball creation by utilizing magic crystals.\n\nGrisha needs to obt... | [{"type": "stdin_stdout", "input": "1000000000 1000000000\n1000000000 1000000000 1000000000\n", "output": "5000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000\n1000100000 1000000000 1000000000\n", "output": "5000200000\n"}, {"type": "stdin_stdout", "input": "1000000000 1010000000\n1000100000 100000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNian is a monster which lives deep in the oceans. Once a year, it shows up on the land, devouring livestock and even people. In order to keep the monster away, people fill their villages with red colour, light, and cracki... | [{"type": "stdin_stdout", "input": "24 24\n299931317 581208095 975349898 832722683 817690798 482251493 336949323 145902930 573001018 802990442 898055771 253410043 150981561 225791789 53290960 405421751 723296526 565432511 256399554 374970926 22699716 104391316 121063780 149329252\n-295118728 -830122321 -294539299 -9059... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPikachu had an array with him. He wrote down all the non-empty subsequences of the array on paper. Note that an array of size n has 2n - 1 non-empty subsequences in it. \n\nPikachu being mischievous as he always is, remov... | [{"type": "stdin_stdout", "input": "930971393 177624874\n", "output": "332\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 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624875 177624... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a collection of words, say as in a dictionary. \n\nYou can represent it in the following compressed form: \n\nThe first word will be followed by a sequence of pair of a integer (x) and a word. \n\nThe number... | [{"type": "stdin_stdout", "input": "4\nzebsb\n1 r\n2 uogh\n5 taguisj\n\nSMMBOG", "output": "zruogtaguisj\n"}, {"type": "stdin_stdout", "input": "4\nyebtb\n1 r\n2 hogu\n5 tbguisi\n\nSMMBOH", "output": "yrhogtbguisi\n"}, {"type": "stdin_stdout", "input": "4\nasbez\n6 r\n3 ungi\n4 jgiusau\n\nSMMOAG", "output": "asbujgiusa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoy's friends has been spying on his text messages, so Roy thought of an algorithm to encrypt text messages. \n\nEncryption Algorithm is as follows:\nWe say message to be encrypted as Plain Text and encrypted form of mes... | [{"type": "stdin_stdout", "input": "100\ngrwctfse\nuiufoftt\nr\ni\nnreyfhlov\niqklvul\nfhz\npaxeo\nlnadrfvgk\ngszgwr\nkczwqcb\nvjtuuud\nnz\nufywxt\nmbvmbnd\nykqyqvxn\naf\nuzoz\nyjjt\nlwuo\nntxlb\nma\ngzpbfgwm\nihy\nyephwnhlh\nptkgk\ntrq\nfdyfqvr\nckvd\nclhrdtcd\nfozzjkfds\ngfpm\neqkzlwlasg\nfrjjsyf\nmyziq\nimuyhvpiun\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a string, find the length of string.\n\nInput Format:\nFirst line contains single integer t, the number of test-cases. Each of next t lines contains a string of lower case alphabets.\n\nOutput Format:\nOutput t line... | [{"type": "stdin_stdout", "input": "15\nbswdkimmongrpuirmtyzlenpuphbakkdcigpsvbgijaydirsbprothfpymrawd\nzljofermpamnf\nexzvroratgyixaecdfnovtvmhkmvxurdtqam\nrmcamkzmocrwrgrmbgtluokofpkwrwcjlelzqkohofdglwsocobxclnkcxguukffrqghcu\ntatznqtcshdrkrfwtcenwoudhmkrpehigbjutcwnmbfysmumoybnoyswkcpbjwlpzuluzh\nljpjbbfprdtgrrzpbdg... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.\nGiven a string S, determine wh... | [{"type": "stdin_stdout", "input": "sjppvv", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "coffee", "output": "Yes"}, {"type": "stdin_stdout", "input": "sippuu", "output": "Yes"}, {"type": "stdin_stdout", "input": "cofgee", "output": "No\n"}, {"type": "stdin_stdout", "input": "uuppis", "output": "No\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThe... | [{"type": "stdin_stdout", "input": "300 27", "output": "274\n972426\n102082793\n328873421\n615196510\n24430690\n273712439\n600435969\n563935644\n888588929\n654428054\n74494182\n338218805\n98085192\n435847368\n844223382\n705536554\n49767749\n177382729\n162791487\n789150629\n878637769\n365777831\n411668372\n514585465\n76... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has one biscuit and zero Japanese yen (the currency) in his pocket. He will perform the following operations exactly K times in total, in the order he likes:\n\n* Hit his pocket, which magically increases the number... | [{"type": "stdin_stdout", "input": "314159265 35897932 384626433", "output": "48518828981938099"}, {"type": "stdin_stdout", "input": "407766107 9307229 14836778", "output": "1101648954500241\n"}, {"type": "stdin_stdout", "input": "407766107 9307229 25447105", "output": "3215538450316794\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning. Snuke decides to light K of the N candles.\n... | [{"type": "stdin_stdout", "input": "8 4\n-14 -7 -4 -11 1 2 3 4", "output": "4\n"}, {"type": "stdin_stdout", "input": "8 4\n-14 -7 -4 -11 1 2 3 8", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 5\n-14 -7 -1 -11 1 2 3 4", "output": "5\n"}, {"type": "stdin_stdout", "input": "8 4\n-14 -7 -1 -11 1 1 3 8", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Republic of AtCoder, Snuke Chameleons (Family: Chamaeleonidae, Genus: Bartaberia) are very popular pets. Ringo keeps N Snuke Chameleons in a cage.\n\nA Snuke Chameleon that has not eaten anything is blue. It changes it... | [{"type": "stdin_stdout", "input": "123456 234567", "output": "857617983"}, {"type": "stdin_stdout", "input": "29001 234567", "output": "246712986\n"}, {"type": "stdin_stdout", "input": "29001 137176", "output": "790285595\n"}, {"type": "stdin_stdout", "input": "18209 234567", "output": "750285457\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a circle with a circumference of L. Each point on the circumference has a coordinate value, which represents the arc length from a certain reference point clockwise to the point. On this circumference, there are ... | [{"type": "stdin_stdout", "input": "4 20 18\n7 2\n9 1\n12 1\n18 1", "output": "10\n16\n7\n9\n"}, {"type": "stdin_stdout", "input": "4 20 18\n3 2\n9 1\n12 1\n18 1", "output": "10\n16\n5\n7\n"}, {"type": "stdin_stdout", "input": "4 20 18\n3 2\n9 1\n12 1\n18 2", "output": "5\n7\n10\n0\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with t... | [{"type": "stdin_stdout", "input": "15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake sna... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\n\nThis figure shows railway tracks for reshuffling cars. The rail tracks end in the bottom and the top-left rail track is used for the entrace and the top-right rail track is used for the exit. Ten cars, which ... | [{"type": "stdin_stdout", "input": "1\n6\n-1\n13\n10\n0\n0\n0", "output": "10\n13\n-1\n"}, {"type": "stdin_stdout", "input": "1\n20\n0\n20\n11\n0\n0\n1", "output": "20\n11\n20\n"}, {"type": "stdin_stdout", "input": "1\n38\n0\n20\n11\n0\n0\n1", "output": "38\n11\n20\n"}, {"type": "stdin_stdout", "input": "1\n10\n0\n20\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a set of cards with positive integers written on them. Stack the cards to make several piles and arrange them side by side. Select two adjacent piles of cards from them, and stack the left pile on top of the righ... | [{"type": "stdin_stdout", "input": "3\n2 21\n0 48\n-1 12", "output": "-1152\n"}, {"type": "stdin_stdout", "input": "3\n4 21\n0 48\n-1 12", "output": "-2304\n"}, {"type": "stdin_stdout", "input": "3\n4 21\n0 28\n-1 12", "output": "-1344\n"}, {"type": "stdin_stdout", "input": "3\n6 93\n1 -14\n1 -1", "output": "-7728\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt Akabe High School, a programmer training school, there is a unique study session run by the students themselves. It is important for programmers to constantly adopt new technologies, so the aim of this activity is to d... | [{"type": "stdin_stdout", "input": "5 8\n5\n10\n17\n1\n3\nADD 1\nADD 3\nCHEDK -1\nCHECK 1\nCHEBJ -1\nCHFCK -1\nCHECK 4\nCHECK 8", "output": "NA\n4\nNA\nNA\n0\n0\n"}, {"type": "stdin_stdout", "input": "5 8\n5\n10\n13\n1\n3\nADD 1\nADD 5\nCHECK 0\nCHECK 1\nCHEBJ 0\nCHFCK 0\nCHECK 0\nCHECK 5", "output": "NA\nNA\nNA\nNA\nN... | 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\nHaruna is a high school student. She must remember the seating arrangements in her class because she is a class president. It is too difficult task to remember if there are so many students.\n\nThat is the reason why seat... | [{"type": "stdin_stdout", "input": "1 2\n11 0\n0 0", "output": "yes\nyes\n"}, {"type": "stdin_stdout", "input": "2 1\n10 0\n0 0", "output": "yes\nyes\n"}, {"type": "stdin_stdout", "input": "1 4\n11 0\n0 0", "output": "yes\nyes\n"}, {"type": "stdin_stdout", "input": "2 -1\n8 0\n0 0", "output": "yes\nyes\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDescription\n\nIn 200X, the mysterious circle K, which operates at K University, announced K Poker, a new game they created on the 4th floor of K East during the university's cultural festival.\nAt first glance, this game... | [{"type": "stdin_stdout", "input": "3\n0 1 0 1 0 0 0 -1 0 1 0 -1 0\n1 0 0 0 0 0 1 0 0 0 0 0 2\n0 1 1 0 1 1 1 0 1 0 0 5 5\n3 1 1 1 0 1 0 0 1 0 3 -1 1\n1 1 2 7 5 10 20 50 100\n7H 6H 2H 5H 3H\n9S 9C 9H 8H 8D\nKS KH QH JD TS\n10\n1 1 1 1 1 1 1 1 1 0 1 1 1\n0 1 1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 2 1 1 1 1 1 1 1 0\n1 1 1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3\n0 2 7\n2 0 4\n5 8 0\n\n\nOutput\n\n11\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python co... | [{"type": "stdin_stdout", "input": "3\n0 3 10\n1 0 4\n19 11 0", "output": "15\n"}, {"type": "stdin_stdout", "input": "3\n0 6 13\n4 0 3\n24 12 0", "output": "20\n"}, {"type": "stdin_stdout", "input": "3\n0 12 13\n6 0 6\n27 8 0", "output": "25\n"}, {"type": "stdin_stdout", "input": "3\n0 12 18\n6 0 6\n27 8 0", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEscape\n\nAn undirected graph with positive values ββat the vertices is given. The vertices are numbered from 1 to N, and the i-th vertex has a value of w_i. You can start from the first vertex and move on the graph with ... | [{"type": "stdin_stdout", "input": "6 10\n0 3 3 4 10 12\n1 3\n2 6\n3 4\n1 1\n4 5\n5 6", "output": "32\n"}, {"type": "stdin_stdout", "input": "6 10\n0 0 3 6 10 12\n1 3\n1 1\n6 4\n1 1\n6 5\n5 6", "output": "31\n"}, {"type": "stdin_stdout", "input": "6 10\n0 3 3 5 10 12\n1 3\n2 6\n3 4\n1 1\n4 5\n5 6", "output": "33\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Endo wanted to write the code that performs breadth-first search (BFS), which is a search algorithm to explore all vertices on an undirected graph. An example of pseudo code of BFS is as follows:\n\n\n1: $current \\le... | [{"type": "stdin_stdout", "input": "8 -1\n7 1\n3 0\n1 6\n0 5\n3 0\n10 7\n2 13\n8 2\n12 4", "output": "-1\n"}, {"type": "stdin_stdout", "input": "8 -1\n7 1\n3 0\n2 6\n0 5\n3 0\n10 7\n2 13\n8 2\n12 4", "output": "-1\n"}, {"type": "stdin_stdout", "input": "8 -1\n7 1\n3 0\n2 6\n0 5\n3 0\n10 4\n2 13\n8 2\n12 4", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGPA is an abbreviation for \"Galaxy Point of Aizu\" and takes real numbers from 0 to 4.\nGPA rock-paper-scissors is a game played by two people. After each player gives a signal of \"rock-paper-scissors, pon (h... | [{"type": "stdin_stdout", "input": "3\n1.2162360718264462\n2.9346880694304285\n3.9759367558439593", "output": "0\n3\n6\n"}, {"type": "stdin_stdout", "input": "3\n1.3676423535538285\n2.5451927881659007\n3.4551403734048662", "output": "0\n3\n6\n"}, {"type": "stdin_stdout", "input": "3\n2.2132650658019095\n2.5451927881659... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two standard ways to represent a graph $G = (V, E)$, where $V$ is a set of vertices and $E$ is a set of edges; Adjacency list representation and Adjacency matrix representation.\n\nAn adjacency-list representati... | [{"type": "stdin_stdout", "input": "4\n1 1 0 4\n2 1 1\n-1 -1\n4 1 2", "output": "0 0 0 1\n1 0 0 0\n0 0 0 0\n0 1 0 0\n"}, {"type": "stdin_stdout", "input": "4\n1 2 2 4\n2 1 4\n3 -1\n4 1 3", "output": "0 1 0 1\n0 0 0 1\n0 0 0 0\n0 0 1 0\n"}, {"type": "stdin_stdout", "input": "4\n1 2 1 4\n2 1 4\n1 -1\n4 1 3", "output": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSince Sonya is interested in robotics too, she decided to construct robots that will read and recognize numbers.\n\nSonya has drawn n numbers in a row, a_i is located in the i-th position. She also has put a robot at each... | [{"type": "stdin_stdout", "input": "15\n1 4 6 1 2 7 2 1 1 10 4 15 2 7 5\n", "output": "45\n"}, {"type": "stdin_stdout", "input": "15\n1 4 6 1 2 7 2 1 1 10 4 8 2 7 5\n", "output": "45\n"}, {"type": "stdin_stdout", "input": "15\n1 4 3 1 2 7 2 1 1 10 4 4 2 7 5\n", "output": "36\n"}, {"type": "stdin_stdout", "input": "15\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n rectangles on a plane with coordinates of their bottom left and upper right points. Some (n-1) of the given n rectangles have some common point. A point belongs to a rectangle if this point is strictly ins... | [{"type": "stdin_stdout", "input": "3\n-1000000000 -1000000000 -999999999 -999999999\n-1000000000 -1000000000 1000000000 1000000000\n-1000000000 -1000000000 -999999999 -999999999\n", "output": "-1000000000 -1000000000\n"}, {"type": "stdin_stdout", "input": "3\n-1000000000 -1000000000 -999999999 -999999999\n-1000000000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo friends are travelling through Bubble galaxy. They say \"Hello!\" via signals to each other if their distance is smaller or equal than d_1 and \n\n * it's the first time they speak to each other or \n * at some poin... | [{"type": "stdin_stdout", "input": "8\n100 200\n660 973 461 774\n844 449 645 648\n770 319 770 319\n494 325 693 126\n934 913 933 714\n207 945 206 845\n527 264 427 264\n1595 189 787 209\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "8\n100 200\n660 973 461 774\n844 252 645 648\n770 319 770 319\n494 325 693 126\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is working on a new operating system called BerOS. He asks you to help with implementation of a file suggestion feature.\n\nThere are n files on hard drive and their names are f_1, f_2, ..., f_n. Any file name co... | [{"type": "stdin_stdout", "input": "32\n.\n..\n...\n....\n.....\n......\n.......\n........\n0\n00\n000\n0000\n00000\n000000\n0000000\n00000000\nz\nzz\nzzz\nzzzz\nzzzzz\nzzzzzz\nzzzzzzz\nzzzzzzzz\n9\n99\n999\n9999\n99999\n999999\n9999999\n99999999\n32\n.\n..\n...\n....\n.....\n......\n.......\n........\n0\n00\n000\n0000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches.\n\nThe current state of ... | [{"type": "stdin_stdout", "input": "20\n10 5 2 3 5 7 7 9 4 9 9 4 9 7 7 5 3 2 5 10\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "14\n7 7 7 4 3 3 4 5 4 4 5 7 7 7\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "14\n7 7 7 4 3 3 4 5 4 8 5 7 7 7\n", "output": "YES\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvery superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.\n\nInitially, there are n su... | [{"type": "stdin_stdout", "input": "9 10770 5887448\n3054 105616 81667 103207 41139 64840 76118 11566 22469\n", "output": "116386.0\n"}, {"type": "stdin_stdout", "input": "9 10770 5887448\n3054 105616 81667 103207 41139 64840 22254 11566 22469\n", "output": "116386.0\n"}, {"type": "stdin_stdout", "input": "9 48096 5475... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has written some permutation p_1, p_2, β¦, p_n of integers from 1 to n, so for all 1 β€ i β€ n it is true that 1 β€ p_i β€ n and all p_1, p_2, β¦, p_n are different. After that he wrote n numbers next_1, next_2, β¦, next_n... | [{"type": "stdin_stdout", "input": "10\n4\n2 4 4 5\n4\n2 -1 4 -1\n4\n5 5 5 5\n4\n2 3 4 5\n4\n2 3 4 5\n4\n-1 3 4 5\n4\n-1 3 5 5\n4\n3 3 5 5\n4\n3 4 5 5\n4\n5 4 4 5\n", "output": "1 3 2 4 \n1 2 3 4 \n4 3 2 1 \n1 2 3 4 \n1 2 3 4 \n1 2 3 4 \n1 2 4 3 \n2 1 4 3 \n-1\n4 2 1 3 \n"}, {"type": "stdin_stdout", "input": "10\n4\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are fighting with Zmei Gorynich β a ferocious monster from Slavic myths, a huge dragon-like reptile with multiple heads! \n\n<image>\n\nInitially Zmei Gorynich has x heads. You can deal n types of blows. If you deal a... | [{"type": "stdin_stdout", "input": "5\n4 807989196\n770312657 78181451\n624192034 690910298\n754831733 354913874\n519577171 400120478\n4 491297333\n546432637 76258441\n312107971 75446008\n767483254 958677299\n84044330 577526244\n2 177840791\n197738084 143071228\n23274563 597315796\n7 610054060\n858529462 646280969\n644... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp lives on the coordinate axis Ox and travels from the point x=a to x=b. It moves uniformly rectilinearly at a speed of one unit of distance per minute.\n\nOn the axis Ox at the point x=c the base station of the mo... | [{"type": "stdin_stdout", "input": "9\n4 17 0 0\n0 6 0 0\n5 0 7 3\n52 2 20 010\n-11 20 -40 0\n2 2 0 0\n-2 0 1 4\n-1 4 0 2\n0 4 -10 0\n", "output": "13\n6\n4\n30\n31\n0\n0\n2\n4\n"}, {"type": "stdin_stdout", "input": "9\n1 10 7 1\n3 3 1 0\n8 2 10 4\n10 2 10 100\n-10 20 -17 2\n-3 1 0 0\n-3 1 2 0\n2 3 0 3\n-1 1 -2 2\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a simple weighted connected undirected graph, consisting of n vertices and m edges.\n\nA path in the graph of length k is a sequence of k+1 vertices v_1, v_2, ..., v_{k+1} such that for each i (1 β€ i β€ k) th... | [{"type": "stdin_stdout", "input": "15 15 23\n13 11 12\n11 14 12\n2 15 5\n4 10 8\n10 2 4\n10 7 5\n3 10 1\n5 6 11\n1 13 8\n9 15 4\n4 2 9\n11 15 1\n11 12 14\n10 8 12\n3 6 11\n", "output": "3682\n"}, {"type": "stdin_stdout", "input": "15 15 23\n13 10 12\n11 14 12\n2 15 5\n4 10 5\n8 2 4\n10 7 5\n3 10 1\n5 6 11\n1 13 15\n9 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n + 2 towns located on a coordinate line, numbered from 0 to n + 1. The i-th town is located at the point i.\n\nYou build a radio tower in each of the towns 1, 2, ..., n with probability 1/2 (these events are in... | [{"type": "stdin_stdout", "input": "200000\n", "output": "\n202370013\n"}, {"type": "stdin_stdout", "input": "199998\n", "output": "801261687\n"}, {"type": "stdin_stdout", "input": "199999\n", "output": "503231359\n"}, {"type": "stdin_stdout", "input": "103835\n", "output": "497577175\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a statistic of price changes for one product represented as an array of n positive integers p_0, p_1, ..., p_{n - 1}, where p_0 is the initial price of the product and p_i is how the price was increased during th... | [{"type": "stdin_stdout", "input": "2\n4 1\n20100 1 202 525\n3 101\n1 0 1\n", "output": "32197\n0\n"}, {"type": "stdin_stdout", "input": "2\n4 1\n20100 1 182 525\n3 101\n1 0 1\n", "output": "32217\n0\n"}, {"type": "stdin_stdout", "input": "2\n4 1\n33029 1 202 525\n3 101\n1 0 1\n", "output": "19268\n0\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlexey is travelling on a train. Unfortunately, due to the bad weather, the train moves slower that it should!\n\nAlexey took the train at the railroad terminal. Let's say that the train starts from the terminal at the mo... | [{"type": "stdin_stdout", "input": "2\n2\n2 4\n10 12\n0 2\n5\n1 4\n7 8\n9 10\n13 15\n19 20\n1 2 3 4 5\n", "output": "\n12\n32\n"}, {"type": "stdin_stdout", "input": "2\n2\n2 3\n10 12\n0 2\n5\n1 4\n7 8\n9 10\n13 15\n19 20\n1 2 3 4 5\n", "output": "12\n32\n"}, {"type": "stdin_stdout", "input": "2\n2\n2 3\n10 12\n0 2\n5\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"Contestant who earns a score equal to or greater than the k-th place finisher's score will advance to the next round, as long as the contestant earns a positive score...\" β an excerpt from contest rules.\n\nA total of ... | [{"type": "stdin_stdout", "input": "50 44\n100 100 99 97 95 91 91 84 83 83 79 71 70 69 69 62 61 60 59 59 58 102 58 55 55 54 52 48 47 45 44 44 38 36 38 31 28 28 25 25 24 24 24 22 17 15 14 13 12 4\n", "output": "44\n"}, {"type": "stdin_stdout", "input": "50 44\n100 100 99 97 95 91 91 84 83 83 79 71 70 69 69 62 61 60 59 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second β number B, etc. till column 26 that is marked by Z. Then there are two-le... | [{"type": "stdin_stdout", "input": "10\nR50C12\nR23C47\nY96\nR44C13\nR19C21\nR95C73\nBK12\nR51C74\nAY34\nR63C25\n", "output": "L50\nAU23\nR96C25\nM44\nU19\nBU95\nR12C63\nBV51\nR34C51\nY63\n"}, {"type": "stdin_stdout", "input": "10\nR50C12\nR23C47\nY96\nR44C13\nR19C21\nR95C73\nBK12\nR51C74\nAY34\nR62C25\n", "output": "L... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA bracket sequence is a string, containing only characters \"(\", \")\", \"[\" and \"]\".\n\nA correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting chara... | [{"type": "stdin_stdout", "input": "[()][([[]])][[[]()]][()[]]()()([[][]][[]][](()))[[[(())]]][]()(([([])(([[[]]()])(()))]((())))([()]([()[[[]([][[[[][(())([[]()])]]][[(())]([])]()][[](())]()[])]()[][]]([[]])[]])[(()[()((()[][()]))][])[]()()([]())](()[][][])()()[]()))[]()[]\n", "output": "61\n[()][([[]])][[[]()]][()[]]... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several advan... | [{"type": "stdin_stdout", "input": "285642 492030 560100 388288 354938 20867\n", "output": "216690.214383517276\n"}, {"type": "stdin_stdout", "input": "111724 287004 931554 512877 139642 23002\n", "output": "257255.653204436792"}, {"type": "stdin_stdout", "input": "246310 320553 585881 278070 443362 23788\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGreg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game:\n... | [{"type": "stdin_stdout", "input": "9\n0 85236 27579 82251 69479 24737 87917 15149 52311\n59640 0 74687 34711 3685 30121 4961 7552 83399\n33376 68733 0 81357 18042 74297 15466 29476 5865\n7493 5601 3321 0 20263 55901 45756 55361 87633\n26751 17161 76681 40376 0 39745 50717 56887 90055\n18885 76353 47089 43601 21561 0 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEmail address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters. \n\nBob is a system administrator in Β«BersoftΒ» company. He keeps a list of email addresses of th... | [{"type": "stdin_stdout", "input": "c@ir@xf@ap@fk@sp@wm@ec@qw@vg@by@iu@tr@wu@pv@lj@dd@tc@qj@ok@hm@bs@ul@ez@cg@ht@xf@ag@tr@hz@ap@tx@ly@dg@hu@nd@uv@il@ii@cn@nc@nb@cy@kp@dk@xa@da@ta@yr@yv@qg@db@je@wz@rn@yh@xi@mj@kc@uj@yu@cf@ps@ao@fo@le@d\n", "output": "c@i,r@x,f@a,p@f,k@s,p@w,m@e,c@q,w@v,g@b,y@i,u@t,r@w,u@p,v@l,j@d,d@t,c@... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecule.\n\nA molecule consists of atoms, with some pairs of atoms connected by atomic bonds. Each atom... | [{"type": "stdin_stdout", "input": "1000000 1000000 1000000\n", "output": "500000 500000 500000\n"}, {"type": "stdin_stdout", "input": "602752 645534 784262\n", "output": "232012 413522 370740\n"}, {"type": "stdin_stdout", "input": "688348 726472 442198\n", "output": "486311 240161 202037\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe research center Q has developed a new multi-core processor. The processor consists of n cores and has k cells of cache memory. Consider the work of this processor.\n\nAt each cycle each core of the processor gets one ... | [{"type": "stdin_stdout", "input": "100 1 100\n59\n37\n53\n72\n37\n15\n8\n93\n92\n74\n11\n11\n68\n16\n92\n40\n76\n20\n10\n86\n76\n5\n9\n95\n5\n81\n44\n57\n10\n24\n22\n2\n57\n6\n26\n67\n48\n95\n34\n97\n55\n33\n70\n66\n51\n70\n74\n65\n35\n85\n37\n9\n27\n43\n65\n6\n5\n57\n54\n27\n22\n41\n8\n29\n10\n50\n9\n68\n78\n9\n92\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDevu is a renowned classical singer. He is invited to many big functions/festivals. Recently he was invited to \"All World Classical Singing Festival\". Other than Devu, comedian Churu was also invited.\n\nDevu has provid... | [{"type": "stdin_stdout", "input": "100 6000\n41 31 23 17 24 78 26 96 93 48 46 2 49 33 35 9 73 100 34 48 83 36 33 69 43 24 3 74 8 81 27 33 94 38 77 9 76 90 62 90 21 67 22 22 12 2 17 27 102 18 72 85 59 65 71 38 90 75 74 66 60 47 58 50 90 95 75 10 5 100 97 29 83 88 65 26 93 90 22 98 36 55 70 38 50 92 88 72 99 96 25 14 74... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle beaver is a beginner programmer, so informatics is his favorite subject. Soon his informatics teacher is going to have a birthday and the beaver has decided to prepare a present for her. He planted n flowers in a r... | [{"type": "stdin_stdout", "input": "11 18 8\n4744 4993 1340 4982 4982 1437 2765 2200 6975 4989 10703\n", "output": "1358\n"}, {"type": "stdin_stdout", "input": "11 18 8\n4744 4993 7957 4982 4982 1437 2765 2200 6975 4989 10703\n", "output": "1455\n"}, {"type": "stdin_stdout", "input": "11 18 8\n4996 4993 4988 4982 4982 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence a consisting of n integers. Find the maximum possible value of <image> (integer remainder of ai divided by aj), where 1 β€ i, j β€ n and ai β₯ aj.\n\nInput\n\nThe first line contains integer n β the ... | [{"type": "stdin_stdout", "input": "12\n12 4 37 11 28 30 64 43 22 102 70 226\n", "output": "38\n"}, {"type": "stdin_stdout", "input": "12\n12 4 37 11 28 30 35 43 22 102 70 226\n", "output": "33\n"}, {"type": "stdin_stdout", "input": "12\n6 4 19 11 28 30 35 43 22 102 70 117\n", "output": "47\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchange rate is now assumed to be an integer.... | [{"type": "stdin_stdout", "input": "4314752277691991627730686134692292422155753465948025897701703862445837045929984759093775762579123919\n", "output": "9314752277691991627730686134692292422155753465948025897701703862445837045929984759093775762579123914\n"}, {"type": "stdin_stdout", "input": "354515198058487122724043653... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstable.\n\nIn total the table Arthur bought has n legs, the length of the i-th leg is li.\n\nArthur deci... | [{"type": "stdin_stdout", "input": "30\n20 27 26 17 29 9 25 13 6 21 15 1 14 22 26 2 15 18 20 23 27 9 15 29 11 2 19 23 14 12\n133 199 22 151 9 134 196 119 197 189 117 84 156 6 61 195 98 197 145 75 142 85 187 24 159 3 60 138 156 161\n", "output": "2804\n"}, {"type": "stdin_stdout", "input": "30\n20 27 26 17 29 9 25 13 6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCity X consists of n vertical and n horizontal infinite roads, forming n Γ n intersections. Roads (both vertical and horizontal) are numbered from 1 to n, and the intersections are indicated by the numbers of the roads th... | [{"type": "stdin_stdout", "input": "9\n4 5\n2 3\n8 3\n5 6\n9 3\n4 4\n5 4\n4 7\n1 7\n8 4\n1 4\n1 5\n5 7\n7 8\n7 1\n9 9\n8 7\n7 5\n3 7\n6 6\n7 3\n5 2\n3 6\n7 4\n9 6\n5 8\n9 7\n6 3\n7 9\n1 2\n1 1\n6 2\n5 3\n7 2\n1 6\n4 1\n6 1\n8 9\n2 2\n3 9\n2 9\n7 7\n2 8\n9 4\n2 5\n8 6\n3 4\n2 1\n2 7\n6 5\n9 1\n3 3\n3 8\n5 5\n4 3\n3 1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becomes happy every time he passes from a painting to a more beautiful one.\n\nWe are allowed to arranged pict... | [{"type": "stdin_stdout", "input": "100\n9 9 49 55 14 8 55 58 35 67 3 6 106 169 41 49 15 60 18 66 3 26 97 47 43 88 71 98 12 34 48 17 134 53 8 24 69 49 12 23 77 12 21 88 66 9 29 13 61 69 54 77 41 20 4 65 37 74 7 6 24 210 55 72 89 4 78 27 29 82 13 83 18 4 32 69 89 91 66 13 92 54 38 5 26 56 17 98 29 4 17 39 29 181 3 67 85... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n100 years have passed since the last victory of the man versus computer in Go. Technologies made a huge step forward and robots conquered the Earth! It's time for the final fight between human and robot that will decide t... | [{"type": "stdin_stdout", "input": "68 -9959\n-3666\n-3501\n9169\n5724\n1478\n-643\n-3039\n-5537\n-4295\n-1856\n-6720\n6827\n-39\n-9509\n-7005\n1942\n-5173\n-4564\n2390\n4604\n-6098\n-9847\n-9708\n2382\n7421\n8716\n9718\n9895\n-4553\n-8275\n4771\n1538\n-8131\n9912\n-4334\n-3702\n7035\n-106\n-1298\n-6190\n1321\n332\n767... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProgrammer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in <image>, which Sasha coped with. For Sasha not to think that h... | [{"type": "stdin_stdout", "input": "10 3\n-20\n-63\n-64\n45\n-84\n-13\n79\n-31\n70\n-100\n", "output": "-20\n45\n45\n45\n79\n79\n79\n70\n"}, {"type": "stdin_stdout", "input": "10 3\n-20\n-52\n-64\n45\n-139\n-13\n79\n-31\n89\n-100\n", "output": "-20\n45\n45\n45\n79\n79\n89\n89"}, {"type": "stdin_stdout", "input": "10 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya is managed to enter his favourite site Codehorses. Vanya uses n distinct passwords for sites at all, however he can't remember which one exactly he specified during Codehorses registration.\n\nVanya will enter passw... | [{"type": "stdin_stdout", "input": "20 5\nvSyC787KlIL8kZ2Uv5sw\nWKWOP\n7i8J3E8EByIq\nNW2VyGweL\nmyR2sRNu\nmXusPP0\nf4jgGxra\n4wHRzRhOCpEt\npPz9kybGb\nOtSpePCRoG5nkjZ2VxRy\nwHYsSttWbJkg\nKBOP9\nQfiOiFyHPPsw3GHo8J8\nxB8\nqCpehZEeEhdq\niOLjICK6\nQ91\nHmCsfMGTFKoFFnv238c\nJKjhg\ngkEUh\nKBOP9\n", "output": "3 11\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMahmoud has n line segments, the i-th of them has length ai. Ehab challenged him to use exactly 3 line segments to form a non-degenerate triangle. Mahmoud doesn't accept challenges unless he is sure he can win, so he aske... | [{"type": "stdin_stdout", "input": "40\n740553458 532562042 138583675 75471987 487348843 476240280 972115023 103690894 546736371 1412788259 35356828 819948191 138721993 24257926 761587264 767176616 608310208 78275645 386063134 227581756 672567198 177797611 87579917 941781518 274774331 843623616 981221615 630282032 1188... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHaiku is a genre of Japanese traditional poetry.\n\nA haiku poem consists of 17 syllables split into three phrases, containing 5, 7 and 5 syllables correspondingly (the first phrase should contain exactly 5 syllables, the... | [{"type": "stdin_stdout", "input": "aaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\naaaaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\naaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudents went into a class to write a test and sat in some way. The teacher thought: \"Probably they sat in this order to copy works of each other. I need to rearrange them in such a way that students that were neighbors ... | [{"type": "stdin_stdout", "input": "22 111\n", "output": "YES\n1325 2017 8 2351 2152 1579 2251 2072 1773 1195 1308 1215 324 1208 1633 1064 12 2073 2428 1217 1700 918 1085 1651 475 2312 77 1616 1071 2423 673 848 901 1414 236 1533 494 192 168 1404 812 213 823 2238 1334 2236 1774 568 828 1838 358 1331 461 893 1439 1169 14... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA classroom in a school has six rows with 3 desks in each row. Two people can use the same desk: one sitting on the left and one sitting on the right. \n\nSome places are already occupied, and some places are vacant. Pety... | [{"type": "stdin_stdout", "input": "..-**-..\n..-**-..\n..-..-..\n..-..-..\n..-..-..\n..-..-..\n", "output": "P.-**-..\n..-**-..\n..-..-..\n..-..-..\n..-..-..\n..-..-..\n"}, {"type": "stdin_stdout", "input": "**-**-**\n**-**-**\n..-**-.*\n**-**-**\n..-..-..\n..-**-..\n", "output": "**-**-**\n**-**-**\nP.-**-.*\n**-**-*... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, ababa is adorable ... | [{"type": "stdin_stdout", "input": "aaaaaaaabbbbbcder\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "abaaaaaabbbbbcder\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "abaaaaaabbbbbcdes\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "aaaaaaabbbbbbcder\n", "output": "NO"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr Keks is a typical white-collar in Byteland.\n\nHe has a bookshelf in his office with some books on it, each book has an integer positive price.\n\nMr Keks defines the value of a shelf as the sum of books prices on it. ... | [{"type": "stdin_stdout", "input": "30 4\n893642632982367 772277951746295 510759449350295 826812150840579 1060893142351815 525992742241552 154832018679993 645715002371268 27232975419720 475004229372388 200177708355593 810661468479466 49618609534806 301608930846726 97042172725806 441637617418914 594900693592862 62651070... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSometimes inventing a story for the problem is a very hard task.\nFortunately for us, Limak has just been kidnapped by an insane mathematician.\nWe need some name for the mathematician and let it be Mathew.\n\nLimak is a ... | [{"type": "stdin_stdout", "input": "100\n9 657681137\n9 459211231\n9 421854149\n10 919145723\n9 201797513\n6 105479273\n7 119609519\n8 336121607\n9 93853663\n10 260929637\n9 974056219\n10 551709247\n10 607613777\n9 689940947\n9 14567611\n10 81152371\n9 502271117\n10 496195387\n10 796995161\n9 556351291\n10 691502167\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRoss and Rachel are on a date. Ross, being the super geek he is, takes Rachel to see dinosaur exhibits. \nEach dinosaur has a name and K attributes which are described by an ordered K-tuple ( A1, A2, A3,..., AK ). Each at... | [{"type": "stdin_stdout", "input": "5 3 9 5\nbaryonyx 5 1 14\nairbboj -1 3 8\npviarptor 9 5 1\ntsondom 11 17 3\nminmi 7 4 5\n9 7 1\n1 2 3\n5 16 13\n3 2 3\n7 4 4\n\nSAMPLE", "output": "You cant fool me :P\nYou cant fool me :P\nYou cant fool me :P\nYou cant fool me :P\nYou cant fool me :P\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Ram got to know about a secret place where he can play many games to win lot of prize. Games are very easy, so he can easily win high prize, but he can play a limited number of games.\nHe want to win the maximum ... | [{"type": "stdin_stdout", "input": "5\n5 5\n1 1 1 1 1\n4 0\n1 1 1 1\n3 1\n8 10 8\n6 11\n100 262 300 341 500 1100\n2 4\n2 5\n\nSAMPLE", "output": "5\n0\n10\n2603\n7\n"}, {"type": "stdin_stdout", "input": "5\n5 5\n1 1 1 1 1\n4 0\n1 1 1 1\n3 1\n8 10 8\n6 11\n100 262 300 608 500 1100\n2 4\n2 5\n\nSAMPLE", "output": "5\n0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an two integers i and j such that i β€ j.\nTask is to find the sum of all integers from i to j (both inclusive). \n\nFor example:\ni = 3\nj = 5\nthen sum from i to j will be 3+4+5 = 12 \n\nInput:\nSingle li... | [{"type": "stdin_stdout", "input": "117 1000000000100\n\nT@MPLE", "output": "500000000100499999998264\n"}, {"type": "stdin_stdout", "input": "117 1000000001100\n\nT@MPLE", "output": "500000001100500000598764\n"}, {"type": "stdin_stdout", "input": "117 1001000001100\n\nT@MPLE", "output": "501000501101600500598764\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle PandeyG is a curious student, studying in HEgwarts. Being smarter, faster and displaying more zeal for magic than any other student, one by one he managed to impress the three hidden witches of the school. They kne... | [{"type": "stdin_stdout", "input": "100\n273457900\n426795959\n566201490\n178331926\n758516183\n324609619\n697289003\n473088422\n560067111\n678996275\n511809062\n485788833\n821690097\n72858722\n487771337\n655455479\n1360847206\n240111601\n850089979\n474130333\n53486217\n295773355\n240831554\n423513160\n943606966\n54387... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are integers a,b,c and d. If x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n* -10^9 \\leq a \\leq b \\leq 10^9\n* -10^9 \\l... | [{"type": "stdin_stdout", "input": "-104263787 -2 -1413615786 -1", "output": "147388935211341582\n"}, {"type": "stdin_stdout", "input": "-104263787 -2 -1511060856 -1", "output": "157548927234021672\n"}, {"type": "stdin_stdout", "input": "-145189730 -2 -1511060856 -1", "output": "219390517696208880\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\n\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\n\nTakahashi, the king, loves the positive integer K... | [{"type": "stdin_stdout", "input": "6 1007784494318310970\n6 5 2 5 3 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "6 1122048832909353099\n6 4 1 1 3 2", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 2190427306125562200\n6 4 1 1 3 2", "output": "1\n"}, {"type": "stdin_stdout", "input": "6 219042730612... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n* 3 \\leq N \\leq 50\n* S consi... | [{"type": "stdin_stdout", "input": "33\nABCCABCBABCCABACBCBBABCBCBCBCABDB", "output": "4\n"}, {"type": "stdin_stdout", "input": "33\nBDBACBCBCBCBABBCBCABACCBABCBACCBA", "output": "1\n"}, {"type": "stdin_stdout", "input": "33\nABCCABCBABCCABACBCBBABCBCBDBCABCB", "output": "5\n"}, {"type": "stdin_stdout", "input": "33\nB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a directed graph with N vertices numbered 1 to N and M edges. The i-th edge is directed from Vertex A_i to Vertex B_i, and there are C_i coins \bplaced along that edge. Additionally, there is a button on Vertex N... | [{"type": "stdin_stdout", "input": "4 5 10\n2 2 2\n1 4 -1\n3 4 0\n1 4 101\n3 3 100", "output": "91\n"}, {"type": "stdin_stdout", "input": "4 5 10\n2 2 2\n1 4 0\n3 4 0\n1 4 111\n3 3 100", "output": "101\n"}, {"type": "stdin_stdout", "input": "4 5 10\n1 4 3\n2 3 1\n2 2 1\n2 1 100\n1 4 110", "output": "100\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn the Planet AtCoder, there are four types of bases: `A`, `C`, `G` and `T`. `A` bonds with `T`, and `C` bonds with `G`.\n\nYou are given a letter b as input, which is `A`, `C`, `G` or `T`. Write a program that prints the... | [{"type": "stdin_stdout", "input": "C", "output": "G\n"}, {"type": "stdin_stdout", "input": "T", "output": "A\n"}, {"type": "stdin_stdout", "input": "C", "output": "G\n"}, {"type": "stdin_stdout", "input": "T", "output": "A\n"}, {"type": "stdin_stdout", "input": "G", "output": "C"}, {"type": "stdin_stdout", "input": "A... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer N. Determine if there exists a tuple of subsets of \\\\{1,2,...N\\\\}, (S_1,S_2,...,S_k), that satisfies the following conditions:\n\n* Each of the integers 1,2,...,N is contained in exactly two o... | [{"type": "stdin_stdout", "input": "3", "output": "Yes\n3\n2 1 2\n2 3 1\n2 2 3"}, {"type": "stdin_stdout", "input": "1", "output": "Yes\n2\n1 1\n1 1\n"}, {"type": "stdin_stdout", "input": "-122", "output": "No\n"}, {"type": "stdin_stdout", "input": "-16", "output": "No\n"}, {"type": "stdin_stdout", "input": "-10", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSitting in a station waiting room, Joisino is gazing at her train ticket.\n\nThe ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).\n\nIn the formula A op1 B op2 C op3 D = 7... | [{"type": "stdin_stdout", "input": "2364", "output": "2+3+6-4=7\n"}, {"type": "stdin_stdout", "input": "1114", "output": "1+1+1+4=7\n"}, {"type": "stdin_stdout", "input": "2005", "output": "2+0+0+5=7\n"}, {"type": "stdin_stdout", "input": "1455", "output": "1-4+5+5=7\n"}, {"type": "stdin_stdout", "input": "1152", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are taking a computer-based examination. The examination consists of N questions, and the score allocated to the i-th question is s_i. Your answer to each question will be judged as either \"correct\" or \"incorrect\"... | [{"type": "stdin_stdout", "input": "3\n-101\n-1\n-1", "output": "-103\n"}, {"type": "stdin_stdout", "input": "3\n-109\n-1\n-1", "output": "-111\n"}, {"type": "stdin_stdout", "input": "3\n-156\n-1\n-1", "output": "-158\n"}, {"type": "stdin_stdout", "input": "3\n-166\n-1\n-1", "output": "-168\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n... | [{"type": "stdin_stdout", "input": "dreameraser", "output": "YES"}, {"type": "stdin_stdout", "input": "resaremaerd", "output": "NO\n"}, {"type": "stdin_stdout", "input": "ersaremaerd", "output": "NO\n"}, {"type": "stdin_stdout", "input": "ersaremadrd", "output": "NO\n"}, {"type": "stdin_stdout", "input": "ersarfmadrd",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBooks are indexed. Write a program which reads a list of pairs of a word and a page number, and prints the word and a list of the corresponding page numbers.\n\nYou can assume that a word consists of at most 30 characters... | [{"type": "stdin_stdout", "input": "ntzsd 22\neevn 1\nnutrodnctioi -1\nse_z 1\nstyle 32\ntndmucod 2\nstyld 10\nmuee -2", "output": "eevn\n1\nmuee\n-2\nntzsd\n22\nnutrodnctioi\n-1\nse_z\n1\nstyld\n10\nstyle\n32\ntndmucod\n2\n"}, {"type": "stdin_stdout", "input": "ntzsd 10\neevn 1\nnutrodnctioi -1\nse_z 1\nstyle 32\ntndm... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFood contains three nutrients called \"protein\", \"fat\" and \"carbohydrate\", which are called three major nutrients. It is calculated that protein and carbohydrate are 4 kcal (kilocalories) and fat is 9 kcal per 1 g (g... | [{"type": "stdin_stdout", "input": "4\n1 7 14 47\n2 5 35 55\n3 6 3 59\n4 6 5 15\n10 15 50 110\n2\n1 8 10 116\n-1 4 18 33\n10 10 50 300\n0", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "4\n1 7 14 47\n2 5 35 55\n3 6 3 59\n4 6 5 15\n10 15 50 110\n2\n1 8 10 116\n0 4 18 33\n10 10 50 300\n0", "output": "NA\nNA\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two cameras which observe the up line and the down line respectively on the double lane (please see the following figure). These cameras are located on a line perpendicular to the lane, and we call the line 'mon... | [{"type": "stdin_stdout", "input": "4 5\n20 35 110 70\n15 30 40 84 113\n3 2\n10 20 30\n81 60\n0 1\n100\n1 1\n10\n83\n0 0", "output": "30\n30\n100\n73\n"}, {"type": "stdin_stdout", "input": "4 5\n20 60 110 70\n15 30 40 84 113\n3 2\n10 20 30\n42 60\n0 1\n100\n1 1\n10\n83\n0 0", "output": "26\n18\n100\n73\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDo you know the famous series of children's books named \"Where's Wally\"? Each of the books contains a variety of pictures of hundreds of people. Readers are challenged to find a person called Wally in the crowd.\n\nWe c... | [{"type": "stdin_stdout", "input": "48 3 3\ngAY4I4wA\ngIIgIIgg\nw4IAYAg4\ng\ng\nw\n153 3 3\nkkkkkkkkkkkkkkkkkkkkkkkkkg\nSSSSSSSSSSSSSSSSSSSSSSSSSQ\nJJJJJJJJJJJJJJJJJJJJJJJJJI\ng\nQ\nJ\n1 1 2\nA\nA\nA\n384 3 2\nABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\nBCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrs... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nG, a college student living in a certain sky city, has a hornworm, Imotaro. He disciplined Imotaro to eat all the food in order with the shortest number of steps. You, his friend, decided to write a program because he ask... | [{"type": "stdin_stdout", "input": "5 8 3\n#.......\n#.####2#\n#.#.3..#\n######.#\n.1Sabcde", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5 8 3\n.......#\n#.####2#\n#.#.3..#\n#.######\n.1Sabcde", "output": "14\n"}, {"type": "stdin_stdout", "input": "5 8 2\n.......#\n#.#\"##2#\n#..3.#.#\n#.######\n.1Sabcde", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is a story of a world somewhere far from the earth. In this world, the land is parted into a number of countries ruled by empires. This world is not very peaceful: they have been involved in army race.\n\nThey are co... | [{"type": "stdin_stdout", "input": "3 3\n3 4 1 1\n2 1 5\n2 3 3\n3 6\n3 2 5 1\n2 1 5\n2 3 3\n0 0", "output": "Yes\nYes\n"}, {"type": "stdin_stdout", "input": "3 6\n3 8 1 1\n2 2 6\n2 2 3\n3 3\n3 2 5 1\n2 1 11\n2 3 3\n0 0", "output": "Yes\nNo\n"}, {"type": "stdin_stdout", "input": "3 2\n3 11 1 1\n2 2 8\n2 2 3\n3 5\n3 4 5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt the school where the twins Ami and Mami attend, the summer vacation has already begun, and a huge amount of homework has been given this year as well. However, the two of them were still trying to go out without doing ... | [{"type": "stdin_stdout", "input": "4\n1 2\n3 1\n4 1\n2 1\n3\n10 4\n1 2\n1 2\n1\n1000 1000\n10\n5 62\n10 68\n15 132\n20 73\n25 75\n30 77\n35 79\n40 82\n45 100\n815 283\n6\n106 21\n53 55\n118 77\n19 13\n83 42\n2 1\n0", "output": "15\n24\n3000\n2072\n590\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n3 1\n4 1\n2 2\n3\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nD: Rescue a Postal Worker\n\nstory\n\nYou got a job at the post office, which you have long dreamed of this spring. I decided on the delivery area I was in charge of, and it was my first job with a feeling of excitement, ... | [{"type": "stdin_stdout", "input": "8 6 1 1\n1 3 5\n1 1 2\n2 3 1\n3 5 4\n3 4 2\n4 5 3\n3 6", "output": "Cannot deliver\n"}, {"type": "stdin_stdout", "input": "8 6 1 1\n1 3 4\n1 1 2\n2 3 1\n3 5 4\n3 4 2\n4 5 3\n3 6", "output": "Cannot deliver\n"}, {"type": "stdin_stdout", "input": "5 6 1 1\n2 3 5\n1 1 2\n2 3 1\n3 5 4\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThe point $ P $ is placed at the origin on the coordinate plane. I want to move the point $ P $ to a position where the Manhattan distance from the origin is as far as possible.\n\nFirst, the string $ S = s_1s_... | [{"type": "stdin_stdout", "input": "UDDTLSD\n15", "output": "7\n"}, {"type": "stdin_stdout", "input": "DSLTDDU\n12", "output": "7\n"}, {"type": "stdin_stdout", "input": "UDDTMSD\n15", "output": "7\n"}, {"type": "stdin_stdout", "input": "DSLTDDU\n10", "output": "7\n"}, {"type": "stdin_stdout", "input": "UDETMSD\n15", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSet\n\nGiven the sequence a_1, a_2, .., a_N.\n\nHow many values ββare there in this sequence?\n\ninput\n\n\nN\na_1 a_2 ... a_N\n\n\noutput\n\nOutput the number of types of values ββin the sequence.\n\nConstraint\n\n* 1 \\... | [{"type": "stdin_stdout", "input": "6\n-4 -3 1 -1 27 -1", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n-1 0 63 -1 3 -1", "output": "4\n"}, {"type": "stdin_stdout", "input": "6\n-2 -1 25 -2 4 0", "output": "5\n"}, {"type": "stdin_stdout", "input": "6\n-1 -1 25 -2 4 0", "output": "5\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a sequence $A = a_0, a_1, ..., a_{n-1}$. You are given the following information and questions.\n\n* relate$(x, y, z)$: $a_y$ is greater than $a_x$ by $z$\n* diff$(x, y)$: report the difference between $a_x$ and ... | [{"type": "stdin_stdout", "input": "5 17\n0 0 2 5\n0 1 0 2\n1 0 2\n0 1 3\n0 1 4 3\n1 0 1", "output": "5\n?\n-2\n-2\n-2\n-2\n-2\n-2\n-2\n-2\n-2\n-2\n-2\n-2\n"}, {"type": "stdin_stdout", "input": "5 17\n0 0 2 5\n0 2 3 5\n1 0 1\n1 0 0\n0 1 3 4\n1 0 4", "output": "?\n0\n?\n?\n?\n?\n?\n?\n?\n?\n?\n?\n?\n?\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMultiplication of Big Integers II\n\nGiven two integers $A$ and $B$, compute the product, $A \\times B$.\n\nInput\n\nTwo integers $A$ and $B$ separated by a space character are given in a line.\n\nOutput\n\nPrint the prod... | [{"type": "stdin_stdout", "input": "-15 87", "output": "-1305\n"}, {"type": "stdin_stdout", "input": "-81 -15", "output": "1215\n"}, {"type": "stdin_stdout", "input": "-1 -111", "output": "111\n"}, {"type": "stdin_stdout", "input": "-23 -15", "output": "345\n"}, {"type": "stdin_stdout", "input": "-46 -15", "output": "6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLeonid is developing new programming language. The key feature of his language is fast multiplication and raising to a power operations. He is asking you to help with the following task. \nYou have an expression S and pos... | [{"type": "stdin_stdout", "input": "2\n1000 2**3*3**1\n100000 4**2*2**11", "output": "24\n32768\n"}, {"type": "stdin_stdout", "input": "2\n1001 2**3*2**1\n100000 4**2*2**11", "output": "16\n32768\n"}, {"type": "stdin_stdout", "input": "2\n1000 2**4*3**1\n111000 4**2*2**11", "output": "48\n32768\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome programming contest problems are really tricky: not only do they\nrequire a different output format from what you might have expected, but\nalso the sample output does not show the difference. For an example,\nlet us... | [{"type": "stdin_stdout", "input": "4\n-2 1 2 4\n5\n-1 3 0 3 0\n1\n1\n0", "output": "not ambiguous\nnot ambiguous\nambiguous\n"}, {"type": "stdin_stdout", "input": "4\n-1 4 2 4\n5\n0 3 4 3 0\n1\n1\n0", "output": "not ambiguous\nnot ambiguous\nambiguous\n"}, {"type": "stdin_stdout", "input": "4\n-1 4 2 1\n5\n0 3 4 3 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMaxim wants to buy some games at the local game shop. There are n games in the shop, the i-th game costs c_i.\n\nMaxim has a wallet which can be represented as an array of integers. His wallet contains m bills, the j-th b... | [{"type": "stdin_stdout", "input": "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 4\n4 8 15 16 23 42\n1000 1000 1000 1010\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 4\n4 8 17 16 23 42\n1000 1000 1000 1010\n", "output": "4\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt a break Vanya came to the class and saw an array of n k-bit integers a_1, a_2, β¦, a_n on the board. An integer x is called a k-bit integer if 0 β€ x β€ 2^k - 1. \n\nOf course, Vanya was not able to resist and started cha... | [{"type": "stdin_stdout", "input": "20 30\n30095551 418501267 319405832 181290086 651729244 244371014 1160853882 491522284 582219539 1510068105 512276151 438340777 293617992 759003208 759003208 1 1043646272 1073741823 1431280338 1073741823\n", "output": "210\n"}, {"type": "stdin_stdout", "input": "20 30\n30095551 41850... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMakoto has a big blackboard with a positive integer n written on it. He will perform the following action exactly k times:\n\nSuppose the number currently written on the blackboard is v. He will randomly pick one of the d... | [{"type": "stdin_stdout", "input": "1000000000000000 10000\n", "output": "215514159\n"}, {"type": "stdin_stdout", "input": "1000000000001000 10000\n", "output": "150774797\n"}, {"type": "stdin_stdout", "input": "1172768550854780 8998\n", "output": "789402181\n"}, {"type": "stdin_stdout", "input": "1292761461062695 8123... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the constraints.\n\nPolycarp has to write a coursework. The coursework consists of m pages.\n\nPolycarp also has n cups of coffee. The coffee in the i-th cup Polycarp ... | [{"type": "stdin_stdout", "input": "100 10000\n93 99 95 105 94 108 104 104 102 112 106 82 114 104 88 107 105 104 93 96 103 109 105 82 107 95 83 93 120 115 96 104 96 86 87 102 103 108 97 84 108 117 109 107 80 87 102 107 88 97 96 101 101 114 106 103 99 101 105 102 85 94 98 101 115 100 91 92 108 105 94 110 91 89 119 119 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n[Thanos sort](https://codegolf.stackexchange.com/questions/182221/implement-the-thanos-sorting-algorithm) is a supervillain sorting algorithm, which works as follows: if the array is not sorted, snap your fingers* to remo... | [{"type": "stdin_stdout", "input": "16\n12 17 18 51 49 54 107 59 68 74 88 91 98 100 66 49\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "16\n12 17 18 51 52 54 56 59 68 74 88 91 98 100 66 49\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "16\n12 17 18 51 49 54 56 59 68 74 88 91 98 100 66 49\n", "outpu... | 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\nIvan plays a computer game that contains some microtransactions to make characters look cooler. Since Ivan wants his character to be really cool, he wa... | [{"type": "stdin_stdout", "input": "78 36\n0 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 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 1 0 0 0 0 0 0 0 0 0 0\n1 52\n2 6\n9 43\n10 52\n4 63\n9 35\n10 67\n9 17\n3 43\n4 38\n1 27\n9 44\n6 74\n7 3\n8 18\n1 52\n1 68\n5 51\n5 2\n11 50\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHeidi found out that the Daleks have created a network of bidirectional Time Corridors connecting different destinations (at different times!). She suspects that they are planning another invasion on the entire Space and ... | [{"type": "stdin_stdout", "input": "10 26\n9 5 277429172\n10 8 789225932\n5 2 992601916\n9 8 277294258\n8 6 245446241\n9 2 378979732\n7 1 895407000\n10 6 699661758\n1 9 865851152\n2 8 397672809\n7 10 756200111\n8 3 431547893\n5 6 465205287\n7 4 957301499\n3 4 308491540\n3 7 258504473\n10 5 282875145\n1 8 262659451\n5 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers.\n\nYour task is to say the number of such positive integers x such that x divides each number from the array. In other words, you have to find the number of common diviso... | [{"type": "stdin_stdout", "input": "6\n10000100623 10000100623 10000100623 10000100623 10000100623 10000100623\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n153965681607 99999999977 99999999977 99999999977 99999999977\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n153965681607 99999999977 999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet n be a positive integer. Let a, b, c be nonnegative integers such that a + b + c = n.\n\nAlice and Bob are gonna play rock-paper-scissors n times. Alice knows the sequences of hands that Bob will play. However, Alice ... | [{"type": "stdin_stdout", "input": "7\n2\n1 1 0\nRR\n2\n2 0 0\nSS\n2\n2 0 0\nRR\n3\n1 2 0\nRRR\n3\n2 1 0\nRRR\n1\n1 0 0\nP\n1\n1 0 0\nS\n", "output": "YES\nPR\nYES\nRR\nNO\nYES\nPPR\nNO\nNO\nYES\nR\n"}, {"type": "stdin_stdout", "input": "7\n2\n1 1 0\nRR\n2\n2 0 0\nSS\n2\n2 0 1\nRR\n3\n1 2 0\nRRR\n3\n2 1 0\nRRR\n1\n1 0 ... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.