messages listlengths 1 1 | ground_truth stringlengths 156 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Bizon the Champion isn't just a bison. He also is a favorite of the \"Bizons\" team.\n\nAt a competition the \"Bizons\" got the following problem: \"You are given two distinct words (strings of English letters), s and t. You need to transform word s into word t\". The task looked simple to the guy... | [{"input": "itwtyhhsdjjffmmoqkkhxjouypznewstyorotxhozlytndehmaxogrohccnqcgkrjrdmnuaogiwmnmsbdaizqkxnkqxxiihbwepc\nsnixfywvcntitcefsgqxjcodwtumurcglfmnamnowzbjzmfzspbfuldraiepeeiyasmrsneekydsbvazoqszyjxkjiotushsddet\n", "output": "need tree\n"}, {"input": "yyyyxxxxyxyyxxxyxxyxxxyyxxxxxyyxxxyxxyxxyyyxxxyxxxyxyxyyxyyxyxxy... | code_stdio |
[
{
"content": "A: IP Address (Internet Protocol Address)\n\nproblem\n\nSince one number string is given, find the number of valid delimiters for IPv4 IP addresses. However, the effective delimiters for IPv4 IP addresses are as follows.\n\n* The sequence of numbers is divided into four, and each of the separated ... | [{"input": "243960381", "output": "0\n"}, {"input": "268287680", "output": "0\n"}, {"input": "108144550", "output": "3\n"}, {"input": "143647862", "output": "1\n"}, {"input": "120906486", "output": "1\n"}, {"input": "270129441", "output": "0\n"}, {"input": "17566177", "output": "8\n"}, {"input": "1544196", "output": "1... | code_stdio |
[
{
"content": "Kyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are labeled from 1 to k. Balls of the same color are indistinguishable. He draws balls from the bag one by one until the bag is empty. He noticed that he drew the last ball of color i before drawing th... | [{"input": "47\n20\n21\n16\n18\n24\n20\n25\n13\n20\n22\n26\n24\n17\n18\n21\n22\n21\n23\n17\n15\n24\n19\n18\n21\n20\n19\n26\n25\n20\n17\n17\n17\n26\n32\n20\n21\n25\n28\n24\n21\n21\n17\n28\n20\n20\n31\n19\n", "output": "295545118\n"}, {"input": "47\n20\n21\n16\n18\n24\n20\n25\n13\n20\n22\n26\n24\n17\n18\n21\n22\n21\n23\n... | code_stdio |
[
{
"content": "Taro's Shopping\n\nMammy decided to give Taro his first shopping experience. Mammy tells him to choose any two items he wants from those listed in the shopping catalogue, but Taro cannot decide which two, as all the items look attractive. Thus he plans to buy the pair of two items with the highest... | [{"input": "3 13\n17 20 30\n6 7\n1 2 5 1 4 11\n7 000\n22 34 102 94 59 39 61\n4 100\n133 98 100 50\n4 5\n10 5 10 13\n0 0", "output": "NONE\n7\nNONE\nNONE\nNONE\n"}, {"input": "3 48\n17 20 30\n6 1\n1 2 5 1 4 11\n7 000\n22 34 102 94 59 39 70\n4 100\n80 70 119 50\n4 20\n10 5 10 16\n0 0", "output": "47\nNONE\nNONE\nNONE\n20... | code_stdio |
[
{
"content": "One day Vasya went out for a walk in the yard but there weren't any of his friends outside and he had no one to play touch and run. But the boy didn't lose the high spirits and decided to play touch and run with himself. You may ask: \"How did he do that?\" The answer is simple.\n\nVasya noticed t... | [{"input": "1000 2000\n226 566\n20\n0 -100\n-100 100\n100 0\n42 0\n-100 -79\n-66 -16\n0 -7\n-1 0\n0 100\n100 91\n99 0\n1 0\n-100 0\n70 -100\n-100 100\n100 1\n66 0\n-100 1\n-47 -100\n-42 0\n", "output": "708\n"}, {"input": "1010 2000\n226 566\n20\n0 -100\n-100 100\n100 0\n42 0\n-100 -79\n-66 -16\n0 -7\n-1 0\n0 100\n100 ... | code_stdio |
[
{
"content": "Vasya has got an array consisting of $n$ integers, and two integers $k$ and $len$ in addition. All numbers in the array are either between $1$ and $k$ (inclusive), or equal to $-1$. The array is good if there is no segment of $len$ consecutive equal numbers.\n\nVasya will replace each $-1$ with so... | [{"input": "10 42 7\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "645711643\n"}, {"input": "10 42 7\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "645711643\n"}, {"input": "10 32 7\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "61884984"}, {"input": "10 32 1\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "0"}, {"input": "6... | code_stdio |
[
{
"content": "# Bubblesort Algorithm\n\n## Overview\n\nThe Bubblesort Algorithm is one of many algorithms used to sort a list of similar items (e.g. all numbers or all letters) into either ascending order or descending order. Given a list (e.g.):\n\n```python\n[9, 7, 5, 3, 1, 2, 4, 6, 8]\n```\n\nTo sort this l... | [{"input": "[6, 3, 4, 15, 14, 9, 1, 2, 7, 8, 5, 14, 11, 15, 17, 19]", "output": "[[3, 4, 6, 14, 9, 1, 2, 7, 8, 5, 14, 11, 15, 15, 17, 19]]", "fn_name": "bubblesort_once"}, {"input": "[9, 7, 5, 3, 1, 2, 4, 6, 8]", "output": "[[7, 5, 3, 1, 2, 4, 6, 8, 9]]", "fn_name": "bubblesort_once"}, {"input": "[6, 3, 4, 9, 1, 2, 7, ... | code_functional |
[
{
"content": "Find the convex hull of a given set of points P. In other words, find the smallest convex polygon containing all the points of P. Here, in a convex polygon, all interior angles are less than or equal to 180 degrees.\n\nPlease note that you should find all the points of P on both corner and boundar... | [{"input": "7\n4 0\n0 -1\n1 2\n2 -2\n4 2\n0 0\n2 3", "output": "7\n2 -2\n4 0\n4 2\n2 3\n1 2\n0 0\n0 -1\n"}, {"input": "7\n4 0\n0 -1\n1 2\n2 -2\n7 2\n-1 0\n2 3", "output": "6\n2 -2\n7 2\n2 3\n1 2\n-1 0\n0 -1\n"}, {"input": "7\n4 1\n0 -1\n1 2\n2 -2\n4 2\n-1 3\n2 3", "output": "6\n2 -2\n4 1\n4 2\n2 3\n-1 3\n0 -1\n"}, {"in... | code_stdio |
[
{
"content": "The ICPC committee would like to have its meeting as soon as possible to address every little issue of the next contest. However, members of the committee are so busy maniacally developing (possibly useless) programs that it is very difficult to arrange their schedules for the meeting. So, in orde... | [{"input": "3 2\n2 1 2\n-1\n3 3 8 8\n3 2\n4 1 5 0 9\n3 2 5 9\n5 2 4 5 7 12\n3 3\n0 1 4\n3 2 5 9\n2 2 4\n3 3\n2 1 1\n3 1 2 9\n2 2 4\n0 0", "output": "8\n5\n0\n1\n"}, {"input": "3 2\n2 1 2\n-1\n3 3 8 8\n3 2\n4 1 5 0 9\n3 2 5 9\n5 2 4 5 7 12\n3 3\n0 1 4\n3 2 5 9\n2 2 4\n3 3\n2 2 1\n3 1 2 9\n2 2 4\n0 0", "output": "8\n5\n0... | code_stdio |
[
{
"content": "Divide and rule\n\nTaro, Hanako, and Jiro rule the JAG Kingdom together. There are N cities in the JAG Kingdom, some of which are connected by two-way roads. You can always reach all the other cities from any city via one or more roads.\n\nOne day, Taro and Hanako finally made a mistake and decide... | [{"input": "6 7\n1 2\n1 4\n2 3\n2 5\n3 4\n4 5\n4 6\n2 1\n1 2\n3 3\n1 2\n2 3\n2 3\n4 3\n1 2\n2 3\n3 4\n5 4\n1 2\n2 3\n3 4\n4 5\n0 0", "output": "2\n1\n2\n0\n1\n1\n1\n1\n1\n1\n"}, {"input": "6 7\n1 2\n1 4\n2 3\n2 6\n3 4\n4 5\n4 6\n2 1\n1 2\n3 3\n1 2\n2 3\n2 3\n4 3\n1 2\n2 3\n3 4\n5 4\n1 2\n2 3\n3 4\n4 5\n0 0", "output": ... | code_stdio |
[
{
"content": "Letβs play a stone removing game.\n\nInitially, n stones are arranged on a circle and numbered 1, ... , n clockwise (Figure 1). You are also given two numbers k and m. From this state, remove stones one by one following the rules explained below, until only one remains. In step 1, remove stone m. ... | [{"input": "12 2 3\n100 15522 98\n10000 10000 10000\n0 0 0", "output": "10\n89\n2019\n"}, {"input": "12 2 3\n100 15914 98\n10000 10000 10000\n0 0 0", "output": "10\n16\n2019\n"}, {"input": "12 2 3\n100 15914 98\n10001 10000 10000\n0 0 0", "output": "10\n16\n2018\n"}, {"input": "12 2 3\n100 15914 12\n10001 10000 10000\n... | code_stdio |
[
{
"content": "The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.\n\nThe electoral system in the country is pretty unusual. At the first stage of elections the votes are counted for each city: it... | [{"input": "100 1\n439 158 619 538 187 153 973 781 610 475 94 1829 449 531 220 51 788 118 189 501 54 434 465 902 280 635 688 214 737 327 682 690 683 519 261 923 254 388 529 659 662 276 376 735 976 664 521 285 42 147 187 259 407 977 879 465 522 17 550 701 114 921 577 265 668 812 232 267 135 371 426 228 608 373 771 358 1... | code_stdio |
[
{
"content": "Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:\n\n$\\sum_{i = 1}^{a} \\sum_{j = 1}^{b} \\sum_{k = 1}^{c} d(i \\cdot j \\cdot k)$\n\nFind the sum modulo 1073741824 (2^30).\n\n\n-----Input----... | [{"input": "100 100 100\n", "output": "51103588\n"}, {"input": "100 100 100\n", "output": "51103588"}, {"input": "98 34 100\n", "output": "13589991\n"}, {"input": "90 82 100\n", "output": "35482866\n"}, {"input": "67 90 100\n", "output": "27880104\n"}, {"input": "98 34 100\n", "output": "13589991\n"}, {"input": "41 82 ... | code_stdio |
[
{
"content": "There are $n$ products in the shop. The price of the $i$-th product is $a_i$. The owner of the shop wants to equalize the prices of all products. However, he wants to change prices smoothly.\n\nIn fact, the owner of the shop can change the price of some product $i$ in such a way that the differenc... | [{"input": "5\n8 19551489\n31131899 17585660 3913937 14521321 9846714 96097161 115568124 35051437\n1 93900441\n15578410\n7 19560555\n124492495 53703939 20259503 99698023 98868060 83313210 5487534\n6 72321938\n59271765 72426489 16625497 51598082 31475864 20946400\n7 44965081\n49955408 62397026 39981552 92586939 6608008 ... | code_stdio |
[
{
"content": "Andrew was very excited to participate in Olympiad of Metropolises. Days flew by quickly, and Andrew is already at the airport, ready to go home. He has $n$ rubles left, and would like to exchange them to euro and dollar bills. Andrew can mix dollar bills and euro bills in whatever way he wants. T... | [{"input": "100000000\n30\n30\n", "output": "10\n"}, {"input": "100000000\n30\n30\n", "output": "10\n"}, {"input": "100000000\n60\n30\n", "output": "10\n"}, {"input": "100000000\n31\n33\n", "output": "0\n"}, {"input": "23456789\n66\n100\n", "output": "1\n"}, {"input": "99999999\n90\n100\n", "output": "9\n"}, {"input": ... | code_stdio |
[
{
"content": "DZY loves collecting special strings which only contain lowercase letters. For each lowercase letter c DZY knows its value w_{c}. For each special string s = s_1s_2... s_{|}s| (|s| is the length of the string) he represents its value with a function f(s), where $f(s) = \\sum_{i = 1}^{|s|}(w_{s_{i}... | [{"input": "pplkqmluhfympkjfjnfdkwrkpumgdmbkfbbldpepicbbmdgafttpopzdxsevlqbtywzkoxyviglbbxsohycbdqksrhlumsldiwzjmednbkcjishkiekfrchzuztkcxnvuykhuenqojrmzaxlaoxnljnvqgnabtmcftisaazzgbmubmpsorygyusmeonrhrgphnfhlaxrvyhuxsnnezjxmdoklpquzpvjbxgbywppmegzxknhfzyygrmejleesoqfwheulmqhonqaukyuejtwxskjldplripyihbfpookxkuehiwqthbf... | code_stdio |
[
{
"content": "Given the sum and gcd of two numbers, return those two numbers in ascending order. If the numbers do not exist, return `-1`, (or `NULL` in C, `tuple (-1,-1)` in C#, `pair (-1,-1)` in C++,`None` in Rust, `array {-1,-1} ` in Java and Golang).\n\n```\nFor example: \nGiven sum = 12 and gcd = 4...\n\ns... | [{"input": "1000\n5", "output": "[[5, 995]]", "fn_name": "solve"}, {"input": "50\n10", "output": "[[10, 40]]", "fn_name": "solve"}, {"input": "100\n5", "output": "[[5, 95]]", "fn_name": "solve"}, {"input": "12\n4", "output": "[[4, 8]]", "fn_name": "solve"}, {"input": "10\n5", "output": "[[5, 5]]", "fn_name": "solve"}, ... | code_functional |
[
{
"content": "Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\nLeha is playing a very interesting game. The game will be played on a rectangular grid consisting of N rows and M columns. Initially all the cells of the grid are uncolored. \n\nLeha's initial score is zero. At each ... | [{"input": "1\n16 -10", "output": "-326\n"}, {"input": "1\n32 -10", "output": "-662\n"}, {"input": "1\n23 -10", "output": "-473\n"}, {"input": "1\n23 -20", "output": "-923\n"}, {"input": "1\n17 -20", "output": "-677\n"}, {"input": "1\n17 -12", "output": "-413\n"}, {"input": "1\n17 -10", "output": "-347\n"}, {"input": "... | code_stdio |
[
{
"content": "The Fibonacci numbers are the numbers in the following integer sequence (Fn):\n>0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, ...\n\nsuch as \n>F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.\n\nGiven a number, say prod (for product), we search two Fibonacci numbers F(n) and F(n+1) verifyi... | [{"input": "203023208030065646654504166904697594722576", "output": "[[573147844013817084101, 927372692193078999176, false]]", "fn_name": "productFib"}, {"input": "203023208030065646654504166904697594722575", "output": "[[354224848179261915075, 573147844013817084101, true]]", "fn_name": "productFib"}, {"input": "2563195... | code_functional |
[
{
"content": "You have recently fallen through a hole and, after several hours of unconsciousness, have realized you are in an underground city. On one of your regular, daily walks through the unknown, you have encountered two unusually looking skeletons called Sanz and Pβpairus, who decided to accompany you an... | [{"input": "11\nfghdgrakmnq\n8\nfgh 4\ngh 3\nh 10\nhdg 6\nhdgra 7\nakm 12\nrakm 5\na 15\n3\n", "output": "52\n"}, {"input": "11\nfghdgrakmnq\n8\nfgh 4\ngh 3\nh 10\nhdg 6\nargdh 7\nakm 12\nrakm 5\na 15\n3\n", "output": "52\n"}, {"input": "11\nfghdgrakmnq\n8\nfgh 4\ngh 3\nh 10\nhdg 6\nargdh 7\nakm 12\nrakm 5\na 15\n6\n",... | code_stdio |
[
{
"content": "Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm.\n\nHis farm is presented by a rectangle grid with r rows and c columns. Some of these cells contain rice, others are empty. k chickens are living on his far... | [{"input": "4\n3 5 3\n..R..\n...R.\n....R\n6 4 12\nR..R\nR..R\nRRRR\nRRRR\nR..R\nR..R\n5 5 4\nRRR..\nR.R..\nRRR..\nR..R.\nR.R..\n2 31 62\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\nRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR\n", "output": "aaabb\ncccbb\nccccc\naaaa\nbbbb\nccdd\nhgfe\nijjj\nlllk\naaabb\nbbbbb\nbcccc\ndddcc\nddddd\nabcdefghij... | code_stdio |
[
{
"content": "# Task\n You're standing at the top left corner of an `n Γ m` grid and facing towards the `right`. \n \n Then you start walking one square at a time in the direction you are facing. \n \n If you reach the border of the grid or if the next square you are about to visit has already been visited, you... | [{"input": "100\n100", "output": "[\"L\"]", "fn_name": "direction_in_grid"}, {"input": "1\n1", "output": "[\"R\"]", "fn_name": "direction_in_grid"}, {"input": "2\n2", "output": "[\"L\"]", "fn_name": "direction_in_grid"}, {"input": "2\n3", "output": "[\"L\"]", "fn_name": "direction_in_grid"}, {"input": "2\n4", "output":... | code_functional |
[
{
"content": "Your job is to create a calculator which evaluates expressions in [Reverse Polish notation](http://en.wikipedia.org/wiki/Reverse_Polish_notation).\n\nFor example expression `5 1 2 + 4 * + 3 -` (which is equivalent to `5 + ((1 + 2) * 4) - 3` in normal notation) should evaluate to `14`.\n\nFor your ... | [{"input": "\"5 1 2 + 4 * + 3 -\"", "output": "[14]", "fn_name": "calc"}, {"input": "\"10000 123 +\"", "output": "[10123]", "fn_name": "calc"}, {"input": "\"1 3 -\"", "output": "[-2]", "fn_name": "calc"}, {"input": "\"3.5\"", "output": "[3.5]", "fn_name": "calc"}, {"input": "\"1 3 +\"", "output": "[4]", "fn_name": "cal... | code_functional |
[
{
"content": "You are given $n$ integer numbers $a_1, a_2, \\dots, a_n$. Consider graph on $n$ nodes, in which nodes $i$, $j$ ($i\\neq j$) are connected if and only if, $a_i$ AND $a_j\\neq 0$, where AND denotes the bitwise AND operation.\n\nFind the length of the shortest cycle in this graph or determine that i... | [{"input": "150\n0 0 0 0 0 0 0 2537672836907008 0 0 0 0 0 0 16384 0 0 0 0 34360787232 0 0 70871155232 0 0 0 0 0 0 0 0 0 0 0 2256197860262016 0 0 0 0 0 0 0 0 0 0 536872961 0 0 0 0 0 0 0 0 0 0 33619968 0 0 0 0 0 0 0 0 0 0 0 0 37189881297899520 0 18031990695526400 0 0 1099511627776 0 0 0 0 0 0 0 0 2097152 0 0 0 134217984 ... | code_stdio |
[
{
"content": "### Description\nAs hex values can include letters `A` through to `F`, certain English words can be spelled out, such as `CAFE`, `BEEF`, or `FACADE`.\nThis vocabulary can be extended by using numbers to represent other letters, such as `5EAF00D`, or `DEC0DE5`.\n\nGiven a string, your task is to re... | [{"input": "\"DO YOU SEE THAT BEE DRINKING DECAF COFFEE\"", "output": "[13565769]", "fn_name": "hex_word_sum"}, {"input": "\"ASSESS ANY BAD CODE AND TRY AGAIN\"", "output": "[10889952]", "fn_name": "hex_word_sum"}, {"input": "\"DEFACE\"", "output": "[14613198]", "fn_name": "hex_word_sum"}, {"input": "\"SAFE\"", "output... | code_functional |
[
{
"content": "We define a spanning tree of a graph to be a BFS tree rooted at vertex s if and only if for every node t the shortest distance between s and t in the graph is equal to the shortest distance between s and t in the spanning tree. \n\nGiven a graph, we define f(x,y) to be the number of spanning trees... | [{"input": "8 9\n1 2\n1 3\n1 4\n2 7\n3 5\n3 6\n4 8\n2 3\n3 4\n", "output": "\n1 0 0 0 0 0 0 0\n0 2 0 0 0 0 2 0\n0 0 1 0 1 1 0 0\n0 0 0 2 0 0 0 2\n0 0 1 0 1 1 0 0\n0 0 1 0 1 1 0 0\n0 2 0 0 0 0 2 0\n0 0 0 2 0 0 0 2\n"}, {"input": "8 9\n1 2\n1 3\n2 4\n2 7\n3 5\n3 6\n4 8\n2 3\n3 4\n", "output": "2 0 0 0 0 0 0 0\n0 1 0 0 0 ... | code_stdio |
[
{
"content": "A 3Γ3 grid with a integer written in each square, is called a magic square if and only if the integers in each row, the integers in each column, and the integers in each diagonal (from the top left corner to the bottom right corner, and from the top right corner to the bottom left corner), all add... | [{"input": "8\n-28\n1", "output": "8 -28 23\n16 1 -14\n-21 30 -6\n"}, {"input": "8\n-22\n4", "output": "8 -22 26\n22 4 -14\n-18 30 0\n"}, {"input": "8\n-28\n4", "output": "8 -28 32\n28 4 -20\n-24 36 0\n"}, {"input": "8\n-1\n10", "output": "8 -1 23\n25 10 -5\n-3 21 12\n"}, {"input": "1\n0\n13", "output": "1 0 38\n50 13 ... | code_stdio |
[
{
"content": "Vasya plays the sleuth with his friends. The rules of the game are as follows: those who play for the first time, that is Vasya is the sleuth, he should investigate a \"crime\" and find out what is happening. He can ask any questions whatsoever that can be answered with \"Yes\" or \"No\". All the ... | [{"input": "ARIWmwqFqxsQXsXXzHqvFjxOCttAGPUzDtWzsenPYdNXuFOIUGYZsLLK IaoxiyjBBRThoelwdPTkuCQfcBLUEJpCPIrVZlvUWA?\n", "output": "YES\n"}, {"input": "ARIWmwqFqxsQXsXXzHqvFjxOCttAGPUzDtWzsenPYdNXuFOIUGYZsLLK IaoxiykBBRThoelwdPTkuCQfcBLUEJpCPIrVZlvUWA?\n", "output": "YES\n"}, {"input": "KLLsZYGUIOFuXNdYPneszWtDzUPGAttCOxjF... | code_stdio |
[
{
"content": "The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, \"Play with Tsukuro\". Today is the time to make a rectangle with sticks, but I would like to see if I can make a rectangle using the four sticks I prepared. However, the stick... | [{"input": "-1 -2 1 11", "output": "no\n"}, {"input": "-1 -2 1 19", "output": "no\n"}, {"input": "-2 -2 1 1", "output": "yes\n"}, {"input": "-1 4 4 10", "output": "no\n"}, {"input": "-1 1 4 10", "output": "no\n"}, {"input": "-2 1 4 10", "output": "no\n"}, {"input": "-2 1 8 10", "output": "no\n"}, {"input": "0 -1 0 11",... | code_stdio |
[
{
"content": "You play your favourite game yet another time. You chose the character you didn't play before. It has $str$ points of strength and $int$ points of intelligence. Also, at start, the character has $exp$ free experience points you can invest either in strength or in intelligence (by investing one poi... | [{"input": "5\n1 1 100000000\n100000000 100000000 100000000\n100000000 1 100000000\n1 100000000 100000000\n100000000 100000000 1\n", "output": "50000000\n50000000\n100000000\n1\n1\n"}, {"input": "5\n1 1 100000000\n100000000 100000000 100000000\n100000000 1 100000000\n1 100000000 100000000\n100000000 100000000 1\n", "ou... | code_stdio |
[
{
"content": "Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia. \n\nFor the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs $n$ actions. The first action performed is to put a single candy into the box... | [{"input": "1000000000 846040702\n", "output": "999939239\n"}, {"input": "1000000000 315152540\n", "output": "999948715\n"}, {"input": "1000000000 315152540\n", "output": "999948715"}, {"input": "1000000000 846040702\n", "output": "999939239"}, {"input": "999999998 434363581\n", "output": "999946439\n"}, {"input": "999... | code_stdio |
[
{
"content": "Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question.\n\nSuppose you are given a positive integer $a$. You want to choose some integer $b$ from $1$ to $a - 1$ inclusive in such a way that the greatest common divisor (GCD) of integers $a... | [{"input": "9\n30\n11\n12\n122\n136\n92\n1984716\n217\n14628115\n", "output": "31\n15\n15\n127\n255\n127\n2097151\n255\n16777215\n"}, {"input": "9\n30\n7\n12\n122\n136\n92\n1984716\n204\n14628115\n", "output": "31\n1\n15\n127\n255\n127\n2097151\n255\n16777215\n"}, {"input": "9\n30\n7\n12\n122\n136\n92\n1984716\n169\n14... | code_stdio |
[
{
"content": "We have N points in a two-dimensional plane.\n\nThe coordinates of the i-th point (1 \\leq i \\leq N) are (x_i,y_i).\n\nLet us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior.\n\nHere, points on the sides of the rectangle... | [{"input": "4 3\n-1000000000 -1000000000\n1000000000 1000000000\n-999999999 999999999\n999999999 -999999999\n", "output": "3999999996000000001\n"}, {"input": "4 3\n-1000000000 -1000000000\n1000000000 1000000000\n-999999999 999999999\n999999999 -1704052742", "output": "4000000000000000000\n"}, {"input": "4 3\n-100000000... | code_stdio |
[
{
"content": "Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm Γ h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding of what to carve and how.\n\nIn order not to waste time, ... | [{"input": "5 30 10\nH 8\nH 9\nV 1\nH 2\nH 5\nH 3\nH 1\nV 2\nH 13\nV 3\n", "output": "110\n105\n84\n84\n84\n84\n84\n63\n51\n34\n"}, {"input": "5 15 10\nH 8\nH 9\nV 1\nH 2\nH 6\nH 4\nH 1\nV 2\nH 13\nV 3\n", "output": "40\n40\n32\n24\n24\n24\n24\n18\n12\n8\n"}, {"input": "15 5 10\nV 13\nV 10\nV 3\nH 2\nV 9\nV 7\nV 2\nH 1... | code_stdio |
[
{
"content": "Asmany strings are strings of '0's and '1's that have as many 00 as 11. A string such as 00110001 consists of 3 \"00\" and\n1 \"11\". Of course this is not an Asmany string. 0011, 1100, 000111000111 are Asmany strings. An L'th Asmany number is the number of\nAsmany strings of length L for all posi... | [{"input": "2\n12\n12", "output": "YES\nYES\n"}, {"input": "2\n12\n4", "output": "YES\nYES\n"}, {"input": "2\n18\n12", "output": "NO\nYES\n"}, {"input": "2\n12\n6", "output": "YES\nYES\n"}, {"input": "2\n2\n12", "output": "YES\nYES\n"}, {"input": "2\n19\n12", "output": "NO\nYES\n"}, {"input": "2\n2\n4", "output": "YES\... | code_stdio |
[
{
"content": "[Image] \n\n\n-----Input-----\n\nThe input consists of four lines, each line containing a single digit 0 or 1.\n\n\n-----Output-----\n\nOutput a single digit, 0 or 1.\n\n\n-----Example-----\nInput\n0\n1\n1\n0\n\nOutput\n0\n\nWrite Python code to solve this problem. Your program should read the inp... | [{"input": "0\n1\n1\n0\n", "output": "0\n"}, {"input": "0\n0\n0\n0\n", "output": "0\n"}, {"input": "1\n0\n0\n0\n", "output": "1\n"}, {"input": "0\n1\n0\n0\n", "output": "0\n"}, {"input": "1\n1\n0\n0\n", "output": "1\n"}, {"input": "0\n0\n1\n0\n", "output": "0\n"}, {"input": "1\n0\n1\n0\n", "output": "0\n"}, {"input": "... | code_stdio |
[
{
"content": "problem\n\nGiven a sequence of n integers a1, a2, ..., an and a positive integer k (1 β€ k β€ n), then the sum of k consecutive integers Si = ai + ai + Create a program that outputs the maximum value of 1 + ... + ai + k-1 (1 β€ i β€ n --k + 1).\n\n\n\ninput\n\nThe input consists of multiple datasets. ... | [{"input": "5 1\n-1\n18\n-4\n17\n2\n0 0", "output": "18\n"}, {"input": "5 1\n-1\n3\n-4\n30\n2\n0 0", "output": "30\n"}, {"input": "5 3\n2\n13\n-3\n27\n1\n0 0", "output": "37\n"}, {"input": "5 1\n2\n10\n-4\n14\n2\n0 0", "output": "14\n"}, {"input": "5 1\n2\n10\n-4\n14\n0\n0 0", "output": "14\n"}, {"input": "5 1\n3\n10\n... | code_stdio |
[
{
"content": "You are given the array of integer numbers a_0, a_1, ..., a_{n} - 1. For each element find the distance to the nearest zero (to the element which equals to zero). There is at least one zero element in the given array.\n\n\n-----Input-----\n\nThe first line contains integer n (1 β€ n β€ 2Β·10^5) β len... | [{"input": "15\n1000000000 -1000000000 -1000000000 1000000000 -1000000000 -1000000000 -1000000000 1000000000 1000000000 -1000000000 -1000000000 -1000000000 -1000000000 1000000000 0\n", "output": "14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 "}, {"input": "15\n1000000000 -1000000000 -1000000000 1000000000 -1000000000 -1000000000 ... | code_stdio |
[
{
"content": "Everybody knows of spaghetti sort. You decided to implement an analog sorting algorithm yourself, but as you survey your pantry you realize you're out of spaghetti! The only type of pasta you have is ravioli, but you are not going to let this stop you...\n\nYou come up with the following algorithm... | [{"input": "10\n67 67 67 67 67 67 67 67 67 67\n", "output": "YES\n"}, {"input": "10\n16 17 16 15 14 15 16 17 16 15\n", "output": "YES\n"}, {"input": "10\n105 39 93 63 97 40 36 38 11 97\n", "output": "NO\n"}, {"input": "10\n105 39 79 63 97 40 36 38 11 97\n", "output": "NO\n"}, {"input": "10\n109 91 22 29 23 22 33 42 13 ... | code_stdio |
[
{
"content": "Petya loves computer games. Finally a game that he's been waiting for so long came out!\n\nThe main character of this game has n different skills, each of which is characterized by an integer a_{i} from 0 to 100. The higher the number a_{i} is, the higher is the i-th skill of the character. The to... | [{"input": "100 10000\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1... | code_stdio |
[
{
"content": "You are given a grid with $n$ rows and $m$ columns, where each cell has a positive integer written on it. Let's call a grid good, if in each row the sequence of numbers is sorted in a non-decreasing order. It means, that for each $1 \\le i \\le n$ and $2 \\le j \\le m$ the following holds: $a_{i,j... | [{"input": "4\n1 10\n1 2 3 2 2 2 2 2 3 3\n1 10\n1 2 3 3 3 3 3 2 3 3\n1 10\n1 2 3 3 3 3 2 2 3 3\n1 5\n1 4 3 2 5\n", "output": "3 8\n3 8\n-1\n2 4\n"}, {"input": "5\n2 3\n1 2 3\n1 1 1\n2 2\n4 1\n2 3\n2 2\n2 1\n1 1\n2 3\n6 2 1\n5 4 3\n2 1\n1\n2\n", "output": "1 1\n-1\n1 2\n1 3\n1 1\n"}, {"input": "1\n2 4\n2 1 1 1\n2 2 2 1\... | code_stdio |
[
{
"content": "You are given a string s, consisting of lowercase English letters, and the integer m.\n\nOne should choose some symbols from the given string so that any contiguous subsegment of length m has at least one selected symbol. Note that here we choose positions of symbols, not the symbols themselves.\n... | [{"input": "5\nwjjdqawypvtgrncmqvcsergermprauyevcegjtcrrblkwiugrcjfpjyxngyryxntauxlouvwgjzpsuxyxvhavgezwtuzknetdibv\n", "output": "aaaabbcccccddeeeeeefggggggghiijjjjjjkkllmmnnnnoppppqqrrrrrrrrsstttttu\n"}, {"input": "5\nvbidtenkzctwzegvahvxyxuspzjgwutolxuatnxyrygnxyjpfjcrguiwklbrrcujgeuveyuarplsegrescvqmynrgtvpcwaqdjjw... | code_stdio |
[
{
"content": "You are given a square board, consisting of $n$ rows and $n$ columns. Each tile in it should be colored either white or black.\n\nLet's call some coloring beautiful if each pair of adjacent rows are either the same or different in every position. The same condition should be held for the columns a... | [{"input": "500 125000\n", "output": "337093334\n"}, {"input": "500 250000\n", "output": "510735313\n"}, {"input": "499 249001\n", "output": "377244915\n"}, {"input": "499 249000\n", "output": "377244915\n"}, {"input": "499 248999\n", "output": "377244915\n"}, {"input": "500 125000\n", "output": "337093334\n"}, {"input... | code_stdio |
[
{
"content": "Enter a positive integer n of 4,000 or less, with a pair of integers a, b, c, d in the range 0-1000.\n\n\na + b + c + d = n\n\n\nCreate a program that outputs the number of combinations that satisfy the conditions.\n\n\n\nInput\n\nGiven multiple datasets. Each dataset is given n on one row. Please... | [{"input": "2\n-1\n207", "output": "10\n0\n1521520\n"}, {"input": "2\n-1\n254", "output": "10\n0\n2796160\n"}, {"input": "2\n-1\n326", "output": "10\n0\n5881204\n"}, {"input": "2\n-1\n100", "output": "10\n0\n176851\n"}, {"input": "2\n-2\n110", "output": "10\n0\n234136\n"}, {"input": "2\n-2\n111", "output": "10\n0\n2404... | code_stdio |
[
{
"content": "Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card games and play with toy soldiers.\n\nThe ru... | [{"input": "15 31 1\n--------R---------G------------\n-G----------------------------R\n--------------G--------------R-\n---G--------------------------R\n-----R---------G---------------\n--R--G-------------------------\n-----G-----------------R-------\n--R-------------------G--------\n-R----------------------------G\n--... | code_stdio |
[
{
"content": "The prime numbers are not regularly spaced. For example from `2` to `3` the step is `1`.\nFrom `3` to `5` the step is `2`. From `7` to `11` it is `4`.\nBetween 2 and 50 we have the following pairs of 2-steps primes:\n\n`3, 5 - 5, 7, - 11, 13, - 17, 19, - 29, 31, - 41, 43`\n\nWe will write a functi... | [{"input": "2\n10000000\n11000000", "output": "[[10000139, 10000141]]", "fn_name": "step"}, {"input": "2\n104000\n105000", "output": "[[104087, 104089]]", "fn_name": "step"}, {"input": "4\n30000\n100000", "output": "[[30109, 30113]]", "fn_name": "step"}, {"input": "6\n30000\n100000", "output": "[[30091, 30097]]", "fn_n... | code_functional |
[
{
"content": "Let $f_{x} = c^{2x-6} \\cdot f_{x-1} \\cdot f_{x-2} \\cdot f_{x-3}$ for $x \\ge 4$.\n\nYou have given integers $n$, $f_{1}$, $f_{2}$, $f_{3}$, and $c$. Find $f_{n} \\bmod (10^{9}+7)$.\n\n\n-----Input-----\n\nThe only line contains five integers $n$, $f_{1}$, $f_{2}$, $f_{3}$, and $c$ ($4 \\le n \\... | [{"input": "1000000000000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "607659049\n"}, {"input": "1000000000000000000 1000000000 1000000000 1000000000 1000000000\n", "output": "607659049"}, {"input": "1440135023384277212 298741808 401572465 730243936 632306255\n", "output": "694201657\n"}, {"input": ... | code_stdio |
[
{
"content": "Problem I Starting a Scenic Railroad Service\n\nJim, working for a railroad company, is responsible for planning a new tourist train service. He is sure that the train route along a scenic valley will arise a big boom, but not quite sure how big the boom will be.\n\nA market survey was ordered and... | [{"input": "4\n1 3\n1 11\n10 2\n3 12", "output": "4 2\n"}, {"input": "4\n2 1\n1 11\n10 2\n16 3", "output": "2 0\n"}, {"input": "4\n1 3\n1 11\n10 2\n4 12", "output": "4 2\n"}, {"input": "4\n2 2\n1 11\n10 1\n3 10", "output": "3 1\n"}, {"input": "4\n3 1\n1 11\n10 2\n16 3", "output": "2 0\n"}, {"input": "4\n1 3\n2 11\n10 2... | code_stdio |
[
{
"content": "There are N cards. The i-th card has an integer A_i written on it. For any two cards, the integers on those cards are different.\n\nUsing these cards, Takahashi and Aoki will play the following game:\n\n* Aoki chooses an integer x.\n* Starting from Takahashi, the two players alternately take a car... | [{"input": "5 5\n3 5 7 11 13\n1\n14\n9\n10\n13", "output": "31\n23\n27\n23\n23\n"}, {"input": "5 5\n3 5 7 11 13\n1\n7\n9\n10\n13", "output": "31\n27\n27\n23\n23\n"}, {"input": "5 5\n3 5 7 11 13\n1\n4\n12\n5\n13", "output": "31\n31\n23\n31\n23\n"}, {"input": "5 5\n3 5 7 11 13\n1\n6\n12\n5\n13", "output": "31\n27\n23\n31... | code_stdio |
[
{
"content": "Polycarp found $n$ segments on the street. A segment with the index $i$ is described by two integers $l_i$ and $r_i$ β coordinates of the beginning and end of the segment, respectively. Polycarp realized that he didn't need all the segments, so he wanted to delete some of them.\n\nPolycarp believe... | [{"input": "4\n3\n1 4\n2 3\n3 6\n4\n1 2\n2 3\n3 5\n2 5\n5\n0 0\n1 13\n4 1\n6 14\n9 10\n5\n1 5\n2 4\n3 5\n2 8\n4 8\n", "output": "0\n0\n1\n0\n"}, {"input": "4\n3\n1 4\n2 3\n3 6\n4\n1 2\n2 3\n3 5\n2 5\n5\n0 0\n1 13\n4 1\n6 14\n9 10\n5\n1 5\n2 4\n3 5\n2 9\n4 8\n", "output": "0\n0\n1\n0\n"}, {"input": "4\n3\n1 4\n2 3\n3 10... | code_stdio |
[
{
"content": "The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series.\n\nThere are n single men and n single women among the main characters. An opinion poll... | [{"input": "10 50 200\n10 1 22\n2 9 6\n4 2 98\n6 6 38\n5 1 67\n6 7 17\n10 4 29\n6 5 97\n3 8 51\n1 6 31\n5 9 72\n4 5 50\n2 1 3\n10 2 27\n1 10 78\n9 9 48\n8 7 81\n5 8 64\n9 4 78\n7 5 90\n9 8 83\n7 1 99\n5 5 43\n1 2 37\n3 3 6\n4 3 61\n9 6 25\n1 3 46\n2 10 18\n1 4 68\n2 4 75\n3 10 67\n7 8 82\n5 7 1\n5 6 6\n1 8 50\n8 10 50\... | code_stdio |
[
{
"content": "Boboniu has a directed graph with n vertices and m edges.\n\nThe out-degree of each vertex is at most k.\n\nEach edge has an integer weight between 1 and m. No two edges have equal weights.\n\nBoboniu likes to walk on the graph with some specific rules, which is represented by a tuple (c_1,c_2,β¦,c... | [{"input": "9 63 8\n6 9 1\n3 6 2\n5 9 3\n1 9 4\n4 9 5\n9 6 6\n4 3 7\n7 1 8\n1 7 9\n2 1 10\n4 8 11\n8 5 12\n7 6 13\n7 4 14\n3 9 15\n6 8 16\n7 2 17\n7 5 18\n4 6 19\n2 4 20\n5 4 21\n3 4 22\n7 3 23\n2 9 24\n2 6 25\n3 5 26\n2 8 27\n9 1 28\n6 5 29\n2 3 30\n8 4 31\n3 2 32\n1 6 33\n7 9 34\n9 8 35\n8 2 36\n4 1 37\n1 3 38\n9 3 3... | code_stdio |
[
{
"content": "The 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 kittens, of course). Vova likes all these pictures, but some are more beautiful t... | [{"input": "200 103 37\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Chouti is working on a strange math problem.\n\nThere was a sequence of $n$ positive integers $x_1, x_2, \\ldots, x_n$, where $n$ is even. The sequence was very special, namely for every integer $t$ from $1$ to $n$, $x_1+x_2+...+x_t$ is a square of some integer number (that is, a perfect square).\... | [{"input": "80\n24 192 896 1568 2907 4840 7475 9775 11109 29939 22475 45951 46552 36859 66787 106329 85211 94423 65627 147436 143259 128699 139277 167743 178063 192167 150133 162719 177103 160732 139859 157301 176681 199291 152867 182611 199632 199535 199905 199959\n", "output": "Yes\n1 24 39 192 144 896 385 1568 1240 ... | code_stdio |
[
{
"content": "In this Kata, you will be given a list of strings and your task will be to find the strings that have the same characters and return the sum of their positions as follows: \n\n```Haskell\nsolve([\"abc\",\"abbc\", \"ab\", \"xyz\", \"xy\", \"zzyx\"]) = [1,8]\n-- we see that the elements at indices 0... | [{"input": "[\"gkeeekkgggg\", \"gkeeekkgg\", \"bzfffffff\", \"uoboooooo\", \"gkeeekk\", \"uobooo\", \"bzffff\", \"gkeee\"]", "output": "[[8, 8, 12]]", "fn_name": "solve"}, {"input": "[\"ayqqqq\", \"epqqqqqqq\", \"epqqqqqqqqqq\", \"rdsddss\", \"ayqqqqqqq\", \"epqqqq\", \"rdsdd\"]", "output": "[[4, 8, 9]]", "fn_name": "s... | code_functional |
[
{
"content": "The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h_1 cm from the ground. On the height h_2 cm (h_2 > h_1) on the same tree hung an apple and the caterpillar was crawling to the apple.\n\nGabriel is i... | [{"input": "43951 66098\n1604 35654\n", "output": "-1\n"}, {"input": "35413 75637\n4087 30166\n", "output": "-1\n"}, {"input": "28473 80380\n2568 95212\n", "output": "-1\n"}, {"input": "43951 66098\n1604 35654\n", "output": "-1\n"}, {"input": "28473 80380\n2568 95212\n", "output": "-1\n"}, {"input": "35413 75637\n4087 ... | code_stdio |
[
{
"content": "This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution.\n\nPolycarpus continues working as a system administrator in a large corporation. The computer network of this corporation consists of n c... | [{"input": "10 14\n3 2\n7 2\n6 4\n8 1\n3 9\n5 6\n6 3\n4 1\n2 5\n7 10\n9 5\n7 1\n8 10\n3 4\n", "output": "unknown topology\n"}, {"input": "10 14\n3 2\n7 2\n6 4\n8 1\n3 9\n5 6\n6 3\n4 1\n2 5\n7 10\n9 5\n7 1\n8 10\n3 4\n", "output": "unknown topology\n"}, {"input": "10 14\n3 2\n7 2\n6 4\n8 1\n3 9\n5 6\n6 3\n4 1\n2 1\n7 10... | code_stdio |
[
{
"content": "Some natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of the number didn't change.\n\nYou have to find the minimum number of digits in w... | [{"input": "900\n13595314340746721027884681972026445045155446054797436718350397773609081581610067818125738383867204953\n", "output": "86\n"}, {"input": "200\n1000000010000000000000000000010000000000000001000001000000000000000000000000000000000000000000000000\n", "output": "22\n"}, {"input": "700\n9307216756404590162143... | code_stdio |
[
{
"content": "Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function.\n\n\nMerge(A, left, mid, right)\nn1 = mid - left;\nn2 = right - mid;\ncreate array L[0...n1], R[0...n2]\nfor i = 0 to n1-1\ndo L[i] = A[left + ... | [{"input": "10\n11 -1 -2 7 16 5 20 1 -1 12", "output": "-2 -1 -1 1 5 7 11 12 16 20\n34\n"}, {"input": "10\n11 -1 -3 7 16 5 20 1 -1 12", "output": "-3 -1 -1 1 5 7 11 12 16 20\n34\n"}, {"input": "10\n11 -1 -3 7 16 5 23 1 -1 12", "output": "-3 -1 -1 1 5 7 11 12 16 23\n34\n"}, {"input": "10\n11 -1 -3 7 29 5 23 1 -1 12", "o... | code_stdio |
[
{
"content": "You are given a positive integer $x$. Check whether the number $x$ is representable as the sum of the cubes of two positive integers.\n\nFormally, you need to check if there are two integers $a$ and $b$ ($1 \\le a, b$) such that $a^3+b^3=x$.\n\nFor example, if $x = 35$, then the numbers $a=2$ and ... | [{"input": "8\n420587971613\n681238648792\n817378345476\n509923060101\n202232821384\n387799635832\n215157629382\n698361920355\n", "output": "NO\nYES\nYES\nYES\nYES\nYES\nNO\nNO\n"}, {"input": "8\n420587971613\n681238648792\n817378345476\n509923060101\n202232821384\n387799635832\n215157629382\n698361920355\n", "output":... | code_stdio |
[
{
"content": "You are playing a new computer game in which you have to fight monsters. In a dungeon you are trying to clear, you met three monsters; the first of them has $a$ health points, the second has $b$ health points, and the third has $c$.\n\nTo kill the monsters, you can use a cannon that, when fired, d... | [{"input": "13\n3 2 4\n10 2 4\n10 3 5\n5 4 6\n7 1 1\n3 3 3\n6 6 6\n14 2 2\n16 1 1\n9 9 9\n26 3 3\n9 8 10\n4 1 4\n", "output": "YES\nNO\nYES\nNO\nYES\nYES\nYES\nYES\nNO\nYES\nNO\nYES\nYES\n"}, {"input": "13\n3 2 4\n10 2 4\n10 3 5\n5 4 6\n7 1 1\n3 3 3\n6 6 6\n14 2 2\n16 1 1\n9 9 9\n26 3 3\n9 8 10\n4 1 4\n", "output": "YE... | code_stdio |
[
{
"content": "A festival will be held in a town's main street. There are n sections in the main street. The sections are numbered 1 through n from left to right. The distance between each adjacent sections is 1.\n\nIn the festival m fireworks will be launched. The i-th (1 β€ i β€ m) launching is on time t_{i} at ... | [{"input": "100 20 5\n47 93 3\n61 49 10\n14 69 10\n88 2 14\n35 86 18\n63 16 20\n39 49 22\n32 45 23\n66 54 25\n77 2 36\n96 85 38\n33 28 45\n29 78 53\n78 13 60\n58 96 64\n74 39 71\n18 80 80\n18 7 85\n97 82 96\n74 99 97\n", "output": " 877\n"}, {"input": "100 20 ... | code_stdio |
[
{
"content": "The new generation external memory contains an array of integers $a[1 \\ldots n] = [a_1, a_2, \\ldots, a_n]$.\n\nThis type of memory does not support changing the value of an arbitrary element. Instead, it allows you to cut out any segment of the given array, cyclically shift (rotate) it by any of... | [{"input": "4\n2\n2 -1\n3\n1 2 1\n4\n1 4 -1 3\n5\n1 28 -1 4 5\n", "output": "1\n1 2 1\n1\n2 3 1\n2\n1 3 2\n3 4 1\n3\n1 3 2\n3 4 1\n4 5 1\n"}, {"input": "4\n2\n2 -1\n3\n1 2 1\n4\n1 4 -1 3\n5\n2 14 -1 4 3\n", "output": "1\n1 2 1\n1\n2 3 1\n2\n1 3 2\n3 4 1\n3\n1 3 2\n3 5 2\n4 5 1\n"}, {"input": "4\n2\n2 -1\n3\n1 2 1\n4\n0... | code_stdio |
[
{
"content": "During the lesson small girl Alyona works with one famous spreadsheet computer program and learns how to edit tables.\n\nNow she has a table filled with integers. The table consists of n rows and m columns. By a_{i}, j we will denote the integer located at the i-th row and the j-th column. We say ... | [{"input": "11 1\n501465490\n366941771\n415080944\n385243536\n445132523\n697044413\n894369800\n812743722\n23684788\n466526046\n953916313\n45\n2 4\n8 9\n7 7\n4 9\n2 9\n2 11\n4 4\n5 7\n1 2\n5 10\n5 6\n1 7\n4 4\n1 6\n2 7\n10 11\n1 8\n6 11\n8 8\n8 10\n1 1\n5 10\n9 10\n6 9\n6 11\n1 1\n9 9\n10 11\n1 2\n9 11\n2 6\n4 7\n11 11\... | code_stdio |
[
{
"content": "You are given two integers $x$ and $y$ (it is guaranteed that $x > y$). You may choose any prime integer $p$ and subtract it any number of times from $x$. Is it possible to make $x$ equal to $y$?\n\nRecall that a prime number is a positive integer that has exactly two positive divisors: $1$ and th... | [{"input": "69\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n4 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\... | code_stdio |
[
{
"content": "In 2300, the Life Science Division of Federal Republic of Space starts a very ambitious project to complete the genome sequencing of all living creatures in the entire universe and develop the genomic database of all space life. Thanks to scientific research over many years, it has been known that... | [{"input": "ABC 3\nABC 2\n2(4()B)3(XY)A10C 30\n1000(1000(1000(1000(1000(1000(OM)))))) 1090860\n0 0", "output": "0\nC\n0\nO\n"}, {"input": "CBA 3\nABC 0\n2(4(AB)3(XY))10C 10\n1000(1000(1000(1000(1000(1000(NM)))))) 1889091\n0 0", "output": "0\nA\nX\nM\n"}, {"input": "CBA 2\nABC 0\n2(4(AB)3(XY))10C 10\n1000(1000(1000(1000... | code_stdio |
[
{
"content": "qd ucyhf yi q fhycu dkcruh mxeiu huluhiu yi q tyvvuhudj fhycu dkcruh. oekh jqia yi je vydt jxu djx ucyhf.\n\nInput\n\njxu ydfkj sediyiji ev q iydwbu ydjuwuh d (1 β€ d β€ 11184) β jxu edu-rqiut ydtun ev jxu ucyhf je vydt.\n\nOutput\n\nekjfkj q iydwbu dkcruh.\n\nExamples\n\nInput\n\n1\n\n\nOutput\n\n1... | [{"input": "10526\n", "output": "971513\n"}, {"input": "11183\n", "output": "999931\n"}, {"input": "10107\n", "output": "953077\n"}, {"input": "10476\n", "output": "969481\n"}, {"input": "10962\n", "output": "990511\n"}, {"input": "11184\n", "output": "999983\n"}, {"input": "11182\n", "output": "999853\n"}, {"input": "... | code_stdio |
[
{
"content": "You are given a string S consisting of lowercase English letters.\nDetermine whether we can turn S into a palindrome by repeating the operation of swapping two adjacent characters. If it is possible, find the minimum required number of operations.\n\n-----Constraints-----\n - 1 \\leq |S| \\leq 2 Γ... | [{"input": "ataatmma\n", "output": "4\n"}, {"input": "aatltmaa", "output": "-1\n"}, {"input": "aamtltaa", "output": "-1\n"}, {"input": "aamaltta", "output": "-1\n"}, {"input": "attlamaa", "output": "-1\n"}, {"input": "alttamaa", "output": "-1\n"}, {"input": "aamattla", "output": "-1\n"}, {"input": "aamautla", "output":... | code_stdio |
[
{
"content": "Omkar and Akmar are playing a game on a circular board with n (2 β€ n β€ 10^6) cells. The cells are numbered from 1 to n so that for each i (1 β€ i β€ n-1) cell i is adjacent to cell i+1 and cell 1 is adjacent to cell n. Initially, each cell is empty.\n\nOmkar and Akmar take turns placing either an A ... | [{"input": "1000000\n", "output": "948343669\n"}, {"input": "999993\n", "output": "111654003\n"}, {"input": "999989\n", "output": "612908369\n"}, {"input": "999972\n", "output": "305611803\n"}, {"input": "999996\n", "output": "864247083\n"}, {"input": "999994\n", "output": "529477162\n"}, {"input": "999975\n", "output"... | code_stdio |
[
{
"content": "The prime numbers are not regularly spaced. For example from `2` to `3` the gap is `1`.\nFrom `3` to `5` the gap is `2`. From `7` to `11` it is `4`.\nBetween 2 and 50 we have the following pairs of 2-gaps primes:\n`3-5, 5-7, 11-13, 17-19, 29-31, 41-43`\n\nA prime gap of length n is a run of n-1 co... | [{"input": "2\n10000000\n11000000", "output": "[[10000139, 10000141]]", "fn_name": "gap"}, {"input": "4\n30000\n100000", "output": "[[30109, 30113]]", "fn_name": "gap"}, {"input": "6\n30000\n100000", "output": "[[30091, 30097]]", "fn_name": "gap"}, {"input": "8\n30000\n100000", "output": "[[30161, 30169]]", "fn_name": ... | code_functional |
[
{
"content": "Iahub is so happy about inventing bubble sort graphs that he's staying all day long at the office and writing permutations. Iahubina is angry that she is no more important for Iahub. When Iahub goes away, Iahubina comes to his office and sabotage his research work.\n\nThe girl finds an important p... | [{"input": "20\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "output": "927799753\n"}, {"input": "10\n4 10 -1 1 6 8 9 2 -1 -1\n", "output": "4\n"}, {"input": "10\n3 10 -1 1 6 8 9 2 -1 -1\n", "output": "6\n"}, {"input": "10\n3 10 -1 1 7 8 9 2 -1 -1\n", "output": "6\n"}, {"input": "10\n4 10 -1 1 3 8 9 ... | code_stdio |
[
{
"content": "Write function alternateCase which switch every letter in string from upper to lower and from lower to upper.\nE.g: Hello World -> hELLO wORLD\n\nWrite Python code to solve this problem. Define a top-level function named `alternateCase` that takes the input arguments described above and returns th... | [{"input": "\"Jack JUMPED over THE CaNdLeStIcK\"", "output": "[\"jACK jumped OVER the cAnDlEsTiCk\"]", "fn_name": "alternateCase"}, {"input": "\"i LIKE MAKING KATAS VERY MUCH\"", "output": "[\"I like making katas very much\"]", "fn_name": "alternateCase"}, {"input": "\"HuMpTy DuMpTy SaT On A WaLl\"", "output": "[\"hUmP... | code_functional |
[
{
"content": "Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.\nAt least how many sheets of paper does he need?\n\n-----Constraints-----\n - N is an integer.\n - 1 \\leq N \\leq 100\n\n-----Input-----\nInput is given from Standard Input... | [{"input": "1073", "output": "537\n"}, {"input": "100\n", "output": "50\n"}, {"input": "282", "output": "141\n"}, {"input": "557", "output": "279\n"}, {"input": "284", "output": "142\n"}, {"input": "276", "output": "138\n"}, {"input": "231", "output": "116\n"}, {"input": "487", "output": "244\n"}, {"input": "210", "out... | code_stdio |
[
{
"content": "Takahashi, Nakahashi and Hikuhashi have integers A, B and C, respectively. After repeating the following operation K times, find the integer Takahashi will get minus the integer Nakahashi will get:\n\n* Each of them simultaneously calculate the sum of the integers that the other two people have, t... | [{"input": "0001111110 1110000110 0011101101 1010001101001100000", "output": "-1108889000\n"}, {"input": "0101111110 1110000110 1011100101 1010001101001100000", "output": "-1008889000\n"}, {"input": "1000010000 0000000010 1100000010 1000010100000000000", "output": "1000009990\n"}, {"input": "1000110000 0000000010 11000... | code_stdio |
[
{
"content": "You are given an integer N that has exactly four digits in base ten. How many times does `2` occur in the base-ten representation of N?\n\nConstraints\n\n* 1000 \\leq N \\leq 9999\n\nInput\n\nInput is given from Standard Input in the following format:\n\n\nN\n\n\nOutput\n\nPrint the answer.\n\nExa... | [{"input": "12257", "output": "2\n"}, {"input": "16763", "output": "0\n"}, {"input": "18919", "output": "0\n"}, {"input": "12428", "output": "2\n"}, {"input": "36955", "output": "0\n"}, {"input": "43731", "output": "0\n"}, {"input": "74636", "output": "0\n"}, {"input": "69338", "output": "0\n"}, {"input": "14727", "out... | code_stdio |
[
{
"content": "## Task\n\nGiven a positive integer as input, return the output as a string in the following format: \n\nEach element, corresponding to a digit of the number, multiplied by a power of 10 in such a way that with the sum of these elements you can obtain the original number.\n\n## Examples\n\nInput |... | [{"input": "8964631", "output": "[\"8*1000000+9*100000+6*10000+4*1000+6*100+3*10+1\"]", "fn_name": "simplify"}, {"input": "196587", "output": "[\"1*100000+9*10000+6*1000+5*100+8*10+7\"]", "fn_name": "simplify"}, {"input": "10104", "output": "[\"1*10000+1*100+4\"]", "fn_name": "simplify"}, {"input": "999", "output": "[\... | code_functional |
[
{
"content": "You are given an integer number $n$. The following algorithm is applied to it:\n\n if $n = 0$, then end algorithm; find the smallest prime divisor $d$ of $n$; subtract $d$ from $n$ and go to step $1$. \n\nDetermine the number of subtrations the algorithm will make.\n\n\n-----Input-----\n\nThe o... | [{"input": "10000000000\n", "output": "5000000000\n"}, {"input": "10000000000\n", "output": "5000000000\n"}, {"input": "10000000010\n", "output": "5000000005\n"}, {"input": "10010000010\n", "output": "5005000005\n"}, {"input": "10010000110\n", "output": "5005000055\n"}, {"input": "10000000110\n", "output": "5000000055\... | code_stdio |
[
{
"content": "Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.\n\nVictor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long... | [{"input": "90\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n", "output": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n"}, {"input": "90\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb... | code_stdio |
[
{
"content": "Andrzej was given a task:\nThere are n jars with pills. In every jar there is a different type of pill and the amount of pills in each jar is infinite. One type of pill makes a person glow about 30 minutes after taking and none of the other types has any effect.\nHis job is to determine, in which ... | [{"input": "16", "output": "[3]", "fn_name": "friends"}, {"input": "0", "output": "[0]", "fn_name": "friends"}, {"input": "1", "output": "[0]", "fn_name": "friends"}, {"input": "2", "output": "[0]", "fn_name": "friends"}, {"input": "4", "output": "[1]", "fn_name": "friends"}, {"input": "3", "output": "[1]", "fn_name": ... | code_functional |
[
{
"content": "We make a tower by stacking up blocks. The tower consists of several stages and each stage is constructed by connecting blocks horizontally. Each block is of the same weight and is tough enough to withstand the weight equivalent to up to $K$ blocks without crushing.\n\nWe have to build the tower a... | [{"input": "11 16", "output": "11\n"}, {"input": "31 16", "output": "24\n"}, {"input": "27 16", "output": "22\n"}, {"input": "23 60", "output": "23\n"}, {"input": "31 23", "output": "27\n"}, {"input": "21 61", "output": "21\n"}, {"input": "47 16", "output": "29\n"}, {"input": "37 23", "output": "30\n"}, {"input": "39 6... | code_stdio |
[
{
"content": "Decades have passed since the beginning of AtCoder Beginner Contest.\nThe contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?\nIn the end, the labels for the rounds from the 1000-th to the... | [{"input": "1000\n", "output": "ABD\n"}, {"input": "1481\n", "output": "ABD\n"}, {"input": "1998\n", "output": "ABD\n"}, {"input": "1513\n", "output": "ABD\n"}, {"input": "1285\n", "output": "ABD\n"}, {"input": "999\n", "output": "ABC\n"}, {"input": "514\n", "output": "ABC\n"}, {"input": "1001", "output": "ABD\n"}, {"i... | code_stdio |
[
{
"content": "Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected works of Berland leaders, the library has a reading room.\n\nToday was the pilot launch of an automated reading room visitors' accounting system! The scanner of... | [{"input": "50\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 100\n+ 100\n- 1... | code_stdio |
[
{
"content": "Emuskald is addicted to Codeforces, and keeps refreshing the main page not to miss any changes in the \"recent actions\" list. He likes to read thread conversations where each thread consists of multiple messages.\n\nRecent actions shows a list of n different threads ordered by the time of the lat... | [{"input": "132\n13 7 33 124 118 76 94 92 16 107 130 1 46 58 28 119 42 53 102 81 99 29 57 70 125 45 100 68 10 63 34 38 19 49 56 30 103 72 106 3 121 110 78 2 31 129 128 24 77 61 87 47 15 21 88 60 5 101 82 108 84 41 86 66 79 75 54 97 55 12 69 44 83 131 9 95 11 85 52 35 115 80 111 27 109 36 39 104 105 62 32 40 98 50 64 11... | code_stdio |
[
{
"content": "The Little Elephant loves to play with color cards.\n\nHe has n cards, each has exactly two colors (the color of the front side and the color of the back side). Initially, all the cards lay on the table with the front side up. In one move the Little Elephant can turn any card to the other side. Th... | [{"input": "100\n1 2\n2 1\n2 1\n1 2\n1 1\n1 2\n2 1\n1 1\n2 2\n2 1\n2 1\n1 1\n1 1\n2 1\n2 1\n2 1\n2 1\n2 1\n1 1\n2 1\n1 1\n1 1\n2 2\n1 2\n1 2\n1 2\n2 2\n1 2\n1 2\n2 1\n1 2\n2 1\n1 2\n2 2\n1 1\n2 1\n1 2\n2 1\n2 1\n1 2\n2 1\n2 1\n1 2\n2 1\n1 1\n1 2\n1 1\n1 1\n2 2\n2 2\n2 1\n2 1\n1 2\n2 2\n1 1\n2 1\n2 2\n1 1\n1 1\n1 2\n2 2... | code_stdio |
[
{
"content": "In order to make the \"Sea Battle\" game more interesting, Boris decided to add a new ship type to it. The ship consists of two rectangles. The first rectangle has a width of $w_1$ and a height of $h_1$, while the second rectangle has a width of $w_2$ and a height of $h_2$, where $w_1 \\ge w_2$. I... | [{"input": "100000000 100000000 100000000 100000000\n", "output": "600000004\n"}, {"input": "100000000 100000000 100000000 100000000\n", "output": "600000004\n"}, {"input": "100000000 100000000 99999999 100000000\n", "output": "600000004\n"}, {"input": "100000000 100000000 99999999 100000000\n", "output": "600000004\n"... | code_stdio |
[
{
"content": "You are given a sequence $a_1, a_2, \\dots, a_n$ consisting of $n$ non-zero integers (i.e. $a_i \\ne 0$). \n\nYou have to calculate two following values: the number of pairs of indices $(l, r)$ $(l \\le r)$ such that $a_l \\cdot a_{l + 1} \\dots a_{r - 1} \\cdot a_r$ is negative; the number of p... | [{"input": "10\n-27433367 -21216390 1 303383863 -799030648 -1 160141051 -1 -342089574 -215298491\n", "output": "28 27\n"}, {"input": "10\n-27433367 -21216390 1 303383863 -799030648 -1 160141051 -1 -342089574 -215298491\n", "output": "28 27\n"}, {"input": "10\n4 2 -11 4 1 3 -4 9 2 3\n", "output": "28 27\n"}, {"input": "... | code_stdio |
[
{
"content": "We will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are similar when |x_i - y_i| \\leq 1 holds for all i (1 \\leq i \\leq N).\n\nIn particular, any integer sequence is similar to itself.\n\nYou are given an integer N and an integer sequence of length N, A... | [{"input": "10\n105 101 94 98 114 7 6 27 114 120", "output": "58985\n"}, {"input": "10\n105 100 94 98 114 7 6 27 114 120", "output": "58921\n"}, {"input": "10\n105 100 94 98 114 7 6 43 114 120", "output": "58921\n"}, {"input": "10\n105 100 11 98 114 7 6 43 114 120", "output": "58985\n"}, {"input": "10\n105 100 11 98 11... | code_stdio |
[
{
"content": "One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos. They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard... | [{"input": "100\n", "output": "YES\n"}, {"input": "010\n", "output": "YES\n"}, {"input": "98\n", "output": "YES\n"}, {"input": "90\n", "output": "YES\n"}, {"input": "10\n", "output": "YES\n"}, {"input": "32\n", "output": "YES\n"}, {"input": "88\n", "output": "YES\n"}, {"input": "44\n", "output": "YES\n"}, {"input": "12... | code_stdio |
[
{
"content": "Write a program which reads relations in a SNS (Social Network Service), and judges that given pairs of users are reachable each other through the network.\n\nConstraints\n\n* $2 \\leq n \\leq 100,000$\n* $0 \\leq m \\leq 100,000$\n* $1 \\leq q \\leq 10,000$\n\nInput\n\nIn the first line, two inte... | [{"input": "16 9\n0 1\n0 2\n3 4\n5 7\n5 2\n3 7\n6 13\n11 12\n8 9\n3\n0 1\n5 9\n1 3", "output": "yes\nno\nyes\n"}, {"input": "16 9\n0 1\n0 2\n3 4\n5 7\n5 2\n3 7\n6 13\n7 8\n8 9\n3\n0 1\n5 9\n1 3", "output": "yes\nyes\nyes\n"}, {"input": "16 9\n0 1\n0 2\n6 4\n5 7\n5 2\n3 7\n6 13\n7 8\n8 9\n3\n0 1\n5 9\n1 3", "output": "y... | code_stdio |
[
{
"content": "You are given an array a of size n, and q queries to it. There are queries of two types: 1 l_{i} r_{i} β perform a cyclic shift of the segment [l_{i}, r_{i}] to the right. That is, for every x such that l_{i} β€ x < r_{i} new value of a_{x} + 1 becomes equal to old value of a_{x}, and new value o... | [{"input": "6 3 5\n1 2 3 4 10 6\n2 1 3\n2 3 6\n1 1 6\n2 2 1 5 3\n", "output": "3 3 1 10 2\n"}, {"input": "6 3 5\n1 2 3 4 5 12\n2 1 3\n2 3 6\n1 1 6\n2 2 1 5 4\n", "output": "3 3 1 5 12\n"}, {"input": "6 3 5\n1 2 3 4 10 6\n2 2 3\n2 3 6\n1 1 6\n2 2 1 5 3\n", "output": "1 1 2 10 3\n"}, {"input": "6 3 5\n0 2 3 4 10 6\n2 1 3... | code_stdio |
[
{
"content": "Lo and Behold! For you may be surprised by what our chief chef Noodle has in mind for this season! Today, Noodle announced one of his most extra-ordinary ideas ever - Project Spoon. \nNoodle plans to deploy large spoons in the atmosphere so that people all around the world can download food direct... | [{"input": "2\n18\n229", "output": "6\n10\n"}, {"input": "2\n18\n344", "output": "6\n11\n"}, {"input": "2\n128\n46", "output": "10\n8\n"}, {"input": "2\n11\n493", "output": "6\n12\n"}, {"input": "2\n246\n83", "output": "10\n9\n"}, {"input": "2\n368\n38", "output": "11\n8\n"}, {"input": "2\n246\n11", "output": "10\n6\n"... | code_stdio |
[
{
"content": "There are two lists of different length. The first one consists of keys, the second one consists of values. Write a function ```createDict(keys, values)``` that returns a dictionary created from keys and values. If there are not enough values, the rest of keys should have a ```None``` value. If th... | [{"input": "[\"a\", \"b\", \"c\", \"d\", \"e\"]\n[1, 2]", "output": "[{\"a\": 1, \"b\": 2, \"c\": null, \"d\": null, \"e\": null}]", "fn_name": "createDict"}, {"input": "[\"a\", \"b\", \"c\"]\n[1, 2, 3]", "output": "[{\"a\": 1, \"b\": 2, \"c\": 3}]", "fn_name": "createDict"}, {"input": "[\"a\", \"b\"]\n[1, 2, 3, 4]", "... | code_functional |
[
{
"content": "You are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n - When the number is written in base ten, eac... | [{"input": "999999999\n", "output": "26484\n"}, {"input": "500000000\n", "output": "14384\n"}, {"input": "777757375\n", "output": "26423\n"}, {"input": "777777752\n", "output": "26483\n"}, {"input": "777777753\n", "output": "26484\n"}, {"input": "1260308870", "output": "26484\n"}, {"input": "1450760047", "output": "264... | code_stdio |
[
{
"content": "Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\n-----Constraints-----\n - 1 \\leq N \\leq 10^5\n\n-----Input-----\nInput is given from Standard Input in the following format:\nN\n\n-----Ou... | [{"input": "100000\n", "output": "90909\n"}, {"input": "45901\n", "output": "36811\n"}, {"input": "99924\n", "output": "90834\n"}, {"input": "99999\n", "output": "90909\n"}, {"input": "100010", "output": "90909\n"}, {"input": "100000", "output": "90909"}, {"input": "10000\n", "output": "910\n"}, {"input": "3124\n", "ou... | code_stdio |
[
{
"content": "To get on the Shinkansen, you need two tickets, a \"ticket\" and a \"limited express ticket\". These are separate tickets because some of the routes may not use the Shinkansen, but for routes that use only the Shinkansen, one ticket can be used as both a ticket and a limited express ticket. It may... | [{"input": "0 0 0", "output": "Close\n"}, {"input": "1 0 0", "output": "Close\n"}, {"input": "0 1 0", "output": "Close\n"}, {"input": "0 0 0", "output": "Close\n"}, {"input": "0 1 0", "output": "Close\n"}, {"input": "1 0 0", "output": "Close\n"}, {"input": "1 1 0", "output": "Open\n"}, {"input": "1 1 0", "output": "Ope... | code_stdio |
[
{
"content": "ICPC Calculator\n\nIn mathematics, we usually specify the order of operations by using parentheses. For example, 7 Γ (3 + 2) always means multiplying 7 by the result of 3 + 2 and never means adding 2 to the result of 7 Γ 3. However, there are people who do not like parentheses. International Count... | [{"input": "1\n4\n0\n+\n2.115262384218664\n1.6946524456220797\n1.2494077125386351\n0\n+\n2.4871472060127386\n+.\n.-*\n3...\n...)\n--.+1\n2....\n1.1146316365084887\n-1\n*\n0\n1.4326064398520582\n.3.\n)/\n0.6657411913142146\n*/.\n.7..\n...6\n1.7891160931823404\n-1", "output": "4\n"}, {"input": "1\n2\n0\n+\n2.115262384218... | code_stdio |
[
{
"content": "There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance bi inclusive. The beacon itself is not destroyed howe... | [{"input": "11\n110 90\n100 70\n90 10\n155 15\n130 1\n60 1\n71 10\n40 1\n30 1\n10 1\n20 1\n", "output": "4\n"}, {"input": "11\n110 90\n100 70\n90 10\n155 15\n70 1\n60 1\n71 10\n40 1\n30 1\n10 1\n20 1\n", "output": "4\n"}, {"input": "11\n110 90\n100 70\n90 10\n80 10\n70 1\n60 1\n50 10\n40 1\n30 1\n10 1\n20 1\n", "output... | code_stdio |
[
{
"content": "There are n cities and m bidirectional roads in the country. The roads in the country form an undirected weighted graph. The graph is not guaranteed to be connected. Each road has it's own parameter w. You can travel through the roads, but the government made a new law: you can only go through two... | [{"input": "18 20\n10 1 25\n7 1 32\n5 3 45\n4 9 14\n3 4 19\n6 8 5\n9 6 18\n5 3 38\n10 7 12\n7 6 29\n10 6 12\n6 2 40\n8 9 19\n7 8 11\n7 4 19\n2 1 38\n10 14 3\n6 1 50\n10 3 41\n1 8 3\n", "output": "0 2694 1573 1088 4337 64 196 1013 484 1302 -1 -1 -1 289 -1 -1 -1 -1\n"}, {"input": "18 20\n10 1 25\n7 1 32\n5 3 45\n4 9 14\n... | code_stdio |
[
{
"content": "Mary wrote a recipe book and is about to publish it, but because of a new European law, she needs to update and include all measures in grams.\n\nGiven all the measures in tablespoon (`tbsp`) and in teaspoon (`tsp`), considering `1 tbsp = 15g` and `1 tsp = 5g`, append to the end of the measurement... | [{"input": "\"In another bowl, add 2 tsp of vanilla extract, 3 tsp of baking soda and 1/2 tsp of salt\"", "output": "[\"In another bowl, add 2 tsp (10g) of vanilla extract, 3 tsp (15g) of baking soda and 1/2 tsp (3g) of salt\"]", "fn_name": "convert_recipe"}, {"input": "\"Add to the mixing bowl and coat well with 1 tbs... | code_functional |
[
{
"content": "Colossal!Β β exclaimed Hawk-nose.Β β A programmer! That's exactly what we are looking for.Arkadi and Boris Strugatsky. Monday starts on Saturday\n\nReading the book \"Equations of Mathematical Magic\" Roman Oira-Oira and Cristobal Junta found an interesting equation: $a - (a \\oplus x) - x = 0$ for ... | [{"input": "9\n3\n2\n2\n228\n1\n1\n0\n16\n1488\n", "output": "4\n2\n2\n16\n2\n2\n1\n2\n32\n"}, {"input": "9\n2\n1\n2\n228\n1\n6\n8\n16\n1488\n", "output": "2\n2\n2\n16\n2\n4\n2\n2\n32\n"}, {"input": "9\n3\n2\n2\n272\n1\n1\n15\n3\n1488\n", "output": "4\n2\n2\n4\n2\n2\n16\n4\n32\n"}, {"input": "9\n13\n4\n0\n228\n2\n0\n1\... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.