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\nGreg is a beginner bodybuilder. Today the gym coach gave him the training plan. All it had was n integers a1, a2, ..., an. These numbers mean that Greg needs to do exactly n exercises today. Besides, Greg should repeat th... | [{"type": "stdin_stdout", "input": "20\n25 50 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 24\n", "output": "biceps\n"}, {"type": "stdin_stdout", "input": "20\n25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 25 24\n", "output": "chest\n"}, {"type": "stdin_stdout", "input": "20\n25 50 25 25 25 25 25 25 25 25... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera the horse lives on a plane. The Cartesian coordinate system is defined on this plane. Also an infinite spiral is painted on the plane. The spiral consists of segments: [(0, 0), (1, 0)], [(1, 0), (1, 1)], [(1, 1), (... | [{"type": "stdin_stdout", "input": "100 100\n", "output": "397\n"}, {"type": "stdin_stdout", "input": "37 -100\n", "output": "400\n"}, {"type": "stdin_stdout", "input": "-96 -96\n", "output": "383\n"}, {"type": "stdin_stdout", "input": "56 -100\n", "output": "400\n"}, {"type": "stdin_stdout", "input": "94 -94\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a long plate s containing n digits. Iahub wants to delete some digits (possibly none, but he is not allowed to delete all the digits) to form his \"magic number\" on the plate, a number that is divisible by 5. No... | [{"type": "stdin_stdout", "input": "27755776656210607832788619414635535178188775623838313967013958143619017005079991285469853503718562504927535176713879737569375166451462839457844835806559098448980069427607\n240\n", "output": "163555103\n"}, {"type": "stdin_stdout", "input": "2775577665621060783278861941463553517818877... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTeacher thinks that we make a lot of progress. Now we are even allowed to use decimal notation instead of counting sticks. After the test the teacher promised to show us a \"very beautiful number\". But the problem is, he... | [{"type": "stdin_stdout", "input": "40020 4\n", "output": "102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102564102... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDZY loves Physics, and he enjoys calculating density.\n\nAlmost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of the graph have some values) as follows: \n\n<image> w... | [{"type": "stdin_stdout", "input": "20 20\n265918 744212 196368 74731 293587 679367 460805 632939 453630 565881 835276 606327 181087 721045 219431 849838 370939 582350 335676 32244\n2 16 989\n14 19 628\n1 6 483\n5 8 733\n13 19 556\n10 17 911\n2 7 599\n13 17 390\n10 20 965\n9 11 449\n3 15 310\n3 6 557\n14 18 225\n1 18 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn n × n square matrix is special, if:\n\n * it is binary, that is, each cell contains either a 0, or a 1; \n * the number of ones in each row and column equals 2. \n\n\n\nYou are given n and the first m rows of the mat... | [{"type": "stdin_stdout", "input": "7 4 100501\n0100010\n0000101\n0100100\n0000011\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "6 4 100501\n100010\n100100\n010100\n000011\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "6 4 146325\n100010\n100100\n010100\n000011\n", "output": "2\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrew skipped lessons on the subject 'Algorithms and Data Structures' for the entire term. When he came to the final test, the teacher decided to give him a difficult task as a punishment.\n\nThe teacher gave Andrew an a... | [{"type": "stdin_stdout", "input": "100\n0 1 1 1 0 0 0 2 1 2 2 1 2 2 2 0 0 2 1 2 0 1 1 0 2 0 1 2 2 0 2 0 1 0 1 2 0 2 1 1 0 1 0 1 0 0 0 2 2 2 2 1 1 1 0 2 1 0 0 0 0 0 1 0 2 -1 1 0 0 2 0 2 2 1 0 2 2 0 2 0 2 1 2 1 1 1 0 2 1 0 2 1 1 2 1 2 0 1 2 2\n", "output": "36 30 38 35 35 33 34 31 28 22 22 23 19 16 19 20 22 23 24 25 25 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integer a > 1 such that a2 is a divisor of x.\n\n<image>\n\nMalek has a number store! In his store, he ha... | [{"type": "stdin_stdout", "input": "942689843037\n", "output": "104743315893\n"}, {"type": "stdin_stdout", "input": "808453785117\n", "output": "808453785117\n"}, {"type": "stdin_stdout", "input": "999999999988\n", "output": "499999999994\n"}, {"type": "stdin_stdout", "input": "822722434952\n", "output": "205680608738\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo quickly hire highly skilled specialists one of the new IT City companies made an unprecedented move. Every employee was granted a car, and an employee can choose one of four different car makes.\n\nThe parking lot befo... | [{"type": "stdin_stdout", "input": "30\n", "output": "4809844402031689728\n"}, {"type": "stdin_stdout", "input": "29\n", "output": "1161928703861587968\n"}, {"type": "stdin_stdout", "input": "28\n", "output": "280349076803813376\n"}, {"type": "stdin_stdout", "input": "26\n", "output": "16255179905040384\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has recently learned data structure named \"Binary heap\".\n\nThe heap he is now operating with allows the following operations: \n\n * put the given number into the heap; \n * get the value of the minimum element... | [{"type": "stdin_stdout", "input": "30\ninsert 62350949\ngetMin -928976719\nremoveMin\ngetMin 766590157\ngetMin -276914351\ninsert 858958907\ngetMin -794653029\ngetMin 505812710\ngetMin -181182543\ninsert -805198995\nremoveMin\ninsert -200361579\nremoveMin\ninsert 988531216\ninsert -474257426\ninsert 579296921\nremoveM... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta Claus is the first who came to the Christmas Olympiad, and he is going to be the first to take his place at a desk! In the classroom there are n lanes of m desks each, and there are two working places at each of the... | [{"type": "stdin_stdout", "input": "10000 10000 199999999\n", "output": "10000 10000 L\n"}, {"type": "stdin_stdout", "input": "10000 10000 200000000\n", "output": "10000 10000 R\n"}, {"type": "stdin_stdout", "input": "10000 16759 186450844\n", "output": "5563 11864 R\n"}, {"type": "stdin_stdout", "input": "10000 10000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sequence of square brackets is regular if by inserting symbols \"+\" and \"1\" into it, you can get a regular mathematical expression from it. For example, sequences \"[[]][]\", \"[]\" and \"[[][[]]]\" — are regular, at... | [{"type": "stdin_stdout", "input": "100\n[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]\n", "output": "+- -+\n|+- ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKaren is getting ready for a new school day!\n\n<image>\n\nIt is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palind... | [{"type": "stdin_stdout", "input": "08:15\n", "output": "106\n"}, {"type": "stdin_stdout", "input": "06:01\n", "output": "240\n"}, {"type": "stdin_stdout", "input": "16:12\n", "output": "230\n"}, {"type": "stdin_stdout", "input": "17:25\n", "output": "157\n"}, {"type": "stdin_stdout", "input": "16:02\n", "output": "240... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Kefa found n baloons. For convenience, we denote color of i-th baloon as si — lowercase letter of the Latin alphabet. Also Kefa has k friends. Friend will be upset, If he get two baloons of the same color. Kefa wa... | [{"type": "stdin_stdout", "input": "100 100\njhpyiuuzizhubhhpxbbhpyxzhbpjphzppuhiahihiappbhuypyauhizpbibzixjbzxzpbphuiaypyujappuxiyuyaajaxjupbahb\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 100\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipartite graphs, especially trees.\n\nA tree is a connected acyclic graph. A bipartite graph is a graph, whose vertices can ... | [{"type": "stdin_stdout", "input": "10\n7 6\n2 10\n7 1\n8 5\n9 3\n2 3\n8 7\n10 8\n10 4\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "10\n7 6\n2 7\n4 1\n8 5\n9 4\n5 3\n8 7\n10 8\n10 4\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "10\n2 6\n3 7\n8 4\n4 10\n6 9\n9 7\n3 10\n1 2\n5 8\n", "output": "16... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMahmoud has an array a consisting of n integers. He asked Ehab to find another array b of the same length such that:\n\n * b is lexicographically greater than or equal to a. \n * bi ≥ 2. \n * b is pairwise coprime: for... | [{"type": "stdin_stdout", "input": "10\n5 3 2 2 3 3 3 4 2 5\n", "output": "5 3 2 7 11 13 17 19 23 29 "}, {"type": "stdin_stdout", "input": "10\n5 3 4 2 3 3 3 4 2 5\n", "output": "5 3 4 7 11 13 17 19 23 29\n"}, {"type": "stdin_stdout", "input": "7\n23 11 6 14 7 17 20\n", "output": "23 11 6 17 5 7 13\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChandan is a horrendous murderer and he wants to kill Arjit just because he's lazy. Chandan is following the trail of Arjit's shoes. The trail is in the form of a k-ary tree. Arjit is lazy, sure, but he's smart. So, he m... | [{"type": "stdin_stdout", "input": "1\n3\n3 1 3\n3 2 13\n2 7 -1\n0 2 -1\n\nFLPMAS", "output": "0 16\n"}, {"type": "stdin_stdout", "input": "1\n3\n3 1 16\n3 2 2\n2 7 -1\n2 1 1\n\nFLOMAS", "output": "0 18\n"}, {"type": "stdin_stdout", "input": "1\n3\n3 1 16\n3 2 4\n2 7 -1\n2 0 1\n\nFLOMAS", "output": "0 20\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBosky and Menot are two friends who participated in GSF Hacks Prelims on HackerEarth, and both of them easily qualified for the on-site round. Bosky wants to team up with Menot for the on-site round but Menot has a date w... | [{"type": "stdin_stdout", "input": "4\nG: I want to go on nineteen\nM: No that is not possible lets go on twenty one\nG: No nineteen is final and twenty one is not\nM: OKAY as you wish", "output": "No Date\n"}, {"type": "stdin_stdout", "input": "4\nG: I want to go on nineteen\nM: No that is not possible ldts go on twen... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a binary tree in a two dimensional plane which has both side covered by mirrors. \nAs this is a 2D dimensional image, we define our print function to print only those nodes whose reflection is showing\non one of the... | [{"type": "stdin_stdout", "input": "20\n511\n4 114 122 119 120 102 114 70 73 83 66 47 53 48 45 77 90 33 34 93 77 15 21 97 103 58 59 33 51 34 37 113 134 94 77 112 128 76 84 98 122 40 33 42 43 43 47 0 0 108 121 42 49 68 95 106 124 87 103 15 38 0 0 33 69 88 81 33 41 55 50 63 62 19 24 30 30 58 57 88 112 94 109 50 72 45 29 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is `S`, it means it was sunny on the i-th day; if that character is `R`, it ... | [{"type": "stdin_stdout", "input": "SRR", "output": "2\n"}, {"type": "stdin_stdout", "input": "RRR", "output": "3\n"}, {"type": "stdin_stdout", "input": "RSS", "output": "1\n"}, {"type": "stdin_stdout", "input": "SSR", "output": "1\n"}, {"type": "stdin_stdout", "input": "RST", "output": "1\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind \\displaystyle{\\sum_{a=1}^{K}\\sum_{b=1}^{K}\\sum_{c=1}^{K} \\gcd(a,b,c)}.\n\nHere \\gcd(a,b,c) denotes the greatest common divisor of a, b, and c.\n\nConstraints\n\n* 1 \\leq K \\leq 200\n* K is an integer.\n\nInpu... | [{"type": "stdin_stdout", "input": "179", "output": "7689630\n"}, {"type": "stdin_stdout", "input": "130", "output": "2952085\n"}, {"type": "stdin_stdout", "input": "117", "output": "2145333\n"}, {"type": "stdin_stdout", "input": "126", "output": "2693919\n"}, {"type": "stdin_stdout", "input": "115", "output": "2033674... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N cities on a number line. The i-th city is located at coordinate x_i.\n\nYour objective is to visit all these cities at least once.\n\nIn order to do so, you will first set a positive integer D.\n\nThen, you wi... | [{"type": "stdin_stdout", "input": "1 -1\n1010000101", "output": "1010000102\n"}, {"type": "stdin_stdout", "input": "1 -2\n1010000101", "output": "1010000103\n"}, {"type": "stdin_stdout", "input": "1 -2\n1010001101", "output": "1010001103\n"}, {"type": "stdin_stdout", "input": "1 -2\n1010001111", "output": "1010001113\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten. He remembers that the remainder of a divided by b was greater than or equal to K. Find the number of possible pairs that he may... | [{"type": "stdin_stdout", "input": "38823 9265", "output": "550080294\n"}, {"type": "stdin_stdout", "input": "31415 9265", "output": "287927211"}, {"type": "stdin_stdout", "input": "11695 7143", "output": "10362628\n"}, {"type": "stdin_stdout", "input": "11695 9265", "output": "2953665\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRng is preparing a problem set for a qualification round of CODEFESTIVAL.\n\nHe has N candidates of problems. The difficulty of the i-th candidate is D_i.\n\nThere must be M problems in the problem set, and the difficulty... | [{"type": "stdin_stdout", "input": "7\n100 200 500 700 1200 1600 2000\n6\n100 200 500 700 1600 1600", "output": "NO"}, {"type": "stdin_stdout", "input": "7\n100 200 500 700 238 1600 2000\n6\n100 200 500 700 1600 1600", "output": "NO\n"}, {"type": "stdin_stdout", "input": "7\n100 200 500 700 238 1600 2000\n6\n100 200 50... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N bags, each containing two white balls. The i-th box contains two balls with integers x_i and y_i written on them, respectively.\n\nFor each of these bags, you will paint one of the balls red, and paint the oth... | [{"type": "stdin_stdout", "input": "2\n1 1\n1000000000 1000000100", "output": "1000000097999999901\n"}, {"type": "stdin_stdout", "input": "2\n1 1\n1000000000 1000100100", "output": "1000100097999899901\n"}, {"type": "stdin_stdout", "input": "2\n1 1\n1100000000 1000000000", "output": "1099999997900000001\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an N×N checkerboard.\n\nFrom the square at the upper left corner, a square that is i squares to the right and j squares below is denoted as (i, j). Particularly, the square at the upper left corner is denoted as (... | [{"type": "stdin_stdout", "input": "3", "output": "4\n0 1\n1 0\n1 2\n2 1\n"}, {"type": "stdin_stdout", "input": "4", "output": "3\n0 1\n2 1\n2 3"}, {"type": "stdin_stdout", "input": "2", "output": "1\n1 0"}, {"type": "stdin_stdout", "input": "-102", "output": "0\n"}, {"type": "stdin_stdout", "input": "-133", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which judges wheather given length of three side form a right triangle. Print \"YES\" if the given sides (integers) form a right triangle, \"NO\" if not so.\n\nConstraints\n\n* 1 ≤ length of the side ≤ 1,0... | [{"type": "stdin_stdout", "input": "3\n-1 -2 0\n0 1 -1\n-2 0 2", "output": "NO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "3\n-1 -2 -1\n0 1 0\n-2 0 2", "output": "NO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "3\n1 1 0\n29 1 -1\n0 1 -1", "output": "YES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "3\n2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA mischievous notice has arrived from the primitive slow-life organization \"Akaruda\". Akaruda is famous for mischief such as throwing a pie at the face of a VIP, but recently it has become more radical, such as using gu... | [{"type": "stdin_stdout", "input": "4\n03:05\n05:11\n11:54\n10:40", "output": "warning\nwarning\nwarning\nwarning\n"}, {"type": "stdin_stdout", "input": "4\n03:25\n10:61\n11:65\n10:41", "output": "warning\nwarning\nalert\nwarning\n"}, {"type": "stdin_stdout", "input": "4\n12:15\n10:50\n11:44\n10:40", "output": "warning... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere was a big old mansion in one place, and one cat settled in. As shown in the figure, the mansion has a convex polygonal shape when viewed from above, and is made up of several rooms surrounded by straight walls. One ... | [{"type": "stdin_stdout", "input": "4 4\n0 0\n1 0\n1 1\n0 1\n1 2\n1 4\n2 4\n3 4\n12 22\n2 0\n4 0\n8 0\n4 2\n6 2\n8 2\n2 4\n4 4\n6 4\n-1 6\n4 6\n-1 8\n1 2\n2 3\n1 4\n1 7\n1 10\n2 4\n2 5\n3 5\n3 6\n4 5\n3 12\n5 11\n5 7\n6 9\n6 11\n7 10\n7 8\n8 9\n9 11\n10 11\n10 12\n11 12\n0 0", "output": "1\n2\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nJOI Shoji manages the time spent at work by employees with a time card. When an employee arrives at the office, he / she uses a dedicated device to stamp the arrival time on the time card. When leaving the offi... | [{"type": "stdin_stdout", "input": "-1 -2 0 1 1 -1\n8 2 1 62 2 2\n27 6 665 -1 15 14", "output": "2 2 59\n54 0 1\n-28 -1 -51\n"}, {"type": "stdin_stdout", "input": "-1 -2 0 1 1 -1\n8 2 1 62 3 2\n27 6 665 -1 15 14", "output": "2 2 59\n54 1 1\n-28 -1 -51\n"}, {"type": "stdin_stdout", "input": "-1 -2 -1 1 1 -1\n8 2 1 62 3 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSince I got tired to write long problem statements, I decided to make this problem statement short. For given positive integer L, how many pairs of positive integers a, b (a ≤ b) such that LCM(a, b) = L are there? Here, L... | [{"type": "stdin_stdout", "input": "12\n7\n24\n0", "output": "8\n2\n11\n"}, {"type": "stdin_stdout", "input": "12\n11\n2\n0", "output": "8\n2\n2\n"}, {"type": "stdin_stdout", "input": "12\n15\n2\n0", "output": "8\n5\n2\n"}, {"type": "stdin_stdout", "input": "12\n11\n4\n0", "output": "8\n2\n3\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLife is not easy. Sometimes it is beyond your control. Now, as contestants of ACM ICPC, you might be just tasting the bitter of life. But don't worry! Do not look only on the dark side of life, but look also on the bright... | [{"type": "stdin_stdout", "input": "1\nnorth\n3\nnorth\neasu\nsouth\n0", "output": "5\n1\n"}, {"type": "stdin_stdout", "input": "1\nnorth\n3\nnorth\neast\nsouth\n0", "output": "5\n1"}, {"type": "stdin_stdout", "input": "1\nnorth\n0\nnorth\ntsae\nosuth\n-1", "output": "5\n"}, {"type": "stdin_stdout", "input": "1\nnorth\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nN ignited fuses and one bomb for each are placed on a vertical H x horizontal W grid. Each fuse and bomb is placed on a pathi consisting of Li cells, and the jth cell of pathi is (pxij, pyij). Each bomb is in t... | [{"type": "stdin_stdout", "input": "3 3 2\n1 3\n3 2 3 2 1 2 1\n5 2 1 1 1 1 2 2 2 3 2", "output": "-1\n"}, {"type": "stdin_stdout", "input": "3 3 2\n1 3\n3 2 3 2 1 2 1\n5 2 1 1 1 1 2 2 4 3 2", "output": "-1\n"}, {"type": "stdin_stdout", "input": "3 3 2\n1 2\n3 2 3 2 1 2 1\n5 2 1 1 1 1 2 2 2 3 2", "output": "-1\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKyo, 垓, {Reiyo}, 穣, Mizo, 澗, Tadashi, Ryo, Goku, Tsunekawasa, Amongi, Decillion, etc.\nMinutes, 厘, hair, thread, 忽, fine, fine, fine, sha, dust, dust, 渺, vagueness, vagueness, patrolling, su 臾, sigh, bullet finger, moment... | [{"type": "stdin_stdout", "input": "3\n1 km = 10^3 m\n1 m = 10^2 cm\n1 km = 10^5 cm\n7\n1 kilometre = 10^3 metre\n1 megametre = 10^3 kilometre\n1 metre = 10^-6 megametre\n1 terametre = 10^3 gigametre\n1 petametre = 10^3 terametre\n1 gigametre = 10^-6 petametre\n1 metre = 10^-15 petametre\n4\n1 a = 10^2 b\n1 a = 10^3 c\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlternate Escape\n\nAlice House\n\nAlice and Bob are playing board games. This board game is played using a board with squares in rows H and columns and one frame. In this game, the upper left square of the board is set a... | [{"type": "stdin_stdout", "input": "3 3 2 2\n 1 1 1\n0 0 0 0\n 1 1 1\n0 0 0 0\n 1 1 1\n0 0 0 0\n 1 1 1\n3 3 2 1\n 1 0 1\n1 0 1 1\n 1 0 0\n0 0 0 0\n 0 0 1\n1 1 0 1\n 1 0 1\n1 3 1 1\n 1 1 1\n1 0 0 1\n 1 0 1\n2 2 1 1\n 1 0\n1 0 0\n 0 0\n0 0 0\n 0 0\n0 0 0 0", "output": "Yes\nYes\nYes\nNo\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nC: Only one subsequence --Unique Subsequence-\n\nproblem\n\nOne day Ebi-chan noticed that a text string T of length n and a pattern string P (m \\ leq n) of length m were placed on the desk. Ebi-chan loves the \"only one ... | [{"type": "stdin_stdout", "input": "aziucamp\nazu", "output": "yes\n"}, {"type": "stdin_stdout", "input": "azjucamp\nazu", "output": "yes\n"}, {"type": "stdin_stdout", "input": "aizucamp\nazu", "output": "yes"}, {"type": "stdin_stdout", "input": "aizucamp\nuza", "output": "no\n"}, {"type": "stdin_stdout", "input": "azj... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nB: AddMulSubDiv\n\nProblem Statement\n\nYou have an array A of N integers. A_i denotes the i-th element of A.\n\nYou have to process one of the following queries Q times:\n\n* Query 1: The query consists of non-negative i... | [{"type": "stdin_stdout", "input": "3 3 3 10\n2 -5 3\n1 3 2 2\n0 9 -1 4\n0 -1 20 5", "output": "1\n"}, {"type": "stdin_stdout", "input": "3 1 3 10\n2 -5 3\n1 3 2 2\n0 9 -1 4\n0 -1 20 5", "output": "1\n"}, {"type": "stdin_stdout", "input": "3 1 3 15\n2 -5 3\n1 3 2 2\n0 9 -1 4\n0 -1 20 5", "output": "1\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHarry is a bright student. To prepare thoroughly for exams, he completes all the exercises in his book! Now that the exams are approaching fast, he is doing book exercises day and night. He writes down and keeps updating ... | [{"type": "stdin_stdout", "input": "6\n14 hrilgne\n6 mathematics\n-1 geography\n-1\n3 grcphias\n-1", "output": "0 mathematics\n0 hrilgne\n0 grcphias\n"}, {"type": "stdin_stdout", "input": "6\n9 english\n7 nathematics\n-1 geography\n-1\n3 gchpsias\n-1", "output": "0 nathematics\n0 english\n0 gchpsias\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef changed the password of his laptop a few days ago, but he can't remember it today. Luckily, he wrote the encrypted password on a piece of paper, along with the rules for decryption.\nThe encrypted password is a strin... | [{"type": "stdin_stdout", "input": "4\n2\n2 3\n1 1\n8\n0\n1800.7150295041072\n0\n0.42064717124502127\n3\nx 1\nc 2\n# .\n0xd21#dc/98x", "output": "8\n1800.7150295041072\n.42064717124502127\n1d21.d2/981\n"}, {"type": "stdin_stdout", "input": "4\n2\n7 3\n3 1\n10\n0\n1800.0493927440593\n0\n0.9085107376538183\n3\ny 0\nd 3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of 2n+1 integer points on a Cartesian plane. Points are numbered from 0 to 2n inclusive. Let P_i be the i-th point. The x-coordinate of the point P_i equals i. The y-coordinate of the point P_i equals ... | [{"type": "stdin_stdout", "input": "1000000001 1000000000000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1 1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n candy boxes in front of Tania. The boxes are arranged in a row from left to right, numbered from 1 to n. The i-th box contains r_i candies, candies have the color c_i (the color can take one of three values ... | [{"type": "stdin_stdout", "input": "50 49 1000\n30 37 34 31 26 44 32 12 36 15 5 5 31 24 17 24 43 19 17 23 45 2 24 17 23 48 20 44 46 44 13 4 29 49 33 41 14 25 46 43 7 47 28 25 2 30 37 37 19 32\nGBBBRBGRBRBRGRGRBBGBGRRBGGRBGRBRRRRRRRBRGRGGGGBRGG\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "50 37 500\n25 43 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.\n\nRecently, she was presented with an array a of the size of 10^9 elements that is filled as ... | [{"type": "stdin_stdout", "input": "10\n449347852 741090797\n541919355 938202256\n442458747 465872502\n463474612 789217678\n146477812 390217056\n302933612 477640295\n48191125 1417399529\n173202385 374432789\n78807265 428215825\n194590462 1318087870\n", "output": "-145871473\n198141451\n11706878\n626346145\n268347434\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode laptop consumes P1 watt per minute. T1 minutes after Tom moved the mouse or touched the keyboard for the last time... | [{"type": "stdin_stdout", "input": "30 3 50 32 1 18\n46 60\n66 94\n99 141\n162 239\n309 334\n400 550\n594 630\n659 663\n664 701\n735 736\n741 755\n756 801\n823 854\n865 915\n937 964\n984 986\n990 1007\n1008 1031\n1052 1064\n1073 1080\n1190 1191\n1192 1254\n1265 1266\n1272 1273\n1274 1277\n1284 1302\n1308 1312\n1358 138... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArkady bought an air ticket from a city A to a city C. Unfortunately, there are no direct flights, but there are a lot of flights from A to a city B, and from B to C.\n\nThere are n flights from A to B, they depart at tim... | [{"type": "stdin_stdout", "input": "10 11 4 5 10\n1 2 3 4 5 6 7 8 9 10\n16 17 18 19 20 21 22 23 24 25 26\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 3 2 3 1\n1 999999998 999999999 1000000000\n3 4 1000000000\n", "output": "1000000003\n"}, {"type": "stdin_stdout", "input": "10 11 4 5 3\n1 2 3 4 5 6 7 8 9 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet x be an array of integers x = [x_1, x_2, ..., x_n]. Let's define B(x) as a minimal size of a partition of x into subsegments such that all elements in each subsegment are equal. For example, B([3, 3, 6, 1, 6, 6, 6]) =... | [{"type": "stdin_stdout", "input": "5\n1 1 1 1 1\n1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "530612279\n"}, {"type": "stdin_stdout", "input": "10\n10 1 9 3 9 4 10 3 8 5\n10 1 10 14 12 4 10 4 10 7\n", "output": "875000103\n"}, {"type": "stdin_stdout", "input": "10\n10 1 9 3 9 4 10 3 8 5\n10 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the maximum value of n.\n\nYou are given a positive integer number n. You really love good numbers so you want to find the smallest good number greater than or equal t... | [{"type": "stdin_stdout", "input": "100\n2\n8\n5\n6\n5\n4\n4\n6\n12\n2\n9\n5\n10\n8\n4\n10\n9\n6\n9\n4\n5\n6\n4\n4\n7\n1\n2\n2\n5\n6\n1\n5\n10\n9\n10\n16\n3\n2\n2\n3\n2\n7\n9\n2\n9\n5\n7\n8\n1\n5\n2\n5\n1\n3\n8\n4\n7\n9\n3\n1\n7\n1\n2\n4\n7\n2\n7\n1\n1\n10\n8\n5\n7\n12\n10\n8\n1\n7\n5\n10\n7\n6\n6\n6\n7\n4\n9\n3\n4\n9\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKarl is developing a key storage service. Each user has a positive integer key.\n\nKarl knows that storing keys in plain text is bad practice. So, instead of storing a key, he decided to store a fingerprint of a key. Howe... | [{"type": "stdin_stdout", "input": "100\n1\n3\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n14\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n19\n42\n43\n44\n45\n46\n47\n20\n49\n50\n65\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVK news recommendation system daily selects interesting publications of one of n disjoint categories for each user. Each publication belongs to exactly one category. For each category i batch algorithm selects a_i publica... | [{"type": "stdin_stdout", "input": "40\n19 20 8 13 13 17 1 14 15 20 14 17 2 9 9 10 19 16 6 12 9 7 20 5 12 2 4 4 12 5 4 11 8 1 2 8 11 19 18 4\n52258 5648 46847 9200 63940 79328 118413 54479 1788 60107 8234 64215 15419 84411 50307 78075 92548 17867 43456 7970 1390 99373 97297 90662 82950 678 79356 51351 2794 82477 16508 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEric is the teacher of graph theory class. Today, Eric teaches independent set and edge-induced subgraph.\n\nGiven a graph G=(V,E), an independent set is a subset of vertices V' ⊂ V such that for every pair u,v ∈ V', (u,v... | [{"type": "stdin_stdout", "input": "50\n21 10\n30 22\n3 37\n37 32\n4 27\n18 7\n2 30\n29 19\n6 37\n12 39\n47 25\n41 49\n45 9\n25 48\n16 14\n9 7\n33 28\n3 31\n34 16\n35 37\n27 40\n45 16\n29 44\n16 15\n26 15\n1 12\n2 13\n15 21\n43 14\n9 33\n44 15\n46 1\n38 5\n15 5\n1 32\n42 35\n20 27\n23 8\n1 16\n15 17\n36 50\n13 8\n49 45... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays a and b both consisting of n positive (greater than zero) integers. You are also given an integer k.\n\nIn one move, you can choose two indices i and j (1 ≤ i, j ≤ n) and swap a_i and b_j (i.e. a_... | [{"type": "stdin_stdout", "input": "5\n2 1\n1 2\n3 4\n5 5\n5 5 6 11 5\n1 2 5 4 3\n5 3\n1 2 3 4 5\n10 9 10 10 9\n4 0\n2 2 4 3\n2 4 2 3\n4 4\n1 2 2 1\n4 4 5 4\n", "output": "6\n32\n39\n11\n17\n"}, {"type": "stdin_stdout", "input": "5\n2 1\n1 2\n3 4\n5 5\n5 10 6 6 5\n1 2 5 4 3\n5 5\n1 2 3 4 5\n10 9 10 10 9\n4 0\n2 2 4 3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two rival donut shops.\n\nThe first shop sells donuts at retail: each donut costs a dollars.\n\nThe second shop sells donuts only in bulk: box of b donuts costs c dollars. So if you want to buy x donuts from thi... | [{"type": "stdin_stdout", "input": "20\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSo nearly half of the winter is over and Maria is dreaming about summer. She's fed up with skates and sleds, she was dreaming about Hopscotch all night long. It's a very popular children's game. The game field, the court,... | [{"type": "stdin_stdout", "input": "100 350728 439252\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10 -227776 821899\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "55 -20 1000000\n", "output": "27272\n"}, {"type": "stdin_stdout", "input": "100 350728 688056\n", "output": "-1\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're given an array b of length n. Let's define another array a, also of length n, for which a_i = 2^{b_i} (1 ≤ i ≤ n). \n\nValerii says that every two non-intersecting subarrays of a have different sums of elements. Yo... | [{"type": "stdin_stdout", "input": "2\n6\n4 3 0 1 2 0\n2\n2 5\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\n6\n0 3 0 1 2 0\n2\n2 5\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\n6\n4 3 0 1 2 0\n2\n4 5\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\n6\n4 3 0 1 2 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a new computer game in which you have to fight monsters. In a dungeon you are trying to clear, you met three monsters; the first of them has a health points, the second has b health points, and the third h... | [{"type": "stdin_stdout", "input": "13\n3 2 4\n10 2 4\n10 3 5\n5 4 6\n7 1 1\n3 3 3\n6 6 6\n14 2 2\n16 1 1\n9 9 9\n26 3 3\n9 8 10\n4 1 4\n", "output": "YES\nNO\nYES\nNO\nYES\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "13\n3 2 4\n10 2 1\n10 3 5\n5 4 6\n7 1 1\n3 3 3\n6 6 6\n14 2 2\n16 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n«One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.\n\nHowever, just counting dragons was boring as well, so she ente... | [{"type": "stdin_stdout", "input": "10\n10\n10\n10\n100000\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "10\n10\n10\n4\n100000\n", "output": "30000\n"}, {"type": "stdin_stdout", "input": "10\n10\n16\n4\n100000\n", "output": "30000\n"}, {"type": "stdin_stdout", "input": "1\n1\n1\n1\n100000\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a large rectangular board which is divided into n × m cells (the board has n rows and m columns). Each cell is either white or black.\n\nYou paint each white cell either red or blue. Obviously, the number of diff... | [{"type": "stdin_stdout", "input": "5 4\noooo\no*oo\noooo\n**oo\nooo*\n", "output": "239616\n"}, {"type": "stdin_stdout", "input": "5 4\noooo\no*oo\noooo\n**oo\n*ooo\n", "output": "249856\n"}, {"type": "stdin_stdout", "input": "5 4\noooo\no*oo\noooo\no*o*\nooo*\n", "output": "233472\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n students numerated from 1 to n. The level of the i-th student is a_i. You need to split the students into stable groups. A group of students is called stable, if in the sorted array of their levels no two neig... | [{"type": "stdin_stdout", "input": "96 15 21\n76 26 108 220 384 4 170 198 568 571 2 193 244 359 78 133 107 340 110 135 565 341 109 572 243 138 357 52 293 344 595 105 569 362 639 134 82 356 27 137 194 291 499 104 28 290 197 477 339 50 288 289 160 54 358 640 343 542 566 79 136 385 3 641 195 355 361 169 196 429 242 162 33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's consider equation:\n\nx2 + s(x)·x - n = 0, \n\nwhere x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.\n\nYou are given an integer n, find the sma... | [{"type": "stdin_stdout", "input": "980100017820000000\n", "output": "990000000\n"}, {"type": "stdin_stdout", "input": "902500013300000000\n", "output": "950000000\n"}, {"type": "stdin_stdout", "input": "999999887000001932\n", "output": "999999908\n"}, {"type": "stdin_stdout", "input": "160000029199999926\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves chess very much. \n\nOne day the Little Elephant and his friend decided to play chess. They've got the chess pieces but the board is a problem. They've got an 8 × 8 checkered board, each square i... | [{"type": "stdin_stdout", "input": "BWBWBWBW\nBWBWBWBW\nBWBWBWBW\nBWBWBWBW\nWBWBWBWB\nWBWBWBWB\nWBWBWBWB\nWBWBWBWB\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "WBWBWBWB\nWBWBWBWB\nWBWBWBWB\nWBWBWBWB\nBWBWBWBW\nWBWBWBWB\nBWBWBWBW\nBWBWBWBW\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "WBWBWBWB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe classic programming language of Bitland is Bit++. This language is so peculiar and complicated.\n\nThe language is that peculiar as it has exactly one variable, called x. Also, there are two operations:\n\n * Operati... | [{"type": "stdin_stdout", "input": "101\nX++\nX++\nX++\n++X\n--X\nX--\nX++\nX--\nX--\n--X\n--X\n++X\nX++\n++X\n++X\nX--\n--X\n++X\nX++\nX--\n++X\n--X\n--X\n--X\n++X\n--X\n++X\nX++\nX++\n++X\n--X\nX++\nX--\nX++\n++X\n++X\nX--\nX--\nX--\nX++\nX++\nX--\nX--\nX++\n++X\n++X\n++X\n--X\n--X\n++X\nX--\nX--\n--X\n++X\nX--\n++X\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nUser ainta has a stack of n red and blue balls. He can apply a certain operation which changes the colors of the balls inside the stack.\n\n * While the top ball inside the stack is red, pop the ball from the top of the ... | [{"type": "stdin_stdout", "input": "50\nBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\n", "output": "1125899906842623\n"}, {"type": "stdin_stdout", "input": "50\nBRRRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\n", "output": "1125899906842609\n"}, {"type": "stdin_stdout", "input": "50\nRRBBBBBBBBBBBBBBBBRBRRBBBR... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNearly each project of the F company has a whole team of developers working on it. They often are in different rooms of the office in different cities and even countries. To keep in touch and track the results of the proj... | [{"type": "stdin_stdout", "input": "100 5\n- 60\n- 58\n+ 25\n- 32\n+ 86\n", "output": "95\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30 31 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 59 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBizon the Champion is called the Champion for a reason. \n\nBizon the Champion has recently got a present — a new glass cupboard with n shelves and he decided to put all his presents there. All the presents can be divided... | [{"type": "stdin_stdout", "input": "100 100 100\n100 100 100\n100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 100 100\n101 100 100\n100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 100 000\n101 100 100\n100\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "000 100 000\n101 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day a well-known sponsor of a well-known contest decided to give every participant of the contest a T-shirt as a present. A natural problem occurred: on the one hand, it is not clear how many T-shirts of what sizes sh... | [{"type": "stdin_stdout", "input": "302 143 40 63 452\n100\nXXL\nM\nXL\nS\nXXL\nS\nL\nXL\nXL\nXL\nXXL\nS\nXXL\nS\nXXL\nXL\nXL\nXXL\nXL\nXXL\nM\nS\nS\nS\nS\nXXL\nS\nL\nXL\nXXL\nXXL\nS\nXXL\nL\nXXL\nM\nS\nL\nL\nXL\nXL\nS\nXL\nL\nXL\nM\nXL\nL\nM\nS\nXL\nXXL\nXL\nL\nXL\nXL\nXL\nM\nM\nXL\nL\nS\nS\nXL\nS\nXXL\nXXL\nXL\nS\nXL... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya wants to pass n exams and get the academic scholarship. He will get the scholarship if the average grade mark for all the exams is at least avg. The exam grade cannot exceed r. Vanya has passed the exams and got gra... | [{"type": "stdin_stdout", "input": "9 846678 205000\n102282 593538\n246630 24854\n545346 409737\n334264 443193\n37717 191227\n154582 913095\n97105 345066\n65504 578960\n163348 394257\n", "output": "2441209588\n"}, {"type": "stdin_stdout", "input": "9 846678 205000\n102282 593538\n246630 24854\n545346 409737\n334264 443... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a string s, consisting of capital Latin letters. Let's denote its current length as |s|. During one move it is allowed to apply one of the following operations to it: \n\n * INSERT pos ch — insert a letter ch in... | [{"type": "stdin_stdout", "input": "GXPLMUNZIRBHFJOOJHOMQNIKHVQSGFYSJLSWJQBUWYWHLQHLZYLPZWBOMPOLOLUGSBMHHLYGEIOUWDKPFIAAIRKYRLXTIFAZOPOLLPSNZHCIZDRTJPCYSCDTXBTMFSGEPRNOHJHNXZFYJPAMSHNOVZZYWCVEXLLOVHGAJBANAXVNTWCYTCUMQPEUUESQZTSDANIMUVJGDJCDLIAZKIAYAUQKPXRYKFRBVQJDRSUQZQZTIHWZDXQND\nYTJUCSBGESVMVRIDTBJTMPVACWWDWKBPEBVMG... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand... | [{"type": "stdin_stdout", "input": "10 10\nlellelleel\ne l\ne l\ne l\ne l\ne l\ne e\nl l\nl e\nl l\ne e\n", "output": "lellelleel\n"}, {"type": "stdin_stdout", "input": "10 10\nlellelleel\ne l\ne l\ne l\ne l\ne l\ne e\nl l\nl e\nl l\ne f\n", "output": "lfllfllffl\n"}, {"type": "stdin_stdout", "input": "10 10\nlellellee... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStepan has the newest electronic device with a display. Different digits can be shown on it. Each digit is shown on a seven-section indicator like it is shown on the picture below.\n\n<image>\n\nSo, for example, to show t... | [{"type": "stdin_stdout", "input": "196542\n", "output": "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are n available fountains, for each fountain its beauty and cost are known. There are two types of money in the game: coins and diamonds, so ... | [{"type": "stdin_stdout", "input": "52 38 22\n9 25 D\n28 29 C\n29 25 D\n4 28 D\n23 29 D\n24 25 D\n17 12 C\n11 19 C\n13 14 C\n12 15 D\n7 25 C\n2 25 C\n6 17 C\n2 20 C\n15 23 D\n8 21 C\n13 15 D\n29 15 C\n25 20 D\n22 20 C\n2 13 D\n13 22 D\n27 20 C\n1 21 D\n22 17 C\n14 21 D\n4 25 D\n5 23 C\n9 21 C\n2 20 C\n14 18 C\n29 24 C\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerland annual chess tournament is coming!\n\nOrganizers have gathered 2·n chess players who should be divided into two teams with n people each. The first team is sponsored by BerOil and the second team is sponsored by B... | [{"type": "stdin_stdout", "input": "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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Polycarp decided to rewatch his absolute favourite episode of well-known TV series \"Tufurama\". He was pretty surprised when he got results only for season 7 episode 3 with his search query of \"Watch Tufurama se... | [{"type": "stdin_stdout", "input": "10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "45\n"}, {"type": "stdin_stdout", "input": "8\n13 2 7 6 7 1 4 9\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "8\n14 2 6 6 5 1 4 9\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGathering darkness shrouds the woods and the world. The moon sheds its light on the boat and the river.\n\n\"To curtain off the moonlight should be hardly possible; the shades present its mellow beauty and restful nature.... | [{"type": "stdin_stdout", "input": "50 1 19\n-5213 -1\n2021 -1\n-4479 1\n1569 -1\n1618 1\n-8318 1\n3854 1\n8190 -1\n9162 1\n8849 1\n-5545 -1\n-7898 -1\n728 1\n-2175 -1\n6453 -1\n2999 1\n3095 1\n-2192 -1\n7938 -1\n1910 -1\n-6863 -1\n5230 -1\n-4630 -1\n-2587 -1\n-3389 1\n-332 -1\n5915 1\n-2604 1\n-8907 1\n-2019 1\n2992 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSee Russian Translation\n\nAdam and Bob are playing a game. The game is parameterized by the three integers a,b,c. They start out with the integer 1, with Adam going first. Suppose the current integer is S. On a player's ... | [{"type": "stdin_stdout", "input": "6\n2 2 10\n2 10 20\n10 10 3\n2 3 100\n22 40 500\n2 100 1000000000000000000\n\nSAMPLE", "output": "Bob\nBob\nAdam\nAdam\nBob\nAdam\n"}, {"type": "stdin_stdout", "input": "6\n2 2 10\n4 10 20\n10 10 3\n2 3 100\n22 40 500\n2 100 1000000000000000000\n\nSAMPLE", "output": "Bob\nBob\nAdam\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGeeko is very happy because his exam are over so he is busy in playing\n games and watching movies, today he has watched lord of the rings \nHe got so fascinated after watching the movie that he is seeing himself\n in t... | [{"type": "stdin_stdout", "input": "2000\n8 294\n9 307\n7 310\n3 677\n10 952\n6 902\n9 86\n7 191\n5 423\n5 992\n6 306\n5 873\n3 504\n3 461\n4 380\n7 94\n4 16\n5 592\n9 876\n9 812\n8 664\n6 921\n10 701\n7 657\n2 979\n9 560\n9 393\n3 827\n7 841\n8 927\n2 685\n4 247\n7 126\n8 731\n10 813\n10 536\n5 963\n9 229\n3 273\n6 49... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs the Monk is also taking part in the CodeMonk Series, this week he learned about hashing. Now he wants to practice some problems. So he came up with a simple problem. Firstly, he made a hash function F such that: \nF(x... | [{"type": "stdin_stdout", "input": "10\n100\n35642 89928 21715 39632 43512 59963 55349 30586 81779 58165 10664 53467 64928 71994 28552 91179 67658 75573 82774 618 64112 14133 5264 25563 30866 89057 65543 72257 63301 42303 64150 45394 6663 85367 89516 72957 94996 75394 30645 7545 917 96968 29618 58611 28331 97002 69767 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChinna is preparing for an online entrance examination. The performance in the examination is measured on a rating scale of 1 to 10^6. Recently, Chinna came across an advertisement of an institution which guarantees an in... | [{"type": "stdin_stdout", "input": "2000\n67\n4034 6 5758 1533 98 3 3 1530 844 8853 18467 38 86 38 53604 2 95652 71 78 35482 6403 546 81178 346 977 20372 8362 826 768 7 5 1880 7606 5275 224 70646 237 25 12 523 5 975 93854 61704 41036 28358 5202 406 92 4 915 903 2 40675 37 2 5281 64780 2407 44 25 81 2 5733 7 24730 3 55 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs we have seen that Vaishnav was a smart kid and today he has grown up(but he is still childish)\nand he is in High school.\n\nToday he was back from school and found that 4 pieces of Pizza was\nordered- one for his fath... | [{"type": "stdin_stdout", "input": "6668\n1\n2\n4\n5\n7\n8\n10\n11\n13\n14\n16\n17\n19\n20\n22\n23\n25\n26\n28\n29\n31\n32\n34\n35\n37\n38\n40\n41\n43\n44\n46\n47\n49\n50\n52\n53\n55\n56\n58\n59\n61\n62\n64\n65\n67\n68\n70\n71\n73\n74\n76\n77\n79\n80\n82\n83\n85\n86\n88\n89\n91\n92\n94\n95\n97\n98\n100\n101\n103\n104\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nM-kun is a student in Aoki High School, where a year is divided into N terms.\nThere is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:\n\n* F... | [{"type": "stdin_stdout", "input": "15 1\n4 1 4 0 6 9 2 6 5 3 5 7 9 1 9", "output": "No\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "15 1\n3 0 8 1 6 9 1 6 5 5 9 7 2 7 16", "output": "No\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\nYes\nNo\nNo\nYes\nYes\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N. Determine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \\... | [{"type": "stdin_stdout", "input": "6\n0 0 1 2 3 12\n0 2 14 6 2 3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n1 0 1 2 3 12\n0 2 14 6 2 3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n1 0 1 2 3 12\n0 4 14 6 2 3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6\n1 0 1 2 3 12\n1 4 14... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an integer N, find the base -2 representation of N.\n\nHere, S is the base -2 representation of N when the following are all satisfied:\n\n* S is a string consisting of `0` and `1`.\n* Unless S = `0`, the initial ch... | [{"type": "stdin_stdout", "input": "208967441", "output": "11101101101011110101100010001\n"}, {"type": "stdin_stdout", "input": "180276081", "output": "11111110000111101110010110001\n"}, {"type": "stdin_stdout", "input": "175198680", "output": "11111101100010101011000101000\n"}, {"type": "stdin_stdout", "input": "21427... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree with N vertices. The vertices are numbered 0 through N-1, and the edges are numbered 1 through N-1. Edge i connects Vertex x_i and y_i, and has a value a_i. You can perform the following operation any... | [{"type": "stdin_stdout", "input": "5\n0 1 1\n0 3 3\n0 3 10\n4 4 1", "output": "2"}, {"type": "stdin_stdout", "input": "5\n0 1 1\n0 0 3\n0 3 10\n4 4 1", "output": "2"}, {"type": "stdin_stdout", "input": "5\n0 1 2\n0 0 3\n0 3 10\n4 4 1", "output": "2"}, {"type": "stdin_stdout", "input": "5\n0 1 1\n0 0 3\n0 3 13\n4 4 1",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network:\n\n* People traveled between cities only throu... | [{"type": "stdin_stdout", "input": "3\n0 1000000000 1000000000\n1000000000 0 1000000000\n1000000000 1000000000 0", "output": "3000000000"}, {"type": "stdin_stdout", "input": "5\n0 21 18 11 28\n21 0 13 10 26\n18 13 0 23 13\n11 10 23 0 17\n28 26 13 17 0", "output": "82"}, {"type": "stdin_stdout", "input": "3\n-1 -1 3\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke loves \"paper cutting\": he cuts out characters from a newspaper headline and rearranges them to form another string.\n\nHe will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excit... | [{"type": "stdin_stdout", "input": "3\ncacb\nccabe\n`cacbc", "output": "abcc\n"}, {"type": "stdin_stdout", "input": "3\ncaaa\ndaacc\nacacac", "output": "aac\n"}, {"type": "stdin_stdout", "input": "3\ncaca\ncca`d\nacacac", "output": "acc\n"}, {"type": "stdin_stdout", "input": "3\nacba\nda`cb\nacacbc", "output": "abc\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSample testcase 3 has a mistake, so we erased this case and rejudged all solutions of this problem. (21:01)\n\nSnuke got a sequence $a$ of length $n$ from AtCoder company. All elements in $a$ are distinct.\nHe made a sequ... | [{"type": "stdin_stdout", "input": "25 250\n13 10 11 20 25 30 35 40 45 50 55 60 65 36 83 80 85 90 95 100 176 110 115 120 125", "output": "322439703\n"}, {"type": "stdin_stdout", "input": "25 127\n5 10 15 20 39 30 35 40 45 50 108 37 81 70 75 80 82 175 58 000 99 110 115 120 125", "output": "712861496\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe hero of justice, the Spider, can pull a rope out of his arm and jump from building to building. However, due to the short rope, you can only move to buildings that are less than 50 distances from you. To move to a bui... | [{"type": "stdin_stdout", "input": "4\n1 -2 0\n2 30 0\n3 33 40\n4 1 60\n2\n1 3\n1 4\n22\n1 0 0\n2 150 40\n3 30 20\n4 180 150\n5 40 80\n6 130 130\n7 72 28\n8 172 118\n9 50 50\n10 160 82\n11 90 105\n12 218 131\n13 130 64\n14 80 140\n15 36 117\n16 190 90\n17 60 100\n18 100 70\n19 130 100\n20 71 69\n21 200 110\n22 120 150\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA frog is about to return to the burrow. The burrow is D centimeters ahead of the frog, and the frog goes straight toward the burrow. There are only two actions that a frog can do:\n\n* Large jump (go forward L centimeter... | [{"type": "stdin_stdout", "input": "115 172", "output": "115\n"}, {"type": "stdin_stdout", "input": "135 191", "output": "135\n"}, {"type": "stdin_stdout", "input": "170 176", "output": "170\n"}, {"type": "stdin_stdout", "input": "208 133", "output": "76\n"}, {"type": "stdin_stdout", "input": "194 102", "output": "93\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA message from humans to extraterrestrial intelligence was sent through the Arecibo radio telescope in Puerto Rico on the afternoon of Saturday November l6, l974. The message consisted of l679 bits and was meant to be tra... | [{"type": "stdin_stdout", "input": "5 1 2\n99999 999 999\n1680 10 16\n1970 1 2\n2002 4 11\n0 0 0", "output": "2 2\n313 313\n37 43\n37 53\n37 53\n"}, {"type": "stdin_stdout", "input": "10 1 9\n99999 999 1768\n1495 5 16\n973 1 2\n2002 4 11\n0 0 0", "output": "2 5\n257 389\n31 47\n31 31\n37 53\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are N islands and M bridges. Numbers from 1 to N are assigned to each of the N islands. Numbers from 1 to M are also assigned to each of the M bridges.\n\nGaccho is currently on the first island (at time ... | [{"type": "stdin_stdout", "input": "4 4\n1 1 27\n1 3 10\n3 3 47\n3 1 136", "output": "-1\n"}, {"type": "stdin_stdout", "input": "3 4\n1 2 27\n2 3 10\n1 3 47\n3 1 57", "output": "47\n"}, {"type": "stdin_stdout", "input": "4 4\n1 2 27\n1 3 10\n2 3 47\n3 1 57", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 4\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n3\n1 3 3\n2\n1 2\n1 3\n\n\nOutput\n\n5\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... | [{"type": "stdin_stdout", "input": "3\n0 2 0\n-1\n1 2\n0 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n0 2 0\n-1\n1 2\n0 1", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n1 1 0\n0\n1 2\n-1 1", "output": "3\n"}, {"type": "stdin_stdout", "input": "3\n0 1 1\n0\n2 1\n-1 1", "output": "3\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads two integers x and y, and prints them in ascending order.\n\nConstraints\n\n* 0 ≤ x, y ≤ 10000\n* the number of datasets ≤ 3000\n\nInput\n\nThe input consists of multiple datasets. Each dataset... | [{"type": "stdin_stdout", "input": "3 0\n-1 2\n15 3\n0 0", "output": "0 3\n-1 2\n3 15\n"}, {"type": "stdin_stdout", "input": "3 -1\n0 2\n27 3\n0 0", "output": "-1 3\n0 2\n3 27\n"}, {"type": "stdin_stdout", "input": "4 -1\n0 2\n27 3\n0 0", "output": "-1 4\n0 2\n3 27\n"}, {"type": "stdin_stdout", "input": "4 -1\n0 2\n18 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef Ciel wants to put a fancy neon signboard over the entrance of her restaurant. She has not enough money to buy the new one so she bought some old neon signboard through the internet. Ciel was quite disappointed when s... | [{"type": "stdin_stdout", "input": "5\n????CIELIS???E?\n????CIELISOUR???F\nT?KEITE?SY\n????????\n???C???", "output": "CHEFCIELISACHEF\nCHEFCIELISOURCHEF\nTAKEITEASY\nCHEFCHEF\nAAACHEF\n"}, {"type": "stdin_stdout", "input": "5\n????CIELIS???E?\n????CIELISOUR???F\nT?KEITE?SY\n????????\n@??C???", "output": "CHEFCIELISACHE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo players A and B have a list of n integers each. They both want to maximize the subtraction between their score and their opponent's score. \n\nIn one turn, a player can either add to his score any element from his lis... | [{"type": "stdin_stdout", "input": "29\n254369 14511 114048 683934 553812 575014 620356 217938 286195 131704 268393 78202 296626 986697 175814 600746 146985 215868 740052 711417 11221 944700 940915 53378 698708 878644 704035 120164 437165\n3415 443979 327875 491782 974937 176118 37957 316844 12044 156497 462613 338831 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given array a of length n. You can choose one segment [l, r] (1 ≤ l ≤ r ≤ n) and integer value k (positive, negative or even zero) and change a_l, a_{l + 1}, ..., a_r by k each (i.e. a_i := a_i + k for each l ≤ i ... | [{"type": "stdin_stdout", "input": "39 1\n4 2 1 1 3 5 1 5 1 1 3 3 4 3 1 1 4 5 1 5 2 3 3 1 5 1 2 1 1 4 1 1 5 2 2 1 1 2 4\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "39 1\n4 2 1 1 3 5 1 5 1 1 3 3 4 3 1 1 4 5 1 5 3 3 3 1 5 1 2 1 1 4 1 1 5 2 2 1 1 2 4\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a_1, a_2, ..., a_n of integer numbers.\n\nYour task is to divide the array into the maximum number of segments in such a way that:\n\n * each element is contained in exactly one segment; \n * each... | [{"type": "stdin_stdout", "input": "100\n1065 362 1002 1071 502 252 1401 1824 887 1803 1572 1571 502 1408 1699 1750 1785 1507 1616 1458 372 323 939 1208 1639 1517 1145 319 935 1507 1094 156 1062 39 1884 1470 646 917 1699 631 39 789 1030 1589 1700 17 495 32 506 574 1458 206 1091 211 279 1617 1624 1183 572 1496 1014 2007... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWelcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market!\n\nIn the morning, there are n opport... | [{"type": "stdin_stdout", "input": "29 30 989\n450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 434\n451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451\n", "output": "1023\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA car number in Berland consists of exactly n digits. A number is called beautiful if it has at least k equal digits. Vasya wants to change the digits in his car's number so that the number became beautiful. To replace on... | [{"type": "stdin_stdout", "input": "490 406\n69376206583505466779821214863898994183223683064168986020986087427466188663988162816834873783630551758344308091300551677259892974326315461675692547390099840313192163258859011559750513086756892636598304230038445861422033560468535920495378496152301219687339355030990474992436599... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is a holiday season, and Koala is decorating his house with cool lights! He owns n lights, all of which flash periodically.\n\nAfter taking a quick glance at them, Koala realizes that each of his lights can be describe... | [{"type": "stdin_stdout", "input": "70\n0010011111011101101111000111101011010101000011000000010100010101010001\n3 1\n1 5\n3 1\n4 1\n3 3\n2 4\n2 1\n5 1\n2 4\n5 2\n5 2\n4 1\n2 5\n2 2\n4 2\n5 1\n1 2\n2 4\n3 1\n1 1\n5 3\n5 2\n3 5\n4 4\n2 1\n3 2\n1 3\n5 1\n3 4\n2 3\n1 5\n4 1\n2 2\n5 1\n3 3\n4 2\n1 4\n5 2\n1 2\n4 1\n1 4\n5 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have two integers l and r. Find an integer x which satisfies the conditions below:\n\n * l ≤ x ≤ r. \n * All digits of x are different. \n\n\n\nIf there are multiple answers, print any of them.\n\nInput\n\nThe first... | [{"type": "stdin_stdout", "input": "98766 110000\n", "output": "102345\n"}, {"type": "stdin_stdout", "input": "98766 110010\n", "output": "102345\n"}, {"type": "stdin_stdout", "input": "72073 145777\n", "output": "72081\n"}, {"type": "stdin_stdout", "input": "11097 145777\n", "output": "12034\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo players decided to play one interesting card game.\n\nThere is a deck of n cards, with values from 1 to n. The values of cards are pairwise different (this means that no two different cards have equal values). At the ... | [{"type": "stdin_stdout", "input": "2\n2 1 1\n2\n-1\n5 2 3\n1 3\n2 11 5\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\n2 1 1\n2\n-1\n5 2 3\n2 3\n2 2 5\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\n2 1 1\n2\n1\n5 2 3\n2 3\n-1 6 5\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Red Kingdom is attacked by the White King and the Black King!\n\nThe Kingdom is guarded by n castles, the i-th castle is defended by a_i soldiers. To conquer the Red Kingdom, the Kings have to eliminate all the defend... | [{"type": "stdin_stdout", "input": "10\n6 3 4 5\n2 3 2 3 1 3\n1 5 4 3\n10\n4 4 2 3\n0 10 14 5\n2 2 1 4\n8 5\n3 5 3 5\n9 2 10\n4 5 5 5\n2 10 2 2\n2 3 1 4\n1 10\n3 1 5 3\n11 8 7\n2 5 4 5\n8 8\n3 5 1 4\n5 2 10\n", "output": "0\n2\n3\n2\n5\n12\n5\n0\n0\n2\n"}, {"type": "stdin_stdout", "input": "10\n6 3 4 5\n2 3 2 3 1 3\n1 ... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.