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\nVasya has recently found out what a digital root of a number is and he decided to share his knowledge with you.\n\nLet's assume that S(n) is the sum of digits of number n, for example, S(4098) = 4 + 0 + 9 + 8 = 21. Then t... | [{"type": "stdin_stdout", "input": "4898 3\n", "output": "3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array $a$ of $n$ integers. You are asked to find out if the inequality $$\\max(a_i, a_{i + 1}, \\ldots, a_{j - 1}, a_{j}) \\geq a_i + a_{i + 1} + \\dots + a_{j - 1} + a_{j}$$ holds for all pairs of indice... | [{"type": "stdin_stdout", "input": "5\n19\n1 1 -1 -1 -1 0 -1 -1 1 -1 -1 1 0 1 0 -1 0 -1 -1\n11\n1 0 1 0 -1 1 -1 -1 -1 1 0\n58\n1 0 0 -1 -1 0 1 0 1 0 1 -1 1 1 0 0 1 -1 -1 1 -1 1 -1 -1 1 -1 0 1 0 0 0 0 -1 -1 0 0 0 1 0 0 1 -1 0 0 0 -1 0 0 1 -1 0 -1 1 1 -1 0 0 1\n2\n0 0\n10\n0 -1 1 -1 1 -1 0 0 1 0\n", "output": "NO\nNO\nNO... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDeveloping tools for creation of locations maps for turn-based fights in a new game, Petya faced the following problem.\n\nA field map consists of hexagonal cells. Since locations sizes are going to be big, a game designe... | [{"type": "stdin_stdout", "input": "-1000000000 -1000000000 1000000000 1000000000\n", "output": "2000000002000000001"}, {"type": "stdin_stdout", "input": "-1000000000 -1000000000 1000000000 1000000000\n", "output": "2000000002000000001"}, {"type": "stdin_stdout", "input": "-1000000000 -999999999 1000000000 999999999\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n\nThe Head Chef is receiving a lot of orders for cooking the best of the problems lately. For this, he organized an hiring event to hire some... | [{"type": "stdin_stdout", "input": "2\n1\n210", "output": "0\n2628\n"}, {"type": "stdin_stdout", "input": "2\n1\n198", "output": "0\n2484\n"}, {"type": "stdin_stdout", "input": "2\n1\n175", "output": "0\n2288\n"}, {"type": "stdin_stdout", "input": "2\n2\n175", "output": "2\n2288\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIT City company developing computer games decided to upgrade its way to reward its employees. Now it looks the following way. After a new game release users start buying it actively, and the company tracks the number of s... | [{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "228571428571428571\n"}, {"type": "stdin_stdout", "input": "1000000010000000000\n", "output": "228571430857142858\n"}, {"type": "stdin_stdout", "input": "1334196189585702396\n", "output": "304959129048160547\n"}, {"type": "stdin_stdout", "input": "13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbr... | [{"type": "stdin_stdout", "input": "50\nagecd\ncghafi\nfiide\niecc\njbdcfjhgd\ndiee\nhfeg\nehc\ngfijgjh\ngacaifebg\ndicbbddc\nhjgciaei\njjcdh\ng\ngc\ncf\nhfdjhd\nc\nicidbec\nji\neeh\ncgeejggc\nacfd\njjg\najefdj\neghhebiic\nbih\ngbb\njjaa\nidc\ngafi\necg\ndbigbjiehj\ncedif\nahidfaaajg\nhfhhiccbgb\ndgegjgieif\nhgjebhfdc\... | 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\nOld timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?\n\nThere are $n$ stu... | [{"type": "stdin_stdout", "input": "20 4\n1\n1\n1\n1\n1\n2\n2\n2\n2\n2\n3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "20 4\n1\n1\n1\n1\n1\n2\n2\n2\n2\n2\n3\n3\n3\n3\n3\n4\n4\n4\n4\n4\n", "output": "18\n"}, {"type": "stdin_stdout", "input": "16 12\n1\n1\n1\n2\n2\n4\n3\n3\n3\n4\n4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro, a junior high school student, is working on his homework. Today's homework is to read Chinese classic texts.\n\nAs you know, Japanese language shares the (mostly) same Chinese characters but the order of words is a ... | [{"type": "stdin_stdout", "input": "6\nonetwo2\n-\nonetwo1\nonetwo2\n-\nonetwo1\n7\nv\ntopbottom2\nonetwo2\n-\nonetwo1\ntopbottom1\n-\n6\nbaz2\nfoo2\nbaz1v\nbar1\nfoo1\nbar1\n0", "output": "2\n3\n1\n5\n6\n4\n4\n5\n3\n6\n2\n1\n7\n4\n3\n1\n5\n2\n6\n"}, {"type": "stdin_stdout", "input": "6\nonetwo2\n-\nonetwo1\nonetwo1\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, ... | [{"type": "stdin_stdout", "input": "16090 15931\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is a harder version of the problem. In this version, $n \\le 50\\,000$.\n\nThere are $n$ distinct points in three-dimensional space numbered from $1$ to $n$. The $i$-th point has coordinates $(x_i, y_i, z_i)$. The nu... | [{"type": "stdin_stdout", "input": "8\n-100000000 -100000000 -100000000\n100000000 100000000 100000000\n-100000000 100000000 100000000\n-100000000 -100000000 100000000\n100000000 100000000 -100000000\n100000000 -100000000 -100000000\n-100000000 100000000 -100000000\n100000000 -100000000 100000000\n", "output": "1 4\n7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nReading books is one of Sasha's passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: \"Many are my names in many countries. Mithrandir a... | [{"type": "stdin_stdout", "input": "tttdddssstttssstttdddddddddttttttdddsssdddtttsssdddsssssstttddddddtttdddssstttsssttttttdddtttsssssstttssssssssstttsssssstttssstttdddddddddsssdddssssssdddssstttsssdddssstttdddttttttdddddddddsssssstttdddtttssssssdddddddddttttttdddtttsssdddssstttsssdddssssssdddsssdddddddddtttssstttsssss... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro is not good at hide-and-seek. As soon as you hide, you will find it, and it will be difficult to find the hidden child. My father, who couldn't see it, made an ultra-high performance location search system. You can u... | [{"type": "stdin_stdout", "input": "3\n6 6 3\n19 19 6\n42 10 1\n6\n5 2 2 11\n12 7 2 11\n11 9 1 11\n14 2 22 5\n17 9 20 5\n20 10 20 5\n0", "output": "Safe\nDanger\nDanger\nDanger\nDanger\nDanger\n"}, {"type": "stdin_stdout", "input": "3\n6 2 16\n40 7 8\n42 8 1\n6\n5 3 4 11\n12 4 2 15\n16 2 0 11\n28 2 31 5\n17 9 41 5\n24 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnton has the integer x. He is interested what positive integer, which doesn't exceed x, has the maximum sum of digits.\n\nYour task is to help Anton and to find the integer that interests him. If there are several such i... | [{"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "999999999999999999\n"}, {"type": "stdin_stdout", "input": "1000000000000000000\n", "output": "999999999999999999\n"}, {"type": "stdin_stdout", "input": "978916546899999999\n", "output": "899999999999999999\n"}, {"type": "stdin_stdout", "input": "999... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The buns aren't ready yet and the line is undergoing some changes.\n\nEach second all boys that stand right in front of... | [{"type": "stdin_stdout", "input": "MFFFMMFMFMFMFFFMMMFFMMMMMMFMMFFMMMFMMFMFFFMMFMMMFFMMFFFFFMFMFFFMMMFFFMFMFMFMFFFMMMMFMMFMMFFMMMMMMFFM\n", "output": "54\n"}, {"type": "stdin_stdout", "input": "MMMMMFFMFMFMFMMFMMFFMMFMFFFFFFFMFFFMMMMMMFFMMMFMFMMFMFFMMFMMMFFFFFMMMMMFMMMMFMMMFFMFFMFFFMFFMFFMMFFM\n", "output": "58\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sequence $(b_1, b_2, \\ldots, b_k)$ is called strange, if the absolute difference between any pair of its elements is greater than or equal to the maximum element in the sequence. Formally speaking, it's strange if for ... | [{"type": "stdin_stdout", "input": "6\n4\n-1 -2 -1 1\n7\n-3 2 -2 0 -4 7 1\n5\n0 5 -3 2 -5\n3\n2 0 1\n4\n-3 -1 2 0\n6\n-3 -2 -1 1 1 1\n", "output": "3\n5\n4\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "6\n4\n-1 -2 -1 1\n7\n-3 2 -2 0 -4 7 1\n5\n0 5 -3 1 -5\n3\n2 0 1\n4\n-3 -1 2 0\n6\n-3 -2 -2 1 1 1\n", "output": "3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given three integers A, B and C.\n\nDetermine if there exists an equilateral triangle whose sides have lengths A, B and C.\n\nConstraints\n\n* All values in input are integers.\n* 1 \\leq A,B,C \\leq 100\n\nInput\... | [{"type": "stdin_stdout", "input": "-1 -1 -1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "-2 -1 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-2 -1 -2", "output": "No\n"}, {"type": "stdin_stdout", "input": "-3 10 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "-3 1 -11", "output": "N... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInna loves digit 9 very much. That's why she asked Dima to write a small number consisting of nines. But Dima must have misunderstood her and he wrote a very large number a, consisting of digits from 1 to 9.\n\nInna wants... | [{"type": "stdin_stdout", "input": "44444444444444544444444445444444444444444444444444554444444444444444444444444444444444444444455444444444444444444444444444444444444444545444444444444444444444444444444444444445444444444444444444444444444444444444544444444444444444444444444444444444444444444544444444444444444444444444... | 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\nproblem\n\nFor the integer n (1 ≤ n), let Pn be a string of n + 1 I's and n O's starting with I and alternating, where I and O are the uppercase Ai and O, respectively. is there.\n\n\nP1 | IOI\n--- | ---\nP2 | IOIOI\nP3 |... | [{"type": "stdin_stdout", "input": "1\n119\nOOJOIOIOIIOII\n1\n14\nKIOIIOIOIOJOO\n0", "output": "3\n3\n"}, {"type": "stdin_stdout", "input": "1\n13\nOIIOIOIOIIOIO\n2\n13\nOOIOIOIOIIOII\n0", "output": "4\n2\n"}, {"type": "stdin_stdout", "input": "1\n13\nOOIOIOIOIIOII\n3\n13\nOOIOIOIOIIOII\n0", "output": "4\n1\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGottfried learned about binary number representation. He then came up with this task and presented it to you.\n\nYou are given a collection of $n$ non-negative integers $a_1, \\ldots, a_n$. You are allowed to perform the ... | [{"type": "stdin_stdout", "input": "37\n1048575 327657 1046479 686078 513773 589787 387035 736754 1038077 1048056 59263 753353 784318 647131 519679 294910 185560 604141 456668 849789 521404 782287 6137 1047551 849874 523933 521721 278491 1042415 581468 1013705 439526 1011709 917469 655311 327646 917499\n", "output": "2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe goal of the matrix-chain multiplication problem is to find the most efficient way to multiply given $n$ matrices $M_1, M_2, M_3,...,M_n$.\n\nWrite a program which reads dimensions of $M_i$, and finds the minimum numbe... | [{"type": "stdin_stdout", "input": "6\n30 35\n35 15\n15 5\n5 10\n10 20\n20 29", "output": "16125\n"}, {"type": "stdin_stdout", "input": "6\n30 35\n35 15\n15 5\n5 10\n10 20\n20 27", "output": "15625\n"}, {"type": "stdin_stdout", "input": "6\n30 35\n35 15\n15 5\n5 10\n10 20\n20 47", "output": "20625\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPrint all subsets of a set $S$, which contains $0, 1, ... n-1$ as elements. Note that we represent $0, 1, ... n-1$ as 00...0001, 00...0010, 00...0100, ..., 10...0000 in binary respectively and the integer representation o... | [{"type": "stdin_stdout", "input": "8", "output": "0:\n1: 0\n2: 1\n3: 0 1\n4: 2\n5: 0 2\n6: 1 2\n7: 0 1 2\n8: 3\n9: 0 3\n10: 1 3\n11: 0 1 3\n12: 2 3\n13: 0 2 3\n14: 1 2 3\n15: 0 1 2 3\n16: 4\n17: 0 4\n18: 1 4\n19: 0 1 4\n20: 2 4\n21: 0 2 4\n22: 1 2 4\n23: 0 1 2 4\n24: 3 4\n25: 0 3 4\n26: 1 3 4\n27: 0 1 3 4\n28: 2 3 4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour security guard friend recently got a new job at a new security company. The company requires him to patrol an area of the city encompassing exactly N city blocks, but they let him choose which blocks. That is, your f... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "1000000\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "999000\n", "output": "3998\n"}, {"type": "stdin_stdout", "input": "999001\n", "output": "4000\n"}, {"type": "stdin_stdout", "input": "999999\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMany countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to S... | [{"type": "stdin_stdout", "input": "8 704 99 110\n", "output": "ACACACACACACACACACACBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBA\nACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACBBBBBBBBBBBBBA\n"}, {"type": "stdin_stdout", "input": "8 66... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLogical quantifiers are very useful tools for expressing claims about a set. For this problem, let's focus on the set of real numbers specifically. The set of real numbers includes zero and negatives. There are two kinds ... | [{"type": "stdin_stdout", "input": "100 50\n55 13\n84 2\n22 63\n100 91\n2 18\n98 64\n1 86\n93 11\n17 6\n24 97\n14 35\n24 74\n22 3\n42 5\n63 79\n31 89\n81 22\n86 88\n77 51\n81 34\n19 55\n41 54\n34 57\n45 9\n55 72\n67 61\n41 84\n39 32\n51 89\n58 74\n32 79\n65 6\n86 64\n63 42\n100 57\n46 39\n100 9\n23 58\n26 81\n61 49\n71... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKawashiro Nitori is a girl who loves competitive programming.\n\nOne day she found a string and an integer. As an advanced problem setter, she quickly thought of a problem.\n\nGiven a string $s$ and a parameter $k$, you n... | [{"type": "stdin_stdout", "input": "7\n5 2\nrwrwq\n2 0\nac\n3 1\nioi\n4 0\nibdp\n22 0\ndokidoktliteraiureclub\n19 0\necilbiahgaahsmnetmi\n6 2\naaaaaa\n", "output": "NO\nYES\nYES\nYES\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "7\n5 1\nqwqwq\n2 0\nab\n3 1\nioi\n4 2\nipcc\n22 0\ncokidokiliteratureclub\n19 11\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudents in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. n of the students use pieces made of two blocks and m of the students use pieces m... | [{"type": "stdin_stdout", "input": "1000000 1000000\n", "output": "3000000\n"}, {"type": "stdin_stdout", "input": "1000000 1000000\n", "output": "3000000\n"}, {"type": "stdin_stdout", "input": "1000000 999999\n", "output": "2999998\n"}, {"type": "stdin_stdout", "input": "999999 1000000\n", "output": "3000000\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis contest, AtCoder Beginner Contest, is abbreviated as ABC.\nWhen we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.\nWhat is the abbreviatio... | [{"type": "stdin_stdout", "input": "1530", "output": "ABC1530\n"}, {"type": "stdin_stdout", "input": "2825", "output": "ABC2825\n"}, {"type": "stdin_stdout", "input": "5621", "output": "ABC5621\n"}, {"type": "stdin_stdout", "input": "-105", "output": "ABC-105\n"}, {"type": "stdin_stdout", "input": "-136", "output": "AB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGenos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as quickly as possible.\n\n... | [{"type": "stdin_stdout", "input": "50\n22 19 14 22 20 11 16 28 23 15 3 23 6 16 30 15 15 10 43 28 19 19 22 30 28 1 27 12 12 14 17 30 17 26 21 26 27 1 11 23 9 30 18 19 17 29 11 20 29 24\n", "output": "25\n"}, {"type": "stdin_stdout", "input": "50\n22 19 14 22 20 11 16 28 38 15 3 23 6 16 30 15 15 10 43 28 19 19 22 30 28 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, since it has the ability to change gravity.\n\nThere are n columns of toy cubes in the b... | [{"type": "stdin_stdout", "input": "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKoa the Koala and her best friend want to play a game.\n\nThe game starts with an array a of length n consisting of non-negative integers. Koa and her best friend move in turns and each have initially a score equal to 0. ... | [{"type": "stdin_stdout", "input": "4\n5\n4 1 5 1 4\n4\n1 0 0 12\n1\n0\n2\n5 4\n", "output": "LOSE\nWIN\nDRAW\nWIN\n"}, {"type": "stdin_stdout", "input": "4\n5\n2 1 3 1 0\n4\n1 0 1 6\n1\n0\n2\n5 4\n", "output": "LOSE\nWIN\nDRAW\nWIN\n"}, {"type": "stdin_stdout", "input": "4\n5\n4 1 5 1 4\n4\n1 0 1 12\n1\n1\n2\n5 4\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe King of a little Kingdom on a little island in the Pacific Ocean frequently has childish ideas. One day he said, “You shall make use of a message relaying game when you inform me of something.” In response to the King... | [{"type": "stdin_stdout", "input": "5\nAJMP\naB33d\nE\n86AE\nAM\n-1\nMPJE\nWaEaETC302Q\nCP\nrTurnAGumdam1isdefferentf", "output": "33Bad\nAE86\n2-\nEC302QTWaEa\nTurnAGumdam0isdefferentfr\n"}, {"type": "stdin_stdout", "input": "5\nAJMP\naB33d\nE\n86AE\nMA\n-1\nMPJE\nWaEaETC302Q\nCP\nftnereffedsi1madmuGAnruTr", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, little Vasya found himself in a maze consisting of (n + 1) rooms, numbered from 1 to (n + 1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the (n + 1)-th one.\n\nThe maze i... | [{"type": "stdin_stdout", "input": "129\n1 1 3 3 1 4 7 4 3 5 8 11 3 9 15 4 11 17 1 6 18 9 11 13 17 22 8 18 26 13 16 20 3 16 35 26 23 28 27 30 39 29 43 8 14 6 17 32 26 31 2 18 3 47 52 21 57 1 35 35 53 47 16 26 30 65 48 2 32 11 10 5 4 1 4 53 71 21 53 8 58 49 17 6 19 80 1 49 43 60 12 60 35 25 86 45 47 97 52 74 10 91 93 31... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo stay woke and attentive during classes, Karen needs some coffee! [Image] \n\nKaren, a coffee aficionado, wants to know the optimal temperature for brewing the perfect cup of coffee. Indeed, she has spent some time read... | [{"type": "stdin_stdout", "input": "3 2 4\n91 288\n92 97\n116 271\n92 192\n93 97\n95 138\n90 100\n", "output": "83\n5\n26\n6\n"}, {"type": "stdin_stdout", "input": "3 2 4\n91 510\n92 97\n66 271\n51 94\n93 97\n95 316\n100 111\n", "output": "4\n5\n177\n12\n"}, {"type": "stdin_stdout", "input": "3 2 4\n91 288\n92 97\n116 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are some beautiful girls in Arpa’s land as mentioned before.\n\nOnce Arpa came up with an obvious problem:\n\nGiven an array and a number x, count the number of pairs of indices i, j (1 ≤ i < j ≤ n) such that $a_{i}... | [{"type": "stdin_stdout", "input": "64 118\n361 547 410 294 448 377 482 490 13 116 346 50 251 330 443 128 543 580 370 489 337 509 414 291 228 71 245 308 319 314 154 39 317 288 145 248 547 152 262 278 89 108 522 238 128 575 112 469 86 230 310 492 127 270 475 25 179 72 345 444 17 332 544 338\n", "output": "3\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValentin participates in a show called \"Shockers\". The rules are quite easy: jury selects one letter which Valentin doesn't know. He should make a small speech, but every time he pronounces a word that contains the sele... | [{"type": "stdin_stdout", "input": "15\n. r\n? e\n. s\n. rw\n? y\n. fj\n. zftyd\n? r\n! wq\n? w\n? p\n. ours\n. dto\n. lbyfru\n? q\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "8\n! hello\n! codeforces\n? c\n. o\n? d\n? h\n. l\n? e\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "7\n! ababahalamaha\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nA programming contest will be held in the Russian Federation. The contest has N questions and has M participants. Question i has a score a_i, and it is known that participant j's ability is b_j. For p... | [{"type": "stdin_stdout", "input": "6\n1 2 0 15 0 2\n7\n2 5 4 2 6 1 0\n1 28 1 3 5 1 0", "output": "Yes\nNo\nYes\nYes\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "6\n1 1 0 15 0 3\n7\n2 5 4 2 10 1 0\n1 28 1 3 0 1 0", "output": "Yes\nNo\nYes\nNo\nYes\nYes\nYes\n"}, {"type": "stdin_stdout", "input": "6\n1 2 0 15 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ab... | [{"type": "stdin_stdout", "input": "atcoderandatcodeer\n5\n", "output": "andat\n"}, {"type": "stdin_stdout", "input": "atcoderamdatcodeer\n5", "output": "amdat\n"}, {"type": "stdin_stdout", "input": "roddadtadmaoefectr\n5", "output": "admao\n"}, {"type": "stdin_stdout", "input": "atcoderamdascodeer\n5", "output": "amda... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an array A of N numbers, find the number of distinct pairs (i, j) such that j ≥i and A[i] = A[j].\n\nFirst line of the input contains number of test cases T. Each test case has two lines, first line is the number N,... | [{"type": "stdin_stdout", "input": "10\n807\n935399 145100 -386862 856283 628359 256963 -461034 935399 776945 -759500 -759500 935399 -967263 649644 -24686 -452785 -352467 688773 908612 -386862 -479957 -146506 439811 -506538 -146506 145100 -461034 935399 -352307 -181185 740341 740341 439811 742466 -854789 700140 -740255... | 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\nYou are given a sequence $a$ consisting of $n$ positive integers.\n\nLet's define a three blocks palindrome as the sequence, consisting of at most two ... | [{"type": "stdin_stdout", "input": "6\n8\n1 1 4 2 1 2 1 1\n3\n1 3 12\n4\n1 10 10 1\n1\n26\n2\n2 4\n3\n2 1 1\n", "output": "6\n1\n4\n1\n1\n2\n"}, {"type": "stdin_stdout", "input": "6\n8\n1 1 2 2 3 2 1 1\n3\n1 3 3\n4\n1 10 10 1\n1\n26\n2\n2 1\n3\n1 1 1\n", "output": "7\n2\n4\n1\n1\n3\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA permutation is a sequence of integers from $1$ to $n$ of length $n$ containing each number exactly once. For example, $[1]$, $[4, 3, 5, 1, 2]$, $[3, 2, 1]$ — are permutations, and $[1, 1]$, $[4, 3, 1]$, $[2, 3, 4]$ — no... | [{"type": "stdin_stdout", "input": "5 4\n1 2 5\n2 3\n1 1 3\n1 3 4\n", "output": "14\n7\n9\n"}, {"type": "stdin_stdout", "input": "4 4\n1 2 4\n2 3\n1 1 2\n1 1 4\n", "output": "9\n4\n10\n"}, {"type": "stdin_stdout", "input": "5 4\n1 1 4\n2 5\n1 1 2\n1 3 4\n", "output": "10\n3\n9\n"}, {"type": "stdin_stdout", "input": "5 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Vasya and Petya assembled a figure of m cubes, each of them is associated with a number between 0 and m - 1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the OX is the g... | [{"type": "stdin_stdout", "input": "25\n-611859852 0\n-611859842 0\n-611859837 0\n-611859843 0\n-611859863 0\n-611859851 0\n-611859857 0\n-611859858 0\n-611859845 0\n-611859865 0\n-611859836 0\n-611859839 0\n-611859850 0\n-611859854 0\n-611859838 0\n-611859840 0\n-611859860 0\n-611859853 0\n-611859848 0\n-611859844 0\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBessie the cow has just intercepted a text that Farmer John sent to Burger Queen! However, Bessie is sure that there is a secret message hidden inside.\n\nThe text is a string $s$ of lowercase Latin letters. She considers... | [{"type": "stdin_stdout", "input": "abcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklyyyyyyymnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcdefghijklzzzzzzzmnopqrstuvwxabcde... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKoa the Koala has a binary string $s$ of length $n$. Koa can perform no more than $n-1$ (possibly zero) operations of the following form:\n\nIn one operation Koa selects positions $i$ and $i+1$ for some $i$ with $1 \\le i... | [{"type": "stdin_stdout", "input": "0100111100100101001101111001011101011001111100110111101110001001010111100010011100011011101111010111111010010101000001110110111110010001100010101110111111000011101110000000001101010011000111111100000000000000001010011111010111\n", "output": "975171002\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a string $s$ of length $n$ consisting only of digits 0 and 1. Also he has an array $a$ of length $n$. \n\nVasya performs the following operation until the string becomes empty: choose some consecutive substring ... | [{"type": "stdin_stdout", "input": "99\n101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1000000000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Japan, people make offerings called hina arare, colorful crackers, on March 3.\nWe have a bag that contains N hina arare. (From here, we call them arare.)\nIt is known that the bag either contains arare in three colors... | [{"type": "stdin_stdout", "input": "100\nP P P G G P P P G G P P G G P G W G W G G G P G P P G P P P G G G P P G P G P P G P P G G G W G G G P P P W G P G G P G G G G G P P W P G G G G G P P G G P G P G G G G P G G G G W P G P P P G G P G P\n", "output": "Three\n"}, {"type": "stdin_stdout", "input": "100\nG G G G G W W... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese , Russian and Vietnamese as well. \n\nSergey has made N measurements. Now, he wants to know the average value of the measurements made.\n\nIn order to make the average value a ... | [{"type": "stdin_stdout", "input": "3\n5 2\n1 9 -9 25 1\n5 1\n4 17 -10 25 2\n3 0\n1 0 0", "output": "1.0\n7.66666666667\n0.333333333333\n"}, {"type": "stdin_stdout", "input": "3\n5 1\n1 9 -19 52 1\n5 0\n3 9 -10 25 0\n3 0\n0 1 1", "output": "3.66666666667\n5.4\n0.666666666667\n"}, {"type": "stdin_stdout", "input": "3\n5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef loves arrays. But he really loves a specific kind of them - Rainbow Arrays. \nThe array is a Rainbow Array if it has such a structure:\n- The first a1 elements equal to 1. \n- The next a2 elements equal to 2. \n- Th... | [{"type": "stdin_stdout", "input": "1018", "output": "857373624\n"}, {"type": "stdin_stdout", "input": "200", "output": "120529249\n"}, {"type": "stdin_stdout", "input": "140", "output": "119877472\n"}, {"type": "stdin_stdout", "input": "320", "output": "398506989\n"}, {"type": "stdin_stdout", "input": "147", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJulia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.\n\nDuring cooking, Julia goes to the kitchen every d min... | [{"type": "stdin_stdout", "input": "312200625484460654 543737694709247394 1000000000000000000\n", "output": "\n1231537069224786756.000000000000\n"}, {"type": "stdin_stdout", "input": "81413279254461199 310548139128293806 1000000000000000000\n", "output": "\n1572837149684581510.000000000000\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese here \nRead problems statements in Russian here \n\n------ Problem Statement ------ \n\nOne day Chef is waiting his girlfriend on the bus station. The girlfriend said that she ... | [{"type": "stdin_stdout", "input": "3\n10:00\n09:00\n14\n10:00\n08:00\n151\n10:00\n09:00\n167", "output": "74.0 60.0\n271.0 211.0\n227.0 197.0\n"}, {"type": "stdin_stdout", "input": "3\n10:00\n09:00\n20\n10:00\n08:00\n151\n10:00\n09:00\n167", "output": "80.0 60.0\n271.0 211.0\n227.0 197.0\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially ever... | [{"type": "stdin_stdout", "input": "104 54\n683 252 125 813 874 835 651 424 826 139 397 323 143 153 326 941 536 435 317 854 353 222 851 591 420 415 190 872 178 311 612 635 174 505 153 81 559 815 805 414 378 62 75 929 208 942 254 670 329 671 127 494 504 618 292 699 203 959 218 788 285 602 83 104 41 562 272 806 4 582 780... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGoldbach's Conjecture: For any even number n greater than or equal to 4, there exists at least one pair of prime numbers p1 and p2 such that n = p1 + p2.\n\nThis conjecture has not been proved nor refused yet. No one is s... | [{"type": "stdin_stdout", "input": "6\n10\n14\n0", "output": "1\n2\n2\n"}, {"type": "stdin_stdout", "input": "6\n1\n12\n0", "output": "1\n0\n1\n"}, {"type": "stdin_stdout", "input": "6\n10\n8\n0", "output": "1\n2\n1\n"}, {"type": "stdin_stdout", "input": "6\n4\n12\n0", "output": "1\n1\n1\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are N positive integers A_1,...,A_N.\nConsider positive integers B_1, ..., B_N that satisfy the following condition.\nCondition: For any i, j such that 1 \\leq i < j \\leq N, A_i B_i = A_j B_j holds.\nFind the minim... | [{"type": "stdin_stdout", "input": "10000\n996426 991040 991394 993249 993789 994392 991787 998270 994534 999447 995337 997096 996535 997215 994454 999779 998240 991404 991682 999870 990794 994313 993602 993869 997730 991987 994764 993847 993506 990653 996555 994126 992060 995401 997275 995702 995833 993070 990511 9917... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian. \n\nChef is on a vacation these days, so his friend Chefza is trying to solve Chef's everyday tasks.\nToday's task is to make a sweet roll. Rolls are made by a ne... | [{"type": "stdin_stdout", "input": "6\n1 1\n2 4\n3 16\n4 16\n4 1\n1 4", "output": "0\n1\n5\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "6\n2 1\n2 1\n3 8\n14 16\n1 1\n2 4", "output": "1\n1\n4\n7\n0\n1\n"}, {"type": "stdin_stdout", "input": "6\n1 2\n2 4\n5 4\n16 32\n3 2\n1 8", "output": "1\n1\n2\n1\n2\n3\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have two variables a and b. Consider the following sequence of actions performed with these variables: If a = 0 or b = 0, end the process. Otherwise, go to step 2; If a ≥ 2·b, then set the value of a to a - 2·b, and r... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "1000000000000000000 1000000000000000000\n"}, {"type": "stdin_stdout", "input": "1100000000000000000 1000000000000000000\n", "output": "1100000000000000000 1000000000000000000\n"}, {"type": "stdin_stdout", "input": "11000000000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe problem uses a simplified TCP/IP address model, please make sure you've read the statement attentively.\n\nPolycarpus has found a job, he is a system administrator. One day he came across n IP addresses. Each IP addre... | [{"type": "stdin_stdout", "input": "15 8\n244.1.125.160\n39.50.68.162\n142.253.101.137\n52.239.241.147\n194.4.189.143\n200.238.160.30\n245.78.177.243\n89.249.140.19\n169.51.142.22\n123.246.20.99\n133.44.192.119\n226.240.179.30\n76.209.211.184\n98.15.6.117\n227.219.117.153\n", "output": "-1\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integer numbers, $n$ and $x$. You may perform several operations with the integer $x$.\n\nEach operation you perform is the following one: choose any digit $y$ that occurs in the decimal representation o... | [{"type": "stdin_stdout", "input": "19 100000000000000000\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "19 522119050105040403\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "19 999999999999999999\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "19 11111111111111111\n", "output": "-1\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven are N integers A_1,\\ldots,A_N.\nFind the sum of A_i \\times A_j over all pairs (i,j) such that 1\\leq i < j \\leq N, modulo (10^9+7).\n\n-----Constraints-----\n - 2 \\leq N \\leq 2\\times 10^5\n - 0 \\leq A_i \\leq... | [{"type": "stdin_stdout", "input": "4\n141421356 17320508 22360679 244949\n", "output": "437235829\n"}, {"type": "stdin_stdout", "input": "4\n141421356 17320508 22360679 176612", "output": "432841470\n"}, {"type": "stdin_stdout", "input": "4\n141421356 17320508 44188846 176612", "output": "442072669\n"}, {"type": "stdi... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJoisino is planning to open a shop in a shopping street.\nEach of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole peri... | [{"type": "stdin_stdout", "input": "3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 0 1 0 1 0\n1 0 1 1 0 0 0 1 0 1\n-8 6 -2 -11 -12 4 14 9 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 9 -9 12 -5 8 0 -9 -7 -7", "output": "33\n"}, {"type": "stdin_stdout", "input": "3\n1 1 1 1 1 1 0 0 0 0\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA rectangle with sides $A$ and $B$ is cut into rectangles with cuts parallel to its sides. For example, if $p$ horizontal and $q$ vertical cuts were made, $(p + 1) \\cdot (q + 1)$ rectangles were left after the cutting. A... | [{"type": "stdin_stdout", "input": "2\n2 2 20\n2 10 40\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "2\n2 2 20\n1 10 11\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2\n2 2 35\n1 10 11\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2\n2 3 20\n2 4 40\n", "output": "6\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider a tunnel on a one-way road. During a particular day, $n$ cars numbered from $1$ to $n$ entered and exited the tunnel exactly once. All the cars passed through the tunnel at constant speeds.\n\nA traffic enforceme... | [{"type": "stdin_stdout", "input": "7\n5 2 3 6 7 1 4\n2 3 6 7 1 4 5\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "7\n5 2 3 6 7 1 4\n2 3 6 7 1 4 5\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "5\n3 5 2 1 4\n4 3 2 5 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n3 5 2 1 4\n4 3 2 5 1\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n banks in the city where Vasya lives, they are located in a circle, such that any two banks are neighbouring if their indices differ by no more than 1. Also, bank 1 and bank n are neighbours if n > 1. No bank i... | [{"type": "stdin_stdout", "input": "50\n108431864 128274949 -554057370 -384620666 -202862975 -803855410 -482167063 -55139054 -215901009 0 0 0 0 0 94325701 730397219 358214459 -673647271 -131397668 -377892440 0 0 0 0 0 -487994257 -360271553 639988328 489338210 -281060728 250208758 0 993242346 -213071841 -59752620 -86435... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an undirected graph consisting of $n$ vertices and $n$ edges, where $n$ is divisible by $6$. Each edge has a weight, which is a positive (greater than zero) integer.\n\nThe graph has the following structure:... | [{"type": "stdin_stdout", "input": "18\n626 619 11 809 967 233 474 747 648 256 397 174 705 695 520 682 402 925\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "18\n58 40 14 8 86 29 5 50 24 42 96 53 72 54 95 62 30 77\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "18\n5 8 3 8 9 10 7 10 2 7 3 2 1 10 7 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n servers in a laboratory, each of them can perform tasks. Each server has a unique id — integer from 1 to n.\n\nIt is known that during the day q tasks will come, the i-th of them is characterized with three in... | [{"type": "stdin_stdout", "input": "1 10\n4 1 1\n9 1 1\n10 1 1\n12 1 1\n13 1 1\n15 1 1\n16 1 1\n18 1 1\n19 1 1\n20 1 1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "1 10\n4 1 1\n9 1 1\n10 1 1\n12 1 1\n13 1 1\n15 1 1\n16 1 1\n18 1 1\n19 1 1\n20 1 1\n", "output": "1\n1\n1\n1\n1\n1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined... | [{"type": "stdin_stdout", "input": "10\n669924290 408119795 804030560\n663737793 250734602 29671646\n431160679 146708815 289491233\n189259304 606497663 379372476\n707829111 49504411 81710658\n54555019 65618101 626948607\n578351356 288589794 974275296\n400531973 205638174 323247740\n219131617 178762989 799964854\n825160... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x_1, x_2, ..., x_{k} (k > 1) is such maximum element x_{j}, that the following inequality h... | [{"type": "stdin_stdout", "input": "10\n29272229 8752316 10025994 52398694 16706314 49609605 28150935 102254532 44865054 87041483\n", "output": "129354579\n"}, {"type": "stdin_stdout", "input": "10\n4547989 39261040 185956581 38131456 26174500 1101740 71295827 77784626 155701452 61318416\n", "output": "263691991\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHolidays are coming up really soon. Rick realized that it's time to think about buying a traditional spruce tree. But Rick doesn't want real trees to get hurt so he decided to find some in an $n \\times m$ matrix consisti... | [{"type": "stdin_stdout", "input": "6\n4 7\n...*...\n..***..\n.****..\n*******\n6 10\n....*.*...\n...*****..\n..*******.\n.********.\n********.*\n**********\n5 5\n*...*\n**.**\n*****\n**.**\n*...*\n5 6\n.*....\n.**...\n.***..\n.****.\n.*****\n3 3\n*.*\n...\n*.*\n2 4\n.**.\n****\n", "output": "24\n89\n19\n22\n4\n8\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya and Vasya arranged a game. The game runs by the following rules. Players have a directed graph consisting of n vertices and m edges. One of the vertices contains a chip. Initially the chip is located at vertex s. Pl... | [{"type": "stdin_stdout", "input": "92 69\n1 76\n1 14\n1 15\n0\n1 46\n1 80\n0\n0\n1 77\n0\n1 53\n1 81\n1 61\n1 40\n0\n1 20\n1 71\n1 24\n1 54\n1 82\n1 23\n0\n1 63\n1 25\n1 38\n1 68\n0\n1 65\n0\n1 76\n1 55\n1 87\n1 1\n1 37\n1 68\n1 30\n1 17\n1 19\n0\n1 16\n1 69\n0\n1 60\n1 86\n0\n1 44\n1 32\n1 10\n1 8\n0\n0\n0\n0\n0\n1 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nI, Fischl, Prinzessin der Verurteilung, descend upon this land by the call of fate an — Oh, you are also a traveler from another world? Very well, I grant you permission to travel with me.\n\nIt is no surprise Fischl spea... | [{"type": "stdin_stdout", "input": "3\n28\nqaabzwsxedcrfvtgbyhnujmiklop\n13\ncleanairactbd\n10\naannttoonn\n", "output": "\nac\nf\nb\n"}, {"type": "stdin_stdout", "input": "4\n5\noisha\n10\niloveoisha\n16\nshahromloveoisha\n16\noishaloveshahrom\n", "output": "b\nb\nb\nb\n"}, {"type": "stdin_stdout", "input": "4\n5\nais... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev decided to build a house of cards. For that they've already found a hefty deck of n playing cards. Let's describe th... | [{"type": "stdin_stdout", "input": "1000000000000\n", "output": "272165"}, {"type": "stdin_stdout", "input": "225849940487\n", "output": "129343\n"}, {"type": "stdin_stdout", "input": "542905489591\n", "output": "200537\n"}, {"type": "stdin_stdout", "input": "376593918338\n", "output": "167021\n"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have an initially empty cauldron, and you want to brew a potion in it. The potion consists of two ingredients: magic essence and water. The potion you want to brew should contain exactly $k\\ \\%$ magic essence and $(... | [{"type": "stdin_stdout", "input": "100\n2\n36\n43\n19\n99\n100\n98\n9\n79\n57\n1\n78\n56\n14\n66\n93\n62\n50\n76\n33\n25\n41\n15\n61\n97\n33\n51\n97\n95\n96\n83\n53\n12\n77\n87\n85\n37\n72\n82\n70\n44\n69\n58\n52\n48\n73\n21\n24\n20\n8\n31\n32\n45\n55\n29\n13\n28\n49\n60\n54\n90\n86\n94\n10\n71\n47\n40\n74\n80\n23\n26... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAiz, which is located in cyberspace, trades information with Wakamatsu. The two countries are developing their economies by exchanging useful data with each other. The two countries, whose national policy is philanthropy ... | [{"type": "stdin_stdout", "input": "5\n18\n102\n-181\n53\n9", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n18\n102\n-155\n53\n9", "output": "3\n"}, {"type": "stdin_stdout", "input": "5\n18\n146\n-181\n53\n9", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n33\n146\n-181\n53\n9", "output": "0\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe first algorithm for detecting a face on the image working in realtime was developed by Paul Viola and Michael Jones in 2001. A part of the algorithm is a procedure that computes Haar features. As part of this task, we... | [{"type": "stdin_stdout", "input": "100 1\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nW\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB\nB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some chore... | [{"type": "stdin_stdout", "input": "100\n2382 7572 9578 1364 2325 2929 7670 5574 2836 2440 6553 1751 929 8785 6894 9373 9308 7338 6380 9541 9951 6785 13181 9942 5087 7544 6582 7139 8458 7424 9759 8199 9464 8817 7625 6200 4955 9373 9500 3062 849 4210 9337 5466 2190 8150 4971 3145 869 5675 1975 161 1998 378 5229 9000 895... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce a Mathematician was trapped by military people during a world war with his forty colleagues. The colleagues were without any weapons, only the mathematician had a knife. And with no weapons they were not able to figh... | [{"type": "stdin_stdout", "input": "952\n2320756\n29322199\n69962176\n35597905\n77503600\n16044585\n78680494\n87353756\n46901578\n54533600\n56732835\n52356252\n3139727\n67375042\n39918429\n47546657\n55270670\n75055313\n37482942\n4607646\n3592454\n42195046\n6958164\n92680150\n74100365\n67455070\n78497675\n79514245\n3736... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer N. Build an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\n* The graph is simple and connected.\n* There exists an integer S such that, for ev... | [{"type": "stdin_stdout", "input": "4", "output": "4\n1 2\n1 3\n2 4\n3 4\n"}, {"type": "stdin_stdout", "input": "4", "output": "4\n1 2\n1 3\n2 4\n3 4\n"}, {"type": "stdin_stdout", "input": "3", "output": "2\n1 3\n2 3"}, {"type": "stdin_stdout", "input": "000", "output": "0\n"}, {"type": "stdin_stdout", "input": "001", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ students numerated from $1$ to $n$. The level of the $i$-th student is $a_i$. You need to split the students into stable groups. A group of students is called stable, if in the sorted array of their levels n... | [{"type": "stdin_stdout", "input": "96 15 21\n76 26 108 220 384 4 170 198 568 571 2 193 244 359 78 133 107 340 110 135 565 341 109 572 243 138 357 52 293 344 595 105 569 362 639 134 82 356 27 137 194 291 499 104 28 290 197 477 339 50 288 289 160 54 358 640 343 542 566 79 136 385 3 641 195 355 361 169 196 429 242 162 33... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have a tree of $n$ vertices. You are going to convert this tree into $n$ rubber bands on infinitely large plane. Conversion rule follows:\n\nFor every pair of vertices $a$ and $b$, rubber bands $a$ and $b$ should inte... | [{"type": "stdin_stdout", "input": "28\n2 24\n2 4\n2 3\n1 2\n1 17\n1 21\n1 22\n10 22\n22 23\n22 26\n25 26\n16 25\n7 26\n5 7\n5 8\n5 15\n5 14\n5 12\n10 20\n11 4\n9 25\n6 9\n12 19\n9 28\n13 14\n18 28\n27 28\n", "output": "13\n"}, {"type": "stdin_stdout", "input": "28\n2 24\n2 4\n2 3\n1 2\n1 17\n1 21\n1 22\n10 22\n22 23\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA + B is often used as an example of the easiest problem possible to show some contest platform. However, some scientists have observed that sometimes this problem is not so easy to get accepted. Want to try?\n\n\n-----In... | [{"type": "stdin_stdout", "input": "1094 350\n", "output": "1444\n"}, {"type": "stdin_stdout", "input": "1132 485\n", "output": "1617\n"}, {"type": "stdin_stdout", "input": "1062 519\n", "output": "1581\n"}, {"type": "stdin_stdout", "input": "260 1041\n", "output": "1301\n"}, {"type": "stdin_stdout", "input": "1132 306... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.\n\nThe level... | [{"type": "stdin_stdout", "input": "21 21\n.....X...X.........X.\n...X...XX......X.....\n..X........X.X...XX..\n.........X....X...X..\nX...X...........XX...\n...X...X....XX...XXX.\n.X............X......\n......X.X............\n.X...X.........X.X...\n......XX......X.X....\n....X.......X.XXX....\n.X.......X..XXX.X..X.\n.... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string S consisting of letters `b`, `d`, `p` and `q`. Determine whether S is a mirror string.\n\nHere, a mirror string is a string S such that the following sequence of operations on S results in the same ... | [{"type": "stdin_stdout", "input": "qbdp", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "dqpb", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "dpqb", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "bpqd", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "bqpd", "output": "Yes\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAmr bought a new video game \"Guess Your Way Out! II\". The goal of the game is to find an exit from the maze that looks like a perfect binary tree of height h. The player is initially standing at the root of the tree and... | [{"type": "stdin_stdout", "input": "4 3\n4 10 14 1\n3 7 6 0\n2 3 3 1\n", "output": "Data not sufficient!\n"}, {"type": "stdin_stdout", "input": "4 3\n4 10 26 1\n3 7 6 0\n2 3 3 1\n", "output": "Data not sufficient!\n"}, {"type": "stdin_stdout", "input": "4 3\n4 10 23 1\n3 7 6 0\n2 3 3 1\n", "output": "Data not sufficien... | 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\nIn April 2008, Aizuwakamatsu City succeeded in making yakitori with a length of 20 m 85 cm. The chicken used at this time is Aizu local chicken, which is a specialty of Aizu. Aizu local chicken is very delicious, but it i... | [{"type": "stdin_stdout", "input": "17 5128 240 126 32\n20 4907 303 151 7\n60 73980 2086 337 15\n3 3216 562 010 6\n40 8478 221 53 307\n23 27966 5 92 13\n50 107893 4497 65 20\n199 88677 2825 226 8\n0", "output": "21 0\n7 18\n15 126\n5 40\n37 5\n13 303\n20 276\n8 292\n"}, {"type": "stdin_stdout", "input": "49 5128 240 25... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is same as the previous one, but has larger constraints.\n\nShiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, her house is too small,... | [{"type": "stdin_stdout", "input": "10\n30518 30518 30518 30518 30518 30518 30518 30518 30518 30518\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10\n30518 30518 30518 30518 30518 30518 30518 30518 30518 30518\n", "output": "10"}, {"type": "stdin_stdout", "input": "10\n30518 96518 74071 59971 50121 4862 439... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova is playing a computer game. There are in total $n$ turns in the game and Vova really wants to play all of them. The initial charge of his laptop battery (i.e. the charge before the start of the game) is $k$.\n\nDurin... | [{"type": "stdin_stdout", "input": "20\n1000000001 510000100 2 1\n1000000000 500000000 2 1\n1000000000 500000000 2 1\n1000000000 500000000 2 1\n1000000000 500000000 2 1\n1000000000 684100035 2 1\n1000000100 500000000 2 1\n1000000000 690764083 2 1\n1000000000 500000000 2 1\n1000000000 167868648 2 1\n1000000001 999999995... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer is seeing a quick report of election results on TV.\nTwo candidates are standing for the election: Takahashi and Aoki.\nThe report shows the ratio of the current numbers of votes the two candidates have ... | [{"type": "stdin_stdout", "input": "5\n3 10\n48 17\n31 199\n231 23\n3 2\n", "output": "6930\n"}, {"type": "stdin_stdout", "input": "5\n3 10\n48 28\n31 199\n300 23\n3 4", "output": "12600\n"}, {"type": "stdin_stdout", "input": "5\n3 11\n87 28\n31 199\n300 23\n3 2", "output": "13000\n"}, {"type": "stdin_stdout", "input":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWelcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market!\n\nIn the morning, there are $n$ oppo... | [{"type": "stdin_stdout", "input": "29 30 989\n450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 450 434\n451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451\n", "output": "1023\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArya has n opponents in the school. Each day he will fight with all opponents who are present this day. His opponents have some fighting plan that guarantees they will win, but implementing this plan requires presence of ... | [{"type": "stdin_stdout", "input": "1 100\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLocal authorities have heard a lot about combinatorial abilities of Ostap Bender so they decided to ask his help in the question of urbanization. There are n people who plan to move to the cities. The wealth of the i of t... | [{"type": "stdin_stdout", "input": "69 6 15\n3845 22036 69001 38625 10662 85485 88195 12883 2257 101913 40235 87797 15559 15841 74716 92979 167517 49466 68603 123491 99905 35606 65184 98603 68232 54398 105580 63002 38979 41488 9636 24737 15892 173020 69670 29711 1460 473 32171 717 21097 108932 86760 55720 116079 61122 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of positive integers a_1, a_2, ..., a_{n}. \n\nWhile possible, you perform the following operation: find a pair of equal consecutive elements. If there are more than one such pair, find the leftmo... | [{"type": "stdin_stdout", "input": "4\n1101111010 1000000000 1000010000 1001001010\n", "output": "4\n1101111010 1000000000 1000010000 1001001010\n"}, {"type": "stdin_stdout", "input": "4\n1101111010 1000000000 1100010000 1001001010\n", "output": "4\n1101111010 1000000000 1100010000 1001001010\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n - If both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n - If the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n - If none of the above holds but 5 divid... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "266666333332\n"}, {"type": "stdin_stdout", "input": "999997\n", "output": "266665333334\n"}, {"type": "stdin_stdout", "input": "870108\n", "output": "201890463153\n"}, {"type": "stdin_stdout", "input": "1100000", "output": "322667033332\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n - In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute ... | [{"type": "stdin_stdout", "input": "100000\n", "output": "3234566667\n"}, {"type": "stdin_stdout", "input": "94598\n", "output": "2345654334\n"}, {"type": "stdin_stdout", "input": "91278\n", "output": "2332345676\n"}, {"type": "stdin_stdout", "input": "97979\n", "output": "3223456555\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a $n \\times m$ matrix $A$ and a $m \\times l$ matrix $B$, and prints their product, a $n \\times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula:\n\n\\\\[ c_{ij} =... | [{"type": "stdin_stdout", "input": "4 0 13\n1 1\n2 4\n4 15\n-1 0 2\n1 5 2", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "4 0 12\n1 1\n-1 2\n4 1\n1 0 -1\n1 12 5", "output": "0 0 0 0 0 0 0 0 0 0 0 0\n0 0 0 0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a set of cards with positive integers written on them. Stack the cards to make several piles and arrange them side by side. Select two adjacent piles of cards from them, and stack the left pile on top of the righ... | [{"type": "stdin_stdout", "input": "3\n2 21\n0 48\n-1 12", "output": "-1152\n"}, {"type": "stdin_stdout", "input": "3\n4 21\n0 48\n-1 12", "output": "-2304\n"}, {"type": "stdin_stdout", "input": "3\n4 21\n0 28\n-1 12", "output": "-1344\n"}, {"type": "stdin_stdout", "input": "3\n6 93\n1 -14\n1 -1", "output": "-7728\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAika's house runs a small coffee shop. The scones baked by Aika's mother were very delicious and the shop was very prosperous.\n\nOne of the jobs of Aika, a waitress, is to deliver the scones that are baked one after anot... | [{"type": "stdin_stdout", "input": "5 11\n7 36 34 14 94\n8 10\n-1 2 1 5 6 6 8 2\n5 4\n2 4 2 4 6\n10 18\n10 15 12 56 12 33 11 1 22 181\n1 101\n10\n0 0", "output": "10\n9\n2\n17\n10\n"}, {"type": "stdin_stdout", "input": "5 11\n7 36 34 45 94\n8 10\n-1 2 1 5 4 6 8 2\n5 2\n2 4 2 4 6\n10 18\n10 15 12 56 12 67 11 6 22 181\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n-----Input-----\n\nThe input contains a single integer a (1 ≤ a ≤ 64).\n\n\n-----Output-----\n\nOutput a single integer.\n\n\n-----Examples-----\nInput\n2\n\nOutput\n1\n\nInput\n4\n\nOutput\n2\n\nInput\n27\n\nOutput\n5\n\... | [{"type": "stdin_stdout", "input": "64\n", "output": "267\n"}, {"type": "stdin_stdout", "input": "16\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "24\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "32\n", "output": "51\n"}, {"type": "stdin_stdout", "input": "36\n", "output": "14\n"}, {"type": "std... | 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\nThere are N children in AtCoder Kindergarten. Mr. Evi will arrange the children in a line, then give 1 candy to the first child in the line, 2 candies to the second child, ..., N candies to the N-th child. How many candie... | [{"type": "stdin_stdout", "input": "-465", "output": "107880\n"}, {"type": "stdin_stdout", "input": "-792", "output": "313236\n"}, {"type": "stdin_stdout", "input": "-937", "output": "438516\n"}, {"type": "stdin_stdout", "input": "-845", "output": "356590\n"}, {"type": "stdin_stdout", "input": "-647", "output": "208981... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.