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\nTakahashi recorded his daily life for the last few days as a integer sequence of length 2N, as follows:\n\n* a_1, b_1, a_2, b_2, ... , a_N, b_N\n\n\n\nThis means that, starting from a certain time T, he was:\n\n* sleeping... | [{"type": "stdin_stdout", "input": "10\n43196 57600\n4800 9600\n6000 1200\n600 600\n300 600\n5400 600\n6000 5760\n6760 2880\n6000 12000\n9000 600", "output": "5\n"}, {"type": "stdin_stdout", "input": "10\n43196 57600\n4800 9600\n6000 1200\n600 600\n300 600\n5400 600\n6000 5760\n6760 2880\n6000 12000\n9000 794", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s of length n consisting of lowercase English letters.\n\nFor two given strings s and t, say S is the set of distinct characters of s and T is the set of distinct characters of t. The strings s and ... | [{"type": "stdin_stdout", "input": "10 30\naccbaaccac\n6 8 3\n2 9 1\n6 8 3\n10 5 1\n6 2 2\n1 4 7\n3 10 1\n6 9 1\n7 7 3\n7 3 2\n8 4 1\n4 9 1\n7 6 4\n6 8 2\n10 2 1\n1 3 5\n5 10 1\n7 10 1\n4 1 2\n8 5 3\n9 8 1\n8 6 2\n6 9 2\n10 3 1\n3 9 1\n5 5 5\n1 5 6\n4 2 6\n10 7 1\n9 8 2\n", "output": "NO\nYES\nNO\nYES\nNO\nNO\nYES\nYES... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of length $n$ that has a special condition: every element in this array has at most 7 divisors. Find the length of the shortest non-empty subsequence of this array product of whose elements is a... | [{"type": "stdin_stdout", "input": "8\n6 15 35 129 143 221 34 26\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "8\n6 15 35 129 143 221 3 26\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "8\n6 15 35 129 143 221 3 51\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "8\n6 11 35 129 143 221 3 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the constraints.\n\nVova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $n$ consecutive pictures (with kitt... | [{"type": "stdin_stdout", "input": "25 4 15\n172043124 384297369 650214870 426077944 587045971 576701397 865475689 261462255 763837593 285228401 629011531 611623799 456424430 820020943 166915939 903479811 357808031 561107351 177427070 14589838 994169358 1227795556 193684940 439658261 237500762\n", "output": "1051264450... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYet another education system reform has been carried out in Berland recently. The innovations are as follows:\n\nAn academic year now consists of n days. Each day pupils study exactly one of m subjects, besides, each subj... | [{"type": "stdin_stdout", "input": "50 50 1\n1 1 1\n1 1 2\n1 1 3\n1 1 4\n1 1 5\n1 1 6\n1 1 7\n1 1 8\n1 1 9\n1 1 10\n1 1 11\n1 1 12\n1 1 13\n1 1 14\n1 1 15\n1 1 16\n1 1 17\n1 1 18\n1 1 19\n1 1 20\n1 1 21\n1 1 22\n1 1 23\n1 1 24\n1 1 25\n1 1 26\n1 1 27\n1 1 28\n1 1 29\n1 1 30\n1 1 31\n1 1 32\n1 1 33\n1 1 34\n1 1 35\n1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nAOR Ika got a cabbage with $ N $ leaves. The leaves of this cabbage are numbered $ 1, \\ ldots, N $ in order from the outside, and the dirtiness of the $ i $ th leaf is $ D_i $. The larger this value ... | [{"type": "stdin_stdout", "input": "16 6 10 -1\n24 1 4 -1 0", "output": "1\n"}, {"type": "stdin_stdout", "input": "16 6 10 -1\n24 1 5 -1 0", "output": "1\n"}, {"type": "stdin_stdout", "input": "21 10 0 4\n5 2 13 -1 0", "output": "3\n"}, {"type": "stdin_stdout", "input": "16 6 10 -1\n24 1 4 0 1", "output": "1\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShe catched the thrown coin that draws parabolic curve with her sparkling fingers. She is an ESPer. Yes, she is an electro-master who has the third strongest power among more than one million ESPers in the city. Being fli... | [{"type": "stdin_stdout", "input": "10.328181706040372\n1.2129508820938308 0.8573113359511872 1.4723271231711133 0.8719653577025106\n2.7936576829562947\n1.6284720172281655 0.042076349022347914 1.0082063051036116 0.8077902409181328\n0", "output": "impossible\nimpossible\n"}, {"type": "stdin_stdout", "input": "11.3176862... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. \"Do I give such a hard task?\" — the HR manager thought. \"Just raise number 5 to the power of n and get la... | [{"type": "stdin_stdout", "input": "2000000000000000000\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "1000001000000000000\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "1440563777463828705\n", "output": "25\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently a serious bug has been found in the FOS code. The head of the F company wants to find the culprit and punish him. For that, he set up an organizational meeting, the issue is: who's bugged the code? Each of the n ... | [{"type": "stdin_stdout", "input": "10 2\n10 2\n9 3\n9 4\n7 2\n4 6\n10 1\n9 2\n3 10\n7 1\n5 1\n", "output": "43\n"}, {"type": "stdin_stdout", "input": "10 3\n6 3\n6 10\n2 5\n5 7\n6 2\n9 2\n8 1\n10 5\n5 10\n7 6\n", "output": "34\n"}, {"type": "stdin_stdout", "input": "10 2\n10 2\n9 3\n9 4\n7 2\n4 6\n10 1\n9 2\n3 10\n7 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and the hard versions is constraints.\n\nA subsequence is a string that can be derived from another string by deleting some or no symbols without changing the order of the remaining sy... | [{"type": "stdin_stdout", "input": "100 1000000000000\ndjgykfqaywhkhpocyxcpvbiiouyielmighclnuopadzuvrirbecucwnzwahahagvfstbxxaednajfauscxwttiglbbxtomnnalcl\n", "output": "8854753825335\n"}, {"type": "stdin_stdout", "input": "100 1000000000000\ndjgykfqaywhkhpocyxcpvbiiouyielmighclnuopadzuvrirbecucwnzwahahagvfstbxxaednaj... | 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\nuza", "output": "no\n"}, {"type": "stdin_stdout", "input": "azjucamp\nazt", "output": "no\n"}, {"type": "stdin_stdout", "input": "az... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSuppose you are given a string $s$ of length $n$ consisting of lowercase English letters. You need to compress it using the smallest possible number of coins.\n\nTo compress the string, you have to represent $s$ as a conc... | [{"type": "stdin_stdout", "input": "255 3880 4590\nwgwzwgwuwgwzwgwxwgwzwgwuwgwzwgwewgwzwgwuwgwzwgwxwgwzwgwuwgwzwgwkwgwzwgwuwgwzwgwxwgwzwgwuwgwzwgwewgwzwgwuwgwzwgwxwgwzwgwuwgwzwgwawgwzwgwuwgwzwgwxwgwzwgwuwgwzwgwewgwzwgwuwgwzwgwxwgwzwgwuwgwzwgwkwgwzwgwuwgwzwgwxwgwzwgwuwgwzwgwewgwzwgwuwgwzwgwxwgwzwgwuwgwzwgw\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $n$ is always even, and in C2, $n$ is always odd.\n\nYou are given a regular polygon with $2 \\cdot n$ ... | [{"type": "stdin_stdout", "input": "100\n2\n4\n6\n8\n17\n12\n14\n16\n18\n20\n22\n24\n26\n28\n30\n32\n16\n36\n38\n40\n42\n44\n46\n48\n50\n80\n54\n56\n58\n60\n62\n64\n66\n68\n70\n72\n74\n11\n78\n80\n82\n84\n78\n17\n90\n92\n94\n96\n55\n100\n102\n104\n106\n108\n110\n139\n114\n229\n118\n120\n122\n124\n126\n128\n130\n132\n13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a grid of squares with N rows and M columns. Let (i, j) denote the square at the i-th row from the top and j-th column from the left. We will choose K of the squares and put a piece on each of them.\nIf we place t... | [{"type": "stdin_stdout", "input": "155776 1 112696\n", "output": "837491985\n"}, {"type": "stdin_stdout", "input": "200000 1 134405\n", "output": "945631888\n"}, {"type": "stdin_stdout", "input": "491 405 148903\n", "output": "206234613\n"}, {"type": "stdin_stdout", "input": "435 448 126173\n", "output": "779238467\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a pro... | [{"type": "stdin_stdout", "input": "+--+--+------+++++++-+-+++--++---+--+-+---+--+++-+++-------+++++-+-++++--+-+-+++++++----+----+++----+-+++-+++-----+++-+-++-+-+++++-+--++----+--+-++-----+-+-++++---+++---+-+-+-++++--+--+++---+++++-+---+-----+++-++--+++---++-++-+-+++-+-+-+---+++--+--++++-+-+--++-------+--+---++-----+++... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is studying number theory. He has denoted a function f(a, b) such that: f(a, 0) = 0; f(a, b) = 1 + f(a, b - gcd(a, b)), where gcd(a, b) is the greatest common divisor of a and b. \n\nVasya has two numbers x and y,... | [{"type": "stdin_stdout", "input": "999999999989 999999999988\n", "output": "999999999988\n"}, {"type": "stdin_stdout", "input": "414654652183 366894205623\n", "output": "366894205623\n"}, {"type": "stdin_stdout", "input": "999999999958 999999999957\n", "output": "499999999979\n"}, {"type": "stdin_stdout", "input": "99... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.\n\nThis time, the brothers are dealing with a strange piece of wood marked with ... | [{"type": "stdin_stdout", "input": "10\n9\nDDDDDDKDD\n10\nKKDDDDKKDK\n7\nKKDDKDK\n13\nKKKDDKDDDKKKD\n14\nKDDDDKDDKDKDKK\n9\nKKDDKDDKD\n14\nDKDKKKKKDDDKKK\n10\nKDKKDKKKKD\n11\nDDKDKKDDKKD\n3\nKKK\n", "output": "1 2 3 4 5 6 1 1 1 \n1 2 1 1 1 1 1 2 1 3 \n1 2 1 1 1 2 1 \n1 2 3 1 1 1 1 1 1 2 1 1 1 \n1 1 1 1 1 2 1 2 3 1 1 4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA competitive eater, Alice is scheduling some practices for an eating contest on a magical calendar. The calendar is unusual because a week contains not necessarily $7$ days!\n\nIn detail, she can choose any integer $k$ w... | [{"type": "stdin_stdout", "input": "5\n5 4\n2 4\n5 1\n13 9\n1010000 14106652\n", "output": "10\n2\n1\n45\n510049495001\n"}, {"type": "stdin_stdout", "input": "5\n6 4\n3 2\n3 1\n13 7\n1010000 14106652\n", "output": "10\n3\n1\n28\n510049495001\n"}, {"type": "stdin_stdout", "input": "5\n5 4\n2 4\n5 1\n13 9\n1010000 129640... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string is called bracket sequence if it does not contain any characters other than \"(\" and \")\". A bracket sequence is called regular if it it is possible to obtain correct arithmetic expression by inserting characte... | [{"type": "stdin_stdout", "input": "1000000000\n1000000000\n1000000000\n1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000\n1000000000\n1000000000\n1000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1000000000\n1000000000\n1000000000\n999999999\n", "output": "0\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMasha has three sticks of length $a$, $b$ and $c$ centimeters respectively. In one minute Masha can pick one arbitrary stick and increase its length by one centimeter. She is not allowed to break sticks.\n\nWhat is the mi... | [{"type": "stdin_stdout", "input": "100 100 100\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100 100 100\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100 10 10\n", "output": "81\n"}, {"type": "stdin_stdout", "input": "100 100 99\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100 100 99... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call two strings $s$ and $t$ anagrams of each other if it is possible to rearrange symbols in the string $s$ to get a string, equal to $t$.\n\nLet's consider two strings $s$ and $t$ which are anagrams of each other.... | [{"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 4\n2 4\n2 2\n2 9\n2 7\n1 5\n", "output": "Yes\nYes\nYes\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 4\n2 4\n2 2\n2 9\n5 7\n1 5\n", "output": "Yes\nYes\nYes\nYes\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "aabbbbbbc\n6\n1 4\n2 4\n2 2\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHQ9+ is a joke programming language which has only four one-character instructions:\n\n * \"H\" prints \"Hello, World!\",\n * \"Q\" prints the source code of the program itself,\n * \"9\" prints the lyrics of \"99 Bott... | [{"type": "stdin_stdout", "input": "mzbmweyydiadtlcouegmdbyfwurpwbpuvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnkH\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "Qzbmweyydiadtlcouegmdbyfwurpwbpuvhifnuapwyndmhtqvkgkbhtytszotwflegsjzzszfwtzfpnscguemwrczqxycivdqnky\n", "output": "YES\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has $n$ coins, the value of the $i$-th coin is $a_i$. It is guaranteed that all the values are integer powers of $2$ (i.e. $a_i = 2^d$ for some non-negative integer number $d$).\n\nPolycarp wants to know answers ... | [{"type": "stdin_stdout", "input": "1 10\n8\n1\n2\n3\n4\n5\n6\n7\n13\n17\n16\n", "output": "-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "1 10\n8\n1\n2\n3\n4\n5\n6\n7\n13\n9\n16\n", "output": "-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "1 10\n8\n1\n2\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 increase creativity by drawing pictures. Let's draw a pattern w... | [{"type": "stdin_stdout", "input": "2\n1 3\n1 1\nRRRR\nRRGR\nRBRR\nRRRR", "output": "10\n"}, {"type": "stdin_stdout", "input": "2\n2 0\n1 1\nRRRR\nRRGR\nRBRR\nRRRR", "output": "16\n"}, {"type": "stdin_stdout", "input": "2\n2 0\n2 1\nRRRR\nRRGR\nRBRR\nRRRR", "output": "10\n"}, {"type": "stdin_stdout", "input": "2\n2 -1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this reason it was excluded from the contest. This mistake have been fixed and the current given p... | [{"type": "stdin_stdout", "input": "20\n1306340891 192811911 592111899 609607891 585084800 601258511 223103775 164258550 858003275 230837577 971499807 312977833 344314550 397998873 558637732 216574673 913028292 1360238301 464376621 61315042\n", "output": "384683838\n"}, {"type": "stdin_stdout", "input": "20\n713900269 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.\n\nMehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, given n, print the la... | [{"type": "stdin_stdout", "input": "1000000000\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "1902349577\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "0000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "1065810635\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1760197508\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction <image> as a sum of three distinct positive fractions in form <image>.\n\nHelp ... | [{"type": "stdin_stdout", "input": "10000\n", "output": "10000 10001 100010000 "}, {"type": "stdin_stdout", "input": "17554\n", "output": "17554 17555 308160470\n"}, {"type": "stdin_stdout", "input": "10023\n", "output": "10023 10024 100470552\n"}, {"type": "stdin_stdout", "input": "19176\n", "output": "19176 19177 367... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently n students from city S moved to city P to attend a programming camp.\n\nThey moved there by train. In the evening, all students in the train decided that they want to drink some tea. Of course, no two people can ... | [{"type": "stdin_stdout", "input": "19\n1\n1 1\n1\n1 2\n1\n1 1000\n1\n1 2000\n1\n2 2\n1\n2 3\n1\n2 1000\n1\n2 2000\n1\n1999 1999\n1\n1999 2000\n1\n2000 2000\n2\n1 1\n1 1\n2\n1 1\n1 2\n2\n1 2\n1 1\n2\n1 2000\n1 1\n2\n1 1\n1 2000\n2\n1 2000\n2 2\n2\n2 2000\n2 2\n2\n2 2\n2 2000\n", "output": "1 \n1 \n1 \n1 \n2 \n2 \n2 \n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nWe played an AI soccer match between Country A and Country B. You have a table that records the player who had the ball at a certain time and its position. The table consists of N rows, and the i-th r... | [{"type": "stdin_stdout", "input": "5\n0 1 0 3 4\n30 1 0 3 4\n90 2 0 6 8\n120 1 1 1 1\n132 2 1 2 2", "output": "5.00000000 1.00000000\n1.41421356 0.20000000"}, {"type": "stdin_stdout", "input": "5\n0 2 0 3 4\n16 1 0 1 4\n155 2 0 6 13\n103 1 1 1 1\n132 -1 1 1 2", "output": "10.295630 2.316667\n1.000000 0.483333\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection o... | [{"type": "stdin_stdout", "input": "100\nqn\nBE\nyN\nep\nPq\nXz\nLM\nEZ\ndb\nMn\nbn\nFe\nqA\nzc\nyq\npC\nyA\nWk\nYq\nrs\noD\nvD\nzW\nxZ\nbl\nur\nkf\ndf\nLS\nUW\nMy\nhR\nsh\nNh\nog\nCW\nor\nzo\nrO\nao\nXH\nDq\nKa\nlL\nYQ\nOh\nRZ\nAx\nta\nko\nDn\nNg\nNy\nDB\nYD\njO\nAp\nFT\noB\nNc\nwB\nHO\neW\nAc\nDr\nMt\nDf\nbF\nFP\nRa\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLeonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lac... | [{"type": "stdin_stdout", "input": "10 19 10\nV 6\nH 8\nV 4\nV 8\nH 2\nH 5\nV 9\nH 7\nH 3\nV 7\n", "output": "114\n66\n44\n44\n44\n44\n44\n44\n44\n44\n"}, {"type": "stdin_stdout", "input": "15 5 10\nV 13\nV 6\nV 3\nH 4\nV 12\nV 7\nV 2\nH 1\nV 4\nH 3\n", "output": "65\n35\n35\n28\n24\n20\n20\n15\n15\n10\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiga Tower is the tallest and deepest building in Cyberland. There are 17 777 777 777 floors, numbered from - 8 888 888 888 to 8 888 888 888. In particular, there is floor 0 between floor - 1 and floor 1. Every day, tho... | [{"type": "stdin_stdout", "input": "-1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "-1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "-1325769607\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "-1737641826\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "-4100583... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou received a notebook which is called Death Note. This notebook has infinite number of pages. A rule is written on the last page (huh) of this notebook. It says: \"You have to write names in this notebook during $n$ con... | [{"type": "stdin_stdout", "input": "16 2\n999999999 999999999 999999999 856501885 1080831631 999999999 768581442 1196229362 999999999 999999999 1341911334 1890212075 1581621479 999999999 999999999 999999999\n", "output": "499999999 500000000 499999999 428250943 540415815 500000000 384290721 598114681 499999999 50000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEdward Leven loves multiples of eleven very much. When he sees a number, he always tries to find consecutive subsequences (or substrings) forming multiples of eleven. He calls such subsequences as 11-sequences. For exampl... | [{"type": "stdin_stdout", "input": "17819\n1011\n11011\n1234567891011121314151617181920\n0", "output": "1\n1\n4\n38\n"}, {"type": "stdin_stdout", "input": "17819\n1010\n11011\n1234567891011121314151617181920\n0", "output": "1\n0\n4\n38\n"}, {"type": "stdin_stdout", "input": "17819\n1011\n11011\n130083111483873165421240... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn programming, hexadecimal notation is often used.\nIn hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters A, B, C, D, E and F are used to represent the values 10, 11, 12, 13, 14 and 15, respective... | [{"type": "stdin_stdout", "input": "A B\n", "output": "<\n"}, {"type": "stdin_stdout", "input": "E C\n", "output": ">\n"}, {"type": "stdin_stdout", "input": "F F\n", "output": "=\n"}, {"type": "stdin_stdout", "input": "E F", "output": "<\n"}, {"type": "stdin_stdout", "input": "A A", "output": "=\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSaMer has written the greatest test case of all time for one of his problems. For a given array of integers, the problem asks to find the minimum number of groups the array can be divided into, such that the product of an... | [{"type": "stdin_stdout", "input": "80\n8861 -8846 -3257 8263 -8045 4549 9626 -6582 5755 -3559 5813 -7411 9151 -1847 2441 4201 2381 4651 -6571 199 -6737 -6333 -9433 -4967 9041 -9319 6801 5813 -2731 -8599 7681 -1303 -7333 6067 -1847 -6333 6047 -7907 -7333 8677 -937 829 2441 -5702 -8045 -3037 -4882 -7703 9001 -5702 -2039... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new e-mail service \"Berlandesk\" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to impl... | [{"type": "stdin_stdout", "input": "10\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzzzzzz\nzzzzzzzzzzzzzzzzzzzzzzz... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He will then press the sn... | [{"type": "stdin_stdout", "input": "42\n15 44\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "26\n04 58\n", "output": "26\n"}, {"type": "stdin_stdout", "input": "35\n15 25\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "50\n01 59\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "46\n06 16\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes ch... | [{"type": "stdin_stdout", "input": "24\n17:30\n", "output": "17:30\n"}, {"type": "stdin_stdout", "input": "12\n17:30\n", "output": "07:30\n"}, {"type": "stdin_stdout", "input": "24\n99:99\n", "output": "09:09\n"}, {"type": "stdin_stdout", "input": "12\n05:54\n", "output": "05:54\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're given an undirected graph with $n$ nodes and $m$ edges. Nodes are numbered from $1$ to $n$.\n\nThe graph is considered harmonious if and only if the following property holds: For every triple of integers $(l, m, r... | [{"type": "stdin_stdout", "input": "1460 5\n100 300\n200 735\n420 117\n559 450\n435 900\n", "output": "795\n"}, {"type": "stdin_stdout", "input": "1460 5\n101 300\n200 735\n420 117\n559 450\n435 900\n", "output": "794\n"}, {"type": "stdin_stdout", "input": "1460 5\n100 300\n200 735\n420 117\n559 450\n435 460\n", "outpu... | 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\nTak performed the following action N times: rolling two dice.\nThe result of the i-th roll is D_{i,1} and D_{i,2}.\nCheck if doublets occurred at least three times in a row.\nSpecifically, check if there exists at lease o... | [{"type": "stdin_stdout", "input": "100\n3 3\n1 1\n5 5\n4 4\n1 1\n3 3\n3 3\n5 5\n2 2\n3 3\n2 2\n2 2\n3 3\n3 3\n5 5\n3 3\n1 1\n3 3\n4 4\n1 1\n4 4\n3 3\n3 3\n4 4\n6 6\n5 5\n2 2\n6 6\n3 3\n1 1\n6 6\n4 4\n3 3\n3 3\n6 6\n2 2\n5 5\n5 5\n1 1\n1 1\n5 5\n6 6\n6 6\n4 4\n6 6\n6 6\n5 5\n3 3\n2 2\n1 1\n1 1\n4 4\n6 6\n5 5\n3 3\n2 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. ... | [{"type": "stdin_stdout", "input": "cicdcdikggfdibkibjdcfgafkdbkjeddbfeacceegecdjeeaedigcjehdjekibjhfdidebkhagibgfiafejfdckcadgcacgbgbcekbcebgeccekejkdkecabakffakjhkjigbaddkbeagfkcacbebfccdgcdihgigcjchgdkfikhceaefibkagaaekj\n", "output": "0.44385026737967914\n"}, {"type": "stdin_stdout", "input": "cicdcdikggfdibkibjdcf... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$n$ towns are arranged in a circle sequentially. The towns are numbered from $1$ to $n$ in clockwise order. In the $i$-th town, there lives a singer with a repertoire of $a_i$ minutes for each $i \\in [1, n]$.\n\nEach sin... | [{"type": "stdin_stdout", "input": "4\n3\n12 16 14\n1\n1\n3\n1 2 3\n6\n81 75 75 93 93 87\n", "output": "YES\n3 1 3 \nYES\n1 \nNO\nYES\n5 5 4 1 4 5 \n"}, {"type": "stdin_stdout", "input": "4\n3\n12 16 14\n1\n1\n3\n1 2 3\n6\n81 75 75 93 93 87\n", "output": "YES\n3 1 3 \nYES\n1 \nNO\nYES\n5 5 4 1 4 5 \n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\n-----Constraints-----\n - \\alpha is an uppercase (A - Z) or lowercase (a - z) En... | [{"type": "stdin_stdout", "input": "B\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "a\n", "output": "a\n"}, {"type": "stdin_stdout", "input": "A\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "G\n", "output": "A\n"}, {"type": "stdin_stdout", "input": "Y\n", "output": "A\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is the faculty of Computer Science in Berland. In the social net \"TheContact!\" for each course of this faculty there is the special group whose name equals the year of university entrance of corresponding course o... | [{"type": "stdin_stdout", "input": "5\n2043 2042 2041 2044 2040\n", "output": "2042\n"}, {"type": "stdin_stdout", "input": "5\n2012 2013 2014 2015 2016\n", "output": "2014\n"}, {"type": "stdin_stdout", "input": "5\n2011 2014 2012 2013 2010\n", "output": "2012\n"}, {"type": "stdin_stdout", "input": "5\n2014 2013 2011 20... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nC: Short-circuit evaluation\n\nproblem\n\nNaodai-kun and Hokkaido University-kun are playing games. Hokkaido University first generates the following logical formula represented by BNF.\n\n\n<formula> :: = <or-expr>\n<or-... | [{"type": "stdin_stdout", "input": "?&?&?|?|?&?", "output": "3 2\n"}, {"type": "stdin_stdout", "input": "?|?&?|?&?&?", "output": "3 1\n"}, {"type": "stdin_stdout", "input": "?&?&?|?&?|?", "output": "3 3\n"}, {"type": "stdin_stdout", "input": "?&?|?|?&?&?", "output": "3 2\n"}, {"type": "stdin_stdout", "input": "?|?|?&?&... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJATC loves Banh-mi (a Vietnamese food). His affection for Banh-mi is so much that he always has it for breakfast. This morning, as usual, he buys a Banh-mi and decides to enjoy it in a special way.\n\nFirst, he splits the... | [{"type": "stdin_stdout", "input": "10 8\n0110000110\n3 3\n1 10\n4 4\n1 8\n1 2\n9 10\n2 10\n3 9\n", "output": "1\n960\n0\n224\n2\n2\n480\n112\n"}, {"type": "stdin_stdout", "input": "10 8\n0110000110\n3 3\n1 10\n4 4\n1 8\n1 2\n9 10\n2 10\n3 9\n", "output": "1\n960\n0\n224\n2\n2\n480\n112\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne of the simple ciphers is the affine cipher. First, replace the letters a to z with the numbers a = 0, b = 1, c = 2, ..., x = 23, y = 24, z = 25 and 0 to 25. Then replace the original alphabet with the following formul... | [{"type": "stdin_stdout", "input": "1\nx eazqyp pnop pngtg ye obmpngt xmybp mr lygw", "output": "p submit that there is another point of view\n"}, {"type": "stdin_stdout", "input": "1\nx pyqzae pnop pngtg ye obmpngt xmybp mr lygw", "output": "p timbus that there is another point of view\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given sequence a_1, a_2, ..., a_{n} and m queries l_{j}, r_{j} (1 ≤ l_{j} ≤ r_{j} ≤ n). For each query you need to print the minimum distance between such pair of elements a_{x} and a_{y} (x ≠ y), that: both inde... | [{"type": "stdin_stdout", "input": "10 6\n4 2 1 5 12 7 9 8 10 4\n1 3\n1 10\n2 10\n2 9\n5 5\n2 8\n", "output": "-1\n9\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "10 6\n4 2 1 5 6 7 9 8 10 4\n1 3\n1 10\n2 10\n2 9\n5 5\n2 8\n", "output": "-1\n9\n-1\n-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "10 6\n4 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlperen is standing at the point $(0,0)$. He is given a string $s$ of length $n$ and performs $n$ moves. The $i$-th move is as follows:\n\nif $s_i = {L}$, then move one unit left;\n\nif $s_i = {R}$, then move one unit rig... | [{"type": "stdin_stdout", "input": "9\n7\nUUURDDL\n2\nUR\n8\nRRRUUDDD\n3\nLLL\n4\nDUUR\n5\nRUDLL\n11\nLLLLDDRUDRD\n10\nLLLLDDRUDR\n5\nRUDLL\n", "output": "YES\nYES\nNO\nNO\nYES\nYES\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "7\n7\nUUURDDL\n2\nUR\n8\nRRRUUDDD\n3\nLLL\n4\nDUUR\n5\nRUDLL\n11\nLLLLDDRUDRD\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe will buy a product for N yen (the currency of Japan) at a shop.\nIf we use only 1000-yen bills to pay the price, how much change will we receive?\nAssume we use the minimum number of bills required.\n\n-----Constraints... | [{"type": "stdin_stdout", "input": "1900\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "1001\n", "output": "999\n"}, {"type": "stdin_stdout", "input": "4575\n", "output": "425\n"}, {"type": "stdin_stdout", "input": "6426\n", "output": "574\n"}, {"type": "stdin_stdout", "input": "9445\n", "output": "555\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nI: Ravage\n\nSanta Claus was caught in the illuminations of the city and broke it.\n\nThere are N light bulbs in the illumination, and the $ i $ th light bulb only comes on when the voltage is above $ A_i $ and below $ B_... | [{"type": "stdin_stdout", "input": "4\n-1 2\n3 2\n-1 4\n-1 15", "output": "3\n"}, {"type": "stdin_stdout", "input": "4\n-4 2\n0 10\n3 7\n-2 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "4\n-4 2\n0 10\n3 2\n-2 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "4\n-4 2\n0 10\n3 2\n-4 2", "output": "3\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a number axis directed from the left rightwards, n marbles with coordinates x1, x2, ..., xn are situated. Let's assume that the sizes of the marbles are infinitely small, that is in this task each of them is assumed to... | [{"type": "stdin_stdout", "input": "15\n-241250505 -2\n-241250503 0\n-241250502 -5\n-241250501 -1\n-241250500 -3\n-241250499 2\n-241250498 -2\n-241250497 6\n-241250496 0\n-241250495 0\n-241250494 8\n-241250493 -5\n-241250492 7\n-241250491 -7\n-241250490 2\n", "output": "-20\n"}, {"type": "stdin_stdout", "input": "15\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must.\n\nLittle Tommy finds an old polynomial and cleaned it up by taking it modulo another. But now he regrets doing thi... | [{"type": "stdin_stdout", "input": "20180214 5\n", "output": "11\n 4 3 4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a word W and a text T, and prints the number of word W which appears in text T\n\nT consists of string Ti separated by space characters and newlines. Count the number of Ti which equals to W. T... | [{"type": "stdin_stdout", "input": "computer\nNurtures computer scientists and highly-skilled computer engineers\nwho will create and exploit \"knowledge\" for the enw era.\nProvides an outstanding computer environment.\nEND_OF_TEXT", "output": "3\n"}, {"type": "stdin_stdout", "input": "comquter\nNurtures computer scie... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKarlsson has visited Lillebror again. They found a box of chocolates and a big whipped cream cake at Lillebror's place. Karlsson immediately suggested to divide the sweets fairly between Lillebror and himself. Specificall... | [{"type": "stdin_stdout", "input": "O O .\n O O . .\n. . . . .\n . . . .\n . O .\n", "output": "Lillebror\n"}, {"type": "stdin_stdout", "input": ". . O\n . O O .\nO . O . O\n O O O O\n . . O\n", "output": "Lillebror\n"}, {"type": "stdin_stdout", "input": "O O O\n O . O .\nO . . O O\n O . O O\n O O O\n", "output": "L... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe solution of $ x ^ 3 = q $ is to calculate the recurrence formula $ x_ {n + 1} = x_n-\\ frac {x_ {n} ^ 3 --q} {3x_ {n} ^ 2} $ It can be calculated approximately with.\n\nPut a positive number $ \\ frac {q} {2} $ in $ x... | [{"type": "stdin_stdout", "input": "15\n153\n-1", "output": "2.466212\n5.348481\n"}, {"type": "stdin_stdout", "input": "15\n123\n-1", "output": "2.466212\n4.973190\n"}, {"type": "stdin_stdout", "input": "15\n194\n-1", "output": "2.466212\n5.788963\n"}, {"type": "stdin_stdout", "input": "15\n103\n-1", "output": "2.46621... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor the given sequence with n different elements find the number of increasing subsequences with k + 1 elements. It is guaranteed that the answer is not greater than 8·1018.\n\nInput\n\nFirst line contain two integer valu... | [{"type": "stdin_stdout", "input": "100 7\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some reason they prefer name \"snookah\")! When a competition takes place somewhere far from their hometow... | [{"type": "stdin_stdout", "input": "50\nPFH\nJFV->PFH\nBVP->PFH\nPFH->BVP\nPFH->JFV\nPFH->ETQ\nPFH->LQJ\nZTO->PFH\nPFH->BVP\nPFH->RXO\nPFH->ZTO\nHWL->PFH\nPFH->HIV\nPFH->AFP\nPFH->HWL\nOBB->PFH\nHIV->PFH\nPFH->LSR\nAFP->PFH\nLQJ->PFH\nHWL->PFH\nETQ->PFH\nPFH->HWL\nLSR->PFH\nWBR->PFH\nBNZ->PFH\nHQR->PFH\nZTO->PFH\nPFH->... | 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 \\le l \\le r \\le n$) and integer value $k$ (positive, negative or even zero) and change $a_l, a_{l + 1}, \\dots, a_r$ by $k$ each (i.e. $a_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 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": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\n-----Notes-----\nThe median of X_1, X_2, \... | [{"type": "stdin_stdout", "input": "3\n111 110\n111 11100\n-2 1111011010", "output": "10990\n"}, {"type": "stdin_stdout", "input": "3\n011 110\n111 11100\n-2 1111011010", "output": "11090\n"}, {"type": "stdin_stdout", "input": "3\n010 110\n111 11100\n-2 1111011010", "output": "11091\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's the year 4527 and the tanks game that we all know and love still exists. There also exists Great Gena's code, written in 2016. The problem this code solves is: given the number of tanks that go into the battle from e... | [{"type": "stdin_stdout", "input": "6\n1000000000000000000000000000000000000 11965651543 1000000000000000000000000000000000000 1000000000000000000000000000000000000 1000000000000000000000000000000000000 1000000000000000000000000000000000000\n", "output": "1196565154300000000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.\n\nDuring one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the c... | [{"type": "stdin_stdout", "input": "2\n2 9\n5\n4 10 7 3 4\n", "output": " 2 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nNow elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you.\n\nThere are $n$ voters, and two ways to... | [{"type": "stdin_stdout", "input": "3\n3\n1 5\n2 10\n2 15\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 15\n2 7\n4 4\n5 5\n", "output": "10\n0\n7\n"}, {"type": "stdin_stdout", "input": "3\n3\n1 5\n2 10\n2 4\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 14\n2 1\n4 4\n5 5\n", "output": "4\n0\n4\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer has N square tiles. The tiles are numbered 1 through N, and the number given to each tile is written on one side of the tile. Also, each corner of each tile is painted in one of the 1000 colors, which ar... | [{"type": "stdin_stdout", "input": "400\n196 345 527 695\n685 207 136 831\n303 497 409 762\n464 670 120 403\n867 799 702 490\n986 9 287 852\n519 89 617 973\n291 551 957 275\n329 210 75 744\n685 560 225 510\n568 429 313 112\n94 659 30 204\n51 891 791 326\n890 977 807 600\n203 468 753 791\n738 279 376 58\n377 694 954 955... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which prints the central coordinate ($cx$,$cy$) and the radius $r$ of a incircle of a triangle which is constructed by three points ($x_1$, $y_1$), ($x_2$, $y_2$) and ($x_3$, $y_3$) on the plane surface.\n... | [{"type": "stdin_stdout", "input": "1 -2\n3 2\n-2 0", "output": "0.53907943898209422325 -0.26437392711448356856 1.18845545916395465278"}, {"type": "stdin_stdout", "input": "0 3\n4 0\n0 0", "output": "1.00000000000000000000 1.00000000000000000000 1.00000000000000000000"}, {"type": "stdin_stdout", "input": "1 6\n-1 -3\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe academic year has just begun, but lessons and olympiads have already occupied all the free time. It is not a surprise that today Olga fell asleep on the Literature. She had a dream in which she was on a stairs. \n\nTh... | [{"type": "stdin_stdout", "input": "50\nUUUUUUUUUUUUUUUUUUUUUUUUUDDDDDDDDDDDDDDDDDDDDDDDDD\n", "output": "51 102 153 204 255 306 357 408 459 510 561 612 663 714 765 816 867 918 969 1020 1071 1122 1173 1224 1275 1275 1224 1173 1122 1071 1020 969 918 867 816 765 714 663 612 561 510 459 408 357 306 255 204 153 102 51 "}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Bender has a digital table of size n × n, each cell can be switched on or off. He wants the field to have at least c switched on squares. When this condition is fulfilled, Mr Bender will be happy.\n\nWe'll consider th... | [{"type": "stdin_stdout", "input": "1000000000 504951981 646612086 602763371\n", "output": "17360\n"}, {"type": "stdin_stdout", "input": "1000000000 999999946 999999941 715189365\n", "output": "37707\n"}, {"type": "stdin_stdout", "input": "1000000000 999999916 999999940 857945620\n", "output": "41279\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is competing in a sumo tournament. The tournament lasts for 15 days, during which he performs in one match per day. If he wins 8 or more matches, he can also participate in the next tournament.\n\nThe matches fo... | [{"type": "stdin_stdout", "input": "xoxoxoxoxoxoxo", "output": "YES\n"}, {"type": "stdin_stdout", "input": "oxoxowoxoxoxox", "output": "YES\n"}, {"type": "stdin_stdout", "input": "oxoxowoooxoxxx", "output": "YES\n"}, {"type": "stdin_stdout", "input": "xxxoxooowoxoxo", "output": "YES\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohn has just bought a new car and is planning a journey around the country. Country has N cities, some of which are connected by bidirectional roads. There are N - 1 roads and every city is reachable from any other city.... | [{"type": "stdin_stdout", "input": "4\n1 2\n2 3\n3 4\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n2 3\n3 4\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n1 3\n3 4\n", "output": "24\n"}, {"type": "stdin_stdout", "input": "4\n1 2\n2 3\n2 4\n", "output": "14\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXenia lives in a city that has n houses built along the main ringroad. The ringroad houses are numbered 1 through n in the clockwise order. The ringroad traffic is one way and also is clockwise.\n\nXenia has recently move... | [{"type": "stdin_stdout", "input": "100 100\n48 73 63 16 49 88 36 17 66 6 87 13 94 52 58 70 71 52 7 70 25 42 24 36 57 9 79 26 75 39 13 14 38 26 33 66 88 28 75 98 53 48 67 54 63 25 69 87 88 32 72 17 36 35 29 67 74 89 70 47 20 90 78 13 94 57 32 73 29 74 45 78 85 64 81 56 12 65 19 67 34 86 55 71 41 33 76 13 100 47 44 76 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string is called a KEYENCE string when it can be changed to `keyence` by removing its contiguous substring (possibly empty) only once.\n\nGiven a string S consisting of lowercase English letters, determine if S is a KEY... | [{"type": "stdin_stdout", "input": "eeyofscienck", "output": "NO\n"}, {"type": "stdin_stdout", "input": "eeyofsciencj", "output": "NO\n"}, {"type": "stdin_stdout", "input": "eeyofscienci", "output": "NO\n"}, {"type": "stdin_stdout", "input": "eeyofscjenci", "output": "NO\n"}, {"type": "stdin_stdout", "input": "icnejcsf... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOleg's favorite subjects are History and Math, and his favorite branch of mathematics is division.\n\nTo improve his division skills, Oleg came up with $t$ pairs of integers $p_i$ and $q_i$ and for each pair decided to fi... | [{"type": "stdin_stdout", "input": "10\n238517256500070918 988176216\n363959778883784349 933416507\n631238591652944446 530795521\n557307185726829409 1481431174\n86402035814143715 513728064\n101626841876448103 26556040\n598448092106640578 746411314\n733629261048200000 361714100\n624561301519202735 38\n106258810456388771... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEdo has got a collection of n refrigerator magnets!\n\nHe decided to buy a refrigerator and hang the magnets on the door. The shop can make the refrigerator with any size of the door that meets the following restrictions:... | [{"type": "stdin_stdout", "input": "20 5\n1 12 21 22\n9 10 15 20\n10 12 12 20\n1 1 25 29\n5 10 21 22\n4 9 16 25\n12 10 14 24\n3 3 19 27\n3 4 23 28\n12 1 11 31\n9 14 17 18\n8 12 14 20\n8 11 18 19\n12 3 14 29\n7 8 13 22\n6 4 16 30\n11 3 13 27\n9 16 15 18\n6 13 14 21\n9 12 15 22\n", "output": "4\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation of numbers from 1 to n. Determine whether there's a pair of integers a, b (1 ≤ a, b ≤ n; a ≠ b) such that the element <image> (note, that it is usual division, not integer one) is between a and... | [{"type": "stdin_stdout", "input": "100\n1 65 33 97 17 81 49 11 73 41 25 89 57 5 69 39 21 85 53 13 77 45 29 93 61 3 67 60 99 19 83 51 11 75 43 27 91 59 7 71 39 23 87 55 15 79 47 31 2 95 63 66 34 98 18 82 50 10 74 42 26 90 58 6 70 38 22 86 54 14 78 46 30 94 62 4 68 36 100 20 84 52 12 76 44 28 92 60 8 72 40 24 88 56 16 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has k matches, placed in n matchboxes lying in a line from left to right. We know that k is divisible by n. Petya wants all boxes to have the same number of matches inside. For that, he can move a match from its box... | [{"type": "stdin_stdout", "input": "100\n6 3 4 5 3 4 2 4 1 2 4 1 8 5 2 2 4 4 6 8 4 10 4 4 6 8 6 5 5 4 8 4 3 3 6 5 7 2 9 7 6 5 6 3 2 6 8 10 3 6 8 7 2 3 5 4 8 6 5 6 6 8 4 1 5 6 1 8 12 5 3 3 8 2 4 2 4 5 6 6 9 5 1 2 8 8 3 7 5 3 4 5 7 6 3 9 4 6 3 6\n", "output": "867\n"}, {"type": "stdin_stdout", "input": "100\n6 3 4 5 3 4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of lowercase English letters.\nAnother string T is initially empty.\nDetermine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:... | [{"type": "stdin_stdout", "input": "dreamereraserdreamererasereraseeraserdreamererasereraserdreamdreamerdreamerdreamerdreamererasedreamereraseeraserdreamereraserdreamereraseeraserdreamdreamdreamerdreamerdreamerdreamdreamerdreameraseerasedreamererasererasererasedreamereraseerasererasedreamerasereraserdreamerdreamerasedr... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ houses along the road where Anya lives, each one is painted in one of $k$ possible colors.\n\nAnya likes walking along this road, but she doesn't like when two adjacent houses at the road have the same color... | [{"type": "stdin_stdout", "input": "100 100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 109 47 21 78 20 63 13 49 76 36 41 79 16 87 87 69 3 76 80 60 100 62 70 59 72 8 38 71 45 97 71 14 76 54 81 4 59 46 39 29 92 3 49 22 53 99 59 52 74 31 92 43 42 23 44 9 82 47 7 40 12 9 3 55 37 85 46 22 84 52 98 41 ... | 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\nWabbit is playing a game with $n$ bosses numbered from $1$ to $n$. The bosses can be fought in any order. Each boss needs to be defeated exactly once. There is a parameter called boss bonus which is initially $0$.\n\nWhen... | [{"type": "stdin_stdout", "input": "70 2\n1 1 1 1 1 -1 -1 -1 -1 -1 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3 -3\n", "output": "-1685\n"}, {"type": "stdin_stdout", "input": "10 3\n950 88... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?\n\nThe market analysts came up with a very smart plan: the n... | [{"type": "stdin_stdout", "input": "OVWIHIWVYXMVAAAATOXWOIUUHYXHIHHVUIOOXWHOXTUUMUUVHVWWYUTIAUAITAOMHXWMTTOIVMIVOTHOVOIOHYHAOXWAUVWAVIVM\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "QDPINBMCRFWXPDBFGOZVVOCEMJRUCTOADEWEGTVBVBFWWRPGYEEYGPRWWFBVBVTGEWEDAOTCURJMECOVVZOGFBDPXWFRCMBNIPDQ\n", "output": "NO\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it.\n\nConstraints\n\n* The length ... | [{"type": "stdin_stdout", "input": "acc", "output": "cca\n"}, {"type": "stdin_stdout", "input": "acb", "output": "bca\n"}, {"type": "stdin_stdout", "input": "adb", "output": "bda\n"}, {"type": "stdin_stdout", "input": "`cb", "output": "bc`\n"}, {"type": "stdin_stdout", "input": "bc`", "output": "`cb\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string, consisting of lowercase Latin letters.\n\nA pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string \"abaca\" contains ... | [{"type": "stdin_stdout", "input": "100\nc\nda\na\nee\ned\ndb\nece\nab\nabe\nd\neeb\na\nbab\nbbd\nc\ncab\nc\nbda\ndb\ncca\nbcd\nbae\neb\nde\ndc\naee\nada\nba\nab\nde\ned\nae\nbc\nbec\ndae\nc\nb\ndab\nd\na\ndbd\nda\nb\ne\nde\nbe\nc\na\nb\nc\nbac\nee\nb\ncce\nc\nde\nc\ndee\ned\ncb\nb\ndc\ncc\na\neb\nec\nbcd\na\ndc\nf\nce... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two arrays: an array $a$ consisting of $n$ zeros and an array $b$ consisting of $n$ integers.\n\nYou can apply the following operation to the array $a$ an arbitrary number of times: choose some subsegment of... | [{"type": "stdin_stdout", "input": "17 10\n465 868 29 633 291 357 62 929 22 124 182 995 903 75 71 924 416\n", "output": "611\n"}, {"type": "stdin_stdout", "input": "1 1\n1000000000000\n", "output": "1000000000000\n"}, {"type": "stdin_stdout", "input": "7 4\n1 10000 1 1 1 1 10000\n", "output": "7500\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem at each moment you have a set of intervals. You can move from interval (a, b) from our set to interval (c, d) from our set if and only if c < a < d or c < b < d. Also there is a path from interval I_1 from... | [{"type": "stdin_stdout", "input": "20\n1 1208 1583\n1 -258 729\n1 -409 1201\n1 194 1938\n1 -958 1575\n1 -1466 1752\n2 1 2\n2 1 2\n2 6 5\n1 -1870 1881\n1 -2002 2749\n1 -2002 2984\n1 -2002 3293\n2 2 4\n2 8 10\n2 9 6\n1 -2002 3572\n1 -2002 4175\n1 -2002 4452\n1 -2002 4605\n", "output": "YES\nYES\nYES\nYES\nYES\nNO\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDrazil is playing a math game with Varda.\n\nLet's define <image> for positive integer x as a product of factorials of its digits. For example, <image>.\n\nFirst, they choose a decimal number a consisting of n digits that... | [{"type": "stdin_stdout", "input": "15\n989898989898989\n", "output": "777777777777777333333333333333322222222222222222222222222222\n"}, {"type": "stdin_stdout", "input": "15\n999999999999990\n", "output": "77777777777777333333333333333333333333333322222222222222\n"}, {"type": "stdin_stdout", "input": "15\n987654329876... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new delivery of clothing has arrived today to the clothing store. This delivery consists of $a$ ties, $b$ scarves, $c$ vests and $d$ jackets.\n\nThe store does not sell single clothing items — instead, it sells suits of... | [{"type": "stdin_stdout", "input": "100000\n100000\n100000\n100000\n1000\n1000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "100000\n100000\n100000\n100000\n1000\n1000\n", "output": "100000000\n"}, {"type": "stdin_stdout", "input": "100000\n100000\n100100\n100000\n1000\n1000\n", "output": "100000000\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmong Johnny's numerous hobbies, there are two seemingly harmless ones: applying bitwise operations and sneaking into his dad's office. As it is usually the case with small children, Johnny is unaware that combining these... | [{"type": "stdin_stdout", "input": "6\n4\n1 0 2 5\n6\n10 7 14 16 0 12\n2\n0 1\n3\n1 2 6\n6\n1 4 6 10 11 20\n2\n0 1023\n", "output": "-1\n-1\n1\n-1\n-1\n1023\n"}, {"type": "stdin_stdout", "input": "6\n4\n1 0 2 6\n6\n10 7 27 16 1 12\n2\n0 1\n3\n1 2 6\n6\n0 8 6 10 11 33\n2\n0 1023\n", "output": "-1\n11\n1\n-1\n-1\n1023\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA group of $n$ dancers rehearses a performance for the closing ceremony. The dancers are arranged in a row, they've studied their dancing moves and can't change positions. For some of them, a white dancing suit is already... | [{"type": "stdin_stdout", "input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 0 1 1 2\n", "output": "413\n"}, {"type": "stdin_stdout", "input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 0 1 1 2\n", "output": "413\n"}, {"type": "stdin_stdout", "input": "20 53 67\n1 2 1 2 0 0 0 2 2 2 1 0 0 2 0 0 1 1 1 2\n", "output": "4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n'Twas the night before Christmas, and Santa's frantically setting up his new Christmas tree! There are n nodes in the tree, connected by n-1 edges. On each edge of the tree, there's a set of Christmas lights, which can be... | [{"type": "stdin_stdout", "input": "4\n6 5\n1 2 -1\n1 3 1\n4 2 7\n6 3 0\n2 5 -1\n2 3 1\n2 5 0\n5 6 1\n6 1 1\n4 5 1\n5 3\n1 2 -1\n1 3 -1\n1 4 1\n4 5 -1\n2 4 0\n3 4 1\n2 3 1\n3 3\n1 2 -1\n1 3 -1\n2 2 0\n1 3 1\n2 3 0\n2 0\n1 2 1\n1 2 0\n", "output": "YES\n1 2 0\n1 3 1\n4 2 7\n6 3 0\n2 5 0\nYES\n1 2 1\n1 3 0\n1 4 1\n4 5 1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCount the pairs of length-N sequences consisting of integers between 1 and M (inclusive), A_1, A_2, \\cdots, A_{N} and B_1, B_2, \\cdots, B_{N}, that satisfy all of the following conditions:\n - A_i \\neq B_i, for every i... | [{"type": "stdin_stdout", "input": "141421 356237\n", "output": "881613484\n"}, {"type": "stdin_stdout", "input": "500000 500000\n", "output": "869509376\n"}, {"type": "stdin_stdout", "input": "436426 479445\n", "output": "710501305\n"}, {"type": "stdin_stdout", "input": "148772 190081\n", "output": "685499830\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is crazy about round numbers. He especially likes the numbers divisible by 10^{k}.\n\nIn the given number of n Polycarp wants to remove the least number of digits to get a number that is divisible by 10^{k}. For ... | [{"type": "stdin_stdout", "input": "1000000001 10\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "1234567890 14\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "1000999999 3\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "1090090090 5\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt Aizu Shingakujuku, students are divided into classes by conducting a proficiency test when they enter the cram school. The test consists of three subjects: Mathematics, English, and Japanese, and students are divided i... | [{"type": "stdin_stdout", "input": "4\n100 217 28\n253 43 197\n18 34 24\n19 22 189\n2\n190 106 20\n66 72 171\n0", "output": "A\nA\nC\nB\nA\nA\n"}, {"type": "stdin_stdout", "input": "4\n100 137 28\n143 43 197\n18 34 24\n19 19 65\n2\n196 106 20\n66 72 171\n0", "output": "A\nA\nC\nC\nA\nA\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDoor's family is going celebrate Famil Doors's birthday party. They love Famil Door so they are planning to make his birthday cake weird!\n\nThe cake is a n × n square consisting of equal squares with side length 1. Each ... | [{"type": "stdin_stdout", "input": "21\n...CCC.....CC..C..C.C\n..CCC...CC...CC.CCC.C\n....C.C.C..CCC..C.C.C\n....CCC..C..C.CC.CCC.\n...CCC.C..C.C.....CCC\n.CCC.....CCC..C...C.C\nCCCC.C...CCC.C...C.CC\nC..C...C.CCC..CC..C..\nC...CC..C.C.CC..C.CC.\nCC..CCCCCCCCC..C....C\n.C..CCCC.CCCC.CCC...C\nCCC...CCC...CCC.C..C.\n.CCC... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12, 2, 177013, 265918 ar... | [{"type": "stdin_stdout", "input": "36\n6\n165310\n6\n177978\n6\n211759\n6\n212643\n6\n229540\n6\n250029\n6\n211519\n6\n256097\n6\n163478\n5\n91505\n5\n79280\n6\n260629\n6\n128051\n6\n121972\n6\n261633\n6\n172044\n6\n119055\n6\n208323\n6\n149942\n6\n161236\n6\n177150\n6\n233766\n5\n97949\n6\n230107\n6\n175822\n6\n21354... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt an arcade, Takahashi is playing a game called RPS Battle, which is played as follows:\n - The player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A d... | [{"type": "stdin_stdout", "input": "99901 2\n3193 1797 2772\nssrprrspsrprsrpsrprsssprrsrssrrprppprrrrrrrsprrrrsprsprsspsspprrrrpprsrprrrrpsspprrrspspsprprprprrpprppsrspprrsssssprsrrsrrsssppsprsrprpprpspppsprrspsspsppsrpspprpprsrsrssrrrrprspprpprrspssprsrrsppsrsrpssprsssprspppspspssrrpsrprpsrpprsrpppsprssssprsrrrrpsrprr... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe next \"Data Structures and Algorithms\" lesson will be about Longest Increasing Subsequence (LIS for short) of a sequence. For better understanding, Nam decided to learn it a few days before the lesson.\n\nNam created... | [{"type": "stdin_stdout", "input": "100\n102 157 177 149 138 193 19 74 127 156 128 122 6 101 154 92 24 188 51 89 18 77 112 100 65 11 113 173 79 124 102 81 11 171 114 43 60 168 44 86 87 82 177 8 12 181 139 121 140 28 108 17 173 63 18 4 148 125 117 153 193 180 188 142 46 75 163 126 128 22 32 163 164 1 161 19 162 59 190 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAhmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't.\n\nThis ... | [{"type": "stdin_stdout", "input": "14 14\n6 -1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 2 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 -1\n1 2 3 4 5 6 7 8 9 10 11 12 13 14\n", "output": "83\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n«Bersoft» company is working on a new version of its most popular text editor — Bord 2010. Bord, like many other text editors, should be able to print out multipage documents. A user keys a sequence of the document page n... | [{"type": "stdin_stdout", "input": "713,572,318,890,577,657,646,146,373,783,392,229,455,871,20,593,573,336,26,381,280,916,907,732,820,713,111,840,570,446,184,711,481,399,788,647,492,15,40,530,549,506,719,782,126,20,778,996,712,761,9,74,812,418,488,175,103,585,900,3,604,521,509,513,145,708,990,361,682,827,791,22,596,780... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.