messages listlengths 1 1 | ground_truth stringlengths 156 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "You play a computer game. In this game, you lead a party of $m$ heroes, and you have to clear a dungeon with $n$ monsters. Each monster is characterized by its power $a_i$. Each hero is characterized by his power $p_i$ and endurance $s_i$.\n\nThe heroes clear the dungeon day by day. In the beginni... | [{"input": "2\n6\n2 3 11 14 1 8\n2\n3 2\n000 1\n5\n3 5 100 2 3\n2\n30 5\n90 1\n", "output": "-1\n-1\n"}, {"input": "2\n6\n1 3 11 14 1 10\n2\n3 2\n100 1\n5\n3 5 100 2 3\n2\n30 5\n11 1\n", "output": "5\n-1\n"}, {"input": "2\n6\n1 3 11 16 1 10\n2\n3 2\n100 1\n5\n3 5 100 2 3\n2\n30 5\n11 1\n", "output": "5\n-1\n"}, {"input... | code_stdio |
[
{
"content": "In this problem MEX of a certain array is the smallest positive integer not contained in this array.\n\nEveryone knows this definition, including Lesha. But Lesha loves MEX, so he comes up with a new problem involving MEX every day, including today.\n\nYou are given an array $a$ of length $n$. Les... | [{"input": "100\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\n", "output... | code_stdio |
[
{
"content": "As a New Year's gift, Dolphin received a string s of length 19.\nThe string s has the following format: `[five lowercase English letters],[seven lowercase English letters],[five lowercase English letters]`.\nDolphin wants to convert the comma-separated string s into a space-separated string.\nWrit... | [{"input": "gaiku,atcoder,tasks", "output": "gaiku atcoder tasks\n"}, {"input": "abgde,fchihgf,edcba", "output": "abgde fchihgf edcba\n"}, {"input": "ha,pypnewyear,enjoy", "output": "ha pypnewyear enjoy\n"}, {"input": "gaiku,atcoeer,tasks", "output": "gaiku atcoeer tasks\n"}, {"input": "abcde,fghihcf,edgba", "output": ... | code_stdio |
[
{
"content": "Vanya is managed to enter his favourite site Codehorses. Vanya uses n distinct passwords for sites at all, however he can't remember which one exactly he specified during Codehorses registration.\n\nVanya will enter passwords in order of non-decreasing their lengths, and he will enter passwords of... | [{"input": "20 5\nvSyC787KlIL8kZ2Uv5sw\nWKWOP\n7i8J3E8EByIq\nNW2VyGweL\nmyR2sRNu\nmXusPP0\nf4jgGxra\n4wHRzRhOCpEt\npPz9kybGb\nOtSpePCRoG5nkjZ2VxRy\nwHYsSttWbJkg\nKBOP9\nQfiOiFyHPPsw3GHo8J8\nxB8\nqCpehZEeEhdq\niOLjICK6\nQ91\nHmCsfMGTFKoFFnv238c\nJKjhg\ngkEUh\nKBOP9\n", "output": "3 11\n"}, {"input": "20 5\nvSyC787KlIL8k... | code_stdio |
[
{
"content": "In Berland a bus travels along the main street of the capital. The street begins from the main square and looks like a very long segment. There are n bus stops located along the street, the i-th of them is located at the distance a_{i} from the central square, all distances are distinct, the stops... | [{"input": "6\n2 3 5 7 9 11\n11\n1 2 2 3 3 4 4 5 5 5 6\n", "output": " 18\n"}, {"input": "6\n2 3 5 7 11 13\n9\n1 2 2 3 3 4 5 5 6\n", "output": " 16\n"}, {"input": "4\n2 3 5 7\n9\n1 1 2 2 2 3 3 3 4\n... | code_stdio |
[
{
"content": "Ms. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine.\n\nFor example, to measure 200mg of aspirin using 300mg weights and 700mg weights, she can put one 700mg weight on the side of the medicine and three 300mg weights on the opposite side (Figure 1). Al... | [{"input": "700 300 200\n993 200 300\n244 200 500\n275 111 330\n275 010 385\n694 375 1747\n3 1 10010\n0 0 0", "output": "1 3\n100 495\n25 28\n21 55\n1 11\n163 297\n3336 2\n"}, {"input": "700 300 200\n500 283 300\n349 200 500\n275 110 330\n275 010 385\n1067 344 4002\n3 1 10001\n0 0 0", "output": "1 3\n56 100\n100 172\n0... | code_stdio |
[
{
"content": "There are n TV shows you want to watch. Suppose the whole time is split into equal parts called \"minutes\". The i-th of the shows is going from l_i-th to r_i-th minute, both ends inclusive.\n\nYou need a TV to watch a TV show and you can't watch two TV shows which air at the same time on the same... | [{"input": "10 798547896 459313948\n40312491 40315265\n40299842 40315264\n40296035 40315263\n40282844 40315262\n40304824 40315261\n40280414 40315260\n40299203 40315259\n40301967 40315258\n40276169 40315257\n40286575 40315256\n", "output": "236433977\n"}, {"input": "4 288243228 34715941\n996451829 999802844\n921286045 9... | code_stdio |
[
{
"content": "Given 2 strings, your job is to find out if there is a substring that appears in both strings. You will return true if you find a substring that appears in both strings, or false if you do not. We only care about substrings that are longer than one letter long.\n\n#Examples:\n\n````\n*Example 1*\n... | [{"input": "\"LoremipsumdolorsitametconsecteturadipiscingelitAeneannonaliquetligulautplaceratorciSuspendissepotentiMorbivolutpatauctoripsumegetaliquamPhasellusidmagnaelitNullamerostellustemporquismolestieaornarevitaediamNullaaliquamrisusnonviverrasagittisInlaoreetultricespretiumVestibulumegetnullatinciduntsempersemacru... | code_functional |
[
{
"content": "Print the K-th element of the following sequence of length 32:\n\n\n1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51\n\nConstraints\n\n* 1 \\leq K \\leq 32\n* All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the fo... | [{"input": "16", "output": "14\n"}, {"input": "24", "output": "15\n"}, {"input": "32", "output": "51\n"}, {"input": "-22", "output": "2\n"}, {"input": "-27", "output": "1\n"}, {"input": "-13", "output": "1\n"}, {"input": "-20", "output": "5\n"}, {"input": "001", "output": "1\n"}, {"input": "32", "output": "51\n"}, {"in... | code_stdio |
[
{
"content": "In the spring of 2014, a student successfully passed the university and started living alone. The problem here is what to do with the supper. He decided to plan a supper for the next N days.\n\nHe wants to maximize the total happiness he gets in N days. Of course, the more delicious or favorite yo... | [{"input": "3 1 -10\n-19\n-10\n-10", "output": "-27\n"}, {"input": "2 1 -10\n-19\n-10\n-10", "output": "-19\n"}, {"input": "3 1 -19\n-19\n-10\n-10", "output": "-39\n"}, {"input": "3 1 -19\n-19\n-10\n-18", "output": "-47\n"}, {"input": "2 1 -10\n-35\n-10\n-10", "output": "-19\n"}, {"input": "2 1 -10\n-35\n-3\n-10", "out... | code_stdio |
[
{
"content": "The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding — an active marketing strategy, that includes a set of measures to change either the brand (both for the company and the goods it produces) or its components: the name... | [{"input": "10 10\nlellelleel\ne l\ne l\ne l\ne l\ne l\ne e\nl l\nl e\nl l\ne e\n", "output": "lellelleel\n"}, {"input": "10 10\nlellelleel\ne l\ne l\ne l\ne l\ne l\ne e\nl l\nl e\nl l\ne e\n", "output": "lellelleel\n"}, {"input": "10 10\nlellelleel\ne l\ne l\ne l\ne l\ne l\ne e\nl l\nl e\nl l\ne f\n", "output": "lfllf... | code_stdio |
[
{
"content": "Victor and Peter are playing hide-and-seek. Peter has hidden, and Victor is to find him. In the room where they are playing, there is only one non-transparent wall and one double-sided mirror. Victor and Peter are points with coordinates (xv, yv) and (xp, yp) respectively. The wall is a segment jo... | [{"input": "-7366 1446\n-7727 -1428\n-2680 -3822 -5191 -5553\n-7304 -6313 -9229 1377\n", "output": "YES\n"}, {"input": "-4752 -3262\n-4582 6436\n-8997 -6490 -4630 1426\n-9865 -6697 -2371 -5622\n", "output": "YES"}, {"input": "-4752 -3262\n-4582 6436\n-8997 -6490 -4630 1426\n-9865 -3168 -2371 -5622\n", "output": "NO\n"}... | code_stdio |
[
{
"content": "You have a card deck of $n$ cards, numbered from top to bottom, i. e. the top card has index $1$ and bottom card — index $n$. Each card has its color: the $i$-th card has color $a_i$.\n\nYou should process $q$ queries. The $j$-th query is described by integer $t_j$. For each query you should:\n\nf... | [{"input": "5 15\n1 2 3 4 5\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "}, {"input": "5 15\n1 2 3 4 5\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n", "output": "5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "}, {"input": "5 15\n1 2 3 4 5\n5 5 5 5 5 5 5 5 2 5 5 5 5 5 5\n", "output": "5 1 1 1 1 1 1 1 3 2 1 1 1 1 1 "}... | code_stdio |
[
{
"content": "Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built n towers in a row. The i-th tower is made of hi identical blocks. For clarification see picture for the first sample.\n\nLimak will repeat the following operation till everything is destroyed.\n\nBlo... | [{"input": "170\n1 2 1 2 1 1 1 1 2 3 2 1 1 2 2 1 2 1 2 1 1 2 3 3 2 1 1 1 1 1 1 1 1 2 1 2 3 3 2 1 2 2 1 2 3 2 1 1 2 3 2 1 2 1 1 1 2 3 3 2 1 2 1 2 1 1 1 2 1 2 1 1 2 2 1 1 2 1 2 2 1 2 1 2 2 1 2 1 2 3 2 1 1 2 3 4 4 3 2 1 2 1 2 1 2 3 3 2 1 2 1 1 1 1 1 1 1 2 2 1 1 2 1 1 1 1 2 1 1 2 3 2 1 2 2 1 2 1 1 1 2 2 1 2 1 2 3 2 1 2 1 1... | code_stdio |
[
{
"content": "You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes.\n\nIn one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes. In other words, after each move the number you have cannot contain any leading... | [{"input": "574196831896431419\n", "output": "33\n"}, {"input": "1000000000000000000\n", "output": "0\n"}, {"input": "213716413141380147\n", "output": "-1\n"}, {"input": "250070000011111111\n", "output": "16\n"}, {"input": "502727272727272727\n", "output": "18\n"}, {"input": "700777111111222222\n", "output": "30\n"}, {... | code_stdio |
[
{
"content": "Given a string $s$ of length $n$ and integer $k$ ($1 \\le k \\le n$). The string $s$ has a level $x$, if $x$ is largest non-negative integer, such that it's possible to find in $s$: $x$ non-intersecting (non-overlapping) substrings of length $k$, all characters of these $x$ substrings are the sa... | [{"input": "92 5\nwwwwwwwwwwwwwwwwwgggggggggggggggbbbbyyyyyyyyyyyyyyjjjjjjjjjjjuuuuuuuuaaaaaaaaaaaafooooooooig\n", "output": "3\n"}, {"input": "92 5\nwwwwwwwwwwwwwwwwwgggggggggggggggbbbbyyyyyyyyyyyyyyjjjjjjjjjjjuuuuuuuuaaaaaaaaaaaafooooooooig\n", "output": "3\n"}, {"input": "92 6\nwwwwwwwwwwwwwwwwwgggggggggggggggbbbbyy... | code_stdio |
[
{
"content": "You are the planning manager of an animation production company. What animation production companies produce these days is not limited to animation itself. Related products, such as figures of characters and character song CDs, are also important sources of revenue. How much this profit can be inc... | [{"input": "4\nakzakr 2 1 8\nfnmyi 5 2 3 4 6 9\ntsnukk 5 2 3 4 7 9\nyskwcnt 6 3 4 7 8 9 10\n4\nakzakr 1 2\nfnmyi 3 10 11 12\ntsnukk 2 1 8\nyskwcnt 2 1 8\n5\nknmmdk 2 13 19\nakmhmr 4 13 15 19 22\nmksyk 6 3 7 12 13 15 19\nskrkyk 3 1 4 8\ntmemm 3 1 17 24\n5\nknmmdk 5 5 6 16 18 26\nakmhmr 9 3 4 7 11 14 15 17 18 20\nmksyk 5... | code_stdio |
[
{
"content": "Ryouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what she hears on the notebook, and the notebook became her memory.\n\nThough Ryouko is f... | [{"input": "100 100\n28 28 28 34 28 28 28 40 28 28 28 28 28 28 28 28 28 28 28 28 28 28 47 28 28 28 28 28 28 28 28 28 28 28 28 28 19 28 28 28 28 28 28 28 28 28 28 28 28 28 46 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 49 28 28 28 28 28 28 28 31 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28... | code_stdio |
[
{
"content": "There are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M +... | [{"input": "20 20 1\n-100 -100 -100 100 100 -100 100 100 100 -100 100 100 -100 100 100 -100 -100 -100 100 100\n-100 -100 100 -100 100 100 -100 100 100 100 -100 100 100 -100 100 -100 -100 -100 -100 100\n-100 -100 100 100 100 100 -100 100 -100 100 -100 100 100 100 100 100 100 -100 100 -100\n-100 -100 100 100 -100 100 100... | code_stdio |
[
{
"content": "Vasya the programmer lives in the middle of the Programming subway branch. He has two girlfriends: Dasha and Masha, who live at the different ends of the branch, each one is unaware of the other one's existence.\n\nWhen Vasya has some free time, he goes to one of his girlfriends. He descends into ... | [{"input": "999999 1000000\n", "output": "Equal\n"}, {"input": "1000000 999993\n", "output": "Masha\n"}, {"input": "999997 1000000\n", "output": "Dasha\n"}, {"input": "459973 1000000\n", "output": "Dasha\n"}, {"input": "1000001 999993\n", "output": "Masha\n"}, {"input": "1001001 999993\n", "output": "Masha\n"}, {"input... | code_stdio |
[
{
"content": "The flag of Berland is such rectangular field n × m that satisfies following conditions:\n\n Flag consists of three colors which correspond to letters 'R', 'G' and 'B'. Flag consists of three equal in width and height stripes, parralel to each other and to sides of the flag. Each stripe has exac... | [{"input": "15 28\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nBBBBBBBBBBBBBBBBBBBBBBBBBBBB\nG... | code_stdio |
[
{
"content": "Let's consider equation:x^2 + s(x)·x - n = 0, \n\nwhere x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.\n\nYou are given an integer n, find the smallest positive integer root of equation x, or else determine that there are no ... | [{"input": "160000001600000000\n", "output": "400000000\n"}, {"input": "250000002500000000\n", "output": "500000000\n"}, {"input": "360000003600000000\n", "output": "600000000\n"}, {"input": "490000004900000000\n", "output": "700000000\n"}, {"input": "640000006400000000\n", "output": "800000000\n"}, {"input": "81000000... | code_stdio |
[
{
"content": "There are N boxes arranged in a circle. The i-th box contains A_i stones.\n\nDetermine whether it is possible to remove all the stones from the boxes by repeatedly performing the following operation:\n\n* Select one box. Let the box be the i-th box. Then, for each j from 1 through N, remove exactl... | [{"input": "5\n12 26 12 10 8", "output": "NO\n"}, {"input": "5\n6 11 12 10 8", "output": "NO\n"}, {"input": "5\n6 16 12 10 8", "output": "NO\n"}, {"input": "5\n6 26 12 10 8", "output": "NO\n"}, {"input": "5\n12 6 12 10 8", "output": "NO\n"}, {"input": "5\n12 2 12 10 8", "output": "NO\n"}, {"input": "5\n12 3 12 10 8", "... | code_stdio |
[
{
"content": "The $\\text{$gcdSum$}$ of a positive integer is the $gcd$ of that integer with its sum of digits. Formally, $\\text{$gcdSum$}(x) = gcd(x, \\text{ sum of digits of } x)$ for a positive integer $x$. $gcd(a, b)$ denotes the greatest common divisor of $a$ and $b$ — the largest integer $d$ such that bo... | [{"input": "3\n17\n110\n182\n", "output": "18\n110\n183\n"}, {"input": "3\n17\n110\n359\n", "output": "18\n110\n360\n"}, {"input": "3\n17\n100\n359\n", "output": "18\n102\n360\n"}, {"input": "3\n33\n100\n359\n", "output": "33\n102\n360\n"}, {"input": "3\n42\n101\n359\n", "output": "42\n102\n360\n"}, {"input": "3\n17\n1... | code_stdio |
[
{
"content": "As shown in the following figure, there is a paper consisting of a grid structure where each cell is indicated by (x, y) coordinate system.\n\nWe are going to put drops of ink on the paper. A drop comes in three different sizes: Large, Medium, and Small. From the point of fall, the ink sinks into ... | [{"input": "2,5,3\n3,6,1\n3,4,2\n4,5,2\n3,6,3\n1,4,1", "output": "75\n5\n"}, {"input": "2,5,3\n1,6,3\n3,4,2\n4,5,2\n3,6,3\n2,4,1", "output": "73\n5\n"}, {"input": "2,5,3\n3,6,1\n2,4,2\n4,5,2\n3,6,3\n1,4,1", "output": "76\n5\n"}, {"input": "2,5,3\n3,6,1\n3,4,2\n5,5,2\n3,6,3\n1,4,1", "output": "72\n4\n"}, {"input": "2,5,... | code_stdio |
[
{
"content": "Mr. A wants to get to the destination on the Yamanote line.\n\nAfter getting on the train, Mr. A gets up for a minute and sleeps for b minutes repeatedly. It is c minutes after boarding to the destination, and you can get off if you are awake at this time, but on the contrary, if you are sleeping,... | [{"input": "196 2 133", "output": "133\n"}, {"input": "128 12 16", "output": "16\n"}, {"input": "134 22 13", "output": "13\n"}, {"input": "134 22 21", "output": "21\n"}, {"input": "50 40 68", "output": "128\n"}, {"input": "36 18 39", "output": "219\n"}, {"input": "128 22 23", "output": "23\n"}, {"input": "134 22 26", "... | code_stdio |
[
{
"content": "Maxim wants to buy some games at the local game shop. There are $n$ games in the shop, the $i$-th game costs $c_i$.\n\nMaxim has a wallet which can be represented as an array of integers. His wallet contains $m$ bills, the $j$-th bill has value $a_j$.\n\nGames in the shop are ordered from left to ... | [{"input": "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000\n", "output": "4\n"}, {"input": "6 4\n4 8 15 16 23 42\n1000 1000 1000 1010\n", "output": "4\n"}, {"input": "6 4\n4 8 17 16 23 42\n1000 1000 1000 1010\n", "output": "4\n"}, {"input": "6 4\n4 8 15 16 23 42\n1000 1000 1000 1000\n", "output": "4\n"}, {"input": "5 1\n100... | code_stdio |
[
{
"content": "Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, you reach photo n. Similarly, by swiping right from the last photo you reach p... | [{"input": "100 20 100 10202\nwwwwhhwhhwhhwhhhhhwwwhhhwwwhwwhwhhwwhhwwwhwwhwwwhwhwhwwhhhwhwhhwhwwhhwhwhwwwhwwwwhwhwwwwhwhhhwhwhwww\n", "output": "100\n"}, {"input": "100 20 100 19121\nwwwwhhwhhwhhwhhhhhwwwhhhwwwhwwhwhhwwhhwwwhwwhwwwhwhwhwwhhhwhwhhwhwwhhwhwhwwwhwwwwhwhwwwwhwhhhwhwhwww\n", "output": "100\n"}, {"input": "... | code_stdio |
[
{
"content": "You are given a weighted undirected graph. The vertices are enumerated from 1 to n. Your task is to find the shortest path between the vertex 1 and the vertex n.\n\nInput\n\nThe first line contains two integers n and m (2 ≤ n ≤ 105, 0 ≤ m ≤ 105), where n is the number of vertices and m is the numb... | [{"input": "10 10\n1 5 12\n2 4 140\n2 10 149\n3 6 154\n3 7 17\n3 8 226\n3 10 132\n4 10 55\n5 8 33\n7 8 173\n", "output": "1 5 8 7 3 10\n"}, {"input": "10 10\n1 5 12\n2 4 140\n2 10 149\n3 6 154\n2 7 17\n3 8 226\n3 10 136\n4 10 55\n5 8 33\n7 8 173\n", "output": "1 5 8 7 2 10\n"}, {"input": "10 10\n1 5 12\n2 4 140\n2 10 1... | code_stdio |
[
{
"content": "The cake shop made a lot of roll cakes of various sizes. You have been tasked with arranging this cake in a box.\n\nThe roll cake is so soft that it will collapse if another roll cake is on top. Therefore, as shown in Fig. (A), all roll cakes must be arranged so that they touch the bottom of the b... | [{"input": "30 4 5 6\n8 5 5 5\n50 3 3 3 10 10\n49 3 3 3 10 10", "output": "OK\nNA\nOK\nNA\n"}, {"input": "30 3 5 6\n6 5 5 5\n50 3 3 3 13 10\n49 3 3 3 10 10", "output": "OK\nNA\nNA\nNA\n"}, {"input": "30 4 5 6\n30 5 5 5\n50 3 3 3 10 10\n49 3 3 3 4 10", "output": "OK\nOK\nOK\nOK\n"}, {"input": "53 4 5 6\n7 5 2 2\n73 3 0 ... | code_stdio |
[
{
"content": "# Task\nGiven some sticks by an array `V` of positive integers, where V[i] represents the length of the sticks, find the number of ways we can choose three of them to form a triangle.\n\n# Example\n\n For `V = [2, 3, 7, 4]`, the result should be `1`.\n\n There is only `(2, 3, 4)` can form a triang... | [{"input": "[1, 2, 3, 10, 20, 30, 4]", "output": "[1]", "fn_name": "counting_triangles"}, {"input": "[2, 3, 7, 4]", "output": "[1]", "fn_name": "counting_triangles"}, {"input": "[5, 6, 7, 8]", "output": "[4]", "fn_name": "counting_triangles"}, {"input": "[2, 2, 2, 2]", "output": "[4]", "fn_name": "counting_triangles"},... | code_functional |
[
{
"content": "Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.\n\nYou've got string s = s_1s_2... s_{n} (n is the length of the string), consisting only of characters \".\" and \"#\" and m queries. Each query is described by a pair of ... | [{"input": "#..##...#.\n7\n5 9\n6 10\n1 7\n2 10\n2 5\n2 10\n3 4\n", "output": "2\n2\n3\n4\n2\n4\n0\n"}, {"input": "#..##...#.\n7\n5 9\n6 10\n1 7\n2 10\n3 5\n2 10\n3 4\n", "output": "2\n2\n3\n4\n1\n4\n0\n"}, {"input": "#..##...#/\n7\n5 9\n6 10\n1 7\n2 10\n3 5\n2 10\n3 4\n", "output": "2\n2\n3\n4\n1\n4\n0\n"}, {"input": ... | code_stdio |
[
{
"content": "A set of four prime numbers arranged like (a, a + 2, a + 6, a + 8) is called a quadruplet prime number. Of the four prime numbers that make up a quadruplet prime, the largest number is called the size of the quadruplet prime. For example, the smallest prime quadruplet is a set of (5, 7, 11, 13), w... | [{"input": "13\n14\n15\n16\n17\n18\n19\n20\n10010\n0", "output": "13\n13\n13\n13\n13\n13\n19\n19\n9439\n"}, {"input": "13\n14\n15\n16\n17\n36\n19\n20\n10000\n0", "output": "13\n13\n13\n13\n13\n19\n19\n19\n9439\n"}, {"input": "13\n14\n15\n16\n27\n36\n19\n20\n10000\n0", "output": "13\n13\n13\n13\n19\n19\n19\n19\n9439\n"}... | code_stdio |
[
{
"content": "Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list so that the concatenation of the two words, i.e. words[i] + words[j] is a palindrome.\n\nExamples:\n\nNon-string inputs should be converted to strings.\n\nReturn an array of arrays containing pairs of distinc... | [{"input": "[\"abcd\", \"dcba\", \"lls\", \"s\", \"sssll\"]", "output": "[[[0, 1], [1, 0], [2, 4], [3, 2]]]", "fn_name": "palindrome_pairs"}, {"input": "[\"dog\", \"cow\", \"tap\", \"god\", \"pat\"]", "output": "[[[0, 3], [2, 4], [3, 0], [4, 2]]]", "fn_name": "palindrome_pairs"}, {"input": "[5777, \"dog\", \"god\", tru... | code_functional |
[
{
"content": "Let $n$ be a positive integer. Let $a, b, c$ be nonnegative integers such that $a + b + c = n$.\n\nAlice and Bob are gonna play rock-paper-scissors $n$ times. Alice knows the sequences of hands that Bob will play. However, Alice has to play rock $a$ times, paper $b$ times, and scissors $c$ times.\... | [{"input": "7\n2\n1 1 0\nRR\n2\n2 0 0\nSS\n2\n2 0 0\nRR\n3\n1 2 0\nRRR\n3\n2 1 0\nRRR\n1\n1 0 0\nP\n1\n1 0 0\nS\n", "output": "YES\nPR\nYES\nRR\nNO\nYES\nPPR\nNO\nNO\nYES\nR\n"}, {"input": "7\n2\n1 1 0\nRR\n2\n2 0 0\nSS\n2\n2 0 0\nRR\n3\n1 2 0\nRRR\n3\n2 1 0\nRRR\n1\n1 0 0\nP\n1\n1 0 0\nS\n", "output": "YES\nPR\nYES\nR... | code_stdio |
[
{
"content": "If I give you a date, can you tell me what day that date is? For example, december 8th, 2015 is a tuesday.\n\nYour job is to write the function ```day(d)```\nwhich takes a string representation of a date as input, in the format YYYYMMDD. The example would be \"20151208\". The function needs to out... | [{"input": "\"19000228\"", "output": "[\"Wednesday\"]", "fn_name": "day"}, {"input": "\"19000301\"", "output": "[\"Thursday\"]", "fn_name": "day"}, {"input": "\"20151208\"", "output": "[\"Tuesday\"]", "fn_name": "day"}, {"input": "\"20160301\"", "output": "[\"Tuesday\"]", "fn_name": "day"}, {"input": "\"20140728\"", "o... | code_functional |
[
{
"content": "Snuke loves \"paper cutting\": he cuts out characters from a newspaper headline and rearranges them to form another string.\nHe will receive a headline which contains one of the strings S_1,...,S_n tomorrow.\nHe is excited and already thinking of what string he will create.\nSince he does not know... | [{"input": "3\ncbaa\ndaacc\nacacac\n", "output": "aac\n"}, {"input": "3\ncacb\nccabe\n`cacbc", "output": "abcc\n"}, {"input": "3\ncaaa\ndaacc\nacacac", "output": "aac\n"}, {"input": "3\ncaca\ncca`d\nacacac", "output": "acc\n"}, {"input": "3\nacba\nda`cb\nacacbc", "output": "abc\n"}, {"input": "3\nbcac\ncc`be\nacacbc", ... | code_stdio |
[
{
"content": "You are the gym teacher in the school.\n\nThere are $n$ students in the row. And there are two rivalling students among them. The first one is in position $a$, the second in position $b$. Positions are numbered from $1$ to $n$ from left to right.\n\nSince they are rivals, you want to maximize the ... | [{"input": "22\n100 100 100 1\n100 100 1 100\n100 0 100 1\n100 0 1 100\n2 0 1 2\n2 100 1 2\n2 0 2 1\n2 100 2 1\n100 0 1 2\n100 98 1 2\n100 97 1 2\n100 0 2 1\n100 98 2 1\n100 97 2 1\n100 0 99 100\n100 98 99 100\n100 97 99 100\n100 0 100 99\n100 98 100 99\n100 97 100 99\n100 0 13 37\n100 0 66 11\n", "output": "99\n99\n99... | code_stdio |
[
{
"content": "Make the 2D list by the sequential integers started by the ```head``` number.\n\nSee the example test cases for the expected output.\n\n``` \nNote:\n\n-10**20 < the head number <10**20\n1 <= the number of rows <= 1000\n0 <= the number of columms <= 1000\n```\n\nWrite Python code to solve this pr... | [{"input": "10000000000\n2\n2", "output": "[[[10000000000, 10000000001], [10000000002, 10000000003]]]", "fn_name": "make_2d_list"}, {"input": "2\n3\n4", "output": "[[[2, 3, 4, 5], [6, 7, 8, 9], [10, 11, 12, 13]]]", "fn_name": "make_2d_list"}, {"input": "5\n6\n1", "output": "[[[5], [6], [7], [8], [9], [10]]]", "fn_name"... | code_functional |
[
{
"content": "Professor Abacus has just built a new computing engine for making numerical tables. It was designed to calculate the values of a polynomial function in one variable at several points at a time. With the polynomial function f(x) = x2 + 2x + 1, for instance, a possible expected calculation result is... | [{"input": "2\n1.0\n4.0\n14.21446074361601\n16.0\n25.0\n1\n-30.5893962764\n6.055835197262627\n39.3853798058\n74.3727663177\n0\n42.56611822314588\n79.5420238202\n28.0282396675\n-30.3627807522\n-49.34987576252381\n-25.34819013612247\n7.58575761381\n0\n-21.42163030108298\n-47.94509062430888\n-23.354080083023813\n-2.110808... | code_stdio |
[
{
"content": "With your birthday coming up soon, your eccentric friend sent you a message to say \"happy birthday\":\n\n hhhappyyyy biirrrrrthddaaaayyyyyyy to youuuu\n hhapppyyyy biirtttthdaaay too youuu\n happy birrrthdayy to youuu\n happpyyyy birrtthdaaay tooooo youu\n\nAt first it looks like a so... | [{"input": "\"happy birthday\"\n\"hhhappyyyy biirrrrrthddaaaayyyyyyy to youuuu\"", "output": "[7680]", "fn_name": "count_subsequences"}, {"input": "\"happy birthday\"\n\"hhaappyy bbiirrtthhddaayy\"", "output": "[2048]", "fn_name": "count_subsequences"}, {"input": "\"happy birthday\"\n\"appyh appy birth day\"", "output"... | code_functional |
[
{
"content": "10^9 contestants, numbered 1 to 10^9, will compete in a competition. There will be two contests in this competition.\n\nThe organizer prepared N problems, numbered 1 to N, to use in these contests. When Problem i is presented in a contest, it will be solved by all contestants from Contestant L_i t... | [{"input": "10\n457835016 1871204067\n456475528 529149798\n455108441 512701454\n455817105 523506955\n457368248 814532746\n455073228 459494089\n888688315 774276744\n457667152 974637457\n457293701 800549465\n456580262 636471526", "output": "1413369052"}, {"input": "10\n457835016 1799005777\n456475528 140431139\n455108441... | code_stdio |
[
{
"content": "Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself.\n\n<image>\n\nRecently Xenia has bought n_r red gems, n_g green gems and n_b blue gems. Each of the gems has a weight.\n\nNow, she is going to pick three gems.\n\... | [{"input": "5\n2 2 3\n7 8\n6 3\n3 1 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n0 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\n12\n", "output": "14\n1999999996000000002\n24\n24\n122\n"}, {"input": "5\n2 2 3\n7 8\n6 3\n3 0 4\n1 1 1\n1\n1\n1000000000\n2 2 2\n0 2\n5 4\n6 7\n2 2 2\n1 2\n3 4\n6 7\n3 4 1\n3 2 1\n7 3 3 4\... | code_stdio |
[
{
"content": "N people are waiting in a single line in front of the Takahashi Store. The cash on hand of the i-th person from the front of the line is a positive integer A_i.\n\nMr. Takahashi, the shop owner, has decided on the following scheme: He picks a product, sets a positive integer P indicating its price... | [{"input": "15\n4\n1\n4\n1\n3\n18\n4\n12\n5\n3\n6\n8\n15\n12\n9", "output": "43\n"}, {"input": "15\n4\n1\n4\n1\n3\n18\n4\n12\n5\n3\n3\n8\n15\n12\n9", "output": "42\n"}, {"input": "15\n4\n1\n4\n1\n3\n31\n4\n8\n5\n3\n6\n8\n15\n7\n9", "output": "46\n"}, {"input": "15\n3\n1\n1\n1\n5\n15\n2\n6\n5\n3\n5\n8\n9\n6\n12", "outpu... | code_stdio |
[
{
"content": "Your program fails again. This time it gets \"Wrong answer on test 233\"\n\n.\n\nThis is the easier version of the problem. In this version 1 ≤ n ≤ 2000. You can hack this problem only if you solve and lock both problems.\n\nThe problem is about a test containing n one-choice-questions. Each of th... | [{"input": "100 100\n82 51 81 14 37 17 78 123 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 3 76 80 60 100 49 70 59 72 8 38 75 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 16 3 55 37 85 46 22 159 52 98 41 21 84 63 17 62 91\n", ... | code_stdio |
[
{
"content": "Amugae has a sentence consisting of $n$ words. He want to compress this sentence into one word. Amugae doesn't like repetitions, so when he merges two words into one word, he removes the longest prefix of the second word that coincides with a suffix of the first word. For example, he merges \"samp... | [{"input": "9\nL M5 M5D M5DAYBl0r6gmttCTR M5DAYBl0r6gmttCTRoKdM9EFrX22qBZpAc M5DAYBl0r6gmttCTRoKdM9EFrX22qBZpAczv7fKrVgg0xe M5DAYBl0r6gmttCTRoKdM9EFrX22qBZpAczv7fKrVhg0xe09re M5DAYBl0r6gmttCTRoKdM9EFrX22qBZpAczv7fKrVhg0xe09re M5DAYBl0r6gmttCTRoKdM9EFrX22qBZpAczv7fKrVhg0xe09re\n", "output": "LM5DAYBl0r6gmttCTRoKdM9EFrX2... | code_stdio |
[
{
"content": "There are n incoming messages for Vasya. The i-th message is going to be received after t_{i} minutes. Each message has a cost, which equals to A initially. After being received, the cost of a message decreases by B each minute (it can become negative). Vasya can read any message after receiving i... | [{"input": "108 576 610 844 573\n242 134 45 515 430 354 405 179 174 366 155 4 300 176 96 36 508 70 75 316 118 563 55 340 128 214 138 511 507 437 454 478 341 443 421 573 270 362 208 107 256 471 436 378 336 507 383 352 450 411 297 34 179 551 119 524 141 288 387 9 283 241 304 214 503 559 416 447 495 61 169 228 479 568 368... | code_stdio |
[
{
"content": "There is a plan view consisting of 12 vertical and 12 horizontal squares showing the terrain. Each square is painted white or black. White represents the sea and black represents the land. When two black squares touch each other vertically or horizontally, they are said to be continuous. In this p... | [{"input": "111100001111\n111000001111\n110000001110\n100000001111\n000100010000\n010000111010\n000001111100\n100011111110\n010101111100\n111000111000\n111100010000\n000000100000\n\n110001111100\n110010001010\n010010000001\n010000000001\n010000000110\n010000111000\n010000000000\n010000010010\n010000000001\n010010000001... | code_stdio |
[
{
"content": "Flatland is inhabited by pixels of three colors: red, green and blue. We know that if two pixels of different colors meet in a violent fight, only one of them survives the fight (that is, the total number of pixels decreases by one). Besides, if pixels of colors x and y (x ≠ y) meet in a violent f... | [{"input": "2147483630 2147483642 2147483610\n", "output": " 2147483630\n"}, {"input": "1944219055 454183506 1369298327\n", "output": " 1944219055\n"}, {"input": "772486757 1747374885 377299255\n", "output": " ... | code_stdio |
[
{
"content": "Masa Kita, who entered the University of Tokyo, joined a circle called TSG (University of Tokyo Super Gamers).\n\nThis circle exhibits games at the Komaba Festival every year, and Masa Kita decided to create and display the games as well.\n\nThe game created by Kitamasa is a common falling block p... | [{"input": "3\n......\n......\n......\n......\n......\n......\n......\n......\n.RGB..\nRGOP..\nRGBPB.\nRGBPP.\nGBRGYP\nGBRRYP\nBGGRBB\nBPRGYY\nGGPRRY\nBYPPRB\nYGGGPB\nGYYYPR\nYRBRBR\nYBRBRB\nBRBRBR\nBRBRBR\n......\n......\n......\n......\n......\n......\n......\n......\n.....-\n......\n..OO..\n..OO..", "output": "3\n18... | code_stdio |
[
{
"content": "ICP city has an express company whose trucks run from the crossing S to the crossing T. The president of the company is feeling upset because all the roads in the city are one-way, and are severely congested. So, he planned to improve the maximum flow (edge disjoint paths) from the crossing S to t... | [{"input": "3 3\n3 2\n1 2\n3 1\n1 3", "output": "2\n2\n1\n3"}, {"input": "4 1\n1 2\n2 1", "output": "1\n1\n1\n"}, {"input": "3 1\n1 2\n2 1", "output": "1\n1\n1\n"}, {"input": "4 1\n1 4\n4 1", "output": "1\n1\n1\n"}, {"input": "5 -1\n1 4\n4 11", "output": "0\n0\n"}, {"input": "11 -1\n1 4\n3 3", "output": "0\n0\n"}, {"in... | code_stdio |
[
{
"content": "You have to create a function that converts integer given as string into ASCII uppercase letters.\n\nAll ASCII characters have their numerical order in table. \n\nFor example,\n\n```\nfrom ASCII table, character of number 65 is \"A\".\n```\n\nNumbers will be next to each other, So you have to spli... | [{"input": "\"84726982693273833278793270857832737832657889327984726982326765836983\"", "output": "[\"THERE IS NO FUN IN ANY OTHER CASES\"]", "fn_name": "convert"}, {"input": "\"32327332327679866932328380656769833232\"", "output": "[\" I LOVE SPACES \"]", "fn_name": "convert"}, {"input": "\"7332767375693285808069826... | code_functional |
[
{
"content": "A-Aun's breathing\n\nProblem Statement\n\nMaeda-san and Goto-san, who will both turn 70 years old in 2060, are long-time friends and friends who fought together at the ACM-ICPC in college.\n\nThe two are still excited about competitive programming, drinking tea together.\n\nWhen the two of us dran... | [{"input": "4\nA\nUn\nB\nUn", "output": "NO\n"}, {"input": "4\n@\nUn\nB\nUn", "output": "NO\n"}, {"input": "4\n@\nUn\nB\nnU", "output": "NO\n"}, {"input": "4\n@\nUn\nB\noU", "output": "NO\n"}, {"input": "4\n@\nUn\nA\noU", "output": "NO\n"}, {"input": "4\n@\nUn\nA\nUo", "output": "NO\n"}, {"input": "4\n@\nTn\nA\nUo", "o... | code_stdio |
[
{
"content": "Calculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters, or print that it is impossible.\n\nString s consists only of lowercase Latin letters, and it is allowed to change characters only to lowercase Latin letters too.\n\n\n--... | [{"input": "smaxpqplaqqbxuqxalqmbmmgubbpspxhawbxsuqhhegpmmpebqmqpbbeplwaepxmsahuepuhuhwxeqmmlgqubuaxehwuwasgxpqmugbmuawuhwqlswllssueglbxepbmwgs\n1\n", "output": "0\n"}, {"input": "smaxpqplaqqbxuqxalqmbmmgubbpspxhawbxsuqhhegpmmpebqmqpbbeplwaepxmsahuepuhuhwxeqmmlgqubuaxehwuwasgxpqmugbmuawuhwqlswllssueglbxepbmwgs\n1\n", "... | code_stdio |
[
{
"content": "Polycarp has a strict daily schedule. He has n alarms set for each day, and the i-th alarm rings each day at the same time during exactly one minute.\n\nDetermine the longest time segment when Polycarp can sleep, i. e. no alarm rings in that period. It is possible that Polycarp begins to sleep in ... | [{"input": "70\n03:33\n23:36\n03:16\n18:18\n06:36\n06:58\n17:27\n04:07\n14:39\n15:53\n17:09\n05:16\n20:28\n09:34\n02:41\n14:18\n20:00\n04:14\n00:25\n20:18\n16:34\n10:13\n21:45\n11:08\n16:19\n20:50\n03:08\n05:06\n02:08\n02:51\n15:16\n11:02\n18:13\n18:35\n00:04\n08:50\n06:12\n20:16\n12:05\n04:01\n08:38\n03:57\n22:44\n04:... | code_stdio |
[
{
"content": "You are given two integers $l$ and $r$, $l\\le r$. Find the largest possible value of $a mod b$ over all pairs $(a, b)$ of integers for which $r\\ge a \\ge b \\ge l$.\n\nAs a reminder, $a mod b$ is a remainder we get when dividing $a$ by $b$. For example, $26 mod 8 = 2$.\n\n\n-----Input-----\n\nEa... | [{"input": "4\n1 1\n117772020 1000000000\n13 102\n1 1716228987\n", "output": "0\n499999999\n50\n858114493\n"}, {"input": "4\n1 1\n117772020 1010000000\n16 102\n2 1716228987\n", "output": "0\n504999999\n50\n858114493\n"}, {"input": "4\n1 1\n117772020 1000000000\n13 139\n1 1137810732\n", "output": "0\n499999999\n69\n5689... | code_stdio |
[
{
"content": "Relative B man came to A child's house. He is 3 years old and loves singing. He is singing the song \"Kobutanuki Tsuneko\" (written and composed by Naozumi Yamamoto), which he learned from kindergarten. In this song, the four words \"kobuta,\" \"raccoon dog,\" \"fox,\" and \"cat\" are arranged in ... | [{"input": "5\napple\nyellow\ngeorgia\ngnik\nemail\n7\napple\nyellow\ngeorgia\nking\nemail\nwink\nlucky\n0", "output": "NG\nOK\n"}, {"input": "5\napple\nyellow\ngeorgia\ngnik\nemail\n7\napple\nzellow\ngeorgia\nking\nemail\nwink\nlucky\n0", "output": "NG\nNG\n"}, {"input": "5\napple\nyellow\ngeorgia\ngnik\nemail\n7\napp... | code_stdio |
[
{
"content": "You are given an array a of length 2n. Consider a partition of array a into two subsequences p and q of length n each (each element of array a should be in exactly one subsequence: either in p or in q).\n\nLet's sort p in non-decreasing order, and q in non-increasing order, we can denote the sorte... | [{"input": "16\n433598100 998244362 998244362 393272824 998244362 998244362 998244362 998244362 998244362 79531025 1605828054 998244362 998244362 998244362 998244362 998244362 998244363 998244363 998244363 998244363 998244363 998244363 998244363 260228230 1941226836 998244363 1240344627 998244363 998244363 998244363 99... | code_stdio |
[
{
"content": "There are n cups of different sizes and three trays (bon festivals) A, B, and C, and these cups are placed on top of each of the three trays in a pile. However, in any tray, the smallest cup in the tray is on the bottom, the second smallest cup is on top, and the third smallest cup is on top, in a... | [{"input": "3 10\n0\n1 1\n2 2 3\n4 13\n1 1 2\n1 3\n1 4\n1 5\n2 1 2\n0\n0\n3 6\n0\n1 1\n2 2 3\n0 0", "output": "9\n-1\n0\n-1\n"}, {"input": "3 10\n0\n1 1\n2 2 3\n4 20\n2 1 2\n1 3\n1 4\n1 5\n2 1 2\n0\n0\n3 3\n0\n1 1\n2 2 3\n0 0", "output": "9\n3\n0\n-1\n"}, {"input": "3 10\n0\n1 1\n2 2 3\n4 7\n2 1 2\n1 2\n1 4\n1 5\n2 1 2... | code_stdio |
[
{
"content": "Today you are going to lead a group of elven archers to defend the castle that is attacked by an army of angry orcs. Three sides of the castle are protected by impassable mountains and the remaining side is occupied by a long wall that is split into n sections. At this moment there are exactly ai ... | [{"input": "100 100 1000\n814 165 709 628 263 653 940 749 331 437 129 547 575 73 480 429 396 688 489 312 425 946 444 228 547 512 477 849 53 241 643 416 141 502 449 58 686 111 171 844 113 790 79 107 399 846 945 427 361 68 295 630 260 939 679 458 485 738 202 141 166 940 5 73 108 351 245 998 640 772 604 123 389 758 491 34... | code_stdio |
[
{
"content": "One of Arkady's friends works at a huge radio telescope. A few decades ago the telescope has sent a signal $s$ towards a faraway galaxy. Recently they've received a response $t$ which they believe to be a response from aliens! The scientists now want to check if the signal $t$ is similar to $s$.\n... | [{"input": "01\nzbrronwaofovklkopelo\n", "output": "19\n"}, {"input": "01\nzbrronwaofovklkopelo\n", "output": "19\n"}, {"input": "01\nzbrronwaofovklkopeln\n", "output": "19\n"}, {"input": "01\nzbrrnnwaofovklkopeln\n", "output": "19\n"}, {"input": "01\nzbrrnnwaofovklkopelo\n", "output": "19\n"}, {"input": "01\nzbrrnnwbo... | code_stdio |
[
{
"content": "Три брата договорились о встрече. Пронумеруем братьев следующим образом: пусть старший брат имеет номер 1, средний брат имеет номер 2, а младший брат — номер 3. \n\nКогда пришло время встречи, один из братьев опоздал. По заданным номерам двух братьев, которые пришли вовремя, вам предстоит определи... | [{"input": "3 1\n", "output": "2\n"}, {"input": "2 1\n", "output": "3\n"}, {"input": "2 3\n", "output": "1\n"}, {"input": "1 2\n", "output": "3\n"}, {"input": "1 3\n", "output": "2\n"}, {"input": "3 2\n", "output": "1\n"}] | code_stdio |
[
{
"content": "An expression is formed by taking the digits 1 to 9 in numerical order and then inserting into each gap between the numbers either a plus sign or a minus sign or neither.\n\nYour task is to write a method which takes one parameter and returns the **smallest possible number** of plus and minus sign... | [{"input": "160", "output": "[null]", "fn_name": "operator_insertor"}, {"input": "100", "output": "[3]", "fn_name": "operator_insertor"}, {"input": "766", "output": "[4]", "fn_name": "operator_insertor"}, {"input": "389", "output": "[2]", "fn_name": "operator_insertor"}, {"input": "11", "output": "[5]", "fn_name": "ope... | code_functional |
[
{
"content": "There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer y-coordinates, and their x-coordinate is equal to -100, while the second group is p... | [{"input": "50 60\n445 303 -861 -583 436 -125 312 -700 -829 -865 -276 -25 -725 -286 528 -221 757 720 -572 514 -514 359 294 -992 -838 103 611 776 830 143 -247 182 -241 -627 299 -824 635 -571 -660 924 511 -876 160 569 -570 827 75 558 708 46\n899 974 750 -138 -439 -904 -113 -761 -150 -92 -279 489 323 -649 -759 667 -600 -7... | code_stdio |
[
{
"content": "Ask a small girl - \"How old are you?\". She always says strange things... Lets help her!\n\n\nFor correct answer program should return int from 0 to 9.\n\nAssume test input string always valid and may look like \n\"1 year old\" or \"5 years old\", etc.. The first char is number only.\n\nWrite Pyt... | [{"input": "\"2 years old\"", "output": "[2]", "fn_name": "get_age"}, {"input": "\"3 years old\"", "output": "[3]", "fn_name": "get_age"}, {"input": "\"4 years old\"", "output": "[4]", "fn_name": "get_age"}, {"input": "\"5 years old\"", "output": "[5]", "fn_name": "get_age"}, {"input": "\"6 years old\"", "output": "[6]... | code_functional |
[
{
"content": "Amr loves Chemistry, and specially doing experiments. He is preparing for a new interesting experiment.\n\nAmr has n different types of chemicals. Each chemical i has an initial volume of a_{i} liters. For this experiment, Amr has to mix all the chemicals together, but all the chemicals volumes mu... | [{"input": "20\n1 2 3 4 6 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 100000\n", "output": "113\n"}, {"input": "20\n1 2 3 4 6 8 16 32 64 128 256 512 1024 2048 3647 8192 16384 32768 65536 100000\n", "output": "124\n"}, {"input": "20\n1 2 3 4 6 8 16 32 8 128 256 512 1024 2048 3647 13320 16384 32768 65536... | code_stdio |
[
{
"content": "Problem B Parallel Lines\n\nGiven an even number of distinct planar points, consider coupling all of the points into pairs. All the possible couplings are to be considered as long as all the given points are coupled to one and only one other point.\n\nWhen lines are drawn connecting the two points... | [{"input": "4\n-1 -1\n1 1\n-1 4\n0 5", "output": "1\n"}, {"input": "4\n-2 -1\n1 1\n-1 4\n0 5", "output": "0\n"}, {"input": "4\n-1 0\n1 1\n-1 2\n2 2", "output": "0\n"}, {"input": "4\n0 -1\n1 1\n-1 2\n2 3", "output": "0\n"}, {"input": "4\n-1 0\n1 1\n-1 2\n1 2", "output": "1\n"}, {"input": "4\n0 -1\n1 1\n-1 2\n2 5", "outp... | code_stdio |
[
{
"content": "We have N integers. The i-th number is A_i.\n\\{A_i\\} is said to be pairwise coprime when GCD(A_i,A_j)=1 holds for every pair (i, j) such that 1\\leq i < j \\leq N.\n\\{A_i\\} is said to be setwise coprime when \\{A_i\\} is not pairwise coprime but GCD(A_1,\\ldots,A_N)=1.\nDetermine if \\{A_i\\} ... | [{"input": "3\n6 10 15\n", "output": "setwise coprime\n"}, {"input": "3\n17 10 15", "output": "setwise coprime\n"}, {"input": "3\n26 10 15", "output": "setwise coprime\n"}, {"input": "3\n7 10 31", "output": "pairwise coprime\n"}, {"input": "3\n3 4 5\n", "output": "pairwise coprime\n"}, {"input": "3\n7 19 4", "output": ... | code_stdio |
[
{
"content": "Let's define the sum of two permutations p and q of numbers 0, 1, ..., (n - 1) as permutation [Image], where Perm(x) is the x-th lexicographically permutation of numbers 0, 1, ..., (n - 1) (counting from zero), and Ord(p) is the number of permutation p in the lexicographical order.\n\nFor example,... | [{"input": "84\n83 4 68 34 24 2 48 38 22 51 5 62 31 67 66 53 49 70 9 71 46 41 30 8 50 17 28 79 15 80 32 43 14 74 29 42 81 60 56 65 23 0 77 76 58 78 1 11 37 27 75 35 18 73 54 20 57 33 36 6 61 69 64 55 39 10 3 45 13 26 59 82 21 25 63 52 16 44 47 72 19 12 7 40\n63 41 80 52 36 45 17 69 22 66 37 21 46 44 64 9 48 74 58 81 10... | code_stdio |
[
{
"content": "Polycarp loves geometric progressions very much. Since he was only three years old, he loves only the progressions of length three. He also has a favorite integer k and a sequence a, consisting of n integers.\n\nHe wants to know how many subsequences of length three can be selected from a, so that... | [{"input": "18 10\n10000000 100000000 1000000000 -10000000 -100000000 -1000000000 -10000000 -100000000 -1000000000 -10000000 -100000000 -1000000000 10000000 100000000 1000000000 10000000 100000000 1000000000\n", "output": "20\n"}, {"input": "18 10\n10000000 100000000 1000000000 -10000000 -100000000 -1000000000 -1000000... | code_stdio |
[
{
"content": "There are three sticks with integer lengths $l_1, l_2$ and $l_3$.\n\nYou are asked to break exactly one of them into two pieces in such a way that:\n\nboth pieces have positive (strictly greater than $0$) integer length;\n\nthe total length of the pieces is equal to the original length of the stic... | [{"input": "68\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1 2\n1 1... | code_stdio |
[
{
"content": "Rick wants a faster way to get the product of the largest pair in an array. Your task is to create a performant solution to find the product of the largest two integers in a unique array of positive numbers. All inputs will be valid.\nPassing [2, 6, 3] should return 18, the product of [6, 3].\n\n`... | [{"input": "[39, 135, 47, 275, 37, 108, 265, 457, 2, 133, 316, 330, 153, 253, 321, 411]", "output": "[187827]", "fn_name": "max_product"}, {"input": "[354, 463, 165, 62, 472, 53, 347, 293, 252, 378, 420, 398, 255, 89]", "output": "[218536]", "fn_name": "max_product"}, {"input": "[114, 424, 53, 272, 128, 215, 25, 329, 2... | code_functional |
[
{
"content": "There are some candies that need to be distributed to some children as fairly as possible (i.e. the variance of result needs to be as small as possible), but I don't know how to distribute them, so I need your help. Your assignment is to write a function with signature `distribute(m, n)` in which ... | [{"input": "-5\n-5", "output": "[[]]", "fn_name": "distribute"}, {"input": "10\n-5", "output": "[[]]", "fn_name": "distribute"}, {"input": "15\n-5", "output": "[[]]", "fn_name": "distribute"}, {"input": "-5\n0", "output": "[[]]", "fn_name": "distribute"}, {"input": "10\n0", "output": "[[]]", "fn_name": "distribute"}, {... | code_functional |
[
{
"content": "On the great island of Baltia, there live N people, numbered from 1 to N. There are exactly M pairs of people that are friends with each other. The people of Baltia want to organize a successful party, but they have very strict rules on what a party is and when the party is successful. On the isla... | [{"input": "20 57\n13 14\n12 20\n18 3\n17 20\n15 9\n18 13\n12 19\n2 4\n9 2\n12 11\n14 1\n16 11\n11 14\n16 4\n16 15\n11 19\n15 4\n10 15\n12 5\n9 3\n10 2\n10 4\n20 19\n14 7\n19 2\n5 8\n6 14\n4 17\n2 17\n17 9\n13 9\n19 9\n18 8\n12 16\n18 5\n7 1\n8 3\n11 20\n6 13\n20 5\n13 8\n17 19\n7 6\n9 11\n18 9\n13 1\n12 14\n7 3\n10 16... | code_stdio |
[
{
"content": "You might have heard about the next game in Lara Croft series coming out this year. You also might have watched its trailer. Though you definitely missed the main idea about its plot, so let me lift the veil of secrecy.\n\nLara is going to explore yet another dangerous dungeon. Game designers deci... | [{"input": "636553724 546535019 115079316355948443\n", "output": "425992073 546535018\n"}, {"input": "548492800 434105920 179638683192075937\n", "output": "134679777 434105920\n"}, {"input": "595261150 794915864 332353903994901365\n", "output": "177161677 794915848\n"}, {"input": "636553724 546535019 115079316355948443... | code_stdio |
[
{
"content": "Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!\n\nThe popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass wit... | [{"input": "20 10\niwbiucrjoj\nqvjewvdrgwgc\newwqyhtdzakryafqaacimthycyasyb\ncuoscayekvbsqokyfdmjnojkjennf\nhkuv\njtdgbespjdtbc\ngeulitsrlqihoujvwuobnfospq\nzphnlqxacchxhyeehnpfwdjnwvj\nxicsaoyfgtdbwqfrdgaiyn\natgshewfkuxaipizcdev\nvp\nyblkfmqsj\nyevxolvycyrrooosberqzrabefdckg\nrytykrlgttc\nafphunqbtydppxotf\nnkfoatpik... | code_stdio |
[
{
"content": "Return a new array consisting of elements which are multiple of their own index in input array (length > 1).\n\nSome cases: \n\n```\n[22, -6, 32, 82, 9, 25] => [-6, 32, 25]\n\n[68, -1, 1, -7, 10, 10] => [-1, 10]\n\n[-56,-85,72,-26,-14,76,-27,72,35,-21,-67,87,0,21,59,27,-92,68] => [-85, 72, 0, 68]... | [{"input": "[-56, -85, 72, -26, -14, 76, -27, 72, 35, -21, -67, 87, 0, 21, 59, 27, -92, 68]", "output": "[[-85, 72, 0, 68]]", "fn_name": "multiple_of_index"}, {"input": "[28, 38, -44, -99, -13, -54, 77, -51]", "output": "[[38, -44, -99]]", "fn_name": "multiple_of_index"}, {"input": "[-1, -49, -1, 67, 8, -60, 39, 35]", ... | code_functional |
[
{
"content": "Let's play a game using a robot on a rectangular board covered with a square mesh (Figure D-1). The robot is initially set at the start square in the northwest corner facing the east direction. The goal of this game is to lead the robot to the goal square in the southeast corner.\n\n<image>\n\nFig... | [{"input": "8 3\n0 0 -1 1 0 0 0 1\n2 3 1 2 3 0 0 1\n3 3 0 0 0 1 -1 4\n11 9 2 9\n4 4\n3 3 4 0\n1 2 4 4\n0 1 1 0\n0 2 4 4\n16 7 2 1\n2 8\n2 1\n4 1\n0 4\n1 3\n1 0\n2 1\n0 6\n1 4\n1 9 3 1\n0 0", "output": "13\n11\n5\n"}, {"input": "8 3\n0 0 0 0 -1 0 0 1\n2 3 0 1 4 0 0 1\n3 3 0 0 0 -1 0 8\n9 9 1 9\n4 4\n3 3 4 0\n1 1 4 4\n1 ... | code_stdio |
[
{
"content": "Petya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product is equal to a square of some integer.\n\nTwo ways are considered different if ... | [{"input": "20\n20 34 51 40 70 64 14 30 24 20 6 1 70 28 38 43 9 60 31 69\n", "output": "2047\n"}, {"input": "20\n20 34 51 40 70 64 14 30 24 20 6 1 70 28 38 43 9 60 31 69\n", "output": "2047\n"}, {"input": "18\n22 41 40 8 36 48 23 5 58 12 26 44 53 49 3 56 58 57\n", "output": "127\n"}, {"input": "18\n22 41 40 8 36 48 23 ... | code_stdio |
[
{
"content": "Let's call a number k-good if it contains all digits not exceeding k (0, ..., k). You've got a number k and an array a containing n numbers. Find out how many k-good numbers are in a (count each number every time it occurs in array a).\n\n\n-----Input-----\n\nThe first line contains integers n and... | [{"input": "10 6\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n", "output": "10\n"}, {"input": "10 6\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n1234560\n", "output": "10\n"}, {"input": "10 6\n2416023\n1234560\n1234560\n1234560\n1234560\... | code_stdio |
[
{
"content": "Zhinü was a child of the Emperor, but he was weaving the machine even if he opened it at the request of his father.\n\nIt was a pleasure of the Emperor to wear clothes made of a splendid cloth called Unnishiki woven by Zhinü. Unnishiki has a short lifespan and deteriorates quickly, but there was n... | [{"input": "5\n0 4 0 2 9 3 4 8 2 -1\n3 8 -1 0 0 3 1 2 17 54\n1 2 1 2 41 2 17 21 11 0\n-2 2 14 24 0 21 1 14 20 4\n7 6 30 0 10 1 22 -2 8 -1", "output": "NG\nNG\nNG\nOK\nNG\n"}, {"input": "5\n0 4 -1 2 7 3 4 8 2 -1\n3 5 -1 0 0 3 0 6 8 62\n1 4 1 0 76 4 17 2 11 0\n-2 2 14 24 -1 27 0 14 28 3\n7 -1 30 0 0 1 37 -2 0 -1", "outpu... | code_stdio |
[
{
"content": "Given an array of arguments, representing system call arguments keys and values, join it into a single, space-delimited string. You don't need to care about the application name -- your task is only about parameters.\n\nEach element of the given array can be:\n* a single string,\n* a single string... | [{"input": "[[\"foo\"], \"bar\", [\"baz\", \"qux\"], [\"xyzzy\", \"a\"], \"a\", [\"a\"], [\"a\", \"plugh\"]]", "output": "[\"foo bar --baz qux --xyzzy a a a -a plugh\"]", "fn_name": "args_to_string"}, {"input": "[[\"---\"], \"---\", [\"---\", \"---\"], [\"-----\", \"-\"], \"-\", [\"-\"], [\"-\", \"-----\"]]", "output":... | code_functional |
[
{
"content": "Once N boys and M girls attended a party. You are given a matrix A of N rows and M columns where Aij is 1 if the i-th boy likes the j-th girl, otherwise it will be 0. Note that it is not necessary that if a boy x likes girl y, then girl y should like boy x.\nYou know that if there are two differen... | [{"input": "2\n4 3\n101\n111\n111\n011\n2 -1\n10\n01", "output": "12\n0\n"}, {"input": "2\n4 3\n101\n101\n111\n011\n2 0\n10\n01", "output": "10\n0\n"}, {"input": "2\n4 3\n101\n101\n110\n000\n-1 1\n10\n01", "output": "4\n0\n"}, {"input": "2\n4 3\n100\n101\n110\n000\n-1 1\n10\n01", "output": "3\n0\n"}, {"input": "2\n4 3\... | code_stdio |
[
{
"content": "Ataru Oafoot of Aizu Gakuen University High School decided to play with a slot machine.\n\nWhen you insert a medal on this machine, three reels will start spinning and each reel will stop automatically. In a normal game (normal game), 3 medals are inserted, and when the symbols are aligned, the fo... | [{"input": "3 2 30 3 41 226\n9 0 18 4 20 118\n5 5 12 0 15 203\n13 4 19 2 22 197\n7 4 24 4 17 209\n0 0 0 0 0 0", "output": "172\n795\n410\n1199\n617\n"}, {"input": "3 2 30 3 41 226\n9 0 36 4 20 118\n5 5 12 0 18 203\n13 4 19 2 22 197\n1 4 42 4 17 209\n0 0 0 0 0 0", "output": "172\n921\n419\n1199\n173\n"}, {"input": "3 2 ... | code_stdio |
[
{
"content": "Given two non-negative decimal integers $a$ and $b$, calculate their AND (logical conjunction), OR (logical disjunction) and XOR (exclusive disjunction) and print them in binary representation of 32 bits.\n\nConstraints\n\n* $0 \\leq a, b \\leq 2^{32} - 1$\n\nInput\n\nThe input is given in the fol... | [{"input": "-136 -1", "output": "11111111111111111111111101111000\n11111111111111111111111111111111\n00000000000000000000000010000111\n"}, {"input": "-104 -3", "output": "11111111111111111111111110011000\n11111111111111111111111111111101\n00000000000000000000000001100101\n"}, {"input": "-104 -5", "output": "11111111111... | code_stdio |
[
{
"content": "Create a function that takes a string as a parameter and does the following, in this order:\n\n1. replaces every letter with the letter following it in the alphabet (see note below)\n2. makes any vowels capital\n3. makes any consonants lower case\n\n**Note:** the alphabet should wrap around, so `Z... | [{"input": "\"Hello World\"", "output": "[\"Ifmmp xpsmE\"]", "fn_name": "changer"}, {"input": "\"sponge1\"", "output": "[\"tqpOhf1\"]", "fn_name": "changer"}, {"input": "\"Cat30\"", "output": "[\"dbU30\"]", "fn_name": "changer"}, {"input": "\"Alice\"", "output": "[\"bmjdf\"]", "fn_name": "changer"}, {"input": "\"dogs\"... | code_functional |
[
{
"content": "Santa Claus has n candies, he dreams to give them as gifts to children.\n\nWhat is the maximal number of children for whose he can give candies if Santa Claus want each kid should get distinct positive integer number of candies. Santa Class wants to give all n candies he has.\n\n\n-----Input-----\... | [{"input": "1000\n", "output": "44\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 54 \n"}, {"input": "990\n", "output": "44\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 4... | code_stdio |
[
{
"content": "You are going to the beach with the idea to build the greatest sand castle ever in your head! The beach is not as three-dimensional as you could have imagined, it can be decribed as a line of spots to pile up sand pillars. Spots are numbered 1 through infinity from left to right. \n\nObviously, th... | [{"input": "1000000000000000000 1000000000000000000\n", "output": "1414213562\n"}, {"input": "1000000000000000000 1000000000000000000\n", "output": "1414213562\n"}, {"input": "999999997351043581 1000000000000000000\n", "output": "1414213561\n"}, {"input": "999999997351043581 1000000000000000000\n", "output": "141421356... | code_stdio |
[
{
"content": "After battling Shikamaru, Tayuya decided that her flute is too predictable, and replaced it with a guitar. The guitar has $6$ strings and an infinite number of frets numbered from $1$. Fretting the fret number $j$ on the $i$-th string produces the note $a_{i} + j$.\n\nTayuya wants to play a melody... | [{"input": "58260522 32004256 2436426 24979445 61648772 23690081\n10\n582107247 906728404 411434947 673536177 411497300 488012525 1035611341 800305059 992325267 138720156\n", "output": "837678839\n"}, {"input": "58260522 32004256 2436426 24979445 12477970 11891566\n10\n582107247 906728404 411434947 673536177 411497300 ... | code_stdio |
[
{
"content": "Little Petya likes permutations a lot. Recently his mom has presented him permutation q_1, q_2, ..., q_{n} of length n.\n\nA permutation a of length n is a sequence of integers a_1, a_2, ..., a_{n} (1 ≤ a_{i} ≤ n), all integers there are distinct. \n\nThere is only one thing Petya likes more than ... | [{"input": "55 28\n25 13 15 37 5 7 42 9 50 8 14 21 3 30 29 38 1 51 52 20 16 27 6 41 48 4 49 32 2 44 55 10 33 34 54 23 40 26 12 31 39 28 43 46 53 19 22 35 36 47 24 17 11 45 18\n17 29 13 26 5 23 6 10 8 32 53 39 2 11 3 21 52 55 46 20 12 47 36 51 1 38 22 42 15 14 40 28 33 34 48 49 4 16 41 37 24 7 43 30 54 44 50 25 27 9 18 ... | code_stdio |
[
{
"content": "You are given an array $a_1, a_2, \\dots , a_n$ and two integers $m$ and $k$.\n\nYou can choose some subarray $a_l, a_{l+1}, \\dots, a_{r-1}, a_r$. \n\nThe cost of subarray $a_l, a_{l+1}, \\dots, a_{r-1}, a_r$ is equal to $\\sum\\limits_{i=l}^{r} a_i - k \\lceil \\frac{r - l + 1}{m} \\rceil$, wher... | [{"input": "44 2 531595322\n926215961 -385821837 -278841122 -422772006 -509196878 -81824369 -101501043 -33095577 -520514931 402836017 48602657 881104200 -110528684 52550046 -208588735 -814534121 -548420443 410430115 -636402169 -848516069 -70639158 775203498 -679440929 -427359667 33598904 656872639 -225600926 57010433 -... | code_stdio |
[
{
"content": "You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.\n\nYou are really curious about prime numbers. ... | [{"input": "10 10\n20 53 6 97 74 12 92 48 13 97\n157 47 32 75 21 69 75 95 54 1\n97 36 1 41 87 1 23 39 44 27\n97 73 1 1 26 6 3 48 69 5\n70 93 42 35 5 12 22 33 29 13\n96 8 13 69 40 91 5 19 16 33\n61 92 54 82 60 24 63 64 59 65\n76 44 60 37 29 16 50 74 59 59\n77 58 95 30 52 25 34 2 49 92\n37 65 12 77 68 33 30 39 16 85\n", ... | code_stdio |
[
{
"content": "Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that.\n\nThe exceptions are processed by try-catch-blocks. There are two operators that work with the ... | [{"input": "21\n try \n try \n try \n try \n try \n try \n try \n try \n try \n try \n throw( qtSMze) \ncatch(LY,\"x3 j\")\ncatch(hgSAFgbMGx,\"moByu\")\ncatch(LmydVQgv,\"hbZl\")\ncatch(oK,\"B6OZx qy\")\ncatch(rrtnRQB,\"7VFkQMv\")\ncatch(CASqQXaz,\"d9oci1Kx\")\ncatch(CTCzsdD,\"u\")\ncatch(xqqMxbE... | code_stdio |
[
{
"content": "Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.\n\nVasya is watching a recorded football match now and makes no... | [{"input": "KASFLS\nASJBGGDLJFDDFHHTHJH\n42\n2 a 68 y\n4 h 64 r\n5 a 24 y\n6 h 20 r\n2 a 16 r\n9 a 96 y\n10 h 36 r\n12 a 44 y\n13 h 69 r\n16 a 62 r\n18 a 99 r\n20 h 12 r\n21 a 68 y\n25 h 40 y\n26 h 54 r\n28 h 91 r\n29 a 36 r\n33 a 91 y\n36 h 93 r\n37 h 60 r\n38 a 82 r\n41 a 85 y\n42 a 62 r\n46 a 22 r\n48 a 88 r\n49 a 8... | code_stdio |
[
{
"content": "Petya and Vasya are brothers. Today is a special day for them as their parents left them home alone and commissioned them to do n chores. Each chore is characterized by a single parameter — its complexity. The complexity of the i-th chore equals hi.\n\nAs Petya is older, he wants to take the chore... | [{"input": "150 10 140\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "# Task\n\nGiven an array of roots of a polynomial equation, you should reconstruct this equation.\n\n___\n\n## Output details:\n\n* If the power equals `1`, omit it: `x = 0` instead of `x^1 = 0`\n* If the power equals `0`, omit the `x`: `x - 2 = 0` instead of `x - 2x^0 = 0`\n* There should be no 2... | [{"input": "[1, 2, 3, 4, 5]", "output": "[\"x^5 - 15x^4 + 85x^3 - 225x^2 + 274x - 120 = 0\"]", "fn_name": "polynomialize"}, {"input": "[0, -2, -3]", "output": "[\"x^3 + 5x^2 + 6x = 0\"]", "fn_name": "polynomialize"}, {"input": "[0, 2, 3]", "output": "[\"x^3 - 5x^2 + 6x = 0\"]", "fn_name": "polynomialize"}, {"input": "[... | code_functional |
[
{
"content": "The Rebel fleet is on the run. It consists of m ships currently gathered around a single planet. Just a few seconds ago, the vastly more powerful Empire fleet has appeared in the same solar system, and the Rebels will need to escape into hyperspace. In order to spread the fleet, the captain of eac... | [{"input": "30\n(89+76)/87\n(81+78)/18\n(60+97)/32\n(41+14)/48\n(55+65)/27\n(29+15)/95\n(64+13)/96\n(78+30)/75\n(43+6)/60\n(69+34)/48\n(62+2)/97\n(85+42)/3\n(4+97)/42\n(1+18)/39\n(46+55)/76\n(22+59)/24\n(62+81)/98\n(64+8)/51\n(9+59)/48\n(47+2)/80\n(33+74)/76\n(61+83)/44\n(86+4)/51\n(65+41)/49\n(53+36)/45\n(6+19)/15\n(5... | code_stdio |
[
{
"content": "Taro is an elementary school student who has just learned multiplication. Somehow, he likes multiplication, so when he sees numbers, he wants to multiply. He seems to like to do the following for integers greater than or equal to 0. (Processing flow)\n\n* Procedure 1. If a certain integer n greate... | [{"input": "2\n999999\n1000100", "output": "12\n2\n"}, {"input": "2\n999999\n1010100", "output": "12\n3\n"}, {"input": "2\n999999\n1010110", "output": "12\n5\n"}, {"input": "2\n999999\n1101100", "output": "12\n4\n"}, {"input": "2\n114494\n1101001", "output": "11\n5\n"}, {"input": "2\n114494\n1111001", "output": "11\n7\... | code_stdio |
[
{
"content": "You are given a string S consisting of lowercase English letters. Another string T is initially empty. Determine whether it is possible to obtain S = T by performing the following operation an arbitrary number of times:\n\n* Append one of the following at the end of T: `dream`, `dreamer`, `erase` ... | [{"input": "resaremaerd", "output": "NO\n"}, {"input": "ersaremaerd", "output": "NO\n"}, {"input": "ersaremadrd", "output": "NO\n"}, {"input": "ersarfmadrd", "output": "NO\n"}, {"input": "errarfmadrd", "output": "NO\n"}, {"input": "errarfmadrc", "output": "NO\n"}, {"input": "arrerfmadrc", "output": "NO\n"}, {"input": "... | code_stdio |
[
{
"content": "One day Vasya was on a physics practical, performing the task on measuring the capacitance. He followed the teacher's advice and did as much as n measurements, and recorded the results in the notebook. After that he was about to show the results to the teacher, but he remembered that at the last l... | [{"input": "100\n4204 4719 4688 3104 4012 4927 4696 4614 4826 4792 3891 4672 4914 4740 4968 3879 4424 4755 3856 3837 4965 4939 4030 4941 4504 4668 4908 4608 3660 4822 4846 3945 4539 4819 4895 3746 4324 4233 4135 4956 4983 4546 4673 4617 3533 4851 4868 4838 4998 4769 4899 4578 3841 4974 4627 4990 4524 4939 4469 4233 443... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.