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\nA newspaper is published in Walrusland. Its heading is s1, it consists of lowercase Latin letters. Fangy the little walrus wants to buy several such newspapers, cut out their headings, glue them one to another in order to... | [{"type": "stdin_stdout", "input": "ehfjaabjfedhddejjfcfijagefhkeahjcddhchahjbagi\nfbfdjbjhibjgjgaaajgdbcfdbhjcajcbbieijhcjgajhgaa\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "ehfjaabjfedhddejjfcfijagefhkeahjcddhchahjbagi\naaghjagjchjieibbcjacjhbdfcbdgjaaagjgjbihjbjdfbf\n", "output": "10\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGhosts live in harmony and peace, they travel the space without any purpose other than scare whoever stands in their way.\n\nThere are n ghosts in the universe, they move in the OXY plane, each one of them has its own vel... | [{"type": "stdin_stdout", "input": "10 7 -626288749\n795312099 49439844 266151109\n-1357052512 23740808 624973405\n-513221420 -44452680 -391096559\n-350963348 -5068756 -160670209\n690883790 11897718 3356227\n-509035268 -76541374 -210137445\n-121282138 -32581578 230716703\n491731655 9500548 -13423963\n-665038289 4817024... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a vector \\vec{v} = (x, y), define |v| = β{x^2 + y^2}.\n\nAllen had a bit too much to drink at the bar, which is at the origin. There are n vectors \\vec{v_1}, \\vec{v_2}, β
β
β
, \\vec{v_n}. Allen will make n moves. As ... | [{"type": "stdin_stdout", "input": "9\n1000000 0\n0 -999999\n600000 600000\n600000 600000\n600000 600000\n-600000 -600000\n600000 600000\n600000 600000\n-700000 710000\n", "output": "-1 -1 -1 -1 1 -1 -1 1 -1 "}, {"type": "stdin_stdout", "input": "9\n1000000 0\n0 -999999\n600000 600000\n600000 600000\n600000 171765\n-60... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBajirao's city has N X N police stations P(i,j) (1 β€ i β€ N, 1 β€ j β€ N) arranged in an N X N square matrix format. Bajirao is a really hardworking police officer and wants to solve all the pending cases of all the police s... | [{"type": "stdin_stdout", "input": "3\n-1 -1 13\n-2 -4 9\n3 -12 -1\n\nESARLN", "output": "25\n"}, {"type": "stdin_stdout", "input": "3\n-2 -2 18\n-2 0 13\n0 -13 -1\n\nASERLN", "output": "31\n"}, {"type": "stdin_stdout", "input": "3\n-1 0 13\n-1 -4 12\n3 -12 -1\n\nESARMN", "output": "28\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDescription:\nName string is a string consisting of letters \"R\",\"K\" and \"V\". Today Oz wants to design a name string in a beautiful manner. Actually Oz cannot insert these three letters arbitrary anywhere ,he has to ... | [{"type": "stdin_stdout", "input": "21\n0 0 0\n3 -1 0\n5 1 2\n7 12 4\n0 0 0\n0 2 0\n1 1 0\n50 67 56\n4 10 12\n11 10 20\n30 21 30\n3 7 1\n29 14 15\n39 29 34\n5 10 10\n41 12 41\n50 50 1\n50 50 49\n2 3 3\n0 0 68\n1000000 1000000 1010000", "output": "0\n1\n5\n15\n0\n1\n2\n113\n21\n23\n60\n7\n31\n69\n20\n82\n100\n100\n6\n1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFatal Eagle has finally teamed up with Arjit to take on this weird army of zombies and vampires. And they are coming up with strategies to beat these guys on a roll. The simple thing they figured out is that these creatur... | [{"type": "stdin_stdout", "input": "6\n32 188 2 109 25 61", "output": "10395 417\nWe will win!\n"}, {"type": "stdin_stdout", "input": "6\n32 362 2 109 25 61", "output": "10395 591\nWe will win!\n"}, {"type": "stdin_stdout", "input": "6\n32 142 0 132 25 61", "output": "11340 392\nWe will win!\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is a number sequence A of length N.\n\nFind the number of integers i \\left(1 \\leq i \\leq N\\right) with the following property:\n\n* For every integer j \\left(1 \\leq j \\leq N\\right) such that i \\neq j , A_j ... | [{"type": "stdin_stdout", "input": "10\n33 4 45 28 15 19 123 86 2 4", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n33 18 45 28 8 19 89 86 2 7", "output": "6\n"}, {"type": "stdin_stdout", "input": "10\n33 4 45 28 15 19 89 86 2 4", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n33 2 26 28 13 19 89 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.\n\nAccording to the regul... | [{"type": "stdin_stdout", "input": "5\n-1 -1 1 1 321", "output": "APPROVED\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 1 1 337", "output": "APPROVED\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 1 1 200", "output": "APPROVED\n"}, {"type": "stdin_stdout", "input": "5\n-1 -1 1 1 385", "output": "APPROVED\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a digit sequence S of length 4. You are wondering which of the following formats S is in:\n\n* YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January... | [{"type": "stdin_stdout", "input": "1211", "output": "AMBIGUOUS\n"}, {"type": "stdin_stdout", "input": "1204", "output": "AMBIGUOUS\n"}, {"type": "stdin_stdout", "input": "0112", "output": "AMBIGUOUS"}, {"type": "stdin_stdout", "input": "2206", "output": "YYMM\n"}, {"type": "stdin_stdout", "input": "1291", "output": "M... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a grid with H horizontal rows and W vertical columns. Let (i, j) denote the square at the i-th row from the top and the j-th column from the left.\n\nIn the grid, N Squares (r_1, c_1), (r_2, c_2), \\ldots, (r_N, ... | [{"type": "stdin_stdout", "input": "100000 100000 1\n50000 23836", "output": "920202332\n"}, {"type": "stdin_stdout", "input": "100000 100000 1\n50000 25003", "output": "717307015\n"}, {"type": "stdin_stdout", "input": "100000 100000 1\n50000 29731", "output": "587968146\n"}, {"type": "stdin_stdout", "input": "100000 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has two positive integers A and B.\n\nIt is known that A plus B equals N. Find the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\" (in base 10).\n\nConstraints\n\n* 2... | [{"type": "stdin_stdout", "input": "100000", "output": "10"}, {"type": "stdin_stdout", "input": "1697", "output": "23\n"}, {"type": "stdin_stdout", "input": "199", "output": "19\n"}, {"type": "stdin_stdout", "input": "178", "output": "16\n"}, {"type": "stdin_stdout", "input": "389", "output": "20\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive x-axis direction.\n\nThis robot will be given an instruction sequence s. s consists of the following two kinds of let... | [{"type": "stdin_stdout", "input": "FTFFTFFF\n-2 -2", "output": "Yes"}, {"type": "stdin_stdout", "input": "FTFFTFFF\n-2 -3", "output": "No\n"}, {"type": "stdin_stdout", "input": "FTFFTFFF\n-2 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "FTFFTFFF\n-1 -1", "output": "No\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N boxes arranged in a circle. The i-th box contains A_i stones.\n\nDetermine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:\n\n* Select one box. ... | [{"type": "stdin_stdout", "input": "5\n12 26 12 10 8", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5\n6 11 12 10 8", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5\n6 16 12 10 8", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5\n6 26 12 10 8", "output": "NO\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is data that records the customer number of the business partner and the trading date on a monthly basis. Please create a program that reads this month's data and last month's data and outputs the customer number of... | [{"type": "stdin_stdout", "input": "123,10\n56,12\n35,14\n\n123,3\n56,4\n123,5", "output": "56 2\n123 3\n"}, {"type": "stdin_stdout", "input": "123,10\n56,12\n45,13\n\n113,4\n56,4\n123,5", "output": "56 2\n123 2\n"}, {"type": "stdin_stdout", "input": "123,10\n57,12\n35,14\n\n123,3\n57,4\n123,5", "output": "57 2\n123 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe greatest common divisor is an indispensable element in mathematics handled on a computer. Using the greatest common divisor can make a big difference in the efficiency of the calculation. One of the algorithms to find... | [{"type": "stdin_stdout", "input": "1251 5715\n10 10\n0 0", "output": "9 6\n10 1\n"}, {"type": "stdin_stdout", "input": "1251 3144\n10 10\n0 0", "output": "3 6\n10 1\n"}, {"type": "stdin_stdout", "input": "1893 2905\n10 6\n0 0", "output": "1 11\n2 3\n"}, {"type": "stdin_stdout", "input": "1893 2905\n11 6\n0 0", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, ... | [{"type": "stdin_stdout", "input": "6 9\n....#.\n.....#\n./....\n......\n......\n......\n./....\n#@...#\n.#..#.\n11 9\n.#.........\n.#.#######.\n.#.#.....#.\n.#.#.###.#.\n.#.#..@#.#.\n.#.#####.#.\n.#......-#.\n.#########.\n...........\n11 6\n..#..#..#..\n..#..#..#..\n..#..#..###\n..#..#..#@.\n..#..#..#..\n..#..#..\"..\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTraining is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.\n\nToday's training is to gain the power of business by running around the city and condu... | [{"type": "stdin_stdout", "input": "2 3 100 20\nvim 10 10\nemacs 5 10\nvstudio 65 100\n2 1 6\nemacs 4\nvstudio 13\n3 -3 -1\nvim 5\nemacs 9\nvstudio 62", "output": "129\n"}, {"type": "stdin_stdout", "input": "2 3 100 10\nvim 10 10\nemacs 5 18\nvstudio 65 100\n2 1 6\nemacs 4\nvstudio 13\n3 -3 0\nvim 5\nemacs 9\nvstudio 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a game called Guru Guru Gururin. In this game, you can move with the vehicle called Gururin. There are two commands you can give to Gururin: 'R' and 'L'. When 'R' is sent, Gururin rotates clockwise by 90 d... | [{"type": "stdin_stdout", "input": "RRLRRLRRRRLRRLRRRRLRRLRRRRLRRLRR", "output": "4"}, {"type": "stdin_stdout", "input": "RLLRRLLLRRRLLLLRR", "output": "0\n"}, {"type": "stdin_stdout", "input": "RLLRRLLMRRRLLLLRR", "output": "0\n"}, {"type": "stdin_stdout", "input": "RLLRLLLLRRRLLLRRR", "output": "0"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA priority queue is a data structure which maintains a set $S$ of elements, each of with an associated value (key), and supports the following operations:\n\n* $insert(S, k)$: insert an element $k$ into the set $S$\n* $ex... | [{"type": "stdin_stdout", "input": "insert 8\ninsert -1\nextract\ninsert 12\nextract\ninsert 11\nextract\nextract\nend", "output": "8\n12\n11\n-1\n"}, {"type": "stdin_stdout", "input": "insert 9\ninsert -1\nextract\ninsert 12\nextract\ninsert 11\nextract\nextract\nend", "output": "9\n12\n11\n-1\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nQueue is a container of elements that are inserted and deleted according to FIFO (First In First Out).\n\nFor $n$ queues $Q_i$ ($i = 0, 1, ..., n-1$), perform a sequence of the following operations.\n\n* enqueue($t$, $x$)... | [{"type": "stdin_stdout", "input": "3 24\n0 2 1\n0 0 2\n0 0 5\n0 2 6\n0 0 4\n2 0\n1 2\n2 0\n1 0", "output": "1\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n"}, {"type": "stdin_stdout", "input": "3 24\n0 2 1\n0 0 2\n0 0 5\n0 2 9\n0 0 4\n2 0\n1 0\n2 0\n1 0", "output": "5\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n rectangles in a row. You can either turn each rectangle by 90 degrees or leave it as it is. If you turn a rectangle, its width will be height, and its height will be width. Notice that you can turn any number ... | [{"type": "stdin_stdout", "input": "10\n706794178 103578427\n431808055 641644550\n715688799 406274173\n767234853 345348548\n241724251 408945969\n808703176 213953908\n185314264 16672343\n1017427585 152702033\n105991807 76314740\n61409204 244301685\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "10\n706794178 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAll bus tickets in Berland have their numbers. A number consists of n digits (n is even). Only k decimal digits d_1, d_2, ..., d_k can be used to form ticket numbers. If 0 is among these digits, then numbers may have lead... | [{"type": "stdin_stdout", "input": "200000 10\n3 6 0 5 7 4 2 1 8 9\n", "output": "712861856\n"}, {"type": "stdin_stdout", "input": "199998 10\n3 4 9 2 5 0 6 1 7 8\n", "output": "251145888\n"}, {"type": "stdin_stdout", "input": "199998 10\n3 7 9 5 2 6 1 8 0 4\n", "output": "251145888\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp wants to cook a soup. To do it, he needs to buy exactly n liters of water.\n\nThere are only two types of water bottles in the nearby shop β 1-liter bottles and 2-liter bottles. There are infinitely many bottles ... | [{"type": "stdin_stdout", "input": "4\n10 1 3\n7 5 2\n1 1000 1\n1000000000000 42 88\n", "output": "10\n11\n1000\n42000000000000\n"}, {"type": "stdin_stdout", "input": "4\n10 1 3\n7 3 2\n1 1000 1\n1000000000000 42 88\n", "output": "10\n9\n1000\n42000000000000\n"}, {"type": "stdin_stdout", "input": "4\n10 1 3\n7 5 2\n1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers. You can perform the following operations arbitrary number of times (possibly, zero):\n\n 1. Choose a pair of indices (i, j) such that |i-j|=1 (indices i and j are adjace... | [{"type": "stdin_stdout", "input": "69\n1 1 1 1 0 0 1 0 0 1 1 1 2 1 0 1 0 2 1 1 1 0 0 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 0 2 1 1 1 0 1 1 2 1 2 1 1 1 0 2 1 0 0 1 1 1 1 0 1 1 1 0 1 1 2\n", "output": "24\n1 5 4\n1 6 5\n1 8 7\n1 9 8\n2 13 12\n1 15 14\n1 17 16\n2 18 17\n1 22 21\n1 23 22\n2 25 24\n2 37 36\n1 39 38\n2 40 39\n1 44 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call (yet again) a string good if its length is even, and every character in odd position of this string is different from the next character (the first character is different from the second, the third is different... | [{"type": "stdin_stdout", "input": "100\nababbaaabaaabaabbabbaaabbabaaabbbabbbbbbbbababbbbbabbaaaabbbabbaababaabaababbbabababbbababbbbaabbbba\n", "output": "34\nababbaabababbabaabbabaabbababababaabbabaabababababbabababababaabba\n"}, {"type": "stdin_stdout", "input": "100\nabbbbaabbbbababbbabababbbabaabaababaabbabbbaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Cybermen solved that first test much quicker than the Daleks. Luckily for us, the Daleks were angry (shocking!) and they destroyed some of the Cybermen.\n\nAfter the fighting stopped, Heidi gave them another task to w... | [{"type": "stdin_stdout", "input": "5 0\n2 1\n-2 -1\n-1 1\n-2 -2\n2 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 1\n1 1\n-1 -1\n-1 1\n-2 -2\n2 0\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5 1\n2 1\n-1 -1\n-1 1\n-2 -2\n2 0\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5 1\n2 1\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string t and n strings s_1, s_2, ..., s_n. All strings consist of lowercase Latin letters.\n\nLet f(t, s) be the number of occurences of string s in string t. For example, f('aaabacaa', 'aa') = 3, and f('a... | [{"type": "stdin_stdout", "input": "abacabadabacaba\n22\na\nb\nc\nd\naba\naca\nabacabadabacaba\naa\ndab\nac\nca\nba\nab\nad\nda\nabacaba\nabacaba\nabacabad\nabacabad\ndabacaba\ndabacaba\nabacabadabacabaa\n", "output": "108\n"}, {"type": "stdin_stdout", "input": "abacabadabacaba\n22\na\nb\nc\nd\naba\nacb\nabacabadabacab... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence a_1, a_2, ..., a_n consisting of n integers.\n\nYou may perform the following operation on this sequence: choose any element and either increase or decrease it by one.\n\nCalculate the minimum pos... | [{"type": "stdin_stdout", "input": "100 1186\n619 240 80 547 446 128 43 285 725 220 56 690 770 431 777 5 41 549 405 203 2 477 919 481 453 787 680 326 318 241 942 497 504 324 598 925 346 628 851 38 355 493 748 685 901 63 698 676 154 162 313 964 455 617 381 41 479 746 83 253 164 907 950 918 264 307 980 743 257 322 845 41... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n segments on a Ox axis [l_1, r_1], [l_2, r_2], ..., [l_n, r_n]. Segment [l, r] covers all points from l to r inclusive, so all x such that l β€ x β€ r.\n\nSegments can be placed arbitrarily β be inside each other... | [{"type": "stdin_stdout", "input": "4\n2\n-1000000000 1000000000\n-1000000000 1000000000\n2\n-1000000000 -1\n0 1000000000\n2\n-1000000000 -1\n1 1000000000\n2\n-1000000000 1\n-1 1000000000\n", "output": "1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "4\n2\n-1000000000 1000000000\n-1000000000 1000000000\n2\n-10000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS: \n\nYou are given two integers d, m, find the number of arrays a, satisfying the following constraints:\n\n * Th... | [{"type": "stdin_stdout", "input": "10\n1 1000000000\n2 999999999\n3 39238314\n2 14233839\n3 1308869\n6 99995\n13 14099\n8 474\n9 146\n10 2\n", "output": "1\n3\n5\n3\n5\n23\n209\n59\n89\n1\n"}, {"type": "stdin_stdout", "input": "10\n1 1000000000\n2 999999999\n3 99999998\n4 9999997\n5 999996\n6 99995\n7 9994\n12 993\n15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSlime has a sequence of positive integers a_1, a_2, β¦, a_n.\n\nIn one operation Orac can choose an arbitrary subsegment [l β¦ r] of this sequence and replace all values a_l, a_{l + 1}, β¦, a_r to the value of median of \\\\... | [{"type": "stdin_stdout", "input": "5\n5 3\n1 5 2 6 1\n1 6\n6\n3 2\n1 2 3\n4 3\n3 1 2 3\n10 3\n1 2 3 4 5 6 7 8 9 10\n", "output": "no\nyes\nyes\nno\nyes\n"}, {"type": "stdin_stdout", "input": "5\n5 3\n1 5 2 6 1\n1 6\n6\n3 2\n1 2 3\n4 3\n3 1 2 3\n10 3\n1 2 3 4 8 6 7 8 9 10\n", "output": "no\nyes\nyes\nno\nyes\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLee is used to finish his stories in a stylish way, this time he barely failed it, but Ice Bear came and helped him. Lee is so grateful for it, so he decided to show Ice Bear his new game called \"Critic\"...\n\nThe game ... | [{"type": "stdin_stdout", "input": "6\n216986951114298167 235031205335543871\n148302405431848579 455670351549314242\n506251128322958430 575521452907339082\n1 648430128412383765\n189336074809158272 1455231353527037415\n256976506735255726 632385375031134277\n", "output": "1 1\n"}, {"type": "stdin_stdout", "input": "6\n21... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a simple and connected undirected graph consisting of n nodes and m edges.\n\nConsider any way to pair some subset of these n nodes such that no node is present in more than one pair. \n\nThis pairing is valid if... | [{"type": "stdin_stdout", "input": "4\n6 5\n1 4\n2 5\n3 6\n1 5\n3 5\n6 5\n1 4\n2 5\n3 6\n1 5\n3 5\n12 14\n1 2\n2 3\n3 4\n4 1\n1 5\n1 12\n2 6\n2 7\n3 8\n3 9\n4 10\n4 11\n2 4\n1 3\n12 14\n1 2\n2 3\n3 4\n4 1\n1 5\n1 12\n2 6\n2 7\n3 8\n6 9\n4 10\n4 11\n2 4\n1 3\n", "output": "PATH\n4\n6 3 5 1 \nPATH\n4\n6 3 5 1 \nPAIRING\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a building consisting of 10~000 apartments numbered from 1 to 10~000, inclusive.\n\nCall an apartment boring, if its number consists of the same digit. Examples of boring apartments are 11, 2, 777, 9999 and so on... | [{"type": "stdin_stdout", "input": "36\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n9999\n", "output": "90\n90\n90\n90\n90\n90\n90\n90\n90\n90\n90\n90\n90... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe great hero guards the country where Homer lives. The hero has attack power A and initial health value B. There are n monsters in front of the hero. The i-th monster has attack power a_i and initial health value b_i. \... | [{"type": "stdin_stdout", "input": "10\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1 1000000000 1\n1\n1000000000\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Dormi received a histogram with n bars of height a_1, a_2, β¦, a_n for Christmas. However, the more he played with his new histogram, the more he realized its imperfections, so today he wanted to modify it to his li... | [{"type": "stdin_stdout", "input": "2\n4\n0 16 14 1\n6\n2 1 14 4 0 0\n", "output": "30\n19\n"}, {"type": "stdin_stdout", "input": "2\n4\n0 16 17 1\n6\n2 1 14 4 0 0\n", "output": "33\n19\n"}, {"type": "stdin_stdout", "input": "2\n4\n13 8 15 13\n6\n2 1 7 8 1 0\n", "output": "33\n16\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudents of group 199 have written their lectures dismally. Now an exam on Mathematical Analysis is approaching and something has to be done asap (that is, quickly). Let's number the students of the group from 1 to n. Eac... | [{"type": "stdin_stdout", "input": "10\n9 10 6 8 5 3 1 7 4 2\n7 6 2 9 5 10 8 4 1 3\n", "output": "8 3 10 1 5 2 4 9 7 6 "}, {"type": "stdin_stdout", "input": "10\n2 9 1 7 6 8 5 4 10 3\n6 8 5 1 9 10 2 3 4 7\n", "output": "5 6 7 3 2 9 1 10 8 4 "}, {"type": "stdin_stdout", "input": "10\n5 9 7 1 4 10 3 6 2 8\n8 3 9 10 6 5 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves to play with color cards.\n\nHe has n cards, each has exactly two colors (the color of the front side and the color of the back side). Initially, all the cards lay on the table with the front sid... | [{"type": "stdin_stdout", "input": "100\n1 2\n2 1\n2 1\n1 2\n1 1\n1 2\n2 1\n1 1\n2 2\n2 1\n2 1\n1 1\n1 1\n2 1\n2 1\n2 1\n2 1\n2 1\n1 1\n2 1\n1 1\n1 1\n2 2\n1 2\n1 2\n1 2\n2 2\n1 2\n1 2\n2 1\n1 2\n2 1\n1 2\n2 2\n1 1\n2 1\n1 2\n2 1\n2 1\n1 2\n2 1\n2 1\n1 2\n2 1\n1 1\n1 2\n1 1\n1 1\n2 2\n2 2\n2 1\n2 1\n1 2\n2 2\n1 1\n2 1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes permutations a lot. Recently his mom has presented him permutation q1, q2, ..., qn of length n.\n\nA permutation a of length n is a sequence of integers a1, a2, ..., an (1 β€ ai β€ n), all integers there ... | [{"type": "stdin_stdout", "input": "55 28\n35 33 46 8 11 13 14 26 42 38 1 7 34 5 2 21 17 45 54 43 4 18 27 50 25 10 29 48 6 16 22 28 55 53 49 41 39 23 40 47 51 37 36 19 9 32 52 12 24 3 20 15 30 44 31\n5 52 24 16 7 27 48 21 18 8 14 28 29 12 47 53 17 31 54 41 30 55 10 35 25 4 38 46 23 34 33 3 15 6 11 20 9 26 42 37 43 45 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a square matrix n Γ n, consisting of non-negative integer numbers. You should find such a way on it that \n\n * starts in the upper left cell of the matrix; \n * each following cell is to the right or down from... | [{"type": "stdin_stdout", "input": "10\n10 8 6 5 9 8 2 5 3 2\n3 1 8 10 8 10 5 10 7 8\n5 9 7 7 4 9 7 2 5 2\n5 9 9 5 4 2 6 6 8 1\n10 6 9 9 10 5 6 3 5 9\n6 7 10 3 1 4 3 6 7 6\n10 10 4 7 4 4 8 2 7 4\n10 5 8 2 2 7 4 4 1 4\n8 4 6 10 10 6 1 3 3 1\n9 9 7 2 11 5 1 8 6 3\n", "output": "1\nDRDDDRRDDDRRDRDRRR\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDaniel is organizing a football tournament. He has come up with the following tournament format: \n\n 1. In the first several (possibly zero) stages, while the number of teams is even, they split in pairs and play one ga... | [{"type": "stdin_stdout", "input": "288230376151711743\n", "output": "144115188344291328\n288230376151711744\n"}, {"type": "stdin_stdout", "input": "72057594037927935\n", "output": "36028797153181696\n72057594037927936\n"}, {"type": "stdin_stdout", "input": "1125899906842623\n", "output": "562949970198528\n112589990684... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai ... | [{"type": "stdin_stdout", "input": "50\n57 122 98 44 22 63 5 65 36 69 49 54 61 15 58 79 50 30 43 155 18 105 46 92 72 67 67 51 34 40 50 77 91 53 79 72 72 34 91 75 83 67 71 93 11 51 85 20 6 2\n20\n2 40\n1 14 102\n2 4\n2 15\n2 43\n1 29 532\n2 27\n2 47\n1 24 107\n1 20 720\n1 21 315\n2 20\n1 2 787\n1 27 909\n2 38\n1 32 445\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice likes word \"nineteen\" very much. She has a string s and wants the string to contain as many such words as possible. For that reason she can rearrange the letters of the string.\n\nFor example, if she has string \"... | [{"type": "stdin_stdout", "input": "nnnnnnnnnneeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeiiiiiiiiiiiiiiiiiiiitttttttttttttttttttt\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "nnnnnnnnnneeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeedeeeeeeeeeeeeeeeeiiiiiiiiiiiiiiiiiiiitttttttttttttttttttt\n", "output": "4\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSergey is testing a next-generation processor. Instead of bytes the processor works with memory cells consisting of n bits. These bits are numbered from 1 to n. An integer is stored in the cell in the following way: the l... | [{"type": "stdin_stdout", "input": "100\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "100\n1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNura wants to buy k gadgets. She has only s burles for that. She can buy each gadget for dollars or for pounds. So each gadget is selling only for some type of currency. The type of currency and the cost in that currency ... | [{"type": "stdin_stdout", "input": "1 93 46 46\n1\n1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2 1\n1 2\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe numbers of all offices in the new building of the Tax Office of IT City will have lucky numbers.\n\nLucky number is a number that consists of digits 7 and 8 only. Find the maximum number of offices in the new building... | [{"type": "stdin_stdout", "input": "55\n", "output": "72057594037927934\n"}, {"type": "stdin_stdout", "input": "54\n", "output": "36028797018963966\n"}, {"type": "stdin_stdout", "input": "49\n", "output": "1125899906842622\n"}, {"type": "stdin_stdout", "input": "43\n", "output": "17592186044414\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA simple recommendation system would recommend a user things liked by a certain number of their friends. In this problem you will implement part of such a system.\n\nYou are given user's friends' opinions about a list of ... | [{"type": "stdin_stdout", "input": "10 10 10\nYYYYYYYYYY\nYYYYYYYYYY\nYYYYYYYYYY\nYYYYYYYYYY\nYYYYYYYYYY\nYYYYYYYYYY\nYYYYYYYYYY\nYYYYYYYYYY\nYYYYYYYYYY\nYYYYYYYYYY\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10 10 1\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNNNNNNNN\nNNNN... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n cities in Bearland, numbered 1 through n. Cities are arranged in one long row. The distance between cities i and j is equal to |i - j|.\n\nLimak is a police officer. He lives in a city a. His job is to catch c... | [{"type": "stdin_stdout", "input": "100 100\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\n", "output": "100"}, {"type": "stdin_stdout", "input": "100 100\n1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in a wonderful sunny morning, walking around blocks of ice, Mishka met her friend Chris, and they star... | [{"type": "stdin_stdout", "input": "100\n4 3\n3 4\n5 1\n2 5\n5 3\n1 5\n6 3\n2 4\n5 2\n2 6\n5 2\n1 5\n6 3\n1 5\n6 3\n3 4\n5 2\n1 5\n6 1\n1 5\n4 2\n3 5\n6 3\n2 6\n6 3\n1 4\n6 2\n3 4\n4 1\n3 6\n5 1\n2 4\n5 1\n3 4\n6 2\n3 5\n4 1\n2 6\n4 3\n2 6\n5 2\n3 6\n6 2\n3 5\n4 3\n1 5\n5 3\n3 6\n4 2\n3 4\n6 1\n3 4\n5 2\n2 6\n5 2\n2 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n from left to right. There are two types of bump... | [{"type": "stdin_stdout", "input": "100\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", "output": "100"}, {"type": "stdin_stdout", "input": "100\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBitwise exclusive OR (or bitwise addition modulo two) is a binary operation which is equivalent to applying logical exclusive OR to every pair of bits located on the same positions in binary notation of operands. In other... | [{"type": "stdin_stdout", "input": "9992164445234764941\n8162963574901971597\n", "output": "914600435166396672 9077564010068368269"}, {"type": "stdin_stdout", "input": "1367480970723947\n584615739735395\n", "output": "391432615494276 976048355229671"}, {"type": "stdin_stdout", "input": "339671107814\n208405902980\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA robber has attempted to rob a bank but failed to complete his task. However, he had managed to open all the safes.\n\nOleg the bank client loves money (who doesn't), and decides to take advantage of this failed robbery ... | [{"type": "stdin_stdout", "input": "8 3 13\n12\n3 3 3 12 7 6 10 1 8 8 7 12\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 3 13\n12\n3 3 3 8 7 6 10 1 8 8 7 12\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 5 13\n12\n3 3 3 8 7 6 10 1 7 8 7 11\n", "output": "8\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBeroffice text editor has a wide range of features that help working with text. One of the features is an automatic search for typos and suggestions of how to fix them.\n\nBeroffice works only with small English letters (... | [{"type": "stdin_stdout", "input": "bababcdfabbcabcdfacbbabcdfacacabcdfacbcabcdfaccbabcdfacaaabcdfabacabcdfabcbabcdfacbaabcdfabaaabcdfabbaabcdfacababcdfabbbabcdfabcaabcdfaaababcdfabccabcdfacccabcdfaacbabcdfaabaabcdfaabcabcdfaaacabcdfaccaabcdfaabbabcdfaaaaabcdfaacaabcdfaacc\n", "output": "bababc dfabb cabc dfacb babc df... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines.\n\nMultiset... | [{"type": "stdin_stdout", "input": "50\n-38 -107\n-34 -75\n-200 -143\n-222 -139\n-34 55\n-102 -79\n48 -99\n2 -237\n-118 -167\n-56 -41\n10 17\n68 -89\n-32 41\n-100 -93\n84 -1\n86 -15\n46 -145\n-101 -117\n8 31\n-36 -61\n-12 21\n-116 79\n88 -205\n70 -103\n-78 -37\n106 -5\n-96 -201\n-60 -103\n-54 45\n-138 -177\n-178 -47\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. Master Heidi needs to select the Jedi Knights who will go on peacekeeping missions throughout th... | [{"type": "stdin_stdout", "input": "100 100\n52 93 36 69 49 37 48 42 63 27 16 60 16 63 80 37 69 24 86 38 73 15 43 65 49 35 39 98 91 24 20 35 12 40 75 32 54 4 76 22 23 7 50 86 41 9 9 91 23 18 41 61 47 66 1 79 49 21 99 29 87 94 42 55 87 21 60 67 36 89 40 71 6 63 65 88 17 12 89 32 79 99 34 30 63 33 53 56 10 11 66 80 73 50... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have m = nΒ·k wooden staves. The i-th stave has length ai. You have to assemble n barrels consisting of k staves each, you can use any k staves to construct a barrel. Each stave must belong to exactly one barrel.\n\nLe... | [{"type": "stdin_stdout", "input": "10 3 726\n277 706 1241 812 692 1291 196 507 911 111 498 704 573 381 463 1095 704 36 443 640 326 405 47 834 962 521 1296 740 520 622\n", "output": "5072\n"}, {"type": "stdin_stdout", "input": "10 3 726\n277 706 1241 812 692 1291 196 507 911 111 498 704 573 381 463 1095 704 36 693 640 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThose of you who are familiar with the TV Show Community and it's 'lovable' character, Abed, who likes to travel around dimensions, parallel universes, and various other parallel time lines, would know that Abed needs you... | [{"type": "stdin_stdout", "input": "10\n227 147\n36 22\n110 62\n9\n143 19\n34 4\n84 13\n9\n556 63\n21 57\n94 25\n4\n398 205\n172 177\n127 195\n4\n240 153\n111 114\n207 85\n7\n203 42\n89 3\n107 32\n4\n132 167\n103 22\n102 140\n5\n115 7\n111 5\n56 1\n7\n116 108\n41 37\n40 30\n1\n136 81\n112 37\n49 23\n2", "output": "1026... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExams are over !! Everyone is now in the mood to play the multiplayer game Counter-Strike 1.6. 12 players decide to play Counter-Strike 1.6, each one playing from his own room via LAN on his own laptop. The 12 \nplayers (... | [{"type": "stdin_stdout", "input": "998\n2 -7299 -1104 5841 7780\n8 4665 -7637 8967 -4124\n2 9223 789 -7690 4412\n4 116 -9319 -6946 -5438\n4 4417 3824 -2120 -90\n2 -9912 1820 -9527 6254\n6 1466 1097 1912 -2611\n4 -9462 7771 1177 6218\n8 8290 9152 -1317 -2873\n3 -5267 -1353 3365 -2413\n5 9661 -2020 -4846 -456\n7 -5160 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHansa did not have enough money to pay the bill of the party. Now she loves cupcakes (and can also eat any amount of it apparently), so she came up with a cupcake challenge. She challenges t people individually every time... | [{"type": "stdin_stdout", "input": "2\n-1 -2 -1\n-2 2 12\n\nLBMMES", "output": "NO BILL\nNO BILL\n"}, {"type": "stdin_stdout", "input": "2\n-1 -2 -1\n-2 0 12\n\nLBMMES", "output": "NO BILL\nNO BILL\n"}, {"type": "stdin_stdout", "input": "2\n-1 -2 -1\n-2 0 12\n\nLBMNES", "output": "NO BILL\nNO BILL\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make... | [{"type": "stdin_stdout", "input": "1000 1 1100", "output": "1100000\n"}, {"type": "stdin_stdout", "input": "1010 1 1100", "output": "1111000\n"}, {"type": "stdin_stdout", "input": "1011 1 1100", "output": "1112100\n"}, {"type": "stdin_stdout", "input": "1001 1 1000", "output": "1001000\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person ... | [{"type": "stdin_stdout", "input": "10\n1 1 1 1 1 2 1 1 1", "output": "8\n1\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 2 1 2 1 1 1", "output": "7\n2\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1 2 1 2 1 1 2", "output": "6\n3\n0\n0\n0\n0\n0\n0\n0\n0\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.\n\nGiven is a string S. Find the minimum number... | [{"type": "stdin_stdout", "input": "redocder", "output": "1\n"}, {"type": "stdin_stdout", "input": "rdebrdeo", "output": "4\n"}, {"type": "stdin_stdout", "input": "reeocddr", "output": "3\n"}, {"type": "stdin_stdout", "input": "rddcoeer", "output": "3\n"}, {"type": "stdin_stdout", "input": "rddboeer", "output": "3\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented as `2019/04/30`.)\n\nWrite a program that prints `Heisei` if the dat... | [{"type": "stdin_stdout", "input": "2019/03/30", "output": "Heisei\n"}, {"type": "stdin_stdout", "input": "2019/04/20", "output": "Heisei\n"}, {"type": "stdin_stdout", "input": "1019/04/30", "output": "Heisei\n"}, {"type": "stdin_stdout", "input": "2019/01/00", "output": "Heisei\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph consisting of N vertices and M edges. The vertices are numbered 1 to N, and the edges are numbered 1 to M. In addition, each vertex has a label, `A` or `B`. The label of Vertex i is s_i. ... | [{"type": "stdin_stdout", "input": "13 23\nABAAAABBBBAAB\n7 1\n10 6\n1 11\n2 10\n2 8\n2 11\n11 12\n8 3\n7 11\n11 2\n13 13\n11 9\n4 1\n9 7\n9 6\n8 13\n8 6\n4 10\n8 7\n4 3\n2 1\n8 12\n6 9", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "13 23\nABAAAABBBBAAB\n7 1\n10 6\n1 11\n2 10\n2 8\n2 11\n11 12\n8 3\n7 12\n11 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a two-dimensional plane, there are N red points and N blue points. The coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i).\n\nA red point and a blue point can fo... | [{"type": "stdin_stdout", "input": "5\n0 0\n4 1\n5 5\n6 6\n13 11\n2 2\n6 3\n-1 4\n8 4\n14 17", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n0 0\n4 1\n5 5\n6 6\n13 11\n2 2\n6 3\n-1 4\n8 4\n9 17", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n0 0\n4 1\n5 5\n6 6\n13 11\n2 2\n8 3\n-1 4\n14 4\n9 4", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a tree with N vertices numbered 1 through N. The i-th of the N-1 edges connects vertices a_i and b_i.\n\nInitially, each edge is painted blue. Takahashi will convert this blue tree into a red tree, by performing ... | [{"type": "stdin_stdout", "input": "6\n1 2\n3 5\n4 6\n1 6\n0 2\n5 3\n1 4\n2 6\n12 3\n5 6", "output": "NO\n"}, {"type": "stdin_stdout", "input": "6\n1 2\n3 5\n4 6\n1 6\n5 2\n5 3\n1 4\n2 6\n4 3\n5 6", "output": "NO\n"}, {"type": "stdin_stdout", "input": "6\n1 2\n3 1\n4 6\n1 6\n5 1\n5 3\n1 4\n2 6\n4 3\n5 6", "output": "NO... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke got a present from his mother on his birthday. The present was a pair of two sequences a and b, consisting of positive integers. They satisfied all of the following properties:\n\n* The sum of all elements of a is N... | [{"type": "stdin_stdout", "input": "107 11\n0 1 3 3 5 10 13 1 7 17", "output": "Impossible\n"}, {"type": "stdin_stdout", "input": "107 11\n0 1 3 3 5 12 13 1 7 17", "output": "Impossible\n"}, {"type": "stdin_stdout", "input": "107 10\n0 2 3 5 5 6 7 12 9 10", "output": "Impossible\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro is not good at hide-and-seek. As soon as you hide, you will find it, and it will be difficult to find the hidden child. My father, who couldn't see it, made an ultra-high performance location search system. You can u... | [{"type": "stdin_stdout", "input": "3\n6 6 3\n19 19 6\n42 10 1\n6\n5 2 2 11\n12 7 2 11\n11 9 1 11\n14 2 22 5\n17 9 20 5\n20 10 20 5\n0", "output": "Safe\nDanger\nDanger\nDanger\nDanger\nDanger\n"}, {"type": "stdin_stdout", "input": "3\n6 2 16\n40 7 8\n42 8 1\n6\n5 3 4 11\n12 4 2 15\n16 2 0 11\n28 2 31 5\n17 9 41 5\n24 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe following sorting operation is repeated for the stacked blocks as shown in Fig. A.\n\n1. Stack all the bottom blocks (white blocks in Figure a) on the right edge (the remaining blocks will automatically drop one step ... | [{"type": "stdin_stdout", "input": "6\n1 4 1 3 2 4\n5\n1 2 5 4 5\n10\n1 1 1 1 1 1 1 1 1 1\n9\n1 1 1 1 1 1 1 1 1\n12\n1 4 1 3 2 4 3 3 2 1 2 2\n1\n5050\n3\n10000 10000 100\n0", "output": "24\n-1\n10\n-1\n48\n5049\n-1\n"}, {"type": "stdin_stdout", "input": "6\n1 4 1 3 2 4\n5\n1 2 5 4 5\n10\n1 1 1 1 1 1 1 1 1 1\n9\n1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nThere are n islands in JOI, and each island is numbered from 1 to n. Currently, the JOI country is developing a route network connecting each island.\n\nYou work at a ticket center that handles ship tickets. Th... | [{"type": "stdin_stdout", "input": "3 8\n1 3 1 10\n0 2 3\n1 2 3 20\n1 1 2 5\n0 3 2\n1 1 3 7\n1 2 1 9\n0 2 3\n5 16\n1 1 3 343750\n1 1 3 3343\n1 1 4 347392\n1 2 5 5497\n1 2 3 123394\n1 2 4 545492\n1 2 5 458\n1 3 4 343983\n1 3 5 843468\n1 4 5 2780\n0 2 1\n0 4 1\n0 3 2\n0 4 2\n0 4 3\n0 5 3\n0 0", "output": "-1\n15\n12\n126... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSaying that it is not surprising that people want to know about their love, she has checked up his address, name, age, phone number, hometown, medical history, political party and even his sleeping position, every piece o... | [{"type": "stdin_stdout", "input": "3\n800 600\nindxe 1\n443 100 700 200 profile\nprofile 2\n100 100 400 200 index\n000 742 400 500 link\nlink 1\n100 100 300 200 index\n9\nclick 600 150\nshow\nclick 200 450\nshow\nback\nback\nshow\nforward\nshow\n0", "output": "profile\nprofile\nindxe\nprofile\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are a number of rectangles on the x-y plane. The four sides of the rectangles are parallel to either the x-axis or the y-axis, and all of the rectangles reside within a range specified later. There are no other cons... | [{"type": "stdin_stdout", "input": "3\n4 28 27 17\n15 20 42 5\n19 24 33 14\n5\n4 44 27 11\n12 11 34 2\n7 26 14 16\n14 16 19 12\n17 28 50 21\n2\n322297 1000000 828907 0\n-1 1164792 1000000 300000\n0", "output": "8\n7\n4\n"}, {"type": "stdin_stdout", "input": "3\n4 28 27 17\n15 20 21 5\n19 42 33 14\n5\n4 28 27 11\n12 11 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere is an arithmetic progression A with the number of terms N, the first term a, and the tolerance d. Since M statements that update the sequence are given in the following format, find the value of the K ite... | [{"type": "stdin_stdout", "input": "6\n10 -1\n0\n24 -1 1\n0 4 1\n-2 -2 0\n1 1 1\n1", "output": "-13\n"}, {"type": "stdin_stdout", "input": "6\n19 -1\n0\n24 -1 1\n0 4 1\n-2 -1 0\n0 1 1\n1", "output": "-4\n"}, {"type": "stdin_stdout", "input": "6\n3 -1\n0\n30 -2 1\n0 2 1\n-1 1 1\n-2 2 0\n2", "output": "-26\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEnglish text is not available in this practice contest.\n\nAt one point, a nobleman fell in love with a brave princess in a poor country and applied for marriage. The princess has given certain conditions to the aristocra... | [{"type": "stdin_stdout", "input": "6\n-2 -1 1 1\n2 2 4 1\n5 7 1 1\n8 0 3 1\n13 4 1 1\n16 1 0 2\n3\n-1 0 2 1\n10 0 2 2\n0 10 4 1\n3\n0 0 2 1\n10 0 2 1\n1 11 2 1\n3\n0 0 2 1\n10 0 2 1\n-1 4 2 1\n1\n0 0 1 1\n0", "output": "5\n2\n2\n3\n1\n"}, {"type": "stdin_stdout", "input": "6\n-2 -1 1 1\n2 2 4 1\n5 7 1 0\n8 0 3 1\n16 4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\nmmemewwemeww\n\n\nOutput\n\nCat\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 sol... | [{"type": "stdin_stdout", "input": "mmemwweemeww", "output": "Rabbit\n"}, {"type": "stdin_stdout", "input": "wwemeewwmemm", "output": "Rabbit\n"}, {"type": "stdin_stdout", "input": "mmemwweeneww", "output": "Rabbit\n"}, {"type": "stdin_stdout", "input": "mnemwweeneww", "output": "Rabbit\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nIn Ikatta, the SNS used by AOR Ika-chan, posts are called tweets.\n\nAnd in squid, there is a concern that visibility will deteriorate if there are many replies to tweets, so when a tweet meets any of the follo... | [{"type": "stdin_stdout", "input": "0 13\n-1\n3\n3\n-1\n1\n14", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 13\n-1\n-1\n0\n3\n7\n0", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 13\n-1\n-1\n0\n3\n7\n1", "output": "0\n"}, {"type": "stdin_stdout", "input": "0 13\n-1\n-2\n0\n3\n7\n1", "output": "0\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nI have a grid of $ H $ rows and $ W $ columns. Hereafter, the cells in the $ i $ row and $ j $ column on the grid are written as $ (i, j) $ cells.\n\nEach cell in the grid has a number between $ 1 $ a... | [{"type": "stdin_stdout", "input": "3 3\n1820\n4#2\n1007", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1 13\n1558\n2$4\n246", "output": "NO\n"}, {"type": "stdin_stdout", "input": "3 3\n631\n4#2\n486", "output": "YES\n"}, {"type": "stdin_stdout", "input": "3 3\n631\n4#2\n246", "output": "YES\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind bridges of an undirected graph G(V, E).\n\nA bridge (also known as a cut-edge) is an edge whose deletion increase the number of connected components.\n\nConstraints\n\n* 1 β€ |V| β€ 100,000\n* 0 β€ |E| β€ 100,000\n* The ... | [{"type": "stdin_stdout", "input": "5 4\n0 1\n1 2\n1 3\n3 4", "output": "0 1\n1 2\n1 3\n3 4\n"}, {"type": "stdin_stdout", "input": "5 4\n0 1\n1 3\n2 3\n3 4", "output": "0 1\n1 3\n2 3\n3 4\n"}, {"type": "stdin_stdout", "input": "5 4\n0 1\n0 2\n2 3\n3 4", "output": "0 1\n0 2\n2 3\n3 4\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n integers a_1, a_2, β¦, a_n. Each of a_i has between 3 and 5 divisors. Consider a = β a_i β the product of all input integers. Find the number of divisors of a. As this number may be very large, print it mod... | [{"type": "stdin_stdout", "input": "10\n2 1000013759 1000012847\n2 1000010197 1000008649\n2 1000014583 1000000933\n2 1000001021 1000010233\n2 1000005763 1000012927\n2 1000013759 1000003471\n2 1000008829 1000012219\n2 1000012847 1000008397\n2 1000011011 1736428976\n2 1000007909 1000010549\n", "output": "102400\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArkady and his friends love playing checkers on an n Γ n field. The rows and the columns of the field are enumerated from 1 to n.\n\nThe friends have recently won a championship, so Arkady wants to please them with some c... | [{"type": "stdin_stdout", "input": "1100000000 1000\n", "output": "4114000000000000\n"}, {"type": "stdin_stdout", "input": "1000010000 1\n", "output": "1000020000100000000\n"}, {"type": "stdin_stdout", "input": "1100010000 1000\n", "output": "4114074800340000\n"}, {"type": "stdin_stdout", "input": "1010010000 1\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey received a postcard from Irina. It contained only the words \"Hello, Andrey!\", and a strange string consisting of lowercase Latin letters, snowflakes and candy canes. Andrey thought that this string is an encrypte... | [{"type": "stdin_stdout", "input": "uduzhzchjkaddukfwqngffblohjmqbgyfrzomuznircygatbxoyfxflurhoewioptyqlpoozlksyxrntwsqozghcamszlgeawisninpntpwpuemybjwmhwmpqkurkrnjzfoppmoopwrmpylvhtntghxkavveeyfmdqsvuqiflyemklnshfrtskmyhkbzhwmlaqcasjbw\n200\n", "output": "uduzhzchjkaddukfwqngffblohjmqbgyfrzomuznircygatbxoyfxflurhoewio... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVus the Cossack has two binary strings, that is, strings that consist only of \"0\" and \"1\". We call these strings a and b. It is known that |b| β€ |a|, that is, the length of b is at most the length of a.\n\nThe Cossack... | [{"type": "stdin_stdout", "input": "10010110100000101100\n11001\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10010110100000101100\n10011\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10010110100000101100\n00010\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10010110100000101100\n0101... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he understands the subject fairly well, and so he began to behave like he already got PhD in that area.\n\nTo prove his ski... | [{"type": "stdin_stdout", "input": "100000 100000\n", "output": "870472905"}, {"type": "stdin_stdout", "input": "28151 100000\n", "output": "422317846\n"}, {"type": "stdin_stdout", "input": "100000 99999\n", "output": "758107445"}, {"type": "stdin_stdout", "input": "24538 86821\n", "output": "1000000005"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTry guessing the statement from this picture <http://tiny.cc/ogyoiz>.\n\nYou are given two integers A and B, calculate the number of pairs (a, b) such that 1 β€ a β€ A, 1 β€ b β€ B, and the equation a β
b + a + b = conc(a, b)... | [{"type": "stdin_stdout", "input": "3\n1 14\n4 2\n191 102469002\n", "output": "1\n0\n1528\n"}, {"type": "stdin_stdout", "input": "3\n1 14\n4 2\n131 176163142\n", "output": "1\n0\n1048\n"}, {"type": "stdin_stdout", "input": "3\n1 14\n4 2\n142 128000654\n", "output": "1\n0\n1136\n"}, {"type": "stdin_stdout", "input": "3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nInput\n\nThe input contains two integers row, col (0 β€ row, col β€ 63), separated by a single space.\n\nOutput\n\nOutput \"IN\" or \"OUT\".\n\nExamples\n\nInput\n\n\n0 0\n\n\nOutput\n\n\nOUT\n\n\nInput\n\n\n27 0... | [{"type": "stdin_stdout", "input": "27 36\n", "output": "OUT\n"}, {"type": "stdin_stdout", "input": "0 45\n", "output": "OUT\n"}, {"type": "stdin_stdout", "input": "53 27\n", "output": "IN\n"}, {"type": "stdin_stdout", "input": "0 18\n", "output": "OUT\n"}, {"type": "stdin_stdout", "input": "51 1\n", "output": "OUT\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSkier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respectively).\n\nIt is known tha... | [{"type": "stdin_stdout", "input": "1\nENNNNNNNNNNNSSSSSSSSSSSEEEEEEEEEEN\n", "output": "126\n"}, {"type": "stdin_stdout", "input": "1\nNEEEEEEEEEEEWWWWWWWWWWWNNNNNNNNNNE\n", "output": "126\n"}, {"type": "stdin_stdout", "input": "1\nENNNNNNNNNNNSSSSSSSNSSSEEEEEEEEEES\n", "output": "126\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the easy version of the problem. The difference between versions is the constraints on n and a_i. You can make hacks only if all versions of the problem are solved.\n\nFirst, Aoi came up with the following idea fo... | [{"type": "stdin_stdout", "input": "123 79\n49 100 128 149 148 22 89 81 46 142 119 70 22 134 134 80 69 145 144 33 28 127 70 27 91 94 98 29 153 53 102 138 113 123 135 143 87 77 84 27 106 8 156 27 97 150 53 31 126 135 40 79 150 79 69 7 3 49 84 14 24 39 13 103 54 98 122 95 71 157 79 114 136 101 38 25 150 103 150 158 109 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers. We denote the subarray a[l..r] as the array [a_l, a_{l + 1}, ..., a_r] (1 β€ l β€ r β€ n).\n\nA subarray is considered good if every integer that occurs in this subarray occ... | [{"type": "stdin_stdout", "input": "100\n79 79 79 97 97 97 64 64 64 2 2 2 38 38 38 65 65 65 10 10 10 25 24 25 53 53 53 73 73 73 11 11 11 29 29 29 93 93 93 73 73 73 89 89 89 72 72 72 49 49 49 78 78 78 92 92 92 90 90 90 95 95 95 92 92 92 12 12 12 65 65 65 81 81 81 5 5 5 21 21 21 94 94 94 51 51 51 44 44 44 55 55 55 47 47 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMike received an array a of length n as a birthday present and decided to test how pretty it is.\n\nAn array would pass the i-th prettiness test if there is a way to get an array with a sum of elements totaling s_i, using... | [{"type": "stdin_stdout", "input": "2\n5 5\n1 2 3 4 5\n1\n5\n9\n12\n6\n5 5\n6 1 3 2 3\n1\n2\n3\n15\n11\n", "output": "Yes\nYes\nYes\nNo\nYes\nYes\nYes\nYes\nYes\nNo\n"}, {"type": "stdin_stdout", "input": "2\n5 5\n1 2 3 4 5\n1\n5\n3\n12\n6\n5 5\n6 1 3 2 3\n1\n2\n3\n15\n11\n", "output": "Yes\nYes\nYes\nNo\nYes\nYes\nYes\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is playing a new computer game. This game has n stones in a row. The stone on the position i has integer power a_i. The powers of all stones are distinct.\n\nEach turn Polycarp can destroy either stone on the fir... | [{"type": "stdin_stdout", "input": "1\n52\n1 3 3 4 5 10 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 48 29 30 31 32 49 34 35 36 37 38 39 40 41 42 43 21 45 46 47 48 49 50 51 52\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n52\n1 3 3 4 5 10 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the dis... | [{"type": "stdin_stdout", "input": "1000\n1000 1000 1000\n", "output": "333.33333443989454 333.3333334287973 333.33333213130817\n"}, {"type": "stdin_stdout", "input": "1000\n1268 998 997\n", "output": "388.59944836040455 305.85350904076006 305.54704259883545\n"}, {"type": "stdin_stdout", "input": "1\n1000 1000 1000\n",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTernary numeric notation is quite popular in Berland. To telegraph the ternary number the Borze alphabet is used. Digit 0 is transmitted as Β«.Β», 1 as Β«-.Β» and 2 as Β«--Β». You are to decode the Borze code, i.e. to find out ... | [{"type": "stdin_stdout", "input": "..---.-.--.-..-.-.---...--.-------..-.---.-...-.-----...-.-.....-..--.---.-.-.-----.-.-.-..----.-.----.-.---.--.-..-.----..---.-..--..------.-.-.---.-.-...--....-.--.--.-.-.-..-..-...--..---.-.------.\n", "output": "00211201011210020222101211001221001100001020211122111102201220121201... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera conducts experiments with algorithms that search for shortest paths. He has recently studied the Floyd's algorithm, so it's time to work with it.\n\nValera's already written the code that counts the shortest distan... | [{"type": "stdin_stdout", "input": "139 8017 8\n18 108 117 114 99 74 36 52\n", "output": "18 1\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n1 25\n1 26\n1 27\n1 28\n1 29\n1 30\n1 31\n1 32\n1 33\n1 34\n1 35\n1 36\n1 37\n1 38\n1 39\n1 40\n1 41... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have number a, whose decimal representation quite luckily contains digits 1, 6, 8, 9. Rearrange the digits in its decimal representation so that the resulting number will be divisible by 7.\n\nNumber a doesn't contain... | [{"type": "stdin_stdout", "input": "16514659663135220552358975265304642528481558184545431737172205632772580885090555390229496726074548190\n", "output": "11111112222222222222333333334444444444555555555555555555556666666677777777888888889999991869000000000"}, {"type": "stdin_stdout", "input": "982599565604028679312800604... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn some square in the lowest row of a chessboard a stands a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start i... | [{"type": "stdin_stdout", "input": "100 3 4\n644\n861\n478\n250\n560\n998\n141\n162\n386\n778\n123\n811\n602\n533\n391\n515\n898\n215\n965\n556\n446\n883\n256\n195\n573\n889\n515\n240\n179\n339\n258\n593\n930\n730\n735\n949\n522\n067\n549\n366\n452\n405\n473\n188\n488\n994\n000\n046\n930\n217\n897\n580\n509\n032\n343\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle X has met the following problem recently. \n\nLet's define f(x) as the sum of digits in decimal representation of number x (for example, f(1234) = 1 + 2 + 3 + 4). You are to calculate <image>\n\nOf course Little X ... | [{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000000 1999999999999999999"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000000 1999999999999999999"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "1000000000000000000 199... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus participates in a competition for hacking into a new secure messenger. He's almost won.\n\nHaving carefully studied the interaction protocol, Polycarpus came to the conclusion that the secret key can be obtaine... | [{"type": "stdin_stdout", "input": "284254589153928171911281811000\n1009 1000\n", "output": "YES\n2842545891539\n28171911281811000\n"}, {"type": "stdin_stdout", "input": "284254589153928171911281811000\n1009 1100\n", "output": "YES\n2842545891539\n28171911281811000\n"}, {"type": "stdin_stdout", "input": "64502253490350... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWatto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be ... | [{"type": "stdin_stdout", "input": "1 17\ncacdbcacabccba\naccbcbcabaabbcbcaa\nbabccaaacccacbb\nbbbabbabbbcaacbaaac\nabbaccacabacaaaa\nbccbccabaacaacb\nbbbabbbbabcaacbcaac\nbcacababbbdaaca\nccbbbbababbccaab\nbbcbcc`babcaacb\naacccbabbacbabacaca\nbcaacbabcccbcbb\nacbacacbcacc\ncaaabcaaabacabbabbb\nabcbabaaaba\naacccbcaab... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably), and if they belong to dif... | [{"type": "stdin_stdout", "input": "39 16 81\n", "output": "0.015517101139791982 0.9843603428087337 0.00012255605147426518\n"}, {"type": "stdin_stdout", "input": "2 100 69\n", "output": "0.7464107946114571 0.25358920538854307 -1.6653345369377348e-16\n"}, {"type": "stdin_stdout", "input": "41 100 14\n", "output": "0.417... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn Bertown's main street n trees are growing, the tree number i has the height of ai meters (1 β€ i β€ n). By the arrival of the President of Berland these trees were decided to be changed so that their heights formed a bea... | [{"type": "stdin_stdout", "input": "10\n73905 73906 73907 85732 73909 73909 73908 73907 73906 73905\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "10\n60718 99414 65042 65043 65044 38495 95782 65042 65041 65040\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "10\n60718 99414 65042 89001 65044 38495 95... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.