messages listlengths 1 1 | ground_truth stringlengths 872 161M | id stringlengths 32 32 | dataset stringclasses 1
value |
|---|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter a wonderful evening in the restaurant the time to go home came. Leha as a true gentlemen suggested Noora to give her a lift. Certainly the girl agreed with pleasure. Suddenly one problem appeared: Leha cannot find h... | [{"input": "4\n1 1 1 1 1\n3 2 5 4 5\n1 1 5 5 10000\n1 4 2 5 2\n", "output": "1\n13\n93\n0\n", "type": "code"}, {"input": "10\n3 7 4 10 7\n6 1 7 10 18\n9 6 10 8 3\n1 8 3 10 3\n10 4 10 5 19\n8 9 9 10 10\n10 1 10 5 4\n8 1 9 4 18\n6 3 9 5 1\n6 6 9 6 16\n", "output": "22\n130\n0\n0\n25\n3\n0\n68\n0\n22\n", "type": "code"}, ... | 811b158b35eac12103a102b12f10da7c | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is a beautiful garden of stones in Innopolis.\n\nIts most beautiful place is the $n$ piles with stones numbered from $1$ to $n$.\n\nEJOI participants have visited this place twice. \n\nWhen they first visited it, th... | [{"input": "5\n1 2 3 4 5\n2 1 4 3 5\n", "output": "Yes\n", "type": "code"}, {"input": "5\n1 1 1 1 1\n1 0 1 0 1\n", "output": "Yes\n", "type": "code"}, {"input": "3\n2 3 9\n1 7 9\n", "output": "No\n", "type": "code"}, {"input": "40\n361 372 139 808 561 460 421 961 727 719 130 235 320 470 432 759 317 886 624 666 917 133 ... | 934bd3611c16f47df53dbfa21be2637c | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey thinks he is truly a successful developer, but in reality he didn't know about the binary search algorithm until recently. After reading some literature Andrey understood that this algorithm allows to quickly find ... | [{"input": "4 1 2\n", "output": "6\n", "type": "code"}, {"input": "123 42 24\n", "output": "824071958\n", "type": "code"}, {"input": "1 1 0\n", "output": "1\n", "type": "code"}, {"input": "1000 501 501\n", "output": "646597996\n", "type": "code"}, {"input": "1000 999 799\n", "output": "0\n", "type": "code"}, {"input": ... | d7a794d4b0390b4696e11f43bdc610eb | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nBajtek, known for his unusual gifts, recently got an integer array $x_0, x_1, \\ldots, x_{k-1}$.\n\nUnfortunately, after a huge array-party with his extraordinary friends, he realized that he'd lost it. After hours spent ... | [{"input": "5\n1 2 3 4 5\n", "output": "5\n1 2 3 4 5 ", "type": "code"}, {"input": "5\n1 3 5 6 8\n", "output": "2\n3 5 ", "type": "code"}, {"input": "3\n1 5 3\n", "output": "1\n3 ", "type": "code"}, {"input": "1\n5\n", "output": "1\n1 ", "type": "code"}, {"input": "10\n500000 500000 500000 500000 500000 500000 500000 1... | c0907e1ac4d1f713f34e41ce4190b14a | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are $n$ slimes in a row. Each slime has an integer value (possibly negative or zero) associated with it.\n\nAny slime can eat its adjacent slime (the closest slime to its left or to its right, assuming that this sli... | [{"input": "4\n2 1 2 1\n", "output": "4", "type": "code"}, {"input": "5\n0 -1 -1 -1 -1\n", "output": "4", "type": "code"}, {"input": "2\n10 8\n", "output": "2", "type": "code"}, {"input": "5\n-14 -2 0 -19 -12\n", "output": "47", "type": "code"}, {"input": "6\n-15 2 -19 20 0 9\n", "output": "65", "type": "code"}, {"inpu... | 2b7bc0ce0fd388c83595c160e5300d93 | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSome natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of th... | [{"input": "3\n11\n", "output": "1\n", "type": "code"}, {"input": "3\n99\n", "output": "0\n", "type": "code"}, {"input": "10\n5205602270\n", "output": "0\n", "type": "code"}, {"input": "70\n3326631213\n", "output": "6\n", "type": "code"}, {"input": "200\n10000000100000000000000000000100000000000000010000010000000000000... | 2e4043fa95fcbed5bdc168967f8f9628 | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.\n\nThe teacher has written down the sum of multiple numbers. Pupils should calculate the sum. To m... | [{"input": "3+2+1\n", "output": "1+2+3\n", "type": "code"}, {"input": "1+1+3+1+3\n", "output": "1+1+1+3+3\n", "type": "code"}, {"input": "2\n", "output": "2\n", "type": "code"}, {"input": "2+2+1+1+3\n", "output": "1+1+2+2+3\n", "type": "code"}, {"input": "2+1+2+2+2+3+1+3+1+2\n", "output": "1+1+1+2+2+2+2+2+3+3\n", "type... | 2b127a6c62af05e03e48ac4e7112c6ce | 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... | [{"input": "5 3\n0 1 2 2 0\n1 2 2 3 2\n5\n3\n2\n4\n5\n1\n", "output": "3\n1\n1\n1\n0\n", "type": "code"}, {"input": "5 3\n0 1 2 2 1\n1 3 2 3 2\n5\n4\n2\n3\n5\n1\n", "output": "3\n2\n2\n1\n0\n", "type": "code"}, {"input": "5 5\n0 1 2 4 5\n1 2 3 4 5\n4\n2\n3\n5\n4\n", "output": "1\n1\n1\n1\n", "type": "code"}, {"input": ... | f72f6c50394787652ffbb964db61256a | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOstap already settled down in Rio de Janiero suburb and started to grow a tree in his garden. Recall that a tree is a connected undirected acyclic graph. \n\nOstap's tree now has n vertices. He wants to paint some vertice... | [{"input": "2 0\n1 2\n", "output": "1\n", "type": "code"}, {"input": "2 1\n1 2\n", "output": "3\n", "type": "code"}, {"input": "4 1\n1 2\n2 3\n3 4\n", "output": "9\n", "type": "code"}, {"input": "7 2\n1 2\n2 3\n1 4\n4 5\n1 6\n6 7\n", "output": "91\n", "type": "code"}, {"input": "1 0\n", "output": "1\n", "type": "code"}... | b8217840dea518ac49b3940ac9183ac5 | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe first algorithm for detecting a face on the image working in realtime was developed by Paul Viola and Michael Jones in 2001. A part of the algorithm is a procedure that computes Haar features. As part of this task, we... | [{"input": "6 8\nBBBBBBBB\nBBBBBBBB\nBBBBBBBB\nWWWWWWWW\nWWWWWWWW\nWWWWWWWW\n", "output": "2\n", "type": "code"}, {"input": "3 3\nWBW\nBWW\nWWW\n", "output": "4\n", "type": "code"}, {"input": "3 6\nWWBBWW\nWWBBWW\nWWBBWW\n", "output": "3\n", "type": "code"}, {"input": "4 4\nBBBB\nBBBB\nBBBB\nBBBW\n", "output": "4\n", "... | f547e94d09cd6987ab96a77e995cd3d6 | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem, a $n \\times m$ rectangular matrix $a$ is called increasing if, for each row of $i$, when go from left to right, the values strictly increase (that is, $a_{i,1}<a_{i,2}<\\dots<a_{i,m}$) and for each colum... | [{"input": "4 5\n1 3 5 6 7\n3 0 7 0 9\n5 0 0 0 10\n8 9 10 11 12\n", "output": "144\n", "type": "code"}, {"input": "3 3\n1 2 3\n2 0 4\n4 5 6\n", "output": "30\n", "type": "code"}, {"input": "3 3\n1 2 3\n3 0 4\n4 5 6\n", "output": "-1\n", "type": "code"}, {"input": "3 3\n1 2 3\n2 3 4\n3 4 2\n", "output": "-1\n", "type": ... | 0cab7c559cc44ed5b98cea104536ee69 | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFor integers b (b \\geq 2) and n (n \\geq 1), let the function f(b,n) be defined as follows:\n - f(b,n) = n, when n < b\n - f(b,n) = f(b,\\,{\\rm floor}(n / b)) + (n \\ {\\rm mod} \\ b), when n \\geq b\nHere, {\\rm floor}... | [{"input": "87654\n30\n", "output": "10\n", "type": "code"}, {"input": "87654\n138\n", "output": "100\n", "type": "code"}, {"input": "87654\n45678\n", "output": "-1\n", "type": "code"}, {"input": "31415926535\n1\n", "output": "31415926535\n", "type": "code"}, {"input": "1\n31415926535\n", "output": "-1\n", "type": "cod... | 9af28efda47122106d3d3cbfb6c56b1f | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number is another matter. It is aesthetically pleasing, and it has a number of r... | [{"input": "1 1\n", "output": "40\n", "type": "code"}, {"input": "1 42\n", "output": "1\n", "type": "code"}, {"input": "6 4\n", "output": "172\n", "type": "code"}, {"input": "3 1\n", "output": "2530\n", "type": "code"}, {"input": "42 1\n", "output": "1179858\n", "type": "code"}, {"input": "10000 239\n", "output": "1168... | c390e12d92e3f803fe81d289c99dcdb2 | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently you have received two positive integer numbers $x$ and $y$. You forgot them, but you remembered a shuffled list containing all divisors of $x$ (including $1$ and $x$) and all divisors of $y$ (including $1$ and $y... | [{"input": "10\n10 2 8 1 2 4 1 20 4 5\n", "output": "20 8\n", "type": "code"}, {"input": "4\n9973 9973 1 1\n", "output": "9973 9973\n", "type": "code"}, {"input": "66\n35 90 36 7560 189 14 360 180 168 12 1 252 21 8 630 15 40 1512 18 9973 108 7 540 3 210 270 2520 504 1890 6 378 70 1080 30 20 84 1260 420 105 9 135 28 60 ... | 7ebbe2e7a034c6c858d9044dbb6a699c | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a problemset consisting of $n$ problems. The difficulty of the $i$-th problem is $a_i$. It is guaranteed that all difficulties are distinct and are given in the increasing order.\n\nYou have to assemble the ... | [{"input": "10\n1 2 5 6 7 10 21 23 24 49\n", "output": "4\n", "type": "code"}, {"input": "5\n2 10 50 110 250\n", "output": "1\n", "type": "code"}, {"input": "6\n4 7 12 100 150 199\n", "output": "3\n", "type": "code"}, {"input": "1\n1000000000\n", "output": "1\n", "type": "code"}, {"input": "2\n1 2\n", "output": "2\n", ... | 0fb99dd4ba0acceaa7431d7e18dfba09 | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer sequence $a_1, a_2, \\dots, a_n$.\n\nFind the number of pairs of indices $(l, r)$ ($1 \\le l \\le r \\le n$) such that the value of median of $a_l, a_{l+1}, \\dots, a_r$ is exactly the given numbe... | [{"input": "5 4\n1 4 5 60 4\n", "output": "8\n", "type": "code"}, {"input": "3 1\n1 1 1\n", "output": "6\n", "type": "code"}, {"input": "15 2\n1 2 3 1 2 3 1 2 3 1 2 3 1 2 3\n", "output": "97\n", "type": "code"}, {"input": "1 1\n1\n", "output": "1\n", "type": "code"}, {"input": "2 1\n1 2\n", "output": "2\n", "type": "co... | ca3d9bba40ea3b2c17a4cfd70e37dc5a | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a permutation $p_1, p_2, \\dots, p_n$. A permutation of length $n$ is a sequence such that each integer between $1$ and $n$ occurs exactly once in the sequence.\n\nFind the number of pairs of indices $(l, r)... | [{"input": "5 4\n2 4 5 3 1\n", "output": "4\n", "type": "code"}, {"input": "5 5\n1 2 3 4 5\n", "output": "1\n", "type": "code"}, {"input": "15 8\n1 15 2 14 3 13 4 8 12 5 11 6 10 7 9\n", "output": "48\n", "type": "code"}, {"input": "1 1\n1\n", "output": "1\n", "type": "code"}, {"input": "2 1\n1 2\n", "output": "2\n", "t... | d5d753fc449988807bedee39b05ca89f | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are two sisters Alice and Betty. You have $n$ candies. You want to distribute these $n$ candies between two sisters in such a way that: Alice will get $a$ ($a > 0$) candies; Betty will get $b$ ($b > 0$) candies; ... | [{"input": "6\n7\n1\n2\n3\n2000000000\n763243547\n", "output": "3\n0\n0\n1\n999999999\n381621773\n", "type": "code"}, {"input": "2\n1\n2\n", "output": "0\n0\n", "type": "code"}, {"input": "1\n108139\n", "output": "54069\n", "type": "code"}, {"input": "5\n1\n1\n1\n1\n1\n", "output": "0\n0\n0\n0\n0\n", "type": "code"}, {... | 6030a2a7ba30edca9b0aac86ee36da0f | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n persons who initially don't know each other. On each morning, two of them, who were not friends before, become friends.\n\nWe want to plan a trip for every evening of m days. On each trip, you have to select a... | [{"input": "4 4 2\n2 3\n1 2\n1 3\n1 4\n", "output": "0\n0\n3\n3\n", "type": "code"}, {"input": "5 8 2\n2 1\n4 2\n5 4\n5 2\n4 3\n5 1\n4 1\n3 2\n", "output": "0\n0\n0\n3\n3\n4\n4\n5\n", "type": "code"}, {"input": "5 7 2\n1 5\n3 2\n2 5\n3 4\n1 2\n5 3\n1 3\n", "output": "0\n0\n0\n0\n3\n4\n4\n", "type": "code"}, {"input": "... | 550450240449db4654469cafa0a52b16 | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nXenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.\n\nThe teacher has written down the sum of multiple numbers. Pupils should calculate the sum. To m... | [{"input": "2\n", "output": "2\n", "type": "code"}, {"input": "3+2+1\n", "output": "1+2+3\n", "type": "code"}, {"input": "1+1+3+1+3\n", "output": "1+1+1+3+3\n", "type": "code"}, {"input": "2+2+1+1+3\n", "output": "1+1+2+2+3\n", "type": "code"}, {"input": "3+1\n", "output": "1+3\n", "type": "code"}, {"input": "1+3\n", "... | 4ed91a995e908a6994e25bbcef2a2cfa | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nJoisino is planning to open a shop in a shopping street.\n\nEach of the five weekdays is divided into two periods, the morning and the evening. For each of those ten periods, a shop must be either open during the whole pe... | [{"input": "1\n1 1 0 1 0 0 0 1 0 1\n3 4 5 6 7 8 9 -2 -3 4 -2", "output": "8", "type": "code"}, {"input": "3\n1 1 1 1 1 1 0 0 1 1\n0 1 0 1 1 1 1 0 1 0\n1 0 1 1 0 1 0 1 0 1\n-8 6 -2 -8 -8 4 8 7 -6 2 2\n-9 2 0 1 7 -5 0 -2 -6 5 5\n6 -6 7 -9 6 -5 8 0 -9 -7 -7", "output": "23", "type": "code"}, {"input": "2\n1 1 1 1 1 0 0 0 ... | 3e20c8a46e3cb6bdee90bff720dbbf55 | code_stdio |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 2