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\nIn the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this reason it was excluded from the contest. This mistake have been fixed and the current given p... | [{"type": "stdin_stdout", "input": "20\n1306340891 192811911 592111899 609607891 585084800 601258511 223103775 164258550 858003275 230837577 971499807 312977833 344314550 397998873 558637732 216574673 913028292 1360238301 464376621 61315042\n", "output": "384683838\n"}, {"type": "stdin_stdout", "input": "20\n713900269 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAyrat has number n, represented as it's prime factorization pi of size m, i.e. n = p1·p2·...·pm. Ayrat got secret information that that the product of all divisors of n taken modulo 109 + 7 is the password to the secret d... | [{"type": "stdin_stdout", "input": "67\n98929 19079 160079 181891 17599 91807 19079 98929 182233 92647 77477 98929 98639 182233 181891 182233 160079 98929 19079 98639 114941 98929 161341 91807 160079 22777 132361 92647 98929 77477 182233 103913 160079 77477 55711 77477 77477 182233 114941 91807 98929 19079 104393 18223... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPaul is at the orchestra. The string section is arranged in an r × c rectangular grid and is filled with violinists with the exception of n violists. Paul really likes violas, so he would like to take a picture including ... | [{"type": "stdin_stdout", "input": "10 10 10 1\n8 10\n2 9\n1 10\n3 1\n8 5\n10 1\n4 10\n10 2\n5 3\n9 3\n", "output": "1787\n"}, {"type": "stdin_stdout", "input": "14 10 10 1\n8 10\n2 9\n1 10\n3 1\n8 5\n10 1\n4 10\n10 2\n5 3\n9 3\n", "output": "3411\n"}, {"type": "stdin_stdout", "input": "10 10 10 1\n1 10\n10 8\n7 4\n7 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPari has a friend who loves palindrome numbers. A palindrome number is a number that reads the same forward or backward. For example 12321, 100001 and 1 are palindrome numbers, while 112 and 1021 are not.\n\nPari is tryin... | [{"type": "stdin_stdout", "input": "11635543554796045289140983157483950524203250955411464324183518580611424141988904394156045071683009945\n", "output": "11635543554796045289140983157483950524203250955411464324183518580611424141988904394156045071683009945549900386170540651493409889141424116085815381423464114559052302425... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only king stands on the standard chess board. You are given his position in format \"cd\", where c is the column from 'a' to 'h' and d is the row from '1' to '8'. Find the number of moves permitted for the king.\n\nCh... | [{"type": "stdin_stdout", "input": "e2\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "a3\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "d7\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "h7\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "d6\n", "output": "8\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGrigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.\n\nEmbosser is a special devise th... | [{"type": "stdin_stdout", "input": "uhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuhuh\n", "output": "1293\n"}, {"type": "stdin_stdout", "input": "dqcpcobpcobnznamznamzlykxkxlxlylzmaobnaobpbnanbpcoaobnboaoboanzlymzmykylymylzlylymanboanaocqdqesfrfs\n", "output": "1236\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolandBall lives in a forest with his family. There are some trees in the forest. Trees are undirected acyclic graphs with k vertices and k - 1 edges, where k is some integer. Note that one vertex is a valid tree.\n\nTher... | [{"type": "stdin_stdout", "input": "6 5\n1 4\n2 3\n3 4\n4 5\n5 6\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "6 5\n1 4\n2 0\n3 4\n4 5\n5 6\n", "output": "1"}, {"type": "stdin_stdout", "input": "5 4\n1 2\n1 3\n1 4\n3 5\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 4\n1 3\n1 4\n4 2\n5 2\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMoriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same ... | [{"type": "stdin_stdout", "input": "13 11\n0 1 1 0 1 0 0 0 1 0 0 1 1\n6 2 8 9 11 12 13\n3 1 3 11\n1 12\n1 7\n3 6 10 13\n3 1 3 8\n2 7 9\n1 4\n1 2\n2 5 10\n3 4 5 6\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "13 11\n0 1 1 0 0 0 0 0 1 0 0 1 1\n6 2 8 9 11 12 13\n3 1 3 11\n1 12\n1 7\n3 6 10 13\n3 1 3 8\n2 7 9\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMost C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.\n\nIn this problem we consider th... | [{"type": "stdin_stdout", "input": "5\n#define iiXEqDYeyVmIYsOaO fj/x-9-6/x*x+ 1/ 7*2-x -x+9+235*23*Ww+x-2*K+2-x/70\n#define XVgLzhoTUxoBr ( x+x/x/x*6-x)* x+K/24206-2 /5/8-x-7/Ww/K-x+6 \n#define QdfRBaJk 470551685-( 54-x)-30\n#define gEJcAGnF x+x-x+(x/x+9)/x-41-1/fj/1157561+x/x -x/26/x+K*x\n#define lO 7-1*(x*58 )-K*fj... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOkabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and cut banana trees.\n\nConsider the point (x, y) in the 2D plane such that x and y are integers and 0 ≤ x, y. The... | [{"type": "stdin_stdout", "input": "1000 10000\n", "output": "74133360011484445"}, {"type": "stdin_stdout", "input": "1581 6030\n", "output": "40628923515290265\n"}, {"type": "stdin_stdout", "input": "1061 8096\n", "output": "44286779591578800\n"}, {"type": "stdin_stdout", "input": "1581 5974\n", "output": "39507636740... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIvan has an array consisting of n different integers. He decided to reorder all elements in increasing order. Ivan loves merge sort so he decided to represent his array with one or several increasing sequences which he th... | [{"type": "stdin_stdout", "input": "10\n71550121 446173607 640274071 402690754 802030518 598196518 796619138 96204862 983359971 799843967\n", "output": "71550121 446173607 640274071 802030518 983359971\n402690754 598196518 796619138 799843967\n96204862\n"}, {"type": "stdin_stdout", "input": "10\n71550121 446173607 8477... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n strings s1, s2, ..., sn consisting of characters 0 and 1. m operations are performed, on each of them you concatenate two existing strings into a new one. On the i-th operation the concatenation saisbi is ... | [{"type": "stdin_stdout", "input": "2\n011\n100\n63\n1 1\n3 3\n4 4\n5 5\n6 6\n7 7\n8 8\n9 9\n10 10\n11 11\n12 12\n13 13\n14 14\n15 15\n16 16\n17 17\n18 18\n19 19\n20 20\n21 21\n22 22\n23 23\n24 24\n25 25\n26 26\n27 27\n28 28\n29 29\n30 30\n31 31\n32 32\n2 2\n34 34\n35 35\n36 36\n37 37\n38 38\n39 39\n40 40\n41 41\n42 42... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"QAQ\" is a word to denote an expression of crying. Imagine \"Q\" as eyes with tears and \"A\" as a mouth.\n\nNow Diamond has given Bort a string consisting of only uppercase English letters of length n. There is a great... | [{"type": "stdin_stdout", "input": "QQAQQAKQFAQLQAAWAMQAZQAJQAAQQOACQQAAAYANAQAQQAQAAQQAOBQQJQAQAQAQQQAAAAABQQQAVNZAQQQQAMQQAFAAEAQAQHQT\n", "output": "10420\n"}, {"type": "stdin_stdout", "input": "AQEGQHQQKQAQQPQKAQQQAAAAQQQAQEQAAQAAQAQFSLAAQQAQOQQAVQAAAPQQAWAQAQAFQAXAQQQQTRLOQAQQJQNQXQQQQSQVDQQQ\n", "output": "12488\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a [directed graph](https://en.wikipedia.org/wiki/Directed_graph) consisting of n vertices and m edges (each edge is directed, so it can be traversed in only one direction). You are allowed to remove at most ... | [{"type": "stdin_stdout", "input": "500 50\n396 340\n47 341\n422 140\n492 209\n263 248\n461 300\n124 495\n33 6\n93 384\n389 182\n130 297\n217 329\n131 136\n355 94\n388 275\n115 368\n279 462\n126 285\n185 287\n223 221\n207 167\n203 127\n39 245\n394 444\n166 99\n399 328\n3 276\n142 325\n284 153\n65 3\n102 5\n459 168\n156... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of length n. We define fa the following way:\n\n * Initially fa = 0, M = 1; \n * for every 2 ≤ i ≤ n if aM < ai then we set fa = fa + aM and then set M = i. \n\n\n\nCalculate the sum of fa over ... | [{"type": "stdin_stdout", "input": "9\n347223417 807654168 573530036 826123287 366028010 257025851 15406743 784063803 132844347\n", "output": "932879531\n"}, {"type": "stdin_stdout", "input": "9\n347223417 807654168 573530036 826123287 366028010 257025851 15406743 784063803 138878790\n", "output": "655212093\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach student eagerly awaits the day he would pass the exams successfully. Thus, Vasya was ready to celebrate, but, alas, he didn't pass it. However, many of Vasya's fellow students from the same group were more successful... | [{"type": "stdin_stdout", "input": "100 100 100 100\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "101 100 100 100\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "100 0 100 100\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "100 100 100 0\n", "output": "-1\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an array A of size N. Given Q operations, each operation contains an integer D. In each operation you have to divide all the elements of the array by D.\n\nFor example, for each operation with a given D, the new arr... | [{"type": "stdin_stdout", "input": "1000\n384 887 778 916 794 336 387 493 650 422 363 28 691 60 764 927 541 427 173 737 212 369 568 430 783 531 863 124 68 136 930 803 23 59 70 310 394 457 12 43 230 374 422 920 785 538 199 325 316 371 414 527 92 981 957 874 863 171 997 466 306 926 85 328 337 506 847 730 314 858 125 896 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Deepu loves positive things in life, positive girlfriends, positive marks. He's, in general a lover of positive things, so for obvious reasons he loves an array which contains positive elements.\n\nAnyway, Little D... | [{"type": "stdin_stdout", "input": "10\n19 10 17 20 13 2 3 20 30 75\n10\n1\n1\n1\n2\n2\n2\n40\n30\n10\n10", "output": "11 4 10 12 7 1 1 12 22 65\n"}, {"type": "stdin_stdout", "input": "10\n19 10 17 20 13 2 3 20 30 75\n10\n1\n1\n1\n2\n2\n2\n40\n30\n20\n10", "output": "12 4 10 13 7 1 1 13 22 65\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn intergallactic war is on. Aliens are throwing fire-balls at our planet and this fire is so deadly that whichever nation it hits, it will wipe out not only that nation, but also spreads to any other nation which lies ad... | [{"type": "stdin_stdout", "input": "3 3 3\n0 0 0\n1 0 1\n0 1 1\n1 2\n2 2\n3 3\n\nSAMPLE", "output": "4\n4\n1\n"}, {"type": "stdin_stdout", "input": "3 3 3\n0 0 0\n1 0 1\n0 1 1\n1 1\n2 2\n3 3\n\nSAMPLE", "output": "4\n4\n1\n"}, {"type": "stdin_stdout", "input": "3 3 3\n0 0 0\n1 0 1\n1 1 1\n1 2\n2 2\n3 3\n\nSAMPLE", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are N integers A_1,\\ldots,A_N.\n\nWe will choose exactly K of these elements. Find the maximum possible product of the chosen elements.\n\nThen, print the maximum product modulo (10^9+7), using an integer between 0... | [{"type": "stdin_stdout", "input": "16 1\n1000000001 100000100 10000100 1000001 100000 10001 1000 000 18 1", "output": "1000000001\n"}, {"type": "stdin_stdout", "input": "10 10\n1000000000 100000000 10000000 1100010 100000 10000 1000 100 10 1", "output": "123991513\n"}, {"type": "stdin_stdout", "input": "10 10\n1000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA Hitachi string is a concatenation of one or more copies of the string `hi`.\n\nFor example, `hi` and `hihi` are Hitachi strings, while `ha` and `hii` are not.\n\nGiven a string S, determine whether S is a Hitachi string... | [{"type": "stdin_stdout", "input": "hihi", "output": "Yes"}, {"type": "stdin_stdout", "input": "hhhi", "output": "No\n"}, {"type": "stdin_stdout", "input": "hhhj", "output": "No\n"}, {"type": "stdin_stdout", "input": "jhhh", "output": "No\n"}, {"type": "stdin_stdout", "input": "hjhh", "output": "No\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi has a water bottle with the shape of a rectangular prism whose base is a square of side a~\\mathrm{cm} and whose height is b~\\mathrm{cm}. (The thickness of the bottle can be ignored.)\n\nWe will pour x~\\mathrm... | [{"type": "stdin_stdout", "input": "12 30 10", "output": "89.8938968259\n"}, {"type": "stdin_stdout", "input": "15 21 10", "output": "89.8267706578\n"}, {"type": "stdin_stdout", "input": "1 16 18", "output": "-75.9637565321\n"}, {"type": "stdin_stdout", "input": "34 21 10", "output": "89.9235751027\n"}, {"type": "stdin... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a grid with H rows and W columns, where each square is painted black or white.\n\nYou are given H strings S_1, S_2, ..., S_H, each of length W. If the square at the i-th row from the top and the j-th column from ... | [{"type": "stdin_stdout", "input": "3 3\n.#.\n..#\n#..", "output": "10"}, {"type": "stdin_stdout", "input": "3 4\n.#.\n..#\n#..", "output": "16"}, {"type": "stdin_stdout", "input": "3 4\n.#.\n..#\n#./", "output": "27"}, {"type": "stdin_stdout", "input": "3 3\n/#.\n..#\n#..", "output": "18"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the city of Nevermore, there are 10^8 streets and 10^8 avenues, both numbered from 0 to 10^8-1. All streets run straight from west to east, and all avenues run straight from south to north. The distance between neighbo... | [{"type": "stdin_stdout", "input": "10 0 2 4\n3\n-1 3\n10 2\n2 4", "output": "1191.415926535898\n"}, {"type": "stdin_stdout", "input": "1 1 2 13\n3\n3 1\n5 -1\n-1 7", "output": "1300.000000000000\n"}, {"type": "stdin_stdout", "input": "0 1 2 17\n3\n3 2\n8 -1\n-1 4", "output": "1800.000000000000\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTwo deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest. In this game, an honest player always tells the truth, and an dishonest player always tell lies. You are given two characters a and b as the... | [{"type": "stdin_stdout", "input": "H 14", "output": "D\n"}, {"type": "stdin_stdout", "input": "H 15", "output": "D\n"}, {"type": "stdin_stdout", "input": "H 23", "output": "D\n"}, {"type": "stdin_stdout", "input": "H 17", "output": "D\n"}, {"type": "stdin_stdout", "input": "H 13", "output": "D\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N towns located in a line, conveniently numbered 1 through N. Takahashi the merchant is going on a travel from town 1 to town N, buying and selling apples.\n\nTakahashi will begin the travel at town 1, with no a... | [{"type": "stdin_stdout", "input": "10 100\n7 10 4 5 9 3 6 8 1 1", "output": "2\n"}, {"type": "stdin_stdout", "input": "10 100\n7 10 4 5 9 3 6 8 2 1", "output": "2"}, {"type": "stdin_stdout", "input": "5 10\n21 30 40 10 20", "output": "1\n"}, {"type": "stdin_stdout", "input": "5 10\n21 30 40 10 31", "output": "1\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that reads poker hand data and outputs the role for each. However, this issue follows the rules below.\n\n* Poker is a competition with 5 playing cards.\n* No more than 5 cards with the same number.\n* Th... | [{"type": "stdin_stdout", "input": "1,2,4,3,1\n3,3,1,3,12\n12,13,11,12,12\n7,6,7,6,7\n3,3,2,3,3\n6,7,8,9,10\n11,13,11,1,13\n11,12,13,1,1", "output": "one pair\nthree card\nthree card\nfull house\nfour card\nstraight\ntwo pair\none pair\n"}, {"type": "stdin_stdout", "input": "1,2,3,4,1\n2,3,1,3,12\n12,13,11,12,12\n7,6,7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nI bought food at the store to make a lunch box to eat at lunch. At the store, I only got an elongated bag to put food in, so I had to stack all the food vertically and put it in the bag. I want to pack the bag with the he... | [{"type": "stdin_stdout", "input": "4\nsandwich 30 120\nelppa 50 200\ncheese 20 40\ncake 100 100\n9\nonigiri 80 300\nonigiri 80 300\nanpan 70 280\nmikan 50 80\nkanzume 101 500\nchocolate 50 350\niookce 30 132\npurin 40 400\ncracker 40 154\n0", "output": "cake\nelppa\nsandwich\ncheese\nkanzume\npurin\nchocolate\nonigiri... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are working on the development of the unique operating system \"Unsgune 15\" and are struggling to design a scheduler that determines performance. A scheduler is a program that expresses the processes to be executed i... | [{"type": "stdin_stdout", "input": "5 3\n1 5 2\n3 31 5\n6 2 3\n5 5 5\n4 8 3\n0\n1 2 3\n2\n2 2 3 1\n4 3 1 2", "output": "3\n4\n2\n5\n1\n"}, {"type": "stdin_stdout", "input": "5 3\n1 0 2\n3 8 5\n1 2 -1\n9 5 5\n4 8 0\n0\n1 2 3\n1\n2 2 3 1\n4 3 1 2", "output": "4\n5\n2\n3\n1\n"}, {"type": "stdin_stdout", "input": "5 3\n1 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA text editor is a useful software tool that can help people in various situations including writing and programming. Your job in this problem is to construct an offline text editor, i.e., to write a program that first re... | [{"type": "stdin_stdout", "input": "3\nA sample input\n9\nforward word\ndelete char\nforward word\ndelete char\nforward word\ndelete char\nbackward word\nbackward word\nforward word\nHallow, Word.\n7\nforward char\ndelete word\ninsert \"ello, \"\nforward word\nbackward char\nbackward char\ninsert \"l\"\n\n3\nforward vo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are appointed director of a famous concert hall, to save it from bankruptcy. The hall is very popular, and receives many requests to use its two fine rooms, but unfortunately the previous director was not very efficie... | [{"type": "stdin_stdout", "input": "4\n1 2 10\n2 3 10\n3 3 10\n1 3 10\n6\n1 20 1000\n5 25 10000\n2 30 8781\n22 300 5500\n10 117 9000\n7 7 2175\n8\n32 251 2396\n132 281 1659\n222 235 5641\n162 217 1883\n22 158 7195\n194 198 9190\n119 274 1469\n122 334 13708\n0", "output": "30\n21175\n35734\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend recently came up with a card game called UT-Rummy.\n\nThe cards used in this game are numbered red, green, or blue and any number from 1 to 9. Each player in this game has 9 cards in his or her hand, chooses o... | [{"type": "stdin_stdout", "input": "5\n1 2 3 6 4 5 7 13 7\nR R R R R R G G G\n1 2 2 3 4 4 4 4 5\nR R R R R Q R R R\n1 3 3 4 4 4 5 5 5\nR R B R R R R R R\n1 1 1 3 4 5 6 6 10\nR R B G G G R R S\n2 2 2 3 3 3 1 1 2\nR G B R G B R G B", "output": "0\n0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 6 4 5 7 13 7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs many of you know, we have two major calendar systems used in Japan today. One of them is Gregorian calendar which is widely used across the world. It is also known as “Western calendar” in Japan.\n\nThe other calendar ... | [{"type": "stdin_stdout", "input": "4 3\nmeiji 10 1877\ntaisho 6 1917\nrhowa 62 1987\nheisei 22 2010\n2046\n1917\n1988\n1 1\nuniversalbentury 218 2168\n2010\n0 0", "output": "Unknown\ntaisho 6\nUnknown\nuniversalbentury 60\n"}, {"type": "stdin_stdout", "input": "4 3\nmeiji 10 1877\nasisho 6 3102\nsiowa 62 1987\nieisei ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne-day pass\n\nMr. D, a university student living in a certain country, is a big fan of Mr. A, a national guitarist, and is thinking of going to a live concert in the city center this summer. However, since Mr. D lives i... | [{"type": "stdin_stdout", "input": "3 3 3 2\n1 2 3 1 1\n1 3 8 1 1\n2 3 3 2 2\n1 3\n0\n3 3 2 2\n1 2 3 1 1\n1 3 8 1 1\n2 3 3 2 2\n1 3\n0\n12 4 3 2\n1 2 3 1 1\n1 3 8 1 1\n4 11 3 2 2\n5 6 7 2 2\n1 6\n0\n3 3 3 2\n1 2 3 1 1\n1 3 8 1 1\n2 3 3 1 2\n1 3\n2\n2 6 1 2\n1 2 2\n3 3 2 2\n1 2 3 1 1\n1 3 8 1 1\n2 3 3 1 2\n1 3\n2\n2 6 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nC --Misawa's rooted tree\n\nProblem Statement\n\nYou noticed that your best friend Misawa's birthday was near, and decided to give him a rooted binary tree as a gift. Here, the rooted binary tree has the following graph s... | [{"type": "stdin_stdout", "input": "((()[1]())[2]())[5](((()[2]())[6](()[3]()))[8]()(\n(()[4]())[3](((()[2]())[1]())[8](()[4]')))", "output": "(()[6]())[8](((()[4]())[7]())[16]())\n"}, {"type": "stdin_stdout", "input": "((()[8]())[2]())[5](((()[3]())[6](()[3]()))[2]())\n(()[4]())[2](((()[2]())[1]())[8](()[3]())(", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNotes\n\nTemplate in C\n\nConstraints\n\n2 ≤ the number of operands in the expression ≤ 100\n1 ≤ the number of operators in the expression ≤ 99\n-1 × 109 ≤ values in the stack ≤ 109\n\nInput\n\nAn expression is given in a... | [{"type": "stdin_stdout", "input": "1 1 + 5 11 - *", "output": "-12\n"}, {"type": "stdin_stdout", "input": "0 0 + 6 21 - +", "output": "-15\n"}, {"type": "stdin_stdout", "input": "1 12 + 3 8 - *", "output": "-65\n"}, {"type": "stdin_stdout", "input": "1 0 + 6 21 - +", "output": "-14\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a list of student test scores and evaluates the performance for each student.\n\nThe test scores for a student include scores of the midterm examination m (out of 50), the final examination f (... | [{"type": "stdin_stdout", "input": "92 101 -1\n16 30 -1\n0 2 -1\n-1 -1 -1", "output": "A\nD\nF\n"}, {"type": "stdin_stdout", "input": "150 64 -2\n16 30 -1\n1 0 -1\n-1 -1 -1", "output": "A\nD\nF\n"}, {"type": "stdin_stdout", "input": "116 100 -1\n16 50 -1\n1 1 0\n-1 -1 -1", "output": "A\nB\nF\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJohn Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was fo... | [{"type": "stdin_stdout", "input": "18\n68 32 84 6\n44 53 11 21\n61 34 77 82\n19 36 47 58\n47 73 31 96\n17 50 82 16\n57 90 64 8\n14 37 45 69\n48 1 18 58\n42 34 96 14\n56 82 33 77\n40 66 30 53\n33 31 44 95\n0 90 24 8\n7 85 39 1\n76 77 93 35\n98 9 62 13\n24 84 60 51\n", "output": "8\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two bus stops denoted A and B, and there n buses that go from A to B every day. The shortest path from A to B takes t units of time but some buses might take longer paths. Moreover, buses are allowed to overtake... | [{"type": "stdin_stdout", "input": "2 1000000000\n1 1000000000\n2 2\n", "output": "Yes\n 2000000000 2000000001"}, {"type": "stdin_stdout", "input": "2 10\n4 5\n2 2\n", "output": "Yes\n ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday is tuesday, that means there is a dispute in JOHNNY SOLVING team again: they try to understand who is Johnny and who is Solving. That's why guys asked Umnik to help them. Umnik gave guys a connected graph with n ver... | [{"type": "stdin_stdout", "input": "15 34 2\n1 8\n2 8\n3 8\n4 8\n5 8\n6 8\n7 8\n9 8\n10 8\n11 8\n12 8\n13 8\n14 8\n15 8\n1 9\n3 9\n5 9\n7 9\n11 9\n13 9\n15 9\n1 5\n13 5\n3 11\n7 11\n15 11\n2 10\n4 10\n6 10\n12 10\n14 10\n2 6\n12 6\n4 14\n", "output": "CYCLES\n5\n14 4 10 2 8\n5\n12 6 10 2 8\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven two integers n and x, construct an array that satisfies the following conditions: \n\n * for any element a_i in the array, 1 ≤ a_i<2^n; \n * there is no non-empty subsegment with [bitwise XOR](https://en.wikipedia... | [{"type": "stdin_stdout", "input": "16 210\n", "output": "32767\n1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 63 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 127 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 63 1 3 1 7 1 3 1 15 1 3 1 7 1 3 1 31 1 3 1 7 1 3 1 15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMarcin is a coach in his university. There are n students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.\n\nLet's focus on the stud... | [{"type": "stdin_stdout", "input": "10\n206158430208 206162624513 68719476737 137506062337 206162624513 4194305 68719476737 206225539072 137443147777 109376694609\n202243898 470292528 170057449 290025540 127995253 514454151 607963029 768676450 611202521 68834463\n", "output": "2704208829\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0, 0) on an infinite grid.\n\nYou also have the sequence of instructions of this robot. It is written as the string s consist... | [{"type": "stdin_stdout", "input": "6\nLRU\nDURLDRUDRULRDURDDL\nLRUDDLRUDRUL\nLLLLRRRR\nURDUR\nLLL\n", "output": "2\nLR\n14\nLLLUUUURRRDDDD\n12\nLLLUUURRRDDD\n2\nLR\n2\nUD\n0\n\n"}, {"type": "stdin_stdout", "input": "6\nLRU\nDURLDRUDRULRDURDDL\nLRUDDLRUDRUL\nLLLLRRRR\nURDUR\nLLL\n", "output": "2\nLR\n14\nLLLUUUURRRDDDD... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings s and t consisting of lowercase Latin letters. Also you have a string z which is initially empty. You want string z to be equal to string t. You can perform the following operation to achieve thi... | [{"type": "stdin_stdout", "input": "11\nb\naaaaaaaaaaa\ncba\nabcabcabcabcabcabcabc\nbvdhsdvlbelrivbhxbhie\ny\nabacabadabacaba\nabacabadabacaba\nabacabadabacaba\nbaabaabdaa\nabbab\nbabaabaabcbabaaa\nt\nz\nu\nt\nkiihgfedcba\nabccefghijk\nabcdefghijk\nkjihgfdecba\nbba\nabaabbbb\n", "output": "-1\n15\n-1\n1\n2\n-1\n-1\n-1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is Professor R's last class of his teaching career. Every time Professor R taught a class, he gave a special problem for the students to solve. You being his favourite student, put your heart into solving it one last t... | [{"type": "stdin_stdout", "input": "70 11 17929\n10313 427 268935 211 197219 148 357 179290 97 358580 475 343 175 221 286864 429 304793 179290 189 363 221 340651 376509 453 251006 141 304793 358580 235 107574 141 358580 167 181 101469 335 286864 171 107574 105 449 358580 286864 161 286864 349 89645 197219 395 358580 23... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKaavi, the mysterious fortune teller, deeply believes that one's fate is inevitable and unavoidable. Of course, she makes her living by predicting others' future. While doing divination, Kaavi believes that magic spells c... | [{"type": "stdin_stdout", "input": "babbaaababbbbabbaaaababbbaabababbaabbaababbaaabaabbabaabbaababababbaabaaabaaaaababbaabaaaaabaabbabaaababbbb\nbbaabbbbabbbbaaaaaababbbabaaabbbbabababbbaabbbbbabaababbaabaaabaabbababababaaaaabaabbabaaabaaaaaaaaaaaaabbb\n", "output": "284471294\n"}, {"type": "stdin_stdout", "input": "cb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya very much likes playing with little Masha. Recently he has received a game called \"Zero-One\" as a gift from his mother. Petya immediately offered Masha to play the game with him.\n\nBefore the very beginnin... | [{"type": "stdin_stdout", "input": "1110110101111111001111111110111011100001110111011001011111111111011010011111?111111?011111110001010110011111010111100111?111101010011101010?011111101010111111111101111010111?1111111100110110001111101111100100110011101111011110111000111?011110?111110?1011010111101111101111010100111110... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters + and 1 into this sequence. For example, sequences (())(), () and (()(())) are regular, while )(, (() ... | [{"type": "stdin_stdout", "input": "12\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n", "output": "YES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "12\n(??)\n(??)\n(??)\n(??)\n(??)\n(??)\n(?)?\n(??)\n(??)\n(??)\n(??)\n(??)\n", "output": "YES\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a game similar to Sokoban on an infinite number line. The game is discrete, so you only consider integer positions on the line.\n\nYou start on a position 0. There are n boxes, the i-th box is on a positio... | [{"type": "stdin_stdout", "input": "1\n10 10\n-1690085822 -916138523 -582832806 -399654630 -299751944 -269053050 -220763772 115612869 134734706 330611632\n-836519191 -611761365 -306272 8975969 469083185 681128970 789056642 862703103 881641726 895240878\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n10 10\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAquaMoon has n friends. They stand in a row from left to right, and the i-th friend from the left wears a T-shirt with a number a_i written on it. Each friend has a direction (left or right). In the beginning, the directi... | [{"type": "stdin_stdout", "input": "10\n10\n6 2 1 1 1 10 10 2 10 5\n8\n1 3 1 1 4 5 4 4\n9\n14 6 9 9 2 8 7 2 2\n10\n9 4 3 3 5 4 3 10 4 5\n9\n7 5 1 7 5 5 5 5 6\n8\n8 8 4 4 7 6 2 8\n10\n6 8 1 6 8 8 5 6 8 4\n10\n5 5 5 8 3 4 3 3 10 10\n8\n1 1 3 6 6 7 1 2\n8\n4 1 3 5 3 1 3 3\n", "output": "NO\nYES\nYES\nYES\nYES\nYES\nYES\nY... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nInput\n\nThe input contains two integers a, b (1 ≤ a ≤ 10, 0 ≤ b ≤ 22·a - 1) separated by a single space.\n\nOutput\n\nOutput two integers separated by a single space.\n\nExamples\n\nInput\n\n1 0\n\n\nOutput\n\... | [{"type": "stdin_stdout", "input": "10 165056\n", "output": "391 431\n"}, {"type": "stdin_stdout", "input": "10 595169\n", "output": "619 770\n"}, {"type": "stdin_stdout", "input": "10 156555\n", "output": "468 325\n"}, {"type": "stdin_stdout", "input": "10 140634\n", "output": "323 383"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as <image>, where k is some positive integer), and the coolest numbers are those that are repr... | [{"type": "stdin_stdout", "input": "999999190\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "999999940\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "816761542\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "999887464\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "99999999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSeveral ages ago Berland was a kingdom. The King of Berland adored math. That's why, when he first visited one of his many palaces, he first of all paid attention to the floor in one hall. The floor was tiled with hexagon... | [{"type": "stdin_stdout", "input": "1000 1100 1000\n", "output": "3196901\n"}, {"type": "stdin_stdout", "input": "1000 0100 1000\n", "output": "1197901\n"}, {"type": "stdin_stdout", "input": "1000 1000 1000\n", "output": "2997001"}, {"type": "stdin_stdout", "input": "998 999 1001\n", "output": "2993002\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're given a string of lower-case Latin letters. Your task is to find the length of its longest substring that can be met in the string at least twice. These occurrences can overlap (see sample test 2).\n\nInput\n\nThe ... | [{"type": "stdin_stdout", "input": "ipsrjylhpkjvlzncfixipstwcicxqygqcfrawpzzvckoveyqhathglblhpkjvlzncfixipfajaqobtzvthmhgbuawowoknirclxg\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbffffffffffffffffffffffgffffffffffffff\n", "output": "61\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasily the bear has a favorite rectangle, it has one vertex at point (0, 0), and the opposite vertex at point (x, y). Of course, the sides of Vasya's favorite rectangle are parallel to the coordinate axes. \n\nVasya also ... | [{"type": "stdin_stdout", "input": "-1000000000 -1000000000\n", "output": "-2000000000 0 0 -2000000000 "}, {"type": "stdin_stdout", "input": "-1000000000 -999999999\n", "output": "-1999999999 0 0 -1999999999 "}, {"type": "stdin_stdout", "input": "-999999999 -1000000000\n", "output": "-1999999999 0 0 -1999999999 "}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation p is an ordered group of numbers p1, p2, ..., pn, consisting of n distinct positive integers, each is no more than n. We'll define number n as the length of permutation p1, p2, ..., pn.\n\nSimon has a positi... | [{"type": "stdin_stdout", "input": "7563 3781\n", "output": "2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKsenia has ordinary pan scales and several weights of an equal mass. Ksenia has already put some weights on the scales, while other weights are untouched. Ksenia is now wondering whether it is possible to put all the rema... | [{"type": "stdin_stdout", "input": "CKQHRUZMISGE|FBVWPXDLTJYN\nOA\n", "output": "CKQHRUZMISGEO|FBVWPXDLTJYNA\n"}, {"type": "stdin_stdout", "input": "V|CMOEUTAXBFWSK\nDLRZJGIYNQHP\n", "output": "VDLRZJGIYNQHP|CMOEUTAXBFWSK\n"}, {"type": "stdin_stdout", "input": "QWHNMALDGKTJ|\nPBRYVXZUESCOIF\n", "output": "QWHNMALDGKTJP... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new prob... | [{"type": "stdin_stdout", "input": "10 10\n3 4 2 6 1 9 0 0 8 7\n5 7\n2 6\n0 1\n5 11\n3 4\n2 5\n2 10\n4 6\n3 6\n3 7\n", "output": "0 1 1 0 0 1 0 1 0 1 "}, {"type": "stdin_stdout", "input": "10 10\n4 4 2 6 1 9 0 0 8 7\n5 7\n2 6\n0 1\n5 11\n3 4\n2 5\n2 10\n4 6\n3 6\n3 7\n", "output": "0 1 1 0 0 1 0 1 0 1 "}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have k pieces of laundry, each of which you want to wash, dry and fold. You are at a laundromat that has n1 washing machines, n2 drying machines and n3 folding machines. Each machine can process only one piece of laun... | [{"type": "stdin_stdout", "input": "10000 1000 1000 1000 1010 1000 1000\n", "output": "12100\n"}, {"type": "stdin_stdout", "input": "10000 1000 1000 1000 1010 1001 1000\n", "output": "12101\n"}, {"type": "stdin_stdout", "input": "10000 1000 1000 1000 1000 1000 1000\n", "output": "12000"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImagine a city with n horizontal streets crossing m vertical streets, forming an (n - 1) × (m - 1) grid. In order to increase the traffic flow, mayor of the city has decided to make each street one way. This means in each... | [{"type": "stdin_stdout", "input": "20 20\n<>>>>>>>><>>><>><<<>\nvv^^vv^^^^v^vv^v^^^^\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "20 20\n><<><<<<<<<>>><>>><<\n^^^^^^^^vvvv^vv^vvvv\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "20 20\n><><><><><><><><><><\n^v^v^v^v^v^v^v^v^v^v\n", "output": "Y... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a new professor of graph theory and he speaks very quickly. You come up with the following plan to keep up with his lecture and make notes.\n\nYou know two languages, and the professor is giving the lecture in th... | [{"type": "stdin_stdout", "input": "10 22\nazbrll oen\ngh vdyayei\njphveblohx vfglv\nmfyxib jepnvhcuwo\nrpikazqj uam\nl rx\nokjenof qpnyi\nj tixqrno\nod itozmfct\nikkdxmirx ev\nqexftojc p\nkdazb zjs\nmbk ykvqjrxaxu\nhbcwhouzq pwt\nmirpsz zfaegpl\nuhkkvcj rlvwj\nef iqnnwtolrc\npjzfcpmeag ecdayth\nsa qcthz\ncbfhfxi qrnbv... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is flying in the airplane. Finally, it is his favorite time — the lunchtime. The BerAvia company stewardess is giving food consecutively to all the passengers from the 1-th one to the last one. Polycarp is sittin... | [{"type": "stdin_stdout", "input": "5\n\n3 3\n1 1 1\n0 0\n0 1\n\n3 3\n1 1 1\n1 0\n2 1\n\n3 3\n1 1 1\n1 0\n0 1\n\n3 3\n1 1 1\n0 0\n1 0\n\n3 3\n1 1 1\n0 0\n1 1\n", "output": "YYY\nYYN\nYYY\nYYY\nYYY\n"}, {"type": "stdin_stdout", "input": "5\n\n3 3\n1 1 1\n0 0\n0 1\n\n3 3\n1 1 1\n1 0\n2 1\n\n3 3\n1 1 1\n1 0\n0 1\n\n3 3\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBerlanders like to eat cones after a hard day. Misha Square and Sasha Circle are local authorities of Berland. Each of them controls its points of cone trade. Misha has n points, Sasha — m. Since their subordinates consta... | [{"type": "stdin_stdout", "input": "10 10\n971 -2437\n-3336 3332\n-7503 -8713\n-9337 -9607\n-927 -9162\n-4375 -3790\n-913 -257\n-5916 5783\n5131 -7304\n9993 -9999\n-2774 8057\n8670 -7936\n8388 3302\n8718 -4865\n3329 -3334\n5088 -1539\n5050 8130\n4710 -2803\n8124 -4062\n-10000 9997\n", "output": "YES\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s and should process m queries. Each query is described by two 1-based indices li, ri and integer ki. It means that you should cyclically shift the substring s[li... ri] ki times. The queries should... | [{"type": "stdin_stdout", "input": "tcpyttzcpo\n10\n2 3 6\n2 4 1\n2 6 9\n7 10 5\n2 3 5\n4 10 6\n3 4 5\n7 9 4\n9 10 7\n2 10 8\n", "output": "ttcyopztcp\n"}, {"type": "stdin_stdout", "input": "tcpyzttcpo\n10\n2 3 6\n4 4 1\n2 6 9\n2 10 5\n2 3 5\n4 5 11\n3 4 5\n7 9 4\n9 10 7\n1 10 8\n", "output": "pccozptytt\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n<image>\n\nAs some of you know, cubism is a trend in art, where the problem of constructing volumetrical shape on a plane with a combination of three-dimensional geometric shapes comes to the fore. \n\nA famous sculptor C... | [{"type": "stdin_stdout", "input": "53\n1014364 40727 75774 243769 314 406417 5272684 14138 10640282 64955 2763 5667043 2121887 204672692 567643 60183 5183 11361359 2792918 199155 174809 16182540 21 392221 19434423 9140891 159733 15438 67903 3816799 616 429181 30392293 413992581 10847741 20771 16366654 1163 414283 1561... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Anton found a box with digits in his room. There are k2 digits 2, k3 digits 3, k5 digits 5 and k6 digits 6.\n\nAnton's favorite integers are 32 and 256. He decided to compose this integers from digits he has. He ... | [{"type": "stdin_stdout", "input": "4759823 3520376 4743363 4743363\n", "output": "1214827648\n"}, {"type": "stdin_stdout", "input": "5000000 5000000 5000000 5000000\n", "output": "1280000000\n"}, {"type": "stdin_stdout", "input": "4288078 3520376 4743363 4743363\n", "output": "1097747968\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland.\n\nNow he has a goal to replace dead light bulbs, however he doesn't know how many light bulbs fo... | [{"type": "stdin_stdout", "input": "!!!!!!!!!!!!!!!!!!Y!!!!!!!!!!!!!!!!!!B!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!G!!R!!!!!!!!!!!!\n", "output": "24 24 24 24\n"}, {"type": "stdin_stdout", "input": "!Y!!!Y!!G!!!G!!B!!R!!!!B!!!!!Y!!G!R!!!!!!!!!!!!B!!!!GY!B!!!!!YR!G!!!!!!B!Y!B!!!!!!R!G!!!!!!!G!R!!!!B\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe marmots need to prepare k problems for HC2 over n days. Each problem, once prepared, also has to be printed.\n\nThe preparation of a problem on day i (at most one per day) costs ai CHF, and the printing of a problem o... | [{"type": "stdin_stdout", "input": "13 13\n93 19 58 34 96 7 35 46 60 5 36 40 41\n57 3 42 68 26 85 25 45 50 21 60 23 79\n", "output": "1154\n"}, {"type": "stdin_stdout", "input": "13 13\n93 19 58 34 96 7 35 46 60 5 66 40 41\n57 3 42 68 26 85 25 45 50 21 60 23 79\n", "output": "1184\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk will say that a yuan for b kilos (You ... | [{"type": "stdin_stdout", "input": "50 37\n78 49\n96 4\n86 118\n28 4\n19 2\n79 43\n79 92\n95 35\n33 60\n54 84\n90 25\n2 19\n53 21\n86 52\n72 25\n6 8\n41 46\n3 68\n42 89\n33 48\n57 43\n99 45\n1 126\n38 62\n11 50\n55 84\n1 97\n12 67\n51 96\n51 7\n1 100\n79 61\n66 54\n97 93\n52 75\n80 41\n98 73\n29 28\n73 108\n24 73\n3 25... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection o... | [{"type": "stdin_stdout", "input": "100\nqn\nBE\nyN\nep\nPq\nXz\nLM\nEZ\ndb\nMn\nbn\nFe\nqA\nzc\nyq\npC\nyA\nWk\nYq\nrs\noD\nvD\nzW\nxZ\nbl\nur\nkf\ndf\nLS\nUW\nMy\nhR\nsh\nNh\nog\nCW\nor\nzo\nrO\nao\nXH\nDq\nKa\nlL\nYQ\nOh\nRZ\nAx\nta\nko\nDn\nNg\nNy\nDB\nYD\njO\nAp\nFT\noB\nNc\nwB\nHO\neW\nAc\nDr\nMt\nDf\nbF\nFP\nRa\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect.\n\nThe interior of the square is consider... | [{"type": "stdin_stdout", "input": "-17 -91 -17 -27 -81 -27 -81 -91\n-48 -21 -12 -57 -48 -93 -84 -57\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "-100 -100 -100 -99 -99 -99 -99 -100\n-10 -10 -9 -9 -10 -8 -11 -9\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-100 -100 -100 100 100 100 100 -100\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSteve Jobs' ghost has come down to BITS Pilani Hyderabad Campus, since he has heard a lot about the coding culture here. Hoping to recruit talented people to work on top-secret Apple software, he keeps a strict coding tes... | [{"type": "stdin_stdout", "input": "next\n2\nnextpermutation\nnextelement\n\nSAMPLE", "output": "nextelement\n"}, {"type": "stdin_stdout", "input": "next\n2\nnextpermutation\nnextelement\n\nSAMPEL", "output": "nextelement\n"}, {"type": "stdin_stdout", "input": "next\n3\nnextpermutation\nnexteldment\n\nSAMPLE", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\nConstraints\n\n* All values in input are integers.\n* 1 \\leq N \\leq 10^9\n* 2 \\leq K \\leq 10\n\nInput\n\nInput is given from Standard Input in ... | [{"type": "stdin_stdout", "input": "1568902019 2", "output": "31\n"}, {"type": "stdin_stdout", "input": "4000772700 2", "output": "32\n"}, {"type": "stdin_stdout", "input": "279134799 3", "output": "18\n"}, {"type": "stdin_stdout", "input": "314159265 4", "output": "15\n"}, {"type": "stdin_stdout", "input": "550505180 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchas... | [{"type": "stdin_stdout", "input": "4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n41097 1\n2\n86918 1\n3", "output": "69942\n"}, {"type": "stdin_stdout", "input": "4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3", "output": "69942"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe development of algae in a pond is as follows.\n\nLet the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:\n\n* x_{i+1} = rx_i - D\n\n\n\nYou are given r, D... | [{"type": "stdin_stdout", "input": "28 -2 -1", "output": "-26\n-726\n-20326\n-569126\n-15935526\n-446194726\n-12493452326\n-349816665126\n-9794866623526\n-274256265458726\n"}, {"type": "stdin_stdout", "input": "17 -2 -1", "output": "-15\n-253\n-4299\n-73081\n-1242375\n-21120373\n-359046339\n-6103787761\n-103764391935\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\nSnuke, an employee, would like to play with this sequence.\n\nSpecific... | [{"type": "stdin_stdout", "input": "10\n2184 2126 1721 1800 1480 2528 3360 1945 1280 1776", "output": "32\n"}, {"type": "stdin_stdout", "input": "10\n2184 2126 1721 1800 1480 2850 3360 1945 1280 1776", "output": "28\n"}, {"type": "stdin_stdout", "input": "10\n2184 2126 1721 1800 1480 2850 1620 1945 1280 1776", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs a token of his gratitude, Takahashi has decided to give his mother an integer sequence. The sequence A needs to satisfy the conditions below:\n\n* A consists of integers between X and Y (inclusive).\n* For each 1\\leq ... | [{"type": "stdin_stdout", "input": "314159265 358979323846264338", "output": "31"}, {"type": "stdin_stdout", "input": "15043200 358979323846264338", "output": "35\n"}, {"type": "stdin_stdout", "input": "12899738 158337027091717102", "output": "34\n"}, {"type": "stdin_stdout", "input": "12899738 686618920047839292", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi loves numbers divisible by 2.\n\nYou are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always u... | [{"type": "stdin_stdout", "input": "101", "output": "64\n"}, {"type": "stdin_stdout", "input": "111", "output": "64\n"}, {"type": "stdin_stdout", "input": "110", "output": "64\n"}, {"type": "stdin_stdout", "input": "121", "output": "64\n"}, {"type": "stdin_stdout", "input": "104", "output": "64\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSnuke loves flags.\n\nSnuke is placing N flags on a line.\n\nThe i-th flag can be placed at either coordinate x_i or coordinate y_i.\n\nSnuke thinks that the flags look nicer when the smallest distance between two of them... | [{"type": "stdin_stdout", "input": "22\n93 6440\n78 6647\n1028 11\n8306 9689\n798 99\n801 521\n188 206\n6079 971\n4559 209\n50 94\n92 6270\n5403 560\n803 83\n1855 99\n42 504\n75 484\n629 11\n92 122\n3359 37\n28 16\n648 14\n11 269", "output": "17\n"}, {"type": "stdin_stdout", "input": "22\n93 6440\n78 6647\n889 11\n8306... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string ... | [{"type": "stdin_stdout", "input": "EDOC6102LAVITSEF", "output": "16\n"}, {"type": "stdin_stdout", "input": "1DO2LAVI6REGE0TC", "output": "15\n"}, {"type": "stdin_stdout", "input": "VT0EGER6ICAL2OD0", "output": "10\n"}, {"type": "stdin_stdout", "input": "VV1EFFR7ICAK2OD0", "output": "11\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro is very good at 8 puzzles and always has his friends sort them out during breaks. At that time, my friend asked me, \"Can you solve more complicated puzzles?\", But I have never done other puzzles. Apparently the fri... | [{"type": "stdin_stdout", "input": "2\n1 0 3\n4 5 6 7 8\n9 0 11\n10\n0\n0 2 3\n4 5 8 7 8\n9 10 11\n0\n0\n3 10 9\n11 7 6 5 5\n3 0 1\n0\n-1", "output": "2\nNA\nNA\n"}, {"type": "stdin_stdout", "input": "2\n1 0 3\n4 5 6 7 8\n9 0 11\n10\n0\n1 2 3\n4 5 6 7 8\n9 10 11\n0\n0\n11 10 5\n3 11 6 5 4\n5 2 1\n0\n-1", "output": "2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOf the real numbers, those with a circular decimal part and those with a finite number of digits can be expressed as fractions.\n\n\n\n\nGiven a real number that can be represented by a fraction, write a program that outp... | [{"type": "stdin_stdout", "input": "3.2(145)", "output": "32113/9990\n"}, {"type": "stdin_stdout", "input": "3.3(145)", "output": "16556/4995\n"}, {"type": "stdin_stdout", "input": "5.21(43)", "output": "25811/4950\n"}, {"type": "stdin_stdout", "input": "3.3(155)", "output": "16561/4995\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe ICPC committee would like to have its meeting as soon as possible to address every little issue of the next contest. However, members of the committee are so busy maniacally developing (possibly useless) programs that... | [{"type": "stdin_stdout", "input": "3 2\n2 1 2\n-1\n3 3 8 8\n3 2\n4 1 5 0 9\n3 2 5 9\n5 2 4 5 7 12\n3 3\n0 1 4\n3 2 5 9\n2 2 4\n3 3\n2 1 1\n3 1 2 9\n2 2 4\n0 0", "output": "8\n5\n0\n1\n"}, {"type": "stdin_stdout", "input": "3 2\n2 1 2\n-1\n3 3 8 8\n3 2\n4 1 5 0 9\n3 2 5 9\n5 2 4 5 7 12\n3 3\n0 1 4\n3 2 5 9\n2 2 4\n3 3\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt was the last day of the summer camp you strayed into the labyrinth on the way to Komaba Campus, the University of Tokyo. The contest has just begun. Your teammates must impatiently wait for you. So you have to escape f... | [{"type": "stdin_stdout", "input": "6 6\n######\n#_|A%#\n#C#_|#\n#^BBa#\n#B&A##\n######\n2\n######\n#)|*.#\n#.#.|#\n#*.**#\n#...##\n$#####\n######\n#*|*.#\n#*#.|#\n#..+*#\n#..*##\n######", "output": "10\n"}, {"type": "stdin_stdout", "input": "6 6\n######\n#_|A%#\n#C#_|#\n#^BBa#\n#B&A##\n######\n2\n######\n#*|*.#\n#.#.|... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N towers in the town where Ikta lives. Each tower is given a different number from 0 to N-1, and the tower with number i is called tower i. Curious Ikta was interested in the height of the N towers and decided t... | [{"type": "stdin_stdout", "input": "7\n0 1\n0 2\n2 3\n0 4\n0 5\n0 6", "output": "2071\n"}, {"type": "stdin_stdout", "input": "7\n0 1\n0 2\n1 3\n0 4\n1 5\n0 6", "output": "1303\n"}, {"type": "stdin_stdout", "input": "7\n0 1\n0 2\n0 3\n0 4\n0 5\n0 6", "output": "4683\n"}, {"type": "stdin_stdout", "input": "7\n0 1\n0 2\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\n$ M $ students will be tested in a classroom with $ N $ seats in a straight line. Seats are numbered $ 1 \\ dots N $ from the front, and $ 1 $ per seat can seat $ 1 $ students.\n\nNow each student is sitting in... | [{"type": "stdin_stdout", "input": "2 0\n-1 -1 0 3", "output": "0\n"}, {"type": "stdin_stdout", "input": "3 0\n-1 2 -1 3", "output": "0\n"}, {"type": "stdin_stdout", "input": "11 2\n1 4 10 6", "output": "1\n"}, {"type": "stdin_stdout", "input": "10 2\n0 2 4 10", "output": "0\n"}, {"type": "stdin_stdout", "input": "3 0\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSearch trees are data structures that support dynamic set operations including insert, search, delete and so on. Thus a search tree can be used both as a dictionary and as a priority queue.\n\nBinary search tree is one of... | [{"type": "stdin_stdout", "input": "8\ninsert 30\ninsert 113\ninsert 18\ninsert 1\ninsert 20\ninsert 17\ninsert 25\nprint", "output": " 1 17 18 20 25 30 113\n 30 18 1 17 20 25 113\n"}, {"type": "stdin_stdout", "input": "8\ninsert 30\ninsert 166\ninsert 12\ninsert 1\ninsert 20\ninsert 17\ninsert 19\nprint", "output": " ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPrint all combinations which can be made by $k$ different elements from $0, 1, ..., n-1$. Note that we represent $0, 1, ... n-1$ as 00...0001, 00...0010, 00...0100, ..., 10...0000 in binary respectively and the integer re... | [{"type": "stdin_stdout", "input": "10 5", "output": "31: 0 1 2 3 4\n47: 0 1 2 3 5\n55: 0 1 2 4 5\n59: 0 1 3 4 5\n61: 0 2 3 4 5\n62: 1 2 3 4 5\n79: 0 1 2 3 6\n87: 0 1 2 4 6\n91: 0 1 3 4 6\n93: 0 2 3 4 6\n94: 1 2 3 4 6\n103: 0 1 2 5 6\n107: 0 1 3 5 6\n109: 0 2 3 5 6\n110: 1 2 3 5 6\n115: 0 1 4 5 6\n117: 0 2 4 5 6\n118: ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAs you might remember, the collector of Siruseri had ordered\na complete revision of the Voters List. He knew that constructing\nthe list of voters is a difficult task, prone to errors. Some\nvoters may have been away on ... | [{"type": "stdin_stdout", "input": "5 6 5\n23\n30\n37\n57\n90\n21 \n23 \n35 \n57 \n90 \n92 \n21 \n23 \n30 \n57 \n174", "output": "5\n21\n23\n30\n57\n90\n"}, {"type": "stdin_stdout", "input": "5 6 5\n23\n30\n42\n57\n90\n21 \n23 \n35 \n13 \n36 \n143 \n21 \n23 \n30 \n57 \n90", "output": "5\n21\n23\n30\n57\n90\n"}, {"type"... | 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\nConsider some set of distinct characters A and some string S, consisting of exactly n characters, where each character is present in A.\n\nYou are given an array of m integers b (b_1 < b_2 < ... < b_m). \n\nYou are allowe... | [{"type": "stdin_stdout", "input": "1000000000 2 2\n1 500000000\n", "output": "933660593\n"}, {"type": "stdin_stdout", "input": "1000000000 2 2\n2 500000000\n", "output": "811805447\n"}, {"type": "stdin_stdout", "input": "1000000000 2 3\n1 500000000\n", "output": "947751250\n"}, {"type": "stdin_stdout", "input": "10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're given an array a of length n. You can perform the following operations on it:\n\n * choose an index i (1 ≤ i ≤ n), an integer x (0 ≤ x ≤ 10^6), and replace a_j with a_j+x for all (1 ≤ j ≤ i), which means add x to ... | [{"type": "stdin_stdout", "input": "55\n13460 19498 67155 65091 83100 3449 65685 3094 89646 74121 34194 3875 23968 91713 89408 43745 66157 60904 60652 29654 6801 59743 78890 39765 23098 93723 14710 104238 27668 24433 7005 98614 74610 76246 51126 48500 33811 61674 79966 94097 97541 54630 3490 61580 44231 66349 5007 9621... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are playing a new famous fighting game: Kortal Mombat XII. You have to perform a brutality on your opponent's character.\n\nYou are playing the game on the new generation console so your gamepad have 26 buttons. Each ... | [{"type": "stdin_stdout", "input": "38 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 53 53 53 1 1 1 1 1 1 1 1 1 1 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "53\n"}, {"type": "stdin_stdout", "input": "38 1\n1 1 1 1 1 2 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 53 62 53 0 1 1 1 1 1 1 1 1 1 1\naaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNastya came to her informatics lesson, and her teacher who is, by the way, a little bit famous here gave her the following task.\n\nTwo matrices A and B are given, each of them has size n × m. Nastya can perform the follo... | [{"type": "stdin_stdout", "input": "4 9\n1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "6 6\n1 1 1 1 2 3\n1 1 1 2 3 1\n1 1 2 3 1 1\n1 3 2 1 1 1\n3 2 1 1 1 1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a consisting of n integers a_1, a_2, ..., a_n.\n\nYour problem is to find such pair of indices i, j (1 ≤ i < j ≤ n) that lcm(a_i, a_j) is minimum possible.\n\nlcm(x, y) is the least common multiple ... | [{"type": "stdin_stdout", "input": "4\n9999991 9999883 9999659 9999433\n", "output": "3 4\n"}, {"type": "stdin_stdout", "input": "4\n9999991 5101198 9999659 9999433\n", "output": "2 4\n"}, {"type": "stdin_stdout", "input": "3\n10000000 9999999 9999997\n", "output": "2 3\n"}, {"type": "stdin_stdout", "input": "3\n100000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe mayor of the Central Town wants to modernize Central Street, represented in this problem by the (Ox) axis.\n\nOn this street, there are n antennas, numbered from 1 to n. The i-th antenna lies on the position x_i and h... | [{"type": "stdin_stdout", "input": "40 100000\n8644 429\n97881 2766\n98955 25663\n8679 187\n54897 23213\n64306 4647\n46280 23471\n31464 3\n35532 2\n95998 1352\n28824 3\n99405 3856\n47271 13832\n66959 7\n50599 11\n70318 293\n84159 236\n10893 1914\n54437 15065\n4468 3\n91940 32106\n87980 50\n81589 378\n8783 23\n11417 690... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has n different binary words. A word called binary if it contains only characters '0' and '1'. For example, these words are binary: \"0001\", \"11\", \"0\" and \"0011100\".\n\nPolycarp wants to offer his set of n... | [{"type": "stdin_stdout", "input": "4\n4\n0001\n1000\n0011\n0111\n3\n010\n101\n0\n2\n00000\n00001\n4\n01\n001\n0001\n00001\n", "output": "1\n3\n-1\n0\n\n2\n1 2\n"}, {"type": "stdin_stdout", "input": "4\n4\n0001\n1000\n0011\n0111\n3\n010\n111\n0\n2\n00000\n00001\n4\n01\n001\n0001\n00001\n", "output": "1\n3\n-1\n0\n\n2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nINTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequenc... | [{"type": "stdin_stdout", "input": "aMCT]:0hDJ*Up5g_l:O&>>%gjQkZkb(mi&;\\7dL\"nWOGz/;,6h*@Q0R53MS2<}F~+Ms\\\"cF-lgF0>C&y7)72\\.T\"8*#VO=|^OtYs\n", "output": "122\n212\n240\n152\n112\n94\n80\n246\n244\n208\n254\n170\n156\n98\n198\n236\n196\n218\n106\n142\n232\n0\n216\n190\n144\n204\n180\n124\n132\n144\n50\n94\n32\n50\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array a of length 2^n. You should process q queries on it. Each query has one of the following 4 types: \n\n 1. Replace(x, k) — change a_x to k; \n 2. Reverse(k) — reverse each subarray [(i-1) ⋅ 2^k+1, ... | [{"type": "stdin_stdout", "input": "3 8\n7 0 3 15 7 1 5 2\n4 3 7\n2 1\n3 2\n4 1 6\n2 3\n1 5 16\n4 8 8\n3 0\n", "output": "31\n22\n1\n"}, {"type": "stdin_stdout", "input": "3 8\n7 0 8 8 7 1 5 2\n4 3 7\n2 1\n3 2\n4 1 6\n2 3\n1 5 16\n4 8 8\n3 0\n", "output": "29\n22\n1\n"}, {"type": "stdin_stdout", "input": "3 8\n4 0 8 8 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers ... | [{"type": "stdin_stdout", "input": "5 5\n4\nacxxay\nasuuswzxyzwvxvwcbuvtxw\nasxyabczbusyscuatbuzczx\nazvwtyvxcsbcwuyvbzyubz\naayxsvzbyvzbsaxccwxwzbcuwcuy\n0\ncctzttazzwytuxzttxwbvzbsvy\ncbwzsbsb\nca\nucwzvwv\nuatxuabttcxcysvuzywwxa\n1\nbvyyusbcuwactubtasbcbbcvwsawt\nwwbyzza\nwacsuvyaxvvvx\nwawccbzxcybzwbavcs\nwvbycwsxc... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.