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\nIkta loves fast programs. Recently, I'm trying to speed up the division program. However, it doesn't get much faster, so I thought it would be better to make it faster only for \"common sense and typical\" inputs. The pro... | [{"type": "stdin_stdout", "input": "001", "output": "2\n"}, {"type": "stdin_stdout", "input": "000", "output": "1\n"}, {"type": "stdin_stdout", "input": "178", "output": "0\n"}, {"type": "stdin_stdout", "input": "209", "output": "0\n"}, {"type": "stdin_stdout", "input": "375", "output": "0\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nYou brought a flat, holeless donut with a $ W $ horizontal $ H $ vertical $ H $ rectangle for ACPC.\nPlace this donut on the $ 2 $ dimension plane coordinate $ (0,0) $ with the center of the donut so that the s... | [{"type": "stdin_stdout", "input": "7828 5000 20 -1 1069 300", "output": "0.2806361085\n"}, {"type": "stdin_stdout", "input": "7828 10252 13 -1 292 464", "output": "1.5890410959\n"}, {"type": "stdin_stdout", "input": "7828 10252 13 -1 574 464", "output": "0.8083623693\n"}, {"type": "stdin_stdout", "input": "4997 2843 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a set $T$, which is a subset of $S$. The set $S$ consists of $0, 1, ... n-1$. Print all subsets of $T$. Note that we represent $0, 1, ... n-1$ as 00...0001, 00...0010, 00...0100, ..., 10...0000 in binary res... | [{"type": "stdin_stdout", "input": "4\n2 1 3", "output": "0:\n2: 1\n8: 3\n10: 1 3\n"}, {"type": "stdin_stdout", "input": "4\n2 0 3", "output": "0:\n1: 0\n8: 3\n9: 0 3\n"}, {"type": "stdin_stdout", "input": "4\n2 1 2", "output": "0:\n2: 1\n4: 2\n6: 1 2\n"}, {"type": "stdin_stdout", "input": "4\n2 0 1", "output": "0:\n1:... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTanechka is shopping in the toy shop. There are exactly n toys in the shop for sale, the cost of the i-th toy is i burles. She wants to choose two toys in such a way that their total cost is k burles. How many ways to do ... | [{"type": "stdin_stdout", "input": "100000000000000 100000000000000\n", "output": "49999999999999\n"}, {"type": "stdin_stdout", "input": "100000000010000 100000000000000\n", "output": "49999999999999\n"}, {"type": "stdin_stdout", "input": "105925489085800 100000000001000\n", "output": "50000000000499\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n points on the plane. The polygon formed from all the n points is strictly convex, that is, the polygon is convex, and there are no three collinear points (i.e. lying in the same straight line). The points ... | [{"type": "stdin_stdout", "input": "20\n-2967010 48581504\n-2967318 48581765\n-2967443 48581988\n-2967541 48582265\n-2967443 48582542\n-2967318 48582765\n-2967010 48583026\n-2966691 48583154\n-2966252 48583234\n-2965813 48583154\n-2965494 48583026\n-2965186 48582765\n-2965061 48582542\n-2964963 48582265\n-2965061 48581... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSomeone give a strange birthday present to Ivan. It is hedgehog β connected undirected graph in which one vertex has degree at least 3 (we will call it center) and all other vertices has degree 1. Ivan thought that hedgeh... | [{"type": "stdin_stdout", "input": "33 2\n3 13\n17 3\n2 6\n5 33\n4 18\n1 2\n31 5\n4 19\n3 16\n1 3\n9 2\n10 3\n5 1\n5 28\n21 4\n7 2\n1 4\n5 24\n30 5\n14 3\n3 11\n27 5\n8 2\n22 4\n12 3\n20 4\n26 5\n4 23\n32 5\n25 5\n15 3\n29 5\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "33 2\n3 13\n17 3\n2 6\n5 33\n4 18\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe kingdom of Lazyland is the home to n idlers. These idlers are incredibly lazy and create many problems to their ruler, the mighty King of Lazyland. \n\nToday k important jobs for the kingdom (k β€ n) should be performe... | [{"type": "stdin_stdout", "input": "18 12\n6 3 6 6 6 6 6 6 6 12 1 3 6 6 10 6 6 6\n47 4 41 56 75 24 29 10 100 112 53 48 79 30 87 135 60 87\n", "output": "185\n"}, {"type": "stdin_stdout", "input": "18 12\n6 3 6 6 6 6 6 6 6 12 1 3 6 6 10 6 6 6\n47 4 41 56 75 24 29 10 100 112 53 48 79 30 87 135 10 87\n", "output": "148\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is a number of elements in the array.\n\nYou are given an array a consisting of n integers. The value of the i-th element of the array is a_i.\n\nYou are also given a set... | [{"type": "stdin_stdout", "input": "50 50\n1 -9 8 -9 5 -4 -4 3 -2 -1 3 -8 -6 -6 2 -5 -1 -2 -5 10 2 0 10 10 5 -3 12 -1 -9 9 -10 4 7 0 -6 0 -1 4 8 0 -3 -8 10 10 6 6 -3 -5 -3 -8\n28 41\n28 49\n49 49\n6 38\n22 30\n50 50\n41 45\n30 32\n17 44\n24 25\n27 39\n17 39\n50 50\n10 14\n11 12\n18 28\n11 20\n36 42\n45 49\n29 36\n32 44... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is a head of a circus troupe. There are n β an even number β artists in the troupe. It is known whether the i-th artist can perform as a clown (if yes, then c_i = 1, otherwise c_i = 0), and whether they can perfo... | [{"type": "stdin_stdout", "input": "10\n0011101001\n1000101110\n", "output": "1 2 5 8 9\n"}, {"type": "stdin_stdout", "input": "10\n1111000011\n1111111100\n", "output": "1 2 3 5 6\n"}, {"type": "stdin_stdout", "input": "10\n0011101001\n1010101110\n", "output": "1 2 3 5 8 "}, {"type": "stdin_stdout", "input": "10\n10110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree (an undirected connected acyclic graph) consisting of n vertices and n - 1 edges. A number is written on each edge, each number is either 0 (let's call such edges 0-edges) or 1 (those are 1-edges).\n\... | [{"type": "stdin_stdout", "input": "7\n2 1 1\n3 2 0\n4 2 1\n5 2 0\n6 7 1\n7 2 1\n", "output": "34\n"}, {"type": "stdin_stdout", "input": "7\n2 1 1\n3 2 0\n4 2 1\n5 4 0\n6 7 1\n7 2 1\n", "output": "32\n"}, {"type": "stdin_stdout", "input": "7\n2 1 1\n3 2 1\n4 2 1\n5 2 0\n6 7 1\n7 2 1\n", "output": "37\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a connected undirected weighted graph consisting of n vertices and m edges.\n\nYou need to print the k-th smallest shortest path in this graph (paths from the vertex to itself are not counted, paths from i t... | [{"type": "stdin_stdout", "input": "28 27 378\n1 2 1000000000\n2 3 1000000000\n3 4 1000000000\n4 5 1000000000\n5 6 1000000000\n6 7 1000000000\n7 8 1000000000\n8 9 1000000000\n9 10 1000000000\n10 11 1000000000\n11 12 1000000000\n12 13 1000000000\n13 14 1000000000\n14 15 1000000000\n15 16 1000000000\n16 17 1000000000\n17... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrew was very excited to participate in Olympiad of Metropolises. Days flew by quickly, and Andrew is already at the airport, ready to go home. He has n rubles left, and would like to exchange them to euro and dollar bi... | [{"type": "stdin_stdout", "input": "100000000\n30\n30\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "100000000\n60\n30\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "100000000\n31\n33\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100000000\n98\n99\n", "output": "0\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNew Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.\n\nVasya's verse contains n parts. It takes a_i seconds to recite the i-th part. Vasya can't change the order of pa... | [{"type": "stdin_stdout", "input": "1\n50 1\n2 1 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 100000000 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWu got hungry after an intense training session, and came to a nearby store to buy his favourite instant noodles. After Wu paid for his purchase, the cashier gave him an interesting task.\n\nYou are given a bipartite grap... | [{"type": "stdin_stdout", "input": "1\n100 31\n10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn February 14 Denis decided to give Valentine to Nastya and did not come up with anything better than to draw a huge red heart on the door of the length k (k β₯ 3). Nastya was very confused by this present, so she decided... | [{"type": "stdin_stdout", "input": "5\n8 6\n1 2 4 1 2 7 1 2\n5 3\n3 2 3 2 1\n10 8\n7 4 7 6 2 3 0 1 -1 1\n15 10\n3 14 4 8 2 1 4 5 21 2 0 4 2 1 3\n7 5\n1 2 3 4 2 6 2\n", "output": "3 2\n2 2\n4 2\n4 1\n3 3\n"}, {"type": "stdin_stdout", "input": "5\n8 6\n1 2 4 1 2 7 1 2\n5 3\n3 2 3 2 1\n10 8\n7 4 7 6 2 3 0 1 -1 1\n15 10\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShubham has a binary string s. A binary string is a string containing only characters \"0\" and \"1\".\n\nHe can perform the following operation on the string any amount of times: \n\n * Select an index of the string, an... | [{"type": "stdin_stdout", "input": "18\n010\n100100011010\n001\n010101\n101\n1100111101101110\n101100\n0001100101001100\n111110101100\n01100\n0110111100\n110101\n10000011001010010001\n0011\n00001010110100000101\n11011101110\n011000011101000010\n1001111110001000\n", "output": "1\n4\n0\n2\n1\n4\n1\n6\n2\n1\n2\n2\n6\n0\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nConsider a fixed positive integer n. Two players, First and Second play a game as follows:\n\n 1. First considers the 2n numbers 1, 2, ..., 2n, and partitions them as he wants into n di... | [{"type": "stdin_stdout", "input": "10\n1 10 6 4 3 5 10 9 3 8 1 2 6 4 7 5 2 9 7 8\n", "output": "First\n1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 \n"}, {"type": "stdin_stdout", "input": "10\n10 1 9 8 7 2 4 5 6 3 10 1 9 8 7 2 4 5 6 3\n", "output": "First\n1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 \n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is n. \n\nThere is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains 2 apar... | [{"type": "stdin_stdout", "input": "7\n7 3\n1 3\n18 6\n1865 4\n12 2\n2 10\n22 5\n", "output": "3\n1\n4\n467\n6\n1\n5\n"}, {"type": "stdin_stdout", "input": "7\n7 3\n1 3\n18 6\n987 4\n12 2\n2 10\n22 12\n", "output": "3\n1\n4\n248\n6\n1\n3\n"}, {"type": "stdin_stdout", "input": "7\n7 3\n1 3\n18 6\n1865 4\n12 2\n4 10\n22 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n cities in Berland. The city numbered 1 is the capital. Some pairs of cities are connected by a one-way road of length 1.\n\nBefore the trip, Polycarp for each city found out the value of d_i β the shortest dis... | [{"type": "stdin_stdout", "input": "3\n\n6 7\n1 2\n1 3\n2 5\n2 4\n5 1\n3 6\n6 2\n\n2 2\n1 2\n2 1\n\n6 8\n1 2\n1 5\n2 6\n6 1\n2 3\n3 4\n4 2\n5 4\n", "output": "\n0 0 1 2 0 1 \n0 0 \n0 0 2 1 1 0 \n"}, {"type": "stdin_stdout", "input": "3\n\n6 7\n1 2\n1 3\n2 5\n2 4\n5 1\n3 6\n6 2\n\n2 2\n1 2\n2 1\n\n6 8\n1 2\n1 5\n2 6\n6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s, consisting only of characters '0' or '1'. Let |s| be the length of s.\n\nYou are asked to choose some integer k (k > 0) and find a sequence a of length k such that: \n\n * 1 β€ a_1 < a_2 < ... < ... | [{"type": "stdin_stdout", "input": "1\n0000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n0000011111111111111111111111111111111111111111111111111111111111111111101111111111111111111111111100\n", "output": "NO\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima overslept the alarm clock, which was supposed to raise him to school.\n\nDima wonders if he will have time to come to the first lesson. To do this, he needs to know the minimum time it will take him to get from home ... | [{"type": "stdin_stdout", "input": "10 8 2\n0 -1 0 -1 -1 0 0 -1 -1\n-1 0 -1 0 0 -1 -1 0 -1\n-1 -1 -1 0 -1 -1 0 0 0\n0 0 0 0 -1 0 0 0 -1\n0 -1 -1 0 -1 -1 -1 0 0\n-1 -1 -1 0 -1 -2 0 -1 0\n0 0 0 0 -1 0 0 0 -1\n0 0 -1 0 -1 0 0 -1 0\n-1 0 0 0 -1 -1 -1 0 0\n-1 -1 -1 0 0 0 -1 -1 0\n", "output": "-1\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo players play a game. The game is played on a rectangular board with n Γ m squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the s... | [{"type": "stdin_stdout", "input": "100 100 1 1 100 100\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "100 100 10 10 13 14\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "000 100 1 1 100 100\n", "output": "Second\n"}, {"type": "stdin_stdout", "input": "100 32 71 12 71 22\n", "output": "Seco... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant has got a problem β somebody has been touching his sorted by non-decreasing array a of length n and possibly swapped some elements of the array.\n\nThe Little Elephant doesn't want to call the police u... | [{"type": "stdin_stdout", "input": "128\n1 2 4 6 8 17 20 20 23 33 43 49 49 49 52 73 74 75 82 84 85 87 90 91 102 103 104 105 111 111 401 142 142 152 155 160 175 176 178 181 183 184 187 188 191 193 326 202 202 214 224 225 236 239 240 243 246 247 249 249 257 257 261 264 265 271 277 281 284 284 286 289 290 296 297 303 305 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus loves lucky numbers. Everybody knows that lucky numbers are positive integers, whose decimal representation (without leading zeroes) contain only the lucky digits x and y. For example, if x = 4, and y = 7, then... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "40744\n"}, {"type": "stdin_stdout", "input": "999999998\n", "output": "40742\n"}, {"type": "stdin_stdout", "input": "603356456\n", "output": "31623\n"}, {"type": "stdin_stdout", "input": "820040584\n", "output": "36407\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.\n\nPolycarpus continues working as a system administrator in ... | [{"type": "stdin_stdout", "input": "10 14\n3 2\n7 2\n6 4\n8 1\n3 9\n5 6\n6 3\n4 1\n2 5\n7 10\n9 5\n7 1\n8 10\n3 4\n", "output": "unknown topology\n"}, {"type": "stdin_stdout", "input": "10 14\n3 2\n7 2\n6 4\n8 1\n3 9\n5 6\n6 3\n4 1\n2 1\n7 10\n9 5\n7 1\n8 10\n3 4\n", "output": "unknown topology\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGeorge woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t. \n\nHelp George! Write a program that will, given time s and t, determine the time p when George went to ... | [{"type": "stdin_stdout", "input": "00:01\n00:00\n", "output": "00:01\n"}, {"type": "stdin_stdout", "input": "05:50\n05:44\n", "output": "00:06\n"}, {"type": "stdin_stdout", "input": "00:00\n01:00\n", "output": "23:00\n"}, {"type": "stdin_stdout", "input": "12:33\n23:33\n", "output": "13:00\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPiegirl was asked to implement two table join operation for distributed database system, minimizing the network traffic.\n\nSuppose she wants to join two tables, A and B. Each of them has certain number of rows which are ... | [{"type": "stdin_stdout", "input": "10 10\n933168403 308417110 823216696 818565876 448948583 884328249 809244579 473034231 407137956 871269623\n1302355559 145998557 644003076 138712151 839886312 479712343 709513279 138285801 858528549 643830064\n", "output": "11375801438\n"}, {"type": "stdin_stdout", "input": "10 10\n9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine that you are in a building that has exactly n floors. You can move between the floors in a lift. Let's number the floors from bottom to top with integers from 1 to n. Now you're on the floor number a. You are very... | [{"type": "stdin_stdout", "input": "5000 2081 3619 5000\n", "output": "557114846\n"}, {"type": "stdin_stdout", "input": "5000 2314 1234 5000\n", "output": "546628648\n"}, {"type": "stdin_stdout", "input": "5000 1031 4782 5000\n", "output": "981271392\n"}, {"type": "stdin_stdout", "input": "5000 4998 5000 5000\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLeonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm Γ h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lac... | [{"type": "stdin_stdout", "input": "5 30 10\nH 8\nH 9\nV 1\nH 2\nH 5\nH 3\nH 1\nV 2\nH 13\nV 3\n", "output": "110\n105\n84\n84\n84\n84\n84\n63\n51\n34\n"}, {"type": "stdin_stdout", "input": "5 15 10\nH 8\nH 9\nV 1\nH 2\nH 6\nH 4\nH 1\nV 2\nH 13\nV 3\n", "output": "40\n40\n32\n24\n24\n24\n24\n18\n12\n8\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are labeled from 1 to k. Balls of the same color are indistinguishable. He draws balls from the bag one by one until the bag... | [{"type": "stdin_stdout", "input": "47\n20\n21\n16\n18\n24\n20\n25\n13\n20\n22\n26\n24\n17\n18\n21\n22\n21\n23\n17\n15\n24\n19\n18\n21\n20\n19\n26\n25\n20\n17\n17\n17\n26\n32\n20\n21\n25\n28\n24\n21\n21\n17\n28\n20\n20\n31\n19\n", "output": "295545118\n"}, {"type": "stdin_stdout", "input": "25\n35\n43\n38\n33\n47\n44\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree with root in vertex 1. Each vertex is coloured in some colour.\n\nLet's call colour c dominating in the subtree of vertex v if there are no other colours that appear in the subtree of vertex v ... | [{"type": "stdin_stdout", "input": "15\n1 2 3 1 2 3 3 1 1 3 2 2 1 2 3\n1 2\n1 3\n1 4\n1 14\n1 15\n2 5\n2 6\n2 7\n3 8\n3 9\n3 10\n4 11\n4 12\n4 13\n", "output": "6 5 4 3 2 3 3 1 1 3 2 2 1 2 3 \n"}, {"type": "stdin_stdout", "input": "15\n1 2 3 1 2 3 3 1 1 3 2 2 1 2 3\n1 2\n1 3\n1 4\n1 14\n1 15\n2 5\n2 6\n2 7\n3 8\n3 9\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBessie the cow and her best friend Elsie each received a sliding puzzle on Pi Day. Their puzzles consist of a 2 Γ 2 grid and three tiles labeled 'A', 'B', and 'C'. The three tiles sit on top of the grid, leaving one grid ... | [{"type": "stdin_stdout", "input": "AB\nXC\nXB\nAC\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "XB\nAC\nBX\nAC\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "AC\nBX\nCB\nAX\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "AC\nXB\nBA\nCX\n", "output": "Yes\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTed has a pineapple. This pineapple is able to bark like a bulldog! At time t (in seconds) it barks for the first time. Then every s seconds after it, it barks twice with 1 second interval. Thus it barks at times t, t + s... | [{"type": "stdin_stdout", "input": "749399100 103031711 761562532\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "178769979 103031711 761562532\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "4363010 696782227 701145238\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "723634470 2814619 940... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings a and b. You have to remove the minimum possible number of consecutive (standing one after another) characters from string b in such a way that it becomes a subsequence of string a. It can happen... | [{"type": "stdin_stdout", "input": "bbbbaabbababbaaaaababbaaabbbbaaabbbababbbbabaabababaabaaabbbabababbbabababaababaaaaa\nbbabaaaabaaaabbaaabbbabaaabaabbbababbbbbbbbbbabbababbaababbbaaabababaaabbbbaaababaaaaab\n", "output": "bbbbbbbabbababbaababbbaaabababaaabbbbaaababaaaaab\n"}, {"type": "stdin_stdout", "input": "bbbba... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist of round brackets (characters ... | [{"type": "stdin_stdout", "input": "((((()())))())((((((()(()())(()())()((()()))(((())()()()(())))))()())())))(()()(()))))()(((()(((())()))())())))))(()()()((((((())(()())())()())(()))))()(()))(((()()()))())()(((()(()(((()))(()))()(()))((((((((())))))()))())(())))))()(()(()(((()((()()()())(((())())((()())(((((()()(())(... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya and Petya take part in a Codeforces round. The round lasts for two hours and contains five problems.\n\nFor this round the dynamic problem scoring is used. If you were lucky not to participate in any Codeforces roun... | [{"type": "stdin_stdout", "input": "26\n3 -1 71 -1 42\n85 72 48 38 -1\n-1 -1 66 24 -1\n46 -1 60 99 107\n53 106 51 -1 104\n-1 17 135 54 -1\n44 107 66 65 102\n47 40 62 34 5\n-1 10 -1 98 -1\n-1 69 47 85 75\n12 62 -1 15 -1\n48 63 72 32 99\n116 104 111 -1 -1\n92 -1 52 -1 11\n118 25 97 1 108\n-1 78 97 37 -1\n87 47 -1 -1 21\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this integer is between 1 and 100 000, inclusive. It is possible that some cards have the same integers on them.\n\nVasily decide... | [{"type": "stdin_stdout", "input": "100\n9 9 72 55 14 8 55 58 35 67 3 18 73 92 41 49 15 60 18 66 9 26 97 47 43 88 71 97 19 34 48 96 79 53 8 24 69 49 12 23 77 12 21 88 66 9 29 13 61 69 54 77 41 13 4 68 37 74 7 6 29 76 55 72 89 4 78 27 29 82 18 83 12 4 32 69 89 85 66 13 92 54 38 5 26 56 17 55 29 4 17 39 29 94 3 67 85 98 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems were saved, but now he needs to find them among other problems.\n\nBut there are too many problems, to do i... | [{"type": "stdin_stdout", "input": "____________________________________________________________________________________________________\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "__________________________________________________________________________________________________`_\n", "output": "NO\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a fraction <image>. You need to find the first occurrence of digit c into decimal notation of the fraction after decimal point.\n\nInput\n\nThe first contains three single positive integers a, b, c (1 β€ a < b β€ 1... | [{"type": "stdin_stdout", "input": "99999 100000 13\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "69168 84860 4\n", "output": "107\n"}, {"type": "stdin_stdout", "input": "25102 31579 2\n", "output": "174\n"}, {"type": "stdin_stdout", "input": "13805 15538 3\n", "output": "164\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHacker Zhorik wants to decipher two secret messages he intercepted yesterday. Yeah message is a sequence of encrypted blocks, each of them consists of several bytes of information.\n\nZhorik knows that each of the message... | [{"type": "stdin_stdout", "input": "50 50\n5733 740 547 3647 5382 5109 6842 7102 5879 1502 3574 1628 7905 4357 8569 9564 8268 3542 2487 8532 425 7713 2585 925 6458 2697 2844 69 324 9030 495 4428 6724 3524 3304 4874 1303 2098 1136 1048 2464 7316 274 9586 534 2450 2368 8060 7795 70692\n1918 4122 6806 4914 6517 6278 9842 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe busses in Berland are equipped with a video surveillance system. The system records information about changes in the number of passengers in a bus after stops.\n\nIf x is the number of passengers in a bus just before ... | [{"type": "stdin_stdout", "input": "102 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "102 1\n1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers 1, 5, 10 and 50 respectively. The use of other roman digits is not allowed.\n\nNumbers in this ... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "48999999753\n"}, {"type": "stdin_stdout", "input": "1000000100\n", "output": "49000004653\n"}, {"type": "stdin_stdout", "input": "1517731607\n", "output": "74368848496\n"}, {"type": "stdin_stdout", "input": "1000001100\n", "output": "49000053653\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTask is simple. You are provided with a string of curly brackets and you have to do the following - \nPrint 0 if the brackets are balanced.\nPrint k if it is unbalanced, where k is the number of actions performed to balan... | [{"type": "stdin_stdout", "input": "4\n{ { { } .\n} { .\n{ } { } | } -\n{ } { } } .\n\nFLPMAS", "output": "1\n2\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "4\n{ { { } .\n} | -\n{ } { } { } .\n{ } { } } .\n\nASMPLE", "output": "1\n-1\n0\n-1\n"}, {"type": "stdin_stdout", "input": "4\n{ { { ~ -\n} { .\n{ } { } { } .\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i. Find the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nConstraints\n\n* 2 \\leq N \\leq 2 \\times ... | [{"type": "stdin_stdout", "input": "3\n111 110\n111 11100\n-2 1111011010", "output": "10990\n"}, {"type": "stdin_stdout", "input": "3\n011 110\n111 11100\n-2 1111011010", "output": "11090\n"}, {"type": "stdin_stdout", "input": "3\n010 110\n111 11100\n-2 1111011010", "output": "11091\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?\n\nCons... | [{"type": "stdin_stdout", "input": "96 1", "output": "111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n"}, {"type": "stdin_stdout", "input": "10 40", "output": "10101010101010101010101010101010101010101010101010101010101010101010101010101010\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nE869120 is initially standing at the origin (0, 0) in a two-dimensional plane.\n\nHe has N engines, which can be used as follows:\n\n* When E869120 uses the i-th engine, his X- and Y-coordinate change by x_i and y_i, resp... | [{"type": "stdin_stdout", "input": "10\n1 2\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n17 18\n19 20", "output": "148.660687473185055226120082139313966514489855137208"}, {"type": "stdin_stdout", "input": "2\n96000 -72000\n-72000 54000", "output": "120000.000000000000000000000000000000000000000000000000"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N integers, A_1, A_2, ..., A_N, written on the blackboard.\n\nYou will choose one of them and replace it with an integer of your choice between 1 and 10^9 (inclusive), possibly the same as the integer originally... | [{"type": "stdin_stdout", "input": "2\n1000010000 1000000000", "output": "1000010000\n"}, {"type": "stdin_stdout", "input": "2\n1000000000 1000001000", "output": "1000001000\n"}, {"type": "stdin_stdout", "input": "2\n1001000000 1000001000", "output": "1001000000\n"}, {"type": "stdin_stdout", "input": "2\n1001100000 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a positive integer X. Find the largest perfect power that is at most X. Here, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less ... | [{"type": "stdin_stdout", "input": "1074", "output": "1024\n"}, {"type": "stdin_stdout", "input": "1023", "output": "1000\n"}, {"type": "stdin_stdout", "input": "1298", "output": "1296\n"}, {"type": "stdin_stdout", "input": "1357", "output": "1331\n"}, {"type": "stdin_stdout", "input": "1746", "output": "1728\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider an infinite sequence a_1, a_2, β¦ Initially, the values of all the terms are 0, and from this state we will sequentially perform Q operations. The i-th operation (1 β€ i β€ Q) is as follows:\n\n* For every positive ... | [{"type": "stdin_stdout", "input": "5\n56 114834\n72 -134386\n100 190757\n192 -132693\n240 133108", "output": "438699\n"}, {"type": "stdin_stdout", "input": "5\n56 114834\n72 -134386\n100 190757\n192 -132693\n240 261716", "output": "567307\n"}, {"type": "stdin_stdout", "input": "5\n56 114834\n72 -149861\n100 190757\n19... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer N. Find the number of the positive divisors of N!, modulo 10^9+7.\n\nConstraints\n\n* 1β€Nβ€10^3\n\nInput\n\nThe input is given from Standard Input in the following format:\n\n\nN\n\n\nOutput\n\nPri... | [{"type": "stdin_stdout", "input": "1001", "output": "513172208\n"}, {"type": "stdin_stdout", "input": "1000", "output": "972926972"}, {"type": "stdin_stdout", "input": "108", "output": "875619122\n"}, {"type": "stdin_stdout", "input": "111", "output": "130571620\n"}, {"type": "stdin_stdout", "input": "101", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that converts the date expressed in the Christian era to the Japanese calendar using the era name and outputs the date. The input is three integers, as shown in the example, in the order year, month, and ... | [{"type": "stdin_stdout", "input": "3559 9 5\n2425 12 2\n2980 9 14", "output": "heisei 1571 9 5\nheisei 437 12 2\nheisei 992 9 14\n"}, {"type": "stdin_stdout", "input": "3559 9 5\n2425 12 2\n2980 9 7", "output": "heisei 1571 9 5\nheisei 437 12 2\nheisei 992 9 7\n"}, {"type": "stdin_stdout", "input": "3080 6 3\n2027 12 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA popular game in a certain country, Pachimon Creature, has been remade and released in Japan. If you love games, after playing this game many times, you've come to think about how you can clear it the fastest. However, n... | [{"type": "stdin_stdout", "input": "6 6\nS.1..4\n5..3..\n..4.1.\n4....5\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0", "output": "3 12\nNA\n"}, {"type": "stdin_stdout", "input": "6 6\nS.1..4\n3..5..\n..4.1.\n4...5.\n.2.32.\n5.1..G\n3 2\n...\nS.G\n0 0", "output": "2 10\nNA\n"}, {"type": "stdin_stdout", "input": "6 6\nS.1..4\n4..... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Japan, temperature is usually expressed using the Celsius (β) scale. In America, they used the Fahrenheit (β) scale instead. $20$ degrees Celsius is roughly equal to $68$ degrees Fahrenheit. A phrase such as \"Todayβs ... | [{"type": "stdin_stdout", "input": "22485", "output": "11227\n"}, {"type": "stdin_stdout", "input": "37535", "output": "18752\n"}, {"type": "stdin_stdout", "input": "54760", "output": "27365\n"}, {"type": "stdin_stdout", "input": "10347", "output": "5158\n"}, {"type": "stdin_stdout", "input": "10699", "output": "5334\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe fundamental idea in the JPEG compression algorithm is to sort coeffi- cient of given image by zigzag path and encode it. In this problem, we donβt discuss about details of the algorithm, but you are asked to make simp... | [{"type": "stdin_stdout", "input": "3\n9\n0", "output": "Case 1:\n 1 2 6\n 3 5 7\n 4 8 9\nCase 2:\n 1 2 6 7 15 16 28 29 45\n 3 5 8 14 17 27 30 44 46\n 4 9 13 18 26 31 43 47 60\n 10 12 19 25 32 42 48 59 61\n 11 20 24 33 41 49 58 62 71\n 21 23 34 40 50 57 63 70 72\n 22 35 39 51 56 64 69 73 78\n 36 38 52... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a computer literacy course in your university. In the computer system, the login/logout records of all PCs in a day are stored in a file. Although students may use two or more PCs at a time, no one can log in to ... | [{"type": "stdin_stdout", "input": "6 2\n10\n775 1 1 1\n780 4 2 1\n790 2 1 1\n800 2 1 0\n810 3 1 1\n820 1 1 0\n825 3 1 0\n860 1 1 1\n870 4 2 -1\n880 1 1 0\n1\n780 870 1\n13 15\n12\n540 12 13 1\n600 12 13 0\n650 13 15 1\n660 12 15 1\n665 11 13 1\n670 13 15 0\n675 11 13 0\n680 12 15 0\n1000 11 14 1\n1060 12 14 1\n1060 11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a small planet named Bandai, a landing party of the starship Tadamigawa discovered colorful cubes traveling on flat areas of the planet surface, which the landing party named beds. A cube appears at a certain position ... | [{"type": "stdin_stdout", "input": "10 5\nkkkkkwwwww\nw#wwwrwwww\nwwwwbgwwww\nkwwnwcwwkk\nkkwywwwkkk\nrgbcmy\n10 5\nkkkkkkkkkk\nk#kkkkkkkk\nkwkkkkkwwk\nkwwbgrymck\nkwwwwwwwwk\ncmyrgb\n10 5\nkkkkkkkkkk\nk#kkkkkkkk\nkkwkkkkkwk\nkcmyrgbwwk\nkwwwwwwwwk\ncnyrgb\n0 0", "output": "unreachable\nunreachable\nunreachable\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nI chose creature observation as the theme of my free study during the summer vacation and purchased a creature observation kit.\n\nThis creature prefers to live in a three-dimensional grid-like space. Only one ... | [{"type": "stdin_stdout", "input": "5\n00000\n01010\n00000\n00100\n00000\n\n00000\n01010\n00000\n01010\n00000\n\n00000\n00100\n00000\n01010\n00000\n\n00000\n01110\n00000\n00100\n00000\n\n00000\n00000\n00100\n00000\n00000\n\n1 2\n2 3 4\n4\n01110\n00100\n00100\n00100\n01110\n\n01110\n10001\n10000\n10001\n01110\n\n11111\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Bill is shopping at the store. There are some coins in his wallet (10-yen coins, 50-yen coins, 100-yen coins, 500-yen coins), but he is now trying to consume as much of this coin as possible. In other words, by paying... | [{"type": "stdin_stdout", "input": "160\n1 1 2 0\n160\n1 1 2 10\n0", "output": "10 1\n50 1\n100 1\n\n10 1\n50 1\n100 1\n"}, {"type": "stdin_stdout", "input": "160\n1 1 2 0\n160\n1 -1 1 10\n0", "output": "10 1\n50 1\n100 1\n\n10 1\n500 1\n"}, {"type": "stdin_stdout", "input": "160\n1 1 4 0\n125\n-1 1 2 10\n0", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwin adventurers Rin and Len are searching for treasure in the Mirror Cave. The cave has two pairs of rooms, the Hall of Mirrors, and an expensive treasure lies behind the door of the room.\n\nFor convenience, each of the... | [{"type": "stdin_stdout", "input": "5 5\n%#... ...#%\n.#.#. .#.#.\n.#.#. .#.#.\n.#.#. .#.#.\n...#L R#...\n3 2\n.L. .R#\n%.. .%.\n4 1\nL.%. %..R\n0 0", "output": "Yes\nYes\nNo"}, {"type": "stdin_stdout", "input": "5 5\n%#... ...#%\n.#.#. .#.#.\n.#.#. .#.#.\n.#.#. .#.#.\n...#L R#...\n3 2\n.L. .R#\n%.. .&.\n4 1\nL.%. %..R... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSunake is in the form of a polygonal line consisting of n vertices (without self-intersection). First, Sunake-kun's i-th vertex is at (xi, yi). You can move continuously by translating or rotating, but you cannot deform (... | [{"type": "stdin_stdout", "input": "11\n63 106\n87 143\n102 132\n115 169\n74 145\n41 177\n56 130\n28 102\n19 124\n0 156\n22 183", "output": "Impossible\n"}, {"type": "stdin_stdout", "input": "11\n63 106\n87 143\n102 132\n115 169\n74 145\n41 177\n56 130\n28 102\n19 124\n0 294\n22 183", "output": "Impossible\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJ: City\n\nSanta decides to deliver a present to a city.\n\nThe city has a rectangular shape divided into north-south $ H $ parcels x east-west $ W $ parcels, with one house delivering gifts to each parcel.\n\nThe $ X $ t... | [{"type": "stdin_stdout", "input": "2 -2 11 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 -1 12 1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 2 0 14", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 -1 1 11", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 -2 11 0", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGiven a permutation of length $ N $ $ P = \\\\ {P_1, P_2, \\ ldots, P_N \\\\} $ and the integer $ K $.\nDetermine if the permutation $ P $ can be monotonically increased by repeating the following operation any... | [{"type": "stdin_stdout", "input": "0 3\n3 -1 1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 2\n6 11 1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1 2\n10 2 2", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 2\n10 2 2", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "0 2\n2 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which prints the central coordinate ($cx$,$cy$) and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points ($x_1$, $y_1$), ($x_2$, $y_2$) and ($x_3$, $y_3$) on the plan... | [{"type": "stdin_stdout", "input": "1 -2\n3 2\n-2 0", "output": "0.62500000000000000000 0.68750000000000000000 2.71353666826155124291"}, {"type": "stdin_stdout", "input": "0 3\n4 0\n0 0", "output": "2.00000000000000000000 1.50000000000000000000 2.50000000000000000000"}, {"type": "stdin_stdout", "input": "7 -3\n1 0\n-13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a set $S$ of integers, perform a sequence of the following operations. Note that each value in $S$ must be unique.\n\n* insert($x$): Insert $x$ to $S$ and report the number of elements in $S$ after the operation.\n* f... | [{"type": "stdin_stdout", "input": "7\n0 -1\n0 2\n0 6\n1 2\n0 -1\n0 -1\n1 20", "output": "1\n2\n3\n1\n3\n3\n0\n"}, {"type": "stdin_stdout", "input": "7\n0 -1\n0 2\n0 5\n1 2\n0 -1\n1 0\n1 20", "output": "1\n2\n3\n1\n3\n0\n0\n"}, {"type": "stdin_stdout", "input": "7\n0 -1\n0 2\n0 6\n1 2\n0 -1\n0 0\n1 20", "output": "1\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA bracket sequence is a string containing only characters \"(\" and \")\". A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters \"1\" and \"... | [{"type": "stdin_stdout", "input": "40 36\n((((((((()()()))))))))((())((()())))(())\n", "output": "((((((((()()()))))))))((())((()())))\n"}, {"type": "stdin_stdout", "input": "40 34\n((((((((()()()))))))))((())((()())))(())\n", "output": "((((((((()()()))))))))((())((())))\n"}, {"type": "stdin_stdout", "input": "40 32\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan places knights on infinite chessboard. Initially there are n knights. If there is free cell which is under attack of at least 4 knights then he places new knight in this cell. Ivan repeats this until there are no suc... | [{"type": "stdin_stdout", "input": "1000\n", "output": "0 0\n1 0\n0 1\n-1 0\n0 -1\n2 0\n0 2\n-2 0\n0 -2\n3 0\n0 3\n-3 0\n0 -3\n4 0\n0 4\n-4 0\n0 -4\n5 0\n0 5\n-5 0\n0 -5\n6 0\n0 6\n-6 0\n0 -6\n7 0\n0 7\n-7 0\n0 -7\n8 0\n0 8\n-8 0\n0 -8\n9 0\n0 9\n-9 0\n0 -9\n10 0\n0 10\n-10 0\n0 -10\n11 0\n0 11\n-11 0\n0 -11\n12 0\n0 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.\n\nThe i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and v_i along the edge e_i is... | [{"type": "stdin_stdout", "input": "8 10\n1 2 1\n2 3 2\n2 4 5\n1 4 2\n6 3 3\n6 1 3\n3 5 2\n3 7 1\n4 8 1\n6 2 4\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "8 10\n1 2 1\n2 3 4\n2 4 5\n1 4 2\n6 3 3\n6 1 3\n3 5 2\n3 7 1\n4 8 1\n6 2 4\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "8 10\n1 2 1\n2 3 2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by n streets along the Eastern direction and m streets across the Southern direction. Naturally, this city has nm int... | [{"type": "stdin_stdout", "input": "1 100\n197 693 757 329 311 798 783 1130 504 1051 978 358 367 467 623 767 481 154 855 608 157 104 273 261 110 713 948 897 96 476 855 337 93 321 648 441 215 979 505 69 858 99 1215 337 237 116 824 98 955 192 773 99 485 385 861 347 772 993 470 215 792 1192 986 515 84 7 476 831 903 74 79 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation p of n integers 1, 2, ..., n (a permutation is an array where each element from 1 to n occurs exactly once).\n\nLet's call some subsegment p[l, r] of this permutation special if p_l + p_r = max... | [{"type": "stdin_stdout", "input": "5\n4 5 1 3 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n5 4 1 3 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n3 4 2 5 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n3 4 1 5 2\n", "output": "2"}, {"type": "stdin_stdout", "input": "3\n2 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's denote a k-step ladder as the following structure: exactly k + 2 wooden planks, of which\n\n * two planks of length at least k+1 β the base of the ladder; \n * k planks of length at least 1 β the steps of the ladd... | [{"type": "stdin_stdout", "input": "4\n4\n1 12 1 3\n3\n1 3 1\n5\n2 1 3 1 2\n3\n1 1 2\n", "output": "2\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n4\n1 12 1 3\n3\n1 3 1\n5\n2 1 3 4 2\n3\n1 1 2\n", "output": "2\n0\n2\n0\n"}, {"type": "stdin_stdout", "input": "4\n4\n1 3 1 3\n3\n3 3 2\n5\n2 3 3 4 2\n3\n1 1 2\n", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are b boys and g girls participating in Olympiad of Metropolises. There will be a board games tournament in the evening and n participants have accepted the invitation. The organizers do not know how many boys and g... | [{"type": "stdin_stdout", "input": "300\n299\n300\n", "output": "300\n"}, {"type": "stdin_stdout", "input": "100\n200\n150\n", "output": "101\n"}, {"type": "stdin_stdout", "input": "299\n259\n300\n", "output": "259\n"}, {"type": "stdin_stdout", "input": "199\n199\n199\n", "output": "200\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour favorite music streaming platform has formed a perfectly balanced playlist exclusively for you. The playlist consists of n tracks numbered from 1 to n. The playlist is automatic and cyclic: whenever track i finishes ... | [{"type": "stdin_stdout", "input": "100\n7585 5510 1017 4329 2840 8171 5089 1873 7308 9656 6833 7578 4914 6658 4408 7122 5265 1204 9800 3150 2151 6906 6041 3973 931 7239 4421 4211 156 8655 4266 3543 9752 3117 2731 6052 8950 9391 6367 996 9973 629 9489 4912 9226 9301 5166 4889 3710 6794 618 9155 2462 1120 5499 5861 3177... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLong is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.\n\nHis farm is presented by a rectangle grid with r rows and c columns. Some of... | [{"type": "stdin_stdout", "input": "4\n3 5 3\n..R..\n...R.\n....R\n6 4 12\nR..R\nR..R\nRRRR\nRRRR\nR..R\nR..R\n5 5 4\nRRR..\nR.R..\nRRR..\nR..R.\nR.R..\n2 31 62\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", "output": "aaabb\ncccbb\nccccc\naaaa\nbbbb\nccdd\nhgfe\nijjj\nlllk\naaabb\nbbbbb\nbcccc\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta has to send presents to the kids. He has a large stack of n presents, numbered from 1 to n; the topmost present has number a_1, the next present is a_2, and so on; the bottom present has number a_n. All numbers are ... | [{"type": "stdin_stdout", "input": "2\n3 3\n3 1 2\n3 2 1\n7 2\n2 1 7 3 4 5 6\n6 1\n", "output": "5\n14\n"}, {"type": "stdin_stdout", "input": "2\n3 3\n3 1 2\n3 2 1\n7 2\n2 1 7 3 4 5 6\n4 1\n", "output": "5\n10\n"}, {"type": "stdin_stdout", "input": "2\n3 3\n3 1 2\n3 2 1\n7 2\n4 1 7 3 2 5 4\n5 1\n", "output": "5\n12\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA popular reality show is recruiting a new cast for the third season! n candidates numbered from 1 to n have been interviewed. The candidate i has aggressiveness level l_i, and recruiting this candidate will cost the show... | [{"type": "stdin_stdout", "input": "34 5\n2 2 5 4 3 1 3 5 3 1 3 1 3 5 5 2 1 3 3 3 1 1 1 4 5 1 3 2 5 5 2 1 2 2\n1357 797 4642 4072 3953 4020 207 344 1412 4061 400 214 708 389 567 3294 1336 3746 1513 3539 4220 4720 329 4516 1741 1744 2537 3963 4941 664 1169 4512 3358 4144\n-4668 -1085 109 -899 769 -1132 -2587 1503 760 -2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAyush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns: \n\n * Select any leaf node in the tree and remove it together with any edge which has thi... | [{"type": "stdin_stdout", "input": "10\n8 2\n1 5\n7 4\n8 5\n5 6\n8 7\n2 8\n1 3\n10 5\n10 1\n4 7\n6 4\n4 3\n8 1\n1 2\n1 4\n5 1\n1 9\n2 2\n2 1\n9 3\n9 6\n1 7\n2 6\n7 3\n6 8\n1 6\n5 1\n6 4\n8 6\n3 1\n8 6\n2 4\n5 7\n8 4\n1 8\n5 6\n10 3\n5 9\n10 1\n5 10\n6 1\n4 10\n1 2\n3 7\n2 3\n10 8\n4 1\n1 4\n1 3\n2 1\n5 5\n4 5\n1 3\n1 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMasha has n types of tiles of size 2 Γ 2. Each cell of the tile contains one integer. Masha has an infinite number of tiles of each type.\n\nMasha decides to construct the square of size m Γ m consisting of the given tile... | [{"type": "stdin_stdout", "input": "6\n3 4\n1 2\n5 6\n5 7\n7 4\n8 9\n9 8\n2 5\n1 1\n1 1\n2 2\n2 2\n1 100\n10 10\n10 10\n1 2\n4 5\n8 4\n2 2\n1 1\n1 1\n1 2\n3 4\n1 2\n1 1\n1 1\n", "output": "YES\nNO\nYES\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "6\n3 4\n0 2\n5 6\n5 7\n7 4\n8 9\n9 8\n2 5\n1 1\n1 1\n2 2\n2 2\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA Ministry for Defense sent a general to inspect the Super Secret Military Squad under the command of the Colonel SuperDuper. Having learned the news, the colonel ordered to all n squad soldiers to line up on the parade g... | [{"type": "stdin_stdout", "input": "100\n66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 55 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 95 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have an array a_1, a_2, ..., a_n. All a_i are positive integers.\n\nIn one step you can choose three distinct indices i, j, and k (i β j; i β k; j β k) and assign the sum of a_j and a_k to a_i, i. e. make a_i = a_j + ... | [{"type": "stdin_stdout", "input": "15\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n3 3\n3 3 3\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's say you are standing on the XY-plane at point (0, 0) and you want to reach point (n, n).\n\nYou can move only in two directions: \n\n * to the right, i. e. horizontally and in the direction that increase your x coo... | [{"type": "stdin_stdout", "input": "3\n2\n13 100\n3\n4 3 1\n5\n13 4 1 1 5\n", "output": "226\n15\n25\n"}, {"type": "stdin_stdout", "input": "3\n2\n13 88\n3\n2 3 1\n5\n4 3 2 1 4\n", "output": "\n202\n13\n19\n"}, {"type": "stdin_stdout", "input": "3\n2\n13 100\n3\n2 3 0\n5\n4 3 2 1 5\n", "output": "226\n11\n19\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call an array a consisting of n positive (greater than 0) integers beautiful if the following condition is held for every i from 1 to n: either a_i = 1, or at least one of the numbers a_i - 1 and a_i - 2 exists in t... | [{"type": "stdin_stdout", "input": "4\n1\n12\n13\n35\n", "output": "1\n4\n4\n6\n"}, {"type": "stdin_stdout", "input": "4\n1\n12\n11\n14\n", "output": "1\n4\n4\n4\n"}, {"type": "stdin_stdout", "input": "4\n1\n12\n22\n35\n", "output": "1\n4\n5\n6\n"}, {"type": "stdin_stdout", "input": "4\n2\n12\n11\n14\n", "output": "2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've got a rectangular table with length a and width b and the infinite number of plates of radius r. Two players play the following game: they take turns to put the plates on the table so that the plates don't lie on e... | [{"type": "stdin_stdout", "input": "100 100 51\n", "output": "Second"}, {"type": "stdin_stdout", "input": "100 100 27\n", "output": "First\n"}, {"type": "stdin_stdout", "input": "100 100 46\n", "output": "First\n"}, {"type": "stdin_stdout", "input": "100 100 49\n", "output": "First"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves playing with arrays. He has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai. \n\nAdditionally the Little Elephant has m queries to the ... | [{"type": "stdin_stdout", "input": "6 6\n2 1 2 3 3 10\n1 2\n2 2\n1 3\n2 4\n3 6\n2 2\n", "output": "1\n1\n2\n1\n0\n1\n"}, {"type": "stdin_stdout", "input": "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 6\n", "output": "1\n0\n2\n1\n1\n3\n"}, {"type": "stdin_stdout", "input": "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n4 4\n4 6\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are almost prime, while 4, 8, 9, 42 are not. Find the amount of almost prime numbers which are between 1 and n,... | [{"type": "stdin_stdout", "input": "2998\n", "output": "1375\n"}, {"type": "stdin_stdout", "input": "2999\n", "output": "1375\n"}, {"type": "stdin_stdout", "input": "2997\n", "output": "1374\n"}, {"type": "stdin_stdout", "input": "3000\n", "output": "1375\n"}, {"type": "stdin_stdout", "input": "2990\n", "output": "1370... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being made of a very large number of bricks, numbered 1, 2, 3 and so on. \n\... | [{"type": "stdin_stdout", "input": "1 1 1000000000 2000000000\n", "output": "1000000001\n"}, {"type": "stdin_stdout", "input": "2 1 1000000000 2000000000\n", "output": "500000001\n"}, {"type": "stdin_stdout", "input": "2 1 1000001000 2000000000\n", "output": "499999501\n"}, {"type": "stdin_stdout", "input": "555 777 66... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGeorge decided to prepare a Codesecrof round, so he has prepared m problems for the round. Let's number the problems with integers 1 through m. George estimates the i-th problem's complexity by integer bi.\n\nTo make the ... | [{"type": "stdin_stdout", "input": "29 100\n20 32 41 67 72 155 331 382 399 412 465 644 484 511 515 529 690 637 679 715 733 763 826 843 862 903 276 979 989\n15 15 15 17 18 22 19 20 21 21 22 8 25 26 26 27 28 31 32 32 37 42 38 39 39 40 41 42 43 43 35 45 46 47 49 49 50 50 50 51 52 53 53 55 56 57 24 59 59 60 60 62 62 63 63 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's that time of the year when the Russians flood their countryside summer cottages (dachas) and the bus stop has a lot of people. People rarely go to the dacha on their own, it's usually a group, so the people stand in ... | [{"type": "stdin_stdout", "input": "100 60\n34 21 39 17 48 46 23 56 46 52 50 39 55 48 54 38 32 38 24 26 44 12 28 9 25 26 10 52 42 60 41 3 16 60 44 29 27 55 19 19 19 57 45 59 29 35 5 14 50 47 57 48 16 7 12 36 58 31 37 58 30 50 19 11 10 41 59 57 49 41 33 9 12 11 53 50 60 51 21 9 44 23 1 16 4 15 17 57 15 17 46 50 18 52 43... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA triangular number is the number of dots in an equilateral triangle uniformly filled with dots. For example, three dots can be arranged in a triangle; thus three is a triangular number. The n-th triangular number is the ... | [{"type": "stdin_stdout", "input": "300\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "406\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "253\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "276\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "496\n", "output": "YES\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, d... | [{"type": "stdin_stdout", "input": "19\n1 13\n0 0\n1 9\n1 11\n1 11\n2 3\n2 30\n0 0\n1 5\n1 2\n0 0\n5 29\n1 6\n2 11\n0 0\n0 0\n0 0\n0 0\n2 13\n", "output": "10\n0 13\n2 9\n3 11\n4 11\n8 5\n12 6\n13 11\n5 11\n6 18\n11 18\n"}, {"type": "stdin_stdout", "input": "18\n0 0\n0 0\n2 19\n1 2\n2 29\n0 0\n1 7\n1 6\n1 12\n1 13\n0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vertices C of the maximu... | [{"type": "stdin_stdout", "input": "12\n66 4\n12 4\n60 4\n24 4\n48 4\n0 4\n36 4\n30 4\n6 4\n54 4\n42 4\n18 4\n", "output": "6"}, {"type": "stdin_stdout", "input": "12\n66 4\n12 4\n60 4\n24 4\n48 4\n0 4\n36 4\n4 4\n6 4\n54 4\n42 4\n18 4\n", "output": "6"}, {"type": "stdin_stdout", "input": "12\n66 4\n12 4\n60 2\n24 4\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define the permutation of length n as an array p = [p1, p2, ..., pn] consisting of n distinct integers from range from 1 to n. We say that this permutation maps value 1 into the value p1, value 2 into the value p2 a... | [{"type": "stdin_stdout", "input": "50 20365011074\n", "output": "2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 "}, {"type": "stdin_stdout", "input": "50 5608642004\n", "output": "1 2 4 3 5 6 8 7 9 10 11 13 12 15 14 17 16 18 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is a balmy spring afternoon, and Farmer John's n cows are ruminating about link-cut cacti in their stalls. The cows, labeled 1 through n, are arranged so that the i-th cow occupies the i-th stall from the left. However... | [{"type": "stdin_stdout", "input": "100000 100000\n", "output": "4999950000\n"}, {"type": "stdin_stdout", "input": "100000 40000\n", "output": "4799960000\n"}, {"type": "stdin_stdout", "input": "100000 49998\n", "output": "4999949994\n"}, {"type": "stdin_stdout", "input": "100000 49999\n", "output": "4999949999\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBarney is standing in a bar and starring at a pretty girl. He wants to shoot her with his heart arrow but he needs to know the distance between him and the girl to make his shot accurate.\n\n<image>\n\nBarney asked the ba... | [{"type": "stdin_stdout", "input": "8.1089882894234341219420177467603732503076124872188628349726911362800974096687340341040683238197289136e31\n", "output": "81089882894234341219420177467603.732503076124872188628349726911362800974096687340341040683238197289136\n"}, {"type": "stdin_stdout", "input": "2.062909480759549113... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCowboy Beblop is a funny little boy who likes sitting at his computer. He somehow obtained two elastic hoops in the shape of 2D polygons, which are not necessarily convex. Since there's no gravity on his spaceship, the ho... | [{"type": "stdin_stdout", "input": "16\n0 1000 0\n436 1013 0\n509 517 0\n1000 500 0\n1000 1000 0\n1401 1028 0\n1434 461 0\n2086 442 0\n2079 1044 0\n2506 1032 0\n2549 450 0\n3077 446 0\n3063 1067 0\n3715 1062 0\n3756 -125 0\n0 0 0\n16\n-243 700 394\n109 700 365\n129 700 -366\n763 700 -366\n725 700 397\n1131 700 409\n117... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangular table 3 Γ n. Each cell contains an integer. You can move from one cell to another if they share a side.\n\nFind such path from the upper left cell to the bottom right cell of the table that doe... | [{"type": "stdin_stdout", "input": "10\n1086100980 -928074266 -409520915 770775361 240764400 108297300 -280070452 588179696 -920283246 736937716\n422602209 -940948979 -483879926 -525886137 -79749893 -958247281 844561102 553768085 269384580 -975129348\n-485518332 -130037110 493465239 494308146 958976404 706037260 154106... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSmith wakes up at the side of a dirty, disused bathroom, his ankle chained to pipes. Next to him is tape-player with a hand-written message \"Play Me\". He finds a tape in his own back pocket. After putting the tape in th... | [{"type": "stdin_stdout", "input": "15 6\naaa\naaabbb\naaabb\naaaaa\naaaaaa\naaaa\naaabbbb\naaaaa\naaaaaa\naaaa\naaabbbb\naabbbb\naa\naa\naab\na\n?a?\n??\n?aa?bb?\n?aa?aa?\n??aaa?\n", "output": "0\n4\n2\n5\n6\n7\n"}, {"type": "stdin_stdout", "input": "15 6\naaa\naaabbb\naaabb\naaaaa\naaaaaa\naaaa\naaabbbb\naaaaa\naaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Nikita found the string containing letters \"a\" and \"b\" only. \n\nNikita thinks that string is beautiful if it can be cut into 3 strings (possibly empty) without changing the order of the letters, where the 1-s... | [{"type": "stdin_stdout", "input": "bbabbbbbaaba\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "bbbbbbabaaaa\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "bbabbbbabbbb\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "baabbbbbaaba\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation p of length n. Remove one element from permutation to make the number of records the maximum possible.\n\nWe remind that in a sequence of numbers a1, a2, ..., ak the element ai is a record if f... | [{"type": "stdin_stdout", "input": "92\n42 64 33 89 57 9 24 44 87 67 92 84 39 88 26 27 85 62 22 83 23 71 14 13 73 79 15 49 2 12 76 53 81 40 31 3 72 58 1 61 7 82 20 54 46 77 11 16 28 48 6 45 36 43 60 38 18 4 32 74 10 91 19 86 75 51 50 52 78 25 65 8 55 30 90 69 59 63 56 80 29 68 70 17 35 41 37 47 66 34 5 21\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days ar... | [{"type": "stdin_stdout", "input": "01010101010101010101010101010101010101000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010\n", "output": "5\n39 1 2 3 4 5 6 7 8 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn BerSoft n programmers work, the programmer i is characterized by a skill r_i.\n\nA programmer a can be a mentor of a programmer b if and only if the skill of the programmer a is strictly greater than the skill of the p... | [{"type": "stdin_stdout", "input": "10 35\n322022227 751269818 629795150 369443545 344607287 250044294 476897672 184054549 986884572 917181121\n6 3\n7 3\n1 9\n7 9\n10 7\n3 4\n8 6\n7 4\n6 10\n7 2\n3 5\n6 9\n3 10\n8 7\n6 5\n8 1\n8 5\n1 7\n8 10\n8 2\n1 5\n10 4\n6 7\n4 6\n2 6\n5 4\n9 10\n9 2\n4 8\n5 9\n4 1\n3 2\n2 1\n4 2\n... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.