messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 1
value |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are both a shop keeper and a shop assistant at a small nearby shop. You have n goods, the i-th good costs a_i coins.\n\nYou got tired of remembering the price of each product when customers ask for it, thus you decide... | [{"type": "stdin_stdout", "input": "3\n5\n1 2 6 4 5\n3\n1 2 3\n2\n777 2131\n", "output": "4\n2\n1454\n"}, {"type": "stdin_stdout", "input": "3\n5\n1 2 3 4 5\n3\n1 2 3\n2\n777 1089\n", "output": "3\n2\n933\n"}, {"type": "stdin_stdout", "input": "3\n5\n1 2 6 4 5\n3\n1 2 3\n2\n777 1089\n", "output": "4\n2\n933\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines t... | [{"type": "stdin_stdout", "input": "10 20\n6 10\n3 10\n10 4\n5 3\n9 4\n10 1\n10 3\n10 7\n8 5\n7 2\n4 7\n5 1\n2 9\n5 5\n6 6\n9 8\n2 10\n9 10\n1 4\n7 4\n", "output": "0 0 4 9 4 1 2 0 0\n"}, {"type": "stdin_stdout", "input": "100 10\n97 5\n53 35\n92 86\n54 95\n98 13\n36 23\n55 56\n96 94\n25 96\n49 31\n", "output": "6 4 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n strings a_1, a_2, β¦, a_n: all of them have the same length m. The strings consist of lowercase English letters.\n\nFind any string s of length m such that each of the given n strings differs from s in at m... | [{"type": "stdin_stdout", "input": "5\n2 4\nabac\nzbab\n2 4\naaaa\nbbbb\n3 3\nbaa\naaa\naab\n2 2\nab\nbb\n3 1\na\nb\nc\n", "output": "zbac\n-1\naaa\nab\na\n"}, {"type": "stdin_stdout", "input": "5\n2 4\nabac\nzbab\n2 4\naaaa\nbbbb\n3 3\nbaa\naaa\naab\n2 2\nab\nbb\n3 1\na\nb\nc\n", "output": "zbac\n-1\naaa\nab\na\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are creating a level for a video game. The level consists of n rooms placed in a circle. The rooms are numbered 1 through n. Each room contains exactly one exit: completing the j-th room allows you to go the (j+1)-th ... | [{"type": "stdin_stdout", "input": "50\n499 1400 1621 123 72 526 944 482 862 136 265 605 5 616 974 967 713 187 969 467 573 845 71 224 17 873 648 120 239 1722 438 574 404 129 899 583 632 314 525 496 443 857 241 78 575 2 430 137 387 911\n", "output": "459200194 19968654 978281891 778632355 119790684 519088159 339403985 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that had been living at this plan... | [{"type": "stdin_stdout", "input": "4\n3 13\n5 8\n8 9\n8 10\n", "output": "8 3\n"}, {"type": "stdin_stdout", "input": "4\n3 13\n5 8\n6 9\n8 10\n", "output": "6 3\n"}, {"type": "stdin_stdout", "input": "4\n3 4\n4 5\n4 6\n8 10\n", "output": "4 2\n"}, {"type": "stdin_stdout", "input": "4\n3 4\n4 8\n4 6\n8 10\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOleg's favorite subjects are History and Math, and his favorite branch of mathematics is division.\n\nTo improve his division skills, Oleg came up with t pairs of integers p_i and q_i and for each pair decided to find the... | [{"type": "stdin_stdout", "input": "10\n622457341638479796 338608092\n891914827865404228 279127582\n1567895284521734914 1071397817\n859803368805468629 746530097\n286803888063493394 769449696\n28943295091599321 24611833\n598448092106640578 352238501\n733629261048200000 672172589\n1286713648467123503 46\n7203441458027487... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\... | [{"type": "stdin_stdout", "input": "44447774444474477747774774477777474774744744477444447777477477744747477774744444744777777777747777477447744774744444747477744744\n77777474477477747774777777474474477444474777477747747777477747747744474474747774747747444777474444744744444477477777747744747477\n", "output": "37\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a n Γ m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m).\n\nYou can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell (x, y). You... | [{"type": "stdin_stdout", "input": "9\n1 1 0\n2 2 4\n2 2 3\n2 2 -2\n1 1 1\n100 100 11000\n2 3 7\n3 1 9\n2 6 11\n", "output": "YES\nNO\nYES\nNO\nNO\nNO\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "9\n1 1 0\n2 2 4\n2 2 3\n2 2 -1\n2 1 1\n100 100 10000\n2 4 7\n3 1 9\n2 6 8\n", "output": "YES\nNO\nYES\nNO\nYES\nNO\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAquaMoon had n strings of length m each. n is an odd number.\n\nWhen AquaMoon was gone, Cirno tried to pair these n strings together. After making (n-1)/(2) pairs, she found out that there was exactly one string without t... | [{"type": "stdin_stdout", "input": "3\n3 5\naaaaa\nbbbbb\nccccc\n2 2 4 1 0 2 4 7\n2 1 3\n3 4\naaaa\nbbbb\ncccc\n0 0 2 1 2\n2 1 3\n5 6\nabcdef\nuuuuuu\nkekeke\nekekek\nmyzklx\n1 5 1 2 -1 4\n2 5 5 2 4 1\n5 8 1 2 3\n", "output": "abcabcabcabcabc\n\nabcabcabcabc\n"}, {"type": "stdin_stdout", "input": "3\n3 5\naaaaa\nbbbbb\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring the break the schoolchildren, boys and girls, formed a queue of n people in the canteen. Initially the children stood in the order they entered the canteen. However, after a while the boys started feeling awkward f... | [{"type": "stdin_stdout", "input": "50 30\nBGGGGGGBGGBGBGGGGBGBBGBBBGGBBBGBGBGGGGGBGBBGBGBGGG\n", "output": "GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGBBBBBBBBBBBBBBBBBBBB\n"}, {"type": "stdin_stdout", "input": "50 13\nGGGBGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG\n", "output": "GGGGGGGGGGGGGGGGBGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms:\n\n 1. Make vi-th array element e... | [{"type": "stdin_stdout", "input": "6 6\n202714501 613423725 367325359 862808465 196327629 745008828\n2 492\n2 1943\n1 3 173984392\n1 5 17007494\n3 4\n1 5 472683539\n", "output": "862810900\n\n"}, {"type": "stdin_stdout", "input": "6 6\n202714501 613423725 367325359 862808465 196327629 745008828\n2 492\n2 1943\n1 3 173... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPaladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the swamp is very difficult, so people tramped exactly n - 1 paths. Each o... | [{"type": "stdin_stdout", "input": "50 2 5\n9 14\n46 34\n40 35\n44 30\n32 16\n1 38\n48 2\n17 14\n50 25\n6 1\n45 19\n21 15\n22 11\n15 33\n8 28\n2 32\n10 22\n37 3\n43 39\n25 16\n9 19\n16 3\n36 32\n20 45\n24 32\n4 18\n49 39\n13 45\n26 4\n11 33\n14 37\n42 19\n31 45\n38 3\n34 8\n18 29\n35 34\n29 16\n7 46\n19 28\n27 33\n30 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLevko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of one of two types:\n\n 1. I... | [{"type": "stdin_stdout", "input": "97 29\n2 78 82 356152\n2 14 29 430177\n1 59 84 3680\n1 49 89 -2247\n1 92 96 3701\n2 54 89 377271\n1 62 70 -507\n2 94 97 431563\n1 46 55 -9257\n1 51 83 1627\n1 10 20 6633\n1 17 34 -9263\n2 66 92 383251\n1 12 82 3884\n1 78 96 -5379\n2 13 35 424798\n1 68 91 2939\n2 80 84 214725\n1 61 85... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera had an undirected connected graph without self-loops and multiple edges consisting of n vertices. The graph had an interesting property: there were at most k edges adjacent to each of its vertices. For convenience,... | [{"type": "stdin_stdout", "input": "10 6\n0 4 1 1 2 1 1 2 1 3\n", "output": "9\n1 3\n1 4\n1 6\n1 7\n1 9\n3 5\n3 8\n5 10\n10 2\n"}, {"type": "stdin_stdout", "input": "10 6\n0 2 1 1 1 1 1 2 1 2\n", "output": "9\n1 3\n1 4\n1 5\n1 6\n1 7\n1 9\n3 2\n3 8\n3 10\n"}, {"type": "stdin_stdout", "input": "10 6\n0 2 1 1 2 1 1 2 1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, after a difficult lecture a diligent student Sasha saw a graffitied desk in the classroom. She came closer and read: \"Find such positive integer n, that among numbers n + 1, n + 2, ..., 2Β·n there are exactly m n... | [{"type": "stdin_stdout", "input": "101628400798615604 31\n", "output": "981546175132942729\n"}, {"type": "stdin_stdout", "input": "101628400788615604 30\n", "output": "999999999999995905\n"}, {"type": "stdin_stdout", "input": "10000000000000000 24\n", "output": "318248384812319433\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwilight Sparkle once got a crystal from the Crystal Mine. A crystal of size n (n is odd; n > 1) is an n Γ n matrix with a diamond inscribed into it.\n\nYou are given an odd integer n. You need to draw a crystal of size n... | [{"type": "stdin_stdout", "input": "101\n", "output": "**************************************************D**************************************************\n*************************************************DDD*************************************************\n************************************************DDDDD******... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDreamoon likes to play with sets, integers and <image>. <image> is defined as the largest positive integer that divides both a and b.\n\nLet S be a set of exactly four distinct integers greater than 0. Define S to be of r... | [{"type": "stdin_stdout", "input": "3600 8\n", "output": "172792\n8 16 24 40\n56 64 72 88\n104 112 120 136\n152 160 168 184\n200 208 216 232\n248 256 264 280\n296 304 312 328\n344 352 360 376\n392 400 408 424\n440 448 456 472\n488 496 504 520\n536 544 552 568\n584 592 600 616\n632 640 648 664\n680 688 696 712\n728 736 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe DNA sequence for every living creature in Berland can be represented as a non-empty line consisting of lowercase Latin letters. Berland scientists found out that all the creatures evolve by stages. During one stage ex... | [{"type": "stdin_stdout", "input": "caaijqulvbesqytzrjqujqhsqtzqulbvhsquqsqcmzlqswbvug\nyinccmmtvchfctzlqcsqwqlpktbjidmusqmqbfjsqwuclwfugq\n50\nw->ep\nc->ya\nj->dc\nf->ot\nc->xm\nb->ce\nt->vl\ni->qu\nk->rv\ns->hs\nh->cu\nl->fn\nl->ai\ng->di\nb->bn\nc->ej\ng->kx\ns->uw\nh->hp\nv->ji\nw->sh\nn->cm\nj->ed\ny->lf\nk->lr\nf... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains number i Γ j. The rows and columns are numbered starting from 1.\n\nYou are given a posi... | [{"type": "stdin_stdout", "input": "100000 1000000000\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "100000 479001600\n", "output": "254\n"}, {"type": "stdin_stdout", "input": "100000 551350800\n", "output": "392\n"}, {"type": "stdin_stdout", "input": "100000 183783600\n", "output": "438\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSpongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of n and m, such that there are exactly x distinct squares in the table consisting of n rows and m c... | [{"type": "stdin_stdout", "input": "983282300\n", "output": "48\n 1 983282300\n 2 3277... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n pearls in a row. Let's enumerate them with integers from 1 to n from the left to the right. The pearl number i has the type ai.\n\nLet's call a sequence of consecutive pearls a segment. Let's call a segment go... | [{"type": "stdin_stdout", "input": "10\n460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451 460626451\n", "output": "5\n1 2\n3 4\n5 6\n7 8\n9 10\n"}, {"type": "stdin_stdout", "input": "10\n460626451 460626451 460626451 460626451 460626451 460626451 460626451 352666953 460626451 460... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediat... | [{"type": "stdin_stdout", "input": "5 12 1\n1 5\n", "output": "0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "5 10 2\n1 2\n3 1 7 5\n", "output": "0 0 0 0 0 0 5 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.\n\nArtem want... | [{"type": "stdin_stdout", "input": "10\n1 1 1000000000\n1 4 1000000000\n2 2 1000000000\n1 5 1000000000\n1 8 1000000000\n2 15 1000000000\n3 3 1000000000\n3 10 1000000000\n3 6 1000000000\n3 7 1000000000\n", "output": "0\n3\n2\n2\n"}, {"type": "stdin_stdout", "input": "10\n1 1 1000000000\n1 4 1000000000\n2 2 1000000000\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder has drawn an undirected graph of n vertices numbered from 0 to n - 1 and m edges between them. Each edge of the graph is weighted, each weight is a positive integer.\n\nThe next day, ZS the Coder realized tha... | [{"type": "stdin_stdout", "input": "7 9 999999999 0 3\n0 1 0\n1 2 0\n2 3 0\n0 4 1\n4 1 1\n1 5 499999999\n5 2 499999999\n2 6 1\n6 3 1\n", "output": "YES\n0 1 1\n1 2 999999996\n2 3 999999997\n0 4 1\n4 1 1\n1 5 499999999\n5 2 499999999\n2 6 1\n6 3 1\n"}, {"type": "stdin_stdout", "input": "7 9 999999999 0 3\n0 1 0\n1 2 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAhmed and Mostafa used to compete together in many programming contests for several years. Their coach Fegla asked them to solve one challenging problem, of course Ahmed was able to solve it but Mostafa couldn't.\n\nThis ... | [{"type": "stdin_stdout", "input": "14 14\n6 -1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 2 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 1\n6 1 1 1 1 1 -1\n1 2 3 4 5 6 7 8 9 10 11 12 13 14\n", "output": "83\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of positive integers and q queries to this array. There are two types of queries: \n\n * 1 l r x β for each index i such that l β€ i β€ r set ai = x. \n * 2 l r β find the minimum among... | [{"type": "stdin_stdout", "input": "10 10\n10 8 10 14 2 2 4 6 10 1\n10\n1 17 87 5\n2 31 94\n1 5 99 8\n1 56 90 10\n1 25 93 6\n1 11 32 5\n2 20 49\n1 46 87 8\n2 14 48\n2 40 48\n", "output": "1\n5\n5\n6\n"}, {"type": "stdin_stdout", "input": "10 10\n10 8 10 9 2 2 4 6 2 1\n10\n1 17 87 5\n2 31 94\n1 10 56 8\n1 78 90 10\n1 25... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.\n\nWe will call point a bad if there are different points b and c, not equal to a, from the given set such ... | [{"type": "stdin_stdout", "input": "11\n358 -724 -232 53 -520\n486 -554 -328 53 -220\n358 -554 -232 -372 -520\n358 -554 -232 308 -520\n868 -554 448 53 -520\n478 -554 -322 53 -600\n358 296 -232 53 -520\n256 -554 -368 53 -520\n230 -554 -136 53 -820\n-182 -554 173 53 -160\n358 -554 -232 53 -520\n", "output": "1\n11\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEverybody in Russia uses Gregorian calendar. In this calendar there are 31 days in January, 28 or 29 days in February (depending on whether the year is leap or not), 31 days in March, 30 days in April, 31 days in May, 30 ... | [{"type": "stdin_stdout", "input": "24\n29 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "24\n28 31 30 31 30 31 31 30 31 30 31 31 28 31 30 31 30 31 31 30 31 30 31 31\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "24\n31 28 31 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Init... | [{"type": "stdin_stdout", "input": "2 40\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n", "output": "0\n1\n3\n7\n15\n31\n63\n127\n255\n511\n1023\n2047\n4095\n8191\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected.\n\nThe pasture i... | [{"type": "stdin_stdout", "input": "10 10\n....W.W.W.\n.........S\n.S.S...S..\nW.......SS\n.W..W.....\n.W...W....\nS..S...S.S\n....W...S.\n..S..S.S.S\nSS.......S\n", "output": "Yes\nDDDDWDWDWD\nDDDDDDDDDS\nDSDSDDDSDD\nWDDDDDDDSS\nDWDDWDDDDD\nDWDDDWDDDD\nSDDSDDDSDS\nDDDDWDDDSD\nDDSDDSDSDS\nSSDDDDDDDS\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nString can be called correct if it consists of characters \"0\" and \"1\" and there are no redundant leading zeroes. Here are some examples: \"0\", \"10\", \"1001\".\n\nYou are given a correct string s.\n\nYou can perform... | [{"type": "stdin_stdout", "input": "100\n1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"}, {"type": "stdin_stdout", "input": "100\n10000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCat Noku recently picked up construction working as a hobby. He's currently working with a row of buildings and would like to make it beautiful.\n\nThere are n buildings in a row. The height of the i-th building is xi.\n\... | [{"type": "stdin_stdout", "input": "328 292351550 423738 553208\n212104 323236 874897 789938 217603 184758 141056 786670 468124 275297 166078 549777 797943 48188 1239581 612740 236243 719660 10818 237349 7310 533049 18681 643358 866782 174809 1123432 32784 718241 62650 438776 423884 482093 19525 611891 31928 1485735 81... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are 26 letters in the English alphabet and 6 of them are vowels: a,e,i,o,u,y.\nOther 20 letters are called consonants.\n\nLimak is a little polar bear.\nHe found a string s consisting of lowercase English letters.\n... | [{"type": "stdin_stdout", "input": "50\net\ngel\nkekjoiceuuziizyu\nisaemwyocoioymeuiwovorgiuljiu\neydexzizfiahklyoesbyxemedqvrxlvtikiiawufoxcsfysreq\nuwluy\neeoxnizrabguxzeoqyefeziamxumborjyeanunzuphaimuxej\niueeuaqceueoeoomsd\ngowut\nihvy\nyieixymmhfpegakiyignijewuteofajjplviiapeggxipuieju\neanodofhmmbsivegmidiaalulht... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"She loves me\", \"She loves me not\", \"She loves me\", \"She loves me not\", OH WAIT, I'm LALA,\n\"They love me\", \"They love me not\", \"They love me\", \"They love me not\". Lala was indeed overwhelmed by the\n'runn... | [{"type": "stdin_stdout", "input": "64\n317306974\n24435194\n36701392\n102003399\n38591177\n150073105\n171554925\n4769107\n48186188\n92980498\n202706670\n253829104\n235038229\n5859136\n125741147\n48357310\n411432358\n169557272\n29923942\n206794813\n35005212\n247430138\n16720534\n81965044\n62300552\n38525838\n6441541\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWizKid went on a trip to Wonderland with his classmates. Now, as you know, going on trips incurs costs including hotel costs, fooding, shopping, etc. And when many people go together, usually one person pays and it is exp... | [{"type": "stdin_stdout", "input": "10\n5 5\nprtei\nfyidw\nnshrv\nvflws\noefcc\nfyidw\n703\n1\noefcc\nfyidw\n35\n3\nnshrv\noefcc\nvflws\noefcc\n117\n2\nfyidw\nprtei\nfyidw\n149\n3\nnshrv\noefcc\nvflws\nfyidw\n408\n2\noefcc\nvflws\n5 5\nnoocg\nvugwp\nzjioj\nnpedp\nwqqbm\nwqqbm\n263\n1\nnpedp\nnpedp\n782\n3\nzjioj\nwqqbm... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday, teacher taught Xenny the chapter 'Prime numbers and Composite numbers'. Xenny liked it and being a studious boy, wanted some homework. So teacher gave him a simple task. The task is to find the smallest composite n... | [{"type": "stdin_stdout", "input": "2\n109\n1\n\nMMEOAS", "output": "110\n4\n"}, {"type": "stdin_stdout", "input": "2\n122\n0\n\nSAOMEM", "output": "123\n4\n"}, {"type": "stdin_stdout", "input": "2\n0\n100\n\nRKPELB", "output": "4\n102\n"}, {"type": "stdin_stdout", "input": "2\n30\n12\n\nEMOMAS", "output": "32\n14\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters. You have decided to choose some three consecutive ch... | [{"type": "stdin_stdout", "input": "sakahashi", "output": "sak\n"}, {"type": "stdin_stdout", "input": "sbkahashi", "output": "sbk\n"}, {"type": "stdin_stdout", "input": "ihsahakbs", "output": "ihs\n"}, {"type": "stdin_stdout", "input": "hhsaiakbr", "output": "hhs\n"}, {"type": "stdin_stdout", "input": "rbkaiashh", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N integers A_1, A_2, ..., A_N.\n\nThere are \\frac{N(N-1)}{2} ways to choose two of them and form a pair. If we compute the product of each of those pairs and sort the results in ascending order, what will be the ... | [{"type": "stdin_stdout", "input": "30 413\n-170202098 -268409015 537203564 983211703 11883920 -443999067 -286607651 -159124657 -358352725 526800997 -1907718835 648738515 -1273635706 -1268616353 37909651 -1 1196187672 -20098238 0 -948955241 1 -214720580 287839163 -18897162 694477644 0 -425610555 158912296 842295515 0",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a tree with N vertices. The vertices are numbered 1 through N. The i-th edge (1 \\leq i \\leq N - 1) connects Vertex x_i and y_i. For vertices v and w (1 \\leq v, w \\leq N), we will define the distance between v... | [{"type": "stdin_stdout", "input": "7\n1 2\n6 1\n4 5\n1 7\n1 5\n2 3", "output": "1036\n"}, {"type": "stdin_stdout", "input": "7\n1 2\n6 1\n4 1\n1 7\n2 5\n1 3", "output": "1448\n"}, {"type": "stdin_stdout", "input": "7\n1 2\n1 3\n4 5\n1 7\n1 5\n2 6", "output": "1036\n"}, {"type": "stdin_stdout", "input": "7\n1 2\n6 2\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a tree with N vertices, numbered 1 through N. The i-th edge in this tree connects Vertices A_i and B_i and has a length of C_i.\n\nJoisino created a complete graph with N vertices. The length of the edge connecti... | [{"type": "stdin_stdout", "input": "8\n2 8 13\n1 5 1\n4 5 0\n3 5 4\n3 8 5\n6 8 17\n2 7 12", "output": "171\n"}, {"type": "stdin_stdout", "input": "8\n2 4 8\n1 5 0\n4 8 2\n2 5 11\n3 8 6\n6 3 9\n2 7 12", "output": "178\n"}, {"type": "stdin_stdout", "input": "8\n2 8 8\n1 5 1\n4 8 0\n2 5 4\n3 8 5\n6 8 17\n2 7 12", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere 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 eac... | [{"type": "stdin_stdout", "input": "111100001111\n111000001111\n110000001110\n100000001111\n000100010000\n010000111010\n000001111100\n100011111110\n010101111100\n111000111000\n111100010000\n000000100000\n\n110001111100\n110010001010\n010010000001\n010000000001\n010000000110\n010000111000\n010000000000\n010000010010\n01... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe neutral city of Eyes City, in the heart of the four countries, is home to the transcontinental train Bandai. The platform has a row of chairs for passengers waiting for the Bandai, and people who enter the platform ca... | [{"type": "stdin_stdout", "input": "10 4\nA\nB\nB\nC\n8 4\nD\nD\nB\nB\n0 0", "output": "AC######BB\nD####BBD\n"}, {"type": "stdin_stdout", "input": "12 4\nA\nB\nB\nD\n5 4\nC\nD\nB\nB\n0 0", "output": "A####D####BB\nD#CBB\n"}, {"type": "stdin_stdout", "input": "10 4\nA\nC\nD\nB\n7 4\nC\nA\nB\nB\n0 0", "output": "AC#####... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are now in a bookshop with your friend Alice to buy a book, \"The Winning Strategy for the Programming Koshien Contest,β just released today. As you definitely want to buy it, you are planning to borrow some money fro... | [{"type": "stdin_stdout", "input": "0111 12618 3831", "output": "3720\n"}, {"type": "stdin_stdout", "input": "0101 15626 3831", "output": "3730\n"}, {"type": "stdin_stdout", "input": "0110 15626 3831", "output": "3721\n"}, {"type": "stdin_stdout", "input": "0111 27455 5699", "output": "5588\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe JOI Railways is the only railway company in the Kingdom of JOI. There are $N$ stations numbered from $1$ to $N$ along a railway. Currently, two kinds of trains are operated; one is express and the other one is local.\... | [{"type": "stdin_stdout", "input": "10 3 1\n10 6 -1\n10\n-1\n1\n10", "output": "3\n"}, {"type": "stdin_stdout", "input": "10 3 5\n3 2 6\n79\n-1\n13\n10", "output": "11\n"}, {"type": "stdin_stdout", "input": "16 3 10\n10 3 6\n16\n2\n11\n11", "output": "2\n"}, {"type": "stdin_stdout", "input": "10 3 1\n10 6 -1\n51\n-1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given N points in the xy-plane. You have a circle of radius one and move it on the xy-plane, so as to enclose as many of the points as possible. Find how many points can be simultaneously enclosed at the maximum. ... | [{"type": "stdin_stdout", "input": "3\n6.834942604239939 7.69628\n6.04723928846506 4.859878448884584\n7.439438773048666 6.914350092484497\n6\n7.260024632937995 4.220572316804344\n7.2301779956102665 2.69466\n5.977411451010016 4.7893139817742\n5.771323891387089 5.033018424848772\n7.097650770216692 5.940611762552271\n8.51... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTraining is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well.\n\nToday's training is to develop physical strength and judgment by running on a straight... | [{"type": "stdin_stdout", "input": "3 1 1 2 3 110\n49\n50\n51", "output": "53.6666666667\n"}, {"type": "stdin_stdout", "input": "3 0 1 2 3 100\n49\n50\n74", "output": "48.8333333333\n"}, {"type": "stdin_stdout", "input": "3 1 2 2 3 100\n49\n50\n51", "output": "47.6666666667\n"}, {"type": "stdin_stdout", "input": "3 1 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNathan O. Davis has been running an electronic bulletin board system named JAG-channel. He is now having hard time to add a new feature there --- threaded view.\n\nLike many other bulletin board systems, JAG-channel is th... | [{"type": "stdin_stdout", "input": "1\n0\nccpi", "output": "ccpi\n"}, {"type": "stdin_stdout", "input": "1\n0\nipcc", "output": "ipcc\n"}, {"type": "stdin_stdout", "input": "1\n0\njpcc", "output": "jpcc\n"}, {"type": "stdin_stdout", "input": "1\n0\ncbpi", "output": "cbpi\n"}, {"type": "stdin_stdout", "input": "1\n0\nio... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nIf you bring an empty bottle of $ a $ milk, you can exchange it for a new bottle of $ b $ milk.\nHow many bottles of milk can Mr. Kawabayashi, who initially has a bottle of $ x $ milk, drink? Output the remaind... | [{"type": "stdin_stdout", "input": "560118409912468 316250877917599 1316995007040099", "output": "500636509\n"}, {"type": "stdin_stdout", "input": "316250877917604 316250877917599 672514164456590", "output": "265329493\n"}, {"type": "stdin_stdout", "input": "560118409912468 316250877917599 681260158257385", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor given three points p1, p2, p, find the reflection point x of p onto p1p2.\n\n<image>\n\nConstraints\n\n* 1 β€ q β€ 1000\n* -10000 β€ xi, yi β€ 10000\n* p1 and p2 are not identical.\n\nInput\n\n\nxp1 yp1 xp2 yp2\nq\nxp0 yp... | [{"type": "stdin_stdout", "input": "0 0 2 0\n3\n-1 1\n0 1\n1 1", "output": "-1.0000000000 -1.0000000000\n0.0000000000 -1.0000000000\n1.0000000000 -1.0000000000"}, {"type": "stdin_stdout", "input": "0 0 3 -1\n3\n0 1\n4 20\n-1 2", "output": "-0.600000000 -0.800000000\n-8.800000000 -18.400000000\n-2.000000000 -1.000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor $n$ lists $L_i$ $(i = 0, 1, ..., n-1)$, perform a sequence of the following operations.\n\n* insert($t$, $x$): Insert an integer $x$ at the end of $L_t$.\n* dump($t$): Print all elements in $L_t$.\n* splice($s$, $t$):... | [{"type": "stdin_stdout", "input": "3 24\n0 1 1\n0 1 1\n0 1 3\n0 1 4\n0 1 5\n2 2 1\n0 2 7\n1 1\n1 2\n1 2", "output": "1 1 3 4 5\n7\n7\n7\n7\n7\n7\n7\n7\n7\n7\n7\n7\n7\n7\n7\n7\n"}, {"type": "stdin_stdout", "input": "3 24\n0 1 1\n0 1 1\n0 1 5\n0 1 4\n0 1 5\n2 2 1\n0 2 7\n1 1\n1 2\n1 2", "output": "1 1 5 4 5\n7\n7\n7\n7\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDid you know that Chwee kueh, a cuisine of Singapore, means water rice cake ? Its a variety of the most popular South Indian savory cake, only that we call it here idli :). The tastiest idlis are made in Chennai, by none ... | [{"type": "stdin_stdout", "input": "3\n4\n1 4 2 3\n2\n1 2\n10\n1 0 3 4 1 6 7", "output": "-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "3\n4\n1 4 2 3\n2\n1 2\n10\n1 0 3 1 1 6 7", "output": "-1\n-1\n-1\n"}, {"type": "stdin_stdout", "input": "3\n4\n1 4 1 3\n2\n1 2\n7\n1 -1 3 4 6 6 7", "output": "-1\n-1\n-1\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus every day. The way from home to school is represented by a segment of a straight line; the segment contains exact... | [{"type": "stdin_stdout", "input": "68 74\n51 54\n3 22\n12 24\n3 27\n32 42\n36 55\n60 64\n1 4\n4 23\n11 64\n54 62\n50 56\n21 34\n27 63\n15 54\n28 61\n13 57\n39 53\n12 32\n32 40\n33 67\n55 61\n33 67\n30 37\n15 49\n27 45\n21 41\n8 42\n24 63\n40 48\n28 41\n30 67\n0 4\n7 15\n27 59\n60 62\n25 65\n30 31\n38 67\n24 43\n14 64\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a grid, consisting of 2 rows and n columns. Each cell of this grid should be colored either black or white.\n\nTwo cells are considered neighbours if they have a common border and share the same color. Two c... | [{"type": "stdin_stdout", "input": "1000 1100\n", "output": "961685369\n"}, {"type": "stdin_stdout", "input": "1000 1110\n", "output": "720640362\n"}, {"type": "stdin_stdout", "input": "1000 1010\n", "output": "841013797\n"}, {"type": "stdin_stdout", "input": "1000 1000\n", "output": "987824894"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers l and r (l β€ r). Your task is to calculate the sum of numbers from l to r (including l and r) such that each number contains at most k different digits, and print this sum modulo 998244353.\n\nF... | [{"type": "stdin_stdout", "input": "272324690824608523 272324690825360086 10\n", "output": "654181460\n"}, {"type": "stdin_stdout", "input": "671230848573969360 813646736032170824 12\n", "output": "406228104\n"}, {"type": "stdin_stdout", "input": "542839106765197089 928416801745511006 10\n", "output": "353013736\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a bracket sequence s consisting of n opening '(' and closing ')' brackets.\n\nA regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting charac... | [{"type": "stdin_stdout", "input": "20\n(())(((((((()())()()\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "20\n(()())()((((()(())((\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "20\n(())((((()(((())()()\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "20\n(())(()(((())())()((\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKurt reaches nirvana when he finds the product of all the digits of some positive integer. Greater value of the product makes the nirvana deeper.\n\nHelp Kurt find the maximum possible product of digits among all integers... | [{"type": "stdin_stdout", "input": "1616324002\n", "output": "387420489\n"}, {"type": "stdin_stdout", "input": "1193916775\n", "output": "387420489\n"}, {"type": "stdin_stdout", "input": "1498619968\n", "output": "387420489\n"}, {"type": "stdin_stdout", "input": "1720967773\n", "output": "387420489\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is same as the previous one, but has larger constraints.\n\nShiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, her house is too small,... | [{"type": "stdin_stdout", "input": "10\n30518 30518 30518 30518 30518 30518 30518 30518 30518 30518\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n30518 96518 74071 59971 50121 4862 43967 73607 19138 90754\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n30518 96518 74071 59971 50121 4862 12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and the hard versions is constraints.\n\nA subsequence is a string that can be derived from another string by deleting some or no symbols without changing the order of the remaining sy... | [{"type": "stdin_stdout", "input": "100 1000000000000\ndjgykfqaywhkhpocyxcpvbiiouyielmighclnuopadzuvrirbecucwnzwahahagvfstbxxaednajfauscxwttiglbbxtomnnalcl\n", "output": "8854753825335\n"}, {"type": "stdin_stdout", "input": "100 1000000000000\nlclannmotxbblgittwxcsuafjandeaxxbtsfvgahahawznwcucebrirvuzdapounlchgimleiyuo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of n integers, where n is odd. You can make the following operation with it:\n\n * Choose one of the elements of the array (for example a_i) and increase it by 1 (that is, replace it with a_i + 1... | [{"type": "stdin_stdout", "input": "23 290352079\n162011045 845692742 774584765 103906675 222286673 251540072 1067675108 30856336 71306611 790640347 835976636 327687572 387722548 48938195 769656348 341889962 393959831 928029640 320443541 248114937 798473713 159552755 814528707\n", "output": "471308140\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is different from the easy version. In this version Ujan makes at most 2n swaps. In addition, k β€ 1000, n β€ 50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you... | [{"type": "stdin_stdout", "input": "4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca\n", "output": "YES\n1\n4 1\nNO\nNO\nYES\n3\n3 3\n3 1\n3 2\n"}, {"type": "stdin_stdout", "input": "4\n5\nsouse\nhouhe\n3\ncat\ndog\n2\naa\naz\n3\nabc\nbca\n", "output": "YES\n1\n4 1\nNO\nNO\nYES\n3\n3 3\n3 1\n3 2\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have three piles of candies: red, green and blue candies:\n\n * the first pile contains only red candies and there are r candies in it, \n * the second pile contains only green candies and there are g candies in it,... | [{"type": "stdin_stdout", "input": "6\n2 1 1\n1 1 1\n4 1 2\n7 7 18\n12 1 4\n14 0 13\n", "output": "2\n1\n3\n14\n5\n13\n"}, {"type": "stdin_stdout", "input": "6\n1 1 1\n1 2 1\n4 1 1\n7 7 25\n8 1 4\n14 2 15\n", "output": "1\n2\n2\n14\n5\n15\n"}, {"type": "stdin_stdout", "input": "6\n1 1 1\n1 2 1\n4 1 1\n7 7 25\n8 1 4\n14... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFilled with optimism, Hyunuk will host a conference about how great this new year will be!\n\nThe conference will have n lectures. Hyunuk has two candidate venues a and b. For each of the n lectures, the speaker specified... | [{"type": "stdin_stdout", "input": "4\n544431836 544432042 793496989 793497079\n544429970 544430041 793496343 793496350\n544432412 544432541 793497670 793498269\n544431029 544431033 793494552 793494859\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "4\n922033367 922033530 246113700 246113747\n922034178 92203... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly.\n\nThen Andrey got bored from looking at the same number and he s... | [{"type": "stdin_stdout", "input": "10802611971893001160947949048137125257663360973350362557151889546818281691354280360512029669737944667993533147136817951837479019430773307929092792540144287240690218353482990299029694493198951486742073494255017372881972567810450854959208991586907060759736152497682999322253656832611644... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nHomer likes arrays a lot and he wants to play a game with you. \n\nHomer has hidden from you a permutation a_1, a_2, ..., a_n of integers 1 to n. You are asked to find any index k (1 β€ k... | [{"type": "stdin_stdout", "input": "100\n2 3 4 5 6 7 8 0 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 10 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 1 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 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\n\nInput\n\nThe first line of the input contains a single integer N (1 β€ N β€ 24). The next N lines contain 5 space-separated integers each. The first three integers will be between 0 and 2, inclusive. The last two intege... | [{"type": "stdin_stdout", "input": "10\n2 0 0 1 1\n1 1 1 2 1\n2 1 0 1 2\n1 1 0 1 1\n2 1 0 2 1\n1 1 1 2 1\n1 2 1 3 1\n2 0 0 1 1\n1 1 0 1 1\n1 1 2 2 2\n", "output": "\ncodeforcez\n"}, {"type": "stdin_stdout", "input": "1\n1 0 0 1 0\n", "output": "codeforcez\n"}, {"type": "stdin_stdout", "input": "1\n1 0 0 1 0\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEshag has an array a consisting of n integers.\n\nEshag can perform the following operation any number of times: choose some subsequence of a and delete every element from it which is strictly larger than AVG, where AVG i... | [{"type": "stdin_stdout", "input": "3\n6\n1 1 1 7 3 1\n6\n17 17 8 11 9 12\n6\n10 2 2 2 1 1\n", "output": "2\n5\n4\n"}, {"type": "stdin_stdout", "input": "3\n6\n1 1 1 7 3 1\n6\n17 17 8 11 9 12\n6\n10 2 2 2 0 1\n", "output": "2\n5\n5\n"}, {"type": "stdin_stdout", "input": "3\n6\n1 1 2 7 3 1\n6\n17 17 8 11 9 12\n6\n10 2 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine that you have a twin brother or sister. Having another person that looks exactly like you seems very unusual. It's hard to say if having something of an alter ego is good or bad. And if you do have a twin, then yo... | [{"type": "stdin_stdout", "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 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA widely known among some people Belarusian sport programmer Yura possesses lots of information about cars. That is why he has been invited to participate in a game show called \"Guess That Car!\".\n\nThe game show takes ... | [{"type": "stdin_stdout", "input": "10 10\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 1585 1564 3603 1095 1364 1029 3189 1331\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 1749\n0 3495 1540 641 1093 702 2249 983 1218 2108\n0 1397 1105 3119 1194 839 1286 2979 2941 1911\n0 1818 2264... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!).\n\nThe flying saucer, on which the brave pioneers set off, consists... | [{"type": "stdin_stdout", "input": "602799218 494169337\n", "output": "105935725\n"}, {"type": "stdin_stdout", "input": "523061914 144515354\n", "output": "127493116\n"}, {"type": "stdin_stdout", "input": "622152471 448257864\n", "output": "210299666\n"}, {"type": "stdin_stdout", "input": "549662082 945236243\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest ... | [{"type": "stdin_stdout", "input": "100 100\n-98 -97 -96 -93 -92 -91 -90 -87 -86 -84 -81 -80 -79 -78 -76 -75 -73 -71 -69 -67 -65 -64 -63 -62 -61 -54 -51 -50 -49 -48 -46 -45 -44 -37 -36 -33 -30 -28 -27 -16 -15 -13 -12 -10 -9 -7 -6 -5 -4 2 3 5 8 9 10 11 13 14 15 16 17 19 22 24 25 26 27 28 30 31 32 36 40 43 45 46 47 50 51... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Little Girl loves problems on games very much. Here's one of them.\n\nTwo players have got a string s, consisting of lowercase English letters. They play a game that is described by the following rules:\n\n * The pla... | [{"type": "stdin_stdout", "input": "opfokvwzpllctflkphutcrkferbjyyrasqqkrcvoymyrxwaudgsugcqveccymdplxmtlzfoptmrapfeizpnnhbzlkuyznwacnswibxhqunazbhdvrlidghisuqunstbuevjzimvlfvopgqxrvahhngnaumgywscfrfwfpnfxwhfrelbunmedvkssykwjyartxjiplerntzkpiiaalijiwhyuhxlvhxpkgfypvrpqqsacuwocdampnnhvibsbolyduvscsjfayxpldyvqzjbqojjxdvxt... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFox Ciel has some flowers: r red flowers, g green flowers and b blue flowers. She wants to use these flowers to make several bouquets. There are 4 types of bouquets:\n\n * To make a \"red bouquet\", it needs 3 red flower... | [{"type": "stdin_stdout", "input": "1000000000 1000000000 1000000000\n", "output": "1000000000\n"}, {"type": "stdin_stdout", "input": "1000000000 1100000000 1000000000\n", "output": "1033333333\n"}, {"type": "stdin_stdout", "input": "1137468270 1106087921 972974334\n", "output": "1072176841\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya is learning to play chess. He has already learned how to move a king, a rook and a bishop. Let us remind you the rules of moving chess pieces. A chessboard is 64 square fields organized into an 8 Γ 8 table. A... | [{"type": "stdin_stdout", "input": "1 1 6 2\n", "output": "2 2 5\n"}, {"type": "stdin_stdout", "input": "8 1 1 7\n", "output": "2 0 7\n"}, {"type": "stdin_stdout", "input": "1 2 1 6\n", "output": "1 2 4\n"}, {"type": "stdin_stdout", "input": "1 5 1 7\n", "output": "1 2 2\n"}, {"type": "stdin_stdout", "input": "3 2 6 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem consists of three subproblems: for solving subproblem F1 you will receive 8 points, for solving subproblem F2 you will receive 15 points, and for solving subproblem F3 you will receive 10 points.\n\nManao has... | [{"type": "stdin_stdout", "input": "10 4\n2\n7\n1\n9\n8\n10\n5\n10\n1\n20\n", "output": "38\n"}, {"type": "stdin_stdout", "input": "10 4\n1\n7\n1\n9\n8\n10\n5\n10\n1\n20\n", "output": "39\n"}, {"type": "stdin_stdout", "input": "10 5\n2\n13\n3\n9\n8\n7\n9\n7\n1\n18\n", "output": "36\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera loves his garden, where n fruit trees grow.\n\nThis year he will enjoy a great harvest! On the i-th tree bi fruit grow, they will ripen on a day number ai. Unfortunately, the fruit on the tree get withered, so they... | [{"type": "stdin_stdout", "input": "24 1524\n16 934\n23 1940\n21 1447\n20 417\n24 1340\n22 1932\n13 775\n19 2918\n12 2355\n9 593\n11 2676\n3 1857\n16 868\n13 426\n18 1679\n22 991\n9 2728\n10 2497\n16 1221\n9 772\n23 2522\n24 982\n12 1431\n18 757\n", "output": "25893\n"}, {"type": "stdin_stdout", "input": "24 1524\n32 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlexandra has a paper strip with n numbers on it. Let's call them ai from left to right.\n\nNow Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy:\n\n * Each piece should... | [{"type": "stdin_stdout", "input": "2 1000000000 2\n-1000000000 1000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "2 1000000000 1\n-1000000000 1000000000\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "2 1000000000 4\n-1000000000 1000000000\n", "output": "-1"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFox Ciel starts to learn programming. The first task is drawing a fox! However, that turns out to be too hard for a beginner, so she decides to draw a snake instead.\n\nA snake is a pattern on a n by m table. Denote c-th ... | [{"type": "stdin_stdout", "input": "49 50\n", "output": "##################################################\n.................................................#\n##################################################\n#.................................................\n##################################################\n...... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. That's why Keione told his smart friend, SaDDas to punish him! SaDDas took Tavas' headphones a... | [{"type": "stdin_stdout", "input": "777777777\n", "output": "1022"}, {"type": "stdin_stdout", "input": "477477447\n", "output": "728"}, {"type": "stdin_stdout", "input": "777744747\n", "output": "996"}, {"type": "stdin_stdout", "input": "444444444\n", "output": "511"}, {"type": "stdin_stdout", "input": "7474747\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVolodya and Vlad play the following game. There are k pies at the cells of n Γ m board. Each turn Volodya moves one pie to the neighbouring (by side) cell. If the pie lies at the border of the board then Volodya can move ... | [{"type": "stdin_stdout", "input": "19 13 83\n5 2\n12 11\n5 6\n3 11\n17 8\n10 8\n3 10\n9 10\n16 3\n15 12\n14 2\n11 8\n18 6\n15 10\n11 12\n2 1\n15 3\n16 3\n1 7\n15 7\n2 9\n11 13\n18 9\n4 7\n13 4\n7 4\n3 1\n14 8\n4 5\n5 7\n8 3\n17 2\n18 2\n16 3\n10 12\n6 2\n3 6\n5 2\n10 3\n18 9\n14 3\n3 6\n6 5\n12 8\n7 12\n2 11\n6 6\n18 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSaitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an elevator in one of its other hotels. The elevator is special β it starts on the top floor, can only move down, ... | [{"type": "stdin_stdout", "input": "100 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTreeland is a country in which there are n towns connected by n - 1 two-way road such that it's possible to get from any town to any other town. \n\nIn Treeland there are 2k universities which are located in different tow... | [{"type": "stdin_stdout", "input": "35 15\n6 12 32 18 11 10 29 9 30 27 31 14 8 24 28 25 19 15 21 3 4 1 33 22 23 17 16 13 7 2\n1 2\n20 3\n1 4\n20 5\n20 6\n1 7\n13 8\n4 9\n1 10\n1 11\n1 12\n1 13\n18 14\n10 15\n1 16\n16 17\n1 18\n1 19\n1 20\n20 21\n1 22\n27 23\n25 24\n1 25\n20 26\n20 27\n18 28\n4 29\n13 30\n1 31\n1 32\n20... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova plays a computer game known as Mages and Monsters. Vova's character is a mage. Though as he has just started, his character knows no spells.\n\nVova's character can learn new spells during the game. Every spell is ch... | [{"type": "stdin_stdout", "input": "15 100\n1 8 8\n2 200 101\n2 10 99\n1 9 9\n2 10 99\n2 200 101\n1 14 4\n2 194 195\n2 194 194\n2 990 290\n1 2 999992\n2 6 256\n2 7 256\n2 2 999988\n2 2 252\n", "output": "NO\nNO\nYES\nNO\nNO\nYES\nNO\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "15 100\n1 8 8\n2 200 101\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice got tired of playing the tag game by the usual rules so she offered Bob a little modification to it. Now the game should be played on an undirected rooted tree of n vertices. Vertex 1 is the root of the tree.\n\nAli... | [{"type": "stdin_stdout", "input": "34 33\n2 1\n3 2\n4 3\n5 2\n6 3\n7 2\n8 1\n9 7\n10 12\n11 7\n12 7\n13 8\n14 2\n15 10\n16 1\n17 2\n18 14\n19 1\n20 2\n21 16\n22 21\n23 1\n24 6\n25 2\n26 20\n27 5\n28 20\n29 2\n30 10\n31 14\n32 12\n33 15\n34 8\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "34 33\n2 1\n3 2\n4 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDaenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains ai soldiers. She wants to bring her army to the other side of the sea to get the Iron Throne. She has recently bought an airplane ... | [{"type": "stdin_stdout", "input": "10000 100\n800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 800 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA new set of desks just arrived, and it's about time! Things were getting quite cramped in the office. You've been put in charge of creating a new seating chart for the engineers. The desks are numbered, and you sent out ... | [{"type": "stdin_stdout", "input": "50\n73 1\n65 73\n16 65\n57 65\n33 16\n34 57\n98 16\n84 98\n55 34\n64 84\n80 55\n75 64\n28 75\n20 75\n42 75\n88 42\n50 20\n48 28\n32 48\n58 88\n92 76\n76 53\n53 15\n15 1\n1 10\n10 71\n71 37\n37 95\n95 63\n63 92\n45 97\n97 51\n51 96\n96 12\n12 62\n62 31\n31 5\n5 29\n29 19\n19 49\n49 6\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Init... | [{"type": "stdin_stdout", "input": "2 40\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n", "output": "0\n1\n3\n7\n15\n31\n63\n127\n255\n511\n1023\n2047\n4095\n8191\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVivek was roaming around in the electronics shop, where he saw a box called as BlackBox. He was intrigued by its function, so he bought it. It's functionality states that for given integer input N β€ 1000 - it outputs th... | [{"type": "stdin_stdout", "input": "1000\n917\n816\n831\n979\n848\n744\n882\n615\n657\n977\n860\n951\n614\n971\n634\n838\n882\n625\n821\n918\n722\n712\n769\n761\n618\n649\n888\n629\n720\n932\n834\n895\n692\n692\n823\n711\n838\n983\n762\n962\n665\n715\n910\n863\n817\n672\n734\n958\n817\n856\n790\n932\n692\n722\n983\n618... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFoo was not amongst the most brilliant students of his class. So, he has some pending exams to clear. As the exams are approaching, this time he vowed to pass in all of them. This will only happen if he is not under stres... | [{"type": "stdin_stdout", "input": "2\n2 9 2 -1 19\n2 1 2 10 0010\n\nSAMPLE", "output": "1\n0\n"}, {"type": "stdin_stdout", "input": "2\n1 2 4 -1 16\n1 3 3 12 1010\n\nSAMPKE", "output": "1\n8\n"}, {"type": "stdin_stdout", "input": "2\n2 -1 1 1 16\n1 1 1 7 1000\n\nQAMSKE", "output": "2\n9\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMilly and Pranjul are playing a game in which Pranjul will give an index of a chocolate. Then, Milly has to tell him the box number in which that chocolate is in. There are N such boxes and Ci chocolates are there in i^th... | [{"type": "stdin_stdout", "input": "2\n2 3\n2\n2\n4\n\nSAMPLE", "output": "1\n2\n"}, {"type": "stdin_stdout", "input": "2\n2 3\n2\n3\n4\n\nSAMPLE", "output": "2\n2\n"}, {"type": "stdin_stdout", "input": "2\n2 3\n2\n2\n1\n\nSAMPLE", "output": "1\n1\n"}, {"type": "stdin_stdout", "input": "2\n3 3\n2\n2\n4\n\nSAMPLE", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRahul has set upon the quest for a new logo of his company. He has created the following continuous logo: \n\n /\\\n / \\\n / /\\ \\\n / / \\ \\\n/ / /\\ \\ \\\n \\ \\ \\/ / /\n \\ \\ / /\n \\ \\/ /\n ... | [{"type": "stdin_stdout", "input": "100\n10\n10\n10\n9\n10\n8\n10\n9\n10\n10\n8\n10\n10\n10\n10\n10\n10\n9\n10\n10\n8\n10\n10\n9\n7\n10\n10\n10\n10\n10\n9\n10\n10\n10\n9\n9\n10\n10\n9\n10\n10\n10\n10\n10\n7\n10\n10\n10\n9\n10\n10\n10\n10\n10\n10\n10\n10\n10\n9\n10\n10\n10\n10\n10\n10\n9\n10\n10\n8\n10\n10\n9\n10\n9\n10... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a_0, a_1, ..., a_{N-1} of length N. Process Q queries of the following types.\n\n* `0 l r b c`: For each i = l, l+1, \\dots, {r - 1}, set a_i \\gets b \\times a_i + c.\n* `1 l r`: Print \\sum_{i = l... | [{"type": "stdin_stdout", "input": "8 12\n1 2 3 3 5\n0 1 5\n0 2 4 100 101\n1 0 3\n0 1 5 102 103\n1 2 5\n0 1 4 65 105\n1 0 2", "output": "404\n82623\n20061\n20061\n20061\n20061\n20061\n20061\n20061\n"}, {"type": "stdin_stdout", "input": "5 9\n1 2 5 4 5\n1 0 5\n0 2 4 100 101\n1 0 3\n0 1 5 102 103\n1 2 5\n0 2 5 41 105\n1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print `unsafe`; otherwise, print `safe`.\n\nC... | [{"type": "stdin_stdout", "input": "-1 -1", "output": "unsafe\n"}, {"type": "stdin_stdout", "input": "-2 -2", "output": "unsafe\n"}, {"type": "stdin_stdout", "input": "000 0", "output": "unsafe\n"}, {"type": "stdin_stdout", "input": "000 1", "output": "unsafe\n"}, {"type": "stdin_stdout", "input": "001 1", "output": "u... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a sequence of N integers: x=(x_0,x_1,\\cdots,x_{N-1}). Initially, x_i=0 for each i (0 \\leq i \\leq N-1).\n\nSnuke will perform the following operation exactly M times:\n\n* Choose two distinct indices i, j (0 \\l... | [{"type": "stdin_stdout", "input": "100001 50000", "output": "546347865\n"}, {"type": "stdin_stdout", "input": "100001 27098", "output": "949668337\n"}, {"type": "stdin_stdout", "input": "101000 27098", "output": "277745716\n"}, {"type": "stdin_stdout", "input": "101000 14296", "output": "338861381\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou planned a trip using trains and buses. The train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket. Similarly, the bus fare will be C yen if... | [{"type": "stdin_stdout", "input": "549\n838\n715\n603", "output": "1152\n"}, {"type": "stdin_stdout", "input": "549\n817\n715\n603", "output": "1152"}, {"type": "stdin_stdout", "input": "555\n312\n400\n200", "output": "512\n"}, {"type": "stdin_stdout", "input": "600\n548\n220\n420", "output": "768\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSquare1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value:\n\n* Operation A: The displayed value is doubled.\n* Operation B: The displaye... | [{"type": "stdin_stdout", "input": "10\n-32", "output": "-16128\n"}, {"type": "stdin_stdout", "input": "10\n-23", "output": "-11520\n"}, {"type": "stdin_stdout", "input": "10\n-37", "output": "-18688\n"}, {"type": "stdin_stdout", "input": "10\n-42", "output": "-21248\n"}, {"type": "stdin_stdout", "input": "10\n-33", "o... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three integers A, B and C. Determine whether C is not less than A and not greater than B.\n\nConstraints\n\n* -100β€A,B,Cβ€100\n* A, B and C are all integers.\n\nInput\n\nInput is given from Standard Input in ... | [{"type": "stdin_stdout", "input": "-1 2 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-3 0 -3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-5 0 -3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-4 2 -3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 4 -1", "output": "Yes... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke received a triangle as a birthday present. The coordinates of the three vertices were (x_1, y_1), (x_2, y_2), and (x_3, y_3).\n\nHe wants to draw two circles with the same radius inside the triangle such that the tw... | [{"type": "stdin_stdout", "input": "-1 -1\n1 1\n2 0", "output": "0.402627528107\n"}, {"type": "stdin_stdout", "input": "3 -1\n2 5\n1 16", "output": "0.143556168892\n"}, {"type": "stdin_stdout", "input": "-3 1\n1 1\n2 -1", "output": "0.548232156368\n"}, {"type": "stdin_stdout", "input": "6 -2\n2 5\n1 18", "output": "0.9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have a large square grid with H rows and W columns. Iroha is now standing in the top-left cell. She will repeat going right or down to the adjacent cell, until she reaches the bottom-right cell.\n\nHowever, she cannot ... | [{"type": "stdin_stdout", "input": "100000 100000 99999 72298", "output": "471980925\n"}, {"type": "stdin_stdout", "input": "100000 100000 43938 55555", "output": "265769345\n"}, {"type": "stdin_stdout", "input": "100000 100000 99999 39553", "output": "199584029\n"}, {"type": "stdin_stdout", "input": "100000 100000 439... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDo the following for a four-digit number N consisting of numbers 0-9.\n\n1. Let L be the number obtained as a result of arranging the numerical values ββof each of the N digits in descending order.\n2. Let S be the number... | [{"type": "stdin_stdout", "input": "6174\n3985\n3333\n0000", "output": "0\n3\nNA\n"}, {"type": "stdin_stdout", "input": "6174\n1779\n3333\n0000", "output": "0\n6\nNA\n"}, {"type": "stdin_stdout", "input": "6174\n1794\n3333\n0000", "output": "0\n5\nNA\n"}, {"type": "stdin_stdout", "input": "6174\n1542\n3333\n0000", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBrave Ponta and his best friend, Brave Gonta, have come to Luida's bar in search of friends to embark on an epic adventure. There are many warriors, monks and wizards in the tavern who are itching to go on an adventure.\n... | [{"type": "stdin_stdout", "input": "5\n1 4 3 2 20\n19\n1 3 4 10\n0", "output": "10\n2\n"}, {"type": "stdin_stdout", "input": "5\n1 4 3 2 20\n19\n2 3 4 10\n0", "output": "10\n1\n"}, {"type": "stdin_stdout", "input": "5\n2 0 3 4 20\n29\n1 3 4 10\n0", "output": "11\n2\n"}, {"type": "stdin_stdout", "input": "5\n2 0 3 4 20\... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.