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\nSalve, mi amice.\n\nEt tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.\n\nRp:\n\n I Aqua Fortis\n\n I Aqua Regia\n\n II Amalg... | [{"type": "stdin_stdout", "input": "100 100 100 100 100\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "100 100 100 100 100\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "100 110 100 100 100\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "100 110 100 110 100\n", "output": "15\n"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a given string S consisting of N symbols. Your task is to find the number of ordered pairs of integers i and j such that\n\n1. 1 ≤ i, j ≤ N\n\n2. S[i] = S[j], that is the i-th symbol of string S is equal to the j... | [{"type": "stdin_stdout", "input": "abcdefghijklmnopqrstuvwxyz0987654321abcdefghijklmnopqrstuvwxyz0987654321abcdefghijklmnopqrstuvwxyz0987654321\n", "output": "324\n"}, {"type": "stdin_stdout", "input": "1234567890zyxwvutsrqponmlkjihgfedcba1234567890zyxwvutsrqponmlkjihgfedcba1234567890zyxwvutsrqponmlkjihgfedcba\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a binary string $s$.\n\nFind the number of distinct cyclical binary strings of length $n$ which contain $s$ as a substring.\n\nThe cyclical string $t$ contains $s$ as a substring if there is some cyclical sh... | [{"type": "stdin_stdout", "input": "40\n1111110111111111111111011111111111111110\n", "output": "40\n"}, {"type": "stdin_stdout", "input": "40\n0000000000100000100000000000000000000000\n", "output": "40\n"}, {"type": "stdin_stdout", "input": "40\n0000010010000000000001000110000001010100\n", "output": "40\n"}, {"type": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe University of Aizu has a park covered with grass, and there are no trees or buildings that block the sunlight. On sunny summer days, sprinklers installed in the park operate to sprinkle water on the lawn. The frog Pyo... | [{"type": "stdin_stdout", "input": "10 1\n10\n2 6 6 3 1 2 -1 2 4 0 1 8 5 9 7 9 8 9 6 3\n6 1\n10\n10 2 5 3 1 2 0 12 4 6 1 4 9 9 11 12 8 6 14 0\n0 0", "output": "NA\nNA\n"}, {"type": "stdin_stdout", "input": "10 1\n10\n2 6 6 3 1 2 -1 2 4 0 1 8 5 9 7 9 8 9 6 3\n6 1\n10\n10 2 5 3 1 2 0 12 4 6 1 4 9 9 17 12 8 6 14 0\n0 0", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVus the Cossack has two binary strings, that is, strings that consist only of \"0\" and \"1\". We call these strings $a$ and $b$. It is known that $|b| \\leq |a|$, that is, the length of $b$ is at most the length of $a$.\... | [{"type": "stdin_stdout", "input": "10010110100000101100\n11001\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10010110100000101100\n10011\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10010110100000101100\n00010\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "10010110100000101100\n0101... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are a total of A + B cats and dogs.\nAmong them, A are known to be cats, but the remaining B are not known to be either cats or dogs.\nDetermine if it is possible that there are exactly X cats among these A + B anim... | [{"type": "stdin_stdout", "input": "-1 -1 10", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-2 -1 10", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-3 -1 10", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-3 -1 17", "output": "NO\n"}, {"type": "stdin_stdout", "input": "-5 -1 11", "output": "NO... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nColonel has n badges. He wants to give one badge to every of his n soldiers. Each badge has a coolness factor, which shows how much it's owner reached. Coolness factor can be increased by one for the cost of one coin. \n\... | [{"type": "stdin_stdout", "input": "50\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50\n", "output": "1225\n"}, {"type": "stdin_stdout", "input": "50\n50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWater Country Water Deven has n cities. Each city is surrounded by water and looks like an island country. Water Deven has m bridges, and transportation between cities is carried out by these bridges, which allows you to ... | [{"type": "stdin_stdout", "input": "5 6\n0 2 0\n0 1 0\n2 3 16\n1 3 2\n3 4 5\n0 0 1\n3 3\n0 2 3\n2 0 3\n0 1 12\n0 0", "output": "7\n15\n"}, {"type": "stdin_stdout", "input": "5 6\n0 0 1\n2 2 3\n2 3 12\n0 3 0\n2 4 14\n1 3 4\n3 3\n0 2 3\n1 0 3\n0 1 1\n0 0", "output": "30\n4\n"}, {"type": "stdin_stdout", "input": "5 6\n0 0... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is decidin... | [{"type": "stdin_stdout", "input": "740", "output": "2\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\n"}, {"type": "stdin_stdout", "input": "370", "output": "1\n2\n3\n4\n5\n6\n7\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he loves the famous drink \"Beecola\", which can be bought in n different shops in the city. It's known that th... | [{"type": "stdin_stdout", "input": "12\n35345 58181 32223 84621 35905 73863 99537 30666 67771 39229 36847 29038\n23\n55052824\n82504840\n35160556\n78141700\n73401989\n86305919\n39430705\n31939373\n23501765\n4406029\n61436920\n14295390\n34275309\n28028753\n91433780\n70158847\n2396455\n66994588\n84024224\n30175981\n34941... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe JOI Railways is the only railway company in the Kingdom of JOI. There are $N$ stations numbered from $1$ to $N$ along a railway. Currently, two kinds of trains are operated; one is express and the other one is local.\... | [{"type": "stdin_stdout", "input": "10 3 1\n10 6 -1\n10\n-1\n1\n10", "output": "3\n"}, {"type": "stdin_stdout", "input": "10 3 5\n3 2 6\n79\n-1\n13\n10", "output": "11\n"}, {"type": "stdin_stdout", "input": "16 3 10\n10 3 6\n16\n2\n11\n11", "output": "2\n"}, {"type": "stdin_stdout", "input": "10 3 1\n10 6 -1\n51\n-1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNikolay got a string $s$ of even length $n$, which consists only of lowercase Latin letters 'a' and 'b'. Its positions are numbered from $1$ to $n$.\n\nHe wants to modify his string so that every its prefix of even length... | [{"type": "stdin_stdout", "input": "8\nbbbabbba\n", "output": "2\nabbaabba\n"}, {"type": "stdin_stdout", "input": "8\nbbabbbaa\n", "output": "3\nabababba\n"}, {"type": "stdin_stdout", "input": "8\nbbbabbba\n", "output": "2\nabbaabba"}, {"type": "stdin_stdout", "input": "8\nbbabbbaa\n", "output": "3\nabababba"}, {"type"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ students and $m$ clubs in a college. The clubs are numbered from $1$ to $m$. Each student has a potential $p_i$ and is a member of the club with index $c_i$. Initially, each student is a member of exactly on... | [{"type": "stdin_stdout", "input": "20 20\n0 0 3 2 1 2 2 3 2 2 1 1 0 3 0 0 1 1 1 3\n15 1 20 13 6 12 16 8 3 14 10 5 18 17 4 9 2 11 7 19\n20\n2\n10\n7\n4\n6\n5\n14\n8\n9\n18\n13\n11\n19\n1\n16\n20\n17\n12\n15\n3\n", "output": "4\n4\n4\n4\n4\n4\n4\n4\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n0\n0\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnn and Borya have n piles with candies and n is even number. There are a_{i} candies in pile with number i.\n\nAnn likes numbers which are square of some integer and Borya doesn't like numbers which are square of any int... | [{"type": "stdin_stdout", "input": "100\n444272562 25 25 0 49 73291074 64 100 638092144 756033694 0 700405846 16 25 25 100 36 25 269573395 288578186 366853675 36 81 49 4 0 25 49 9 64 0 4 36 36 49 0 64 64 532899768 1 64 9 549673690 25 64 4 817183855 25 146555318 36 495564252 100 49 9 36 100 49 100 4 100 9 64 9 432227412... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two non-empty strings $s$ and $t$, consisting of Latin letters.\n\nIn one move, you can choose an occurrence of the string $t$ in the string $s$ and replace it with dots.\n\nYour task is to remove all occurr... | [{"type": "stdin_stdout", "input": "10\nakhvjuejwrazexjkmzfersbjnvdvdbrdvuexbdloltpllcnvqtdoooftuhphtdfcveomexsbn\ni\ndgkrbariruzn\njwa\nttbbvxlxjsksrziizcmhhxpntxvmkqvhtqqedhqprzdidcvgfgrbqyhlrpwpisajpwmbszyjntqgaoskvc\nmk\ntwakxsrktfktpkrmrxsruzjvivionieksdngxrhcifxcyzuqfaciojwifrusfrlvikfcqeextlfcudoahqqm\na\nb\nwr\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have had record hot temperatures this summer. To avoid heat stroke, you decided to buy a quantity of drinking water at the nearby supermarket. Two types of bottled water, 1 and 0.5 liter, are on sale at respective pric... | [{"type": "stdin_stdout", "input": "467 101 10577", "output": "2222\n"}, {"type": "stdin_stdout", "input": "467 100 16500", "output": "3300\n"}, {"type": "stdin_stdout", "input": "467 100 12758", "output": "2600\n"}, {"type": "stdin_stdout", "input": "467 101 12758", "output": "2626\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nC*++ language is quite similar to C++. The similarity manifests itself in the fact that the programs written in C*++ sometimes behave unpredictably and lead to absolutely unexpected effects. For example, let's imagine an ... | [{"type": "stdin_stdout", "input": "399\n469*++a-935*++a-838*++a-468*++a+79*++a-89*++a-863*++a+531*a++-523*a++-583*++a-411*++a+301*++a+201*a++-108*a+++581*a+++938*++a-16*a++-632*a+++146*a++-230*++a+151*++a-618*a+++593*a+++320*++a+750*++a+185*a++-68*++a+839*a++-853*a+++761*a++-442*a++-385*a++-487*a++-573*a++-820*a++-123... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ warriors in a row. The power of the $i$-th warrior is $a_i$. All powers are pairwise distinct.\n\nYou have two types of spells which you may cast: Fireball: you spend $x$ mana and destroy exactly $k$ conse... | [{"type": "stdin_stdout", "input": "23 5\n10 3 3\n2 1 4 11 8 10 5 6 7 9 12 3 14 13 16 18 21 15 17 19 20 23 22\n4 6 3 18 23\n", "output": "56\n"}, {"type": "stdin_stdout", "input": "23 5\n10 3 4\n2 1 4 11 8 10 5 6 7 9 12 3 14 13 16 18 21 15 17 19 20 23 22\n4 6 3 18 23\n", "output": "64\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Bob are studying for their class test together. The topic of the test is Prime Numbers. The preparation is getting too boring for their liking. To make it interesting, they turn it into a game. The winner will g... | [{"type": "stdin_stdout", "input": "4\n3 0 1\n2 12 2\n22 12 2\n2 20 1", "output": "-1\n3\n-5\n12\n"}, {"type": "stdin_stdout", "input": "4\n3 0 1\n2 19 2\n22 12 2\n2 20 1", "output": "-1\n6\n-5\n12\n"}, {"type": "stdin_stdout", "input": "4\n3 0 1\n2 12 4\n22 12 2\n2 20 1", "output": "-1\n0\n-5\n12\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nÆsir - CHAOS Æsir - V.\n\n\"Everything has been planned out. No more hidden concerns. The condition of Cytus is also perfect.\n\nThe time right now...... 00:01:12......\n\nIt's time.\"\n\nThe emotion samples are now suffi... | [{"type": "stdin_stdout", "input": "87\n1120 1120 1120 872 1120 731 3583 2815 4019 1291 4568 973 1120 1705 1120 822 203 1120 1120 1120 1120 4196 3166 4589 3030 1120 1120 1120 711 1120 500 1120 1120 3551 1120 1120 1120 1700 1120 1120 2319 4554 1120 1312 1120 1120 4176 1120 1120 3661 1120 1120 1120 1120 142 63 4125 1120 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are N integers written on a blackboard. The i-th integer is A_i.\n\nTakahashi and Aoki will arrange these integers in a row, as follows:\n\n* First, Takahashi will arrange the integers as he wishes.\n* Then, Aoki wi... | [{"type": "stdin_stdout", "input": "5\n1 12 6 0 5", "output": "1 0 6 12 5 "}, {"type": "stdin_stdout", "input": "5\n1 12 2 0 5", "output": "1 0 5 2 12 "}, {"type": "stdin_stdout", "input": "5\n1 12 3 0 5", "output": "1 0 5 3 12 "}, {"type": "stdin_stdout", "input": "5\n1 17 3 0 5", "output": "1 0 17 5 3 "}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n positive integers a_1, …, a_n, and an integer k ≥ 2. Count the number of pairs i, j such that 1 ≤ i < j ≤ n, and there exists an integer x such that a_i ⋅ a_j = x^k.\n\nInput\n\nThe first line contains two... | [{"type": "stdin_stdout", "input": "100 4\n94 94 83 27 80 73 61 38 34 95 72 96 59 36 52 15 122 78 39 22 21 57 54 59 9 32 81 64 51 90 67 41 18 58 93 76 44 62 77 61 31 70 39 73 111 57 43 31 27 85 36 26 58 48 35 23 124 53 3 14 40 67 53 19 70 81 98 12 91 15 92 90 89 86 58 30 67 73 72 69 68 47 30 7 89 41 17 97 45 6 4 23 13 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two strings $s$ and $t$ both of length $n$ and both consisting of lowercase Latin letters.\n\nIn one move, you can choose any length $len$ from $1$ to $n$ and perform the following operation: Choose any co... | [{"type": "stdin_stdout", "input": "4\n4\nabcd\nabdc\n5\nababa\nbaaba\n4\nasdf\nasdg\n4\nabcd\nbadc\n", "output": "NO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\n4\nabcd\nabdc\n5\nababa\nabaab\n4\nasdf\nasdg\n4\nabcd\nbadc\n", "output": "NO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "4\n4\ndabb\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart.\n\nLet us consider the building process. Vasya takes a brick an... | [{"type": "stdin_stdout", "input": "20\n-10 17 -4 11\n1 22 -15 6\n-5 12 -9 16\n-9 16 -5 12\n-2 19 -12 9\n-10 17 -4 11\n-8 13 -6 15\n-5 12 -9 16\n-3 18 -11 10\n-1 20 -13 8\n29 9 -12 50\n29 50 -11 10\n29 9 -12 50\n29 50 -10 11\n-14 50 29 7\n-9 12 29 50\n-14 7 29 50\n29 9 -12 50\n-11 10 29 50\n-11 50 29 10\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor a positive integer n let's define a function f:\n\nf(n) = - 1 + 2 - 3 + .. + ( - 1)^{n}n \n\nYour task is to calculate f(n) for a given integer n.\n\n\n-----Input-----\n\nThe single line contains the positive integer... | [{"type": "stdin_stdout", "input": "1000000000000000\n", "output": "500000000000000\n"}, {"type": "stdin_stdout", "input": "999999999999999\n", "output": "-500000000000000\n"}, {"type": "stdin_stdout", "input": "1000000000000000\n", "output": "500000000000000\n"}, {"type": "stdin_stdout", "input": "999999999999999\n", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour friend who lives in undisclosed country is involved in debt. He is borrowing 100,000-yen from a loan shark. The loan shark adds 5% interest of the debt and rounds it to the nearest 1,000 above week by week.\n\nWrite ... | [{"type": "stdin_stdout", "input": "291", "output": "158467928000\n"}, {"type": "stdin_stdout", "input": "188", "output": "1040975000\n"}, {"type": "stdin_stdout", "input": "214", "output": "3701387000\n"}, {"type": "stdin_stdout", "input": "190", "output": "1147676000\n"}, {"type": "stdin_stdout", "input": "143", "out... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPasha is participating in a contest on one well-known website. This time he wants to win the contest and will do anything to get to the first place!\n\nThis contest consists of n problems, and Pasha solves ith problem in ... | [{"type": "stdin_stdout", "input": "44\n750 672 846 969 981 698 380 587 813 587 156 28 446 917 1550 449 142 764 226 1406 349 622 236 782 416 689 113 325 452 265 585 217 707 50 520 712 1869 275 423 123 175 160 415 528\n4\n869 1568\n1353 1354\n1683 1685\n2532 2540\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nKaren has just arrived at school, and she has a math test today! [Image] \n\nThe test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time... | [{"type": "stdin_stdout", "input": "19\n519879446 764655030 680293934 914539062 744988123 317088317 653721289 239862203 605157354 943428394 261437390 821695238 312192823 432992892 547139308 408916833 829654733 223751525 672158759\n", "output": "\n265109293\n"}, {"type": "stdin_stdout", "input": "19\n519879446 764655030... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two rival donut shops.\n\nThe first shop sells donuts at retail: each donut costs a dollars.\n\nThe second shop sells donuts only in bulk: box of b donuts costs c dollars. So if you want to buy x donuts from thi... | [{"type": "stdin_stdout", "input": "20\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 100... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Smart Beaver from ABBYY got hooked on square matrices. Now he is busy studying an n × n size matrix, where n is odd. The Smart Beaver considers the following matrix elements good: \n\n * Elements of the main diagonal... | [{"type": "stdin_stdout", "input": "15\n0 2 1 2 1 0 2 0 2 2 2 2 2 0 2\n2 0 1 0 1 1 2 2 0 2 2 0 3 0 1\n3 3 2 2 2 1 2 3 2 3 1 2 3 3 2\n0 3 0 3 3 3 2 1 0 2 3 2 3 3 2\n3 0 0 2 1 2 3 1 1 1 2 2 2 1 0\n1 3 2 3 3 0 3 2 0 3 1 2 3 0 3\n2 2 3 2 0 0 2 3 0 1 2 1 1 2 1\n2 1 3 2 3 3 2 2 2 0 3 3 1 1 3\n0 2 1 3 1 2 0 0 1 0 0 2 0 0 0\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet S(n) denote the number that represents the digits of n in sorted order. For example, S(1) = 1, S(5) = 5, S(50394) = 3459, S(353535) = 333555.\n\nGiven a number X, compute <image> modulo 109 + 7.\n\nInput\n\nThe first ... | [{"type": "stdin_stdout", "input": "44649014054971081213608137817466046254652492627741860478258558206397113198232823859870363821007188476405951611069347299689170240023979048198711745011542774268179055311013054073075176122755643483380248999657649211459997766221072399103579977409770898200358240970169892326442892826731631... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Luba bought a very interesting book. She knows that it will take t seconds to read the book. Luba wants to finish reading as fast as she can.\n\nBut she has some work to do in each of n next days. The number of s... | [{"type": "stdin_stdout", "input": "100 1000000\n0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 -1 0 0 1 0 0 1 -1 -1 0 0 0 0 0 0 0 1 0 0 0 0 0 -1 -1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 1 0 0 0 0 -1 0 0 0\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "100 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fifth center tile: [Image] ... | [{"type": "stdin_stdout", "input": "21\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\nRJ Freight, a Japanese railroad company for freight operations has recently constructed exchange lines at Hazawa, Yokohama. The layout of the lines is shown in Figure B-1.\n\n<image>\nFigure B-1: Layout of the exchange li... | [{"type": "stdin_stdout", "input": "4\n_e\na`ba\nebbf\neddea", "output": "2\n12\n12\n13\n"}, {"type": "stdin_stdout", "input": "4\ne]\na`ba\nebbf\needea", "output": "2\n12\n12\n14\n"}, {"type": "stdin_stdout", "input": "4\n_f\n`db_\nfecf\nhaefg", "output": "2\n12\n12\n18\n"}, {"type": "stdin_stdout", "input": "4\naa\nd... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nValera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English teacher decided to have ... | [{"type": "stdin_stdout", "input": "15\nrxeeeeeeeeeeeer\nereeeeeeeeeeere\needeeeeeeeeeoee\neeereeeeeeeewee\neeeereeeeebeeee\nqeeeereeejedyee\neeeeeerereeeeee\neeeeeeereeeeeee\neeeeeerereeeeze\neeeeereeereeeee\neeeereeeeegeeee\neeereeeeeeereee\neereeeeeeqeeved\ncreeeeeeceeeere\nreeerneeeeeeeer\n", "output": "NO\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. ... | [{"type": "stdin_stdout", "input": "jkeaagakbifeaechkifkdghcjcgighidcgdccgbdbcackfgaebkddabgijkhjkaffkabacekdkjekeccegbecbkecbgbgcacgdackcdfjefaifgbigahkbedidfhjbikejdhejcgideaeejdcefeeccaefbddejkbdkfagfcdjbikbidfggkidcdcic\n", "output": "0.44919786096256686\n"}, {"type": "stdin_stdout", "input": "jkeaagakbifeaechkifkd... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nConsider the following experiment. You have a deck of m cards, and exactly one card is a joker. n times, you do the following: shuffle the deck, take the top card of the deck, look at it and return it into the deck.\n\nLe... | [{"type": "stdin_stdout", "input": "569716410 849619604 5000\n", "output": "122094144\n"}, {"type": "stdin_stdout", "input": "232213466 585535513 4789\n", "output": "454306758\n"}, {"type": "stdin_stdout", "input": "251134010 189925189 5000\n", "output": "103457138\n"}, {"type": "stdin_stdout", "input": "588636954 7308... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChef has recently learnt some new facts about the famous number π. For example, he was surprised that ordinary fractions are sometimes used to represent this number approximately. For example, 22/7, 355/113 or even 103993... | [{"type": "stdin_stdout", "input": "3\n3\n6\n82", "output": "3.141\n3.141592\n3.1415926530119026040722614947737296840070086399613316415926530119026040722614947737\n"}, {"type": "stdin_stdout", "input": "3\n3\n5\n82", "output": "3.141\n3.14159\n3.14159265301190260407226149477372968400700863996133164159265301190260407226... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlthough Inzane successfully found his beloved bone, Zane, his owner, has yet to return. To search for Zane, he would need a lot of money, of which he sadly has none. To deal with the problem, he has decided to hack the b... | [{"type": "stdin_stdout", "input": "10\n-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -1000000000\n10 3\n7 4\n2 6\n9 2\n5 10\n1 8\n7 8\n7 2\n10 6\n", "output": "-999999998\n"}, {"type": "stdin_stdout", "input": "10\n-1000000000 -1000000000 -1000000000 -10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.\n\nHe is too selfish, so for a given n he wants to obtain a string of n characters, each of... | [{"type": "stdin_stdout", "input": "89946\n", "output": "aabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaab... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn AtCoder Kingdom, Gregorian calendar is used, and dates are written in the \"year-month-day\" order, or the \"month-day\" order without the year.\n\nFor example, May 3, 2018 is written as 2018-5-3, or 5-3 without the ye... | [{"type": "stdin_stdout", "input": "-13 438", "output": "-13\n"}, {"type": "stdin_stdout", "input": "-18 766", "output": "-18\n"}, {"type": "stdin_stdout", "input": "-143 0", "output": "-143\n"}, {"type": "stdin_stdout", "input": "-212 0", "output": "-212\n"}, {"type": "stdin_stdout", "input": "-106 5", "output": "-106... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a set of strings S. Each string consists of lowercase Latin letters.\n\nFor each string in this set, you want to calculate the minimum number of seconds required to type this string. To type a string, you ha... | [{"type": "stdin_stdout", "input": "10\n0 i\n1 q\n2 g\n0 k\n1 e\n5 r\n4 m\n5 h\n3 o\n3 e\n5\n8 9 1 10 6\n", "output": "2 4 1 3 3\n"}, {"type": "stdin_stdout", "input": "10\n0 i\n1 q\n2 g\n0 k\n1 e\n5 r\n4 m\n4 g\n3 o\n3 e\n5\n8 9 1 10 6\n", "output": "2 4 1 3 2\n"}, {"type": "stdin_stdout", "input": "10\n0 i\n1 q\n2 g\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLittle Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph.\n\nThere are n toy cars. Each pair... | [{"type": "stdin_stdout", "input": "4\n-1 3 3 3\n6 -1 3 -1\n2 3 -1 3\n3 3 3 -1\n", "output": "0\n\n"}, {"type": "stdin_stdout", "input": "4\n-1 3 3 3\n6 -1 3 -1\n2 1 -1 3\n3 3 3 -1\n", "output": "0\n\n"}, {"type": "stdin_stdout", "input": "4\n-1 3 3 3\n6 -1 3 -1\n2 3 -1 2\n3 3 3 -1\n", "output": "0\n\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a string and a number k. You are suggested to generate new strings by swapping any adjacent pair of characters in the string up to k times. Write a program to report the lexicographically smallest string amo... | [{"type": "stdin_stdout", "input": "pckoshien\n16", "output": "cehikposn\n"}, {"type": "stdin_stdout", "input": "pckoshien\n30", "output": "cehiknops\n"}, {"type": "stdin_stdout", "input": "pckosiien\n26", "output": "ceiiknops\n"}, {"type": "stdin_stdout", "input": "pckoshien\n14", "output": "cehkopisn\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ashore on a foggy island. Though he was exhausted and despaired, he was still fortunate to remember a legend of the fogg... | [{"type": "stdin_stdout", "input": "2 1 1\n1 1 nn\n2 1 np\n3 2 1\n1 1 yes\n2 2 yes\n3 1 yes\n2 4 1\n1 2 yes\n2 3 no\n5 4 3\n1 2 yes\n1 3 no\n4 5 yes\n5 6 yes\n6 7 no\n0 0 0", "output": "no\n1\n3\nend\n1\n2\n4\n5\nend\n3\n4\n5\n6\nend\n"}, {"type": "stdin_stdout", "input": "2 1 1\n1 1 nn\n2 1 np\n3 2 1\n1 1 yes\n2 2 yes... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArtem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets min(a, b) points,... | [{"type": "stdin_stdout", "input": "10\n96 106 8 18 36 48 34 11 37 42\n", "output": "305\n"}, {"type": "stdin_stdout", "input": "10\n96 106 8 18 58 48 34 11 37 42\n", "output": "337\n"}, {"type": "stdin_stdout", "input": "10\n96 66 8 18 30 48 34 11 37 42\n", "output": "299\n"}, {"type": "stdin_stdout", "input": "10\n96... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe statement of this problem shares a lot with problem A. The differences are that in this problem, the probability is introduced, and the constraint is different.\n\nA robot cleaner is placed on the floor of a rectangle... | [{"type": "stdin_stdout", "input": "10\n44317 2 42112 2 19660 2 49\n48930 2 47499 1 27225 2 43\n48392 2 28544 2 34152 2 97\n43473 2 185 2 4950 1 94\n41685 2 38469 1 6333 1 18\n45137 2 29286 1 28293 2 34\n43584 2 41743 1 28092 2 83\n47658 2 33552 2 8862 1 27\n46379 2 4528 2 2818 2 58\n46926 2 14781 1 7952 1 59\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\na is an array of n positive integers, all of which are not greater than n.\n\nYou have to process q queries to this array. Each query is represented by two numbers p and k. Several operations are performed in each query; ... | [{"type": "stdin_stdout", "input": "50\n49 21 50 31 3 19 10 40 20 5 47 12 12 30 5 4 5 2 11 23 5 39 3 30 19 3 23 40 4 14 39 50 45 14 33 37 1 15 43 30 45 23 32 3 9 17 9 5 14 12\n50\n36 29\n44 24\n38 22\n30 43\n15 19\n39 2\n13 8\n29 50\n37 18\n32 19\n42 39\n20 41\n14 11\n4 25\n14 35\n17 23\n1 29\n3 19\n8 6\n26 31\n9 46\n3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJOI has a stove in your room. JOI himself is resistant to the cold, so he doesn't need to put on the stove when he is alone in the room, but he needs to put on the stove when there are visitors.\n\nOn this day, there are ... | [{"type": "stdin_stdout", "input": "2 1\n-10\n31\n0", "output": "42\n"}, {"type": "stdin_stdout", "input": "3 1\n-1\n4\n11", "output": "13\n"}, {"type": "stdin_stdout", "input": "3 1\n-1\n0\n23", "output": "25\n"}, {"type": "stdin_stdout", "input": "3 2\n-2\n6\n21", "output": "10\n"}, {"type": "stdin_stdout", "input": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOri and Sein have overcome many difficult challenges. They finally lit the Shrouded Lantern and found Gumon Seal, the key to the Forlorn Ruins. When they tried to open the door to the ruins... nothing happened.\n\nOri was... | [{"type": "stdin_stdout", "input": "20 7\n18525 35038\n15816 31586\n18641 46864\n35863 38632\n13563 35915\n41614 98684\n13573 35863\n25851 35985\n41687 55831\n31583 80871\n18525 35038\n15816 31586\n18641 46864\n35863 38632\n13563 35915\n41614 98684\n13573 35863\n25851 35985\n41687 55831\n31583 80871\n", "output": "4112... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is the easy version of the problem. The difference is that in this version, there are no nodes with already chosen colors.\n\nTheofanis is starving, and he wants to eat his favorite food, sheftalia. However, he should ... | [{"type": "stdin_stdout", "input": "010\n", "output": "153616455\n"}, {"type": "stdin_stdout", "input": "011\n", "output": "217549120\n"}, {"type": "stdin_stdout", "input": "60\n", "output": "937481864\n"}, {"type": "stdin_stdout", "input": "50\n", "output": "902552662\n"}, {"type": "stdin_stdout", "input": "59\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhat are you doing at the end of the world? Are you busy? Will you save us?\n\n\n\n[Image]\n\nNephren is playing a game with little leprechauns.\n\nShe gives them an infinite array of strings, f_{0... ∞}.\n\nf_0 is \"What... | [{"type": "stdin_stdout", "input": "10\n100000 873326525630182716\n100000 620513733919162415\n100000 482953375281256917\n100000 485328193417229962\n100000 353549227094721271\n100000 367447590857326107\n100000 627193846053528323\n100000 243833127760837417\n100000 287297493528203749\n100000 70867563577617188\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis is an interactive problem.\n\nVasya and Petya are going to play the following game: Petya has some positive integer number a. After that Vasya should guess this number using the following questions. He can say a pair... | [{"type": "stdin_stdout", "input": "100\n103\n130\n138\n126\n157\n164\n185\n120\n109\n137\n123\n147\n124\n178\n183\n155\n146\n169\n156\n153\n196\n152\n145\n110\n184\n168\n170\n177\n190\n128\n108\n182\n102\n101\n159\n150\n117\n106\n187\n194\n167\n151\n171\n195\n127\n115\n192\n114\n125\n165\n118\n113\n189\n199\n180\n139\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nArtem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets min(a, b) points,... | [{"type": "stdin_stdout", "input": "10\n96 66 8 18 30 48 34 11 37 42\n", "output": " 299\n"}, {"type": "stdin_stdout", "input": "9\n72 49 39 50 68 35 75 94 56\n", "output": " 435\n"}, {"type": "stdin_... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice and Brown are brothers in a family and each receives pocket money in celebration of the coming year. They are very close and share the total amount of the money fifty-fifty. The pocket money each receives is a multi... | [{"type": "stdin_stdout", "input": "1001 20263", "output": "10632\n"}, {"type": "stdin_stdout", "input": "1011 20263", "output": "10637\n"}, {"type": "stdin_stdout", "input": "0010 12073", "output": "6041\n"}, {"type": "stdin_stdout", "input": "0000 12073", "output": "6036\n"}, {"type": "stdin_stdout", "input": "0001 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt's one more school day now. Sasha doesn't like classes and is always bored at them. So, each day he invents some game and plays in it alone or with friends.\n\nToday he invented one simple game to play with Lena, with w... | [{"type": "stdin_stdout", "input": "251656215122324104 164397544865601257\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "669038685745448997 501718093668307460\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "255787422422806632 146884995820359999\n", "output": "YES\n"}, {"type": "stdin_stdout", "in... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGrigory has $n$ magic stones, conveniently numbered from $1$ to $n$. The charge of the $i$-th stone is equal to $c_i$.\n\nSometimes Grigory gets bored and selects some inner stone (that is, some stone with index $i$, wher... | [{"type": "stdin_stdout", "input": "10\n62159435 282618243 791521863 214307200 976959598 590907019 166397456 708291256 85377387 569889619\n296371399 546807332 272720717 689420404 273026579 74510326 749070707 104458586 450770185 466655231\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "10\n62159435 282618243 7... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarpus likes giving presents to Paraskevi. He has bought two chocolate bars, each of them has the shape of a segmented rectangle. The first bar is a_1 × b_1 segments large and the second one is a_2 × b_2 segments larg... | [{"type": "stdin_stdout", "input": "7 1\n1 7\n", "output": " 0\n 7 1\n ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nHow many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?\n\n-----Constraints-----\n - 1≤M≤23\n - M is an integer.\n\n-----Input-----\nInput is given from Standard Input in the following ... | [{"type": "stdin_stdout", "input": "182", "output": "-134\n"}, {"type": "stdin_stdout", "input": "339", "output": "-291\n"}, {"type": "stdin_stdout", "input": "-117", "output": "165\n"}, {"type": "stdin_stdout", "input": "467", "output": "-419\n"}, {"type": "stdin_stdout", "input": "-155", "output": "203\n"}, {"type": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProgrammers' kids solve this riddle in 5-10 minutes. How fast can you do it?\n\n\n-----Input-----\n\nThe input contains a single integer n (0 ≤ n ≤ 2000000000).\n\n\n-----Output-----\n\nOutput a single integer.\n\n\n-----... | [{"type": "stdin_stdout", "input": "1215860145\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "2000000000\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "143165576\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "1919020031\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "1795248373\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a tree consisting of $n$ vertices. A tree is an undirected connected acyclic graph. [Image] Example of a tree. \n\nYou have to paint each vertex into one of three colors. For each vertex, you know the cost o... | [{"type": "stdin_stdout", "input": "15\n10 34 69 39 82 49 57 22 50 25 82 37 33 62 69\n35 14 68 31 26 8 33 98 33 95 19 22 89 18 67\n80 24 10 5 26 85 69 21 29 38 89 24 78 68 88\n13 1\n6 12\n8 4\n11 9\n14 11\n15 5\n3 15\n1 10\n13 9\n7 12\n14 6\n3 2\n2 7\n4 5\n", "output": "620\n2 3 2 2 3 3 1 1 3 3 2 2 1 1 1 \n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi and Aoki will play a game using a grid with H rows and W columns of square cells. There are N obstacles on this grid; the i-th obstacle is at (X_i,Y_i). Here, we represent the cell at the i-th row and j-th colum... | [{"type": "stdin_stdout", "input": "10 10 14\n4 3\n2 2\n9 4\n9 10\n7 7\n10 2\n10 10\n5 4\n3 4\n2 8\n6 4\n5 4\n5 8\n9 0", "output": "8\n"}, {"type": "stdin_stdout", "input": "10 10 14\n4 3\n2 1\n7 3\n9 10\n7 7\n8 1\n10 10\n5 4\n2 4\n2 8\n6 4\n4 4\n9 6\n9 -1", "output": "1\n"}, {"type": "stdin_stdout", "input": "10 10 14... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhile swimming at the beach, Mike has accidentally dropped his cellphone into the water. There was no worry as he bought a cheap replacement phone with an old-fashioned keyboard. The keyboard has only ten digital equal-si... | [{"type": "stdin_stdout", "input": "9\n123456789\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "9\n103481226\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "9\n246112056\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "9\n289887167\n", "output": "YES\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to <image>. Then he measured the length of its sides, and found that each of them is equal to an integer n... | [{"type": "stdin_stdout", "input": "1000 1000 1000 1000 1000 1000\n", "output": "6000000\n"}, {"type": "stdin_stdout", "input": "718 466 729 470 714 481\n", "output": "2102808\n"}, {"type": "stdin_stdout", "input": "677 303 685 288 692 296\n", "output": "1365807\n"}, {"type": "stdin_stdout", "input": "1000 1000 1 1000 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLimak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive integer length of side. Limak has infinitely many blocks of each side length.\n\nA block with side a has volume a^... | [{"type": "stdin_stdout", "input": "1000000000000000\n", "output": "18 999999993541753\n"}, {"type": "stdin_stdout", "input": "1000000000000000\n", "output": "18 999999993541753\n"}, {"type": "stdin_stdout", "input": "1000000000000000\n", "output": "18 999999993541753\n"}, {"type": "stdin_stdout", "input": "99999999370... | 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 2 10 3 2 1 1\n3\n2 4 3\n4\n2 10 11 1\n1\n26\n2\n1 1\n3\n2 1 1\n", "output": "6\n1\n1\n1\n2\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\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \n3:33\nIt's possible for all the digits displayed on a digital clock in the hours:minutes format to be identical. The time shown above (3:33) ... | [{"type": "stdin_stdout", "input": "6\n24 60\n34 50\n10 11\n10 12\n11 11\n1 2", "output": "19\n20\n10\n11\n10\n1\n"}, {"type": "stdin_stdout", "input": "6\n24 60\n34 50\n10 11\n10 12\n13 11\n1 2", "output": "19\n20\n10\n11\n11\n1\n"}, {"type": "stdin_stdout", "input": "6\n24 60\n34 50\n10 11\n15 12\n11 11\n1 1", "outpu... | 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\nLittle Elephant likes lemonade.\n\nWhen Little Elephant visits any room, he finds the bottle of the lemonade in that room that contains the greatest number of litres of lemonade and drinks it all.\n\nThere are n rooms (nu... | [{"type": "stdin_stdout", "input": "2\n3 3\n0 2 0\n3 1 2 3\n1 11\n2 4 13\n4 7\n0 2 2 0 1 0 0\n1 14\n3 9 4 5\n7 1 2 3 4 5 6 7\n1 2", "output": "18\n36\n"}, {"type": "stdin_stdout", "input": "2\n3 3\n0 2 0\n3 1 2 3\n1 11\n2 4 13\n4 7\n0 2 2 0 1 0 0\n1 19\n3 9 4 5\n7 1 2 3 4 5 6 7\n1 2", "output": "18\n41\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProfessor Phunsuk Wangdu has performed some experiments on rays. The setup for n rays is as follows.\n\nThere is a rectangular box having exactly n holes on the opposite faces. All rays enter from the holes of the first s... | [{"type": "stdin_stdout", "input": "45\n45 44 40 43 27 29 41 39 30 34 28 26 25 42 38 19 32 24 9 37 23 21 20 18 33 36 16 22 35 17 7 4 15 31 13 11 2 3 10 12 14 6 8 5 1\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45\n", "output": "22\n"}, {"ty... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers $n$ and $m$. Calculate the number of pairs of arrays $(a, b)$ such that:\n\n the length of both arrays is equal to $m$; each element of each array is an integer between $1$ and $n$ (inclusive)... | [{"type": "stdin_stdout", "input": "1000 10\n", "output": "414070642\n"}, {"type": "stdin_stdout", "input": "1000 10\n", "output": "414070642\n"}, {"type": "stdin_stdout", "input": "1000 2\n", "output": "917124963\n"}, {"type": "stdin_stdout", "input": "1000 2\n", "output": "917124963\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ points on the plane, $(x_1,y_1), (x_2,y_2), \\ldots, (x_n,y_n)$.\n\nYou need to place an isosceles triangle with two sides on the coordinate axis to cover all points (a point is covered if it lies inside the... | [{"type": "stdin_stdout", "input": "10\n100 34\n27 17\n17 73\n12 60\n53 25\n46 31\n61 86\n22 91\n82 91\n8 41\n", "output": "173\n"}, {"type": "stdin_stdout", "input": "10\n100 34\n27 17\n17 73\n12 60\n53 25\n46 31\n51 86\n22 91\n82 91\n8 41\n", "output": "173\n"}, {"type": "stdin_stdout", "input": "10\n110 34\n27 17\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepiped of size n × m × k, split into 1 × 1 × 1 cells, each cell contains exactly one... | [{"type": "stdin_stdout", "input": "100 1 1\n0\n\n1\n\n1\n\n1\n\n0\n\n0\n\n0\n\n1\n\n1\n\n0\n\n0\n\n1\n\n0\n\n1\n\n1\n\n1\n\n1\n\n0\n\n0\n\n1\n\n1\n\n1\n\n0\n\n0\n\n0\n\n0\n\n0\n\n1\n\n1\n\n0\n\n1\n\n1\n\n1\n\n0\n\n1\n\n0\n\n0\n\n1\n\n0\n\n1\n\n1\n\n0\n\n0\n\n0\n\n0\n\n1\n\n0\n\n1\n\n0\n\n0\n\n1\n\n1\n\n1\n\n0\n\n1\n\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOnce upon a time there were several little pigs and several wolves on a two-dimensional grid of size n × m. Each cell in this grid was either empty, containing one little pig, or containing one wolf.\n\nA little pig and a... | [{"type": "stdin_stdout", "input": "10 10\n..P..WWP.W\nPP.WPPPPPP\nWWPP.PPWPP\nPPPPW..PPW\nPP.PW.P.PW\nWW..PPWWP.\n..PW...PP.\n.PPPP.PPPW\nPP.PWP..P.\nPWPPP..WWP\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "10 10\nWPPPPWPPWP\nPPPWPPPPPP\nPWPPPPWPPP\nPPPPWPPPWP\nWPPPPPPPPP\nPPPWPPWPPP\nPWPPPPPPWP\nPPPPWPPPP... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn late autumn evening n robots gathered in the cheerful company of friends. Each robot has a unique identifier — an integer from 1 to 10^9.\n\nAt some moment, robots decided to play the game \"Snowball\". Below there are... | [{"type": "stdin_stdout", "input": "4 6\n5 1000000000 1790978867 12\n", "output": "1790978867\n"}, {"type": "stdin_stdout", "input": "4 9\n5 1000000000 1766326397 19\n", "output": "1766326397\n"}, {"type": "stdin_stdout", "input": "4 9\n5 1000000000 1204240164 12\n", "output": "1204240164\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has n dice d_1, d_2, ..., d_{n}. The i-th dice shows numbers from 1 to d_{i}. Polycarp rolled all the dice and the sum of numbers they showed is A. Agrippina didn't see which dice showed what number, she knows on... | [{"type": "stdin_stdout", "input": "10 20\n1 1 1 1 5 100 1 1 1 1\n", "output": "0 0 0 0 0 95 0 0 0 0 "}, {"type": "stdin_stdout", "input": "10 20\n1 1 1 1 5 100 1 1 1 1\n", "output": "0 0 0 0 0 95 0 0 0 0\n"}, {"type": "stdin_stdout", "input": "10 20\n1 1 1 1 10 100 1 1 1 1\n", "output": "0 0 0 0 0 90 0 0 0 0"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAyrat has number n, represented as it's prime factorization p_{i} of size m, i.e. n = p_1·p_2·...·p_{m}. Ayrat got secret information that that the product of all divisors of n taken modulo 10^9 + 7 is the password to the... | [{"type": "stdin_stdout", "input": "67\n98929 19079 160079 181891 17599 91807 19079 98929 182233 92647 77477 98929 98639 182233 181891 182233 160079 98929 19079 98639 114941 98929 161341 91807 160079 22777 132361 92647 98929 77477 182233 103913 160079 77477 55711 77477 77477 182233 114941 91807 98929 19079 104393 18223... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, liouzhou_101 got a chat record of Freda and Rainbow. Out of curiosity, he wanted to know which sentences were said by Freda, and which were said by Rainbow. According to his experience, he thought that Freda alwa... | [{"type": "stdin_stdout", "input": "10\nmiao.vyscfysAtWcPkpFHdwZqAQ,UPPcjhKQTlala.\nmiao.KESqus DybUuYFoWVpo..LWZh.UqEdUsTHFlKfzqkThAUPklala.\nUNoE vfZIAdxkiWKhsHPfsqRPTNQoHgAxooVLYxRzugHjo jaEHWQFF\nCCmdIwr.UkoiYWK.Z,,ZesMpISTXNgnpYnJaWquCyL,gO\n.JvOayhXK_bgoYbfAtnXg\nbvdSzRrXoGxVgWvdXnsjEnEfxDzIQo_aZVGDGrzwuAMtzVAHio... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given two integers A and B.\nFind the largest value among A+B, A-B and A \\times B.\n\n-----Constraints-----\n - -1000 \\leq A,B \\leq 1000\n - All values in input are integers.\n\n-----Input-----\nInput is given ... | [{"type": "stdin_stdout", "input": "-17 -10", "output": "170\n"}, {"type": "stdin_stdout", "input": "-10 -10", "output": "100\n"}, {"type": "stdin_stdout", "input": "-156 -1", "output": "156\n"}, {"type": "stdin_stdout", "input": "-156 -2", "output": "312\n"}, {"type": "stdin_stdout", "input": "-156 -3", "output": "468... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn a number line there are n balls. At time moment 0 for each ball the following data is known: its coordinate xi, speed vi (possibly, negative) and weight mi. The radius of the balls can be ignored.\n\nThe balls collide ... | [{"type": "stdin_stdout", "input": "10 88\n-100 -86 12\n-88 -62 9\n-96 -73 1\n-89 -100 34\n-80 -57 18\n-81 -91 2\n-84 -100 7\n-77 -84 3\n-97 -96 10\n-52 -60 3\n", "output": "-9488.033285728\n-7931.120096426\n-8406.936891019\n-8261.349896254\n-5320.095238095\n-5795.666666667\n-6961.166666667\n-5303.428571429\n-8788.1186... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nInnokentiy likes tea very much and today he wants to drink exactly n cups of tea. He would be happy to drink more but he had exactly n tea bags, a of them are green and b are black.\n\nInnokentiy doesn't like to drink the... | [{"type": "stdin_stdout", "input": "70000 2748 31589 38411\n", "output": "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of integers. Vasya can permute (change order) its integers. He wants to do it so that as many as possible integers will become on a place where a smaller integer used to stand. Help Vasya find the m... | [{"type": "stdin_stdout", "input": "6\n300000000 200000000 300000000 200000000 1000000000 300000000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "6\n300000000 200000000 173776099 200000000 1000000000 300000000\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "6\n300000000 200000000 173776099 200000000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCreate a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.\n\n\n\nInput\n\nThe input is given in the following format:\n\n\nSales unit price, sal... | [{"type": "stdin_stdout", "input": "02,001\n50,10\n8,531", "output": "4750\n181\n"}, {"type": "stdin_stdout", "input": "0,1000\n01,05\n134,8", "output": "1077\n338\n"}, {"type": "stdin_stdout", "input": "0,1000\n01,05\n134,9", "output": "1211\n338\n"}, {"type": "stdin_stdout", "input": "0,1000\n11,05\n134,9", "output":... | 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\nGiven is a tree T with N vertices. The i-th edge connects Vertex A_i and B_i (1 \\leq A_i,B_i \\leq N).\nNow, each vertex is painted black with probability 1/2 and white with probability 1/2, which is chosen independently... | [{"type": "stdin_stdout", "input": "7\n4 7\n3 1\n2 6\n5 2\n7 1\n2 7\n", "output": "570312505\n"}, {"type": "stdin_stdout", "input": "7\n4 7\n3 1\n2 6\n5 4\n7 1\n2 7", "output": "835937507\n"}, {"type": "stdin_stdout", "input": "7\n4 7\n3 1\n3 6\n5 4\n7 1\n2 7", "output": "679687506\n"}, {"type": "stdin_stdout", "input"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLast summer Peter was at his granny's in the country, when a wolf attacked sheep in the nearby forest. Now he fears to walk through the forest, to walk round the forest, even to get out of the house. He explains this not ... | [{"type": "stdin_stdout", "input": "1000000\n", "output": "958220352\n"}, {"type": "stdin_stdout", "input": "972408\n", "output": "377259665\n"}, {"type": "stdin_stdout", "input": "956022\n", "output": "864671299\n"}, {"type": "stdin_stdout", "input": "941322\n", "output": "359985814\n"}, {"type": "stdin_stdout", "inpu... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem you are to calculate the sum of all integers from 1 to n, but you should take all powers of two with minus in the sum.\n\nFor example, for n = 4 the sum is equal to - 1 - 2 + 3 - 4 = - 4, because 1, 2 an... | [{"type": "stdin_stdout", "input": "60\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\n268435455\n268435457\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\n268435455\n268435457\n536870912\n536870911\n536870913\n1000000000\n999999999\n1\n2\n3\n4\n268435456\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLeo has developed a new programming language C+=. In C+=, integer variables can only be changed with a \"+=\" operation that adds the right-hand side value to the left-hand side variable. For example, performing \"a += b\... | [{"type": "stdin_stdout", "input": "16\n1 1 1\n3 4 6\n4 5 16\n456 123 7890123\n1 1 1000000000\n45 12 782595420\n1 1000000000 1001000000\n1 999999999 1000000100\n1 99999 676497416\n5 6 1409378894\n8 9 1376775908\n500000000 500000000 1000000000\n1000000000 1000000000 1000000000\n999999999 1000000000 1000000000\n1066 1487... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is an infinite set generated as follows:\n\n$1$ is in this set.\n\nIf $x$ is in this set, $x \\cdot a$ and $x+b$ both are in this set.\n\nFor example, when $a=3$ and $b=6$, the five smallest elements of the set are:... | [{"type": "stdin_stdout", "input": "5\n24 3 5\n10 5 11\n2097 1 4\n19260817 394 623\n19260817 233 264\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "5\n24 3 5\n10 5 11\n2097 1 4\n19260817 394 227\n19260817 233 264\n", "output": "YES\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a sorted array $a_1, a_2, \\dots, a_n$ (for each index $i > 1$ condition $a_i \\ge a_{i-1}$ holds) and an integer $k$.\n\nYou are asked to divide this array into $k$ non-empty consecutive subarrays. Every el... | [{"type": "stdin_stdout", "input": "7 6\n-3 0 -1 -2 -2 -4 -1\n", "output": "-2\n"}, {"type": "stdin_stdout", "input": "8 1\n1 1 2 3 5 8 13 21\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "5 3\n99 101 103 105 107\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "5 3\n99 101 103 105 107\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlice is playing a game with her good friend, Marisa.\n\nThere are n boxes arranged in a line, numbered with integers from 1 to n from left to right. Marisa will hide a doll in one of the boxes. Then Alice will have m cha... | [{"type": "stdin_stdout", "input": "8000 100\n7990 4432 5901 5019 423 1200 7760 5752 7422 4337 4802 2570 7354 4912 2185 2344 6538 2783 1473 5311 3987 4739 7159 1677 3438 502 2800 1318 5223 4518 4448 6451 3455 5012 1588 814 4971 5847 3849 6248 6420 3607 2610 6852 1045 3730 757 6905 5248 3738 2382 7251 1305 7380 2476 734... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Ancient Berland there were n cities and m two-way roads of equal length. The cities are numbered with integers from 1 to n inclusively. According to an ancient superstition, if a traveller visits three cities ai, bi, c... | [{"type": "stdin_stdout", "input": "4 4 4\n1 2\n2 3\n3 4\n1 3\n1 2 3\n1 3 4\n1 2 4\n1 3 2\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 4 2\n1 2\n2 3\n3 4\n1 3\n1 2 3\n1 3 4\n", "output": "4\n1 3 2 3 4\n"}, {"type": "stdin_stdout", "input": "4 4 1\n1 2\n2 3\n3 4\n1 3\n1 3 4\n", "output": "3\n1 2 3 4\n"}, ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have initially a string of N characters, denoted by A1,A2...AN. You have to print the size of the largest subsequence of string A such that all the characters in that subsequence are distinct ie. no two characters in ... | [{"type": "stdin_stdout", "input": "2\nabc\naba\n", "output": "3\n2\n"}, {"type": "stdin_stdout", "input": "2\nabd\naba", "output": "3\n2\n"}, {"type": "stdin_stdout", "input": "2\nabc\naaa", "output": "3\n1\n"}, {"type": "stdin_stdout", "input": "2\ncca\naaa", "output": "2\n1\n"}, {"type": "stdin_stdout", "input": "2\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou talked to Polycarp and asked him a question. You know that when he wants to answer \"yes\", he repeats Yes many times in a row.\n\nBecause of the noise, you only heard part of the answer — some substring of it. That i... | [{"type": "stdin_stdout", "input": "12\nYES\nesYes\ncodeforces\nes\nse\nYesY\nesYesYesYesYesYesYe\nseY\nYess\nsY\no\nYes\n", "output": "NO\nYES\nNO\nYES\nNO\nYES\nYES\nNO\nNO\nYES\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "1\nsYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesY\n", "output": "YES\n"}, {"type": "std... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Matsudaira is always careful about eco-friendliness in his life. Last month's water charge was 4280 yen, which exceeded the usual target of 4000 yen, so we have been trying to save water this month. How much have you ... | [{"type": "stdin_stdout", "input": "29\n104\n0\n-1", "output": "620\n-11360\n3130\n"}, {"type": "stdin_stdout", "input": "29\n112\n0\n-1", "output": "620\n-12640\n3130\n"}, {"type": "stdin_stdout", "input": "29\n130\n1\n-1", "output": "620\n-15520\n3130\n"}, {"type": "stdin_stdout", "input": "29\n97\n0\n-1", "output": ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given n k-digit integers. You have to rearrange the digits in the integers so that the difference between the largest and the smallest number was minimum. Digits should be rearranged by the same rule in all intege... | [{"type": "stdin_stdout", "input": "8 8\n83239439\n62184887\n58968944\n39808261\n68740623\n38480328\n81965504\n52600488\n", "output": "44481119\n"}, {"type": "stdin_stdout", "input": "8 8\n96805230\n73119021\n06552907\n86283347\n88650846\n19155689\n37032451\n19310120\n", "output": "53604668\n"}, {"type": "stdin_stdout"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's consider all integers in the range from $1$ to $n$ (inclusive).\n\nAmong all pairs of distinct integers in this range, find the maximum possible greatest common divisor of integers in pair. Formally, find the maximu... | [{"type": "stdin_stdout", "input": "100\n2\n3\n4\n6\n6\n9\n8\n9\n10\n11\n12\n23\n14\n15\n5\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n11\n20\n35\n36\n37\n38\n65\n40\n41\n42\n43\n44\n70\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\n73\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnshal and his friends love watching TV series together,but Anshal has a habit of giving spoilers.In order to tackle this his friends anagrammed the list of the shows they were planning to watch.Somehow Anshal got hold of... | [{"type": "stdin_stdout", "input": "MDSZWKDLGUIISYZKOGMGXOZKMTWHNCMZHGADQFOYZZITXHDNNRTNGSZULYBACPBJVBMNGDLICTBBDHQSAJFGDHCQFETHVUSRYEEGHSOLNSMQBCJBNQKSXMJCSCLOYDHWKNDTFTFTNTLQYUSLNCEKQPNJTAZREGOOTTJBOOUEKHUICMVPQBBJQQUJRTDXBTNWOWXCLTIXBDFFRAWKCZTUQNGHIJGLETHSPHWCCFZFIEMZHKJLKEFARNJBYPMCIWWZDTCHYDNIIBJRMVCWZJYTZHUXYJCG... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBamboo Blossoms\n\nThe bamboos live for decades, and at the end of their lives, they flower to make their seeds. Dr. ACM, a biologist, was fascinated by the bamboos in blossom in his travel to Tsukuba. He liked the flower... | [{"type": "stdin_stdout", "input": "3 2\n2 6\n10 10\n110 181\n2 371896\n0 0", "output": "5\n17\n21\n379\n5361757\n"}, {"type": "stdin_stdout", "input": "12 1\n3 1\n10 20\n100 50\n3 202868\n0 0", "output": "13\n4\n47\n150\n2792771\n"}, {"type": "stdin_stdout", "input": "2 4\n3 1\n13 35\n100 47\n4 346519\n0 0", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAlas, finding one's true love is not easy. Masha has been unsuccessful in that yet. Her friend Dasha told Masha about a way to determine the phone number of one's Prince Charming through arithmancy. \n\nThe phone number i... | [{"type": "stdin_stdout", "input": "17601120900014764776764048700928872725171605903217\n", "output": "10428170619\n"}, {"type": "stdin_stdout", "input": "78767765544454334445445555455676565433343455432332\n", "output": "11031574582\n"}, {"type": "stdin_stdout", "input": "676765666545656543321110112122111112234332221100... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.