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\nThe \"BerCorp\" company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee we have the list of... | [{"type": "stdin_stdout", "input": "100 100\n1 33\n0\n2 35 4\n2 40 78\n1 69\n0\n1 2\n0\n0\n2 81 34\n1 45\n0\n1 87\n1 50\n1 97\n0\n2 100 59\n0\n0\n0\n1 45\n0\n0\n0\n1 6\n1 54\n0\n0\n0\n4 79 96 52 84\n1 86\n0\n0\n0\n0\n0\n0\n0\n0\n3 90 2 80\n0\n0\n0\n0\n0\n0\n0\n0\n0\n0\n1 2\n0\n1 64\n0\n1 78\n1 82\n0\n0\n0\n0\n0\n1 6\n0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe classic programming language of Bitland is Bit++. This language is so peculiar and complicated.\n\nThe language is that peculiar as it has exactly one variable, called x. Also, there are two operations:\n\n Operation... | [{"type": "stdin_stdout", "input": "101\nX++\nX++\nX++\n++X\n--X\nX--\nX++\nX--\nX--\n--X\n--X\n++X\nX++\n++X\n++X\nX--\n--X\n++X\nX++\nX--\n++X\n--X\n--X\n--X\n++X\n--X\n++X\nX++\nX++\n++X\n--X\nX++\nX--\nX++\n++X\n++X\nX--\nX--\nX--\nX++\nX++\nX--\nX--\nX++\n++X\n++X\n++X\n--X\n--X\n++X\nX--\nX--\n--X\n++X\nX--\n++X\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is the story of 20XX. The number of air passengers increased as a result of the stable energy supply by the renewable power network and the invention of liquefied synthetic fuel. However, the threat of terrorism by a... | [{"type": "stdin_stdout", "input": "6\n1 1\n.\n3 3\n...\n.W.\n...\n10 10\n..........\n.DDDDCCC..\n.DDDDCCC..\n.DDDDCCC..\nADDDDCCC..\nAAA..CCC..\n..CBBBBAAA\nAAABBBB...\n..BBBBB...\n..........\n10 10\n..........\n.DDDDDD...\n.DDDDCCC..\n.DDDDCCC..\nADDDDCCC..\nAAA.-CCC..\nAAABBBBC..\nAAABBBB...\n..BBBBB...\n..........\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem F Pizza Delivery\n\nAlyssa is a college student, living in New Tsukuba City. All the streets in the city are one-way. A new social experiment starting tomorrow is on alternative traffic regulation reversing the on... | [{"type": "stdin_stdout", "input": "4 5\n1 3 7\n4 2 6\n4 3 0\n2 1 34\n3 3 12", "output": "SOSO\nSOSO\nHAPPY\nHAPPY\nSOSO\n"}, {"type": "stdin_stdout", "input": "4 5\n1 1 5\n3 4 6\n4 2 13\n2 1 6\n2 3 17", "output": "SOSO\nSOSO\nSOSO\nHAPPY\nSOSO\n"}, {"type": "stdin_stdout", "input": "4 5\n1 3 5\n3 4 6\n2 2 7\n2 1 1\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBilly investigates the question of applying greedy algorithm to different spheres of life. At the moment he is studying the application of greedy algorithm to the problem about change. There is an amount of n coins of dif... | [{"type": "stdin_stdout", "input": "91\n4000000 3000000 2900000 2511334 2511333 2102003 1901011 1700000 1200000 999999 800000 750000 600000 508111 202000 101000 35000 20000 9000 5000 2000 899 630 629 628 627 626 625 624 623 622 621 620 619 618 617 616 615 614 613 612 611 610 609 608 607 606 605 604 603 602 601 504 405 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem is a simplified version of D2, but it has significant differences, so read the whole statement.\n\nPolycarp has an array of $n$ ($n$ is even) integers $a_1, a_2, \\dots, a_n$. Polycarp conceived of a positive... | [{"type": "stdin_stdout", "input": "10\n10\n25 25 7 61 97 -47 43 7 -11 -29\n10\n44 -10 -10 -64 -64 98 -64 62 -10 -64\n10\n20 50 65 35 65 -40 50 20 -55 -10\n10\n7 -91 -77 -91 -21 7 77 35 21 -7\n10\n56 -76 78 12 -54 -43 23 1 -65 45\n10\n-68 12 -88 -48 52 -8 -28 -8 92 -88\n10\n55 -2 -2 74 36 -59 -59 55 36 -78\n10\n70 -66 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBob is playing a game of Spaceship Solitaire. The goal of this game is to build a spaceship. In order to do this, he first needs to accumulate enough resources for the construction. There are $n$ types of resources, numbe... | [{"type": "stdin_stdout", "input": "2\n4 4\n9\n1 1 1\n1 2 1\n1 3 1\n2 1 2\n2 2 2\n2 3 2\n2 3 1\n2 2 1\n2 1 1\n", "output": "7\n6\n5\n4\n3\n2\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "2\n4 4\n9\n1 1 1\n1 2 1\n1 3 1\n2 1 2\n2 2 2\n2 3 2\n2 3 1\n2 2 1\n2 1 1\n", "output": "7\n6\n5\n4\n3\n2\n2\n3\n4\n"}, {"type": "s... | 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\nYou are given a matrix with $n$ rows (numbered from $1$ to $n$) and $m$ columns (numbered from $1$ to $m$). A number $a_{i, j}$ is written in the cell belonging to the $i$-th row and the $j$-th column, each number is eith... | [{"type": "stdin_stdout", "input": "4\n2 2\n1 1\n0 1\n2 3\n1 1 0\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 0 0 0 0 0\n1 0 1 1 1 0 1\n2 5\n1 0 1 0 0\n1 1 1 1 0\n-1 1 1 0 0\n", "output": "0\n3\n5\n4\n"}, {"type": "stdin_stdout", "input": "4\n2 2\n1 1\n0 1\n2 3\n1 1 1\n1 0 0\n3 7\n1 0 1 1 1 1 1\n0 0 1 0 0 1 0\n1 0 1 0 1 0 1\n2 5\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSalem gave you $n$ sticks with integer positive lengths $a_1, a_2, \\ldots, a_n$.\n\nFor every stick, you can change its length to any other positive integer length (that is, either shrink or stretch it). The cost of chan... | [{"type": "stdin_stdout", "input": "113\n86 67 31 33 72 100 88 63 16 12 79 80 76 45 31 96 44 10 24 33 53 11 56 100 23 57 9 48 28 73 18 48 12 89 73 9 51 11 82 94 90 92 34 99 54 58 33 67 35 87 58 90 94 64 57 80 87 99 84 99 20 1 63 12 16 40 50 95 33 58 7 23 71 89 53 15 95 29 71 16 65 21 66 89 82 30 6 45 6 66 58 32 27 78 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus likes studying at school a lot and he is always diligent about his homework. Polycarpus has never had any problems with natural sciences as his great-great-grandfather was the great physicist Seinstein. On the ... | [{"type": "stdin_stdout", "input": "10\n58 22116\n112840 772160\n127432 399484\n182031 255417\n459340 548097\n603984 739189\n606173 663033\n280170 366159\n779239 906234\n874623 155443\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "10\n58 22116\n112840 772160\n122094 399484\n182031 255417\n459340 548097\n60398... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.\n\nWe will call point a bad if there are different points b and c, not equal to a, from the given set such ... | [{"type": "stdin_stdout", "input": "11\n358 -724 -232 53 -520\n486 -554 -328 53 -220\n358 -554 -232 -372 -520\n358 -554 -232 308 -520\n868 -554 448 53 -520\n478 -554 -322 53 -600\n358 296 -232 53 -520\n256 -554 -368 53 -520\n230 -554 -136 53 -820\n-182 -554 173 53 -160\n358 -554 -232 53 -520\n", "output": "1\n11\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA Pythagorean triple is a triple of integer numbers $(a, b, c)$ such that it is possible to form a right triangle with the lengths of the first cathetus, the second cathetus and the hypotenuse equal to $a$, $b$ and $c$, r... | [{"type": "stdin_stdout", "input": "3\n2131\n21165\n6666\n", "output": "32\n102\n57\n"}, {"type": "stdin_stdout", "input": "3\n2131\n21165\n6666\n", "output": "32\n102\n57\n"}, {"type": "stdin_stdout", "input": "3\n2131\n38301\n6666\n", "output": "32\n137\n57\n"}, {"type": "stdin_stdout", "input": "3\n1625\n38301\n6666... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA thief sneaked into a museum with a lot of treasures with only one large furoshiki. There are many things I want to steal, but the weight that the furoshiki can withstand is limited, and if it exceeds this, the furoshiki... | [{"type": "stdin_stdout", "input": "50\n5\n60,10\n100,10\n03,022\n210,45\n10,4\n162\n5\n60,10\n100,20\n120,30\n210,45\n10,4\n0", "output": "Case 1:\n220\n49\nCase 2:\n500\n109\n"}, {"type": "stdin_stdout", "input": "50\n5\n60,20\n100,20\n03,021\n210,45\n10,4\n143\n5\n60,10\n100,20\n120,30\n200,45\n10,4\n0", "output": "... | 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"}, {"type": "stdin_stdout", "input": "bbbb... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n8\n-10 0\n-10 5\n-5 5\n-5 0\n10 0\n10 -5\n5 -5\n5 0\n\n\nOutput\n\n50\n\nThe input will be stdin and you should print your solution to stdout\n\n\nNow solve the problem and return the code.\n\nWrite Py... | [{"type": "stdin_stdout", "input": "8\n-18 1\n-10 2\n-10 8\n-27 -1\n11 0\n22 -5\n4 -8\n5 0", "output": "137\n"}, {"type": "stdin_stdout", "input": "8\n-18 1\n-10 2\n-10 8\n-27 -1\n11 0\n22 -7\n4 -8\n5 0", "output": "144\n"}, {"type": "stdin_stdout", "input": "8\n-18 1\n-10 2\n-10 8\n-7 -1\n11 0\n22 -14\n4 -8\n5 0", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n$N$ sages are sitting around a round table with $N$ seats. Each sage holds chopsticks with his dominant hand to eat his dinner. The following happens in this situation.\n\n* If sage $i$ is right-handed and a left-handed s... | [{"type": "stdin_stdout", "input": "5\n1 1 0 1 0\n1 3 1 -2 4", "output": "-1\n"}, {"type": "stdin_stdout", "input": "5\n1 1 0 1 0\n1 3 1 -1 4", "output": "0\n"}, {"type": "stdin_stdout", "input": "5\n1 1 0 0 2\n1 3 0 2 13", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n1 0 0 1 0\n2 3 6 1 2", "output": "3\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSereja has got an array, consisting of n integers, a_1, a_2, ..., a_{n}. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make v_{i}-th array element ... | [{"type": "stdin_stdout", "input": "6 6\n202714501 613423725 367325359 862808465 196327629 745008828\n2 492\n2 1943\n1 3 173984392\n1 5 17007494\n3 4\n1 5 472683539\n", "output": "862810900\n\n"}, {"type": "stdin_stdout", "input": "6 6\n202714501 613423725 367325359 862808465 196327629 745008828\n2 492\n2 1943\n1 3 173... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N strings arranged in a row. It is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right. That is, S_1<S_2<...<S_N holds lexicographically, wh... | [{"type": "stdin_stdout", "input": "5\n11 1 2 2 2", "output": "3"}, {"type": "stdin_stdout", "input": "5\n14 1 2 2 2", "output": "3"}, {"type": "stdin_stdout", "input": "5\n28 1 2 2 2", "output": "3"}, {"type": "stdin_stdout", "input": "5\n3 1 2 1 13", "output": "3"}, {"type": "stdin_stdout", "input": "5\n11 1 2 2 1", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn accordion is a string (yes, in the real world accordions are musical instruments, but let's forget about it for a while) which can be represented as a concatenation of: an opening bracket (ASCII code $091$), a colon (A... | [{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSomeone give a strange birthday present to Ivan. It is hedgehog β connected undirected graph in which one vertex has degree at least 3 (we will call it center) and all other vertices has degree 1. Ivan thought that hedgeh... | [{"type": "stdin_stdout", "input": "33 2\n3 13\n17 3\n2 6\n5 33\n4 18\n1 2\n31 5\n4 19\n3 16\n1 3\n9 2\n10 3\n5 1\n5 28\n21 4\n7 2\n1 4\n5 24\n30 5\n14 3\n3 11\n27 5\n8 2\n22 4\n12 3\n20 4\n26 5\n4 23\n32 5\n25 5\n15 3\n29 5\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "25 2\n1 2\n1 3\n1 4\n2 5\n2 6\n2 7\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is the maximum value of $n$.\n\nYou are given a positive integer number $n$. You really love good numbers so you want to find the smallest good number greater than or equ... | [{"type": "stdin_stdout", "input": "100\n1\n2\n3\n4\n5\n6\n7\n8\n14\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\n71\n72\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAn expedition group flew from planet ACM-1 to Earth in order to study the bipedal species (its representatives don't even have antennas on their heads!).\n\nThe flying saucer, on which the brave pioneers set off, consists... | [{"type": "stdin_stdout", "input": "602799218 494169337\n", "output": "105935725\n"}, {"type": "stdin_stdout", "input": "523061914 144515354\n", "output": "127493116\n"}, {"type": "stdin_stdout", "input": "622152471 448257864\n", "output": "210299666\n"}, {"type": "stdin_stdout", "input": "549662082 945236243\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA telephone number is a sequence of exactly 11 digits, where the first digit is 8. For example, the sequence 80011223388 is a telephone number, but the sequences 70011223388 and 80000011223388 are not.\n\nYou are given a ... | [{"type": "stdin_stdout", "input": "2\n13\n7818005553535\n11\n31415926535\n", "output": "YES\nNO\n"}, {"type": "stdin_stdout", "input": "2\n13\n14222439333841\n11\n31415926535\n", "output": "NO\nNO\n"}, {"type": "stdin_stdout", "input": "2\n13\n3872943379171\n11\n45489461254\n", "output": "YES\nNO\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press β upvote and downvote.\n\nHowever, the site is not so simple on the in... | [{"type": "stdin_stdout", "input": "9\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "9\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "9\n1\n1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya plays the Need For Brake. He plays because he was presented with a new computer wheel for birthday! Now he is sure that he will win the first place in the championship in his favourite racing computer game! \n\nn ra... | [{"type": "stdin_stdout", "input": "20\ng 1000000\nibb 1000000\nidj 1000000\nkccg 1000000\nbbe 1000000\nhjf 1000000\na 1000000\nf 1000000\niij 1000000\nakgf 1000000\nkdkhj 1000000\ne 1000000\nh 1000000\nhb 1000000\nfaie 1000000\nj 1000000\ni 1000000\nhgg 1000000\nfi 1000000\nicf 1000000\n12\n1000000 1000000 1000000 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA positive integer is called a 2-3-integer, if it is equal to 2^{x}Β·3^{y} for some non-negative integers x and y. In other words, these integers are such integers that only have 2 and 3 among their prime divisors. For exa... | [{"type": "stdin_stdout", "input": "1088391168 1934917632\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "1088391167 1934917632\n", "output": "17\n"}, {"type": "stdin_stdout", "input": "1088391169 1934917632\n", "output": "16\n"}, {"type": "stdin_stdout", "input": "1088391168 1934917631\n", "output": "16\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation $p$ of $n$ integers $1$, $2$, ..., $n$ (a permutation is an array where each element from $1$ to $n$ occurs exactly once).\n\nLet's call some subsegment $p[l, r]$ of this permutation special if... | [{"type": "stdin_stdout", "input": "5\n3 4 1 5 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n4 5 1 3 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5\n5 4 1 3 2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n3 4 2 5 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTaro came to a square to look for treasure. There are many treasures buried in this square, but Taro has the latest machines, so he knows everything about where the treasures are buried. Since the square is very wide Taro... | [{"type": "stdin_stdout", "input": "5 5\n10 7\n-3 -8\n2 11\n6 0\n-1 3\n-3 1 3 13\n-1 -1 9 5\n-3 -16 10 11\n-1 0 5 4\n-1 -13 15 10", "output": "2\n2\n5\n1\n3\n"}, {"type": "stdin_stdout", "input": "5 5\n10 7\n-3 -8\n2 11\n10 0\n-1 3\n-3 1 3 13\n-1 -1 9 5\n-3 -16 12 11\n0 0 5 4\n-1 -13 15 10", "output": "2\n1\n5\n0\n3\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Berland recently a new collection of toys went on sale. This collection consists of 10^9 types of toys, numbered with integers from 1 to 10^9. A toy from the new collection of the i-th type costs i bourles.\n\nTania ha... | [{"type": "stdin_stdout", "input": "5 100000000\n100000000 999999999 1 2 3\n", "output": "14138\n4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDecimal numbers are a common notation system currently in use and use ten symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 to represent all numbers.\n\nBinary numbers are a popular notation in the computer world and use two symbo... | [{"type": "stdin_stdout", "input": "7\n4\n0\n24\n10\n10010\n-1", "output": "13\n10\n0\n120\n22\n2130122\n"}, {"type": "stdin_stdout", "input": "7\n4\n1\n24\n10\n10010\n-1", "output": "13\n10\n1\n120\n22\n2130122\n"}, {"type": "stdin_stdout", "input": "7\n4\n0\n12\n16\n10000\n-1", "output": "13\n10\n0\n30\n100\n2130100\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind places where a string P is found within a text T. Print all indices of T where P found. The indices of T start with 0.\n\nConstraints\n\n* 1 β€ length of T β€ 1000000\n* 1 β€ length of P β€ 10000\n* The input consists of... | [{"type": "stdin_stdout", "input": "aaaaab\naa", "output": "0\n1\n2\n3\n"}, {"type": "stdin_stdout", "input": "baaaaa\naa", "output": "1\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "aaabaa\naa", "output": "0\n1\n4\n"}, {"type": "stdin_stdout", "input": "baaaab\naa", "output": "1\n2\n3\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.\n\nThe playing field is a sequence of n non-negative integers ai numbered ... | [{"type": "stdin_stdout", "input": "120\n242 524 420 973 816 432 247 666 134 849 145 366 608 930 613 315 863 628 97 109 65 704 741 314 736 17 872 971 559 648 223 771 171 327 782 837 303 393 292 339 730 834 794 868 540 251 789 893 23 305 116 220 699 863 580 992 861 393 98 253 544 171 336 207 348 496 316 285 286 727 613 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSakuzyo - Imprinting\n\nA.R.C. Markland-N is a tall building with $n$ floors numbered from $1$ to $n$. Between each two adjacent floors in the building, there is a staircase connecting them.\n\nIt's lunchtime for our sens... | [{"type": "stdin_stdout", "input": "1\n100 52 99\n51 69 42 32 34 62 12 75 88 18 57 47 40 91 100 81 72 15 26 14 93 68 6 50 5 24 97 52 10 20 54 9 56 39 21 55 7 98 59 87 77 17 29 13 30 46 37 76 71 78 96 82 49 64 84 60 67 19 2 25 85 89 38 41 11 90 35 48 27 28 70 65 66 16 79 3 80 44 36 43 61 99 22 33 86 4 83 94 74 31 73 95 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. ... | [{"type": "stdin_stdout", "input": "8 10\n100\n200\n300\n400\n500\n600\n700\n800\n900\n1000\n", "output": "11\n13\n14\n15\n16\n16\n17\n18\n19\n20\n"}, {"type": "stdin_stdout", "input": "8 10\n100\n200\n300\n400\n500\n600\n700\n862\n900\n1000\n", "output": "11\n13\n14\n15\n16\n16\n17\n19\n19\n20\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a sequence of integers a_1, ..., a_{n} and q queries x_1, ..., x_{q} on it. For each query x_{i} you have to count the number of pairs (l, r) such that 1 β€ l β€ r β€ n and gcd(a_{l}, a_{l} + 1, ..., a_{r}) = x_{i}.\n\... | [{"type": "stdin_stdout", "input": "10\n2 2 4 3 2 4 4 2 4 2\n104\n3\n3\n1\n4\n1\n1\n4\n1\n1\n3\n1\n1\n4\n1\n1\n1\n4\n3\n1\n1\n4\n1\n1\n1\n1\n1\n4\n1\n1\n1\n4\n1\n1\n4\n1\n1\n1\n1\n1\n4\n4\n1\n3\n1\n4\n1\n1\n1\n4\n1\n2\n4\n1\n4\n1\n4\n1\n4\n3\n1\n2\n2\n4\n2\n1\n1\n2\n4\n4\n1\n2\n3\n1\n1\n4\n4\n4\n4\n4\n2\n2\n4\n1\n1\n1\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nAs every other little boy, Mike has a favorite toy to play with. Mike's favorite toy is a set of N disks. The boy likes to compose his disks in stacks,... | [{"type": "stdin_stdout", "input": "3\n6\n2 4 5 0 1 2\n10\n0 2 5 5 2 3 4 14 1 3\n8\n9 9 13 19 23 10 18 12", "output": "3 0 1 2\n6 0 1 2 3 3 14\n5 9 9 10 12 23\n"}, {"type": "stdin_stdout", "input": "3\n6\n3 4 5 1 1 2\n10\n3 2 9 5 2 3 4 14 7 10\n8\n9 5 13 19 23 10 18 12", "output": "3 1 1 2\n6 2 2 3 4 7 10\n4 5 10 12 23... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nGiven the integer n, output the smallest m such that nCm (the number of combinations that choose m out of n different ones) is even.\n\nConstraints\n\nThe input satisfies the following conditions.\n\n* 1 β€ n β€ ... | [{"type": "stdin_stdout", "input": "127", "output": "128\n"}, {"type": "stdin_stdout", "input": "255", "output": "256\n"}, {"type": "stdin_stdout", "input": "175", "output": "16\n"}, {"type": "stdin_stdout", "input": "101", "output": "2\n"}, {"type": "stdin_stdout", "input": "15", "output": "16\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it β either 1 or 2.\n\nHowever, there is one condition you must fulfi... | [{"type": "stdin_stdout", "input": "214\n1 2 2 1 1 1 2 2 2 2 1 1 1 2 2 2 2 2 2 1 2 1 1 2 2 1 1 2 2 2 2 1 2 2 2 1 1 2 2 2 1 1 2 2 1 2 2 2 1 1 2 1 1 2 1 1 1 2 2 2 2 1 2 2 2 1 2 1 2 1 1 2 2 1 1 2 1 2 2 2 2 2 2 2 1 2 1 2 2 1 2 2 2 1 2 2 1 2 2 1 2 2 2 2 1 2 2 2 1 1 2 2 2 2 2 2 1 2 2 2 2 1 1 1 2 2 2 1 2 1 2 1 1 2 1 1 1 2 2 2... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the year 30XX, an expedition team reached a planet and found a warp machine suggesting the existence of a mysterious supercivilization. When you go through one of its entrance gates, you can instantaneously move to the... | [{"type": "stdin_stdout", "input": "25\nneihsokcpuziafoytisrevinu\nuniversityofaizupckoshhen", "output": "4\n"}, {"type": "stdin_stdout", "input": "25\nuniversityofaiztpckoshien\nuniversityofaizupbkoshhen", "output": "0\n"}, {"type": "stdin_stdout", "input": "25\nuniversityofaiztpckoshien\nnehhsokbpuziafoytisrevinu", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different.\n\nIn Ancient Berland arenas in circuses were shaped as a regular (equiangular) polygon, the size and the... | [{"type": "stdin_stdout", "input": "129.400249 -44.695226\n122.278798 -53.696996\n44.828427 -83.507917\n", "output": "26227.478504758346\n"}, {"type": "stdin_stdout", "input": "115.715093 141.583620\n136.158119 -23.780834\n173.673212 64.802787\n", "output": "24043.740341410277\n"}, {"type": "stdin_stdout", "input": "-4... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given $n$ numbers $a_1, a_2, \\dots, a_n$. With a cost of one coin you can perform the following operation:\n\nChoose one of these numbers and add or subtract $1$ from it.\n\nIn particular, we can apply this opera... | [{"type": "stdin_stdout", "input": "22\n99039804 -580368436 -694542422 231508622 -490965348 958087037 -570157955 560902976 -840005981 -1381720926 -708462966 639575552 119982241 -631099451 -154223559 102960509 -225552439 507250810 -712228569 989896753 1574991855 1\n", "output": "12773524192\n"}, {"type": "stdin_stdout",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are times you recall a good old friend and everything you've come through together. Luckily there are social networksΒ β they store all your message history making it easy to know what you argued over 10 years ago.\n... | [{"type": "stdin_stdout", "input": "100 7\n0 1 1 1 0 5 6 6 8 8 9 11 12 11 8 0 0 14 6 16 7 21 15 23 15 24 0 0 0 28 0 29 26 27 19 1 0 21 37 32 40 30 37 34 39 38 34 38 0 0 41 24 45 47 0 33 46 26 31 0 21 57 57 18 63 63 20 59 65 56 68 0 30 55 55 0 70 43 59 49 59 79 66 74 0 11 65 0 80 63 0 84 73 49 73 81 0 86 76 20\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom to top, the columns are numbered from 1 to 100 from left to right. \n\nIn this table, Vany... | [{"type": "stdin_stdout", "input": "5\n4 11 20 20\n6 11 20 16\n5 1 33 15\n11 3 18 21\n3 2 14 21\n", "output": "1087\n"}, {"type": "stdin_stdout", "input": "5\n4 11 20 22\n6 11 20 16\n5 1 34 15\n11 3 18 21\n3 1 14 11\n", "output": "1028\n"}, {"type": "stdin_stdout", "input": "5\n4 11 20 38\n6 11 20 16\n5 2 19 15\n11 3 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.\n\nGiven a string S, determine ... | [{"type": "stdin_stdout", "input": "sippuu\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "coffee\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "dceett\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "otjjmm\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "zkrrcc\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Floral Clock has been standing by the side of Mirror Lake for years. Though unable to keep time, it reminds people of the passage of time and the good old days.\n\nOn the rim of the Floral Clock are 2n flowers, number... | [{"type": "stdin_stdout", "input": "23333\n", "output": "259575428\n"}, {"type": "stdin_stdout", "input": "49997\n", "output": "645043850\n"}, {"type": "stdin_stdout", "input": "10492\n", "output": "914991759\n"}, {"type": "stdin_stdout", "input": "30000\n", "output": "583465411\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.\n\nThe area looks like a strip of cells 1 Γ n. Each cell contains the direction for the next jump and the length of that... | [{"type": "stdin_stdout", "input": "10\n>>>>>>>>><\n1 1 1 1 1 1 1 1 1 5\n", "output": "INFINITE\n"}, {"type": "stdin_stdout", "input": "10\n>>>>>>>>><\n1 1 1 1 1 1 1 1 1 1\n", "output": "INFINITE\n"}, {"type": "stdin_stdout", "input": "10\n>>>>>>>>>>\n1 1 1 1 1 1 1 1 1 100\n", "output": "FINITE\n"}, {"type": "stdin_std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nproblem\n\nAOR Ika made a set $ S = \\\\ {a_1, ..., a_N \\\\} $ and a map $ f: S β S $. $ f (a_i) = b_i $. For any element $ x $ in the set $ S $, all maps $ g, h: S β S $ satisfying $ g (f (x)) = h (f (x)) $ are $ g (x).... | [{"type": "stdin_stdout", "input": "5\n2 1 3 4 5\n3 4 2 5 1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 4 5\n2 4 3 5 1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "5\n1 3 2 4 5\n3 4 2 5 1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "5\n2 1 3 4 5\n2 4 3 5 1", "output": "Yes\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a chain consisting of multiple circles on a plane. The first (last) circle of the chain only intersects with the next (previous) circle, and each intermediate circle intersects only with the two neighboring circl... | [{"type": "stdin_stdout", "input": "10\n802 0 10\n814 0 4\n820 1 4\n826 1 4\n832 3 5\n838 9 5\n845 7 3\n849 10 3\n853 14 4\n857 18 3\n3\n0 0 5\n8 0 5\n8 8 5\n3\n0 0 5\n7 3 6\n16 1 5\n9\n-1 3 5\n8 0 8\n19 2 11\n23 14 6\n23 21 6\n23 28 6\n19 40 8\n8 42 8\n0 39 5\n11\n0 0 5\n8 0 5\n18 8 10\n8 16 5\n0 16 5\n-1 24 5\n3 32 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sequence of $n$ integers $a_1$, $a_2$, ..., $a_n$. Let us call an index $j$ ($2 \\le j \\le {{n-1}}$) a hill if $a_j > a_{{j+1}}$ and $a_j > a_{{j-1}}$; and let us call it a valley if $a_j < a_{{j+1}}$ and... | [{"type": "stdin_stdout", "input": "4\n3\n3 14 1\n5\n3 3 2 2 4\n6\n1 6 2 2 2 10\n5\n1 12 1 4 2\n", "output": "0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n3\n3 14 1\n5\n3 3 2 1 4\n6\n1 6 2 2 2 10\n5\n1 12 1 4 2\n", "output": "0\n0\n0\n0\n"}, {"type": "stdin_stdout", "input": "4\n3\n1 5 0\n5\n5 4 2 2 -1\n6\n0 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBandits appeared in the city! One of them is trying to catch as many citizens as he can.\n\nThe city consists of $n$ squares connected by $n-1$ roads in such a way that it is possible to reach any square from any other sq... | [{"type": "stdin_stdout", "input": "100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n0 0 63 70 92 75 4 96 52 33 86 57 53 85 91 62 23 0 28 37 41 69 26 64 7 100 41 19 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nStudent Andrey has been skipping physical education lessons for the whole term, and now he must somehow get a passing grade on this subject. Obviously, it is impossible to do this by legal means, but Andrey doesn't give u... | [{"type": "stdin_stdout", "input": "8 8\n.#.#.#.#\n#.#.#.#.\n.#.#.#.#\n#.#.#.#.\n.#.#.#.#\n#.#.#.#.\n.#.#.#.#\n#.#.#.#.\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "8 8\n.#.#.#.#\n.#.#.#.#\n.#.#.#.#\n#.#.#.#.\n.#.#.#.#\n#.#.#.#.\n.#.#.#.#\n#.#.#.#.\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDanny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!\n\nYou are given $n$ nonnegative integers $a_1, a_2, \\dots, a_n$ arranged in a circle, where $n$ m... | [{"type": "stdin_stdout", "input": "41\n67695023 47580738 52676259 26530025 83455112 2392302 23011073 86422683 148437329 42852564 97383338 95729385 6219705 42027049 79082264 1205076 1191075 18025596 75651485 93690196 63851880 23817841 79285846 9296266 60979868 62770176 40911517 96687661 35967137 55930828 78662969 51939... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently, Tokitsukaze found an interesting game. Tokitsukaze had $n$ items at the beginning of this game. However, she thought there were too many items, so now she wants to discard $m$ ($1 \\le m \\le n$) special items o... | [{"type": "stdin_stdout", "input": "1000000000000000000 20 365\n31881893160049984 103938857870698567 103962228223609431 140762820261865064 175962215264653912 239086305245565642 354522451098745823 383839975876242372 443471287955807705 478923027151493682 511195154588214957 619570919279066139 677571312513476877 7058647976... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are a secret agent from the Intelligence Center of Peacemaking Committee. You've just sneaked into a secret laboratory of an evil company, Automated Crime Machines.\n\nYour mission is to get a confidential document ke... | [{"type": "stdin_stdout", "input": "10 1\n3\n1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "7 1\n6\n-1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "11 1\n3\n1", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "6 2\n10\n3", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "7 1\n6\n-2",... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNowadays, most of the internet advertisements are not statically linked to a web page. Instead, what will be shown to the person opening a web page is determined within 100 milliseconds after the web page is opened. Usual... | [{"type": "stdin_stdout", "input": "5\n3778 9170\n2657 6649\n4038 9722\n3392 7255\n4890 8961\n", "output": "6938.4627241726648\n"}, {"type": "stdin_stdout", "input": "5\n4787 9531\n3133 9597\n1754 9725\n4335 7124\n4269 7752\n", "output": "7046.2404831918329\n"}, {"type": "stdin_stdout", "input": "5\n2194 6947\n2062 824... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera loves his garden, where n fruit trees grow.\n\nThis year he will enjoy a great harvest! On the i-th tree b_{i} fruit grow, they will ripen on a day number a_{i}. Unfortunately, the fruit on the tree get withered, s... | [{"type": "stdin_stdout", "input": "24 1524\n16 934\n23 1940\n21 1447\n20 417\n24 1340\n22 1932\n13 775\n19 2918\n12 2355\n9 593\n11 2676\n3 1857\n16 868\n13 426\n18 1679\n22 991\n9 2728\n10 2497\n16 1221\n9 772\n23 2522\n24 982\n12 1431\n18 757\n", "output": "25893\n"}, {"type": "stdin_stdout", "input": "24 1524\n16 9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a complete undirected graph. For each pair of vertices you are given the length of the edge that connects them. Find the shortest paths between each pair of vertices in the graph and return the length of the... | [{"type": "stdin_stdout", "input": "10\n0 1 100 100 100 100 100 100 100 100\n1 0 1 100 100 100 100 100 100 100\n100 1 0 1 100 100 100 100 100 100\n100 100 1 0 1 100 100 100 100 100\n100 100 100 1 0 1 100 100 100 100\n100 100 100 100 1 0 1 100 100 100\n100 100 100 100 100 1 0 1 100 100\n100 100 100 100 100 100 1 0 1 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a clear night, a boy, Campanella looked up at the sky, there were many stars which have different colors such as red, yellow, green, blue, purple, etc. He was watching the stars and just lost track of time. Presently, ... | [{"type": "stdin_stdout", "input": "8\n1 0 3 3 0 1 14 5\n7\n1 2 -1 8 12 1 5\n0", "output": "NO COLOR\nNO COLOR\n"}, {"type": "stdin_stdout", "input": "8\n1 0 3 3 0 1 14 5\n7\n1 2 -1 8 22 1 5\n0", "output": "NO COLOR\nNO COLOR\n"}, {"type": "stdin_stdout", "input": "8\n1 0 3 3 0 1 14 5\n7\n1 2 -1 8 13 1 5\n0", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta has to send presents to the kids. He has a large stack of $n$ presents, numbered from $1$ to $n$; the topmost present has number $a_1$, the next present is $a_2$, and so on; the bottom present has number $a_n$. All ... | [{"type": "stdin_stdout", "input": "2\n3 3\n3 1 2\n3 2 1\n7 2\n2 1 7 3 4 5 6\n6 1\n", "output": "5\n14\n"}, {"type": "stdin_stdout", "input": "2\n3 3\n3 1 2\n3 2 1\n7 2\n2 1 7 3 4 5 6\n4 1\n", "output": "5\n10\n"}, {"type": "stdin_stdout", "input": "2\n3 3\n3 1 2\n3 2 1\n7 2\n4 1 7 3 2 5 4\n5 1\n", "output": "5\n12\n"}... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday is the ticket release date for Aizu Entertainment's recommended idol group \"Akabeko & Koboushi\". There are four types of tickets:\n\nS seat 6000 yen\nA seat 4000 yen\nB seat 3000 yen\nC seat 2000 yen\n\nYou, the s... | [{"type": "stdin_stdout", "input": "3 57\n1 4\n1 -2\n1 2", "output": "171000\n24000\n-12000\n12000\n"}, {"type": "stdin_stdout", "input": "3 57\n1 3\n1 -2\n1 2", "output": "171000\n18000\n-12000\n12000\n"}, {"type": "stdin_stdout", "input": "3 16\n1 4\n1 -2\n1 5", "output": "48000\n24000\n-12000\n30000\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the speed skating badge test, grades are awarded when the time specified for two distances is exceeded. For example, to reach Class A, 500 M requires less than 40.0 seconds and 1000 M requires less than 1 minute and 23... | [{"type": "stdin_stdout", "input": "70.02963720383003 94.72312922368101\n103.91489947609344 168.84078141503855", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "50.825010742906116 75.69989732783311\n82.26479437960049 146.33206365267094", "output": "D\nNA\n"}, {"type": "stdin_stdout", "input": "40.991466890252... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImp is in a magic forest, where xorangles grow (wut?)\n\n [Image] \n\nA xorangle of order n is such a non-degenerate triangle, that lengths of its sides are integers not exceeding n, and the xor-sum of the lengths is equa... | [{"type": "stdin_stdout", "input": "2500\n", "output": "700393\n"}, {"type": "stdin_stdout", "input": "1216\n", "output": "160822\n"}, {"type": "stdin_stdout", "input": "2140\n", "output": "614785\n"}, {"type": "stdin_stdout", "input": "1488\n", "output": "239580\n"}, {"type": "stdin_stdout", "input": "1040\n", "output... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given array $a_1, a_2, \\ldots, a_n$, consisting of non-negative integers.\n\nLet's define operation of \"elimination\" with integer parameter $k$ ($1 \\leq k \\leq n$) as follows:\n\nChoose $k$ distinct array ind... | [{"type": "stdin_stdout", "input": "5\n4\n4 4 4 4\n4\n13 7 25 19\n6\n3 5 3 1 7 1\n1\n1\n5\n0 0 0 0 0\n", "output": "1 2 4 \n1 2 \n1 \n1 \n1 2 3 4 5 \n"}, {"type": "stdin_stdout", "input": "5\n4\n4 4 4 4\n4\n13 7 25 19\n6\n3 7 3 1 7 1\n1\n1\n5\n0 0 0 0 0\n", "output": "1 2 4\n1 2\n1 2\n1\n1 2 3 4 5\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between the easy and the hard versions is the maximum value of $k$.\n\nYou are given an infinite sequence of form \"112123123412345$\\dots$\" which consist of blocks of all consecutive positive integer... | [{"type": "stdin_stdout", "input": "19\n1\n10\n100\n1000\n10000\n100000\n1000000\n10000000\n100000000\n1000000000\n10000000000\n100000000000\n1000000000000\n10000000000000\n100000000000000\n1000000000000000\n10000000000000000\n100000000000000000\n1000000000000000000\n", "output": "1\n4\n1\n4\n9\n2\n6\n2\n6\n8\n1\n1\n9\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program of the square picking method, which is one of the classical random number generation methods. The square harvesting method was proposed by von Neumann in the mid-1940s.\n\nIn the square picking method, wh... | [{"type": "stdin_stdout", "input": "2\n387\n615", "output": "Case 1:\n1497\n2410\n8081\n3025\n1506\n2680\n1824\n3269\n6863\n1007\nCase 2:\n3782\n3035\n2112\n4605\n2060\n2436\n9340\n2356\n5507\n3270\n"}, {"type": "stdin_stdout", "input": "2\n210\n567", "output": "Case 1:\n441\n1944\n7791\n6996\n9440\n1136\n2904\n4332\n7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInaka has a disc, the circumference of which is n units. The circumference is equally divided by n points numbered clockwise from 1 to n, such that points i and i + 1 (1 β€ i < n) are adjacent, and so are points n and 1.\n... | [{"type": "stdin_stdout", "input": "30000 28\n10601 1119\n11119 20601\n9493 25771\n14351 4869\n13101 3619\n23101 13619\n29869 9351\n6119 15601\n3101 23619\n1851 22369\n11851 2369\n8619 18101\n19579 12933\n18619 28101\n16851 7369\n8101 28619\n24869 4351\n24351 14869\n2690 6851\n9869 19351\n5601 26119\n3976 21301\n21851 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova has taken his summer practice this year and now he should write a report on how it went.\n\nVova has already drawn all the tables and wrote down all the formulas. Moreover, he has already decided that the report will... | [{"type": "stdin_stdout", "input": "94 3\n4 2 1 6 1 1 1 5 1 3 3 3 6 1 6 6 3 5 3 1 4 1 3 6 4 5 3 4 6 5 5 2 1 5 4 5 6 5 2 2 6 5 4 6 1 3 5 1 2 5 5 2 1 3 4 5 6 4 3 1 4 4 1 5 4 4 2 2 2 4 4 3 6 2 6 1 5 6 1 3 5 5 1 3 5 3 5 2 6 1 3 6 1 5\n5 6 3 5 4 1 4 6 3 1 4 4 3 3 6 2 1 1 4 6 4 2 4 1 3 1 5 3 6 2 5 6 1 6 6 2 2 2 2 5 2 6 1 4 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (... | [{"type": "stdin_stdout", "input": "42\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n1 2\n", "output": "83\n"}, {"type": "stdin_stdout", "input": "42\n1 2\n1 2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a d... | [{"type": "stdin_stdout", "input": "55\n73792\n39309\n73808\n47389\n34803\n87947\n32460\n14649\n70151\n35816\n8272\n78886\n71345\n61907\n16977\n85362\n0\n43792\n8118\n83254\n89459\n32230\n87068\n82617\n94847\n83528\n37629\n31438\n97413\n62260\n13651\n47564\n43543\n61292\n51025\n64106\n0\n19282\n35422\n19657\n95170\n102... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n\"Night gathers, and now my watch begins. It shall not end until my death. I shall take no wife, hold no lands, father no children. I shall wear no crowns and win no glory. I shall live and die at my post. I am the sword ... | [{"type": "stdin_stdout", "input": "205\n5 5 3 3 6 2 9 3 8 9 6 6 10 8 1 5 3 3 1 2 9 9 9 3 9 10 3 9 8 3 5 6 6 4 6 9 2 9 10 9 5 6 6 7 4 2 6 3 4 1 10 1 7 2 7 7 3 2 6 5 5 2 9 3 8 8 7 6 6 4 2 2 6 2 3 5 7 2 2 10 1 4 6 9 2 3 7 2 2 7 4 4 9 10 7 5 8 6 5 3 6 10 2 7 5 6 6 8 3 3 9 4 3 5 7 9 3 2 1 1 3 2 1 9 3 1 4 4 10 2 5 5 8 1 4 8... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) Γ 1000 = 800... | [{"type": "stdin_stdout", "input": "6\n-10\n38\n2\n4\n-2\n8", "output": "48\n"}, {"type": "stdin_stdout", "input": "6\n-17\n38\n2\n4\n-2\n8", "output": "55\n"}, {"type": "stdin_stdout", "input": "6\n-17\n33\n2\n1\n-3\n8", "output": "50\n"}, {"type": "stdin_stdout", "input": "6\n-17\n61\n2\n1\n-3\n8", "output": "78\n"},... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSonya was unable to think of a story for this problem, so here comes the formal description.\n\nYou are given the array containing n positive integers. At one turn you can pick any element and increase or decrease it by 1... | [{"type": "stdin_stdout", "input": "75\n392 593 98 1017 515 448 220 310 475 79 539 294 208 828 75 534 875 493 94 205 656 105 546 493 60 188 222 108 788 504 809 621 934 455 307 236 630 298 938 62 850 421 839 134 950 256 934 817 209 559 866 67 990 835 534 672 733 768 757 516 959 893 275 315 692 927 321 554 801 805 885 12... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the following arithmetic progression with n terms:\n\n* x, x + d, x + 2d, \\ldots, x + (n-1)d\n\n\n\nWhat is the product of all terms in this sequence? Compute the answer modulo 1\\ 000\\ 003.\n\nYou are given Q ... | [{"type": "stdin_stdout", "input": "2\n12 1 5\n42764 449743 2019", "output": "524160\n165266\n"}, {"type": "stdin_stdout", "input": "2\n12 1 5\n42764 376063 2019", "output": "524160\n455865\n"}, {"type": "stdin_stdout", "input": "2\n12 1 5\n23772 376063 2019", "output": "524160\n755257\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA revolution took place on the Buka Island. New government replaced the old one. The new government includes n parties and each of them is entitled to some part of the island according to their contribution to the revolut... | [{"type": "stdin_stdout", "input": "50 50 50 49 26\n205 221 199 178 191 202 180 192 185 204 183 194 215 216 185 200 182 170 190 180 176 204 166 164 194 174\n", "output": "YES\naaaaabbbbccccddddeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnooooppppqqqqrrrrsssstttuuuvvvvwwwwxxxxyyyyzzz\naaaaabbbbccccddddeeffffgggghhhhiiiijjjjkkk... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches.\n\nThe current state of ... | [{"type": "stdin_stdout", "input": "20\n10 5 2 3 5 7 7 9 4 9 9 4 9 7 7 5 3 2 5 10\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "14\n7 7 7 4 3 3 4 5 4 4 5 7 7 7\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "14\n7 7 7 4 3 3 4 5 4 8 5 7 7 7\n", "output": "YES\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDenis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally... Denis asks her to be to... | [{"type": "stdin_stdout", "input": "10 10\n1101001\n0110000\n0111010\n0010000\n1010000\n0111000\n1011011\n1010010\n1101011\n1111110\n", "output": "9941743758\n"}, {"type": "stdin_stdout", "input": "10 10\n0101111\n0000000\n1111011\n1011011\n1011011\n1111011\n0010010\n1010010\n1101111\n0000000\n", "output": "8993391761\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a programing contest named SnakeUp, 2n people want to compete for it. In order to attend this contest, people need to form teams of exactly two people. You are given the strength of each possible combination of t... | [{"type": "stdin_stdout", "input": "3\n1000000\n999999 999998\n999997 999996 999995\n999994 999993 999992 999991\n999990 999989 999988 999987 999986\n", "output": "2 1 4 3 6 5\n"}, {"type": "stdin_stdout", "input": "3\n1000000\n999999 999998\n999997 999996 999995\n999994 999993 999992 999991\n999990 999989 999988 99998... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlex, Bob and Carl will soon participate in a team chess tournament. Since they are all in the same team, they have decided to practise really hard before the tournament. But it's a bit difficult for them because chess is... | [{"type": "stdin_stdout", "input": "100\n2\n3\n1\n2\n3\n3\n3\n1\n1\n1\n1\n3\n3\n3\n3\n1\n2\n3\n3\n3\n3\n3\n3\n3\n1\n2\n2\n2\n3\n1\n1\n3\n3\n3\n3\n3\n3\n3\n3\n1\n2\n3\n3\n3\n1\n1\n1\n1\n3\n3\n3\n3\n1\n2\n3\n1\n2\n2\n2\n3\n3\n2\n1\n3\n3\n1\n2\n3\n1\n1\n1\n2\n2\n2\n3\n1\n1\n1\n1\n1\n1\n3\n2\n2\n2\n2\n2\n2\n3\n1\n2\n2\n2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven an integer $x$. Your task is to find out how many positive integers $n$ ($1 \\leq n \\leq x$) satisfy $$n \\cdot a^n \\equiv b \\quad (\\textrm{mod}\\;p),$$ where $a, b, p$ are all known constants.\n\n\n-----Input--... | [{"type": "stdin_stdout", "input": "1000002 1000002 1000003 1000000000000\n", "output": "999998\n"}, {"type": "stdin_stdout", "input": "1000002 1000002 1000003 1000000000000\n", "output": "999998\n"}, {"type": "stdin_stdout", "input": "693528 398514 1000003 1000000000000\n", "output": "999995\n"}, {"type": "stdin_stdou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter rejecting 10^{100} data structure problems, Errorgorn is very angry at Anton and decided to kill him.\n\nAnton's DNA can be represented as a string a which only contains the characters \"ANTON\" (there are only 4 di... | [{"type": "stdin_stdout", "input": "1\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n", "output": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n"}, {"type": "stdin_stdout", "input": "4\nANTON\nNAAN\nAAAAAA\nOAANTTON\n", "output": "\nNNOTA\nAANN\nAAAAAA\nTNNTAOOA\n"}, {... | 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.\nThe sequence A needs to satisfy the conditions below:\n - A consists of integers between X and Y (inclusive).\n - For each 1\\leq... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "314159265 358979323846264338\n", "output": "31\n"}, {"type": "stdin_stdout", "input": "275278675 992237867823568722\n", "output": "32\n"}, {"type": "stdin_stdout", "input": "10000 1099511... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Frugal bought a new house. He feels deeply in love with his new house because it has a comfortable living room in which he can put himself completely at ease. He thinks his new house is a really good buy.\n\nBut, to h... | [{"type": "stdin_stdout", "input": "4 3\n0 1 1 1\n1 1 1 1\n1 1 1 1\n8 5\n0 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1\n1 0 1 1 1 1 1 1\n1 1 0 0 1 1 1 1\n0 1 1 1 0 1 1 1\n8 8\n0 1 1 0 0 1 1 0\n1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1\n0 1 1 0 0 1 1 0\n0 1 1 0 0 1 1 0\n1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1\n0 1 1 0 0 1 1 0\n10 10\n1 1 1 1 1 1 1 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDima and his friends have been playing hide and seek at Dima's place all night. As a result, Dima's place got messy. In the morning they decided that they need to clean the place.\n\nTo decide who exactly would clean the ... | [{"type": "stdin_stdout", "input": "100\n3 3 1 4 2 4 4 3 1 5 1 1 4 4 3 4 4 3 5 4 5 2 4 3 4 1 2 4 5 4 2 1 5 4 1 1 4 3 2 4 1 2 1 4 4 5 5 4 4 5 3 2 5 1 4 2 2 1 1 2 5 2 5 1 5 3 1 4 3 2 4 3 2 2 4 5 5 1 2 3 1 4 1 2 2 2 5 5 2 3 2 4 3 1 1 2 1 2 1 2\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "100\n2 1 1 3 5 4 4 2 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe all know the impressive story of Robin Hood. Robin Hood uses his archery skills and his wits to steal the money from rich, and return it to the poor.\n\nThere are n citizens in Kekoland, each person has ci coins. Each ... | [{"type": "stdin_stdout", "input": "123 54564\n38 44 41 42 59 3 95 15 45 32 44 69 35 83 94 57 65 85 64 47 24 20 34 86 26 91 98 12 36 96 80 4 70 40 95 38 70 22 58 50 34 84 80 45 14 60 61 43 11 56 19 59 50 63 35 15 97 98 27 13 9 71 32 18 90 10 2 99 75 87 74 83 79 37 89 3 49 27 92 95 49 1 26 82 72 75 81 37 60 98 28 28 10 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Berland each high school student is characterized by academic performance β integer value between 1 and 5.\n\nIn high school 0xFF there are two groups of pupils: the group A and the group B. Each group consists of exac... | [{"type": "stdin_stdout", "input": "100\n5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\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 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. Th... | [{"type": "stdin_stdout", "input": "100 3\n.*.\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n***\n**... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDo you know the story about the three musketeers? Anyway, you must help them now.\n\nRichelimakieu is a cardinal in the city of Bearis. He found three brave warriors and called them the three musketeers. Athos has strengt... | [{"type": "stdin_stdout", "input": "30\n34938093 71279712 25853338\n29827587 21741565 52179990 30235076 83272806 10815432 98887688 94542207 99870240 97586453 21739186 30460781 75347784 50711354 12162179 74306503 97398492 88466481 52489587 67579359 53177356 75077523 86044366 14405531 73916272 78242091 49321886 41937821 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest... | [{"type": "stdin_stdout", "input": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus got an internship in one well-known social network. His test task is to count the number of unique users who have visited a social network during the day. Polycarpus was provided with information on all user re... | [{"type": "stdin_stdout", "input": "10 3 30000\n00:06:54\n00:42:06\n03:49:45\n04:38:35\n05:33:30\n05:51:46\n10:46:34\n14:34:59\n14:40:06\n14:53:13\n", "output": "6\n1\n2\n3\n3\n3\n3\n4\n5\n6\n6\n"}, {"type": "stdin_stdout", "input": "10 3 30000\n00:06:54\n00:42:06\n03:49:45\n04:38:35\n05:33:30\n05:51:46\n10:46:34\n14:3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits \"1974\".\n\nConstraints\n\n* 0 \\leq N_1, N_2, N_3, N_4 \\leq 9\n* N_1, N_2, N_3 and N_4 are integers.\n\nIn... | [{"type": "stdin_stdout", "input": "-1 3 13 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 2 13 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 2 17 -1", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 2 -1 24", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-1 2 17 -2", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings $s$ and $t$, both consisting only of lowercase Latin letters.\n\nThe substring $s[l..r]$ is the string which is obtained by taking characters $s_l, s_{l + 1}, \\dots, s_r$ without changing the or... | [{"type": "stdin_stdout", "input": "11 3 66\nssszzzzsssz\nsss\n1 1\n1 2\n2 2\n1 3\n2 3\n3 3\n1 4\n2 4\n3 4\n4 4\n1 5\n2 5\n3 5\n4 5\n5 5\n1 6\n2 6\n3 6\n4 6\n5 10\n6 6\n1 7\n2 7\n3 7\n4 7\n5 7\n6 7\n7 7\n1 8\n2 8\n3 8\n4 8\n5 8\n6 8\n7 8\n8 8\n1 9\n2 9\n3 9\n4 9\n5 9\n6 9\n7 9\n8 9\n9 9\n1 10\n2 10\n3 10\n4 10\n5 10\n6... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile Vasya finished eating his piece of pizza, the lesson has already started. For being late for the lesson, the teacher suggested Vasya to solve one interesting problem. Vasya has an array a and integer x. He should fi... | [{"type": "stdin_stdout", "input": "100 2 1\n1 2 2 2 1 2 1 2 2 2 2 1 2 1 1 2 1 2 2 1 1 2 1 1 2 2 1 1 2 1 2 2 2 2 2 1 1 1 2 1 2 1 2 1 2 1 2 2 1 2 2 2 1 1 1 2 2 1 1 2 2 1 1 1 1 1 1 2 2 1 1 2 2 1 2 2 1 2 1 2 2 1 2 1 1 1 2 2 1 1 2 1 2 2 1 1 2 2 2 1\n", "output": "5200\n"}, {"type": "stdin_stdout", "input": "100 2 1\n1 2 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Petya very much likes gifts. Recently he has received a new laptop as a New Year gift from his mother. He immediately decided to give it to somebody else as what can be more pleasant than giving somebody gifts. And... | [{"type": "stdin_stdout", "input": "100\n42 23 48 88 36 6 18 70 96 1 34 40 46 22 39 55 85 93 45 67 71 75 59 9 21 3 86 63 65 68 20 38 73 31 84 90 50 51 56 95 72 33 49 19 83 76 54 74 100 30 17 98 15 94 4 97 5 99 81 27 92 32 89 12 13 91 87 29 60 11 52 43 35 58 10 25 16 80 28 2 44 61 8 82 66 69 41 24 57 62 78 37 79 77 53 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nE869120 found a chest which is likely to contain treasure.\n\nHowever, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters.\n\nHe also found a string S', which tu... | [{"type": "stdin_stdout", "input": "??p??d??\nabc\n", "output": "UNRESTORABLE\n"}, {"type": "stdin_stdout", "input": "?tc??@?\ncoder", "output": "UNRESTORABLE\n"}, {"type": "stdin_stdout", "input": "?tc??@?\ncnder", "output": "UNRESTORABLE\n"}, {"type": "stdin_stdout", "input": "?tc??@?\nendcr", "output": "UNRESTORABLE... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nToday we will be playing a red and white colouring game (no, this is not the Russian Civil War; these are just the colours of the Canadian flag).\n\nYou are given an $n \\times m$ grid of \"R\", \"W\", and \".\" character... | [{"type": "stdin_stdout", "input": "3\n4 6\n.R....\n......\n......\n.W....\n4 4\nR..W\n....\n....\n....\n5 1\nR\nW\nR\nW\nR\n", "output": "YES\nWRWRWR\nRWRWRW\nWRWRWR\nRWRWRW\nYES\nRWRW\nWRWR\nRWRW\nWRWR\nYES\nR\nW\nR\nW\nR\n"}, {"type": "stdin_stdout", "input": "3\n4 6\n.R....\n......\n......\n.W....\n4 4\n.R.W\n....\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGood evening, contestants.\n\nIf a and d are relatively prime positive integers, the arithmetic sequence beginning with a and increasing by d, i.e., a, a + d, a + 2d, a + 3d, a + 4d, ..., contains infinitely many prime nu... | [{"type": "stdin_stdout", "input": "367 186 151\n179 10 203\n271 37 39\n103 230 1\n27 104 285\n253 50 85\n1 1 1\n9075 337 210\n307 40 79\n331 221 177\n259 170 40\n269 75 102\n0 0 0", "output": "92809\n6709\n12037\n103\n153739\n14503\n2\n899429\n10667\n412717\n22699\n38669\n"}, {"type": "stdin_stdout", "input": "367 186... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nThere are $ N $ Amidakuji with 3 vertical lines.\nNo matter which line you start from, the Amidakuji that ends at the starting line is considered a good Amidakuji.\nYou can select one or more Amidakuji and conn... | [{"type": "stdin_stdout", "input": "3\n3 -1 0\n0 1\n1 2 -1 1 2 0", "output": "yes\n"}, {"type": "stdin_stdout", "input": "3\n3 -1 0\n0 1\n1 2 -1 1 2 1", "output": "yes\n"}, {"type": "stdin_stdout", "input": "3\n3 -1 0\n0 1\n1 2 -1 1 3 1", "output": "yes\n"}, {"type": "stdin_stdout", "input": "3\n3 -1 0\n0 1\n1 2 -1 2 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem statement\n\nN first-year students of the Faculty of Information Science and Technology of R University take the final exam of the lecture called Programming Exercise 1. The test is a perfect score of m. In other ... | [{"type": "stdin_stdout", "input": "89 111", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 11... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA palindrome is a string $t$ which reads the same backward as forward (formally, $t[i] = t[|t| + 1 - i]$ for all $i \\in [1, |t|]$). Here $|t|$ denotes the length of a string $t$. For example, the strings 010, 1001 and 0 ... | [{"type": "stdin_stdout", "input": "11\n4\n0\n1\n1\n0\n2\n0001000\n0000000000000\n2\n1\n0\n1\n1\n1\n0\n2\n11\n00\n2\n111\n000\n2\n111\n00\n2\n00\n111\n2\n11111\n00\n2\n00000100000\n000\n", "output": "4\n2\n2\n1\n1\n2\n2\n2\n2\n2\n2\n"}, {"type": "stdin_stdout", "input": "11\n4\n0\n1\n1\n0\n2\n0001000\n0000000000000\n2\... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.