messages listlengths 1 1 | ground_truth stringlengths 156 726k | dataset stringclasses 2
values |
|---|---|---|
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes ... | [{"input": "4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4\n", "output": "3\n2\n0\n4\n"}, {"input": "4\n7\n1 7 1 6 4 7 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4\n", "output": "3\n2\n0\n4\n"}, {"input": "4\n7\n1 7 1 6 4 7 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 1\n6\n2 5 2 3 1 4\n", "output": "3\n2\n1\n4\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAt the foot of Liyushan Mountain, n tents will be carefully arranged to provide accommodation for those who a... | [{"input": "10\n-535541974 -572774963 229181417\n-535541973 -590337106 348212269\n-535541972 -572774962 413415882\n-535541973 -717839722 657120913\n-535541975 -572774961 155042637\n-535541975 -706888442 81575270\n-535541971 -572774961 888834471\n-535541974 -721151373 899782743\n-535541971 -1600858205 614959267\n-535541... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Task\n Initially a number `1` is written on a board. It is possible to do the following operations with it:... | [{"input": "12345", "output": "[false]", "fn_name": "number_increasing"}, {"input": "54321", "output": "[true]", "fn_name": "number_increasing"}, {"input": "100", "output": "[false]", "fn_name": "number_increasing"}, {"input": "101", "output": "[true]", "fn_name": "number_increasing"}, {"input": "2", "output": "[false]... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRecall that a binary search tree is a rooted binary tree, whose nodes each store a key and each have at most ... | [{"input": "1000000\n", "output": "0\n"}, {"input": "360561\n", "output": "0\n"}, {"input": "699049\n", "output": "1\n"}, {"input": "699047\n", "output": "0\n"}, {"input": "699050\n", "output": "1\n"}, {"input": "699048\n", "output": "0\n"}, {"input": "786432\n", "output": "0\n"}, {"input": "750096\n", "output": "0\n"}... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThis is an interactive problem. Refer to the Interaction section below for better understanding.\n\nIthea and... | [{"input": "10 120 15\n6\n11\n9\n11\n3\n12\n11\n12\n2\n8\n3\n11\n13\n5\n12\n11\n9\n3\n10\n9\n9\n13\n13\n5\n6\n11\n3\n15\n8\n8\n10\n13\n7\n6\n4\n14\n9\n10\n5\n13\n4\n1\n8\n6\n13\n1\n3\n4\n9\n12\n2\n7\n3\n3\n7\n2\n2\n9\n2\n4\n2\n2\n11\n12\n15\n13\n6\n2\n11\n1\n8\n3\n13\n6\n15\n6\n4\n3\n4\n15\n15\n9\n5\n8\n3\n6\n14\n14\n5... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn Finite Encyclopedia of Integer Sequences (FEIS), all integer sequences of lengths between 1 and N (inclusi... | [{"input": "0 39", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"input": "0 28", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"}, {"input": "13 27", "output": "7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 8\n"}, {"input": "2 27", "output": ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWilliam has a favorite bracket sequence. Since his favorite sequence is quite big he provided it to you as a ... | [{"input": "50\n980145241 167620437 937571657 683888733 687342940 596264451 470954757 312707590 782743417 441517678 539214535 498906886 521201165 581866343 987986939 770597138 136540061 812371324 567649512 704604401 873600670 364129557 600605741 459396557 173915633 607977424 480952533 834953681 878054436 827935116 4130... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string ... | [{"input": "12-12-201312-12-201312-12-201313--12-201313--12-201313--12-201313--12-201313--12-201313--12-201313--12-201313--12-2013\n", "output": "12-12-2013\n"}, {"input": "12-12-211312-12-201312-12-201313--12-201313--02-201313--12-201313--12-201313--12-201313--12-201313--12-201313--12-2013\n", "output": "12-12-2013\n"... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the sam... | [{"input": "1000 1000 1000 1000\n", "output": "NO\n"}, {"input": "1000 1000 1000 1000\n", "output": "NO\n"}, {"input": "1000 1000 1001 1000\n", "output": "NO\n"}, {"input": "1000 1000 1 1000\n", "output": "YES\n"}, {"input": "1000 1000 1 1000\n", "output": "YES\n"}, {"input": "1000 1001 1 1000\n", "output": "YES\n"}, {... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n— Oh my sweet Beaverette, would you fancy a walk along a wonderful woodland belt with me? \n\n— Of course, my... | [{"input": "20\n-808998072 733614990 579897311 -337992089 579897311 120800519 -337992089 -354825441 733614990 -686536765 733614990 -803027570 -803027570 733614990 120800519 -1246630624 -686536765 579897311 -808998072 -686536765\n", "output": "4215055101 13\n1 4 7 8 10 12 13 15 16 17 18 19 20\n"}, {"input": "20\n-808998... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLittle chief has his own restaurant in the city. There are N workers there. Each worker has his own salary. T... | [{"input": "2\n3\n0 -2 -1\n2\n75 42", "output": "3\n33\n"}, {"input": "2\n3\n0 -3 -1\n2\n75 42", "output": "5\n33\n"}, {"input": "2\n3\n1 -2 -1\n2\n60 42", "output": "4\n18\n"}, {"input": "2\n3\n0 -3 -1\n2\n75 16", "output": "5\n59\n"}, {"input": "2\n3\n1 -4 -1\n2\n75 42", "output": "8\n33\n"}, {"input": "2\n3\n0 -2 0\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi and Aoki are playing a stone-taking game. Initially, there are N piles of stones, and the i-th pile... | [{"input": "200\n48018902 1000000000\n671608134 1000000000\n821230959 1000000000\n839046240 1000000000\n871451860 1000000000\n201326387 1000000000\n95653264 1000000000\n118998199 1000000000\n661381768 1000000000\n265950246 1000000000\n443323091 1000000000\n621558889 1000000000\n486583499 1000000000\n185518031 100000000... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAutomatons, or Finite State Machines (FSM), are extremely useful to programmers when it comes to software des... | [{"input": "[\"APP_PASSIVE_OPEN\", \"RCV_SYN\", \"RCV_ACK\", \"APP_CLOSE\", \"RCV_FIN_ACK\", \"APP_TIMEOUT\", \"APP_ACTIVE_OPEN\", \"RCV_SYN\", \"APP_CLOSE\", \"RCV_FIN\", \"RCV_ACK\"]", "output": "[\"TIME_WAIT\"]", "fn_name": "traverse_TCP_states"}, {"input": "[\"APP_ACTIVE_OPEN\", \"RCV_SYN\", \"APP_CLOSE\", \"RCV_FI... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe research center Q has developed a new multi-core processor. The processor consists of n cores and has k c... | [{"input": "100 1 100\n59\n37\n53\n72\n37\n15\n8\n93\n92\n74\n11\n11\n68\n16\n92\n40\n76\n20\n10\n86\n76\n5\n9\n95\n5\n81\n44\n57\n10\n24\n22\n2\n57\n6\n26\n67\n48\n95\n34\n97\n55\n33\n70\n66\n51\n70\n74\n65\n35\n85\n37\n9\n27\n43\n65\n6\n5\n57\n54\n27\n22\n41\n8\n29\n10\n50\n9\n68\n78\n9\n92\n30\n88\n62\n30\n5\n80\n58... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRead problems statements in Mandarin Chinese, Russian and Vietnamese as well. \nLittle Egor likes to play wit... | [{"input": "2\n1 18\n76 209", "output": "139\n15682\n"}, {"input": "2\n1 16\n76 209", "output": "108\n15682\n"}, {"input": "2\n1 7\n114 127", "output": "25\n1447\n"}, {"input": "2\n1 7\n76 209", "output": "25\n15682\n"}, {"input": "2\n1 9\n76 209", "output": "39\n15682\n"}, {"input": "2\n2 18\n42 82", "output": "138\n2... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inc... | [{"input": "50 27\nACBCABCCCAACACCBBBACCBCBBBCCBAAAABAACACAAACCACCCCA\n", "output": "ACBCABCCCAACACCBBBACCBCBBBcCBAAAABAACACAAACCACCCCA\n"}, {"input": "50 50\nCABABCBBCBABCAACBCBBAAAACBCBCBBABBABBBCCBAACCAACAB\n", "output": "CABABCBBCBABCAACBCBBAAAACBCBCBBABBABBBCCBAACCAACAb\n"}, {"input": "40 38\nBCCACCBCACABBBBBCBABC... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWhen you want to get the square of a binomial of two variables x and y, you will have:\n\n`$(x+y)^2 = x^2 + 2... | [{"input": "10", "output": "[[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2047]]", "fn_name": "f"}, {"input": "6", "output": "[[1, 2, 4, 8, 16, 32, 64, 127]]", "fn_name": "f"}, {"input": "3", "output": "[[1, 2, 4, 8, 15]]", "fn_name": "f"}, {"input": "2", "output": "[[1, 2, 4, 7]]", "fn_name": "f"}, {"input": "1", "ou... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nproblem\n\nIn the area where Kazakhstan is now located, there used to be a trade route called the \"Silk Road... | [{"input": "3 5\n10\n25\n15\n50\n30\n15\n12\n30", "output": "855\n"}, {"input": "3 5\n10\n38\n18\n50\n30\n6\n40\n30", "output": "1068\n"}, {"input": "3 5\n10\n38\n18\n50\n30\n6\n40\n34", "output": "1140\n"}, {"input": "3 5\n10\n38\n18\n50\n27\n6\n40\n34", "output": "1110\n"}, {"input": "3 5\n10\n38\n28\n50\n27\n6\n40\n... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere was a big bank robbery in Tablecity. In order to catch the thief, the President called none other than ... | [{"input": "\u0412 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435 \u043d\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430.\nThis problem doesn't have sample inout and output.", "output": "2000\n1 1 1 2\n2 1 2 2\n3 1 3 2\n4 1 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYour task is to write a function which counts the number of squares contained in an ASCII art picture.\n\nThe... | [{"input": "[\"+---------+--+\", \"| +---+ | |\", \"| | | | |\", \"| | | +--+\", \"| | | |\", \"| +---+ |\", \"| |\", \"| |\", \"| |\", \"| |\", \"| +---+---+\", \"| | | |\", \"| | | |\", \"+----+---+---+\", \" +---+\"]", "output":... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nNote that the memory limit is unusual.\n\nYou are given an integer n and two sequences a_1, a_2, ..., a_n and... | [{"input": "20\n27 6 6 60 47 97 62 25 67 28 41 93 65 32 16 56 57 53 66 61\n84392 -11227 -93200 -52089 4854 -99982 -81560 95957 -35579 -91088 31023 -68447 -41338 -27132 43558 23876 35055 -36267 77633 -94930\n", "output": "294839\n"}, {"input": "20\n27 6 6 60 47 97 62 25 67 28 41 93 65 32 16 56 57 53 66 61\n84392 -11227 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a colored permutation $p_1, p_2, \\dots, p_n$. The $i$-th element of the permutation has color ... | [{"input": "3\n4\n1 3 4 2\n1 1 2 3\n5\n2 3 4 5 1\n1 2 5 10 3\n8\n7 4 5 6 1 8 3 2\n5 3 4 4 12 5 8 9\n", "output": "1\n5\n4\n"}, {"input": "3\n4\n1 3 4 2\n1 2 2 3\n5\n2 3 4 5 1\n1 2 10 4 5\n8\n7 4 5 6 1 8 3 2\n5 3 6 4 7 5 8 4\n", "output": "1\n5\n2\n"}, {"input": "3\n4\n1 3 4 2\n1 1 2 3\n5\n2 3 4 5 1\n1 2 5 10 4\n8\n7 4 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nProfessor Vasechkin is studying evolution of worms. Recently he put forward hypotheses that all worms evolve ... | [{"input": "100\n804 510 266 304 788 178 862 888 408 82 414 470 777 991 729 229 1767 406 601 1 596 720 608 706 432 361 527 548 59 548 474 515 4 991 263 568 681 24 117 563 576 587 281 643 904 521 891 106 842 884 943 54 605 1567 504 757 311 374 335 192 447 652 633 410 455 402 382 150 432 836 413 819 669 875 638 925 217 8... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIchihime is the current priestess of the Mahjong Soul Temple. She claims to be human, despite her cat ears.\n... | [{"input": "14\n2374453 2374454 8591131 23094546\n5813291 5813292 9709163 35032815\n4280399 23049698 23049701 34728360\n15184184 18688462 22400847 22400849\n24397371 31462070 33936330 33936331\n21376685 28241116 38909200 38909202\n29491847 31628480 31628482 45225214\n15144763 15414479 36902879 36902881\n36023581 388899... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nJAG mock qualifying practice session\n\nThe ACM-ICPC OB / OG Association (Japanese Alumni Group; JAG) has N q... | [{"input": "5 3\n1 1\n2 3\n3 2\n3 17\n2 1\n4 2\n1 7\n2 1\n1 3\n2 5\n6 1\n1 3\n1 2\n1 8\n1 2\n1 7\n1 6\n20 9\n4 10\n2 6\n8 3\n1 6\n6 3\n7 4\n8 10\n4 12\n7 5\n1 8\n5 7\n1 5\n4 6\n9 9\n5 8\n6 7\n1 4\n6 4\n7 10\n3 5\n19 6\n4 2\n6 5\n5 10\n1 10\n3 10\n3 6\n2 3\n1 4\n2 10\n1 8\n3 4\n3 1\n5 4\n1 10\n1 3\n5 10\n5 2\n1 10\n2 3\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVasya wants to turn on Christmas lights consisting of m bulbs. Initially, all bulbs are turned off. There are... | [{"input": "1 100\n100 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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100\n", "... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDigory Kirke and Polly Plummer are two kids living next door to each other. The attics of the two houses are ... | [{"input": "4\n####\n#..#.##\n##..#.#\n##.#....#", "output": "0\n1\n1\n2\n"}, {"input": "4\n####\n#..#.##\n#.#..##\n##.#....#", "output": "0\n1\n2\n2\n"}, {"input": "4\n####\n##.#..#\n#.#..##\n##.#....#", "output": "0\n2\n2\n2\n"}, {"input": "4\n####\n##.#..#\n#.#..##\n#....#.##", "output": "0\n2\n2\n1\n"}, {"input": "... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRingo is giving a present to Snuke.\n\nRingo has found out that Snuke loves yakiniku (a Japanese term meaning... | [{"input": "UKINIKAY", "output": "No\n"}, {"input": "UAKOYAKI", "output": "No\n"}, {"input": "NKIUIKAY", "output": "No\n"}, {"input": "IKAYOKAU", "output": "No\n"}, {"input": "NKIUAKIY", "output": "No\n"}, {"input": "AAKOYUKI", "output": "No\n"}, {"input": "OKIUAKIY", "output": "No\n"}, {"input": "AAKPYUKI", "output": ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWrite a program which reads two integers x and y, and prints them in ascending order.\n\nConstraints\n\n* 0 ≤... | [{"input": "3 0\n-1 2\n15 3\n0 0", "output": "0 3\n-1 2\n3 15\n"}, {"input": "3 -1\n0 2\n27 3\n0 0", "output": "-1 3\n0 2\n3 27\n"}, {"input": "4 -1\n0 2\n27 3\n0 0", "output": "-1 4\n0 2\n3 27\n"}, {"input": "4 -1\n0 2\n18 3\n0 0", "output": "-1 4\n0 2\n3 18\n"}, {"input": "4 -1\n0 2\n18 5\n0 0", "output": "-1 4\n0 2\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nToday, Yasser and Adel are at the shop buying cupcakes. There are $n$ cupcake types, arranged from $1$ to $n$... | [{"input": "12\n3\n7 -4 5\n3\n7 -5 4\n3\n4 -5 7\n3\n5 -4 7\n4\n5 -5 -6 6\n5\n100 100 100 -50 50\n10\n11 5 -12 7 -10 20 30 -10 50 60\n10\n10 5 -14 7 -7 20 30 -50 50 60\n2\n1 1\n2\n-1 -1\n3\n1000000000 1010000000 1000000000\n3\n-1000000000 -1000000000 -1000000000\n", "output": "YES\nNO\nNO\nYES\nNO\nNO\nYES\nYES\nYES\nNO... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGildong was hiking a mountain, walking by millions of trees. Inspired by them, he suddenly came up with an in... | [{"input": "14\n4 9\n3 7\n4 1\n3 2\n14 9\n7 6\n10 13\n8 7\n5 7\n7 10\n1 3\n12 3\n7 11\n20\n13 6 14 9 1\n6 4 3 7 9\n9 3 6 13 7\n6 11 11 5 9\n14 5 2 3 4\n13 12 4 2 7\n13 14 7 3 2\n9 5 13 13 6\n8 9 7 3 7\n14 10 11 12 7\n6 12 13 1 1\n8 13 8 10 8\n1 5 13 10 7\n1 4 13 2 6\n1 5 6 4 10\n6 9 11 8 5\n9 7 14 7 9\n12 5 6 8 9\n14 1... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA common problem in number theory is to find x given a such that:\n\na * x = 1 mod [n] \n\nThen x is called t... | [{"input": "156435434\n3543432125", "output": "[1056765589]", "fn_name": "inverseMod"}, {"input": "101014\n125445", "output": "[7969]", "fn_name": "inverseMod"}, {"input": "61965\n17408", "output": "[null]", "fn_name": "inverseMod"}, {"input": "48\n733", "output": "[168]", "fn_name": "inverseMod"}, {"input": "229\n101"... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nImagine a city with n horizontal streets crossing m vertical streets, forming an (n - 1) × (m - 1) grid. In o... | [{"input": "20 20\n><<><<<<<<<>>><>>><<\n^^^^^^^^vvvv^vv^vvvv\n", "output": "YES\n"}, {"input": "20 20\n<>>>>>>>><>>><>><<<>\nvv^^vv^^^^v^vv^v^^^^\n", "output": "YES\n"}, {"input": "20 20\n>>><<<<<>>><><><<><<\n^^^vvv^^^v^^v^^v^vvv\n", "output": "YES\n"}, {"input": "20 20\n<<><<<<<<>>>>><<<>>>\nvvvvvv^v^vvv^^^^^^^^\n",... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWhen l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\\frac{l+1}{2})-th largest value ... | [{"input": "6\n5 -1 -1 -1 13 -1", "output": "-1\n-1\n-1\n-1\n-1\n-1\n"}, {"input": "6\n5 -1 -1 -1 13 0", "output": "-1\n0\n0\n0\n-1\n-1\n"}, {"input": "6\n5 -2 -1 0 15 -2", "output": "-1\n0\n0\n-1\n-1\n0\n"}, {"input": "6\n5 -2 -1 1 15 -2", "output": "-1\n1\n1\n-1\n-1\n1\n"}, {"input": "6\n4 4 -1 -1 4 -7", "output": "-... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAn NBA game runs 48 minutes (Four 12 minute quarters). Players do not typically play the full game, subbing i... | [{"input": "16\n27", "output": "[28.4]", "fn_name": "nba_extrap"}, {"input": "11\n19", "output": "[27.8]", "fn_name": "nba_extrap"}, {"input": "14\n33", "output": "[20.4]", "fn_name": "nba_extrap"}, {"input": "1\n7.5", "output": "[6.4]", "fn_name": "nba_extrap"}, {"input": "6\n13", "output": "[22.2]", "fn_name": "nba_e... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nChildan is making up a legendary story and trying to sell his forgery — a necklace with a strong sense of \"W... | [{"input": "12 1 1\n0 1 2 3 2 5 6 11 0 10 10 17\n001010001000\n001010001000 100\n", "output": "1\n"}, {"input": "12 1 1\n0 1 2 3 2 6 6 11 0 10 10 17\n001010001000\n001010001000 100\n", "output": "1\n"}, {"input": "12 1 1\n0 1 2 3 2 2 6 11 0 10 10 17\n001010001000\n001010001000 100\n", "output": "1\n"}, {"input": "12 1 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPetya and Vasya decided to play a little. They found n red cubes and m blue cubes. The game goes like that: t... | [{"input": "100000 100000\n", "output": "99999 100000\n"}, {"input": "100000 100000\n", "output": "99999 100000\n"}, {"input": "10000 100010\n", "output": "100009 10000\n"}, {"input": "10000 110010\n", "output": "110009 10000\n"}, {"input": "110881 42754\n", "output": "110880 42754\n"}, {"input": "25938 152750\n", "out... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet's denote that some array $b$ is bad if it contains a subarray $b_l, b_{l+1}, \\dots, b_{r}$ of odd length... | [{"input": "10 11\n-1 11 -1 -1 -1 -1 10 -1 -1 -1\n", "output": "100000000\n"}, {"input": "10 11\n-1 11 -1 -1 -1 -1 10 -1 -1 -1\n", "output": "100000000\n"}, {"input": "10 17\n-1 11 -1 -1 -1 -1 10 -1 -1 -1\n", "output": "301989884\n"}, {"input": "10 11\n-1 1 -1 -1 -1 -1 10 -1 -1 -1\n", "output": "100000000\n"}, {"input"... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn the 17th century, Fermat wrote that he proved for any integer $n \\geq 3$, there exist no positive integer... | [{"input": "6\n3\n13\n0", "output": "27\n11\n126\n"}, {"input": "6\n25\n12\n0", "output": "27\n64\n54\n"}, {"input": "6\n6\n15\n0", "output": "27\n27\n119\n"}, {"input": "6\n15\n2\n0", "output": "27\n119\n6\n"}, {"input": "6\n14\n4\n0", "output": "27\n16\n10\n"}, {"input": "6\n25\n4\n0", "output": "27\n64\n10\n"}, {"in... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are solving the crossword problem K from IPSC 2014. You solved all the clues except for one: who does Eev... | [{"input": "8\n.a.o.e.n\n", "output": "vaporeon\n"}, {"input": "8\n........\n", "output": "vaporeon\n"}, {"input": "8\n..p.....\n", "output": "vaporeon\n"}, {"input": "8\n..p.....\n", "output": "vaporeon\n"}, {"input": "8\n.a.o.e.n\n", "output": "vaporeon\n"}, {"input": "8\n........\n", "output": "vaporeon\n"}, {"input... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has 3 keys on it: the 0 ... | [{"input": "01B0\n", "output": "00\n"}, {"input": "B010", "output": "010\n"}, {"input": "B110", "output": "110\n"}, {"input": "B011", "output": "011\n"}, {"input": "B101", "output": "101\n"}, {"input": "B111", "output": "111\n"}, {"input": "B100", "output": "100\n"}, {"input": "B001", "output": "001\n"}, {"input": "B00... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nKolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicio... | [{"input": "1000000000000000000\n999999998000000000\n999999999000000000\n999999998000000000\n", "output": " 3\n"}, {"input": "1\n1000000000000000000\n1000000000\n999999999\n", "output": " 0\n"}, {... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn this Kata you are a game developer and have programmed the #1 MMORPG(Massively Multiplayer Online Role Pla... | [{"input": "769832696988485\n170", "output": "[\"You have already reached level 170.\"]", "fn_name": "xp_to_target_lvl"}, {"input": "10396\n11", "output": "[\"You have already reached level 11.\"]", "fn_name": "xp_to_target_lvl"}, {"input": "2017\n4", "output": "[\"You have already reached level 4.\"]", "fn_name": "xp_... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n## Task\n\nGiven a positive integer `n`, calculate the following sum: \n\n```\nn + n/2 + n/4 + n/8 + ...\n```... | [{"input": "127", "output": "[247]", "fn_name": "halving_sum"}, {"input": "320", "output": "[638]", "fn_name": "halving_sum"}, {"input": "101", "output": "[198]", "fn_name": "halving_sum"}, {"input": "257", "output": "[512]", "fn_name": "halving_sum"}, {"input": "25", "output": "[47]", "fn_name": "halving_sum"}, {"inpu... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given strings S and T consisting of lowercase English letters.\nYou can perform the following operati... | [{"input": "yiizlygglzgpypipzllbzpwgblzziigpgpgywpggbpylpylzlzplwypgwizgpgbywiwwzpygzpgillgbzyiwpwzgppwlbpwzilwilbbbybgzlppgwgyypybbpgbwplzbbzpzbzzzzzzppbwipyzzylyyyibwipyzbyzpygppggibzzlgpzwyglglbywwiglyggbzyzwgpzillgybypbywygzpwzligpwlzwizbpwbzzybzyyglbplpzlgzzipplizbgpgpggylgzybplwyyggyiybppzzibzlpgwplilwigbypzzipgy... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAs bad weather continues and vegetable prices soar, Seven-Eleven is offering customers bulk purchase sales of... | [{"input": "4 2\n50 40 100 80\n7 3\n400 139 100 700 200 600 500\n0 0", "output": "150\n2000\n"}, {"input": "4 2\n50 40 100 80\n7 3\n400 300 100 700 116 600 500\n0 0", "output": "150\n2100\n"}, {"input": "4 3\n50 40 100 80\n7 3\n400 290 000 1162 352 600 57\n0 0", "output": "220\n2404\n"}, {"input": "4 3\n97 59 100 113\n... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA piece of paper contains an array of n integers a1, a2, ..., an. Your task is to find a number that occurs t... | [{"input": "100 1000\n-281 191 -27 -286 -497 462 0 889 0 -350 -720 -507 916 0 -648 -942 -140 0 0 -877 66 576 -278 410 -792 -607 713 712 296 -828 -488 -129 508 -106 470 -263 -865 -506 -604 334 591 -40 220 0 0 198 -435 374 -34 254 970 0 549 100 555 326 91 0 -361 -835 472 823 -663 -456 0 91 295 126 383 141 476 609 518 545... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTwo neighboring kingdoms decided to build a wall between them with some gates to enable the citizens to go fr... | [{"input": "100\nRUURUURRUURUUUUURRUUURRRRUURRURRURRRRUUUUUURRUURRRRURUUURUURURRRRRURUURRUURUURRUUURUUUUUURRUUUURUUUR\n", "output": "3\n"}, {"input": "100\nRUURUURRUURUUUUURRUUURRRRUURRURRURRRRUUUUUURRUURRRRURUUURUURURRRRRURUURRUURUURRUUURUUUUUURRUUUURUUUR\n", "output": "3\n"}, {"input": "100\nRUUURUUUURRUUUUUURUUURRUU... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLittle boy Gerald studies at school which is quite far from his house. That's why he has to go there by bus e... | [{"input": "68 74\n51 54\n3 22\n12 24\n3 27\n32 42\n36 55\n60 64\n1 4\n4 23\n11 64\n54 62\n50 56\n21 34\n27 63\n15 54\n28 61\n13 57\n39 53\n12 32\n32 40\n33 67\n55 61\n33 67\n30 37\n15 49\n27 45\n21 41\n8 42\n24 63\n40 48\n28 41\n30 67\n0 4\n7 15\n27 59\n60 62\n25 65\n30 31\n38 67\n24 43\n14 64\n26 46\n8 12\n34 41\n32 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nCyael is a teacher at a very famous school in Byteland and she is known by her students for being very polite... | [{"input": "2\n17 0\n100 1", "output": "0 17\n100 0\n"}, {"input": "2\n17 0\n101 0", "output": "0 17\n0 101\n"}, {"input": "2\n17 0\n101 1", "output": "0 17\n101 0\n"}, {"input": "2\n10 0\n101 3", "output": "0 10\n33 2\n"}, {"input": "2\n18 0\n101 3", "output": "0 18\n33 2\n"}, {"input": "2\n18 0\n111 3", "output": "0 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet's define a good tree:It is a tree with k * n nodes labeled from 0 to k * n - 1\nNode i and node j are not... | [{"input": "11 11", "output": "459104785\n"}, {"input": "11 14", "output": "737454094\n"}, {"input": "11 28", "output": "685943622\n"}, {"input": "4 10", "output": "994788518\n"}, {"input": "6 10", "output": "835647629\n"}, {"input": "6 13", "output": "865042129\n"}, {"input": "2 13", "output": "748239339\n"}, {"input"... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Task\n Given a sorted array of integers `A`, find such an integer x that the value of `abs(A[0] - x) + abs(... | [{"input": "[-10, -10, -10, -10, -10, -9, -9, -9, -8, -8, -7, -6, -5, -4, -3, -2, -1, 0, 0, 0, 0, 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]", "output": "[15]", "fn_name": ... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAt the first holiday in spring, the town Shortriver traditionally conducts a flower festival. Townsfolk wear ... | [{"input": "100 15 6 10\n6 9 1 7 6 4 1 9 3 2 4 6 2 5 3 10 9 2 9 1 6 5 6 2 3 10 7 10 7 4 5 4 4 4 4 7 1 10 8 4 8 3 10 10 7 4 4 10 6 1 8 5 4 6 2 3 10 3 2 5 7 5 6 10 10 3 4 5 4 3 3 1 7 8 10 10 10 10 8 3 7 4 2 1 8 6 5 6 5 8 7 9 2 1 5 2 4 6 10 8\n6 9 7 8 7 1 4 3 5 8\n", "output": "2\n76 77 \n"}, {"input": "100 15 6 10\n3 2 3... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nSnuke has decided to construct a string that starts with A and ends with Z, by taking out a substring of a st... | [{"input": "HASFJGHOGAKZZFEGA\n", "output": "12\n"}, {"input": "HASFJGHOGAK[ZFEGA", "output": "12\n"}, {"input": "IBAG[IHNGFKKZSFGB", "output": "11\n"}, {"input": "AIEFZGKAFOFGJZSAH", "output": "14\n"}, {"input": "ICAF[IHNGFKZKSFGB", "output": "10\n"}, {"input": "AGEFZJG@GNHHZFSAK", "output": "13\n"}, {"input": "HASFEH... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are two cameras which observe the up line and the down line respectively on the double lane (please see... | [{"input": "4 5\n20 35 110 70\n15 30 40 84 113\n3 2\n10 20 30\n81 60\n0 1\n100\n1 1\n10\n83\n0 0", "output": "30\n30\n100\n73\n"}, {"input": "4 5\n20 60 110 70\n15 30 40 84 113\n3 2\n10 20 30\n42 60\n0 1\n100\n1 1\n10\n83\n0 0", "output": "26\n18\n100\n73\n"}, {"input": "4 5\n4 35 110 134\n15 30 40 84 113\n3 2\n10 20 3... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGiven is a positive even number N.\n\nFind the number of strings s of length N consisting of `A`, `B`, and `C... | [{"input": "1100000", "output": "298228697\n"}, {"input": "0110000", "output": "784164463\n"}, {"input": "0110010", "output": "189920713\n"}, {"input": "1100010", "output": "865187132\n"}, {"input": "0100100", "output": "545699273\n"}, {"input": "1110010", "output": "816062167\n"}, {"input": "0110110", "output": "97385... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAlice, the president of club FCB, wants to build a team for the new volleyball tournament. The team should co... | [{"input": "6 2 3\n78 93 9 17 13 78\n80 97\n30 52\n49 17\n56 68\n60 36\n84 55\n", "output": "377\n"}, {"input": "6 2 3\n78 93 9 17 13 78\n80 12\n30 52\n49 17\n56 68\n60 36\n84 55\n", "output": "377\n"}, {"input": "6 2 3\n78 93 9 17 13 78\n80 97\n30 52\n26 17\n56 68\n60 36\n84 55\n", "output": "377"}, {"input": "3 2 1\n... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA number is self-descriptive when the n'th digit describes the amount n appears in the number.\n\nE.g. 21200:... | [{"input": "6210001000", "output": "[true]", "fn_name": "self_descriptive"}, {"input": "51120111", "output": "[false]", "fn_name": "self_descriptive"}, {"input": "42101000", "output": "[true]", "fn_name": "self_descriptive"}, {"input": "3211000", "output": "[true]", "fn_name": "self_descriptive"}, {"input": "21230", "o... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThis version of the problem differs from the next one only in the constraint on n.\n\nNote that the memory li... | [{"input": "162685 187160003\n", "output": "175888140\n"}, {"input": "200000 316925344\n", "output": "253547906\n"}, {"input": "140750 887458748\n", "output": "669831877\n"}, {"input": "197426 364348492\n", "output": "289708472\n"}, {"input": "199862 999999937\n", "output": "750469605"}, {"input": "124953 922406879\n",... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLimak and Radewoosh are going to compete against each other in the upcoming algorithmic contest. They are equ... | [{"input": "50 1\n6 17 44 82 94 127 134 156 187 211 212 252 256 292 294 303 352 355 379 380 398 409 424 434 480 524 584 594 631 714 745 756 777 778 789 793 799 821 841 849 859 878 879 895 925 932 944 952 958 990\n15 16 40 42 45 71 143 100 117 120 174 181 186 318 221 268 289 332 376 394 403 409 411 444 471 487 499 539 5... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\n# Background\n\nMy pet bridge-maker ants are marching across a terrain from left to right.\n\nIf they encount... | [{"input": "\"JIHGFEDCBA\"\n\"--........------.-........-........---....-----\"", "output": "[\"GFEDCBAJIH\"]", "fn_name": "ant_bridge"}, {"input": "\"JIHGFEDCBA\"\n\"-.....------........-.......-.......----\"", "output": "[\"CBAJIHGFED\"]", "fn_name": "ant_bridge"}, {"input": "\"JIHGFEDCBA\"\n\"-------.......-.......-... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere is an N-car train.\nYou are given an integer i. Find the value of j such that the following statement i... | [{"input": "-108 -1", "output": "-106\n"}, {"input": "-108 71", "output": "-178\n"}, {"input": "-159 71", "output": "-229\n"}, {"input": "-116 71", "output": "-186\n"}, {"input": "-74 36", "output": "-109\n"}, {"input": "-74 71", "output": "-144\n"}, {"input": "-93 71", "output": "-163\n"}, {"input": "-97 71", "output"... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAs you know, majority of students and teachers of Summer Informatics School live in Berland for the most part... | [{"input": "10 10\n7 29\n10 31\n9 40\n5 17\n5 30\n6 85\n2 53\n7 23\n4 57\n10 9\n", "output": "49\n"}, {"input": "10 10\n5 81\n7 68\n7 48\n1 10\n5 37\n7 97\n8 54\n7 41\n7 56\n5 21\n", "output": "110\n"}, {"input": "10 10\n5 81\n7 68\n7 48\n1 10\n5 37\n7 97\n8 54\n7 41\n7 56\n5 21\n", "output": "110\n"}, {"input": "10 10... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nA triangular number is the number of dots in an equilateral triangle uniformly filled with dots. For example,... | [{"input": "300\n", "output": "YES\n"}, {"input": "406\n", "output": "YES\n"}, {"input": "253\n", "output": "YES\n"}, {"input": "276\n", "output": "YES\n"}, {"input": "496\n", "output": "YES\n"}, {"input": "351\n", "output": "YES\n"}, {"input": "378\n", "output": "YES\n"}, {"input": "153\n", "output": "YES\n"}, {"input... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTakahashi has come to an integer shop to buy an integer.\nThe shop sells the integers from 1 through 10^9. Th... | [{"input": "1000000000 1000000000 1000000000000000000\n", "output": "999999991\n"}, {"input": "773361868 125660016 773361869833880887\n", "output": "1000000000\n"}, {"input": "839296263 462224593 839296268591205063\n", "output": "1000000000\n"}, {"input": "450968417 430302156 443135970740411047\n", "output": "982631931... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nPetr, Nikita G. and Nikita are the most... | [{"input": "3\n6\n6\n6", "output": "14.7\n14.7\n14.7\n"}, {"input": "3\n1\n6\n6", "output": "1.0\n14.7\n14.7\n"}, {"input": "3\n2\n6\n6", "output": "3.0\n14.7\n14.7\n"}, {"input": "3\n6\n1\n6", "output": "14.7\n1.0\n14.7\n"}, {"input": "3\n6\n2\n6", "output": "14.7\n3.0\n14.7\n"}, {"input": "3\n3\n6\n6", "output": "5.5... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nDevu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They... | [{"input": "10 10\n23 101 38 38 73 54 59 69 44 150\n100 100 100 100 100 100 100 100 100 100\n", "output": "402\n"}, {"input": "10 10\n23 101 38 38 73 54 59 69 44 150\n100 100 100 100 100 100 100 101 100 100\n", "output": "403\n"}, {"input": "10 10\n23 100 38 74 73 54 59 69 44 139\n100 100 100 100 110 100 100 100 100 10... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVK news recommendation system daily selects interesting publications of one of $n$ disjoint categories for ea... | [{"input": "40\n19 20 8 13 13 17 1 14 15 20 14 17 2 9 9 10 19 16 6 12 9 7 20 5 12 2 4 4 12 5 4 11 8 1 2 8 11 19 18 4\n52258 5648 46847 9200 63940 79328 118413 54479 1788 60107 8234 64215 15419 84411 50307 78075 92548 17867 43456 7970 1390 99373 97297 90662 82950 678 79356 51351 2794 82477 16508 19254 81295 9711 72350 1... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe have a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n}.\nPrint the number of elements p... | [{"input": "20\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20\n", "output": "18\n"}, {"input": "20\n20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1\n", "output": "18\n"}, {"input": "20\n1 20 2 19 3 18 4 17 5 16 6 15 7 14 8 13 9 12 10 11\n", "output": "0\n"}, {"input": "20\n20 1 2 19 3 18 4 17 5 16 6 15 7 14 8 1... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand.... | [{"input": "1s 2s 3s\n", "output": "0\n"}, {"input": "9m 9m 9m\n", "output": "0\n"}, {"input": "3p 9m 2p\n", "output": "1\n"}, {"input": "8p 2s 9m\n", "output": "2\n"}, {"input": "5s 8m 5s\n", "output": "1\n"}, {"input": "9s 4s 3m\n", "output": "2\n"}, {"input": "4p 8m 9s\n", "output": "2\n"}, {"input": "8s 5s 7p\n", "... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nFox Ciel is developing an artificial intelligence (AI) for a game. This game is described as a game tree T wi... | [{"input": "3\n-1 2 -1\n2 2 3\n0\n1", "output": "2 2\n"}, {"input": "3\n-2 4 -1\n2 2 3\n0\n0", "output": "2 2\n"}, {"input": "3\n-2 4 -2\n2 2 3\n0\n0", "output": "2 2\n"}, {"input": "3\n-2 2 -1\n2 2 3\n0\n1", "output": "2 2\n"}, {"input": "3\n-4 4 -1\n2 2 3\n0\n0", "output": "2 2\n"}, {"input": "3\n-1 -1 0\n2 2 3\n0\n1... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe have N locked treasure boxes, numbered 1 to N.\nA shop sells M keys. The i-th key is sold for a_i yen (the... | [{"input": "12 1000\n100000 12\n1 2 3 4 5 6 7 8 9 10 11 12\n100000 12\n1 2 3 4 5 6 7 8 9 10 11 12\n100000 12\n1 2 3 4 5 6 7 8 9 10 11 12\n100000 12\n1 2 3 4 5 6 7 8 9 10 11 12\n100000 12\n1 2 3 4 5 6 7 8 9 10 11 12\n100000 12\n1 2 3 4 5 6 7 8 9 10 11 12\n100000 12\n1 2 3 4 5 6 7 8 9 10 11 12\n100000 12\n1 2 3 4 5 6 7 8... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou're given an array $a$ of length $n$. You can perform the following operation on it as many times as you w... | [{"input": "36\n398353608 662365068 456456182 594572278 958026500 524977116 903404403 382220192 142092809 137516115 522872496 527845939 116437661 423289717 907151540 961740613 981968938 143206666 773454188 691188206 95402302 602570397 986508327 617421132 46091276 866348540 485487643 843511039 768135914 68050875 2627811... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the chi... | [{"input": "100 20\n21 19 61 70 54 97 98 14 61 72 25 94 24 56 55 25 12 80 76 11 35 17 80 26 11 94 52 47 84 61 10 2 74 25 10 21 2 79 55 50 30 75 10 64 44 5 60 96 52 16 74 41 20 77 20 44 8 86 74 36 49 61 99 13 54 64 19 99 50 43 12 73 48 48 83 55 72 73 63 81 30 27 95 9 97 82 24 3 89 90 33 14 47 88 22 78 12 75 58 67\n", "o... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nCreate a function that transforms any positive number to a string representing the number in words. The func... | [{"input": "888887", "output": "[\"eight hundred eighty-eight thousand eight hundred eighty-seven\"]", "fn_name": "number2words"}, {"input": "99997", "output": "[\"ninety-nine thousand nine hundred ninety-seven\"]", "fn_name": "number2words"}, {"input": "7217", "output": "[\"seven thousand two hundred seventeen\"]", "f... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nVasya follows a basketball game and marks the distances from which each team makes a throw. He knows that eac... | [{"input": "18\n450 3726 12063 42865 29689 35320 33937 4067 45951 80313 53004 59541 75551 75836 151186 81297 93876 96211\n47\n3393 11375 6494 7645 9549 8499 11145 13121 14801 15578 24104 24125 25871 31280 35036 38969 29966 41342 42708 46033 47491 25404 49152 51905 55002 9827 56565 57901 104645 37176 66075 87521 68397 1... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAdilbek was assigned to a special project. For Adilbek it means that he has $n$ days to run a special program... | [{"input": "50\n1000000000 1000000000\n999999999 1000000000\n999999998 1000000000\n999999997 1000000000\n999999996 1000000000\n999999995 1000000000\n999999994 1000000000\n999999900 1000000000\n1 11\n2 11\n3 11\n4 11\n5 11\n6 11\n7 11\n8 11\n9 11\n10 11\n11 11\n4 18\n4 20\n3 19\n3 18\n3 167\n3 15\n3 14\n3 13\n3 12\n3 11... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a string S of length n with each character being one of the first m lowercase English letters. ... | [{"input": "100 26\njysrixyptvsesnapfljeqkytlpeepjopspmkviqdqbdkylvfiawhdjjdvqqvcjmmsgfdmpjwahuwhgsyfcgnefzmqlvtvqqfbfsf\n", "output": "237400\n"}, {"input": "100 26\njysrixyptvsesnapfljeqkytlpeepjopspmkviqdqbdkylvfiawhdjjdvqqvcjmmsgfdmpjwahuwhgsyfcgnefzmqlvtvqqfbfsf\n", "output": "237400\n"}, {"input": "100 26\njysrix... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nRead problems statements in Mandarin Chinese and Russian as well. \n\nEuler's phi function for a positive in... | [{"input": "3\n2 1\n229 975\n12 34", "output": "0\n12\n5\n"}, {"input": "3\n2 1\n229 975\n6 62", "output": "0\n12\n10\n"}, {"input": "3\n3 10\n48 237\n18 32", "output": "3\n11\n3\n"}, {"input": "3\n1 10\n48 237\n18 32", "output": "5\n11\n3\n"}, {"input": "3\n2 1\n396 1220\n3 12", "output": "0\n10\n4\n"}, {"input": "3\n... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIn cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher ... | [{"input": "xlmw mw xli tmgxyvi xlex m xsso mr ilx xvmt.", "output": "this is the picture that i took in eht trip.\n"}, {"input": "xlmw mw xli tmgxyvi xlex m ossx mr ilx xvmt.", "output": "this is the picture that i koot in eht trip.\n"}, {"input": "xlmw mw xli tmgxyvi xlex m ossx mr ilx xwmt.", "output": "this is the ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nOne day, early in the morning, you decided to buy yourself a bag of chips in the nearby store. The store has ... | [{"input": "4\n1\n1337\n3\n31 7 1\n5\n0 2 2 6 10\n3\n9 143 1515\n", "output": "446\n11\n4\n506\n"}, {"input": "4\n1\n1337\n3\n10 2 1\n5\n2 2 3 4 5\n3\n10 115 1546\n", "output": "446\n5\n3\n516\n"}, {"input": "4\n1\n1337\n3\n31 7 1\n5\n0 2 2 6 10\n3\n9 105 940\n", "output": "446\n11\n4\n314\n"}, {"input": "4\n1\n1337\n3... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given a string $s$ consisting of exactly $n$ characters, and each character is either '0', '1' or '2'... | [{"input": "69\n000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "000000000000000000000001111111111111111111111122222222222222222222222\n"}, {"input": "69\n000000000000000000000000000000000000000000000000000000000000000000000\n", "output": "00000000000000000000000111111111111111111111... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are given an array $a$ of length $2n$. Consider a partition of array $a$ into two subsequences $p$ and $q... | [{"input": "16\n998244362 998244362 1545401713 998244362 998244362 998244362 998244362 998244362 1483557929 998244362 998244362 356870606 998244362 998244362 998244362 998244362 998244363 998244363 998244363 998244363 998244363 998244363 998244363 998244363 998244363 998244363 998244363 998244363 1290068308 998244363 9... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nIs there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same... | [{"input": "wwwbbwbbbwbwbwwbwwbbbwbwbwwbbbwbwwwbwwbwbbbbwwbwwwwwbwwwwwwwwbbwwwwbbbbbwbwbbwwbbbbbwbwbbwbwwwbbwwbbbwwwbbwwbwwbbbbwwbwbbwbwwbbwbwbwbbwwbwwwbwbwbbbwwwwwwbwwbbbwwbwwbwbwwwbbwwwwwwwwwbwwbwbbbwbwwwwbwwbbwbbwbwwbwwbwwbbwbbwwwwbwwwbwwwbwbwwwbbwwbbwwbwbwwwwwwbwbwwwwbbwwwbwbwwwbbwwwwwbwwbwbbbbbwbwwbbbbbbbwbbwbbwww... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAlice and Bob are controlling a robot. They each have one switch that controls the robot.\n\nAlice started ho... | [{"input": "56 100 33 100\n", "output": "44\n"}, {"input": "0 100 0 100\n", "output": "100\n"}, {"input": "0 75 25 100\n", "output": "50\n"}, {"input": "10 90 20 80\n", "output": "60\n"}, {"input": "77 88 34 96\n", "output": "11\n"}, {"input": "0 100 99 100\n", "output": "1\n"}, {"input": "0 148 36 100", "output": "64\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThere's a new security company in Paris, and they decided to give their employees an algorithm to make first ... | [{"input": "\"Bernard-Henry-Levy\"", "output": "[true]", "fn_name": "show_me"}, {"input": "\"Jean-Luc-Picard-\"", "output": "[false]", "fn_name": "show_me"}, {"input": "\"A-a-a-a----a-a\"", "output": "[false]", "fn_name": "show_me"}, {"input": "\"Z-------------\"", "output": "[false]", "fn_name": "show_me"}, {"input": ... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou a captain of a ship. Initially you are standing in a point $(x_1, y_1)$ (obviously, all positions in the ... | [{"input": "0 0\n1000000000 1000000000\n2\nDR\n", "output": "2000000000\n"}, {"input": "0 0\n1000000000 1000000000\n2\nDR\n", "output": "2000000000\n"}, {"input": "0 0\n1000000010 1000000000\n2\nDR\n", "output": "2000000010\n"}, {"input": "1 0\n1010000000 1000000000\n2\nDR\n", "output": "2010000000\n"}, {"input": "0 0\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYou are policeman and you are playing a game with Slavik. The game is turn-based and each turn consists of tw... | [{"input": "100 2 2\n1 73456 13268 11914 2 1 2 1 1 2 1 1 87480 65464 2 40468 7016 70750 28675 92808 74100 22702 47484 22345 61255 1 104206 62017 89058 61094 76626 1 171051 98876 97451 18228 2 2 1 38979 1 144831 1 43289 73591 2 1 91061 89577 13598 1 2 2 57020 2 82044 24974 1 1 958 8399 1 98709 10870 1 66150 2 79527 2 2 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nGennady is one of the best child dentists in Berland. Today n children got an appointment with him, they line... | [{"input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 5 82\n9 9 25\n3 2 86\n1 5 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10 "}, {"input": "10\n9 8 8\n2 9 33\n10 7 42\n7 2 18\n3 4 82\n9 9 25\n3 2 86\n1 5 49\n5 3 72\n4 4 71\n", "output": "10\n1 2 3 4 5 6 7 8 9 10 "}, {"input": "10\n9 8 8\n2 9 33\n10 7 42\n8 2 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nTree is a connected graph without cycles. A leaf of a tree is any vertex connected with exactly one other ver... | [{"input": "12\n1 2\n1 3\n1 4\n2 5\n2 6\n3 7\n3 12\n3 9\n8 10\n8 11\n8 12\n", "output": "5\n"}, {"input": "12\n1 2\n1 3\n1 4\n2 5\n2 6\n5 7\n3 8\n3 9\n8 10\n8 11\n8 12\n", "output": "5\n"}, {"input": "12\n1 2\n2 3\n1 4\n2 5\n2 6\n5 7\n3 8\n3 9\n8 10\n8 11\n8 12\n", "output": "7\n"}, {"input": "12\n1 2\n1 3\n1 4\n2 5\n3... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLuke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting dig... | [{"input": "1000000000000000000\n", "output": "1000000000000000000\n"}, {"input": "1000000000000000000\n", "output": "1000000000000000000\n"}, {"input": "1000001000000000000\n", "output": "1000001000000000000\n"}, {"input": "1000001000000000010\n", "output": "1000001000000000010\n"}, {"input": "1010001000000000010\n", ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet f(A, B), where A and B are positive integers, be the string satisfying the following conditions:\n\n* f(A... | [{"input": "5\n2 3 1 5\n6 7 1 10\n2 3 1 4\n6 12 2 10\n8 10 10 14", "output": "BABAB\nBABABABABA\nBABA\nBBABBABBA\nABBAB\n"}, {"input": "5\n2 3 1 5\n6 7 1 10\n2 3 1 4\n6 12 3 10\n8 10 10 14", "output": "BABAB\nBABABABABA\nBABA\nBABBABBA\nABBAB\n"}, {"input": "5\n2 3 1 5\n6 7 1 10\n2 3 1 4\n6 12 3 7\n8 10 6 14", "output"... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nThe cities of Byteland and Berland are located on the axis $Ox$. In addition, on this axis there are also dis... | [{"input": "15\n-9518 R\n-6858 P\n-6726 B\n-6486 R\n-4496 P\n-4191 P\n-772 B\n-258 R\n-194 P\n1035 R\n2297 P\n4816 B\n5779 R\n9342 B\n9713 B\n", "output": "25088\n"}, {"input": "15\n-9518 R\n-6858 P\n-6726 B\n-6486 R\n-4496 P\n-4191 P\n-772 B\n-258 R\n-194 P\n1035 R\n2297 P\n4816 B\n5779 R\n9342 B\n9713 B\n", "output":... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nBlake is a CEO of a large company called \"Blake Technologies\". He loves his company very much and he thinks... | [{"input": "25\n12 30 47 109 81 124 80 33 38 48 29 78 96 48 96 27 80 77 102 65 80 113 31 194 35\n25 64 177 13 12 6 111 80 85 16 61 119 23 65 73 65 20 95 124 18 28 79 125 106 116\n", "output": "510\n"}, {"input": "25\n12 30 47 109 81 124 80 33 38 48 29 78 96 48 96 27 80 77 102 65 80 113 31 194 35\n25 64 177 13 12 6 111 ... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representat... | [{"input": "1000\n", "output": "YES\n"}, {"input": "477\n", "output": "YES\n"}, {"input": "124\n", "output": "YES\n"}, {"input": "480\n", "output": "YES\n"}, {"input": "141\n", "output": "YES\n"}, {"input": "882\n", "output": "YES\n"}, {"input": "799\n", "output": "YES\n"}, {"input": "444\n", "output": "YES\n"}, {"inpu... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nLet's introduce the designation <image>, where x is a string, n is a positive integer and operation \" + \" i... | [{"input": "10000000 10000000\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n", "output": "1\n"}, {"input": "10000000 1\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nYour task is to create a new implementation of `modpow` so that it computes `(x^y)%n` for large `y`. The prob... | [{"input": "31\n902938423012\n1023", "output": "[961]", "fn_name": "power_mod"}, {"input": "29\n1013293125\n492", "output": "[161]", "fn_name": "power_mod"}, {"input": "13\n81230123\n22", "output": "[19]", "fn_name": "power_mod"}, {"input": "5\n100000000\n19", "output": "[5]", "fn_name": "power_mod"}, {"input": "11\n10... | code_functional |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nAnadi has a set of dominoes. Every domino has two parts, and each part contains some dots. For every $a$ and ... | [{"input": "7 21\n1 2\n1 3\n1 4\n1 5\n1 6\n1 7\n2 3\n2 4\n2 5\n2 6\n2 7\n3 4\n3 5\n3 6\n3 7\n4 5\n4 6\n4 7\n5 6\n5 7\n6 7\n", "output": "16\n"}, {"input": "7 21\n3 5\n7 2\n2 3\n6 5\n5 2\n4 7\n2 6\n2 4\n6 7\n5 1\n1 4\n4 5\n5 7\n4 6\n3 1\n1 2\n3 4\n7 1\n3 7\n6 1\n3 6\n", "output": "16\n"}, {"input": "7 21\n3 5\n7 2\n2 3\... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nHow many integer sequences A_1,A_2,\\ldots,A_N of length N satisfy all of the following conditions?\n - 0 \\l... | [{"input": "1000000\n", "output": "787616419\n"}, {"input": "260522\n", "output": "765255076\n"}, {"input": "914575\n", "output": "875983450\n"}, {"input": "436426\n", "output": "851976198\n"}, {"input": "979445\n", "output": "664003445\n"}, {"input": "648772\n", "output": "256544986\n"}, {"input": "690081\n", "output"... | code_stdio |
[
{
"content": "You are an expert Python programmer. You will be given a question (problem specification) and will generate a correct Python program that matches the specification and passes all tests.\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\nPrint all strin... | [{"input": "8\nfubfalo\nbuefalo\nbuffamo\nolaffub\nouafflb\nomaffub\nbuffalo\nbuofalf", "output": "buefalo\nbuffalo\nbuffamo\nbuofalf\nfubfalo\nolaffub\nomaffub\nouafflb\n"}, {"input": "8\nfubfalo\nbuefola\nbuffamo\nolaffub\nouafflb\nomaffub\nbuffalo\nbuofalf", "output": "buefola\nbuffalo\nbuffamo\nbuofalf\nfubfalo\nol... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.