messages listlengths 1 1 | ground_truth stringlengths 88 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "Solve the following coding problem using the programming language python:\n\nShuseki Kingdom is the world's leading nation for innovation and technology. There are n cities in the kingdom, numbered from 1 to n.\n\nThanks to Mr. Kitayuta's research, it has finally become possible to construct telep... | [{"type": "stdin_stdout", "input": "7 13\n6 1\n7 2\n3 7\n6 5\n3 6\n7 4\n3 5\n4 1\n3 1\n1 5\n1 6\n4 2\n2 4\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "7 13\n6 1\n7 2\n3 7\n6 5\n3 6\n7 4\n3 7\n4 1\n3 1\n1 5\n1 6\n4 2\n2 4\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "7 13\n6 1\n7 2\n3 7\n6 5\n3 6\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFind the price of a product before tax such that, when the consumption tax rate is 8 percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)\nHe... | [{"type": "stdin_stdout", "input": "80 100\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "68 85\n", "output": "850\n"}, {"type": "stdin_stdout", "input": "24 30\n", "output": "300\n"}, {"type": "stdin_stdout", "input": "25 32\n", "output": "320\n"}, {"type": "stdin_stdout", "input": "27 34\n", "output": "3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEvery year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems.\n\nThis is your first year at summer camp, and you are asked to solve the following problem. All integers starting wi... | [{"type": "stdin_stdout", "input": "1000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "1000\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "999\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "100\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "123\n", "output": "6\n"}, {"type": "st... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA sequence a0, a1, ..., at - 1 is called increasing if ai - 1 < ai for each i: 0 < i < t.\n\nYou are given a sequence b0, b1, ..., bn - 1 and a positive integer d. In each move you may choose one element of the given sequ... | [{"type": "stdin_stdout", "input": "100 3\n329 226 331 909 962 112 837 1005 194 818 506 416 125 648 367 459 400 582 989 547 329 438 234 121 272 226 821 376 834 427 718 164 834 113 654 177 737 212 169 696 744 180 89 944 233 147 667 990 809 1072 1085 1093 814 265 1067 312 833 572 303 901 1032 504 185 817 389 158 613 723 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer recently bought three paint cans.\nThe color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c.\nHere, the color of each... | [{"type": "stdin_stdout", "input": "11 12 -1", "output": "3\n"}, {"type": "stdin_stdout", "input": "11 20 -1", "output": "3\n"}, {"type": "stdin_stdout", "input": "3 3 33\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "5 -1 33", "output": "3\n"}, {"type": "stdin_stdout", "input": "5 -2 33", "output": "3\n"}, {... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA bracket sequence is a string containing only characters \"(\" and \")\". A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters \"1\" and \"... | [{"type": "stdin_stdout", "input": "40 36\n((((((((()()()))))))))((())((()())))(())\n", "output": "((((((((()()()))))))))((())((()())))\n"}, {"type": "stdin_stdout", "input": "40 34\n((((((((()()()))))))))((())((()())))(())\n", "output": "((((((((()()()))))))))((())((())))\n"}, {"type": "stdin_stdout", "input": "40 32\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has exactly two distinct positive integer divisors.\n\nConsider positive integers a, a ... | [{"type": "stdin_stdout", "input": "100000 1000000 7821\n", "output": "108426\n"}, {"type": "stdin_stdout", "input": "10000 1000000 60000\n", "output": "793662\n"}, {"type": "stdin_stdout", "input": "10000 1000000 60000\n", "output": "793662"}, {"type": "stdin_stdout", "input": "100000 1000000 7821\n", "output": "10842... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Convert number to reversed array of digits\n\nGiven a random non-negative number, you have to return the digits of this number within an array in reverse order.\n\n## Example:\n\n```\n348597 => [7,9,5,8,4,3]\n```\n\nWri... | [{"input": "548702838394", "output": "[[4, 9, 3, 8, 3, 8, 2, 0, 7, 8, 4, 5]]", "fn_name": "digitize"}, {"input": "45762893920", "output": "[[0, 2, 9, 3, 9, 8, 2, 6, 7, 5, 4]]", "fn_name": "digitize"}, {"input": "984764738", "output": "[[8, 3, 7, 4, 6, 7, 4, 8, 9]]", "fn_name": "digitize"}, {"input": "23582357", "output... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.\n\nTo settle this ... | [{"type": "stdin_stdout", "input": "tinkoff\nzscoder\n", "output": "fzfsirk\n"}, {"type": "stdin_stdout", "input": "tinkoff\nzscoder\n", "output": "fzfsirk\n"}, {"type": "stdin_stdout", "input": "tinkogf\nzscoder\n", "output": "fzgsirk"}, {"type": "stdin_stdout", "input": "thnkogf\nzscoder\n", "output": "fzgshrk"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya likes to solve equations. Today he wants to solve $(x~\\mathrm{div}~k) \\cdot (x \\bmod k) = n$, where $\\mathrm{div}$ and $\\mathrm{mod}$ stand for integer division and modulo operations (refer to the Notes below f... | [{"type": "stdin_stdout", "input": "999983 1000\n", "output": "999983001\n"}, {"type": "stdin_stdout", "input": "999995 1000\n", "output": "199999005\n"}, {"type": "stdin_stdout", "input": "1709131 435\n", "output": "743471986\n"}, {"type": "stdin_stdout", "input": "232207 1179\n", "output": "273772054\n"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe R1 company wants to hold a web search championship. There were n computers given for the competition, each of them is connected to the Internet. The organizers believe that the data transfer speed directly affects the... | [{"type": "stdin_stdout", "input": "80 50\n15160 6853 20254 11358 19535 27691 2983 31650 9219 11833 32053 31695 21511 4320 4384 24843 1454 31543 18796 13815 1546 27926 16276 14315 12542 25370 24890 29647 3584 17867 12446 15072 19852 30207 16361 7964 5343 398 10837 31114 9252 12767 15098 22562 32637 31823 8160 12658 642... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nMr. ukuku1333 is a little sloppy, so when I expanded the product of the linear expressions of x, I couldn't figure out the original linear expression.\nGiven the nth degree polynomial of x, factor it into the p... | [{"type": "stdin_stdout", "input": "x^5+15x^4+85x^3+225x^2+274x+120", "output": "(x+1)(x+2)(x+3)(x+4)(x+5)"}, {"type": "stdin_stdout", "input": "x^3-81x^2-1882x-1800", "output": "(x-100)(x+1)(x+18)"}, {"type": "stdin_stdout", "input": "x^2+4x+3", "output": "(x+1)(x+3)\n"}, {"type": "stdin_stdout", "input": "x^2+3x+2", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWhen a boy was cleaning up after his grand father passing, he found an old paper:\n\n<image>\n\n\n\nIn addition, other side of the paper says that \"go ahead a number of steps equivalent to the first integer, and turn clo... | [{"type": "stdin_stdout", "input": "56,65\n97,54\n64,-4\n55,76\n42,-27\n43,80\n87,-86\n55,-6\n89,34\n5,59\n0,0", "output": "181\n-212\n"}, {"type": "stdin_stdout", "input": "56,65\n97,54\n64,-4\n55,76\n42,-27\n43,80\n77,-86\n55,-6\n89,34\n95,5\n0,0", "output": "180\n-297\n"}, {"type": "stdin_stdout", "input": "56,65\n9... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem Statement\n\n\"Everlasting -One-\" is an award-winning online game launched this year. This game has rapidly become famous for its large number of characters you can play.\n\nIn this game, a character is character... | [{"type": "stdin_stdout", "input": "12 2\n2 2\n4 12\n6 0\n100000 0\n0 0", "output": "2049\n64\n607723520\n"}, {"type": "stdin_stdout", "input": "12 2\n1 2\n4 3\n6 0\n100000 0\n0 0", "output": "1025\n64\n607723520\n"}, {"type": "stdin_stdout", "input": "12 2\n2 2\n4 3\n6 0\n100000 0\n0 0", "output": "2049\n64\n607723520... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day Vasya got hold of information on the Martian dollar course in bourles for the next n days. The buying prices and the selling prices for one dollar on day i are the same and are equal to ai. Vasya has b bourles. He... | [{"type": "stdin_stdout", "input": "93 867\n131 1270 616 1027 1685 27 1662 947 1480 20 1394 1528 191 1348 37 1694 1772 1706 1394 49 1391 878 1474 307 101 1129 1064 116 143 1239 261 651 1534 1348 1604 636 793 1188 1293 36 1729 1204 1656 1579 1644 661 1470 341 1709 1860 1081 1539 5 1892 1732 1049 419 25 1086 1263 967 128... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\nFor the given set `S` its powerset is the set of all possible subsets of `S`.\n\nGiven an array of integers nums, your task is to return the powerset of its elements.\n\nImplement an algorithm that does it in a de... | [{"input": "[125, 15, 155, 15, 158]", "output": "[[[], [158], [15], [15, 158], [155], [155, 158], [155, 15], [155, 15, 158], [15], [15, 158], [15, 15], [15, 15, 158], [15, 155], [15, 155, 158], [15, 155, 15], [15, 155, 15, 158], [125], [125, 158], [125, 15], [125, 15, 158], [125, 155], [125, 155, 158], [125, 155, 15], ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought it... | [{"type": "stdin_stdout", "input": "5 10 15\nDdunkjly\n13 12 4\n83 26 1\n63 42 3\n83 22 2\n57 33 0\n59 10 1\n89 31 1\n57 17 2\n98 79 5\n46 41 3\nFbpbc\n28 21 0\n93 66 5\n66 21 0\n68 58 0\n59 17 3\n57 23 1\n72 71 1\n55 51 2\n58 40 5\n70 67 2\nKeiotmh\n73 44 4\n98 14 0\n19 7 0\n55 10 5\n30 25 4\n66 48 2\n66 51 4\n82 79 3... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n~~~if-not:ruby,python\nReturn `1` when *any* odd bit of `x` equals 1; `0` otherwise.\n~~~\n~~~if:ruby,python\nReturn `true` when *any* odd bit of `x` equals 1; `false` otherwise.\n~~~\n\nAssume that:\n* `x` is an unsigned... | [{"input": "2863311530", "output": "[true]", "fn_name": "any_odd"}, {"input": "24082", "output": "[true]", "fn_name": "any_odd"}, {"input": "1024", "output": "[false]", "fn_name": "any_odd"}, {"input": "1365", "output": "[false]", "fn_name": "any_odd"}, {"input": "128", "output": "[true]", "fn_name": "any_odd"}, {"inpu... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDefine a function that takes one integer argument and returns logical value `true` or `false` depending on if the integer is a prime.\n\nPer Wikipedia, a prime number (or a prime) is a natural number greater than 1 that h... | [{"input": "75", "output": "[false]", "fn_name": "is_prime"}, {"input": "-1", "output": "[false]", "fn_name": "is_prime"}, {"input": "0", "output": "[false]", "fn_name": "is_prime"}, {"input": "1", "output": "[false]", "fn_name": "is_prime"}, {"input": "73", "output": "[true]", "fn_name": "is_prime"}, {"input": "2", "o... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEmacs is a text editor which is widely used by many programmers.\n\nThe advantage of Emacs is that we can move a cursor without arrow keys and the mice. For example, the cursor can be moved right, left, down, and up by pu... | [{"type": "stdin_stdout", "input": "hyo\nnh\nEND_OF_TEXT\ne\nd\nf\nf\nk\np\np\ne\ny\na\nk\ny\ny\nn\ny\n-", "output": "hyonhhyonhhyonh\n"}, {"type": "stdin_stdout", "input": "hyn\nnh\nEND_OF_TEXT\ne\nd\nf\nf\nk\np\np\ne\nx\na\nk\ny\ny\nn\ny\n-", "output": "hynnhhynnhhynnh\n"}, {"type": "stdin_stdout", "input": "oyh\nni\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSanta Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string s_{i} having the same length n. We denote the beauty o... | [{"type": "stdin_stdout", "input": "10 20\njvyxocgomfmrtllgmagp 13\ngvtjnyaofrswcnnifzfq 17\nqisxpseggpjfoijmqnel -5\nlenqmjiofjpggespxsiq 14\nqfzfinncwsrfoaynjtvg 14\ncaayidazlylxyisihdhx 14\npgamglltrmfmogcoxyvj 11\nxhdhisiyxlylzadiyaac 2\ntbirihfpjgbbtclpxwhv 19\nvhwxplctbbgjpfhiribt 10\n", "output": "109\n"}, {"typ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAnya loves to fold and stick. Today she decided to do just that.\n\nAnya has n cubes lying in a line and numbered from 1 to n from left to right, with natural numbers written on them. She also has k stickers with exclamat... | [{"type": "stdin_stdout", "input": "25 16 13326087796\n157576937 627434432 942652043 706432863 631136945 714549755 465703470 663358517 695561723 249240606 833566455 396564536 758483017 253748999 978210764 530023233 193812243 317718202 184788435 892848108 150420430 330992298 780787784 196460118 674015883\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n stone quarries in Petrograd.\n\nEach quarry owns mi dumpers (1 ≤ i ≤ n). It is known that the first dumper of the i-th quarry has xi stones in it, the second dumper has xi + 1 stones in it, the third has xi + ... | [{"type": "stdin_stdout", "input": "30\n53 12\n13 98\n21 60\n76 58\n39 5\n62 58\n73 80\n13 75\n37 45\n44 86\n1 85\n13 33\n17 50\n12 26\n97 48\n52 40\n2 71\n95 79\n38 76\n24 54\n91 39\n97 92\n94 80\n50 61\n33 56\n22 91\n39 94\n31 56\n28 16\n20 44\n", "output": "tolik\n"}, {"type": "stdin_stdout", "input": "30\n53 12\n13... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an array of integers $a$ of length $n$. The elements of the array can be either different or the same.\n\nEach element of the array is colored either blue or red. There are no unpainted elements in the array... | [{"type": "stdin_stdout", "input": "8\n4\n1 2 5 2\nBRBR\n2\n1 2\nBB\n5\n3 1 4 2 5\nBRRBR\n5\n4 1 3 1 4\nRBRRB\n5\n5 1 5 1 10\nRBRRA\n4\n2 2 2 2\nBRBR\n2\n1 -3\nBR\n4\n-2 -1 4 0\nRRRR\n", "output": "YES\nYES\nYES\nYES\nNO\nYES\nYES\nYES\n"}, {"type": "stdin_stdout", "input": "8\n4\n1 2 5 2\nBRBR\n2\n1 2\nBB\n5\n3 1 4 2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nD: Arrow / Arrow\n\nproblem\n\nrodea is in a one-dimensional coordinate system and stands at x = 0. From this position, throw an arrow of positive integer length that always moves at speed 1 towards the target at x = N. H... | [{"type": "stdin_stdout", "input": "11 1\n11\n1\n16", "output": "1\n"}, {"type": "stdin_stdout", "input": "11 1\n11\n1\n6", "output": "-1\n"}, {"type": "stdin_stdout", "input": "15 1\n3\n1\n2", "output": "13\n"}, {"type": "stdin_stdout", "input": "15 1\n6\n1\n5", "output": "10\n"}, {"type": "stdin_stdout", "input": "15... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven a set of $N$ axis-aligned rectangles in the plane, find the area of regions which are covered by at least one rectangle.\n\nConstraints\n\n* $ 1 \\leq N \\leq 2000 $\n* $ −10^9 \\leq x1_i < x2_i\\leq 10^9 $\n* $ −10... | [{"type": "stdin_stdout", "input": "4\n0 0 3 1\n-1 0 1 3\n-1 2 4 3\n3 0 3 3", "output": "11\n"}, {"type": "stdin_stdout", "input": "4\n0 0 3 1\n-1 0 1 3\n-1 0 4 3\n2 0 3 2", "output": "15\n"}, {"type": "stdin_stdout", "input": "4\n0 0 3 2\n-1 0 1 3\n-1 0 8 3\n2 0 3 2", "output": "27\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are three cells on an infinite 2-dimensional grid, labeled $A$, $B$, and $F$. Find the length of the shortest path from $A$ to $B$ if:\n\nin one move you can go to any of the four adjacent cells sharing a side;\n\nv... | [{"type": "stdin_stdout", "input": "7\n\n2 2\n0 3\n-1 2\n\n2 5\n2 2\n0 3\n\n1000 144\n1000 2\n1000 0000\n\n0 2\n3 10\n2 10\n\n0 13\n12 8\n2 10\n\n0 1\n4 1\n1 2\n\n2 413\n0 10\n1 0\n", "output": "3\n3\n142\n11\n17\n4\n405\n"}, {"type": "stdin_stdout", "input": "7\n\n2 2\n1 3\n-1 2\n\n2 5\n2 1\n2 3\n\n1000 144\n1000 1\n1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAfter a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positione... | [{"type": "stdin_stdout", "input": "10894 92356\n", "output": "46178\n46179\n46177\n46180\n46176\n46181\n46175\n46182\n46174\n46183\n46173\n46184\n46172\n46185\n46171\n46186\n46170\n46187\n46169\n46188\n46168\n46189\n46167\n46190\n46166\n46191\n46165\n46192\n46164\n46193\n46163\n46194\n46162\n46195\n46161\n46196\n46160... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rooted tree with vertices numerated from $1$ to $n$. A tree is a connected graph without cycles. A rooted tree has a special vertex named root.\n\nAncestors of the vertex $i$ are all vertices on the path f... | [{"type": "stdin_stdout", "input": "8\n2 1\n-1 0\n1 1\n1 1\n1 1\n4 0\n5 1\n7 1\n", "output": "1 3 5 7 8\n"}, {"type": "stdin_stdout", "input": "8\n2 1\n-1 0\n1 1\n1 1\n1 1\n4 0\n5 1\n7 0\n", "output": "1 3 5\n"}, {"type": "stdin_stdout", "input": "8\n2 1\n-1 0\n1 0\n1 1\n2 1\n4 0\n5 1\n7 1\n", "output": "5 7 8\n"}, {"t... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\nCity i is established in year Y_i and belongs to Prefecture P_i.\nYou can assume that there are no multiple citie... | [{"type": "stdin_stdout", "input": "75634 912\n18125 601244640\n58230 951349939\n4017 753730550\n23636 124912128\n45120 23758881\n51811 316477853\n19326 139861106\n48018 406348942\n68864 391719264\n1850 712458521\n2796 385027567\n12731 564315721\n43367 828330253\n30104 102450015\n64351 340641907\n19781 414658282\n53502... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProf. Hachioji has devised a new numeral system of integral numbers with four lowercase letters \"m\", \"c\", \"x\", \"i\" and with eight digits \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\". He doesn't use digit... | [{"type": "stdin_stdout", "input": "10\nxi x8i\ni 9i\nc2x2i 5c9x8i\nm2ci 4m7c9x8i\n8c9x8i i\ni 9m9c9x8i\nm i\ni m\nm9i i\n8m9c7xi c1x8i", "output": "2x9i\nx\n7c2x\n5m9c9x9i\n8c9x9i\n9m9c9x9i\nmi\nmi\nmx\n9m8x9i\n"}, {"type": "stdin_stdout", "input": "10\nxi x8i\ni 9i\nc2x3i 5c8x8i\nm2ci 4m7c9x8i\n9c8x9i i\ni 9m9c9x8i\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's solve the geometric problem\n\nMr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.\n\nFloating-point error is the error caused by th... | [{"type": "stdin_stdout", "input": "128 205", "output": "205\n"}, {"type": "stdin_stdout", "input": "110 161", "output": "161\n"}, {"type": "stdin_stdout", "input": "13 204", "output": "102\n"}, {"type": "stdin_stdout", "input": "11 251", "output": "251\n"}, {"type": "stdin_stdout", "input": "10 103", "output": "103\n"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are league games and tournament games in sports competitions. In soccer league games, points are given to each of the wins, losses, and draws, and the rankings are competed based on the points. The points are win (3... | [{"type": "stdin_stdout", "input": "4\nJapan 1 0 2\nEgypt 1 3 -1\nCanada 0 2 1\nSpain 1 0 1\n3\nJndia -1 2 0\nPoland 1 1 1\nItalx 1 -1 1\n0", "output": "Japan,5\nSpain,4\nEgypt,2\nCanada,1\n\nPoland,4\nItalx,4\nJndia,-3\n"}, {"type": "stdin_stdout", "input": "4\nnapaJ 1 0 0\nEgzpt 0 2 -1\naDaadn 0 2 3\nnibpS 2 0 0\n3\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRyouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what she hea... | [{"type": "stdin_stdout", "input": "100 100\n28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Romans have attacked again. This time they are much more than the Persians but Shapur is ready to defeat them. He says: \"A lion is never afraid of a hundred sheep\". \n\nNevertheless Shapur has to find weaknesses in ... | [{"type": "stdin_stdout", "input": "97\n800 771 66 126 231 306 981 96 196 229 253 35 903 739 461 962 979 347 152 424 934 586 225 838 103 178 524 400 156 149 560 629 697 417 717 738 181 430 611 513 754 595 847 464 356 640 24 854 138 481 98 371 142 460 194 288 220 41 999 581 441 407 301 651 271 226 457 393 980 166 272 25... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads a list of student test scores and evaluates the performance for each student.\n\nThe test scores for a student include scores of the midterm examination m (out of 50), the final examination f (... | [{"type": "stdin_stdout", "input": "92 101 -1\n16 30 -1\n0 2 -1\n-1 -1 -1", "output": "A\nD\nF\n"}, {"type": "stdin_stdout", "input": "150 64 -2\n16 30 -1\n1 0 -1\n-1 -1 -1", "output": "A\nD\nF\n"}, {"type": "stdin_stdout", "input": "116 100 -1\n16 50 -1\n1 1 0\n-1 -1 -1", "output": "A\nB\nF\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe have N lamps numbered 1 to N, and N buttons numbered 1 to N. Initially, Lamp 1, 2, \\cdots, A are on, and the other lamps are off.\n\nSnuke and Ringo will play the following game.\n\n* First, Ringo generates a permutat... | [{"type": "stdin_stdout", "input": "9479599 4999", "output": "395563313\n"}, {"type": "stdin_stdout", "input": "4734557 4999", "output": "743624188\n"}, {"type": "stdin_stdout", "input": "7100253 4999", "output": "2548353\n"}, {"type": "stdin_stdout", "input": "9999999 4999", "output": "90395416"}, {"type": "stdin_stdo... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe description is rather long but it tries to explain what a financing plan is. \n\nThe fixed monthly payment for a fixed rate mortgage is the amount paid by the borrower every month that ensures \nthat the loan is paid ... | [{"input": "9.0\n187174\n60\n12", "output": "[\"num_payment 12 c 3885 princ 2694 int 1191 balance 156135\"]", "fn_name": "amort"}, {"input": "1.9\n182840\n48\n18", "output": "[\"num_payment 18 c 3959 princ 3769 int 189 balance 115897\"]", "fn_name": "amort"}, {"input": "7.0\n168742\n48\n16", "output": "[\"num_payment 1... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA palindrome is a series of characters that read the same forwards as backwards such as \"hannah\", \"racecar\" and \"lol\".\n\nFor this Kata you need to write a function that takes a string of characters and returns the ... | [{"input": "\"$aaabbbccddd_!jJpqlQx_.///yYabababhii_\"", "output": "[25]", "fn_name": "longest_palindrome"}, {"input": "\"xyz__a_/b0110//a_zyx\"", "output": "[13]", "fn_name": "longest_palindrome"}, {"input": "\"Hannah\"", "output": "[6]", "fn_name": "longest_palindrome"}, {"input": "\"A\"", "output": "[1]", "fn_name":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Kata Task\n\nYou are given a list of cogs in a gear train\n\nEach element represents the number of teeth of that cog\n\ne.g. `[100, 50, 25]` means \n* 1st cog has 100 teeth \n* 2nd cog has 50 teeth\n* 3rd cog has 25 tee... | [{"input": "[100, 100, 100, 100]\n0", "output": "[[1, -1]]", "fn_name": "cog_RPM"}, {"input": "[100, 100, 100, 100]\n1", "output": "[[-1, 1]]", "fn_name": "cog_RPM"}, {"input": "[100, 100, 100, 100]\n2", "output": "[[1, -1]]", "fn_name": "cog_RPM"}, {"input": "[100, 100, 100, 100]\n3", "output": "[[-1, 1]]", "fn_name":... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nSuppose that there are some light sources and many spherical balloons. All light sources have sizes small enough to be modeled as point light sources, and they emit light in all directions. The surfaces of the balloons ab... | [{"type": "stdin_stdout", "input": "12 5 4\n0 10 0 1\n1 3 0 2\n1 4 0 2\n0 0 0 2\n10 0 0 1\n3 -1 0 2\n5 -1 0 2\n10 10 0 15\n-1 -10 0 1\n10 -10 0 1\n-10 -10 0 1\n10 10 0 1\n0 10 0 240\n10 0 0 200\n10 -2 0 52\n-10 0 0 100\n1 0 0 2\n-1 1 0\n12 5 4\n0 10 0 1\n1 5 0 2\n1 4 0 2\n0 0 0 2\n10 0 0 1\n3 -1 0 2\n5 -1 0 2\n10 10 0 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp has n different binary words. A word called binary if it contains only characters '0' and '1'. For example, these words are binary: \"0001\", \"11\", \"0\" and \"0011100\".\n\nPolycarp wants to offer his set of n... | [{"type": "stdin_stdout", "input": "4\n4\n0001\n1000\n0011\n0111\n3\n010\n111\n0\n2\n00000\n00001\n4\n01\n001\n0001\n00001\n", "output": "1\n3\n-1\n0\n\n2\n1 2\n"}, {"type": "stdin_stdout", "input": "4\n4\n0001\n0000\n0011\n0111\n3\n010\n111\n1\n2\n00000\n00001\n4\n01\n001\n0001\n00001\n", "output": "1\n1\n-1\n0\n\n2\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n## Number pyramid\n\nNumber pyramid is a recursive structure where each next row is constructed by adding adjacent values of the current row. For example:\n\n```\nRow 1 [1 2 3 4]\nRow 2 [3 5 ... | [{"input": "[13, 76, 21, 42, 63]", "output": "[674]", "fn_name": "reduce_pyramid"}, {"input": "[13, 1, 21, 9]", "output": "[88]", "fn_name": "reduce_pyramid"}, {"input": "[5, 6, 7, 8]", "output": "[52]", "fn_name": "reduce_pyramid"}, {"input": "[3, 9, 4]", "output": "[25]", "fn_name": "reduce_pyramid"}, {"input": "[3, ... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNam is playing with a string on his computer. The string consists of n lowercase English letters. It is meaningless, so Nam decided to make the string more beautiful, that is to make it be a palindrome by using 4 arrow ke... | [{"type": "stdin_stdout", "input": "198 10\ntuxqalctjyegbvouezfiqoeoazizhmjhpcmvyvjkyrgxkeupwcmvzcosdrrfgtdmxwfttxjxsbaspjwftgpnvsfyfqsrmyjmypdwonbzwsftepwtjlgbilhcsqyfzfzrfvrvfqiwoemthwvqpvqnflqqspvqrnmvucnspexpijnivqpavqxjyucufculletaedlvut\n", "output": "695\n"}, {"type": "stdin_stdout", "input": "198 14\ntuxqalctjy... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are both a shop keeper and a shop assistant at a small nearby shop. You have $n$ goods, the $i$-th good costs $a_i$ coins.\n\nYou got tired of remembering the price of each product when customers ask for it, thus you ... | [{"type": "stdin_stdout", "input": "3\n5\n1 2 6 4 5\n3\n1 2 3\n2\n777 2131\n", "output": "4\n2\n1454\n"}, {"type": "stdin_stdout", "input": "3\n5\n1 2 3 4 5\n3\n1 2 3\n2\n777 1089\n", "output": "3\n2\n933\n"}, {"type": "stdin_stdout", "input": "3\n5\n1 2 6 4 5\n3\n1 2 3\n2\n777 1089\n", "output": "4\n2\n933\n"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOne day, Snuke was given a permutation of length N, a_1, a_2, ..., a_N, from his friend.\n\nFind the following:\n\n<image>\n\nConstraints\n\n* 1 ≦ N ≦ 200,000\n* (a_1, a_2, ..., a_N) is a permutation of (1, 2, ..., N).\n\... | [{"type": "stdin_stdout", "input": "8\n5 3 8 1 2 6 7 4", "output": "84\n"}, {"type": "stdin_stdout", "input": "8\n4 5 8 1 2 6 7 3", "output": "86\n"}, {"type": "stdin_stdout", "input": "8\n5 4 8 1 2 6 7 3", "output": "85"}, {"type": "stdin_stdout", "input": "4\n2 3 1 4", "output": "17\n"}, {"type": "stdin_stdout", "inp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given an integer N. Among the divisors of N! (= 1 \\times 2 \\times ... \\times N), how many Shichi-Go numbers (literally \"Seven-Five numbers\") are there?\nHere, a Shichi-Go number is a positive integer that has... | [{"type": "stdin_stdout", "input": "100\n", "output": "543\n"}, {"type": "stdin_stdout", "input": "52\n", "output": "123\n"}, {"type": "stdin_stdout", "input": "54\n", "output": "131\n"}, {"type": "stdin_stdout", "input": "77\n", "output": "323\n"}, {"type": "stdin_stdout", "input": "78\n", "output": "324\n"}, {"type":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment ... | [{"type": "stdin_stdout", "input": "200\n2 1 1 2 2 2 2 1 1 2 2 2 1 1 2 2 2 2 1 1 1 2 2 2 2 2 2 1 2 2 1 1 1 1 2 1 2 2 1 2 2 2 2 1 2 2 1 1 1 1 2 2 1 1 1 1 1 2 2 2 2 1 2 1 2 2 2 2 1 1 1 2 1 2 2 2 2 1 1 1 1 1 1 2 2 2 1 2 2 2 1 2 2 2 1 1 1 2 2 1 1 1 1 2 2 1 2 1 1 1 2 2 1 1 2 2 2 1 2 2 0 1 2 1 1 2 2 2 1 2 2 1 1 1 2 2 2 1 2 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn a company an emplopyee is paid as under: \nIf his basic salary is less than Rs. 1500, then HRA = 10% of base salary and DA = 90% of basic salary. \nIf his salary is either equal to or above Rs. 1500, then HRA = Rs. 500... | [{"type": "stdin_stdout", "input": "3\n1203\n10042\n1312", "output": "2406.00\n20383.16\n2624\n"}, {"type": "stdin_stdout", "input": "3 \n530\n4670\n1914", "output": "1060\n9746.6\n4289.72\n"}, {"type": "stdin_stdout", "input": "3 \n1203\n10042\n1312", "output": "2406\n20383.2\n2624\n"}, {"type": "stdin_stdout", "input... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPolycarp is a frequent user of the very popular messenger. He's chatting with his friends all the time. He has $n$ friends, numbered from $1$ to $n$.\n\nRecall that a permutation of size $n$ is an array of size $n$ such t... | [{"type": "stdin_stdout", "input": "100 100\n82 51 81 14 37 17 78 92 64 15 8 86 89 8 87 77 66 10 15 12 100 25 92 47 21 78 20 63 13 49 41 36 41 79 16 87 87 69 1 76 80 60 100 49 70 59 72 8 38 71 15 97 71 14 76 90 81 4 59 46 39 28 92 3 28 22 53 99 59 52 74 43 92 43 42 23 44 9 82 47 7 48 12 12 3 55 37 71 46 22 84 52 98 41 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAndrey received a postcard from Irina. It contained only the words \"Hello, Andrey!\", and a strange string consisting of lowercase Latin letters, snowflakes and candy canes. Andrey thought that this string is an encrypte... | [{"type": "stdin_stdout", "input": "uduzhzchjkaddukfwqngffblohjmqbgyfrzomuznircygatbxoyfxflurhoewioptyqlpoozlksyxrntwsqozghcamszlgeawisninpntpwpuemybjwmhwmpqkurkrnjzfoppmoopwrmpylvhtntghxkavveeyfmdqsvuqiflyemklnshfrtskmyhkbzhwmlaqcasjbw\n200\n", "output": "uduzhzchjkaddukfwqngffblohjmqbgyfrzomuznircygatbxoyfxflurhoewio... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDark is going to attend Motarack's birthday. Dark decided that the gift he is going to give to Motarack is an array $a$ of $n$ non-negative integers.\n\nDark created that array $1000$ years ago, so some elements in that a... | [{"type": "stdin_stdout", "input": "7\n5\n-1 3 -1 24 -1\n5\n-1 40 14 -1 35\n6\n-1 -1 6 -1 0 -1\n2\n-1 -1\n2\n0 -1\n4\n1 -1 3 -1\n7\n1 -1 7 10 0 0 10\n", "output": "11 13\n26 27\n3 3\n0 0\n0 0\n1 2\n10 4\n"}, {"type": "stdin_stdout", "input": "7\n5\n-1 10 -1 20 -1\n5\n-1 22 35 -1 35\n6\n-1 -1 9 -1 3 -1\n2\n-1 -1\n2\n0 -... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\nIf AtCoDe... | [{"type": "stdin_stdout", "input": "2\n-3 4 1\n111 4 -1", "output": "No\n"}, {"type": "stdin_stdout", "input": "2\n5 1 1\n100 1 1\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "2\n5 2 3\n100 0 0", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2\n5 2 2\n100 1 -1", "output": "No\n"}, {"type": "stdin_s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nEach of you probably has your personal experience of riding public transportation and buying tickets. After a person buys a ticket (which traditionally has an even number of digits), he usually checks whether the ticket i... | [{"type": "stdin_stdout", "input": "100\n11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100\n77183123282838... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMr. Chanek is currently participating in a science fair that is popular in town. He finds an exciting puzzle in the fair and wants to solve it.\n\nThere are $N$ atoms numbered from $1$ to $N$. These atoms are especially q... | [{"type": "stdin_stdout", "input": "6 1\n1 10 10 5 20 100\n1000000 1 10 10 100 1000000\n", "output": "144\n"}, {"type": "stdin_stdout", "input": "6 1\n1 10 10 20 5 100\n1000000 1 10 100 10 1000000\n", "output": "144\n"}, {"type": "stdin_stdout", "input": "6 1\n1 10 10 5 20 100\n1000000 1 10 10 100 1000000\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGeorge is a cat, so he really likes to play. Most of all he likes to play with his array of positive integers b. During the game, George modifies the array by using special changes. Let's mark George's current array as b_... | [{"type": "stdin_stdout", "input": "69756649467079322827497669450385938193725265564551073376856848456377282337192553343102536673046067874193973249293390979688852602950724884726382282903675659200865787042684264196306648305545290076062924087939978017987667847105325657080274323400258982046115892228300171243907466293917094... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Story\n\nJohn found a path to a treasure, and while searching for its precise location he wrote a list of directions using symbols `\"^\"`, `\"v\"`, `\"<\"`, `\">\"` which mean `north`, `east`, `west`, and `east` accord... | [{"input": "\">^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v\"", "output": "[\">^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v>^>v\"]", "fn_name": "simplify"}, {"input": "\">vv<<<^^^^>>>>>vvvvvv<<<<<<^^^^^^^^>>>>\"", "output": "[\">vv<<<^^^^>>>>>vvvvvv<<<<<<^^^^^^^^>>>>\"]", "fn_name": "simplify"}, {"input": "\"... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere is \"7 rows\" in the game using playing cards. Here we consider a game that simplifies it. Arrange 7 using 13 cards with numbers 1 to 13 written on each. In the match, the game progresses as follows with only two pl... | [{"type": "stdin_stdout", "input": "5\n1 2 3 4 5 6\n1 3 5 6 8 4\n1 2 3 4 6 8\n1 2 3 5 10 11\n1 3 3 6 9 11", "output": "yes\nyes\nyes\nyes\nno\n"}, {"type": "stdin_stdout", "input": "5\n1 2 3 4 5 10\n1 3 5 6 12 3\n1 2 3 4 6 8\n1 2 4 5 10 11\n1 4 2 6 9 5", "output": "no\nno\nyes\nyes\nyes\n"}, {"type": "stdin_stdout", "i... | 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\nVadim and Roman like discussing challenging problems with each other. One day Vadim told his friend following problem:\nGiven N points on a plane. Each... | [{"type": "stdin_stdout", "input": "2\n2\n2 -1\n2 0\n3\n-1 1\n-1 0\n-2 1", "output": "3\n0\n"}, {"type": "stdin_stdout", "input": "2\n2\n2 -1\n0 0\n3\n-1 1\n-1 0\n-2 1", "output": "3\n0\n"}, {"type": "stdin_stdout", "input": "2\n2\n0 2\n-1 -1\n3\n3 3\n0 -1\n1 3", "output": "3\n0\n"}, {"type": "stdin_stdout", "input": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nExample\n\nInput\n\n2 2\n1 2 0\n3 4 1\n\n\nOutput\n\n2\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 Python code to solve this problem. Yo... | [{"type": "stdin_stdout", "input": "8 0\n-2 0 1\n12 2 12", "output": "680445551\n"}, {"type": "stdin_stdout", "input": "4 0\n-2 0 -1\n12 2 5", "output": "15400\n"}, {"type": "stdin_stdout", "input": "4 0\n-2 0 1\n12 2 10", "output": "15400\n"}, {"type": "stdin_stdout", "input": "4 0\n1 0 1\n9 -1 -1", "output": "15400\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThis problem differs from the previous one only in the absence of the constraint on the equal length of all numbers $a_1, a_2, \\dots, a_n$.\n\nA team of SIS students is going to make a trip on a submarine. Their target i... | [{"type": "stdin_stdout", "input": "100\n463 6421 2912 1546 3999 5175 4357 2259 7380 6081 1148 7857 3532 4168 5643 8819 2568 6681 975 9216 4590 5217 6215 7422 6631 1651 39 4268 8290 2022 3175 8281 1552 980 9314 234 934 5133 6712 1880 2766 5042 5004 5455 6038 6010 6022 1553 4015 4544 3985 4033 223 7682 6302 2121 4832 39... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nChanek Jones is back, helping his long-lost relative Indiana Jones, to find a secret treasure in a maze buried below a desert full of illusions.\n\nThe map of the labyrinth forms a tree with n rooms numbered from 1 to n a... | [{"type": "stdin_stdout", "input": "4 4\n2 -1000 100 3\n2 1\n3 2\n4 1\n2 1 3\n2 2 2\n1 1 -1000000000\n2 1 4\n", "output": "2102\n0\n1000000003\n"}, {"type": "stdin_stdout", "input": "4 4\n2 -1000 100 3\n2 1\n3 2\n4 2\n2 1 3\n2 2 2\n1 1 -1000000000\n2 1 4\n", "output": "2102\n0\n1000002003\n"}, {"type": "stdin_stdout", ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nDr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go.\n\nDr. Evil is interested in sets, He has ... | [{"type": "stdin_stdout", "input": "100 100\n58 88 12 71 22 1 40 19 73 20 67 48 57 17 69 36 100 35 33 37 72 55 52 8 89 85 47 42 78 70 81 86 11 9 68 99 6 16 21 61 53 98 23 62 32 59 51 0 87 24 50 30 65 10 80 95 7 92 25 74 60 79 91 5 13 31 75 38 90 94 46 66 93 34 14 41 28 2 76 84 43 96 3 56 49 82 27 77 64 63 4 45 18 29 54... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nLet's call an undirected graph of n vertices p-interesting, if the following conditions fulfill: the graph contains exactly 2n + p edges; the graph doesn't contain self-loops and multiple edges; for any integer k (1 ≤... | [{"type": "stdin_stdout", "input": "5\n24 228\n24 228\n24 228\n24 228\n24 228\n", "output": "1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n1 8\n1 9\n1 10\n1 11\n1 12\n1 13\n1 14\n1 15\n1 16\n1 17\n1 18\n1 19\n1 20\n1 21\n1 22\n1 23\n1 24\n2 3\n2 4\n2 5\n2 6\n2 7\n2 8\n2 9\n2 10\n2 11\n2 12\n2 13\n2 14\n2 15\n2 16\n2 17\n2 18\n2 19\n2 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nE869120 defined a sequence $a$ like this:\n\n\n* $a_1=a_2=1$, $a_{k+2}=a_{k+1}+a_k \\ (k \\ge 1)$\n\n\nHe also defined sequences $d_1, d_2, d_3, \\dots , d_n$, as the following recurrence relation :\n\n\n* $d_{1, j} = a_j... | [{"type": "stdin_stdout", "input": "42 102", "output": "184174004\n"}, {"type": "stdin_stdout", "input": "42 123", "output": "268300608\n"}, {"type": "stdin_stdout", "input": "46 123", "output": "960087486\n"}, {"type": "stdin_stdout", "input": "70 123", "output": "396400358\n"}, {"type": "stdin_stdout", "input": "42 1... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nCowboy Beblop is a funny little boy who likes sitting at his computer. He somehow obtained two elastic hoops in the shape of 2D polygons, which are not necessarily convex. Since there's no gravity on his spaceship, the ho... | [{"type": "stdin_stdout", "input": "16\n0 1000 0\n436 1013 0\n509 517 0\n1000 500 0\n1000 1000 0\n1401 1028 0\n1434 461 0\n2086 442 0\n2079 1044 0\n2506 1032 0\n2549 450 0\n3077 446 0\n3063 1067 0\n3715 1062 0\n3756 -125 0\n0 0 0\n16\n-243 700 394\n109 700 365\n129 700 -366\n763 700 -366\n725 700 397\n1131 700 409\n117... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe only difference between easy and hard versions is on constraints. In this version constraints are higher. You can make hacks only if all versions of the problem are solved.\n\nKoa the Koala is at the beach!\n\nThe bea... | [{"type": "stdin_stdout", "input": "1\n100 5 4\n1 -2 -1 0 0 4 3 3 1 3 1 5 3 3 0 3 3 6 3 5 6 0 3 3 4 0 2 2 2 0 2 2 4 2 2 4 3 2 3 6 0 0 3 2 1 0 0 2 1 1 3 4 6 9 5 8 12 2 2 0 6 2 4 2 3 1 3 4 2 3 3 2 2 3 2 1 0 2 1 1 0 5 3 3 3 1 8 4 4 11 6 3 1 2 4 4 2 -1 -1 1\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n100 5... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWe conducted a survey on newspaper subscriptions. More specifically, we asked each of the N respondents the following two questions:\n\n* Question 1: Are you subscribing to Newspaper X?\n* Question 2: Are you subscribing ... | [{"type": "stdin_stdout", "input": "101 110 100", "output": "100 109\n"}, {"type": "stdin_stdout", "input": "100 110 100", "output": "100 110\n"}, {"type": "stdin_stdout", "input": "000 110 100", "output": "100 210\n"}, {"type": "stdin_stdout", "input": "000 100 100", "output": "100 200\n"}, {"type": "stdin_stdout", "i... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTunnel formula\n\nOne day while exploring an abandoned mine, you found a long formula S written in the mine. If you like large numbers, you decide to take out the choke and add `(` or `)` so that the result of the formula... | [{"type": "stdin_stdout", "input": "2-(2-3+4+5)", "output": "12\n"}, {"type": "stdin_stdout", "input": "3+(2-4-4+5)", "output": "10\n"}, {"type": "stdin_stdout", "input": "2-(2-3+4+6)", "output": "13\n"}, {"type": "stdin_stdout", "input": "3+(2-4-4+6)", "output": "11\n"}, {"type": "stdin_stdout", "input": "4-(2+5-0+2)"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\n# Task\n\n* **_Given_** *three integers* `a` ,`b` ,`c`, **_return_** *the **_largest number_** obtained after inserting the following operators and brackets*: `+`, `*`, `()`\n* In other words , **_try every combination of... | [{"input": "10\n5\n6", "output": "[300]", "fn_name": "expression_matter"}, {"input": "3\n5\n7", "output": "[105]", "fn_name": "expression_matter"}, {"input": "2\n10\n3", "output": "[60]", "fn_name": "expression_matter"}, {"input": "9\n7\n2", "output": "[126]", "fn_name": "expression_matter"}, {"input": "1\n1\n10", "out... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou are given a rectangular grid with $n$ rows and $m$ columns. The cell located on the $i$-th row from the top and the $j$-th column from the left has a value $a_{ij}$ written in it.\n\nYou can perform the following oper... | [{"type": "stdin_stdout", "input": "2\n2 2\n-1 1\n1 1\n3 4\n-1 -1 -2 -10\n0 -2 -5 -6\n-1 -3 -4 -5\n", "output": "2\n40\n"}, {"type": "stdin_stdout", "input": "2\n2 2\n-1 1\n1 1\n3 4\n-1 -1 -2 -3\n-1 -2 -3 -4\n-2 -1 -8 -5\n", "output": "2\n33\n"}, {"type": "stdin_stdout", "input": "2\n2 2\n-1 1\n1 1\n3 4\n-1 -1 -2 -3\n-... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nDen, the phone number of Ukunikia Co., Ltd., enters a very long phone number into the phone every day.\nOne day, too tired, Den came up with a surprising idea.\n\"Isn't it even a little easier if you rearrange ... | [{"type": "stdin_stdout", "input": "11\n129483884450", "output": "125\n694\n738\n"}, {"type": "stdin_stdout", "input": "11\n128935478480", "output": "123\n689\n745\n"}, {"type": "stdin_stdout", "input": "11\n18396312558", "output": "124\n857\n369\n"}, {"type": "stdin_stdout", "input": "11\n24764186449", "output": "318\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nPetya has a rectangular Board of size $n \\times m$. Initially, $k$ chips are placed on the board, $i$-th chip is located in the cell at the intersection of $sx_i$-th row and $sy_i$-th column.\n\nIn one action, Petya can ... | [{"type": "stdin_stdout", "input": "10 10 20\n7 5\n4 5\n5 4\n7 4\n1 5\n6 7\n9 10\n8 4\n1 4\n2 10\n3 10\n4 10\n0 6\n5 7\n6 2\n1 1\n10 9\n7 6\n1 4\n11 4\n8 2\n10 3\n5 1\n10 8\n4 2\n1 9\n1 10\n9 5\n2 2\n6 7\n8 6\n8 9\n2 2\n7 1\n3 3\n1 2\n6 20\n9 4\n10 2\n7 7\n", "output": "117\nUUUUUUUUULLLLLLLLLRRRRRRRRRDLLLLLLLLLDRRRRRR... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nOn the well-known testing system MathForces, a draw of $n$ rating units is arranged. The rating will be distributed according to the following algorithm: if $k$ participants take part in this event, then the $n$ rating is... | [{"type": "stdin_stdout", "input": "8\n2224571\n2410907\n1906778\n4433130\n429304\n748393\n1234320\n1234321\n", "output": "2982\n0 1 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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 ... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou may know that Euclid was a mathematician. Well, as it turns out, Morpheus knew it too. So when he wanted to play a mean trick on Euclid, he sent him an appropriate nightmare. \n\nIn his bad dream Euclid has a set S of... | [{"type": "stdin_stdout", "input": "50 500000\n2 57 94\n2 1 10\n2 97 98\n2 15 86\n2 66 84\n2 40 100\n2 8 27\n2 14 43\n2 55 75\n2 25 90\n2 22 69\n2 9 12\n2 32 34\n2 24 48\n2 54 88\n2 13 50\n2 30 56\n2 38 77\n2 4 70\n2 39 92\n2 23 72\n2 17 36\n2 20 29\n2 6 51\n2 11 87\n2 21 68\n2 59 80\n2 52 61\n2 26 42\n2 2 37\n2 45 62\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRecently Vasya found a golden ticket — a sequence which consists of $n$ digits $a_1a_2\\dots a_n$. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For ... | [{"type": "stdin_stdout", "input": "100\n0809740931424957283280264749151125408689778966769781910603952566405858112111930579193115510555198933\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "100\n4360837235306857829226262079948050131795231482102447137288804547991971660484969090651046154392003840\n", "output":... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya writes his own library for building graphical user interface. Vasya called his creation VTK (VasyaToolKit). One of the interesting aspects of this library is that widgets are packed in each other. \n\nA widget is so... | [{"type": "stdin_stdout", "input": "20\nVBox hykl\nVBox enwv\nenwv.pack(hykl)\nVBox dlepf\ndlepf.pack(hykl)\nenwv.set_border(30)\nWidget mjrrik(54,21)\nhykl.set_border(2)\ndlepf.set_border(22)\nenwv.set_border(3)\nenwv.pack(dlepf)\ndlepf.pack(mjrrik)\nhykl.set_spacing(96)\nenwv.set_border(32)\ndlepf.set_border(72)\nWid... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA star map in Berland is a checked field n × m squares. In each square there is or there is not a star. The favourite constellation of all Berland's astronomers is the constellation of the Cross. This constellation can be... | [{"type": "stdin_stdout", "input": "10 10 40\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n**********\n", "output": "6 9\n5 9\n7 9\n6 8\n6 10\n"}, {"type": "stdin_stdout", "input": "10 10 59\n**.*******\n********.*\n***.******\n**.*******\n*******.**\n*****... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban — an abacus d... | [{"type": "stdin_stdout", "input": "1116434957\n", "output": "-O|OO-OO\n-O|-OOOO\n-O|OOOO-\nO-|OOOO-\nO-|OOO-O\nO-|OOOO-\n-O|O-OOO\nO-|O-OOO\nO-|O-OOO\nO-|O-OOO\n"}, {"type": "stdin_stdout", "input": "1603481361\n", "output": "O-|O-OOO\n-O|O-OOO\nO-|OOO-O\nO-|O-OOO\n-O|OOO-O\nO-|OOOO-\nO-|OOO-O\nO-|-OOOO\n-O|O-OOO\nO-|... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe Kingdom of Takahashi has N towns, numbered 1 through N.\nThere is one teleporter in each town. The teleporter in Town i (1 \\leq i \\leq N) sends you to Town A_i.\nTakahashi, the king, loves the positive integer K. Th... | [{"type": "stdin_stdout", "input": "6 727202214173249351\n6 5 2 5 3 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "6 1007784494318310970\n6 5 2 5 3 2", "output": "3\n"}, {"type": "stdin_stdout", "input": "6 1122048832909353099\n6 4 1 1 3 2", "output": "4\n"}, {"type": "stdin_stdout", "input": "6 21904273061... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nFizzBuzz is often one of the first programming puzzles people learn. Now undo it with reverse FizzBuzz!\n\nWrite a function that accepts a string, which will always be a valid section of FizzBuzz. Your function must retur... | [{"input": "\"Fizz 688 689 FizzBuzz\"", "output": "[[687, 688, 689, 690]]", "fn_name": "reverse_fizzbuzz"}, {"input": "\"1 2 Fizz 4 Buzz\"", "output": "[[1, 2, 3, 4, 5]]", "fn_name": "reverse_fizzbuzz"}, {"input": "\"Fizz Buzz\"", "output": "[[9, 10]]", "fn_name": "reverse_fizzbuzz"}, {"input": "\"Buzz Fizz\"", "output... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nNazar, a student of the scientific lyceum of the Kingdom of Kremland, is known for his outstanding mathematical abilities. Today a math teacher gave him a very difficult task.\n\nConsider two infinite sets of numbers. The... | [{"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "975735772\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000010000000\n", "output": "636734266\n"}, {"type": "stdin_stdout", "input": "1000000000000000000 1000000000000000000\n", "output": "975735772"}, {"type... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe employees of the F company have lots of ways to entertain themselves. Today they invited a famous magician who shows a trick with plastic cups and a marble.\n\nThe point is to trick the spectator's attention. Initiall... | [{"type": "stdin_stdout", "input": "100 50\n11 28\n11 1\n98 58\n38 27\n24 27\n67 37\n90 48\n91 14\n43 29\n3 64\n24 6\n53 19\n97 65\n13 27\n75 53\n37 82\n69 75\n94 99\n1 26\n95 60\n45 27\n100 82\n71 49\n86 99\n74 58\n88 68\n39 63\n38 23\n22 39\n29 58\n62 83\n62 1\n61 58\n2 30\n41 48\n83 90\n1 17\n73 81\n23 53\n71 16\n43... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a sc... | [{"type": "stdin_stdout", "input": "10 10550000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n", "output": "1000\n"}, {"type": "stdin_stdout", "input": "10 100\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 1000000\n100 10000... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThe government of Berland decided to improve network coverage in his country. Berland has a unique structure: the capital in the center and $n$ cities in a circle around the capital. The capital already has a good network... | [{"type": "stdin_stdout", "input": "3\n10\n3 3 2 3 2 5 1 2 11 3\n6 5 2 5 3 2 4 2 1 2\n20\n9 1 10 1 17 7 5 5 8 1 1 2 7 1 4 2 3 7 6 3\n2 6 3 2 37 1 5 5 4 5 1 3 21 15 1 7 7 5 0 1\n20\n9 1 9 1 5 1 3 2 0 3 6 1 2 8 11 7 3 5 14 2\n11 14 6 4 6 8 8 2 9 9 6 5 3 2 5 7 1 9 14 1\n", "output": "NO\nNO\nNO\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nRidhiman challenged Ashish to find the maximum valued subsequence of an array $a$ of size $n$ consisting of positive integers. \n\nThe value of a non-empty subsequence of $k$ elements of $a$ is defined as $\\sum 2^i$ over... | [{"type": "stdin_stdout", "input": "20\n541032394951352952 204302388514120798 548305186805250399 743987576790520671 332874928746186630 60150973547887825 600093435051546090 862815570651991829 798946884837606574 383607230476788640 748981752333005915 317959714195378963 824508576221039025 547099154391774856 411018774272655... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nThere are n piles of stones of sizes a1, a2, ..., an lying on the table in front of you.\n\nDuring one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j increases by the c... | [{"type": "stdin_stdout", "input": "2\n2 9\n5\n4 10 7 3 4\n", "output": "2 2 2 2 2\n"}, {"type": "stdin_stdout", "input": "2\n2 9\n5\n4 10 7 3 4\n", "output": "2 2 2 2 2\n"}, {"type": "stdin_stdout", "input": "2\n2 1\n5\n4 10 7 3 4\n", "output": "1 1 1 1 1\n"}, {"type": "stdin_stdout", "input": "2\n2 9\n5\n4 13 7 3 4\n... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYour start-up's BA has told marketing that your website has a large audience in Scandinavia and surrounding countries. Marketing thinks it would be great to welcome visitors to the site in their own language. Luckily you ... | [{"input": "\"IP_ADDRESS_INVALID\"", "output": "[\"Welcome\"]", "fn_name": "greet"}, {"input": "\"english\"", "output": "[\"Welcome\"]", "fn_name": "greet"}, {"input": "\"dutch\"", "output": "[\"Welkom\"]", "fn_name": "greet"}, {"input": "\"\"", "output": "[\"Welcome\"]", "fn_name": "greet"}, {"input": "2", "output": "... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nVasya has a grid with $2$ rows and $n$ columns. He colours each cell red, green, or blue.\n\nVasya is colourblind and can't distinguish green from blue. Determine if Vasya will consider the two rows of the grid to be colo... | [{"type": "stdin_stdout", "input": "1\n55\nBBBBBBBBBBBBBBBBBBBGGGGGGGGGGGGGGGGGGGGGGGGGGGGBBBBGBGB\nBBBBBBBBBBBBBBBBBBBGGGGGGGGGGGGGGGGGGGGGGGGGGGGBBBBGBGB\n", "output": "YES\n"}, {"type": "stdin_stdout", "input": "6\n2\nRG\nRB\n4\nGRBG\nGBGB\n5\nGGGGG\nBBBBB\n7\nBBBBBBB\nRRRRRRR\n8\nRGBRRGBR\nRGGRRBGR\n1\nG\nG\n", "ou... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nMonocarp plays a computer game (yet again!). This game has a unique trading mechanics.\n\nTo trade with a character, Monocarp has to choose one of the items he possesses and trade it for some item the other character poss... | [{"type": "stdin_stdout", "input": "3 4 5\n10 60 30\n12 57 17 6\n0 2 2 1 1\n", "output": "100\n102\n102\n100\n100\n"}, {"type": "stdin_stdout", "input": "3 4 5\n10 60 30\n12 57 17 6\n0 2 1 1 1\n", "output": "100\n102\n100\n100\n100\n"}, {"type": "stdin_stdout", "input": "3 4 5\n10 36 60\n19 57 23 0\n0 2 2 1 1\n", "outp... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nImplication is a function of two logical arguments, its value is false if and only if the value of the first argument is true and the value of the second argument is false. \n\nImplication is written by using character '$... | [{"type": "stdin_stdout", "input": "200\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 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... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nProblem\n\nIt seems that a magician with a smoky smell will show off his magic.\n\n\"Now, think of one favorite integer.\"\nYou decide to think of your counting years in your head.\n\nThe magician has thrown the query $ N... | [{"type": "stdin_stdout", "input": "10\n1 10\n2 10\n1 10\n1 10\n1 10\n1 10\n1 10\n1 10\n1 10\n1 10", "output": "-1000000000 1000000000\n"}, {"type": "stdin_stdout", "input": "10\n1 10\n1 10\n1 10\n1 10\n2 10\n1 10\n1 10\n1 10\n1 10\n1 10", "output": "-1000000 1000000000\n"}, {"type": "stdin_stdout", "input": "10\n1 10\... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou're hanging out with your friends in a bar, when suddenly one of them is so drunk, that he can't speak, and when he wants to say something, he writes it down on a paper. However, none of the words he writes make sense ... | [{"input": "\"Hvv? R'n mlg gszg wifmp, r xzm hgroo gzpv nb xolgsvh luu\"", "output": "[\"See? I'm not that drunk, i can still take my clothes off\"]", "fn_name": "decode"}, {"input": "\"Hfiv r xzm wzmxv lm xlk'h xzi, slow nb yvvi\"", "output": "[\"Sure i can dance on cop's car, hold my beer\"]", "fn_name": "decode"}, {... | code_functional |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIt is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. And then they take turns to make the following mo... | [{"type": "stdin_stdout", "input": "10\n100000000 200000000 300000000 400000000 500000000 600000000 700000000 800000000 900000000 1000000000\n", "output": "Bob\n"}, {"type": "stdin_stdout", "input": "10\n100000000 200000000 300000000 400000000 500000000 600000000 700000000 800000000 900000000 1000000000\n", "output": "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nYou have decided to watch the best moments of some movie. There are two buttons on your player: Watch the current minute of the movie. By pressing this button, you watch the current minute of the movie and the player au... | [{"type": "stdin_stdout", "input": "18 111\n1449 2156\n3497 4784\n7775 14575\n23857 24593\n29211 30739\n31932 33447\n35902 36426\n36991 38506\n39679 47202\n48772 60016\n60522 61868\n63340 63982\n68417 78537\n79445 86568\n86918 87940\n90081 90310\n90629 94325\n95728 96263\n", "output": "58967\n"}, {"type": "stdin_stdout... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTo quickly hire highly skilled specialists one of the new IT City companies made an unprecedented move. Every employee was granted a car, and an employee can choose one of four different car makes.\n\nThe parking lot befo... | [{"type": "stdin_stdout", "input": "30\n", "output": "4809844402031689728\n"}, {"type": "stdin_stdout", "input": "29\n", "output": "1161928703861587968\n"}, {"type": "stdin_stdout", "input": "29\n", "output": "1161928703861587968"}, {"type": "stdin_stdout", "input": "30\n", "output": "4809844402031689728"}, {"type": "s... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nIn this problem you will have to help Berland army with organizing their command delivery system.\n\nThere are $n$ officers in Berland army. The first officer is the commander of the army, and he does not have any superio... | [{"type": "stdin_stdout", "input": "13 12\n1 1 1 1 1 1 1 1 1 1 1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n", "output": "1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n1\n"}, {"type": "stdin_stdout", "input": "13 12\n1 1 1 1 1 1 1 1 1 1 1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n1 1\n", "output"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nWrite a program which reads an integer n and prints the number of prime numbers which are less than or equal to n. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. F... | [{"type": "stdin_stdout", "input": "10\n10\n126", "output": "4\n4\n30\n"}, {"type": "stdin_stdout", "input": "10\n117\n4", "output": "4\n30\n2\n"}, {"type": "stdin_stdout", "input": "10\n147\n9", "output": "4\n34\n4\n"}, {"type": "stdin_stdout", "input": "10\n54\n18", "output": "4\n16\n7\n"}, {"type": "stdin_stdout", "... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nGiven is an integer r.\nHow many times is the area of a circle of radius r larger than the area of a circle of radius 1?\nIt can be proved that the answer is always an integer under the constraints given.\n\n-----Constrai... | [{"type": "stdin_stdout", "input": "100\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "87\n", "output": "7569\n"}, {"type": "stdin_stdout", "input": "76\n", "output": "5776\n"}, {"type": "stdin_stdout", "input": "91\n", "output": "8281\n"}, {"type": "stdin_stdout", "input": "88\n", "output": "7744\n"}, {"... | code_stdio |
[
{
"content": "Solve the following coding problem using the programming language python:\n\nTakahashi, Aoki and Snuke love cookies. They have A, B and C cookies, respectively. Now, they will exchange those cookies by repeating the action below:\n\n* Each person simultaneously divides his cookies in half and give... | [{"type": "stdin_stdout", "input": "1390 180 1200", "output": "1\n"}, {"type": "stdin_stdout", "input": "1390 180 2246", "output": "1\n"}, {"type": "stdin_stdout", "input": "1390 180 2625", "output": "0\n"}, {"type": "stdin_stdout", "input": "1390 213 2625", "output": "0\n"}, {"type": "stdin_stdout", "input": "1390 213... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.