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\nIahub is very proud of his recent discovery, propagating trees. Right now, he invented a new tree, called xor-tree. After this new revolutionary discovery, he invented a game for kids which uses xor-trees.\n\nThe game is ... | [{"type": "stdin_stdout", "input": "30\n2 1\n3 2\n4 3\n5 3\n6 5\n7 3\n8 3\n9 2\n10 3\n11 2\n12 11\n13 6\n14 4\n15 5\n16 11\n17 9\n18 14\n19 6\n20 2\n21 19\n22 9\n23 15\n24 20\n25 14\n26 22\n27 1\n28 6\n29 13\n30 27\n0 0 1 1 1 1 0 1 0 0 1 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 1 1 1 0\n0 1 0 1 1 1 0 0 1 1 0 1 1 1 0 1 1 1 1 0 1 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are m roads connecting the cities. One can go from city ui to vi (and vise versa) using t... | [{"type": "stdin_stdout", "input": "3 3 6\n1 2 499999999\n2 3 500000000\n1 3 948187054\n2 499999999\n2 500000000\n2 499999999\n3 999999999\n3 1000000000\n3 1000000000\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3 3 6\n1 2 499999999\n2 3 500000000\n1 2 999999999\n2 499999999\n2 500000000\n2 499999999\n3 999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne way to create task is to learn from game. You should pick a game and focus on part of the mechanic of that game, then it might be a good task.\n\nLet's have a try. Puzzle and Dragon was a popular game in Japan, we foc... | [{"type": "stdin_stdout", "input": "25 3\n1 2 3\n4 5 6\n7 8 9\n10 11 12\n13 14 15\n16 17 18\n19 20 21\n22 23 24\n25 26 27\n28 29 30\n31 32 33\n34 35 36\n37 38 39\n40 41 42\n43 44 45\n46 47 48\n49 50 51\n52 53 54\n55 56 57\n58 59 60\n61 62 63\n64 65 66\n67 68 69\n70 71 72\n73 74 75\n75 74 73\n72 71 70\n69 68 67\n66 65 6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences, so he invented a new method for determining the similarity of cyclic sequences.\n\nLet's assume that strings s ... | [{"type": "stdin_stdout", "input": "318\nTATCAATCGGTACGTGCGCATCATTGTCAATCGGGCTTCATGGCTTGCGGGCGCTACCCGAGGGGAAGCTGCGGACAGGTAGGTAAGATACACACGAACCAAACGGAGTTATGTTGGATAAATTGGCTGGAAGGGCGTAGGTATATCGAGTCGCGGACCTGGCATAGACTATCAGGGGCAGCGGTACAAGGCAACCGTGAGCGGGGTCTGCCCACCATTAGACCGATGCGCCGGCTCGTATATGTGATTCTGGTGAAAAGTATCATGCCGGGACGCGTA... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDo you know a story about the three musketeers? Anyway, you will learn about its origins now.\n\nRichelimakieu is a cardinal in the city of Bearis. He is tired of dealing with crime by himself. He needs three brave warrio... | [{"type": "stdin_stdout", "input": "987 50\n221 959\n221 553\n959 695\n553 959\n819 437\n371 295\n695 553\n959 347\n595 699\n652 628\n553 347\n868 589\n695 221\n282 714\n351 703\n104 665\n755 436\n556 511\n695 347\n221 347\n243 874\n695 847\n863 501\n583 145\n786 221\n38 286\n72 397\n808 658\n724 437\n911 548\n405 759\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEdo has got a collection of n refrigerator magnets!\n\nHe decided to buy a refrigerator and hang the magnets on the door. The shop can make the refrigerator with any size of the door that meets the following restrictions:... | [{"type": "stdin_stdout", "input": "20 5\n1 12 21 22\n9 10 15 20\n10 12 12 20\n1 1 25 29\n5 10 21 22\n4 9 20 25\n12 10 14 24\n3 3 19 27\n3 4 23 28\n9 1 11 31\n9 14 17 18\n8 12 14 20\n8 11 18 19\n12 3 14 29\n7 8 13 22\n6 4 16 30\n11 3 13 27\n9 16 15 18\n6 13 14 21\n9 12 15 22\n", "output": "4\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring a New Year special offer the \"Sudislavl Bars\" offered n promo codes. Each promo code consists of exactly six digits and gives right to one free cocktail at the bar \"Mosquito Shelter\". Of course, all the promoco... | [{"type": "stdin_stdout", "input": "58\n145410\n686144\n766870\n859775\n922809\n470967\n034349\n318920\n019664\n667953\n295078\n908733\n691385\n774622\n325695\n443254\n817406\n984471\n512092\n635832\n303546\n189826\n128551\n720334\n569318\n377719\n281502\n956352\n758447\n207280\n583935\n246631\n160045\n452683\n594100\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nzscoder loves simple strings! A string t is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple whereas aa, add are not simple.\n\nzscoder is given a string s. He wants... | [{"type": "stdin_stdout", "input": "rxxxrrxrxxxxxrrrrrxxxxrrrrxrxxrxxrxrxrrrxrrxrrxrxxxrxrrxrrxrxrxxxxxrxxxxrrrxrxxrxxrxxxrrrrrxrrxrrxrr\n", "output": "rxaxraxrxaxaxrararxaxararaxrxarxarxrxrarxraxraxrxaxrxraxraxrxrxaxaxrxaxararxrxarxarxaxrararxraxraxra\n"}, {"type": "stdin_stdout", "input": "xxxxrrxrxxxxxrrrrrxxxxrrrrx... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it consists of n towns numbered from 1 to n. \n\nThere are n directed roads in the Udayland. i-th of them goes from town i to ... | [{"type": "stdin_stdout", "input": "84\n2 50 67 79 71 45 43 40 57 20 25 8 60 47 52 10 37 23 1 28 22 26 3 42 11 63 61 68 49 32 55 18 5 24 31 70 66 27 38 41 54 12 65 51 15 34 30 35 77 74 21 62 33 16 81 14 19 48 80 73 69 78 39 6 76 46 75 72 84 29 58 59 13 17 82 9 83 4 36 56 53 7 64 44\n", "output": "428380105\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m.\n\nAbout every day we know exam for which one of m subjects can be passed on that day. Perh... | [{"type": "stdin_stdout", "input": "100 10\n1 1 6 6 6 2 5 7 6 5 3 7 10 10 8 9 7 6 9 2 6 7 8 6 7 5 2 5 10 1 10 1 8 10 2 9 7 1 6 8 3 10 9 4 4 8 8 6 6 1 5 5 6 5 6 6 6 9 4 7 5 4 6 6 1 1 2 1 8 10 6 2 1 7 2 1 8 10 9 2 7 3 1 5 10 2 8 10 10 10 8 9 5 4 6 10 8 9 6 6\n2 4 10 11 5 2 6 7 2 15\n", "output": "74\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her.\n\nSerge... | [{"type": "stdin_stdout", "input": "aaaaaaaadbaaabbbbbddaaabdadbbbbbdbbabbbabaabdbbdababbbddddbdaabbddbbbbabbbbbabadaadabaaaadbbabbbaddb\naaaaaaaaaaaaaa\n61 52 5 43 53 81 7 96 6 9 34 78 79 12 8 63 22 76 18 46 41 56 3 20 57 21 75 73 100 94 35 69 32 4 70 95 88 44 68 10 71 98 23 89 36 62 28 51 24 30 74 55 27 80 38 48 93 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the evening Polycarp decided to analyze his today's travel expenses on public transport.\n\nThe bus system in the capital of Berland is arranged in such a way that each bus runs along the route between two stops. Each ... | [{"type": "stdin_stdout", "input": "27 8 1 0 1\nBcd A\nA b\nb BcDc\ndc dbaC\ndbaC dcCB\nB d\nd BbAc\nCBC b\nDBDca d\ncAbb AA\nAA Ba\ncAccb DBDca\ncb DdaB\nAAcBc Ba\nBa dc\ndc DDCd\nbcBDA da\nbDE ADD\nAA b\nb cb\ncb CCBbd\nCCBbd bcDdb\nbcDdb ddc\nddc C\nC Adc\nAdc BbAc\nBbAc DD\n", "output": "111\n"}, {"type": "stdin_st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs Will is stuck in the Upside Down, he can still communicate with his mom, Joyce, through the Christmas lights (he can turn them on and off with his mind). He can't directly tell his mom where he is, because the monster ... | [{"type": "stdin_stdout", "input": ")?(??((???????()?(?????????)??(????????((?)?????)????)??????(?????)?)?????)??????(??()??????)????????)?)()??????????????())????????(???)??)????????????????????(?????)??)???)??(???????????????)???)??)?\n", "output": "8314\n"}, {"type": "stdin_stdout", "input": "???????????????????????... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThroughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achievements. However, one does no... | [{"type": "stdin_stdout", "input": "446237720 920085248 296916273 439113596\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "491259590 529594367 305425951 326414536\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "733405771 1387069059 19971607 389270995\n", "output": "1\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l < w. Frogs can also jump on lengths shorter than l. but can't jump longer. Hopefully, there are some stones in ... | [{"type": "stdin_stdout", "input": "100 34\n16 0 10 11 12 13 0 5 4 14 6 15 4 9 1 20 19 14 1 7 14 11 10 20 6 9 12 8 3 19 20 4 17 17 8 11 14 18 5 20 17 0 3 18 14 12 11 12 5 5 11 7 9 17 4 8 4 10 0 0 12 9 15 3 15 14 19 12 6 8 17 19 4 18 19 3 8 3 9 1 6 15 4 16 1 18 13 16 3 5 20 11 10 9 9 17 20 15 12\n", "output": "312\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNastya received one more array on her birthday, this array can be used to play a traditional Byteland game on it. However, to play the game the players should first select such a subsegment of the array that <image>, wher... | [{"type": "stdin_stdout", "input": "94 58\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 29 58 1 1 1 29 58 58 1 1 29 1 1 1 1 2 1 58 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 29 1 1 1 1 1 58 1 29 1 1 1 1 1 1 1 1 1 1 1 1 58 1 1 1 1 1 2 1 1 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "90 45\n15 1 1 1 1 3 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeveral drivers had lined up for the Drag Racing Competition at the Tokyo Drift Street. Dom had organized the competition, but he was not available during all the races and hence he did not know their results. In the drag... | [{"type": "stdin_stdout", "input": "12\nlzcosnwtjk xcjunvtpwu\ncvjkwwlkyj jyjzvkopkt\nhqxxxvxvsm oaettnnxsn\nyltleijpii taddtwjkhq\nowyayplryk gamjhfquwe\nsfwqtseczr clpbsurgox\nnngbinrstc beuwpgazlm\ndmdbzrvooe sodttxayqp\ntkjafxrpth yugxdvihim\nsfavfdbiec fimvhmtjte\nktpgrbmmqb pqstnzulvo\ntacldiqwmo qywspwioip\niulf... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEveryone who is involved with HackerEarth in what so ever form knows who Little Kuldeep is. He's not so little, but he's called that. (No one knows why!) He's pretty efficient at organizing, mentoring, managing various hi... | [{"type": "stdin_stdout", "input": "3\n09:00-09:50\n13:00-17:00\n09:50-10:30", "output": "Who needs a moderator?\n"}, {"type": "stdin_stdout", "input": "3\n09:00-09:50\n13:00-17:00\n09:50-10:30", "output": "Who needs a moderator?\n"}, {"type": "stdin_stdout", "input": "3\n09:00-09:50\n13:10-17:00\n09:50-10:30", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBetty had invited her friends over for breakfast. Being great at tongue twisters, Betty decides to have some fun with the others by making them repeat one of her tongue twisters while she made the sandwich.\n\nBetty bough... | [{"type": "stdin_stdout", "input": "1000\n422793 206235\n357333 104220\n332537 5\n245560 9\n225105 2\n780480 0\n159417 8\n1266910 507138\n218238 566718\n491224 1\n182141 639551\n401529 9\n117359 590197\n389053 8\n795228 5\n406415 9\n104353 465450\n203260 4\n152821 918970\n250128 493407\n188162 4\n202515 5\n64241 7\n637... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFatal Eagle has decided to do something to save his favorite city against the attack of Mr. XYZ, since no one else surprisingly seems bothered about it, and are just suffering through various attacks by various different ... | [{"type": "stdin_stdout", "input": "10\n113 6\n169 1\n177 4\n163 1\n143 2\n121 3\n199 5\n156 29\n54 15\n133 1", "output": "624845\n250438925115\n1679833535\n142798995930\n1950689437\n40203969\n2767148467\n1152\n26\n7346629512\n"}, {"type": "stdin_stdout", "input": "10\n113 6\n169 1\n177 4\n163 1\n143 2\n121 5\n199 5\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a string S consisting of lowercase English letters.\n\nStarting with this string, he will produce a new one in the procedure given as follows.\n\nThe procedure consists of Q operations. In Operation i (1 \\l... | [{"type": "stdin_stdout", "input": "a\n6\n2 2 a\n2 1 b\n1\n2 2 d\n1\n1", "output": "aabd\n"}, {"type": "stdin_stdout", "input": "a\n6\n2 2 b\n2 1 b\n1\n2 2 d\n1\n1", "output": "babd\n"}, {"type": "stdin_stdout", "input": "a\n6\n2 2 a\n2 1 b\n1\n2 1 c\n1\n1", "output": "caab\n"}, {"type": "stdin_stdout", "input": "a\n6\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree with N vertices 1,2,\\ldots,N, and positive integers c_1,c_2,\\ldots,c_N. The i-th edge in the tree (1 \\leq i \\leq N-1) connects Vertex a_i and Vertex b_i.\n\nWe will write a positive integer on eac... | [{"type": "stdin_stdout", "input": "5\n1 2\n1 3\n1 4\n1 5\n3141 59 39 53 59", "output": "210\n3141 59 59 53 39\n"}, {"type": "stdin_stdout", "input": "5\n1 2\n1 3\n1 4\n1 5\n3141 44 39 53 59", "output": "195\n3141 59 53 44 39\n"}, {"type": "stdin_stdout", "input": "5\n1 2\n1 3\n1 4\n1 5\n3141 59 26 53 59", "output": "1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a grid with H horizontal rows and W vertical columns. Let (i, j) denote the square at the i-th row from the top and the j-th column from the left.\n\nFor each i and j (1 \\leq i \\leq H, 1 \\leq j \\leq W), Squar... | [{"type": "stdin_stdout", "input": "20 20\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n....................\n................ | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke has an integer sequence A of length N.\n\nHe will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen.\n\nLet P,Q,R,S be the... | [{"type": "stdin_stdout", "input": "10\n10 102 113 60 6 47 23 25 52 118", "output": "58\n"}, {"type": "stdin_stdout", "input": "10\n10 102 113 60 6 90 16 25 52 118", "output": "61\n"}, {"type": "stdin_stdout", "input": "10\n10 102 113 72 6 90 16 25 52 118", "output": "73\n"}, {"type": "stdin_stdout", "input": "10\n10 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in `yyyy/mm/dd` format. For example, January 23, 2018 should be written as `2018/01/23`.\n\nAfter fini... | [{"type": "stdin_stdout", "input": "2017/01/06", "output": "2018/01/06\n"}, {"type": "stdin_stdout", "input": "2017/01/32", "output": "2018/01/32\n"}, {"type": "stdin_stdout", "input": "2017/01//7", "output": "2018/01//7\n"}, {"type": "stdin_stdout", "input": "2010/01/77", "output": "2018/01/77\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a three-digit positive integer N.\nDetermine whether N is a palindromic number.\nHere, a palindromic number is an integer that reads the same backward as forward in decimal notation.\n\nConstraints\n\n* 100≤... | [{"type": "stdin_stdout", "input": "676", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "1293", "output": "No\n"}, {"type": "stdin_stdout", "input": "1865", "output": "No\n"}, {"type": "stdin_stdout", "input": "3151", "output": "No\n"}, {"type": "stdin_stdout", "input": "808", "output": "Yes\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe will call a non-negative integer increasing if, for any two adjacent digits in its decimal representation, the digit to the right is greater than or equal to the digit to the left. For example, 1558, 11, 3 and 0 are al... | [{"type": "stdin_stdout", "input": "3704579452095997258280591217784156184311155893966777597430447796450532", "output": "32\n"}, {"type": "stdin_stdout", "input": "4271374355872521214646189206931447259915557225329718337053006899386612", "output": "33\n"}, {"type": "stdin_stdout", "input": "463636595558318557723662913943... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis contest is `CODEFESTIVAL`, which can be shortened to the string `CF` by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain `CF` from other strings in the same way.\n\nYou are g... | [{"type": "stdin_stdout", "input": "CODDFESTIVAL", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "EDOCLAVFTSEI", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "ECOFLAVDTSEI", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "DOECSDKSIVAF", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "DOEC... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that reads the attendance numbers of students in a class and the data that stores the ABO blood group and outputs the number of people for each blood type. There are four types of ABO blood types: A, B, A... | [{"type": "stdin_stdout", "input": "1,B\n2,A\n3,B\n4,AB\n5,B\n5,O\n7,A\n8,O\n9,AB\n10,A\n11,A\n12,B\n13,AB\n14,A", "output": "5\n4\n3\n2\n"}, {"type": "stdin_stdout", "input": "1,B\n2,B\n3,B\n4,AB\n5,B\n6,O\n7,A\n8,O\n9,AB\n10,A\n11,A\n12,B\n13,AB\n14,A", "output": "4\n5\n3\n2\n"}, {"type": "stdin_stdout", "input": "1,... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. A of the Aizu Institute of Biological Research discovered a mysterious insect on a certain southern island. The shape is elongated like a hornworm, but since one segment is shaped like a ball, it looks like a beaded b... | [{"type": "stdin_stdout", "input": "rbgrg\nbbbrbgr\nrbg\nrgbbrgrb\nrrgbgrggb\nggrgbrbggr\nrrrrr\nbgbr\n0", "output": "5\n7\n1\n6\nNA\n11\n0\n4\n"}, {"type": "stdin_stdout", "input": "grgbr\nrbbgbbr\nbgr\nbgbrrgbr\nbggrgbgrr\ngggbrggrbr\nrrrrr\nbgbr\n0", "output": "5\n7\n1\n9\nNA\n11\n0\n4\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAt the pancake shop you work for, pancake dough is lined up in a row on an elongated iron plate and baked. Pancakes can be completed by turning them over with a spatula several times. How many times you turn it over to co... | [{"type": "stdin_stdout", "input": "3\n5 4423 -1", "output": "8846\n"}, {"type": "stdin_stdout", "input": "3\n4 1618 1", "output": "3236\n"}, {"type": "stdin_stdout", "input": "3\n4 2801 1", "output": "5602\n"}, {"type": "stdin_stdout", "input": "3\n5 4573 2", "output": "9146\n"}, {"type": "stdin_stdout", "input": "3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIllumination\n\nIlluminations are displayed in the corridors every year at the JOI High School Cultural Festival. The illuminations consist of N light bulbs, which are lined up in a row from the west side to the east side... | [{"type": "stdin_stdout", "input": "10\n0 4 2 -1 18 -6 -1 -1 4 5", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n0 4 2 -2 18 -6 -1 -1 4 5", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n0 4 2 -2 18 -2 -1 -1 4 5", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n0 4 2 -2 18 -2 -1 -1 5 5"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the good old days, the Internet was free from fears and terrorism. People did not have to worry about any cyber criminals or mad computer scientists. Today, however, you are facing atrocious crackers wherever you are, ... | [{"type": "stdin_stdout", "input": "2 5\npermit 192168?? ?12??34?\ndeny 19216899 012243?5\n19216711 11233340 HiIamACracker\n19216891 01234345 Hello\n19216899 01234345 HiIamAlsoACracker\n19216809 11200340 World\n00000000 99999999 TheEndOfTheWorld\n1 2\npermit 12345678 23456789\n19216891 01234345 Hello\n12345678 23456789... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the year 2xxx, an expedition team landing on a planet found strange objects made by an ancient species living on that planet. They are transparent boxes containing opaque solid spheres (Figure 1). There are also many l... | [{"type": "stdin_stdout", "input": "3\n95 20 180 18\n125 20 185 18\n40 26 195 10\n1\n6 5 5 4\n2\n5 5 5 4\n5 10 5 2\n2\n5 5 11 6\n0 7 5 3\n16\n2338 3465 29034 1351\n1571 14389 25019 842\n1706 8015 21355 1155\n1899 4359 33815 888\n2160 10364 20511 2353\n333 8835 6587 63\n2598 3176 23679 618\n1613 14217 8003 1505\n3140 47... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem J String Puzzle\n\nAmazing Coding Magazine is popular among young programmers for its puzzle solving contests offering catchy digital gadgets as the prizes. The magazine for programmers naturally encourages the re... | [{"type": "stdin_stdout", "input": "9 4 1 4\n6 C\n3 I\n13 C\n9 P\n2 1\n4 1\n6 2\n11 -1\n8 4\n8\n1\n3\n0", "output": "PPPP\n"}, {"type": "stdin_stdout", "input": "9 4 1 4\n6 C\n3 I\n13 C\n9 P\n2 1\n4 1\n6 2\n11 -1\n9 4\n8\n1\n3\n0", "output": "PPPP\n"}, {"type": "stdin_stdout", "input": "9 4 1 4\n6 D\n3 I\n13 C\n9 P\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInternational Christmas Present Company (ICPC) is a company to employ Santa and deliver presents on Christmas. Many parents request ICPC to deliver presents to their children at specified time of December 24. Although sam... | [{"type": "stdin_stdout", "input": "3 2 3\n0 1 10\n1 2 15\n0 -1\n1 8\n2 -1\n3 2 4\n0 1 10\n1 2 10\n0 0\n1 19\n2 20\n0 25\n13 10 10\n0 1 39\n2 3 48\n3 5 20\n4 8 25\n3 9 10\n8 9 40\n3 4 5\n5 0 17\n0 7 93\n1 3 13\n0 0\n1 100000000\n2 100\n3 543\n4 500\n5 400\n6 300\n6 200\n8 100\n9 100\n0 0 0", "output": "3\n3\n4\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNow I have a card with n numbers on it. Consider arranging some or all of these appropriately to make numbers. Find the number obtained by adding all the numbers created at this time.\n\nFor example, if you have 1 and 2, ... | [{"type": "stdin_stdout", "input": "4\n2\n8\n6\n10", "output": "1177916\n"}, {"type": "stdin_stdout", "input": "4\n4\n8\n6\n10", "output": "1315948\n"}, {"type": "stdin_stdout", "input": "4\n1\n5\n7\n17", "output": "1022430\n"}, {"type": "stdin_stdout", "input": "4\n4\n8\n3\n10", "output": "1108900\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\nJAG Kingdom is a strange kingdom such that its $N$ cities are connected only by one-way roads. The $N$ cities are numbered $1$ through $N$. ICPC (International Characteristic Product Corporation) tran... | [{"type": "stdin_stdout", "input": "4 4 1 4\n1 2\n3 1\n4 2\n3 4\n12 8 1 7\n1 2\n1 3\n2 4\n5 4\n1 5\n4 6\n5 7\n7 6\n6 4 5 2\n1 2\n1 3\n4 5\n5 6\n10 21 9 10\n9 1\n9 2\n9 2\n9 4\n10 1\n10 2\n10 3\n10 4\n1 2\n2 5\n2 6\n3 6\n3 10\n4 4\n4 8\n1 8\n5 10\n6 10\n7 10\n10 8\n10 5\n2 15 1 2\n2 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.\n\nThe Koch curve is well known as a kind of fractals.\n\nYou can draw a Koch curve in the following algorithm:\n\n* Di... | [{"type": "stdin_stdout", "input": "5", "output": "0 0\n0.411522633745 0.0\n0.617283950617 0.356389055055\n0.82304526749 0.0\n1.23456790123 0.0\n1.44032921811 0.356389055055\n1.23456790123 0.712778110111\n1.64609053498 0.712778110111\n1.85185185185 1.06916716517\n2.05761316872 0.712778110111\n2.46913580247 0.7127781101... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Conway's Game of Life, cells in a grid are used to simulate biological cells.\nEach cell is considered to be either alive or dead.\nAt each step of the simulation\neach cell's current status and number of living neighb... | [{"type": "stdin_stdout", "input": "4\n00000101\n000\n010101\n11100", "output": "11011000\nMultiple solutions\nMultiple solutions\n01000\n"}, {"type": "stdin_stdout", "input": "4\n00000101\n000\n011011\n10010", "output": "11011000\nMultiple solutions\nMultiple solutions\n01100\n"}, {"type": "stdin_stdout", "input": "4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAstronaut Natasha arrived on Mars. She knows that the Martians are very poor aliens. To ensure a better life for the Mars citizens, their emperor decided to take tax from every tourist who visited the planet. Natasha is t... | [{"type": "stdin_stdout", "input": "2 420\n412 363\n", "output": "420\n0 1 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 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.\n\... | [{"type": "stdin_stdout", "input": "10\n4 7 480392999\n3 4 32525297\n9 7 417904789\n6 2 836294777\n5 3 616099185\n1 7 1310915575\n8 10 838073755\n5 10 547050646\n2 1 12607780\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n4 7 480392999\n3 4 32525297\n9 7 417904789\n6 2 836294777\n5 3 616099185\n1 7 131091... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe circle line of the Roflanpolis subway has n stations.\n\nThere are two parallel routes in the subway. The first one visits stations in order 1 → 2 → … → n → 1 → 2 → … (so the next stop after station x is equal to (x+1... | [{"type": "stdin_stdout", "input": "100 26 63 60 20\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 26 77 60 20\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 45 77 77 20\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100 45 90 77 20\n", "output": "YES\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has an array a_1, a_2, ..., a_n.\n\nYou don't know this array, but he told you m facts about this array. The i-th fact is a triple of numbers t_i, l_i and r_i (0 ≤ t_i ≤ 1, 1 ≤ l_i < r_i ≤ n) and it means:\n\n * if... | [{"type": "stdin_stdout", "input": "1001 2\n1 999 1000\n0 230 581\n", "output": "YES\n1001 1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n numbers a_1, a_2, ..., a_n. With a cost of one coin you can perform the following operation:\n\nChoose one of these numbers and add or subtract 1 from it.\n\nIn particular, we can apply this operation to t... | [{"type": "stdin_stdout", "input": "22\n99039804 -580368436 -694542422 231508622 -490965348 958087037 -570157955 560902976 -840005981 -1381720926 -708462966 639575552 119982241 -631099451 -154223559 102960509 -225552439 507250810 -712228569 989896753 1574991855 1\n", "output": "12773524192\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is constraints.\n\nThere are n kids, each of them is reading a unique book. At the end of any day, the i-th kid will give his book to the p_i-th kid (in case of i = p_i t... | [{"type": "stdin_stdout", "input": "20\n10\n3 8 1 4 9 6 10 2 7 5\n10\n10 4 8 6 5 3 1 2 9 7\n1\n1\n2\n2 1\n10\n2 5 3 6 9 7 4 10 8 1\n10\n1 7 4 6 9 10 8 2 3 5\n8\n3 8 1 7 6 4 2 5\n8\n7 4 5 2 8 1 6 3\n5\n1 2 4 3 5\n6\n4 2 5 6 3 1\n5\n5 3 2 4 1\n5\n4 3 5 1 2\n7\n6 5 1 7 4 2 3\n6\n6 2 4 1 5 3\n3\n3 1 2\n4\n1 3 4 2\n3\n3 1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day in the IT lesson Anna and Maria learned about the lexicographic order.\n\nString x is lexicographically less than string y, if either x is a prefix of y (and x ≠ y), or there exists such i (1 ≤ i ≤ min(|x|, |y|)),... | [{"type": "stdin_stdout", "input": "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWord s of length n is called k-complete if \n\n * s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 ≤ i ≤ n; \n * s has a period of k, i.e. s_i=s_{k+i} for all 1 ≤ i ≤ n-k. \n\n\n\nFor example, \"abaaba\" is a 3-complete ... | [{"type": "stdin_stdout", "input": "4\n6 2\nabaaba\n6 3\nabaaba\n36 9\nhippopotomonstrosesquippedaliophobia\n21 7\nwudixiaoxingxingheclp\n", "output": "2\n0\n23\n16\n"}, {"type": "stdin_stdout", "input": "4\n6 2\nabaaba\n6 3\nabaaba\n36 9\nhippopotononstrosesquippedaliophobia\n21 7\nwudixiaoxingxingheclp\n", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor some binary string s (i.e. each character s_i is either '0' or '1'), all pairs of consecutive (adjacent) characters were written. In other words, all substrings of length 2 were written. For each pair (substring of le... | [{"type": "stdin_stdout", "input": "7\n2 6 0\n1 1 1\n3 17 2\n0 1 0\n3 1 1\n0 0 3\n3 1 1\n", "output": "000101010\n0011\n00001110101010101010101\n01\n000011\n1111\n000011\n"}, {"type": "stdin_stdout", "input": "7\n1 3 5\n1 1 1\n3 15 3\n0 1 0\n3 1 1\n0 0 3\n2 1 1\n", "output": "0011111101\n0011\n0000111101010101010101\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDanny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!\n\nYou are given n nonnegative integers a_1, a_2, ..., a_n arranged in a circle, where n must be od... | [{"type": "stdin_stdout", "input": "41\n67695023 47580738 52676259 26530025 83455112 2392302 23011073 86422683 148437329 42852564 97383338 95729385 6219705 42027049 79082264 1205076 1191075 18025596 75651485 93690196 63851880 23817841 79285846 9296266 60979868 62770176 40911517 96687661 35967137 55930828 78662969 51939... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nn fishermen have just returned from a fishing vacation. The i-th fisherman has caught a fish of weight a_i.\n\nFishermen are going to show off the fish they caught to each other. To do so, they firstly choose an order in ... | [{"type": "stdin_stdout", "input": "10\n319645572 758298525 812547177 459359946 355467212 304450522 807957797 916787906 239781206 242840396\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n319645572 758298525 812547177 513929825 355467212 304450522 807957797 916787906 239781206 242840396\n", "output": "0\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp was given an array of a[1 ... n] of n integers. He can perform the following operation with the array a no more than n times:\n\n * Polycarp selects the index i and adds the value a_i to one of his choice of its... | [{"type": "stdin_stdout", "input": "50\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan wants to have a good dinner. A good dinner should consist of a first course, a second course, a drink, and a dessert.\n\nThere are n_1 different types of first courses Ivan can buy (the i-th of them costs a_i coins),... | [{"type": "stdin_stdout", "input": "5 5 5 5\n836 776 809 618 397\n121 629 373 169 333\n589 439 410 388 446\n936 472 433 647 791\n25\n1 2\n4 5\n5 4\n4 1\n3 5\n5 2\n2 4\n3 4\n3 3\n3 2\n4 4\n4 3\n1 1\n1 4\n5 1\n2 3\n1 5\n5 5\n2 5\n3 1\n2 1\n2 2\n1 3\n5 3\n4 2\n25\n1 1\n5 4\n4 1\n1 2\n1 4\n2 3\n3 3\n4 3\n2 2\n5 3\n2 1\n1 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three integers a, b and c.\n\nFind two positive integers x and y (x > 0, y > 0) such that: \n\n * the decimal representation of x without leading zeroes consists of a digits; \n * the decimal representatio... | [{"type": "stdin_stdout", "input": "9\n1 1 1\n4 4 4\n7 7 3\n4 4 4\n5 7 5\n6 6 6\n7 10 7\n8 8 5\n9 9 1\n", "output": "1 2\n1000 2000\n1000000 1000100\n1000 2000\n10000 1010000\n100000 200000\n1000000 1001000000\n10000000 10010000\n100000000 100000001\n"}, {"type": "stdin_stdout", "input": "9\n1 1 1\n4 4 2\n7 7 3\n4 4 4\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has x of red and y of blue candies. Using them, he wants to make gift sets. Each gift set contains either a red candies and b blue candies, or a blue candies and b red candies. Any candy can belong to at most one... | [{"type": "stdin_stdout", "input": "9\n10 12 1 5\n1 2 2 2\n52 109 13 53\n1000000000 1000000000 1 1\n1000100000 1 1 1000000000\n1 1000000000 1000000001 2\n1 2 1 1\n14 11 2 2\n4 1 2 5\n", "output": "3\n0\n2\n1000000000\n1\n0\n1\n5\n0\n"}, {"type": "stdin_stdout", "input": "9\n10 12 1 16\n1 2 2 3\n52 474 13 53\n1000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are parallel to the coordinate... | [{"type": "stdin_stdout", "input": "314304 429528 163\n", "output": "119035307824.125411987304688\n"}, {"type": "stdin_stdout", "input": "938133 287232 156\n", "output": "182978083107.739746093750000\n"}, {"type": "stdin_stdout", "input": "646084 979010 45\n", "output": "491534756284.375061035156250\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCalendars in widespread use today include the Gregorian calendar, which is the de facto international standard, and is used almost everywhere in the world for civil purposes. The Gregorian reform modified the Julian calen... | [{"type": "stdin_stdout", "input": "1900:01:01\n2038:12:31\n", "output": "50768\n"}, {"type": "stdin_stdout", "input": "1986:08:24\n1926:04:13\n", "output": "22048\n"}, {"type": "stdin_stdout", "input": "1910:01:11\n1987:02:08\n", "output": "28152\n"}, {"type": "stdin_stdout", "input": "2015:10:17\n1966:07:12\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are an adventurer currently journeying inside an evil temple. After defeating a couple of weak zombies, you arrived at a square room consisting of tiles forming an n × n grid. The rows are numbered 1 through n from to... | [{"type": "stdin_stdout", "input": "17\n.EEEEE...EEEE..EE\nEEE..E...EEEEE..E\n.E..E..EEE.EE...E\n.EEE.EE..EE...E..\nE..EEEEEE.EE.....\nE.EE...EEEEEEE.E.\nEEEE....EE..E.EEE\n...EEEEE.E..EE...\nEEE.E..EEEE.EEE..\n..E.E....EEE.....\nEE..E..E.E..EEEEE\nEEE..E.EEEEE.E...\n..EEEEE.E..EE.EE.\nEE.E...E..E..E.EE\n..E.EEE.EE..EE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJeff's got n cards, each card contains either digit 0, or digit 5. Jeff can choose several cards and put them in a line so that he gets some number. What is the largest possible number divisible by 90 Jeff can make from t... | [{"type": "stdin_stdout", "input": "214\n5 0 5 0 5 0 0 0 5 5 0 5 0 5 5 0 5 0 0 0 0 5 5 0 0 5 5 0 0 0 0 5 5 5 5 0 5 0 0 0 0 0 0 5 0 0 0 5 0 0 5 0 0 5 5 0 0 5 5 0 0 0 0 0 5 0 5 0 5 5 0 5 0 0 5 5 5 0 5 0 5 0 5 5 0 5 0 0 0 5 5 0 5 0 5 5 5 5 5 0 0 0 0 0 0 5 0 5 5 0 5 0 5 0 5 5 0 0 0 0 5 0 5 0 5 0 0 5 0 0 5 5 5 5 5 0 0 5 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine that there is a group of three friends: A, B and С. A owes B 20 rubles and B owes C 20 rubles. The total sum of the debts is 40 rubles. You can see that the debts are not organized in a very optimal manner. Let's ... | [{"type": "stdin_stdout", "input": "100 48\n1 56 6\n2 42 3\n3 52 1\n9 26 8\n10 96 8\n11 39 2\n12 51 6\n12 68 7\n13 40 5\n14 18 10\n14 70 6\n15 37 8\n15 38 8\n15 82 6\n15 85 5\n16 48 3\n16 50 9\n16 71 9\n17 18 3\n17 100 10\n20 73 3\n22 32 9\n22 89 9\n23 53 3\n24 53 1\n27 78 10\n30 50 5\n33 94 8\n34 87 9\n35 73 3\n36 51 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle X has n distinct integers: p1, p2, ..., pn. He wants to divide all of them into two sets A and B. The following two conditions must be satisfied:\n\n * If number x belongs to set A, then number a - x must also bel... | [{"type": "stdin_stdout", "input": "70 416035 416023\n70034 70322 345689 345965 345701 70046 345737 345713 70166 345821 70010 345749 345677 345725 69962 345869 70178 70310 345785 69998 70070 69974 70058 346001 70106 345953 70226 70154 345929 69950 70298 346049 70346 345989 70286 69986 345893 70082 70238 345797 70250 34... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova and Marina love offering puzzles to each other. Today Marina offered Vova to cope with the following task.\n\nVova has a non-directed graph consisting of n vertices and m edges without loops and multiple edges. Let's... | [{"type": "stdin_stdout", "input": "14 30\n12 10\n1 7\n12 13\n7 3\n14 10\n3 12\n11 1\n2 12\n2 5\n14 3\n14 1\n14 4\n6 7\n12 6\n9 5\n7 10\n8 5\n6 14\n13 7\n4 12\n9 10\n1 9\n14 5\n1 8\n2 13\n5 11\n8 6\n4 9\n9 13\n2 4\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "14 30\n12 10\n1 7\n12 13\n8 3\n14 10\n3 12\n11 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAccording to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of ... | [{"type": "stdin_stdout", "input": "4\n1475\nKXJURNYJHVLVKULJBPRBCZSOTKNTOGKGFKIQDQEMEAFTPNXQTIQWROI\nKTR\nRHVRWGODYWWTYZFLFYKCVUFFRTQDINKNWPKFHZBFWBHWINWJW\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "4\n1475\nKXJURNYJHVLVKULJBPRBCZSOTKNTOGKGFKIQDQEMEAFTPNXQTIQWROI\nRTK\nRHVRWGODYWWTYZFLFYKCVUFFRTQDINKNWPK... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given string s consists of opening and closing brackets of four kinds <>, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another of the same type. For example, you... | [{"type": "stdin_stdout", "input": "))>)}}>>]}]{{}{({)>{(((}>>))<[})}{}(){}}}]>><){<{<><{[[]{<(<{{])(({[<}({)[}>>([>>(>]>[{]{}<<)()]})])}([>]{}(>{(<([([<(\n", "output": "Impossible\n"}, {"type": "stdin_stdout", "input": "))>)}}>>]}]{{}{({)>{(((}>>))<[})}{}(){}}}]>><){;{<><{[[]{<(<{{])(({[<}({)[}>>([>>(>]>[{]{}<<)()]})]... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're given a list of n strings a1, a2, ..., an. You'd like to concatenate them together in some order such that the resulting string would be lexicographically smallest.\n\nGiven the list of strings, output the lexicogr... | [{"type": "stdin_stdout", "input": "13\nclgknjjojyuvdtv\nclgknjjojyuvdtvzxz\nclgknjjojyuvdtvzxzxradqhm\ngvzpnckalbaubfviyhijosiixvxaydxagvymq\nclgknjjojyuvdtvjgcwarwvgilcctdiytmvmvfxxkezymt\nbvwzpuut\nclgknjjojyuvdtvjgcwarwvgilcctdiytmvmvfxxkezymth\nclgknjjojyuvdtvjgcwarwvgilcctdiytmvmvfxxkezymtlkdl\nrbwvaayhhunlvmwexv... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of the equator and any meridian is considered to be exactly 40 000 kilometers. Thus, travelling from North Pol... | [{"type": "stdin_stdout", "input": "10\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n20000 South\n20000 North\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "9\n1355 North\n15309 West\n17834 North\n13612 East\n17477 North\n4546 North\n18260 East\n154... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAuthor note: I think some of you might remember the problem \"Two Melodies\" from Eductational Codeforces Round 22. Now it's time to make it a bit more difficult!\n\nAlice is a composer, and recently she had recorded two ... | [{"type": "stdin_stdout", "input": "10\n7776 32915 1878 71664 7542 72359 65387 75222 95899 40333\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "10\n7776 32915 1312 71664 7542 72359 65387 75222 95899 40333\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "10\n7776 32915 1030 71664 7542 72359 65387 75222... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence a1, a2, ..., an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers in each of them in increasing order... | [{"type": "stdin_stdout", "input": "100\n39 77 67 25 81 26 50 11 73 95 86 16 90 33 14 79 12 100 68 64 60 27 41 15 34 24 3 61 83 47 57 65 99 43 40 21 94 72 82 85 23 71 76 32 10 17 30 18 44 59 35 89 6 63 7 69 62 70 4 29 92 87 31 48 36 28 45 97 93 98 56 38 58 80 8 1 74 91 53 55 54 51 96 5 42 52 9 22 78 88 75 13 66 2 37 20... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA New Year party is not a New Year party without lemonade! As usual, you are expecting a lot of guests, and buying lemonade has already become a pleasant necessity.\n\nYour favorite store sells lemonade in bottles of n di... | [{"type": "stdin_stdout", "input": "30 1000000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.\n\nMishka is really interested in calculus, though it is so hard to stay awake for all the ... | [{"type": "stdin_stdout", "input": "10 5\n1 1 1 1 1 1 1 1 10000 1\n1 1 1 1 1 1 1 1 0 1\n", "output": "10009\n"}, {"type": "stdin_stdout", "input": "10 5\n1 1 1 1 1 1 1 1 10000 1\n1 1 1 0 1 1 1 1 0 1\n", "output": "10008\n"}, {"type": "stdin_stdout", "input": "10 5\n1 2 1 1 1 1 1 1 10000 1\n1 1 1 0 1 1 1 1 0 0\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen the curtains are opened, a canvas unfolds outside. Kanno marvels at all the blonde colours along the riverside — not tangerines, but blossoms instead.\n\n\"What a pity it's already late spring,\" sighs Mino with regr... | [{"type": "stdin_stdout", "input": "BBB.C.CBBAACB.BCBCCAAAABAB.BCB..CCCACBB.A.CACCAABABAAB.ACBBCCA...CC...AAB..CCAABBA..CAAC..C.AAB.CACA\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": ".CBCC..AB.CCBC.CAABAA.BCCBC.CACAACA..BBCCBB.CC.A.B.CC.C.CC.AC.CBC..CB.B..BCCBCCBAB..CA.BBC.ABBCCAAC.\n", "output": "YES\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHackerMan loves playing Age of Empire. A few days ago, he discovered a variant of that game which is equally adventurous. Here, he has to capture a castle before his enemy.\n\nThe map consists of several interconnected pa... | [{"type": "stdin_stdout", "input": "2\n35 30\n2 10 9 5 3 6 9 5 5 3 7 10 12 3 10 9 0 2 6 2 6 10 10 8 10 12 6 2 1 7\n5 7 3 4 2 3 6 8 4 10 10 9 7 2 5 1 3 8 5 4 7 2 5 10 9 5 8 7 6 5\n10 1 10 6 2 2 3 9 10 6 4 9 1 10 2 2 5 10 3 7 2 6 9 2 8 10 4 4 1 17\n8 2 3 8 9 8 5 1 10 7 1 4 9 2 5 6 8 10 10 8 4 3 6 5 7 8 6 10 9 5\n1 5 9 8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Monk is trying to explain to its users that even a single unit of time can be extremely important and to demonstrate this particular fact he gives them a challenging task. \n\nThere are N processes to be completed by... | [{"type": "stdin_stdout", "input": "3\n3 2 1\n1 3 2\n\nSAMPLE", "output": "5\n"}, {"type": "stdin_stdout", "input": "3\n3 2 1\n1 3 2\n\nSAMELP", "output": "5\n"}, {"type": "stdin_stdout", "input": "3\n3 2 1\n1 3 2\n\nRAMELP", "output": "5\n"}, {"type": "stdin_stdout", "input": "3\n3 2 1\n1 3 2\n\nTAMELP", "output": "5\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIts Diwali time and there are LED series lights everywhere. Little Roy got curious about how LED lights work.\n\nHe noticed that in one single LED Bulb there are 3 LED lights, namely Red, Green and Blue.\n\nState of the b... | [{"type": "stdin_stdout", "input": "1000000 13032 14948 7562323", "output": "254148 252216 0 241068 0 0 0 252568\n"}, {"type": "stdin_stdout", "input": "1000000 10461 14948 7562323", "output": "251165 246577 0 246707 0 0 0 255551\n"}, {"type": "stdin_stdout", "input": "1000001 13032 16049 7562323", "output": "244591 24... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProf. M went to unknown world where words are considered to be powerful according to their weights. But Prof. M doesn't know how to calculate weight of words. He will tell you a word and you have to tell its weight. \nYou... | [{"type": "stdin_stdout", "input": "100\nioyqjzesuuaxinlclckfsvcwumqoarylhwdqvilrelqnadrmfdtzaywwkokniiapgdgdntwsgmhgsauzfobfmzbynnnvwnnervkgogywvhcnhzoopptdqwbekrbieomxjwezfevamypvzdkovfrlcupoltwqhkptjtsoaoqmofjnivdfburfoitcbpulbjekfyafoqrevctgywlbscgjlblosfztofgtegauztzuwscwrqxjsfsfidwakvvbdbwjkxdjqefmxikoyjzsosayxwy... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSiddharth is a math geek. His only work in free time is to think of a new math problem and keep working on that. Siddharth's latest problem is to sum up digits of a number till the result is a single digit. It goes this w... | [{"type": "stdin_stdout", "input": "3\n2\n10\n0010\n\nSAMPLE", "output": "2\n3\n3\n"}, {"type": "stdin_stdout", "input": "3\n2\n10\n0000\n\nSAMPLE", "output": "2\n3\n0\n"}, {"type": "stdin_stdout", "input": "3\n1\n10\n0110\n\nSAMPLE", "output": "1\n3\n3\n"}, {"type": "stdin_stdout", "input": "3\n2\n10\n0011\n\nSAMPLE",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N colored balls arranged in a row from left to right; the color of the i-th ball from the left is c_i.\n\nYou are given Q queries. The i-th query is as follows: how many different colors do the l_i-th through r_i-... | [{"type": "stdin_stdout", "input": "10 10\n6 5 -1 5 2 0 7 13 14 2\n5 6\n2 4\n6 7\n2 2\n7 8\n7 9\n2 8\n6 9\n8 10\n6 8", "output": "2\n2\n2\n1\n2\n3\n6\n4\n3\n3\n"}, {"type": "stdin_stdout", "input": "10 10\n6 5 -1 5 2 0 7 13 14 2\n5 6\n2 4\n6 7\n2 2\n7 8\n7 9\n2 8\n6 5\n8 10\n6 8", "output": "2\n2\n2\n1\n2\n3\n6\n0\n3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\n* S is a palindrome.\n* Let N be the length of S. The string formed by the 1-st through ((N-1)... | [{"type": "stdin_stdout", "input": "akasaka", "output": "Yes"}, {"type": "stdin_stdout", "input": "akas`ka", "output": "No\n"}, {"type": "stdin_stdout", "input": "redocta", "output": "No\n"}, {"type": "stdin_stdout", "input": "akas`ja", "output": "No\n"}, {"type": "stdin_stdout", "input": "rfdocta", "output": "No\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi is at an all-you-can-eat restaurant.\n\nThe restaurant offers N kinds of dishes. It takes A_i minutes to eat the i-th dish, whose deliciousness is B_i.\n\nThe restaurant has the following rules:\n\n* You can onl... | [{"type": "stdin_stdout", "input": "10 100\n15 23\n20 18\n13 17\n47 12\n18 29\n19 27\n23 21\n18 20\n27 15\n22 25", "output": "145\n"}, {"type": "stdin_stdout", "input": "10 100\n15 23\n20 18\n13 17\n47 12\n18 29\n19 20\n23 21\n18 20\n27 15\n22 25", "output": "138\n"}, {"type": "stdin_stdout", "input": "10 100\n15 23\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N dots in a two-dimensional plane. The coordinates of the i-th dot are (x_i, y_i).\n\nWe will repeat the following operation as long as possible:\n\n* Choose four integers a, b, c, d (a \\neq c, b \\neq d) such ... | [{"type": "stdin_stdout", "input": "9\n1 1\n2 1\n11 1\n4 1\n7 1\n1 2\n2 3\n1 4\n1 5", "output": "16\n"}, {"type": "stdin_stdout", "input": "9\n1 1\n2 1\n11 1\n4 1\n7 1\n1 2\n2 3\n1 8\n1 5", "output": "16\n"}, {"type": "stdin_stdout", "input": "9\n1 1\n2 2\n11 1\n4 1\n7 1\n1 2\n2 3\n1 8\n1 5", "output": "16\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions:\n\n* Question 1: Are you subscribing to Newspaper X?\n* Question 2: Are you subscribing ... | [{"type": "stdin_stdout", "input": "101 110 100", "output": "100 109\n"}, {"type": "stdin_stdout", "input": "100 110 100", "output": "100 110\n"}, {"type": "stdin_stdout", "input": "000 110 100", "output": "100 210\n"}, {"type": "stdin_stdout", "input": "000 100 100", "output": "100 200\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (i... | [{"type": "stdin_stdout", "input": "10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 10\n3 10\n3 8\n3 9\n3 10\n1 10", "output": "7\n9\n10\n6\n9\n8\n6\n7\n8\n10\n"}, {"type": "stdin_stdout", "input": "10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have an N \\times N square grid.\n\nWe will paint each square in the grid either black or white.\n\nIf we paint exactly A squares white, how many squares will be painted black?\n\nConstraints\n\n* 1 \\leq N \\leq 100\n... | [{"type": "stdin_stdout", "input": "10\n202", "output": "-102\n"}, {"type": "stdin_stdout", "input": "19\n110", "output": "251\n"}, {"type": "stdin_stdout", "input": "10\n-13", "output": "113\n"}, {"type": "stdin_stdout", "input": "10\n-16", "output": "116\n"}, {"type": "stdin_stdout", "input": "10\n145", "output": "-4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program s... | [{"type": "stdin_stdout", "input": "2\n2.926287414400688 0.6174638399148507 2.2117258079089996 2.51039017960215 2.2432914589132955 0.3458310450303873 3.950438914943076 1.6292131026754104\n5.957858300757107 3.314602021400227 10.473008708157936 7.081122407685485 15.460510197185764 6.858362845609268 7.533578119892425 12.1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nI decided to do bowling as a recreation of the class. Create a program that inputs the pitching information for each participant and outputs the grade information in descending order of score. If there is a tie, output in... | [{"type": "stdin_stdout", "input": "3\n1010 6 3 10 10 1 0 7 9 1 10 6 2 4 3 9 1 9 0\n1200 5 3 9 1 12 1 0 0 12 1 10 10 4 3 9 1 8 2 9\n1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n4\n3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10\n3332 5 0 10 13 1 4 1 9 0 10 10 7 1 5 2 8 1\n3335 10 10 10 10 10 10 10 10 10 10 10 10\n3340 8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is the word heuristics. It's a relatively simple approach that usually works, although there is no guarantee that it will work. The world is full of heuristics because it is simple and powerful.\n\nSome examples of ... | [{"type": "stdin_stdout", "input": "4 1 3 4\nyskwcnt 16\nakzakr 7\ntsnukk 12\nfnmyi 13\nakzakr\n4 1 3 8\nakzakr 7\ntsnukk 4\nfnmyi 13\nyskwcnt 16\nakzakr\n4 2 2 1\nakzakr 4\ntsnukk 6\nyskwcnt 12\nfnmyi 12\nakzakr\nfnmyi\n5 2 3 28\nknmmdk 6\nskrkyk 14\ntmemm 14\nakmhmr 15\nmksyk 25\nknmmdk\nskrkyk\n5 2 3 11\ntmemm 12\ns... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGaccho owns a field separated by W horizontal x H vertical squares. The cell in the x-th column and the y-th row is called the cell (x, y). Only one plant with a height of 0 cm is planted on the land of some tr... | [{"type": "stdin_stdout", "input": "8 6 3\n7\n0 1 1\n5 1 -1\n4 0 2\n3 2 0\n3 0 1\n3 0 1\n5 1 1\n1 0 1 1 0 0 1 0\n0 0 1 1 0 1 0 1\n0 1 0 0 1 1 0 1", "output": "4\n"}, {"type": "stdin_stdout", "input": "8 3 3\n7\n0 1 1\n5 1 -1\n4 0 2\n3 2 0\n3 1 1\n3 0 1\n5 1 1\n1 0 1 1 0 0 1 1\n0 0 1 1 0 1 0 1\n0 1 0 0 0 1 0 1", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\n\"Everlasting -One-\" is an award-winning online game launched this year. This game has rapidly become famous for its large number of characters you can play.\n\nIn this game, a character is character... | [{"type": "stdin_stdout", "input": "12 2\n2 2\n4 12\n6 0\n100000 0\n0 0", "output": "2049\n64\n607723520\n"}, {"type": "stdin_stdout", "input": "12 2\n1 2\n4 3\n6 0\n100000 0\n0 0", "output": "1025\n64\n607723520\n"}, {"type": "stdin_stdout", "input": "12 2\n2 2\n4 3\n6 0\n100000 0\n0 0", "output": "2049\n64\n607723520... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n2 2 2 1\n0 0 0\n\n\nOutput\n\n24\n\nThe input will be given via stdin and the output should be printed to stdout by your code.\n\nNow solve the problem by providing the code.\n\nWrite Python code to so... | [{"type": "stdin_stdout", "input": "26 2 22 0\n-1 2 0", "output": "1336\n"}, {"type": "stdin_stdout", "input": "36 2 22 0\n-1 2 0", "output": "1816\n"}, {"type": "stdin_stdout", "input": "36 2 43 0\n-1 2 0", "output": "3412\n"}, {"type": "stdin_stdout", "input": "3 8 88 0\n-2 8 -1", "output": "1984\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads three integers a, b and c, and prints \"Yes\" if a < b < c, otherwise \"No\".\n\nConstraints\n\n* 0 ≤ a, b, c ≤ 100\n\nInput\n\nThree integers a, b and c separated by a single space are given i... | [{"type": "stdin_stdout", "input": "-1 -1 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 -1 -2", "output": "No\n"}, {"type": "stdin_stdout", "input": "18 10 10", "output": "No\n"}, {"type": "stdin_stdout", "input": "-1 0 2", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-1 -1 2", "output": "No\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a bracket sequence s (not necessarily a regular one). A bracket sequence is a string containing only characters '(' and ')'.\n\nA regular bracket sequence is a bracket sequence that can be transformed into a... | [{"type": "stdin_stdout", "input": "100\n((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "100\n((((((((((((((((... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJATC and his friend Giraffe are currently in their room, solving some problems. Giraffe has written on the board an array a_1, a_2, ..., a_n of integers, such that 1 ≤ a_1 < a_2 < … < a_n ≤ 10^3, and then went to the bath... | [{"type": "stdin_stdout", "input": "100\n901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nVasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair... | [{"type": "stdin_stdout", "input": "100\n103\n130\n138\n126\n157\n164\n185\n120\n109\n137\n123\n147\n124\n178\n183\n155\n146\n169\n156\n153\n196\n152\n145\n110\n184\n168\n170\n177\n190\n128\n108\n182\n102\n101\n159\n150\n117\n106\n187\n194\n167\n151\n171\n195\n127\n115\n192\n114\n125\n165\n118\n113\n189\n199\n180\n139\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou still have partial information about the score during the historic football match. You are given a set of pairs (a_i, b_i), indicating that at some point during the match the score was \"a_i: b_i\". It is known that i... | [{"type": "stdin_stdout", "input": "11\n1 100000000\n200000000 100000000\n200000000 300000000\n400000000 300000000\n400000000 500000000\n600000000 639960479\n618182416 700000000\n800000000 700000000\n800000000 900000000\n1000000000 900000000\n1000000000 1000000000\n", "output": "100000011\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDuring a break in the buffet of the scientific lyceum of the Kingdom of Kremland, there was formed a queue of n high school students numbered from 1 to n. Initially, each student i is on position i. Each student i is char... | [{"type": "stdin_stdout", "input": "30\n61 23\n30 93\n4 18\n34 97\n63 77\n45 95\n51 13\n41 8\n86 19\n38 24\n2 67\n20 61\n95 48\n95 1\n28 26\n92 110\n6 78\n64 28\n1 82\n61 37\n77 35\n152 21\n10 24\n52 12\n80 63\n64 61\n16 87\n118 19\n21 34\n54 49\n", "output": "29529\n"}, {"type": "stdin_stdout", "input": "30\n61 23\n30... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA palindrome is a string t which reads the same backward as forward (formally, t[i] = t[|t| + 1 - i] for all i ∈ [1, |t|]). Here |t| denotes the length of a string t. For example, the strings 010, 1001 and 0 are palindrom... | [{"type": "stdin_stdout", "input": "11\n4\n0\n1\n1\n0\n2\n0001000\n0000000000000\n2\n1\n0\n1\n1\n1\n0\n2\n11\n00\n2\n111\n000\n2\n111\n00\n2\n00\n111\n2\n11111\n00\n2\n00000100000\n000\n", "output": "4\n2\n2\n1\n1\n2\n2\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "11\n4\n0\n1\n1\n0\n2\n0001000\n0000000000000\n2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has a coins, Barbara has b coins and Cerene has c coins. Recently Polycarp has returned from the trip around the world and... | [{"type": "stdin_stdout", "input": "5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n10 20 15 14\n101 101 101 3\n", "output": "Yes\nYes\nNo\nNo\nYes\n"}, {"type": "stdin_stdout", "input": "5\n5 3 2 8\n100 101 102 105\n3 2 1 100000000\n23 20 15 14\n011 101 101 3\n", "output": "YES\nYES\nNO\nYES\nNO\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nScreen resolution of Polycarp's monitor is a × b pixels. Unfortunately, there is one dead pixel at his screen. It has coordinates (x, y) (0 ≤ x < a, 0 ≤ y < b). You can consider columns of pixels to be numbered from 0 to ... | [{"type": "stdin_stdout", "input": "6\n8 8 0 0\n1 11 0 3\n17 10 10 4\n2 4 0 0\n4 10 3 9\n15 18 3 12\n", "output": "56\n7\n100\n6\n36\n198\n"}, {"type": "stdin_stdout", "input": "6\n8 8 0 0\n1 11 0 3\n17 10 10 4\n2 4 0 0\n4 10 3 6\n15 18 3 12\n", "output": "56\n7\n100\n6\n30\n198\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe game of Berland poker is played with a deck of n cards, m of which are jokers. k players play this game (n is divisible by k).\n\nAt the beginning of the game, each player takes n/k cards from the deck (so each card i... | [{"type": "stdin_stdout", "input": "4\n8 3 2\n4 2 4\n12 6 3\n42 0 7\n", "output": "3\n0\n3\n0\n"}, {"type": "stdin_stdout", "input": "4\n12 3 2\n4 2 4\n9 6 3\n42 0 7\n", "output": "3\n0\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n8 1 2\n4 2 4\n12 6 3\n66 0 7\n", "output": "1\n0\n3\n0\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly n flowers.\n\nVladimir went to a flower shop, and he was amazed to see that there are m types of flowers being... | [{"type": "stdin_stdout", "input": "1\n7 7\n873108721 195635452\n42649954 997221147\n873108721 1003477544\n1087176458 873108721\n1130734166 858693746\n1309378041 372607189\n1000000000 427003887\n", "output": "7410830018\n"}, {"type": "stdin_stdout", "input": "1\n7 7\n873108721 195635452\n66631086 997221147\n1700956320 ... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.