messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of $n$ positive integers $a_1, a_2, \\ldots, a_n$. Your task is to calculate the number of arrays of $n$ positive integers $b_1, b_2, \\ldots, b_n$ such that:\n\n$1 \\le b_i \\le a_i$ for every $i$ ... | [{"type": "stdin_stdout", "input": "100\n23 39 85 46 97 72 41 70 37 18 8 40 33 61 12 79 51 78 61 66 85 97 78 14 70 47 100 40 15 40 61 52 19 30 14 91 82 56 10 6 68 24 97 61 31 78 18 45 88 6 37 38 51 86 37 42 58 30 79 56 50 14 61 18 13 20 57 3 93 15 24 74 32 21 71 93 2 66 25 75 75 10 86 82 30 31 6 49 15 33 100 35 1 96 87... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Elephant loves playing with arrays. He has array a, consisting of n positive integers, indexed from 1 to n. Let's denote the number with index i as ai. \n\nAdditionally the Little Elephant has m queries to the ... | [{"type": "stdin_stdout", "input": "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 6\n", "output": "1\n0\n2\n1\n1\n3\n"}, {"type": "stdin_stdout", "input": "6 6\n1 2 2 3 3 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 3\n", "output": "1\n0\n2\n1\n1\n2\n"}, {"type": "stdin_stdout", "input": "6 6\n1 2 2 3 2 3\n1 2\n2 2\n1 3\n2 4\n4 6\n1 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a playlist consisting of $n$ songs. The $i$-th song is characterized by two numbers $t_i$ and $b_i$ β its length and beauty respectively. The pleasure of listening to set of songs is equal to the total length of ... | [{"type": "stdin_stdout", "input": "10 1\n135600 59157\n2735 28902\n43406 39542\n24166 178402\n18565 14980\n69958 53925\n23473 81878\n89682 3949\n18757 31637\n35580 45873\n", "output": "8021689200\n"}, {"type": "stdin_stdout", "input": "10 1\n135600 59157\n2735 28902\n43406 39542\n24166 93361\n18565 14980\n69958 53925\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFilled with optimism, Hyunuk will host a conference about how great this new year will be!\n\nThe conference will have $n$ lectures. Hyunuk has two candidate venues $a$ and $b$. For each of the $n$ lectures, the speaker s... | [{"type": "stdin_stdout", "input": "4\n544431836 544432042 793496989 793497079\n544429970 544430041 793496343 793496350\n544432412 544432541 793497670 793498269\n544431029 544431033 793494552 793494859\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4\n922033367 922033530 246113700 246113747\n922034178 92203... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn February 14 Denis decided to give Valentine to Nastya and did not come up with anything better than to draw a huge red heart on the door of the length $k$ ($k \\ge 3$). Nastya was very confused by this present, so she ... | [{"type": "stdin_stdout", "input": "5\n8 6\n1 2 4 1 2 7 1 2\n5 3\n3 2 3 2 1\n10 8\n7 4 7 6 2 3 0 1 -1 1\n15 10\n3 14 4 8 2 1 4 5 21 2 0 4 2 1 3\n7 5\n1 2 3 4 2 6 2\n", "output": "3 2\n2 2\n4 2\n4 1\n3 3\n"}, {"type": "stdin_stdout", "input": "5\n8 6\n1 2 4 1 2 7 1 2\n5 3\n3 2 3 2 1\n10 8\n7 4 7 6 2 3 0 1 -1 1\n15 10\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKode Festival is an anual contest where the hardest stone in the world is determined. (Kode is a Japanese word for \"hardness\".)\n\nThis year, 2^N stones participated. The hardness of the i-th stone is A_i.\n\nIn the con... | [{"type": "stdin_stdout", "input": "3\n2\n1\n-3\n4\n-1\n25\n110\n1014", "output": "872\n"}, {"type": "stdin_stdout", "input": "3\n2\n1\n-3\n4\n-1\n25\n111\n1014", "output": "871\n"}, {"type": "stdin_stdout", "input": "3\n2\n1\n-3\n4\n-2\n25\n111\n1014", "output": "870\n"}, {"type": "stdin_stdout", "input": "3\n2\n1\n-3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJzzhu have n non-negative integers a1, a2, ..., an. We will call a sequence of indexes i1, i2, ..., ik (1 β€ i1 < i2 < ... < ik β€ n) a group of size k. \n\nJzzhu wonders, how many groups exists such that ai1 & ai2 & ... & ... | [{"type": "stdin_stdout", "input": "55\n0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 3 4 5 6 7 8 9 4 5 6 7 8 9 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9\n", "output": "621247139\n"}, {"type": "stdin_stdout", "input": "55\n0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 3 4 10 6 7 8 9 3 4 5 6 7 8 9 4 5 6 7 8 9 5 6 7 8 9 6 7 8 9 7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm: if the last digit of the ... | [{"type": "stdin_stdout", "input": "1000000000 0\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1559848638 5\n", "output": "1559848633\n"}, {"type": "stdin_stdout", "input": "1100000000 0\n", "output": "1100000000\n"}, {"type": "stdin_stdout", "input": "1086932676 10\n", "output": "108693264\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have an axis-aligned rectangle room with width $W$ and height $H$, so the lower left corner is in point $(0, 0)$ and the upper right corner is in $(W, H)$.\n\nThere is a rectangular table standing in this room. The si... | [{"type": "stdin_stdout", "input": "5\n8 5\n2 1 7 4\n4 2\n5 4\n2 2 5 4\n3 3\n1 8\n0 3 1 6\n1 5\n8 1\n3 0 6 1\n5 1\n8 10\n4 5 7 8\n8 5\n", "output": "1.000000000\n-1\n2.000000000\n2.000000000\n0.000000000\n"}, {"type": "stdin_stdout", "input": "5\n8 5\n2 1 7 4\n4 2\n5 4\n2 2 5 4\n3 3\n1 8\n0 3 1 6\n1 5\n8 1\n3 0 6 1\n5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nParsa has a humongous tree on $n$ vertices.\n\nOn each vertex $v$ he has written two integers $l_v$ and $r_v$.\n\nTo make Parsa's tree look even more majestic, Nima wants to assign a number $a_v$ ($l_v \\le a_v \\le r_v$)... | [{"type": "stdin_stdout", "input": "3\n2\n2 10\n6 6\n1 2\n3\n1 3\n13 6\n7 15\n1 2\n2 3\n6\n10 14\n12 20\n21 19\n2 12\n10 17\n3 17\n3 2\n6 5\n1 5\n2 6\n4 6\n", "output": "4\n18\n48\n"}, {"type": "stdin_stdout", "input": "3\n2\n0 6\n3 13\n1 2\n3\n1 3\n10 6\n12 9\n1 2\n2 3\n6\n3 14\n9 20\n12 19\n1 12\n11 17\n3 17\n3 3\n6 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is a complicated version of D1, but it has significant differences, so read the whole statement.\n\nPolycarp has an array of $n$ ($n$ is even) integers $a_1, a_2, \\dots, a_n$. Polycarp conceived of a positiv... | [{"type": "stdin_stdout", "input": "10\n10\n-30 45 -37 -11 25 61 97 7 7 35\n10\n48 -2 13 88 97 -27 40 88 41 -67\n10\n-13 -31 94 -43 19 95 -35 5 41 10\n10\n-28 -88 17 17 2 -43 -73 -73 -13 2\n10\n46 -73 47 54 -13 67 7 -33 1 -33\n10\n60 92 -100 -76 -12 -52 4 84 -38 36\n10\n50 62 56 -58 -10 87 29 52 14 -22\n10\n-78 50 -52 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHo ho! So you think you know integers, do you? Well then, young wizard, tell us what the Nth digit of the [Champernowne constant](https://en.wikipedia.org/wiki/Champernowne_constant) is!\n\nThe constant proceeds like this... | [{"input": "501337501337101", "output": "[3]", "fn_name": "champernowneDigit"}, {"input": "77199254740991", "output": "[7]", "fn_name": "champernowneDigit"}, {"input": "101800813569", "output": "[6]", "fn_name": "champernowneDigit"}, {"input": "1000599563", "output": "[1]", "fn_name": "champernowneDigit"}, {"input": "1... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# A wolf in sheep's clothing\n\nWolves have been reintroduced to Great Britain. You are a sheep farmer, and are now plagued by wolves which pretend to be sheep. Fortunately, you are good at spotting them. \n\nWarn the she... | [{"input": "[\"sheep\", \"sheep\", \"sheep\", \"sheep\", \"sheep\", \"wolf\", \"sheep\", \"sheep\"]", "output": "[\"Oi! Sheep number 2! You are about to be eaten by a wolf!\"]", "fn_name": "warn_the_sheep"}, {"input": "[\"sheep\", \"wolf\", \"sheep\", \"sheep\", \"sheep\", \"sheep\", \"sheep\"]", "output": "[\"Oi! Shee... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe phantom thief \"Lupin IV\" is told by the beautiful \"Fujiko Mine\", a descendant of the Aizu clan, that the military funds left by the Aizu clan are sleeping in Aizuwakamatsu city. According to a report by Lupine's l... | [{"type": "stdin_stdout", "input": "5\n13 199 1\n93 1000 1\n37 350 10\n27 300 2\n123 200 1100", "output": "93 37 27 13 123\n"}, {"type": "stdin_stdout", "input": "5\n11 199 0\n93 1000 1\n37 350 10\n27 300 2\n123 200 1100", "output": "93 37 27 11 123\n"}, {"type": "stdin_stdout", "input": "5\n11 91 0\n124 1000 1\n37 350... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is an active Internet user. One day he came across an Internet resource he liked, so he wrote its address in the notebook. We know that the address of the written resource has format: <protocol>://<domain>.ru[/<cont... | [{"type": "stdin_stdout", "input": "ftpprutpfrutrutptpfrutpfrutfrutrfrutpfrutprutruruu\n", "output": "ftp://p.ru/tpfrutrutptpfrutpfrutfrutrfrutpfrutprutruruu\n"}, {"type": "stdin_stdout", "input": "ftpprutufrutrutptpfrutpfrutfrutrfrutpfrptprutruruu\n", "output": "ftp://p.ru/tufrutrutptpfrutpfrutfrutrfrutpfrptprutruruu"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the following way: at first the number 1 is written out, then the numbers from 1 to 2, then the numbers ... | [{"type": "stdin_stdout", "input": "100000000000000\n", "output": "1749820\n"}, {"type": "stdin_stdout", "input": "99999998250180\n", "output": "14142135\n"}, {"type": "stdin_stdout", "input": "99999998250180\n", "output": "14142135\n"}, {"type": "stdin_stdout", "input": "100000000000000\n", "output": "1749820\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonocarp has decided to buy a new TV set and hang it on the wall in his flat. The wall has enough free space so Monocarp can buy a TV set with screen width not greater than $a$ and screen height not greater than $b$. Mono... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000\n", "output": "1000000000000000000\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGuy-Manuel and Thomas are going to build a polygon spaceship.\n\nYou're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon o... | [{"type": "stdin_stdout", "input": "8\n-440365664 -897818514\n107345267 -994221803\n248590739 -968608613\n473576011 -880752952\n105203574 994450706\n-164464580 1061907476\n-522092561 852888831\n-874210729 485546704\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "8\n-845415846 -897818514\n107345267 -994221803\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLunar New Year is approaching, and you bought a matrix with lots of \"crosses\".\n\nThis matrix $M$ of size $n \\times n$ contains only 'X' and '.' (without quotes). The element in the $i$-th row and the $j$-th column $(i... | [{"type": "stdin_stdout", "input": "14\nXXX.XXXXX..X.X\nX..XX..X...X..\n.....X.XX..XXX\n.X..X..XXX.XX.\n...XXXX.XX..XX\n.X..XX...XXX..\nXX.XX.XX..XXX.\n.X..X.....X.XX\n...XXX...XX.XX\nXXX.XX.XX.X.XX\nX.XXXX..XX.XX.\n.X.XX....X....\nX..XX..X.XX.X.\n..X...XX....XX\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInput\n\nThe first line of the input contains a single integer N (1 β€ N β€ 24). The next N lines contain 5 space-separated integers each. The first three integers will be between 0 and 2, inclusive. The last two integers w... | [{"type": "stdin_stdout", "input": "10\n2 0 0 1 1\n1 1 1 2 1\n2 1 0 1 2\n1 1 0 1 1\n2 1 0 2 1\n1 1 1 2 1\n1 2 1 3 1\n2 0 0 1 1\n1 1 0 1 1\n1 1 2 2 2\n", "output": "\ncodeforcez\n"}, {"type": "stdin_stdout", "input": "1\n1 0 0 1 0\n", "output": "codeforcez\n"}, {"type": "stdin_stdout", "input": "1\n1 0 0 1 0\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has an array of integers a_1, a_2, β¦, a_n. He only likes sorted arrays. Unfortunately, the given array could be arbitrary, so Petya wants to sort it.\n\nPetya likes to challenge himself, so he wants to sort array us... | [{"type": "stdin_stdout", "input": "7\n1\n1\n2\n2 2\n2\n2 2\n3\n1 2 3\n3\n1 1 1\n3\n3 1 2\n4\n2 1 4 3\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "7\n1\n1\n2\n1 2\n2\n1 1\n3\n1 2 3\n3\n2 1 1\n3\n3 1 1\n4\n4 1 4 3\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a picture consisting of $n$ rows and $m$ columns. Rows are numbered from $1$ to $n$ from the top to the bottom, columns are numbered from $1$ to $m$ from the left to the right. Each cell is painted either bl... | [{"type": "stdin_stdout", "input": "9\n5 5\n..*..\n..*..\n*****\n..*..\n..*..\n3 4\n****\n.*..\n.*..\n4 3\n***\n*..\n*..\n*..\n5 5\n*****\n*.*.*\n*****\n..*.*\n..***\n1 4\n****\n5 5\n.....\n..*..\n.***.\n..*..\n.....\n5 3\n...\n.*.\n.*.\n***\n.*.\n3 3\n.*.\n*.*\n.*.\n4 4\n*.**\n....\n*.**\n*.**\n", "output": "0\n0\n0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are coins with front and back sides and dice with rolls from $ 1 $ to $ N $. Gacho decided to play the following games using these.\n\nThe game starts with a score of $ 0 $ and proceeds as follows.\n\n\n1... | [{"type": "stdin_stdout", "input": "12 110 467", "output": "469611202\n"}, {"type": "stdin_stdout", "input": "12 100 467", "output": "732809678\n"}, {"type": "stdin_stdout", "input": "12 13 187", "output": "455459798\n"}, {"type": "stdin_stdout", "input": "12 60 467", "output": "654858060\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a \"plus\") and negative (a \"minus\"). If t... | [{"type": "stdin_stdout", "input": "115\n10\n10\n10\n10\n01\n01\n10\n10\n10\n01\n01\n10\n01\n01\n10\n10\n10\n01\n10\n01\n10\n10\n01\n01\n10\n10\n10\n10\n01\n10\n01\n01\n10\n10\n10\n10\n01\n10\n10\n10\n01\n10\n01\n10\n10\n10\n10\n01\n01\n01\n10\n10\n01\n01\n01\n10\n10\n01\n10\n01\n01\n01\n01\n10\n10\n01\n10\n01\n01\n01\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's introduce some definitions that will be needed later.\n\nLet $prime(x)$ be the set of prime divisors of $x$. For example, $prime(140) = \\{ 2, 5, 7 \\}$, $prime(169) = \\{ 13 \\}$.\n\nLet $g(x, p)$ be the maximum po... | [{"type": "stdin_stdout", "input": "1000000000 1000000000000000000\n", "output": "997440007\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000000000000\n", "output": "997440007\n"}, {"type": "stdin_stdout", "input": "1000000000 1000000000010000000\n", "output": "778038345\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice has just learned addition. However, she hasn't learned the concept of \"carrying\" fully β instead of carrying to the next column, she carries to the column two columns to the left.\n\nFor example, the regular way t... | [{"type": "stdin_stdout", "input": "2\n352942581\n1100110000\n", "output": "192407906\n102030199\n"}, {"type": "stdin_stdout", "input": "2\n178886702\n1100110000\n", "output": "148360651\n102030199\n"}, {"type": "stdin_stdout", "input": "2\n139544809\n1100110000\n", "output": "69014088\n102030199\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA progress bar is an element of graphical interface that displays the progress of a process for this very moment before it is completed. Let's take a look at the following form of such a bar.\n\nA bar is represented as n ... | [{"type": "stdin_stdout", "input": "100 101 100\n", "output": "101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 101 10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn the way to Rio de Janeiro Ostap kills time playing with a grasshopper he took with him in a special box. Ostap builds a line of length n such that some cells of this line are empty and some contain obstacles. Then, he ... | [{"type": "stdin_stdout", "input": "100 20\n.....G.#.#..................#.........##....#...................#.#..........#...#.#.T..#.......#...\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 33\nG..................................................................................................T\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven time in 24-hour format, convert it to words. \n\n```\nFor example:\n13:00 = one o'clock \n13:09 = nine minutes past one \n13:15 = quarter past one \n13:29 = twenty nine minutes past one\n13:30 = half past one \n13:3... | [{"input": "\"23:31\"", "output": "[\"twenty nine minutes to midnight\"]", "fn_name": "solve"}, {"input": "\"11:31\"", "output": "[\"twenty nine minutes to twelve\"]", "fn_name": "solve"}, {"input": "\"13:29\"", "output": "[\"twenty nine minutes past one\"]", "fn_name": "solve"}, {"input": "\"00:08\"", "output": "[\"ei... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x have been successful. Thus, your current success rate on Codeforces is equal ... | [{"type": "stdin_stdout", "input": "5\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n99999997 999999998 999999998 999999999\n99999996 999999997 999999997 999999999\n99999997 999999998 999999998 999999999\n", "output": "899999999100000001\n449999999550000002\n899999999100000001\n4499999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudent A and student B are giving each other test answers during a test. \nThey don't want to be caught so they are sending each other coded messages.\n\nStudent A is sending student B the message: `Answer to Number 5 P... | [{"input": "\"8 d9dx0962x8067d x 760x272690 d852757d59 d552820d52dx767d 0dxxxd995x0676x59d6x7760x0d7 02dd7558770x2d0760x85d8x709d0x590\"", "output": "[\"88x256960x8 027275x22xd6758dx7dd797272 07d00dd6d0066779x 95dd7056d0x095x6x5009 2xx08xx67d dx5d785268dxd97759x05579d 0d0\"]", "fn_name": "decipher_message"}, {"input... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses (\"+\") in the line bet... | [{"type": "stdin_stdout", "input": "200 100\n56988719755815575893282254081467698462485803782142631369385180999746639622554559884281193367342283559238834106917388166048020056852911293394377949964185368886333934084399980368238188117302968424219707\n", "output": "295455656\n"}, {"type": "stdin_stdout", "input": "200 100\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn eviternity number is a number which:\n* contains only digits 8, 5 and 3, and \n* the count of the digit `8` >= count of digit `5` >= count of digit `3`. \n\nThe first few eviternity numbers are as follows. \n```Haskell... | [{"input": "0\n100000", "output": "[103]", "fn_name": "solve"}, {"input": "0\n500000", "output": "[148]", "fn_name": "solve"}, {"input": "90\n139701", "output": "[99]", "fn_name": "solve"}, {"input": "61\n56976", "output": "[53]", "fn_name": "solve"}, {"input": "0\n10000", "output": "[37]", "fn_name": "solve"}, {"input... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConnect the countless points with lines, till we reach the faraway yonder.\n\nThere are n points on a coordinate plane, the i-th of which being (i, y_{i}).\n\nDetermine whether it's possible to draw two parallel and non-o... | [{"type": "stdin_stdout", "input": "20\n-975467170 758268840 -975467171 758268839 -975467172 758268838 -975467173 758268837 -975467174 1015089897 -975467175 758268835 -975467176 758268834 -975467177 967684266 -975467178 758268832 -975467179 1082851919\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "20\n-97546... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nΠΡΠ½ΠΎΠ²ΠΎΠΉ Π»ΡΠ±ΠΎΠΉ ΡΠΎΡΠΈΠ°Π»ΡΠ½ΠΎΠΉ ΡΠ΅ΡΠΈ ΡΠ²Π»ΡΠ΅ΡΡΡ ΠΎΡΠ½ΠΎΡΠ΅Π½ΠΈΠ΅ Π΄ΡΡΠΆΠ±Ρ ΠΌΠ΅ΠΆΠ΄Ρ Π΄Π²ΡΠΌΡ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»ΡΠΌΠΈ Π² ΡΠΎΠΌ ΠΈΠ»ΠΈ ΠΈΠ½ΠΎΠΌ ΡΠΌΡΡΠ»Π΅. Π ΠΎΠ΄Π½ΠΎΠΉ ΠΈΠ·Π²Π΅ΡΡΠ½ΠΎΠΉ ΡΠΎΡΠΈΠ°Π»ΡΠ½ΠΎΠΉ ΡΠ΅ΡΠΈ Π΄ΡΡΠΆΠ±Π° ΡΠΈΠΌΠΌΠ΅ΡΡΠΈΡΠ½Π°, ΡΠΎ Π΅ΡΡΡ Π΅ΡΠ»ΠΈ a ΡΠ²Π»ΡΠ΅ΡΡΡ Π΄ΡΡΠ³ΠΎΠΌ b, ΡΠΎ b ΡΠ°ΠΊΠΆΠ΅ ΡΠ²Π»ΡΠ΅ΡΡΡ Π΄ΡΡΠ³ΠΎΠΌ ... | [{"type": "stdin_stdout", "input": "10 50\n946010975 207263044\n923545573 749203275\n862015642 426425906\n749203275 839134958\n910721783 289091881\n827003531 333726912\n49704846 538788252\n382891592 207263044\n333726912 438209022\n974360048 49704846\n", "output": "49704846: 0\n207263044: 0\n289091881: 0\n333726912: 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChallenge:\nGiven two null-terminated strings in the arguments \"string\" and \"prefix\", determine if \"string\" starts with the \"prefix\" string. Return 1 (or any other \"truthy\" value) if true, 0 if false.\n\nExample... | [{"input": "\"hello world!\"\n\"HELLO\"", "output": "[false]", "fn_name": "starts_with"}, {"input": "\"hello world!\"\n\"hello\"", "output": "[true]", "fn_name": "starts_with"}, {"input": "\"nowai\"\n\"nowaisir\"", "output": "[false]", "fn_name": "starts_with"}, {"input": "\"\"\n\"abc\"", "output": "[false]", "fn_name"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAbsent-minded Masha got set of n cubes for her birthday.\n\nAt each of 6 faces of each cube, there is exactly one digit from 0 to 9. Masha became interested what is the largest natural x such she can make using her new cu... | [{"type": "stdin_stdout", "input": "3\n5 1 2 9 6 4\n9 0 6 4 2 8\n4 6 2 8 3 7\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "3\n1 1 1 0 2 3\n4 5 6 7 8 9\n0 0 0 0 0 0\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "3\n1 1 1 1 1 1\n0 2 3 4 5 6\n7 8 9 2 3 4\n", "output": "10\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMeikyokan University is very famous for its research and education in the area of computer science. This university has a computer center that has advanced and secure computing facilities including supercomputers and many... | [{"type": "stdin_stdout", "input": "8\n2\nomura\ntoshio\nraku\ntanaka\ninura\nyoshoi\nhayashi\nmiura\n3\n1\ntasaka\nnakata\ntanaka\n1\n1\nfoo\n5\n2\npsqt\nabcdef\nabzdefa\npqrst\nabdxcef\n0", "output": "inura,miura\ninura,omura\nmiura,omura\ntoshio,yoshoi\n4\ntanaka,tasaka\n1\n0\nabcdef,abdxcef\nabcdef,abzdefa\npqrst,p... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ cities and $m$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.\n\nWhat is the minimum number of new roads that need to be built to make all the cities reachable from ... | [{"type": "stdin_stdout", "input": "39 40 38\n4 8\n24 28\n16 17\n7 25\n4 29\n34 35\n16 24\n21 10\n23 36\n36 14\n28 16\n34 19\n15 21\n22 38\n22 37\n37 27\n28 33\n3 29\n32 22\n12 30\n9 15\n5 19\n23 27\n19 17\n25 17\n24 11\n39 10\n6 20\n16 6\n3 18\n34 21\n15 38\n11 19\n11 3\n32 4\n15 13\n16 11\n11 7\n33 7\n3 33\n", "outpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn 1862, the lord of Aizu was ordered to serve as a guardian of Kyoto. The Kyoto Shugoshoku is an important role to protect Kyoto at the end of the Edo period when security has deteriorated. You have to patrol the city by... | [{"type": "stdin_stdout", "input": "1 3\n3 4\n3 5\n3 6\n4 6\n4 7\n4 6\n5 6\n6 3\n5 8\n1 16\n1 8\n2 14\n7 0\n11 9\n9 2\n0 0\n1 3\n3 4\n5 5\n4 2\n0 0", "output": "NG\nOK\n"}, {"type": "stdin_stdout", "input": "1 3\n3 4\n3 5\n3 6\n4 6\n4 7\n4 6\n5 6\n6 3\n5 8\n1 16\n3 8\n6 14\n7 0\n8 9\n9 2\n0 0\n1 3\n3 4\n5 5\n4 2\n0 0",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIlya is very fond of graphs, especially trees. During his last trip to the forest Ilya found a very interesting tree rooted at vertex 1. There is an integer number written on each vertex of the tree; the number written on... | [{"type": "stdin_stdout", "input": "10\n2 3 4 5 6 7 11 9 10 11\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n4 8\n8 9\n9 10\n", "output": "2 3 2 1 1 1 1 1 1 1 \n"}, {"type": "stdin_stdout", "input": "10\n2 3 4 5 6 7 11 9 10 11\n1 2\n2 3\n3 4\n4 5\n5 6\n9 7\n4 8\n8 9\n9 10\n", "output": "2 3 2 1 1 1 1 1 1 1 \n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Math, an improper fraction is a fraction where the numerator (the top number) is greater than or equal to the denominator (the bottom number) For example: ```5/3``` (five third).\n\nA mixed numeral is a whole number an... | [{"input": "\"-21511/21\"", "output": "[\"-1024 7/21\"]", "fn_name": "convert_to_mixed_numeral"}, {"input": "\"9999/24\"", "output": "[\"416 15/24\"]", "fn_name": "convert_to_mixed_numeral"}, {"input": "\"-504/26\"", "output": "[\"-19 10/26\"]", "fn_name": "convert_to_mixed_numeral"}, {"input": "\"74/30\"", "output": "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\nA cake is sliced with `n` straight lines. Your task is to calculate the maximum number of pieces the cake can have.\n\n# Example\n\n For `n = 0`, the output should be `1`.\n \n For `n = 1`, the output should be `2... | [{"input": "10", "output": "[56]", "fn_name": "cake_slice"}, {"input": "0", "output": "[1]", "fn_name": "cake_slice"}, {"input": "1", "output": "[2]", "fn_name": "cake_slice"}, {"input": "2", "output": "[4]", "fn_name": "cake_slice"}, {"input": "3", "output": "[7]", "fn_name": "cake_slice"}] | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDolphin loves programming contests. Today, he will take part in a contest in AtCoder.\n\nIn this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as \"21 o'clock\".\n\nThe current time is A o'clock, a... | [{"type": "stdin_stdout", "input": "23 23\n", "output": "22\n"}, {"type": "stdin_stdout", "input": "405 14", "output": "11\n"}, {"type": "stdin_stdout", "input": "9 12\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "19 0\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "22 1\n", "output": "23\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInput\n\nThe input contains two integers N, M (1 β€ N β€ 1024, 2 β€ M β€ 16), separated by a single space.\n\nOutput\n\nOutput \"YES\" or \"NO\".\n\nExamples\n\nInput\n\n\n2 3\n\n\nOutput\n\n\nYES\n\n\nInput\n\n\n3 2\n\n\nOut... | [{"type": "stdin_stdout", "input": "33 16\n", "output": "\nYES\n"}, {"type": "stdin_stdout", "input": "11 11\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "12 16\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "11 20\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "15 11\n", "output": "Y... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDid you ever hear about 'crossing the bridge noodle' ? Let me tell you that it's not some kind of bridge made of noodles. It's a dish, a kind of rice noodle soup. Mr.Ping makes the best noodle soup and his son Po is eager... | [{"type": "stdin_stdout", "input": "2\nQ 0\nP 14\n\n2\nO -1\nM -16\n\n0", "output": "13\n15\n"}, {"type": "stdin_stdout", "input": "2\nQ -1\nP 14\n\n2\nN -1\nM -3\n\n0", "output": "13\n2\n"}, {"type": "stdin_stdout", "input": "2\nQ -1\nP 8\n\n2\nM -1\nM -14\n\n0", "output": "7\n13\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn computing, there are two primary byte order formats: big-endian and little-endian. Big-endian is used primarily for networking (e.g., IP addresses are transmitted in big-endian) whereas little-endian is used mainly by ... | [{"input": "859983475894789589772983457982345896389458937589738945435\n1024", "output": "[10935879118170253467575045997837531765542549198363770264806105328514144954155675005294370560789173602325403413189569286370255297035043193807918631267898110032789194315444561922202783069416581989858234400991054570729329260875447493... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has two integers X and Y.\nHe computed X + Y and X - Y, and the results were A and B, respectively.\nNow he cannot remember what X and Y were. Find X and Y for him.\n\n-----Constraints-----\n - -100 \\leq A, B \... | [{"type": "stdin_stdout", "input": "-100 -100\n", "output": "-100 0\n"}, {"type": "stdin_stdout", "input": "-100 100\n", "output": "0 -100\n"}, {"type": "stdin_stdout", "input": "-39 -69\n", "output": "-54 15\n"}, {"type": "stdin_stdout", "input": "100 -100\n", "output": "0 100\n"}, {"type": "stdin_stdout", "input": "-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# The die is cast!\n\nYour task in this kata is to write a \"dice roller\" that interprets a subset of [dice notation](http://en.wikipedia.org/wiki/Dice_notation).\n\n# Description\n\nIn most role-playing games, die rolls... | [{"input": "\"2d6+3 abc\"", "output": "[false]", "fn_name": "roll"}, {"input": "\"abc 2d6+3\"", "output": "[false]", "fn_name": "roll"}, {"input": "\"2d6++4\"", "output": "[false]", "fn_name": "roll"}, {"input": "\"abc\"", "output": "[false]", "fn_name": "roll"}, {"input": "\"\"", "output": "[false]", "fn_name": "roll"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArkady invited Anna for a dinner to a sushi restaurant. The restaurant is a bit unusual: it offers $n$ pieces of sushi aligned in a row, and a customer has to choose a continuous subsegment of these sushi to buy.\n\nThe p... | [{"type": "stdin_stdout", "input": "100\n2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n", "output": "54\n"}, {"type": "stdin_stdout", "input": "100\n1 2 2 2 2 2 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPeter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it w... | [{"type": "stdin_stdout", "input": "29 -999961 689169\n-999960 689169\n-999927 -938525\n-999735 -989464\n-993714 -997911\n-870186 -999686\n-796253 -999950\n-139940 -1023635\n969552 -999972\n985446 -999398\n992690 -997295\n999706 -973137\n999898 -848630\n999997 -192297\n999969 773408\n999495 960350\n1685305 981671\n9983... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nReducing Problems - Bug Fixing #8\n\nOh no! Timmy's reduce is causing problems, Timmy's goal is to calculate the two teams scores and return the winner but timmy has gotten confused and sometimes teams don't enter their s... | [{"input": "[6, 45, 1]\n[1, 55, 0]", "output": "[false]", "fn_name": "calculate_total"}, {"input": "[1, 2, 2]\n[1, 0, 0]", "output": "[true]", "fn_name": "calculate_total"}, {"input": "[57, 2, 1]\n[]", "output": "[true]", "fn_name": "calculate_total"}, {"input": "[]\n[3, 4, 3]", "output": "[false]", "fn_name": "calcula... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the minimum area of a square land on which you can place two identical rectangular $a \\times b$ houses. The sides of the houses should be parallel to the sides of the desired square land.\n\nFormally, You are give... | [{"type": "stdin_stdout", "input": "8\n3 2\n4 2\n1 1\n3 1\n4 13\n1 3\n12 4\n100 100\n", "output": "16\n16\n4\n9\n169\n9\n144\n40000\n"}, {"type": "stdin_stdout", "input": "8\n3 2\n2 2\n1 1\n4 2\n2 11\n1 4\n7 4\n100 101\n", "output": "16\n16\n4\n16\n121\n16\n64\n40000\n"}, {"type": "stdin_stdout", "input": "8\n3 2\n4 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDefine a \"prime prime\" number to be a rational number written as one prime number over another prime number: `primeA / primeB` (e.g. `7/31`)\n\nGiven a whole number `N`, generate the number of \"prime prime\" rational n... | [{"input": "1000", "output": "[[14028, 6266]]", "fn_name": "prime_primes"}, {"input": "666", "output": "[[7260, 3213]]", "fn_name": "prime_primes"}, {"input": "65", "output": "[[153, 63]]", "fn_name": "prime_primes"}, {"input": "10", "output": "[[6, 3]]", "fn_name": "prime_primes"}, {"input": "6", "output": "[[3, 1]]",... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N integers written on a blackboard. The i-th integer is A_i.\n\nTakahashi will repeatedly perform the following operation on these numbers:\n\n* Select a pair of integers, A_i and A_j, that have the same parity ... | [{"type": "stdin_stdout", "input": "5\n1 18 1 14 0", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n2 18 0 14 0", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n4 3 -1 16 4", "output": "YES\n"}, {"type": "stdin_stdout", "input": "5\n2 3 -1 16 4", "output": "YES\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nAt IOI Confectionery, rice crackers are baked using the traditional method since the company was founded. This traditional method is to bake the front side for a certain period of time with charcoal, turn it ov... | [{"type": "stdin_stdout", "input": "2 5\n0 1 1 1 0\n1 0 0 0 1\n3 6\n1 0 0 0 1 0\n1 1 1 0 1 0\n1 0 1 1 0 1\n0 0", "output": "10\n15\n"}, {"type": "stdin_stdout", "input": "2 5\n1 1 1 1 0\n0 0 0 0 1\n3 6\n1 0 0 0 0 1\n0 1 1 0 1 0\n1 0 1 1 0 1\n0 0", "output": "10\n16\n"}, {"type": "stdin_stdout", "input": "2 5\n1 1 1 1 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEverybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 ... | [{"type": "stdin_stdout", "input": "24\n31 28 31 30 31 30 31 31 30 31 30 31 31 29 31 30 31 30 31 31 30 31 30 31\n", "output": "Yes\n\n"}, {"type": "stdin_stdout", "input": "24\n31 28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31\n", "output": "Yes\n\n"}, {"type": "stdin_stdout", "input": "24\n28 31 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice is visiting New York City. To make the trip fun, Alice will take photos of the city skyline and give the set of photos as a present to Bob. However, she wants to find the set of photos with maximum beauty and she ne... | [{"type": "stdin_stdout", "input": "50\n5 42 16 13 20 2 39 49 33 1 11 4 46 3 48 44 12 7 27 41 35 38 26 6 31 37 10 50 24 9 32 15 47 30 17 28 22 29 23 34 8 18 40 21 19 36 25 43 45 14\n427 -3 -165 -161 302 -337 285 -418 227 -78 -453 -122 -162 -249 -194 119 -127 322 -238 467 -236 254 263 -57 225 391 270 -96 -173 329 -45 13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Summary:\nGiven a number, `num`, return the shortest amount of `steps` it would take from 1, to land exactly on that number.\n\n# Description:\nA `step` is defined as either:\n- Adding 1 to the number: `num += 1`\n- Dou... | [{"input": "10000", "output": "[17]", "fn_name": "shortest_steps_to_num"}, {"input": "1500", "output": "[16]", "fn_name": "shortest_steps_to_num"}, {"input": "1534", "output": "[18]", "fn_name": "shortest_steps_to_num"}, {"input": "1978", "output": "[17]", "fn_name": "shortest_steps_to_num"}, {"input": "2763", "output"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer S.\nFind how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S.\nThe answer can be very large, so output it modulo 10^9 + 7.\n\n-----Constrai... | [{"type": "stdin_stdout", "input": "1729\n", "output": "294867501\n"}, {"type": "stdin_stdout", "input": "2000\n", "output": "883312678\n"}, {"type": "stdin_stdout", "input": "1445\n", "output": "157799856\n"}, {"type": "stdin_stdout", "input": "1447\n", "output": "185357934\n"}, {"type": "stdin_stdout", "input": "1497... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA variation of determining leap years, assuming only integers are used and years can be negative and positive.\n\nWrite a function which will return the days in the year and the year entered in a string. For example 2000... | [{"input": "2016", "output": "[\"2016 has 366 days\"]", "fn_name": "year_days"}, {"input": "1974", "output": "[\"1974 has 365 days\"]", "fn_name": "year_days"}, {"input": "1857", "output": "[\"1857 has 365 days\"]", "fn_name": "year_days"}, {"input": "2000", "output": "[\"2000 has 366 days\"]", "fn_name": "year_days"},... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a building with 2N floors, numbered 1, 2, \\ldots, 2N from bottom to top.\nThe elevator in this building moved from Floor 1 to Floor 2N just once.\nOn the way, N persons got on and off the elevator. Each person i... | [{"type": "stdin_stdout", "input": "100\n65 165\n6 106\n41 141\n1 101\n4 104\n33 133\n5 105\n57 157\n98 198\n15 115\n52 152\n53 153\n46 146\n29 129\n42 142\n8 108\n12 112\n69 169\n47 147\n87 187\n79 179\n88 188\n67 167\n26 126\n55 155\n73 173\n72 172\n74 174\n95 195\n36 136\n61 161\n10 110\n17 117\n7 107\n23 123\n30 13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Square is going on a holiday. He wants to bring 2 of his favorite squares with him, so he put them in his rectangle suitcase.\n\nWrite a function that, given the size of the squares and the suitcase, return whether th... | [{"input": "10\n10\n11\n11", "output": "[false]", "fn_name": "fit_in"}, {"input": "1\n2\n2\n1", "output": "[false]", "fn_name": "fit_in"}, {"input": "3\n2\n3\n2", "output": "[false]", "fn_name": "fit_in"}, {"input": "1\n2\n1\n2", "output": "[false]", "fn_name": "fit_in"}, {"input": "6\n5\n8\n7", "output": "[false]", "f... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a function `insertDash(num)`/`InsertDash(int num)` that will insert dashes ('-') between each two odd numbers in num. For example: if num is 454793 the output should be 4547-9-3. Don't count zero as an odd number.\n... | [{"input": "1003567", "output": "[\"1003-567\"]", "fn_name": "insert_dash"}, {"input": "454793", "output": "[\"4547-9-3\"]", "fn_name": "insert_dash"}, {"input": "13579", "output": "[\"1-3-5-7-9\"]", "fn_name": "insert_dash"}, {"input": "123456", "output": "[\"123456\"]", "fn_name": "insert_dash"}, {"input": "24680", "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has recently got a job as a cashier at a local store. His day at work is $L$ minutes long. Vasya has already memorized $n$ regular customers, the $i$-th of which comes after $t_{i}$ minutes after the beginning of th... | [{"type": "stdin_stdout", "input": "1 1000000000 1\n0 1000000000\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 1000000000 1\n0 1000000000\n", "output": "0"}, {"type": "stdin_stdout", "input": "0 1000000000 1\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "0 1000000000 1000000000\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBridge Removal\n\nICPC islands once had been a popular tourist destination. For nature preservation, however, the government decided to prohibit entrance to the islands, and to remove all the man-made structures there. Th... | [{"type": "stdin_stdout", "input": "4\n1 2 3\n10 37 30\n10\n1 2 2 1 1 5 1 10 8\n10 2 1 20 2 1 30 1 1\n3\n1 1\n1 1\n0", "output": "114\n139\n2\n"}, {"type": "stdin_stdout", "input": "4\n1 2 3\n10 37 52\n10\n1 2 2 1 1 5 1 10 8\n10 2 1 20 2 1 30 1 1\n3\n1 1\n1 1\n0", "output": "136\n139\n2\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhy would we want to stop to only 50 shades of grey? Let's see to how many we can go. \n\nWrite a function that takes a number n as a parameter and return an array containing n shades of grey in hexadecimal code (`#aaaaaa... | [{"input": "5000", "output": "[[\"#010101\", \"#020202\", \"#030303\", \"#040404\", \"#050505\", \"#060606\", \"#070707\", \"#080808\", \"#090909\", \"#0a0a0a\", \"#0b0b0b\", \"#0c0c0c\", \"#0d0d0d\", \"#0e0e0e\", \"#0f0f0f\", \"#101010\", \"#111111\", \"#121212\", \"#131313\", \"#141414\", \"#151515\", \"#161616\", \"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou get a \"text\" and have to shift the vowels by \"n\" positions to the right.\n(Negative value for n should shift to the left.)\n\"Position\" means the vowel's position if taken as one item in a list of all vowels with... | [{"input": "\"This is a test!\"\n-1", "output": "[\"This as e tist!\"]", "fn_name": "vowel_shift"}, {"input": "\"This is a test!\"\n-5", "output": "[\"This as e tist!\"]", "fn_name": "vowel_shift"}, {"input": "\"This is a test!\"\n0", "output": "[\"This is a test!\"]", "fn_name": "vowel_shift"}, {"input": "\"This is a ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAri the monster is not an ordinary monster. She is the hidden identity of Super M, the Byteforcesβ superhero. Byteforces is a country that consists of n cities, connected by n - 1 bidirectional roads. Every road connects ... | [{"type": "stdin_stdout", "input": "63 20\n35 26\n54 5\n32 56\n56 53\n59 46\n37 31\n46 8\n4 1\n2 47\n59 42\n55 11\n62 6\n30 7\n60 24\n41 36\n34 22\n24 34\n21 2\n12 52\n8 44\n60 21\n24 30\n48 35\n48 25\n32 57\n20 37\n11 54\n11 62\n42 58\n31 43\n12 23\n55 48\n51 55\n41 27\n25 33\n21 18\n42 12\n4 15\n51 60\n62 39\n46 41\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n Consider the following operation:\n \n We take a positive integer `n` and replace it with the sum of its `prime factors` (if a prime number is presented multiple times in the factorization of `n`, then it's count... | [{"input": "156", "output": "[5]", "fn_name": "factor_sum"}, {"input": "31", "output": "[31]", "fn_name": "factor_sum"}, {"input": "24", "output": "[5]", "fn_name": "factor_sum"}, {"input": "35", "output": "[7]", "fn_name": "factor_sum"}, {"input": "4", "output": "[4]", "fn_name": "factor_sum"}] | code_functional |
[
{
"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\nA `Nice array` is defined to be an array where for every value `n` in the array, there is also an element `n-1` or `n+1` in the array.\n\nexample:\n\n```\n[2,10,9,3] is Nice array because\n\n2=3-1\n10=9+1\n3=2+1\n9=10-1\n... | [{"input": "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]", "output": "[true]", "fn_name": "is_nice"}, {"input": "[1, -1, 2, -2, 3, -3, 6]", "output": "[false]", "fn_name": "is_nice"}, {"input": "[3, 2, 10, 4, 1, 6]", "output": "[false]", "fn_name": "is_nice"}, {"input": "[0, 1, 3, -2, 5, 4]", "output": "[false]", "fn_name": "is_nice... | code_functional |
[
{
"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\nThe central dogma of molecular biology is that DNA is transcribed into RNA, which is then tranlsated into protein. RNA, like DNA, is a long strand of nucleic acids held together by a sugar backbone (ribose in this case). ... | [{"input": "\"AUGUAUCCUUCCAUCAAGGAAACCAUGCGCGUUCAGCUUUCUAUGGAGGGUAGUGUUAACUACCACGCCUUCAAGUGCACUGGAAAAGGAGAGGGAAAACCAUACGAAGGCACCCAAAGCCUGAAUAUUACAAUAACUGAAGGAGGUCCUCUGCCAUUUGCUUUUGACAUUCUGUCACACGCCUUUCAGUAUGGCAUCAAGGUCUUCGCCAAGUACCCCAAAGAAAUUCCUGACUUCUUUAAGCAGUCUCUACCUGGUGGUUUUUCUUGGGAAAGAGUAAGCACCUAUGAAGAUGGAGGAGUGCUU... | code_functional |
[
{
"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\nGiven two integers `a` and `b`, which can be positive or negative, find the sum of all the numbers between including them too and return it. If the two numbers are equal return `a` or `b`.\n\n**Note:** `a` and `b` are not... | [{"input": "-321\n123", "output": "[-44055]", "fn_name": "get_sum"}, {"input": "-505\n4", "output": "[-127755]", "fn_name": "get_sum"}, {"input": "321\n123", "output": "[44178]", "fn_name": "get_sum"}, {"input": "505\n4", "output": "[127759]", "fn_name": "get_sum"}, {"input": "-50\n0", "output": "[-1275]", "fn_name": "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a number, write a function to output its reverse digits. (e.g. given 123 the answer is 321)\n\n\nNumbers should preserve their sign; i.e. a negative number should still be negative when reversed.\n\n### Examples\n`... | [{"input": "98989898", "output": "[89898989]", "fn_name": "reverse_number"}, {"input": "4321234", "output": "[4321234]", "fn_name": "reverse_number"}, {"input": "-123", "output": "[-321]", "fn_name": "reverse_number"}, {"input": "123", "output": "[321]", "fn_name": "reverse_number"}, {"input": "1000", "output": "[1]", ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"Point reflection\" or \"point symmetry\" is a basic concept in geometry where a given point, P, at a given position relative to a mid-point, Q has a corresponding point, P1, which is the same distance from Q but in the ... | [{"input": "[1000, 15]\n[-7, -214]", "output": "[[-1014, -443]]", "fn_name": "symmetric_point"}, {"input": "[10, -10]\n[-10, 10]", "output": "[[-30, 30]]", "fn_name": "symmetric_point"}, {"input": "[1, -35]\n[-12, 1]", "output": "[[-25, 37]]", "fn_name": "symmetric_point"}, {"input": "[2, 6]\n[-2, -6]", "output": "[[-6... | code_functional |
[
{
"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\nGiven an array of 4 integers \n```[a,b,c,d]``` representing two points ```(a, b)``` and ```(c, d)```, return a string representation of the slope of the line joining these two points. \n\nFor an undefined slope (division... | [{"input": "[15, -3, 15, -3]", "output": "[\"undefined\"]", "fn_name": "find_slope"}, {"input": "[-6, 57, -6, 84]", "output": "[\"undefined\"]", "fn_name": "find_slope"}, {"input": "[17, -3, 17, 8]", "output": "[\"undefined\"]", "fn_name": "find_slope"}, {"input": "[90, 54, 90, 2]", "output": "[\"undefined\"]", "fn_nam... | code_functional |
[
{
"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\nWe define the score of permutations of combinations, of an integer number (the function to obtain this value:```sc_perm_comb```) as the total sum of all the numbers obtained from the permutations of all the possible combi... | [{"input": "348", "output": "[3675]", "fn_name": "sc_perm_comb"}, {"input": "340", "output": "[1631]", "fn_name": "sc_perm_comb"}, {"input": "333", "output": "[369]", "fn_name": "sc_perm_comb"}, {"input": "6", "output": "[6]", "fn_name": "sc_perm_comb"}, {"input": "0", "output": "[0]", "fn_name": "sc_perm_comb"}] | code_functional |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.