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\nCompute A \\times B.\n\nConstraints\n\n* 1 \\leq A \\leq 100\n* 1 \\leq B \\leq 100\n* All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\n\nA B\n\n\nOutput\n\nPrin... | [{"type": "stdin_stdout", "input": "101 110", "output": "11110\n"}, {"type": "stdin_stdout", "input": "101 111", "output": "11211\n"}, {"type": "stdin_stdout", "input": "101 101", "output": "10201\n"}, {"type": "stdin_stdout", "input": "100 110", "output": "11000\n"}, {"type": "stdin_stdout", "input": "100 111", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCaracal is fighting with a monster.\n\nThe health of the monster is H.\n\nCaracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens:\n\n* If the mons... | [{"type": "stdin_stdout", "input": "1010000000000", "output": "1099511627775\n"}, {"type": "stdin_stdout", "input": "1110100001000", "output": "2199023255551\n"}, {"type": "stdin_stdout", "input": "1010000001000", "output": "1099511627775\n"}, {"type": "stdin_stdout", "input": "1011000000000", "output": "1099511627775\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi's house has only one socket.\n\nTakahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.\n\nOne power strip with A sockets can extend one empty socket int... | [{"type": "stdin_stdout", "input": "2 15", "output": "14\n"}, {"type": "stdin_stdout", "input": "2 14", "output": "13\n"}, {"type": "stdin_stdout", "input": "2 13", "output": "12\n"}, {"type": "stdin_stdout", "input": "2 17", "output": "16\n"}, {"type": "stdin_stdout", "input": "2 26", "output": "25\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a circle whose perimeter is divided by N points into N arcs of equal length, and each of the arcs is painted red or blue. Such a circle is said to generate a string S from every point when the following condition... | [{"type": "stdin_stdout", "input": "45 0\nRRRRRRRBRB", "output": "537720622"}, {"type": "stdin_stdout", "input": "43 0\nBRRRRRRRRB", "output": "969323029"}, {"type": "stdin_stdout", "input": "74 0\nBRRRRRRRRB", "output": "590601443"}, {"type": "stdin_stdout", "input": "42 1\nBSRRRRRRRB", "output": "599074578"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nColoring of the vertices of a tree G is called a good coloring when, for every pair of two vertices u and v painted in the same color, picking u as the root and picking v as the root would result in isomorphic rooted tree... | [{"type": "stdin_stdout", "input": "13\n5 6\n5 4\n2 8\n4 7\n8 9\n3 2\n10 4\n11 10\n2 4\n13 10\n1 8\n12 1", "output": "4 12\n"}, {"type": "stdin_stdout", "input": "13\n5 6\n5 4\n2 8\n4 7\n8 9\n3 2\n10 4\n11 10\n2 5\n13 10\n1 8\n12 1", "output": "4 16\n"}, {"type": "stdin_stdout", "input": "13\n5 6\n5 4\n2 8\n4 7\n1 9\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph G. G has N vertices and M edges. The vertices are numbered from 1 through N, and the i-th edge (1 ≤ i ≤ M) connects Vertex a_i and b_i. G does not have self-loops and multiple edges.\n\nY... | [{"type": "stdin_stdout", "input": "20 1\n6 1\n0 0\n0 -1\n1 17\n2 3\n23 2", "output": "170\n"}, {"type": "stdin_stdout", "input": "34 1\n6 1\n0 0\n0 -1\n1 13\n2 3\n23 2", "output": "527\n"}, {"type": "stdin_stdout", "input": "17 -1\n2 0\n-1 0\n0 8\n1 7\n4 4\n15 4", "output": "121\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N irregular jigsaw pieces. Each piece is composed of three rectangular parts of width 1 and various heights joined together. More specifically:\n\n* The i-th piece is a part of height H, with another part of heigh... | [{"type": "stdin_stdout", "input": "10 10\n1 2 0 3\n1 0 2 0\n-1 1 3 0\n2 0 -2 0\n3 1 2 5\n0 1 6 -1\n3 0 1 -1\n1 4 3 -1\n1 2 1 3\n0 3 0 0", "output": "NO\n"}, {"type": "stdin_stdout", "input": "10 10\n1 2 0 3\n1 0 2 0\n-1 1 3 0\n2 0 -2 0\n3 1 2 5\n0 1 6 -1\n3 0 1 -1\n0 4 3 -1\n1 2 1 3\n0 3 0 0", "output": "NO\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program that reads the coordinates of the vertices of a convex n-sided polygon (a polygon whose internal angles are less than 180 degrees, that is, a polygon that is not dented) and outputs its area. The vertices ... | [{"type": "stdin_stdout", "input": "0.0,0.0\n0.0,1.0\n1.0,1.0\n2.0,0.0\n1.0,-1.0", "output": "2.500000"}, {"type": "stdin_stdout", "input": "0.0,0.0\n0.0,1.0\n0.0,.11\n2.1,0.0\n1.1,-1.0", "output": "1.1655\n"}, {"type": "stdin_stdout", "input": "0.1,0.0\n0.0,1.0\n1.01,.0\n2.0,0.0\n1.0,-0.0", "output": "0.455\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt Akabeko Elementary School, all the students participate in a slightly unusual jogging. Students run their own lap courses at their own pace. After going around each of your courses, you will be returned to elementary s... | [{"type": "stdin_stdout", "input": "2\n3 4\n13 4\n5\n789 289\n166 46\n9 4\n617 272\n972 303\n2\n11 5\n23 20\n0", "output": "13\n3\n1598397732\n1209243492\n1939462992\n1923746112\n1360317793\n23\n44\n"}, {"type": "stdin_stdout", "input": "2\n3 4\n13 4\n5\n789 289\n166 46\n9 4\n617 272\n972 303\n2\n11 5\n32 20\n0", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShe is an extraordinary girl. She works for a library. Since she is young and cute, she is forced to do a lot of laborious jobs. The most annoying job for her is to put returned books into shelves, carrying them by a cart... | [{"type": "stdin_stdout", "input": "2\n2\nYYZNNNNY\n4\nNNNYYNYNNNYYONYN", "output": "6\n10\n"}, {"type": "stdin_stdout", "input": "2\n2\nYYZNYNNN\n4\nNNNYYNYNNNYYNNYN", "output": "5\n10\n"}, {"type": "stdin_stdout", "input": "2\n2\nYYZNNNNY\n4\nNNNYNNYNYNYYONYN", "output": "6\n11\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a square mesh is marked. They use only a s... | [{"type": "stdin_stdout", "input": "2 1\n5 2\n6 6\n2 0 0 2 1 -1\n1 1 0 0 -1 0\n0 0 0 0 0 1\n0 0 -1 0 0 0\n1 0 0 0 -1 1\n0 1 1 1 0 1\n6 1\n1 1 2 1 1 3\n6 1\n1 0 2 1 1 3\n12 1\n2 0 1 1 1 1 1 1 1 1 1 3\n13 1\n2 0 0 1 1 1 1 1 1 1 1 1 3\n0 0", "output": "-1\n-1\n-1\n4\n10\n10\n"}, {"type": "stdin_stdout", "input": "2 1\n5 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHideyuki is allowed by his father Ujisato some 1000 yen bills every month for his pocket money. In the first day of every month, the number of bills is decided as follows. Ujisato prepares n pieces of m-sided dice and dec... | [{"type": "stdin_stdout", "input": "2 6 -1\n2 12 0\n6 18 9\n13 2 52\n1 2008 3\n0 0 0", "output": "8.0000000000\n13.0000000000\n48.0000035281\n1.0000000000\n1001.5029880478\n"}, {"type": "stdin_stdout", "input": "2 6 -1\n2 12 0\n6 18 5\n13 2 52\n1 2008 3\n0 0 0", "output": "8.0000000000\n13.0000000000\n52.0000000000\n1.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a competitive relationship with eac... | [{"type": "stdin_stdout", "input": "2\n-10 1 10 1\n4\n-6 2 -2 -2 1 1\n-6 -2 -2 2 1 0\n12 2 1 -2 0 0\n11 -2 2 2 1 1\n8 12 -7 -3\n8\n4 -5 4 -2 1 2\n4 -2 4 9 1 0\n6 9 6 14 1 1\n-5 6 7 6 0 0\n1 0 1 10 0 0\n-5 0 -5 10 0 1\n-7 -1 7 0 0 1\n-1 -1 -1 -3 0 1", "output": "2\n3\n"}, {"type": "stdin_stdout", "input": "2\n-10 2 10 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Fukuoka has placed a simple robot in a two-dimensional maze. It moves within the maze and never goes out of the maze as there is no exit.\n\nThe maze is made up of H × W grid cells as depicted below. The upper side of... | [{"type": "stdin_stdout", "input": "3 3 10\nE..\n.#.\n...\n5 5 37\n####.\n.....\n.#S#.\n...#.\n#.##.\n5 10 1\n#.#..\n#....\n##.#.\n#..S.\n#....\n5 4 35\n.#.#\n....\n.##.\n.#S.\n...#\n0 0 0", "output": "1 3 E\n4 5 N\n5 4 S\n5 1 S\n"}, {"type": "stdin_stdout", "input": "3 3 10\nE..\n.#.\n...\n5 5 19\n####.\n.....\n.#S#.\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a complete graph of m vertices. Initially, the edges of the complete graph are uncolored. Sunuke did the following for each i (1 ≤ i ≤ n): Select ai vertices from the complete graph and color all edges connecting... | [{"type": "stdin_stdout", "input": "5\n2\n3\n4\n10\n6", "output": "17\n"}, {"type": "stdin_stdout", "input": "5\n2\n3\n3\n5\n6", "output": "11\n"}, {"type": "stdin_stdout", "input": "5\n2\n3\n5\n5\n6", "output": "13\n"}, {"type": "stdin_stdout", "input": "5\n2\n3\n4\n5\n6", "output": "12"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n1\n\n\nOutput\n\n)(\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 code to solve this prob... | [{"type": "stdin_stdout", "input": "321", "output": ")))))))))))))))))))))())))((((((((((((((((((((((((\n"}, {"type": "stdin_stdout", "input": "222", "output": "))))))))))))()))))))))((((((((((((((((((((\n"}, {"type": "stdin_stdout", "input": "193", "output": ")))()))))))))))))))))(((((((((((((((((((\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given n points in metric space, find the distance of the closest points.\n\nConstraints\n\n* 2 ≤ n ≤ 100,000\n* -100 ≤ x, y ≤ 100\n\nInput\n\n\nn\nx0 y0\nx1 y1\n:\nxn-1 yn-1\n\n\nThe first integer n is the number of p... | [{"type": "stdin_stdout", "input": "3\n1.2898350068806816 1.1467446289152408\n2.4176469021911005 0.7451543895838713\n1.341841261706021 1.7448621958767283", "output": "0.600374279\n"}, {"type": "stdin_stdout", "input": "3\n1.2898350068806816 1.8470651543589152\n3.7080917383371705 0.7451543895838713\n1.341841261706021 1.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given an integer $n$, print all permutations of $\\\\{1, 2, ..., n\\\\}$ in lexicographic order.\n\nConstraints\n\n* $1 \\leq n \\leq 9$\n\nInput\n\nAn integer $n$ is given in a line.\n\nOutput\n\nPrint each permutati... | [{"type": "stdin_stdout", "input": "5", "output": "1 2 3 4 5\n1 2 3 5 4\n1 2 4 3 5\n1 2 4 5 3\n1 2 5 3 4\n1 2 5 4 3\n1 3 2 4 5\n1 3 2 5 4\n1 3 4 2 5\n1 3 4 5 2\n1 3 5 2 4\n1 3 5 4 2\n1 4 2 3 5\n1 4 2 5 3\n1 4 3 2 5\n1 4 3 5 2\n1 4 5 2 3\n1 4 5 3 2\n1 5 2 3 4\n1 5 2 4 3\n1 5 3 2 4\n1 5 3 4 2\n1 5 4 2 3\n1 5 4 3 2\n2 1 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a sequence a consisting of n integers a_1, a_2, ..., a_n. Vasya may pefrom the following operation: choose some number from the sequence and swap any pair of bits in its binary representation. For example, Vasya... | [{"type": "stdin_stdout", "input": "5\n1000000000000000000 352839520853234088 165431853141398699 753467583475385837 895062156280564685\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "5\n1000000000000000000 352839520853234088 257894004782222768 753467583475385837 895062156280564685\n", "output": "4\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a chessboard with a width of 10^9 and a height of 10^9, the rows are numbered from bottom to top from 1 to 10^9, and the columns are numbered from left to right from 1 to 10^9. Therefore, for each cell of the chessboar... | [{"type": "stdin_stdout", "input": "0 5\n-1 96762320 34608098\n243235878 312125306 50510976\n326016273 498514053 50510976\n614560077 445224816 25950222\n1077021507 901150398 37242747\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 5\n-1 96762320 34608098\n243235878 312125306 50510976\n326016273 498514053 907... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is preparing a contest, and now he has written a statement for an easy problem. The statement is a string of length n consisting of lowercase Latin latters. Vasya thinks that the statement can be considered hard if ... | [{"type": "stdin_stdout", "input": "25\ndadddhrdhradrdzzzahazaddr\n582987584 321035417 414785252 587245865 701672370 65936511 563890835 134108386 387506178 22811155 989335244 1206131752 445085282 809768866 105799145 196558041 1131981383 134067229 875977231 488184174 41982468 225574390 702881847 937432062 185455403\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pasca... | [{"type": "stdin_stdout", "input": "xjywrmrwqaytezhtqmcnrrjomslvcmevncvzeddnvqgkbusnbzrppdsuzsmcobmnslpvosunavayvdbxhtavvwodorwijxfjjlat\n50\n1 100\n2 99\n3 98\n4 97\n5 96\n6 95\n7 94\n8 93\n9 92\n10 91\n11 90\n12 89\n13 88\n14 87\n15 86\n16 85\n17 84\n18 83\n19 82\n20 81\n21 80\n22 91\n23 78\n24 77\n25 140\n26 75\n27 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string is called diverse if it contains consecutive (adjacent) letters of the Latin alphabet and each letter occurs exactly once. For example, the following strings are diverse: \"fced\", \"xyz\", \"r\" and \"dabcef\". ... | [{"type": "stdin_stdout", "input": "69\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\nabc\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNikolay lives in a two-storied house. There are n rooms on each floor, arranged in a row and numbered from one from left to right. So each room can be represented by the number of the floor and the number of the room on t... | [{"type": "stdin_stdout", "input": "1\n100\n0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "1\n100\n0000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type i is an integer a_i. The... | [{"type": "stdin_stdout", "input": "12\n3\n7 -4 5\n3\n7 -5 4\n3\n4 -5 7\n3\n5 -4 7\n4\n5 -5 -6 6\n5\n100 100 100 -50 50\n10\n11 5 -12 7 -10 20 30 -10 50 60\n10\n10 5 -14 7 -7 20 30 -50 50 60\n2\n1 1\n2\n-1 -1\n3\n1000000000 1010000000 1000000000\n3\n-1000000000 -1000000000 -1000000000\n", "output": "YES\nNO\nNO\nYES\nN... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree consisting of n vertices numbered from 1 to n. The root of the tree is a vertex number 1.\n\nA tree is a connected undirected graph with n-1 edges.\n\nYou are given m queries. The i-th query co... | [{"type": "stdin_stdout", "input": "10 6\n1 2\n1 3\n1 4\n2 5\n2 6\n5 7\n7 8\n7 9\n9 10\n4 3 8 9 10\n3 2 4 6\n3 4 1 5\n3 4 8 2\n2 6 10\n3 5 4 7\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "10 6\n1 2\n1 3\n1 4\n2 5\n2 6\n5 7\n7 8\n7 9\n9 10\n4 3 8 9 10\n3 2 4 6\n3 4 1 5\n3 4 8 1\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPhoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.\n\nEach basket can contain k berries. But, Phoenix has decided that each basket may only contain ber... | [{"type": "stdin_stdout", "input": "20 4\n0 1\n0 2\n0 0\n1 2\n3 2\n1 3\n1 3\n2 0\n3 1\n0 2\n3 3\n2 3\n2 0\n3 2\n1 2\n1 1\n1 1\n1 2\n0 0\n1 3\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "20 4\n0 1\n0 2\n0 0\n1 2\n3 2\n1 3\n1 3\n2 0\n3 1\n0 2\n3 3\n2 3\n4 0\n3 2\n1 2\n1 1\n1 1\n1 2\n0 0\n1 3\n", "output": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLee just became Master in Codeforces, and so, he went out to buy some gifts for his friends. He bought n integers, now it's time to distribute them between his friends rationally...\n\nLee has n integers a_1, a_2, …, a_n ... | [{"type": "stdin_stdout", "input": "3\n4 2\n1 13 7 17\n1 3\n6 2\n10 10 10 10 11 11\n3 3\n4 4\n1000000000 1000000000 1000000000 1000000000\n1 1 1 1\n", "output": "48\n42\n8000000000\n"}, {"type": "stdin_stdout", "input": "3\n4 2\n1 13 12 1\n1 3\n6 2\n10 10 10 10 11 11\n3 3\n4 4\n1000000000 1000000000 1000000000 10000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a conveyor belt represented using a grid consisting of n rows and m columns. The cell in the i-th row from the top and the j-th column from the left is labelled (i,j). \n\nEvery cell, except (n,m), has a directio... | [{"type": "stdin_stdout", "input": "10\n1 2\nRC\n1 2\nDC\n2 1\nR\nC\n2 1\nD\nC\n7 6\nDRDDRR\nRDDDRR\nDRRRDD\nRRDRRR\nDDRRRR\nRRDRDR\nDDRDRC\n8 5\nDRDRD\nDRRRR\nRDRRD\nDDDRR\nRDDRR\nRRDDD\nDDRRR\nDDDRC\n8 3\nDDD\nDDR\nDRD\nRRR\nDRR\nDRD\nRRR\nRDC\n6 6\nDRDDDR\nDDDRDR\nRDDRRD\nDRRRRR\nRRRRRR\nDRDRRC\n6 8\nRRDDDRRR\nRDRDD... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMeka-Naruto plays a computer game. His character has the following ability: given an enemy hero, deal a instant damage to him, and then heal that enemy b health points at the end of every second, for exactly c seconds, st... | [{"type": "stdin_stdout", "input": "6\n1411352 712902 579689 383030\n997653 839911 351405 69197\n31160 1580030 281506 245835\n234837 489356 452352 448472\n382561 916024 805514 657373\n287796 831046 710305 568719\n", "output": "1411352\n997653\n31160\n234837\n382561\n287796\n"}, {"type": "stdin_stdout", "input": "6\n141... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given four different integer points p_1, p_2, p_3 and p_4 on XY grid.\n\nIn one step you can choose one of the points p_i and move it in one of four directions by one. In other words, if you have chosen point p_i ... | [{"type": "stdin_stdout", "input": "6\n41 77\n11 61\n31 38\n18 43\n46 77\n11 61\n18 43\n31 38\n10 77\n39 38\n11 103\n18 43\n41 67\n31 64\n18 70\n11 53\n41 77\n31 19\n20 86\n31 22\n41 77\n34 47\n31 59\n15 61\n", "output": "38\n43\n77\n31\n101\n51\n"}, {"type": "stdin_stdout", "input": "6\n41 77\n11 61\n31 38\n18 43\n46 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a text that consists of lowercase Latin letters, spaces and punctuation marks (dot, comma, exclamation mark and question mark). A word is defined as a sequence of consecutive Latin letters.\n\nYour task is t... | [{"type": "stdin_stdout", "input": "ajdwlf ibvlfqadt sqdn aoj nsjtivfrsp !mquqfgzrbp w ow aydap ry s . jwlvg ? ocf segwvfauqt kicxdzjsxhi xorefcdtqc v zhvjjwhl bczcvve ayhkkl ujtdzbxg nggh fnuk xsspgvyz aze zjubgkwff?hgj spteldqbdo vkxtgnl uxckibqs vpzeaq roj ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation is a sequence of n integers from 1 to n, in which all numbers occur exactly once. For example, [1], [3, 5, 2, 1, 4], [1, 3, 2] are permutations, and [2, 3, 2], [4, 3, 1], [0] are not.\n\nPolycarp was present... | [{"type": "stdin_stdout", "input": "4\n7\n3 3 4 4 7 7 7\n4\n1 2 3 4\n7\n3 4 5 5 5 7 7\n1\n1\n", "output": "\n3 1 4 2 7 5 6 \n3 2 4 1 7 6 5 \n1 2 3 4 \n1 2 3 4 \n3 4 5 1 2 7 6 \n3 4 5 2 1 7 6 \n1 \n1 \n"}, {"type": "stdin_stdout", "input": "4\n7\n3 3 4 4 7 7 7\n4\n1 2 3 4\n7\n3 4 5 5 5 6 7\n1\n1\n", "output": "3 1 4 2 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Two-dimensional kingdom is going through hard times... This morning the Three-Dimensional kingdom declared war on the Two-dimensional one. This (possibly armed) conflict will determine the ultimate owner of the straig... | [{"type": "stdin_stdout", "input": "33 23 17 2\n1 1 2 2 2 3 3 3 3 3 3 4 4 4 4 4 5 5 5 6 6 7 7 7 8 8 8 8 8 9 9 10 10\n1 1 3 3 4 4 4 5 5 6 6 6 7 8 8 8 8 8 8 9 9 10 10\n", "output": "23\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n9 9\n12 10\n13 11\n14 12\n17 13\n20 14\n21 15\n22 16\n23 17\n24 18\n25 19\n26 20\n27 21\n28 22\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPatrick has just finished writing a message to his sweetheart Stacey when he noticed that the message didn't look fancy. Patrick was nervous while writing the message, so some of the letters there were lowercase and some ... | [{"type": "stdin_stdout", "input": "MMVESdOCALHJCTBTUWWQRGUUVTTTABKKAAdIINAdKLRLLVLODHDXDPMcQfUhPNHFBJSDRGsHZNORSCPNvKOOIuZnZAmTPUCoPNlR\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "MMbJIBhgFXPVpdQHLkWJkAHFIfJSpITTCRzRCzvRPRYECCheOknfINZWuKATDBOrEVKTcWXiYPjtzQMGUSGPNTMCUrvYCSWQHqAi\n", "output": "27\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements,... | [{"type": "stdin_stdout", "input": "99\n3511 2076 9314 3598 7737 271 4110 4454 5830 8661 8584 8227 2236 2626 1025 3806 3162 2837 6071 9627 1836 7729 6629 4054 9377 3261 1325 8859 3610 7616 5052 9736 1249 6224 7031 6074 4196 8075 4005 5419 5664 8214 4391 731 8714 8622 6122 6976 4057 1770 8025 3778 2792 994 5204 1826 608... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConvexity of a set of points on the plane is the size of the largest subset of points that form a convex polygon. Your task is to build a set of n points with the convexity of exactly m. Your set of points should not cont... | [{"type": "stdin_stdout", "input": "253 95\n", "output": "0 10000000\n1 10000001\n2 10000004\n3 10000009\n4 10000016\n5 10000025\n6 10000036\n7 10000049\n8 10000064\n9 10000081\n10 10000100\n11 10000121\n12 10000144\n13 10000169\n14 10000196\n15 10000225\n16 10000256\n17 10000289\n18 10000324\n19 10000361\n20 10000400\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConnected undirected graph without cycles is called a tree. Trees is a class of graphs which is interesting not only for people, but for ants too.\n\nAn ant stands at the root of some tree. He sees that there are n vertex... | [{"type": "stdin_stdout", "input": "51\n28 3\n42 40\n40 51\n48 20\n13 28\n18 40\n44 40\n22 5\n22 27\n45 34\n40 9\n34 46\n40 34\n22 1\n22 11\n40 7\n28 40\n40 22\n14 40\n34 30\n40 20\n47 40\n12 34\n28 23\n40 24\n40 43\n41 40\n28 15\n49 32\n40 8\n32 10\n40 50\n40 36\n40 21\n16 33\n40 38\n34 2\n28 16\n34 4\n17 34\n19 40\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis task will exclusively concentrate only on the arrays where all elements equal 1 and/or 2.\n\nArray a is k-period if its length is divisible by k and there is such array b of length k, that a is represented by array b... | [{"type": "stdin_stdout", "input": "100 25\n2 2 1 2 2 2 2 2 2 2 2 1 2 1 1 2 1 2 1 2 2 2 1 2 2 2 1 1 2 1 2 1 2 1 2 2 1 2 1 1 2 2 2 1 2 2 1 2 2 2 2 1 1 2 1 2 2 1 1 2 2 2 2 2 1 2 1 2 2 2 2 2 2 2 1 2 1 1 2 2 2 2 2 1 2 2 1 1 2 1 2 2 2 1 2 2 2 2 2 2\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "100 25\n2 2 1 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fiends — t... | [{"type": "stdin_stdout", "input": "100\n0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.8612181095398133 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrew and Eugene are playing a game. Initially, Andrew has string s, consisting of digits. Eugene sends Andrew multiple queries of type \"di → ti\", that means \"replace all digits di in string s with substrings equal to... | [{"type": "stdin_stdout", "input": "19693141406182378241404307417907800263629336520110\n49\n2->\n0->\n3->\n9->\n6->\n5->\n1->\n4->\n8->\n7->0649713852\n0->\n4->\n5->\n3->\n1->\n8->\n7->\n9->\n6->\n2->2563194780\n0->\n8->\n1->\n3->\n5->\n4->\n7->\n2->\n6->\n9->8360512479\n0->\n3->\n6->\n4->\n2->\n9->\n7->\n1->\n8->\n5->... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x1, x2,... | [{"type": "stdin_stdout", "input": "2\n500\n900\n", "output": "YES\n1100\n1500\n"}, {"type": "stdin_stdout", "input": "1\n449\n", "output": "YES\n449\n1347\n1347\n"}, {"type": "stdin_stdout", "input": "2\n391\n365\n", "output": "YES\n1069\n1095\n"}, {"type": "stdin_stdout", "input": "2\n500\n497\n", "output": "YES\n148... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: \"Fox\"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. \n\nAfter checking some e... | [{"type": "stdin_stdout", "input": "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever\n", "output": "zyxwvutsrqpoljhgnefikdmbca\n"}, {"type": "stdin_stdout", "input": "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkoatks\ndmitriyh\nma... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTavas is a strange creature. Usually \"zzz\" comes out of people's mouth while sleeping, but string s of length n comes out from Tavas' mouth instead.\n\n<image>\n\nToday Tavas fell asleep in Malekas' place. While he was ... | [{"type": "stdin_stdout", "input": "173700 6\nbcabcbcbcbaaacaccaacaccaabacabaacbcacbbccaccbcacbabcaccccccaacacabbbbbacabbaaacbcbbaccaccabbbbaabbacacbabccaabcabbbcacaaccbabbcaaaaaabccbbcabcacbcbcabcbcbbaabacaaccccabacaaaccacaaabbacacabbcccacbaabcacacbbaaaccaccbaccccccbccaabcacaacabaccababacabcccbcbbacbabacbcbabacbbaccaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to <image>. Then he measured the length of its sides, and found that each of them is equal to an integer n... | [{"type": "stdin_stdout", "input": "1000 1000 1000 1000 1000 1000\n", "output": "6000000\n"}, {"type": "stdin_stdout", "input": "718 466 729 470 714 481\n", "output": "2102808\n"}, {"type": "stdin_stdout", "input": "677 303 685 288 692 296\n", "output": "1365807\n"}, {"type": "stdin_stdout", "input": "1000 1000 1 1000 ... | 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"}, {"type": "stdin_stdout", "input": "498454011879264 806515... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSean is trying to save a large file to a USB flash drive. He has n USB flash drives with capacities equal to a1, a2, ..., an megabytes. The file size is equal to m megabytes. \n\nFind the minimum number of USB flash drive... | [{"type": "stdin_stdout", "input": "100\n32630\n548\n21\n756\n138\n56\n719\n97\n140\n599\n531\n464\n137\n737\n239\n626\n179\n170\n271\n335\n178\n298\n597\n616\n104\n190\n216\n333\n606\n621\n310\n70\n286\n593\n655\n472\n556\n77\n625\n744\n395\n487\n762\n316\n469\n258\n475\n596\n651\n180\n737\n101\n511\n708\n163\n713\n47... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n \n ++++++++[>+>++>+++>++++>+++++>++++++>+++++++>++++++++>+++++++++>++++++++++>+\n ++++++++++>++++++++++++>+++++++++++++>++++++++++++++>+++++++++++++++>+++++++\n +++++++++<<<<<<<<<<<<<<<<-]>>>>>>>>>>.<<<<<<<... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1000010\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "1229030\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1000011\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "1160745\n", "output": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProfessor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.\n\nThere is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first s... | [{"type": "stdin_stdout", "input": "45\n45 44 40 43 27 29 41 39 30 34 28 26 25 42 38 19 32 24 9 37 23 21 20 18 33 36 16 22 35 17 7 4 15 31 13 11 2 3 10 12 14 6 8 5 1\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45\n", "output": "22\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasiliy has a car and he wants to get from home to the post office. The distance which he needs to pass equals to d kilometers.\n\nVasiliy's car is not new — it breaks after driven every k kilometers and Vasiliy needs t s... | [{"type": "stdin_stdout", "input": "1000000000000 1000000 999999 1000000 1000000\n", "output": "999999999999000000\n"}, {"type": "stdin_stdout", "input": "244641009859 748096 689016 889744 927808\n", "output": "168561873458925288\n"}, {"type": "stdin_stdout", "input": "965585325539 329221 187165 817564 718673\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEarlier, when there was no Internet, each bank had a lot of offices all around Bankopolis, and it caused a lot of problems. Namely, each day the bank had to collect cash from all the offices.\n\nOnce Oleg the bank client ... | [{"type": "stdin_stdout", "input": "100\n28 84 3 95\n1 2 1 1 5 1 1 8 1 10 1 12 1 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 1 80 80 1 83 1 85 85 1 88 88 1 91 1 93 93 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines him, gives prescriptions, appoints tests and may appoint extra examination. Doc knows all the forest animals perf... | [{"type": "stdin_stdout", "input": "150 2476\n70 21 114 127 22 11 29 59 51 59 35 3 53 88 5 8 44 4 12 100 1 27 1 25 27 56 48 22 23 103 85 66 14 58 20 7 176 11 19 26 154 97 83 3 29 30 52 92 59 11 135 37 59 8 66 20 47 19 143 16 93 18 57 71 1 13 141 1 119 6 2 87 40 68 28 22 20 53 31 19 15 33 32 9 70 63 16 26 77 7 45 52 73 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs.\n\nCatacombs consist of several rooms and bidirectional pa... | [{"type": "stdin_stdout", "input": "100\n0 0 0 0 0 0 1 4 4 0 2 2 4 1 7 1 11 0 8 4 12 12 3 0 3 2 2 4 3 9 1 5 4 6 9 14 6 2 4 18 7 7 19 11 20 13 17 16 0 34 2 6 12 27 9 4 29 22 4 20 20 17 17 20 37 53 17 3 3 15 1 46 11 24 31 6 12 6 11 18 13 1 5 0 19 10 24 41 16 41 18 52 46 39 16 30 18 23 53 13\n", "output": "66\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Rebel fleet is afraid that the Empire might want to strike back again. Princess Heidi needs to know if it is possible to assign R Rebel spaceships to guard B bases so that every base has exactly one guardian and each ... | [{"type": "stdin_stdout", "input": "10 10\n8530 -3814\n-9330 -6035\n3951 -217\n-9276 8291\n636 -3118\n5024 -2403\n4601 7977\n-3620 -1428\n4954 -9632\n-9852 6553\n-3457 5430\n-8866 -7343\n1020 -5748\n5043 -1437\n-2832 1528\n-5058 -825\n2406 -3530\n9152 -7463\n-8547 7108\n2492 8953\n", "output": "Yes\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPrintf{}, Pappu Bhujia, mon_ki_onkh are playing Counter Strike 1.6 . Printf{} and Pappu Bhujia are in the same team (Counter Terrorists) and mon_ki_onkh is in the opposite team (Terrorists). It is a 2 on 1 round. The play... | [{"type": "stdin_stdout", "input": "49\n1021719\n99039\n671150\n554555\n1520\n1072252\n21398\n1303339\n365213\n620626\n69416\n253333\n316221\n908305\n44107\n618462\n366801\n808365\n947305\n759616\n740902\n548182\n703319\n971726\n140673\n970631\n522995\n677526\n933515\n49579\n527801\n626569\n825751\n44150\n424499\n67700... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N persons called Person 1 through Person N.\n\nYou are given M facts that \"Person A_i and Person B_i are friends.\" The same fact may be given multiple times.\n\nIf X and Y are friends, and Y and Z are friends,... | [{"type": "stdin_stdout", "input": "1 0\n1 1\n1 2\n0 6\n-1 1\n1 4\n0 12\n2 1\n4 3\n2 4\n4 0", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 0\n1 1\n1 2\n0 6\n-1 1\n1 4\n0 12\n2 1\n4 3\n2 4\n7 0", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 0\n1 1\n1 2\n0 6\n-1 1\n1 4\n0 12\n2 1\n4 5\n2 4\n4 0", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor an integer n not less than 0, let us define f(n) as follows:\n\n* f(n) = 1 (if n < 2)\n* f(n) = n f(n-2) (if n \\geq 2)\n\n\n\nGiven is an integer N. Find the number of trailing zeros in the decimal notation of f(N).\... | [{"type": "stdin_stdout", "input": "1000000000010000000", "output": "125000000001249993\n"}, {"type": "stdin_stdout", "input": "1000000000010001000", "output": "125000000001250117\n"}, {"type": "stdin_stdout", "input": "1010000000010001000", "output": "126250000001250117\n"}, {"type": "stdin_stdout", "input": "10101000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N apple trees in a row. People say that one of them will bear golden apples.\n\nWe want to deploy some number of inspectors so that each of these trees will be inspected.\n\nEach inspector will be deployed under... | [{"type": "stdin_stdout", "input": "28 0", "output": "28\n"}, {"type": "stdin_stdout", "input": "12 0", "output": "12\n"}, {"type": "stdin_stdout", "input": "14 0", "output": "14\n"}, {"type": "stdin_stdout", "input": "22 0", "output": "22\n"}, {"type": "stdin_stdout", "input": "11 0", "output": "11\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given positive integers A and B.\n\nFind the K-th largest positive integer that divides both A and B.\n\nThe input guarantees that there exists such a number.\n\nConstraints\n\n* All values in input are integers.\... | [{"type": "stdin_stdout", "input": "100 50 2", "output": "25\n"}, {"type": "stdin_stdout", "input": "100 50 3", "output": "10\n"}, {"type": "stdin_stdout", "input": "132 36 1", "output": "12\n"}, {"type": "stdin_stdout", "input": "182 56 1", "output": "14\n"}, {"type": "stdin_stdout", "input": "19 114 1", "output": "19... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and... | [{"type": "stdin_stdout", "input": "100000 1000010000", "output": "654732105\n"}, {"type": "stdin_stdout", "input": "100000 1001010000", "output": "210041689\n"}, {"type": "stdin_stdout", "input": "100000 1001000000", "output": "302544643\n"}, {"type": "stdin_stdout", "input": "100000 1001001000", "output": "891654784\... | 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\nWe have a string s consisting of lowercase English letters. Snuke can perform the following operation repeatedly:\n\n* Insert a letter `x` to any position in s of his choice, including the beginning and end of s.\n\n\n\nS... | [{"type": "stdin_stdout", "input": "bxbax", "output": "-1\n"}, {"type": "stdin_stdout", "input": "xxabb", "output": "-1\n"}, {"type": "stdin_stdout", "input": "xyabb", "output": "-1\n"}, {"type": "stdin_stdout", "input": "bbayx", "output": "-1\n"}, {"type": "stdin_stdout", "input": "bb`yx", "output": "-1\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is not good at problems about trees in programming contests, and Aoki is helping him practice.\n\nFirst, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge.\n\nThen, Aoki gav... | [{"type": "stdin_stdout", "input": "10 0\n1 1\n2 6\n11 2\n-1 4\n0 10", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 -1\n1 1\n2 6\n11 2\n-1 5\n0 5", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 -1\n1 1\n2 3\n11 2\n-1 5\n0 5", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10 0\n1 1\n11 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn an electric circuit, when two resistors R_1 and R_2 are connected in parallel, the equivalent resistance R_3 can be derived from the following formula:\n\n* \\frac{1}{R_1} + \\frac{1}{R_2} = \\frac{1}{R_3}\n\n\n\nGiven... | [{"type": "stdin_stdout", "input": "001 230", "output": "0.995670995671\n"}, {"type": "stdin_stdout", "input": "001 379", "output": "0.997368421053\n"}, {"type": "stdin_stdout", "input": "001 119", "output": "0.991666666667\n"}, {"type": "stdin_stdout", "input": "100 113", "output": "53.0516431925\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro is playing with a puzzle that places numbers 1-9 in 9x9 squares. In this puzzle, you have to arrange the numbers according to the following rules.\n\n* One number appears exactly once in the same column\n* A number a... | [{"type": "stdin_stdout", "input": "2\n-1 2 3 3 4 10 8 13 9\n6 5 1 7 39 9 1 2 3\n7 11 11 2 -1 3 2 5 8\n2 4 0 1 6 9 12 9 0\n0 8 7 8 9 1 2 1 4\n8 9 1 0 3 4 2 8 7\n1 4 5 8 7 8 9 1 3\n8 12 8 9 1 4 3 4 5\n12 0 2 3 4 0 13 7 0\n2 1 3 2 5 4 7 8 14\n4 5 6 7 8 9 0 1 3\n7 8 13 1 4 4 8 5 8\n2 6 4 8 6 7 8 9 1\n5 6 12 8 9 1 2 6 3\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe reciprocal of all non-zero real numbers is real, but the reciprocal of an integer is not necessarily an integer. This is the reason why 3/2 * 2 = 2 even though 3.0 / 2.0 * 2.0 = 3.0 in C language. However, if you cons... | [{"type": "stdin_stdout", "input": "5: 2 - 3\n17: 1 + 3 * (2 + 3 / 5 * 2) + 7\n11: 1 / 8 - 5 - 8 * 2\n19: 8 / (2 - 1 * 7)\n1153: 10 * 3 / 7 + ( 50 + 151 / 22 ) + 11\n0:", "output": "2-3 = 4 (mod 5)\n1+3*(2+3/5*2)+7 = 4 (mod 17)\n1/8-5-8*2 = 8 (mod 11)\n8/(2-1*7) = 6 (mod 19)\n10*3/7+(50+151/22)+11 = 1023 (mod 1153)\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere are the following two-player card games.\n\n* This game uses a total of 2n cards with each integer from 1 to 2n written on it. Here, n is an integer between 1 and 100.\n* Deal n cards to each of the two.\... | [{"type": "stdin_stdout", "input": "5\n1\n7\n9\n6\n4\n10\n10\n7\n13\n18\n1\n11\n12\n17\n5\n19\n0", "output": "0\n1\n2\n0\n"}, {"type": "stdin_stdout", "input": "5\n1\n7\n9\n6\n4\n10\n10\n7\n13\n18\n1\n20\n12\n17\n5\n19\n0", "output": "0\n1\n4\n0\n"}, {"type": "stdin_stdout", "input": "5\n1\n2\n9\n6\n10\n10\n16\n7\n14\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo write a research paper, you should definitely follow the structured format. This format, in many cases, is strictly defined, and students who try to write their papers have a hard time with it.\n\nOne of such formats i... | [{"type": "stdin_stdout", "input": "5\n1 2 1 4 11\n3\n12 28 16\n0", "output": "1-2 1 4 11\n12 28 16\n"}, {"type": "stdin_stdout", "input": "5\n1 2 1 4 9\n3\n12 28 16\n0", "output": "1-2 1 4 9\n12 28 16\n"}, {"type": "stdin_stdout", "input": "5\n1 2 1 4 0\n3\n12 28 16\n0", "output": "1-2 1 4 0\n12 28 16\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGoldbach's Conjecture: For any even number n greater than or equal to 4, there exists at least one pair of prime numbers p1 and p2 such that n = p1 + p2.\n\nThis conjecture has not been proved nor refused yet. No one is s... | [{"type": "stdin_stdout", "input": "6\n10\n14\n0", "output": "1\n2\n2\n"}, {"type": "stdin_stdout", "input": "6\n10\n12\n0", "output": "1\n2\n1"}, {"type": "stdin_stdout", "input": "6\n1\n12\n0", "output": "1\n0\n1\n"}, {"type": "stdin_stdout", "input": "6\n10\n8\n0", "output": "1\n2\n1\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are enthusiastic about the popular web game \"Moonlight Ranch\". The purpose of this game is to grow crops in the fields, sell them to earn income, and use that income to grow the ranch.\n\nYou wanted to grow the fiel... | [{"type": "stdin_stdout", "input": "5\nelppa 2 2 -1 1 1 0 1 13 1\nan`ban 1 0 3 9 2 2 4 1 0\ncatror 0 2 2 2 1 4 1 18 2\ncqniau 1 3 0 2 -1 3 1 -1 1\nfghplant 0 4 0 3 2 3 0 110 1\n4\nenoki 1 3 2 -1 6 3 1 10 1\ntpmato 1 0 0 10 0 3 -1 1 1\nqotato -1 0 8 4 1 -1 4 7 1\nonion 3 4 0 3 3 7 0 10 1\n3\na 15 1 1 1 1 1 1 14 5\nc 16 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the sum of weights of edges of the Minimum Spanning Tree for a given weighted undirected graph G = (V, E).\n\nConstraints\n\n* 1 ≤ |V| ≤ 10,000\n* 0 ≤ |E| ≤ 100,000\n* 0 ≤ wi ≤ 10,000\n* The graph is connected\n* The... | [{"type": "stdin_stdout", "input": "6 1\n0 1 -1\n1 0 2\n1 2 8\n-1 3 13\n0 0 -1\n1 -1 11\n7 0 0\n2 1 2\n1 8 0", "output": "-1\n"}, {"type": "stdin_stdout", "input": "6 9\n0 2 1\n0 2 3\n0 2 2\n0 3 7\n2 4 5\n1 4 3\n3 2 1\n3 3 1\n2 5 10", "output": "20\n"}, {"type": "stdin_stdout", "input": "6 9\n0 2 1\n0 2 3\n2 0 2\n1 3 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings s and t, both consisting only of lowercase Latin letters.\n\nThe substring s[l..r] is the string which is obtained by taking characters s_l, s_{l + 1}, ..., s_r without changing the order.\n\nEac... | [{"type": "stdin_stdout", "input": "11 3 66\nssszzzzsssz\nsss\n1 1\n1 2\n2 2\n1 3\n2 3\n3 3\n1 4\n2 4\n3 4\n4 4\n1 5\n2 5\n3 5\n4 5\n5 5\n1 6\n2 6\n3 6\n4 6\n5 10\n6 6\n1 7\n2 7\n3 7\n4 7\n5 7\n6 7\n7 7\n1 8\n2 8\n3 8\n4 8\n5 8\n6 8\n7 8\n8 8\n1 9\n2 9\n3 9\n4 9\n5 9\n6 9\n7 9\n8 9\n9 9\n1 10\n2 10\n3 10\n4 10\n5 10\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n...Once upon a time a man came to the sea. The sea was stormy and dark. The man started to call for the little mermaid to appear but alas, he only woke up Cthulhu...\n\nWhereas on the other end of the world Pentagon is ac... | [{"type": "stdin_stdout", "input": "100 66\n41 14\n19 13\n70 43\n79 62\n9 62\n71 40\n53 86\n80 4\n34 33\n72 68\n40 96\n84 59\n36 77\n55 50\n40 3\n79 81\n3 43\n33 47\n22 98\n33 90\n56 49\n69 28\n73 30\n65 22\n98 20\n9 52\n54 20\n32 70\n51 80\n63 12\n21 48\n35 17\n48 87\n25 43\n65 80\n42 3\n86 35\n95 98\n43 59\n51 46\n66... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJATC loves Banh-mi (a Vietnamese food). His affection for Banh-mi is so much that he always has it for breakfast. This morning, as usual, he buys a Banh-mi and decides to enjoy it in a special way.\n\nFirst, he splits the... | [{"type": "stdin_stdout", "input": "10 8\n0110000110\n3 3\n1 10\n4 4\n1 8\n1 2\n9 10\n2 10\n3 9\n", "output": "1\n960\n0\n224\n2\n2\n480\n112\n"}, {"type": "stdin_stdout", "input": "10 8\n0110000110\n3 3\n2 10\n4 4\n1 8\n1 2\n9 10\n2 10\n3 9\n", "output": "1\n480\n0\n224\n2\n2\n480\n112\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Fair Nut likes kvass very much. On his birthday parents presented him n kegs of kvass. There are v_i liters of kvass in the i-th keg. Each keg has a lever. You can pour your glass by exactly 1 liter pulling this lever... | [{"type": "stdin_stdout", "input": "4 4\n1000000000 1000000000 1000000000 1000000000\n", "output": "999999999\n"}, {"type": "stdin_stdout", "input": "4 4\n1000000000 1000000100 1000000000 1000000000\n", "output": "1000000000"}, {"type": "stdin_stdout", "input": "4 4\n1000000000 1000000100 1000000000 1000000100\n", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method o... | [{"type": "stdin_stdout", "input": "10 24\n<><>>>><>>><>>>>>>>><<>>\n<><>>>><>>><>>>>=>>><<>>\n>><>>>><>>><>>>>>>>><>>>\n<<<><><<<<<<><<><>>><<<>\n<<<=<=<<<<<<><<=<>==<<<>\n>><>>>><>>><>>>>>>>><>>>\n>>>>>>>>>>>>>>>>>>>>>>>>\n<<<<<<<<<<<<=<<<<=<<<<<<\n<><>>>><>>><>>>>>>>><<>>\n<><>>>><>>><>>>>>>>><<>>\n", "output": "Yes... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA girl named Sonya is studying in the scientific lyceum of the Kingdom of Kremland. The teacher of computer science (Sonya's favorite subject!) invented a task for her.\n\nGiven an array a of length n, consisting only of ... | [{"type": "stdin_stdout", "input": "100 1000000000\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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "output": "216163471\n"}, {"type": "stdin_stdout", "input": "100... | 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\nNauuo is a girl who loves random picture websites.\n\nOne day she made a random picture website by herself which includes n pictures.\n\nWhen Nauuo vis... | [{"type": "stdin_stdout", "input": "50 50\n0 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 1\n33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33\n", "output": "677141055 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ra... | [{"type": "stdin_stdout", "input": "3p 9m 2p\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "9m 9m 9m\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1s 2s 3s\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2m 9s 1m\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1m 1m 2m\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are the head of a large enterprise. n people work at you, and n is odd (i. e. n is not divisible by 2).\n\nYou have to distribute salaries to your employees. Initially, you have s dollars for it, and the i-th employee... | [{"type": "stdin_stdout", "input": "3\n3 26\n10 12\n1 4\n13 26\n1 1337\n-1 1000000001\n5 26\n4 3\n1 4\n3 7\n2 12\n2 14\n", "output": "12\n1337\n7\n"}, {"type": "stdin_stdout", "input": "3\n3 25\n10 12\n1 4\n10 13\n1 1337\n1 1000000001\n5 26\n4 3\n0 4\n3 11\n2 12\n2 14\n", "output": "12\n1337\n7\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n blocks arranged in a row and numbered from left to right, starting from one. Each block is either black or white. \n\nYou may perform the following operation zero or more times: choose two adjacent blocks and ... | [{"type": "stdin_stdout", "input": "200\nBBBBBBBBBBBBBBWBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBW\n", "output": "185\n15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given one integer number n. Find three distinct integers a, b, c such that 2 ≤ a, b, c and a ⋅ b ⋅ c = n or say that it is impossible to do it.\n\nIf there are several answers, you can print any.\n\nYou have to an... | [{"type": "stdin_stdout", "input": "100\n101\n102\n103\n104\n105\n106\n107\n108\n165\n110\n111\n112\n113\n114\n115\n116\n117\n118\n228\n175\n121\n122\n123\n124\n125\n126\n127\n128\n129\n130\n131\n132\n133\n134\n135\n136\n137\n138\n139\n140\n141\n142\n143\n175\n145\n146\n147\n148\n149\n150\n151\n152\n153\n154\n155\n156\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence b_1, b_2, …, b_n. Find the lexicographically minimal permutation a_1, a_2, …, a_{2n} such that b_i = min(a_{2i-1}, a_{2i}), or determine that it is impossible.\n\nInput\n\nEach test contains one o... | [{"type": "stdin_stdout", "input": "1\n100\n49 47 115 100 84 71 77 67 1 39 34 92 72 44 68 124 20 102 187 58 78 41 3 15 14 48 134 11 29 117 45 24 23 19 66 27 7 22 123 55 135 10 149 185 8 9 62 61 137 52 171 2 5 28 43 42 155 6 111 127 17 59 25 126 53 125 103 26 75 12 56 96 148 60 114 13 4 131 101 16 104 51 132 158 18 168 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two infinite sources of water:\n\n * hot water of temperature h; \n * cold water of temperature c (c < h). \n\n\n\nYou perform the following procedure of alternating moves:\n\n 1. take one cup of the hot wate... | [{"type": "stdin_stdout", "input": "3\n30 10 20\n41 15 30\n18 13 18\n", "output": "2\n7\n1\n"}, {"type": "stdin_stdout", "input": "3\n30 10 20\n41 15 26\n18 13 18\n", "output": "2\n2\n1\n"}, {"type": "stdin_stdout", "input": "1\n999855 999262 999557\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n114515 114... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes.\n\nLet's consider that all lines in the poems consist of lowercase Latin letter... | [{"type": "stdin_stdout", "input": "7 3\nferwljzwakxedlgwl\noerwljzwakxedlgwl\nhyqombizhuhxedprb\netptjrizhuhxedprb\nurtuckar\ndkartmwramklcmi\nrurtuckar\nnurartmwramklcmi\niraziomsv\nsaziomsv\nbprapiqpayzurgij\nusyemayzurgij\nztstmeecvmkvuu\nquexlecvmkvuu\nrlhwecvmkvuu\nzecvmkvuu\niikymgbncljtub\nqiikymgbncljtub\nbcav... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's denote the median of a sequence s with odd length as the value in the middle of s if we sort s in non-decreasing order. For example, let s = [1, 2, 5, 7, 2, 3, 12]. After sorting, we get sequence [1, 2, 2, \\underli... | [{"type": "stdin_stdout", "input": "4\n3 5 1\n1\n13 3 3\n1 4 7\n15 5 3\n2 5 10\n17 18 7\n2 3 5 7 5 11 12\n", "output": "NO\nYES\nYES\nNO\n"}, {"type": "stdin_stdout", "input": "4\n3 5 1\n1\n11 3 3\n1 3 7\n15 5 3\n4 5 6\n13 7 7\n2 3 5 7 9 11 12\n", "output": "NO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in ... | [{"type": "stdin_stdout", "input": "15\n1 1\n00:00\n1 100\n00:01\n100 100\n02:82\n10 10\n04:04\n100 100\n99:00\n100 2\n30:00\n50 3\n30:00\n51 3\n30:01\n52 16\n21:12\n100 20\n20:07\n23 100\n21:45\n11 11\n02:02\n89 89\n88:86\n100 1\n01:00\n1 100\n00:01\n", "output": "00:00\n00:00\n02:82\n00:00\n00:00\n00:00\n00:00\n50:00... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWelcome to Rockport City!\n\nIt is time for your first ever race in the game against Ronnie. To make the race interesting, you have bet a dollars and Ronnie has bet b dollars. But the fans seem to be disappointed. The exc... | [{"type": "stdin_stdout", "input": "4\n1 11\n1 2\n4 0\n20 10\n", "output": "10 1\n1 0\n4 0\n10 0\n"}, {"type": "stdin_stdout", "input": "4\n1 11\n1 2\n4 0\n22 10\n", "output": "10 1\n1 0\n4 0\n12 2\n"}, {"type": "stdin_stdout", "input": "4\n1 11\n1 2\n2 0\n22 10\n", "output": "10 1\n1 0\n2 0\n12 2\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nInput\n\nThe input contains a single integer a (1 ≤ a ≤ 18257).\n\nOutput\n\nPrint a single integer output (1 ≤ output ≤ 2·109).\n\nExamples\n\nInput\n\n2\n\n\nOutput\n\n13\n\nThe input will be given via stdin ... | [{"type": "stdin_stdout", "input": "15000\n", "output": "1349910001\n"}, {"type": "stdin_stdout", "input": "16344\n", "output": "1602659953\n"}, {"type": "stdin_stdout", "input": "13170\n", "output": "1040614381\n"}, {"type": "stdin_stdout", "input": "15302\n", "output": "1404815413\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya came up to the blackboard and wrote out n distinct integers from 1 to n in some order in a circle. Then he drew arcs to join the pairs of integers (a, b) (a ≠ b), that are either each other's immediate neigh... | [{"type": "stdin_stdout", "input": "25\n17 14\n19 1\n24 16\n23 13\n20 15\n24 23\n18 25\n4 1\n18 9\n2 17\n14 12\n25 2\n13 6\n21 9\n19 3\n11 18\n10 13\n12 19\n3 17\n12 1\n10 6\n15 1\n18 21\n11 21\n23 22\n8 11\n11 16\n10 23\n2 9\n25 7\n15 5\n22 24\n13 22\n5 10\n5 20\n4 15\n5 6\n12 4\n3 14\n16 22\n8 24\n7 17\n25 9\n21 8\n8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation p of size n is the sequence p1, p2, ..., pn, consisting of n distinct integers, each of them is from 1 to n (1 ≤ pi ≤ n).\n\nA lucky permutation is such permutation p, that any integer i (1 ≤ i ≤ n) meets th... | [{"type": "stdin_stdout", "input": "17877\n", "output": "2 17877 4 17875 6 17873 8 17871 10 17869 12 17867 14 17865 16 17863 18 17861 20 17859 22 17857 24 17855 26 17853 28 17851 30 17849 32 17847 34 17845 36 17843 38 17841 40 17839 42 17837 44 17835 46 17833 48 17831 50 17829 52 17827 54 17825 56 17823 58 17821 60 178... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCurrently Tiny is learning Computational Geometry. When trying to solve a problem called \"The Closest Pair Of Points In The Plane\", he found that a code which gave a wrong time complexity got Accepted instead of Time Li... | [{"type": "stdin_stdout", "input": "2000 1998999\n", "output": "0 0\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6\n0 7\n0 8\n0 9\n0 10\n0 11\n0 12\n0 13\n0 14\n0 15\n0 16\n0 17\n0 18\n0 19\n0 20\n0 21\n0 22\n0 23\n0 24\n0 25\n0 26\n0 27\n0 28\n0 29\n0 30\n0 31\n0 32\n0 33\n0 34\n0 35\n0 36\n0 37\n0 38\n0 39\n0 40\n0 41\n0 42\n0 43\n0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPiegirl is buying stickers for a project. Stickers come on sheets, and each sheet of stickers contains exactly n stickers. Each sticker has exactly one character printed on it, so a sheet of stickers can be described by a... | [{"type": "stdin_stdout", "input": "abc\n1011\n", "output": "1\nabcaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima and Seryozha live in an ordinary dormitory room for two. One day Dima had a date with his girl and he asked Seryozha to leave the room. As a compensation, Seryozha made Dima do his homework.\n\nThe teacher gave Seryo... | [{"type": "stdin_stdout", "input": "50\n384672 661179 -775591 -989608 611120 442691 601796 502406 384323 -315945 -934146 873993 -156910 -94123 -930137 208544 816236 466922 473696 463604 794454 -872433 -149791 -858684 -467655 -555239 623978 -217138 -408658 493342 -733576 -350871 711210 884148 -426172 519986 -356885 5271... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n games in a football tournament. Three teams are participating in it. Currently k games had already been played. \n\nYou are an avid football fan, but recently you missed the whole k games. Fortunately, you rem... | [{"type": "stdin_stdout", "input": "5\n3 0 0 0\n3 3 0 0\n6 4 1 0\n6 6 0 0\n3 3 3 2\n", "output": "yes\nyes\nyes\nyes\nno\n"}, {"type": "stdin_stdout", "input": "5\n3 0 0 0\n3 3 0 0\n6 4 1 0\n6 3 3 -1\n3 3 3 2\n", "output": "yes\nyes\nyes\nno\nno\n"}, {"type": "stdin_stdout", "input": "5\n3 0 0 0\n3 3 0 0\n6 4 1 0\n6 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.\n\nMarmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integer... | [{"type": "stdin_stdout", "input": "5\n2 12 3 4 9\n3\n1 25 11\n", "output": "1\n5\n2\n"}, {"type": "stdin_stdout", "input": "5\n2 12 3 4 9\n3\n1 25 17\n", "output": "1\n5\n3\n"}, {"type": "stdin_stdout", "input": "5\n2 17 3 4 9\n3\n1 25 13\n", "output": "1\n4\n2\n"}, {"type": "stdin_stdout", "input": "5\n2 12 3 4 9\n3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Vasya and Petya assembled a figure of m cubes, each of them is associated with a number between 0 and m - 1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the OX is the g... | [{"type": "stdin_stdout", "input": "25\n-611859852 0\n-611859842 0\n-611859837 0\n-611859843 0\n-611859863 0\n-611859851 0\n-611859857 0\n-611859858 0\n-611859845 0\n-611859865 0\n-611859836 0\n-611859839 0\n-611859850 0\n-611859854 0\n-611859838 0\n-611859840 0\n-611859860 0\n-611859853 0\n-611859848 0\n-611859844 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-th bear is exactly ai... | [{"type": "stdin_stdout", "input": "20\n452405440 586588704 509061481 552472140 16115810 148658854 66743034 628305150 677780684 519361360 208050516 401554301 954478790 346543678 387546138 832279893 641889899 80960260 717802881 588066499\n", "output": "954478790 641889899 519361360 452405440 346543678 346543678 20805051... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1.\n\nYou are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you... | [{"type": "stdin_stdout", "input": "128982\n", "output": "17 16 15 14 13 11 10 9 8 7 5 3 2\n"}, {"type": "stdin_stdout", "input": "97205\n", "output": "17 15 14 13 12 10 9 8 6 5 3 1 \n"}, {"type": "stdin_stdout", "input": "32698\n", "output": "15 14 13 12 11 10 9 8 6 5 4 2\n"}, {"type": "stdin_stdout", "input": "97260\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Berland there are n cities and n - 1 bidirectional roads. Each road connects some pair of cities, from any city you can get to any other one using only the given roads.\n\nIn each city there is exactly one repair briga... | [{"type": "stdin_stdout", "input": "12\n1 2\n2 3\n2 4\n2 5\n5 7\n5 6\n5 8\n5 12\n12 10\n12 11\n12 9\n", "output": "5\n3 1 5 9 \n3 2 6 10 \n3 3 7 11 \n1 4 \n1 8 \n"}, {"type": "stdin_stdout", "input": "12\n1 2\n1 3\n2 4\n2 5\n5 7\n5 6\n5 8\n5 12\n12 10\n12 11\n12 9\n", "output": "5\n3 1 5 9\n4 3 6 10 2\n2 4 11\n1 7\n1 8... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.