messages listlengths 1 1 | ground_truth stringlengths 82 619k | 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\nTakahashi sent a string T consisting of lowercase English letters to Aoki. As a result, Aoki received a strin... | [{"input": "9 atcoder\natoder\natcode\nathqcoder\natcoder\ntacoder\njttcoder\natoder\natceoder\natcoer\n", "output": "6\n1 2 4 7 8 9\n", "testtype": "stdin"}, {"input": "5 ababc\nababc\nbabc\nabacbc\nabdbc\nabbac\n", "output": "4\n1 2 3 4\n", "testtype": "stdin"}, {"input": "1 aoki\ntakahashi\n", "output": "0\n\n", "te... | 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 digits.\nFind the number of square numbers that can be obt... | [{"input": "13\n8694027811503\n", "output": "840\n", "testtype": "stdin"}, {"input": "13\n8603613902475\n", "output": "781\n", "testtype": "stdin"}, {"input": "13\n1739086240590\n", "output": "745\n", "testtype": "stdin"}, {"input": "13\n5938217206146\n", "output": "735\n", "testtype": "stdin"}, {"input": "13\n10287009... | 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 N strings S_1, S_2, \\ldots, S_N consisting of lowercase English letters, and a string T consis... | [{"input": "10 ms\nmkgn\nm\nhlms\nvmsle\nmxsm\nnnzdhi\numsavxlb\nffnsybomr\nyvmm\nnaouel\n", "output": "68\n", "testtype": "stdin"}, {"input": "3 bac\nabba\nbcb\naaca\n", "output": "3\n", "testtype": "stdin"}, {"input": "5 xx\nx\nx\nx\nx\nx\n", "output": "25\n", "testtype": "stdin"}, {"input": "2 abcd\nbc\nad\n", "outp... | 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 is a directed graph with N vertices and M edges. Each edge has two positive integer values: beauty and ... | [{"input": "10 20\n3 4 1 2\n7 9 4 5\n2 4 4 5\n4 5 1 4\n6 9 4 1\n9 10 3 2\n6 10 5 5\n5 6 1 2\n5 6 5 2\n2 3 2 3\n6 10 4 4\n4 6 3 4\n4 8 4 1\n3 5 3 2\n2 4 3 2\n3 5 4 2\n1 5 3 4\n1 2 4 2\n3 7 2 2\n7 8 1 3\n", "output": "1.8333333333333333\n", "testtype": "stdin"}, {"input": "5 7\n1 2 3 6\n1 3 9 5\n2 3 1 5\n2 4 5 3\n2 5 1 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\nKeyence has a culture of addressing everyone with the honorific \"san,\" regardless of their role, age, or po... | [{"input": "Cvrayggwnp Nzijdifyer\n", "output": "Cvrayggwnp san\n", "testtype": "stdin"}, {"input": "Takahashi Chokudai\n", "output": "Takahashi san\n", "testtype": "stdin"}, {"input": "Spdhvuyf Vtvnrdylua\n", "output": "Spdhvuyf san\n", "testtype": "stdin"}, {"input": "Mlvumuaren Excf\n", "output": "Mlvumuaren san\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\nKeyence has N bases worldwide, numbered 1 to N.\r\nBase i has W_i employees, and at 0 o'clock in Coordinated ... | [{"input": "1000\n1000000 9\n1000000 10\n1000000 18\n1000000 10\n1000000 10\n1000000 10\n1000000 9\n1000000 9\n1000000 18\n1000000 18\n1000000 13\n1000000 10\n1000000 9\n1000000 13\n1000000 13\n1000000 10\n1000000 10\n1000000 13\n1000000 18\n1000000 9\n1000000 13\n1000000 9\n1000000 9\n1000000 9\n1000000 13\n1000000 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\nThere are zero or more sensors placed on a grid of H rows and W columns. Let (i, j) denote the square in the ... | [{"input": "5 47\n.#..#..#####..#...#..#####..#...#...###...#####\n.#.#...#.......#.#...#......##..#..#...#..#....\n.##....#####....#....#####..#.#.#..#......#####\n.#.#...#........#....#......#..##..#...#..#....\n.#..#..#####....#....#####..#...#...###...#####\n", "output": "7\n", "testtype": "stdin"}, {"input": "5 6\... | 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 products labeled 1 to N flowing on a conveyor belt.\r\nA Keyence printer is attached to the conve... | [{"input": "2\n1 1\n1000000000000000000 1000000000000000000\n", "output": "2\n", "testtype": "stdin"}, {"input": "10\n4 1\n1 2\n1 4\n3 2\n5 1\n5 1\n4 1\n2 1\n4 1\n2 4\n", "output": "6\n", "testtype": "stdin"}, {"input": "5\n9 3\n9 3\n9 3\n10 1\n9 3\n", "output": "4\n", "testtype": "stdin"}, {"input": "5\n1 1\n1 1\n2 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\nThere are N cities in a certain country.\nYou will travel from your office in city 1 to a destination in city... | [{"input": "5 954257 954213 814214\n0 84251 214529 10017 373342\n84251 0 91926 32336 164457\n214529 91926 0 108914 57762\n10017 32336 108914 0 234705\n373342 164457 57762 234705 0\n", "output": "168604826785\n", "testtype": "stdin"}, {"input": "4 8 5 13\n0 6 2 15\n6 0 3 5\n2 3 0 13\n15 5 13 0\n", "output": "78\n", "tes... | 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 the factory manager of Keyence, you want to monitor several sections on a conveyor belt. There are a total... | [{"input": "100\n65972 86203 11302 64714 43133 26247 84809 50171 63933 70661 70411 63569 60113 80112 13299 70340 46505 99483 37243 66399 43659 27884 62962 70114 50830 3612 96891 29120 18112 87032 53516 51265 62945 59619 90672 77537 89030 95538 68069 80175 68631 61646 58655 76879 2737 52950 10499 83609 40068 77818 53997... | 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 is in a building with 100 floors.\nHe uses the stairs for moving up two floors or less or moving do... | [{"input": "100 97\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "99 96\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "54 56\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "99 96\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "82 84\n", "output": "Yes\n", "testtype": "stdin"}, {"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\nA 326-like number is a three-digit positive integer where the product of the hundreds and tens digits equals ... | [{"input": "320\n", "output": "326\n", "testtype": "stdin"}, {"input": "144\n", "output": "144\n", "testtype": "stdin"}, {"input": "516\n", "output": "600\n", "testtype": "stdin"}, {"input": "919\n", "output": "919\n", "testtype": "stdin"}, {"input": "804\n", "output": "818\n", "testtype": "stdin"}, {"input": "133\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\nTakahashi has placed N gifts on a number line. The i-th gift is placed at coordinate A_i.\nYou will choose a ... | [{"input": "10 998244353\n100000007 0 1755647 998244353 495 1000000000 1755648 503 1755649 998244853\n", "output": "7\n", "testtype": "stdin"}, {"input": "2 1000000000\n0 1000000000\n", "output": "1\n", "testtype": "stdin"}, {"input": "2 1000000000\n1000000000 1\n", "output": "2\n", "testtype": "stdin"}, {"input": "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\nYou are given an integer N and strings R and C of length N consisting of A, B, and C. Solve the following pro... | [{"input": "5\nABCBC\nACAAB\n", "output": "Yes\nAC..B\n.BA.C\nC.BA.\nBA.C.\n..CBA\n", "testtype": "stdin"}, {"input": "5\nAABAC\nAABCA\n", "output": "Yes\n.ABC.\nABC..\nBC..A\n..ABC\nC..AB\n", "testtype": "stdin"}, {"input": "5\nAABAC\nABCAC\n", "output": "Yes\nABC..\n.AB.C\nBC.A.\n..ACB\nC..BA\n", "testtype": "stdin"}... | 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\nAoki, an employee at AtCoder Inc., has his salary for this month determined by an integer N and a sequence A ... | [{"input": "5596\n179800715 643028994 703611941 565850714 721103957 864833752 621201873 328301984 822848607 188015309 155331113 641211642 364949165 598444515 433595150 854140803 556310989 253693345 756996095 786020277 681803147 501132244 235181813 33809815 807486306 511747007 611206964 350910455 613080602 163606151 978... | 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 lowercase English letters.\r\nIf there are any adjacent oc... | [{"input": "100\nfdcjjiaeadkjehhdgikejgjdgbceiifhekjedccgcchbiibdhijbcgjkhkkcggbbadecgihhbjghdaiejfehkcefkgkckgageeac\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "100\nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbba\n", "output": "Yes\n", "testtype": "stdi... | 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 integer B.\nIf there exists a positive integer A such that A^A = B, print its value; otherwi... | [{"input": "958951173370198630\n", "output": "-1\n", "testtype": "stdin"}, {"input": "106283256471036324\n", "output": "-1\n", "testtype": "stdin"}, {"input": "839819375950780915\n", "output": "-1\n", "testtype": "stdin"}, {"input": "691581335810983791\n", "output": "-1\n", "testtype": "stdin"}, {"input": "709173818026... | 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 is a 9\\times 9 grid A, where each cell contains an integer between 1 and 9, inclusive.\nSpecifically, ... | [{"input": "1 2 3 4 5 6 7 8 9\n4 5 6 7 8 9 1 2 3\n7 8 9 1 2 3 4 5 6\n2 3 4 5 6 7 8 9 1\n5 6 7 8 9 1 2 3 4\n8 9 1 2 3 4 5 6 7\n3 4 5 6 7 8 9 1 2\n6 7 8 9 1 2 3 4 5\n9 1 2 3 4 5 6 7 8\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "3 5 8 4 7 2 9 1 6\n6 4 1 5 9 8 3 7 2\n2 7 9 6 3 1 8 4 5\n9 6 7 2 1 5 4 8 3\n8 1 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\nA pair of sequences of length M consisting of positive integers at most N, (S, T) = ((S_1, S_2, \\dots, S_M),... | [{"input": "7 8\n1 6 2 7 5 4 2 2\n3 2 7 2 1 2 3 3\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "3 3\n1 2 3\n2 3 1\n", "output": "No\n", "testtype": "stdin"}, {"input": "4 3\n2 3 4\n3 4 2\n", "output": "No\n", "testtype": "stdin"}, {"input": "3 2\n1 2\n2 3\n", "output": "Yes\n", "testtype": "stdin"}, {"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 participated in N contests and earned a performance P_i in the i-th contest.\nHe wants to choose so... | [{"input": "5000\n5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 50... | 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 is a programming contest with N problems. For each i = 1, 2, \\ldots, N, the score for the i-th problem... | [{"input": "8 675\n675 675 675 675 675 675 675 675\n", "output": "5400\n", "testtype": "stdin"}, {"input": "8 648\n157 473 296 301 398 511 435 163\n", "output": "2734\n", "testtype": "stdin"}, {"input": "8 269\n552 412 669 456 400 293 275 207\n", "output": "207\n", "testtype": "stdin"}, {"input": "8 300\n568 655 325 28... | 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\nAtCoder Kingdom uses a calendar whose year has N months.\nMonth i (1\\leq i\\leq N) has D _ i days, from day ... | [{"input": "100\n100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100... | 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 = S_1S_2\\ldots S_N of length N consisting of lowercase English letters.\nAdditional... | [{"input": "11 4\nmississippi\n3 9\n4 10\n4 6\n7 7\n", "output": "2\n2\n0\n0\n", "testtype": "stdin"}, {"input": "5 1\naaaaa\n1 5\n", "output": "4\n", "testtype": "stdin"}] | 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 three different characters: A, B, and C.\nAs long as S contains the st... | [{"input": "ACBBBBCBAABABABABBABBCBCBACACCBBACBBAACACCBAAACCCCACBCBBABABAABCACAACBBCCCCBBAACBBACCBACBCBAABACBCBABBCACCACBBABBCCCAABABBCBCCBCCBCCBACBABBBBBACABAABACABCABBCAABACCACABBCBBBABCAACCBCCBBBCCABCBBCCBCCBBBCABBCABBBACAACBCAACCBBABBBABCACCBCBABABBCBBCABCBCCABACBBCCAACAAAACCAACCBBCBAACBBBACACCABBBCCAABACBCACCCBABB... | 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 weighted simple connected undirected graph with N vertices and M edges, where vertices are nu... | [{"input": "8 28 936294041850197\n1 2 473294720906780\n1 3 743030800139244\n1 4 709363019414774\n1 5 383643612490312\n1 6 557102781022861\n1 7 623179288538138\n1 8 739618599410809\n2 3 857687812294404\n2 4 893923168139714\n2 5 581822471860662\n2 6 740549363586558\n2 7 307226438833222\n2 8 447399029952998\n3 4 636318083... | 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 uppercase English letters. Separate each character of S with a space a... | [{"input": "MRFZDYAJTGIQVLVNYBVSOCHZDOIAFFZEUBNHDRSRCTMYONZIQCPRFWTN\n", "output": "M R F Z D Y A J T G I Q V L V N Y B V S O C H Z D O I A F F Z E U B N H D R S R C T M Y O N Z I Q C P R F W T N\n", "testtype": "stdin"}, {"input": "LWGPDEWHFRJFKMISFBALUMBRPLJNCNZNVDNXFSBEHOPRMWX\n", "output": "L W G P D E W H F R J F ... | 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 N integers A_1, A_2, \\ldots, A_N. Find the largest among those integers that are not the large... | [{"input": "53\n64 36 98 64 64 98 89 98 98 98 89 89 64 98 64 98 98 36 89 36 36 36 89 36 64 98 64 64 64 89 89 64 64 36 36 89 64 98 36 89 36 36 98 64 64 64 98 36 89 64 64 98 89\n", "output": "89\n", "testtype": "stdin"}, {"input": "53\n93 85 85 57 93 71 57 71 93 24 71 57 93 85 57 57 71 85 85 93 93 24 71 93 93 71 57 85 93... | 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 lowercase English letters.\nFind the number of non-empty s... | [{"input": "60522\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx... | 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 is an election to choose one winner from N candidates with candidate numbers 1, 2, \\ldots, N, and ther... | [{"input": "100 5\n100 90 80 70 60\n", "output": "100\n90\n80\n70\n60\n", "testtype": "stdin"}, {"input": "9 8\n8 8 2 2 8 8 2 2\n", "output": "8\n8\n8\n2\n8\n8\n8\n2\n", "testtype": "stdin"}, {"input": "3 7\n1 2 2 3 1 3 3\n", "output": "1\n1\n2\n2\n1\n1\n3\n", "testtype": "stdin"}] | 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 two strings: S, which consists of uppercase English letters and has length N, and T, which also... | [{"input": "9168 2\nZDDZDZDZDZDDZDZDDZDZDDZDDDZDDZDZDDZZDDDDZDZDZDZDZDZDDDZDZDDZDZDDDDZDDZZDZZZZDZZDZDDZDDDZDZDZDZDZZZZDZZZDZDZDDZDZDDZDZDDDZDZDZZZDZDZDZDZZDZDZDDDZDZDZDZDZDZDZDZZDZDZDDDZZZDDZZDDZDZDZZDZDZDDZDZZDZDZDZDZDZDZDDZDZZDDZDZDZDZZDDDZDDDZZDDDDZDDDZZDZDDDZZZZDZZZDDZDZZZDDZZDDZDZDZZDDDZDDZDDZDZDZDDZDZZDZZDZZDDZD... | 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 boxes numbered 1, 2, \\ldots, N. Initially, box i contains one ball of color C_i.\nYou are given ... | [{"input": "6 5\n1 1 1 2 2 3\n1 2\n6 4\n5 1\n3 6\n4 6\n", "output": "1\n2\n1\n1\n3\n", "testtype": "stdin"}, {"input": "5 3\n2 4 2 4 2\n3 1\n2 5\n3 2\n", "output": "1\n2\n0\n", "testtype": "stdin"}] | 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\nN people labeled 1,2,\\dots,N took an exam, and person i scored A_i points.\r\nOnly those who scored at least... | [{"input": "100 764\n68 658 406 462 387 386 549 426 705 470 381 620 573 231 364 330 450 520 980 710 920 729 986 359 373 513 509 110 311 145 63 554 513 654 676 875 369 748 19 263 513 39 124 737 591 388 146 897 787 287 459 329 215 141 57 25 734 384 559 243 435 663 528 514 494 298 838 258 391 499 710 887 942 758 449 404 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\nYou are given an integer sequence A=(A_1,A_2,\\ldots,A_N) of length N and integers L and R such that L\\leq R... | [{"input": "5 4 7\n3 1 4 9 7\n", "output": "4 4 4 7 7\n", "testtype": "stdin"}, {"input": "3 10 10\n11 10 9\n", "output": "10 10 10\n", "testtype": "stdin"}] | 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 positive integer D.\nFind the minimum value of |x^2+y^2-D| for non-negative integers x and y.... | [{"input": "1997637429155\n", "output": "54\n", "testtype": "stdin"}, {"input": "1984112788394\n", "output": "61\n", "testtype": "stdin"}, {"input": "1817480166643\n", "output": "62\n", "testtype": "stdin"}, {"input": "1260158260522\n", "output": "2\n", "testtype": "stdin"}, {"input": "1116602436426\n", "output": "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\nYou are given an N \\times N grid. Let (i,j) denote the cell in the i-th row from the top and the j-th column... | [{"input": "15\nxooxxooooxxxoox\noxxoxoxxxoxoxxo\noxxoxoxxxoxoxxx\nooooxooooxxoxxx\noxxoxoxxxoxoxxx\noxxoxoxxxoxoxxo\noxxoxooooxxxoox\nxxxxxxxxxxxxxxx\nxooxxxooxxxooox\noxxoxoxxoxoxxxo\nxxxoxxxxoxoxxoo\nxooxxxooxxoxoxo\nxxxoxxxxoxooxxo\noxxoxoxxoxoxxxo\nxooxxxooxxxooox\n", "output": "2960\n", "testtype": "stdin"}, {"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 given a sequence A=(A_1,A_2,\\dots,A_N) of length N.\r\nRespond to the following Q queries in the ord... | [{"input": "8 5\n2 0 2 2 1 1 2 5\n4 3\n4 4\n6 3\n8 1000000000\n2 1\n", "output": "4\n3\n6\n5\n0\n", "testtype": "stdin"}, {"input": "1 1\n0\n1 1000000000\n", "output": "0\n", "testtype": "stdin"}, {"input": "1 1\n1000000000\n1 0\n", "output": "1\n", "testtype": "stdin"}] | 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 calendar of AtCoder Kingdom, a year consists of M months from month 1 to month M, and each month consi... | [{"input": "36 72\n6789 23 45\n", "output": "6789 23 46\n", "testtype": "stdin"}, {"input": "12 30\n2023 12 30\n", "output": "2024 1 1\n", "testtype": "stdin"}, {"input": "12 30\n2012 6 20\n", "output": "2012 6 21\n", "testtype": "stdin"}, {"input": "99 99\n3314 99 99\n", "output": "3315 1 1\n", "testtype": "stdin"}, {... | 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 supermarket sells egg packs.\nA pack of 6 eggs costs S yen, a pack of 8 eggs costs M yen, and a pack of 12 ... | [{"input": "100 10000 10000 10000\n", "output": "90000\n", "testtype": "stdin"}, {"input": "40 2253 2992 4490\n", "output": "14960\n", "testtype": "stdin"}, {"input": "57 1337 1781 2668\n", "output": "12903\n", "testtype": "stdin"}, {"input": "55 1748 2346 3525\n", "output": "16330\n", "testtype": "stdin"}, {"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\nYou are given a sequence A=(A_1,\\ldots,A_N) of length N.\nFor each i=1,\\ldots,N, solve the following proble... | [{"input": "50\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\n", "output": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n", "testtype": "stdin"}, {"input": "10\n31 42 59 26 53 58 97 93 23 54\n", "output": "456... | 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 is a grid with 10^9 by 10^9 squares. Let (i, j) denote the square at the (i + 1)-th row from the top an... | [{"input": "10 5\nBBBWWWBBBW\nWWWWWBBBWB\nBBBWBBWBBB\nBBBWWBWWWW\nWWWWBWBWBW\nWBBWBWBBBB\nWWBBBWWBWB\nWBWBWWBBBB\nWBWBWBBWWW\nWWWBWWBWWB\n5 21 21 93\n35 35 70 43\n55 72 61 84\n36 33 46 95\n0 0 999999999 999999999\n", "output": "621\n167\n44\n344\n500000000000000000\n", "testtype": "stdin"}, {"input": "1 1\nB\n0 0 99999... | 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\nAtCoder cafeteria sells meals consisting of a main dish and a side dish.\r\nThere are N types of main dishes,... | [{"input": "917 231 4692\n881130663 806405364 855399219 945169499 2367096 607830970 365433553 795083007 5951398 309723688 110055448 667953593 910924165 413598120 487751110 196639646 671189099 508812085 794745756 336306545 249704670 105322777 271444166 770374871 37678868 610670157 936544359 416730828 699029682 149490686... | 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\nAtCoder Inc. sells merchandise through its online shop.\nTakahashi has decided to purchase N types of product... | [{"input": "100 10000 10000\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000 100\n10000... | 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\nAtCoder Inc. sells glasses and mugs.\nTakahashi has a glass with a capacity of G milliliters and a mug with a... | [{"input": "5 300 500\n", "output": "200 500\n", "testtype": "stdin"}, {"input": "100 999 1000\n", "output": "25 0\n", "testtype": "stdin"}, {"input": "98 31 713\n", "output": "31 651\n", "testtype": "stdin"}, {"input": "94 21 357\n", "output": "21 105\n", "testtype": "stdin"}, {"input": "90 24 480\n", "output": "24 38... | 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\nAtCoder Inc. sells T-shirts with its logo.\nYou are given Takahashi's schedule for N days as a string S of le... | [{"input": "1000 1\n222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222... | 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 two grids, A and B, each with H rows and W columns.\nFor each pair of integers (i, j) satisfyin... | [{"input": "5 5\n925234815 195202420 985293702 925234815 584979839\n985293702 925234815 925234815 195202420 973719359\n720510553 985293702 973719359 584979839 720510553\n797707590 643037195 985293702 720510553 925234815\n195202420 720510553 797707590 195202420 720510553\n195202420 195202420 720510553 797707590 72051055... | 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 integer N between 1 and 9, inclusive, as input.\nConcatenate N copies of the digit N and pri... | [{"input": "9\n", "output": "999999999\n", "testtype": "stdin"}, {"input": "8\n", "output": "88888888\n", "testtype": "stdin"}, {"input": "7\n", "output": "7777777\n", "testtype": "stdin"}, {"input": "6\n", "output": "666666\n", "testtype": "stdin"}, {"input": "5\n", "output": "55555\n", "testtype": "stdin"}, {"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\nA regular pentagon P is shown in the figure below.\n\nDetermine whether the length of the line segment connec... | [{"input": "AC\nEC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "BD\nBD\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "DE\nED\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "EC\nCA\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "AE\nBC\n", "output": "Yes\n", "testtype": "stdin"}, {"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\nA repunit is an integer whose digits are all 1 in decimal representation. The repunits in ascending order are... | [{"input": "333\n", "output": "112222222233\n", "testtype": "stdin"}, {"input": "324\n", "output": "111222222233\n", "testtype": "stdin"}, {"input": "288\n", "output": "111111111123\n", "testtype": "stdin"}, {"input": "258\n", "output": "11222222233\n", "testtype": "stdin"}, {"input": "201\n", "output": "1133333333\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\nYou are given a tree with N vertices: vertex 1, vertex 2, \\ldots, vertex N.\r\nThe i-th edge (1\\leq i\\lt N... | [{"input": "8569\n5786 8251\n504 6613\n3532 4478\n3501 5723\n5357 8298\n79 6902\n1543 6738\n6514 8282\n1409 5647\n3021 4117\n355 4732\n3906 7762\n1051 7701\n991 3636\n875 1737\n4260 5285\n360 8057\n1660 3812\n7958 8269\n5495 5842\n2539 6077\n3127 4635\n2321 6200\n5088 8261\n2172 8413\n2010 6055\n4390 4837\n638 6497\n65... | 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 will embark on an adventure.\nDuring the adventure, N events will occur.\r\nThe i-th event (1\\leq ... | [{"input": "11648\n1 10526\n1 321\n1 822\n1 5727\n1 5858\n1 9993\n1 7005\n2 10526\n1 8233\n1 2679\n1 9846\n1 3754\n1 4023\n2 321\n1 6581\n1 10892\n1 4023\n1 10526\n1 5749\n1 7142\n2 6581\n1 8559\n1 664\n1 3972\n1 5335\n1 4577\n1 117\n1 5702\n1 6906\n1 495\n1 8912\n1 5143\n1 8751\n1 912\n2 912\n1 8912\n1 9092\n1 2966\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\nTakahashi, a young baseball enthusiast, has been a very good boy this year, so Santa has decided to give him ... | [{"input": "334 343\n", "output": "Glove\n", "testtype": "stdin"}, {"input": "522 575\n", "output": "Glove\n", "testtype": "stdin"}, {"input": "447 629\n", "output": "Glove\n", "testtype": "stdin"}, {"input": "431 580\n", "output": "Glove\n", "testtype": "stdin"}, {"input": "1 1000\n", "output": "Glove\n", "testtype": ... | 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 is a road that stretches infinitely to the east and west, and the coordinate of a point located x meter... | [{"input": "1000000000000000000 1 -1000000000000000000 1000000000000000000\n", "output": "2000000000000000001\n", "testtype": "stdin"}, {"input": "1000000000000000000 1000000000 -1000000000000000000 1000000000000000000\n", "output": "2000000001\n", "testtype": "stdin"}, {"input": "-553548222810233536 554374432 -2493284... | 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 N pairs of socks, and the i-th pair consists of two socks of color i.\nOne day, after organizin... | [{"input": "199992 99\n2312 5129 5563 5737 6214 6303 9248 9570 10067 11578 17759 20768 20814 21285 23469 24318 25781 26398 27318 28249 31784 36164 48064 49775 54783 57174 57562 57752 59179 59226 61158 61640 61645 63167 63496 64667 67836 70196 70453 70796 72485 73444 75508 76603 76672 77736 87387 88618 89098 89141 90269... | 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 sleighs numbered 1,2,\\ldots, N.\nR_i reindeer are required to pull sleigh i.\nAdditionally, each... | [{"input": "2 2\n1000000000 1000000000\n200000000000000\n1\n", "output": "2\n0\n", "testtype": "stdin"}, {"input": "6 6\n1 2 3 4 5 6\n1\n2\n3\n4\n5\n6\n", "output": "1\n1\n2\n2\n2\n3\n", "testtype": "stdin"}, {"input": "4 3\n5 3 11 8\n16\n7\n1000\n", "output": "3\n1\n4\n", "testtype": "stdin"}] | 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 problem has a similar setting to Problem G. Differences in the problem statement are indicated in red.\n... | [{"input": "4 5\n..#..\n.###.\n#####\n..#..\n", "output": "598946613\n", "testtype": "stdin"}, {"input": "3 4\n#...\n.#.#\n..##\n", "output": "285212675\n", "testtype": "stdin"}, {"input": "3 3\n##.\n#.#\n#..\n", "output": "499122178\n", "testtype": "stdin"}] | 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 lowercase English letters and digits.\nS is guaranteed to end with 202... | [{"input": "16tcfyt22023uz2023023o3xxrol720237eh630tp12023duk202322022023ecn2020233eyxlfn20232332023nz20233r2023\n", "output": "16tcfyt22023uz2023023o3xxrol720237eh630tp12023duk202322022023ecn2020233eyxlfn20232332023nz20233r2024\n", "testtype": "stdin"}, {"input": "1d7c6jm9202302023tpgjabxu202202320232023tq227920232202... | 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 integer N.\nPrint all triples of non-negative integers (x,y,z) such that x+y+z\\leq N in asc... | [{"input": "21\n", "output": "0 0 0\n0 0 1\n0 0 2\n0 0 3\n0 0 4\n0 0 5\n0 0 6\n0 0 7\n0 0 8\n0 0 9\n0 0 10\n0 0 11\n0 0 12\n0 0 13\n0 0 14\n0 0 15\n0 0 16\n0 0 17\n0 0 18\n0 0 19\n0 0 20\n0 0 21\n0 1 0\n0 1 1\n0 1 2\n0 1 3\n0 1 4\n0 1 5\n0 1 6\n0 1 7\n0 1 8\n0 1 9\n0 1 10\n0 1 11\n0 1 12\n0 1 13\n0 1 14\n0 1 15\n0 1 16... | 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 created a game where the player controls a dragon on a coordinate plane.\nThe dragon consists o... | [{"input": "5 9\n2 3\n1 U\n2 3\n1 R\n1 D\n2 3\n1 L\n2 1\n2 5\n", "output": "3 0\n2 0\n1 1\n1 0\n1 0\n", "testtype": "stdin"}, {"input": "2 1\n2 1\n", "output": "1 0\n", "testtype": "stdin"}] | 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 is a grid with N rows and N columns, where N is an odd number at most 45.\nLet (i,j) denote the cell at... | [{"input": "45\n", "output": "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\n176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216... | 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\nFor a positive integer X, the Dragon String of level X is a string of length (X+3) formed by one L, X occurre... | [{"input": "2024\n", "output": "Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo... | 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\nFor a positive integer X, let \\text{ctz}(X) be the (maximal) number of consecutive zeros at the end of the b... | [{"input": "536870912\n", "output": "29\n", "testtype": "stdin"}, {"input": "486539264\n", "output": "24\n", "testtype": "stdin"}, {"input": "352321536\n", "output": "24\n", "testtype": "stdin"}, {"input": "469762048\n", "output": "26\n", "testtype": "stdin"}, {"input": "469762048\n", "output": "26\n", "testtype": "std... | 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 non-negative integer n is called a good integer when it satisfies the following condition:\n\n- All digits ... | [{"input": "1000000000000\n", "output": "224680888888888888\n", "testtype": "stdin"}, {"input": "773717434406\n", "output": "200268066260800220\n", "testtype": "stdin"}, {"input": "728962537208\n", "output": "86840806804284624\n", "testtype": "stdin"}, {"input": "674860790686\n", "output": "84048206660600440\n", "testt... | 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\nFor a positive integer k, the Pyramid Sequence of size k is a sequence of length (2k-1) where the terms of th... | [{"input": "1\n1000000000\n", "output": "1\n", "testtype": "stdin"}, {"input": "5\n2 2 3 1 1\n", "output": "2\n", "testtype": "stdin"}, {"input": "5\n1 2 3 4 5\n", "output": "3\n", "testtype": "stdin"}] | 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\nTeam Takahashi and Team Aoki played N matches.\r\nIn the i-th match (1\\leq i\\leq N), Team Takahashi scored ... | [{"input": "100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 100\n100 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\nWe define Extended A strings, Extended B strings, Extended C strings, and Extended ABC strings as follows:\n\... | [{"input": "AAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"inp... | 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 people standing in a line: person 1, person 2, \\ldots, person N.\nYou are given the arrangement ... | [{"input": "30\n3 25 20 6 18 12 26 1 29 -1 21 17 23 9 8 30 10 15 22 27 4 13 5 11 16 24 28 2 19 7\n", "output": "10 17 12 6 4 21 11 24 26 7 30 16 25 2 28 27 20 3 1 8 15 18 5 23 13 22 19 29 9 14\n", "testtype": "stdin"}, {"input": "10\n-1 1 2 3 4 5 6 7 8 9\n", "output": "1 2 3 4 5 6 7 8 9 10\n", "testtype": "stdin"}, {"i... | 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 is a grid with H rows and W columns. Let (i, j) denote the cell at the i-th row from the top and the j-... | [{"input": "10 12 6\n......xo.o..\nx...x.....o.\nx...........\n..o...x.....\n.....oo.....\no.........x.\nox.oox.xx..x\n....o...oox.\n..o.....x.x.\n...o........\n", "output": "3\n", "testtype": "stdin"}, {"input": "3 4 3\nxo.x\n..o.\nxx.o\n", "output": "2\n", "testtype": "stdin"}, {"input": "3 3 3\nx..\n..x\n.x.\n", "ou... | 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 (a type of problem where your program interacts with the judge program through... | [{"input": "100 100\n", "output": "7\n50 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 \n50 3 4 7 8 11 12 15 16 19 20 23 24 27 28 31 32 35 36 39 40 43 44 47 48 51 52 55 56 59 60 63 64 67 68 71 72 75 76 79 80 83 84 87 88... | 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 non-empty string S consisting of uppercase and lowercase English letters. Determine whether t... | [{"input": "Vjfwelamvfdkrgeioigerjwqlftfesfjsdamfoewjfweaikojfojweafweaklmvdfmavklfdbmklsdfkbhfweioahedsfnogheri\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n", "output": "Yes\n", "testtype": "stdin"}, {"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\nYou are given a string S consisting of lowercase English letters. Find the character that appears most freque... | [{"input": "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt... | 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 refrigerator has N kinds of ingredients. Let us call them ingredient 1, \\dots, ingredient N. You have Q... | [{"input": "10\n701910 590516 981811 901612 603743 652786 894972 585030 776541 744428\n333367 186557 114760 17378 489256 308866 168351 145357 67695 243164\n124670 312531 329173 40627 16657 144765 166427 385598 138073 357643\n", "output": "2\n", "testtype": "stdin"}, {"input": "10\n1000000 1000000 1000000 1000000 100000... | 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 AtCoder Archipelago consists of N islands connected by N bridges.\nThe islands are numbered from 1 to N, ... | [{"input": "200000 7101\n141353 41356 141361 41363 141369 41378 141373 41366 141361 41369 141359 41364 141373 41383 141381 41378 141373 41378 141384 41383 141385 41383 141374 41378 141373 41375 141381 41372 141367 41357 141365 41361 141354 41349 141358 41362 141360 41368 141362 41357 141350 41352 141356 41353 141343 41... | 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 2N points placed at equal intervals on a circle, numbered 1 to 2N in a clockwise direction starting... | [{"input": "4\n2 4\n3 7\n8 6\n5 1\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "3\n1 3\n4 2\n5 6\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "3\n6 1\n4 3\n2 5\n", "output": "No\n", "testtype": "stdin"}, {"input": "2\n4 2\n3 1\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "2\n3 4\n2 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\nThere is a weighted simple directed graph with N vertices and M edges.\r\nThe vertices are numbered 1 to N, a... | [{"input": "20 380\n12 11 886655\n13 2 886651\n17 3 886650\n12 13 886637\n17 11 886654\n17 16 886643\n18 5 886650\n8 19 886653\n10 2 886656\n13 1 886639\n13 14 886645\n5 14 886653\n1 20 886652\n14 15 886650\n20 8 886650\n15 3 886639\n9 18 886655\n16 5 886651\n18 17 886656\n9 3 886644\n2 11 886644\n14 12 886644\n19 10 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 are given a string S consisting of lowercase English letters and the character ..\r\nPrint the last subst... | [{"input": ".hrsqdwdbcrbuwkxorlklkagwbrubgdscupnvlhchwgasicljgxyovtxqfeydptcypujzavnedquliepcqscjqheqjhwpkmrafeb\n", "output": "hrsqdwdbcrbuwkxorlklkagwbrubgdscupnvlhchwgasicljgxyovtxqfeydptcypujzavnedquliepcqscjqheqjhwpkmrafeb\n", "testtype": "stdin"}, {"input": "m.bembokenqraaqorzitwwutdfvgwwabfsjdmapjimquvhjrivgaspz... | 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 is a grid with H rows and W columns; initially, all cells are painted white. Let (i, j) denote the cell... | [{"input": "63 64 379\n", "output": ".#.#.........................................................#.#\n##.##........................................................#..\n##..........................................................#..#\n#####.#....................................................#...#\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 bus is in operation. The number of passengers on the bus is always a non-negative integer.\nAt some point i... | [{"input": "4\n-1 1000000000 1000000000 1000000000\n", "output": "3000000000\n", "testtype": "stdin"}, {"input": "4\n3 -5 7 -4\n", "output": "3\n", "testtype": "stdin"}, {"input": "5\n0 0 0 0 0\n", "output": "0\n", "testtype": "stdin"}] | 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 is an N \\times N grid, where each cell is either empty or contains an obstacle. Let (i, j) denote the ... | [{"input": "60\n.#.#..#.#..#....#.#..#..#...#.#..##.....#..#.#.#.#......#.#.\n...#.#....#.###...#.#..#..#.#...#..#.#.#.#......#..#.##..#..\n#.#....#.##...#.#.....#..#....#..#...#....#.#.#..#.#.#.##..#\n#...##.#...##....##.#.##..##.#.##..##.##.#..#..##...#..#..#.\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\nPrint an arithmetic sequence with first term A, last term B, and common difference D.\nYou are only given inp... | [{"input": "1 100 1\n", "output": "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 ... | 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 have an empty sequence A. There are Q queries given, and you need to process them in the order they are g... | [{"input": "100\n1 158260522\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 1\n2 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\nThere is a single integer N written on a blackboard.\r\nTakahashi will repeat the following series of operati... | [{"input": "100000000000000000\n", "output": "5655884811924144128\n", "testtype": "stdin"}, {"input": "94260044915063399\n", "output": "5322967416997821270\n", "testtype": "stdin"}, {"input": "24016955048482283\n", "output": "1308920685696043880\n", "testtype": "stdin"}, {"input": "28044290644237898\n", "output": "1534... | 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 is playing a game.\nThe game consists of N stages numbered 1,2,\\ldots,N. Initially, only stage 1 c... | [{"input": "100\n536870914 1 51\n268435458 1 52\n134217730 1 53\n67108866 1 54\n33554434 1 55\n16777218 1 56\n8388610 1 57\n4194306 1 58\n2097154 1 59\n1048578 1 60\n524290 1 61\n262146 1 62\n131074 1 63\n65538 1 64\n32770 1 65\n16386 1 66\n8194 1 67\n4098 1 68\n2050 1 69\n1026 1 70\n514 1 71\n258 1 72\n130 1 73\n66 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\nThere are N boxes numbered 0 to N-1. Initially, box i contains A_i balls.\nTakahashi will perform the followi... | [{"input": "256 22008\n326396802 80709988 391581388 781687584 56703288 212640016 535975066 975537812 264359087 26679346 329162798 66680288 468809756 947236373 925516945 753956332 43767661 953738435 226914661 575386286 220846496 966161410 371739228 10335765 505778157 324703431 809187316 468179161 319951289 567351287 289... | 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 a positive integer N, print a string of N zeros and N+1 ones where 0 and 1 alternate.\n\nInput\n\nThe i... | [{"input": "100\n", "output": "101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101\n", "testtype": "stdin"}, {"input": "99\n", "output": "10101010101010101010101010101010... | 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 countries numbered 1 to N. For each i = 1, 2, \\ldots, N, Takahashi has A_i units of the currency... | [{"input": "10\n32 6 46 9 37 8 33 14 31 5\n5 5\n3 1\n4 3\n2 2\n3 2\n3 2\n4 4\n3 3\n3 1\n", "output": "45\n", "testtype": "stdin"}, {"input": "2\n1000000000 1000000000\n1000000000 1\n", "output": "1000000001\n", "testtype": "stdin"}, {"input": "4\n5 7 0 3\n2 2\n4 3\n5 2\n", "output": "5\n", "testtype": "stdin"}] | 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 is a grid with H rows and W columns.\nEach cell of the grid is land or sea, which is represented by H s... | [{"input": "272 259 386\nUURULDRRLRLURRDUUDDLDUURDLRDLLRRUUULDDUUUDUDDDULRUDLLLLUDLRRRLLRLLLRLULULLDUDUUDRUDUURRLRDRUULDLRURRLRDULLRRDLUDDLULLUULRLULLLLRLDLULLLRRRDURRLLLLLRUDDLDLURRLRUDLRULDRUUDRRRLRDUDURRRUDRDRRUDURLRRULRRDULLRRRDLRUUDDDRRUDDRRRLLRURDUDRDLURLLRRUDDLDRRRLRRRUUULRDULRRURDRUDRDURLDURLLULUUDURRRLLUDRRLRU... | 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 three positive integers N, M, and K. Here, N and M are different.\nPrint the K-th smallest posi... | [{"input": "100000000 99999999 10000000000\n", "output": "500000002500000000\n", "testtype": "stdin"}, {"input": "50000000 100000000 10000000000\n", "output": "999999999950000000\n", "testtype": "stdin"}, {"input": "66666666 99999999 10000000000\n", "output": "666666660000000000\n", "testtype": "stdin"}, {"input": "999... | 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 string consisting of 0 and 1 is called a good string if two consecutive characters in the string are always... | [{"input": "5 6\n10100\n2 1 3\n2 1 5\n1 1 4\n2 1 5\n1 3 3\n2 2 4\n", "output": "Yes\nNo\nYes\nNo\n", "testtype": "stdin"}, {"input": "1 2\n1\n1 1 1\n2 1 1\n", "output": "Yes\n", "testtype": "stdin"}] | 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 simple undirected graph consisting of N vertices and M edges.\nFor i = 1, 2, \\ldots, M, the ... | [{"input": "153 5000\n45 64\n148 153\n5 106\n143 41\n115 29\n149 85\n7 141\n30 12\n121 83\n96 9\n97 47\n101 116\n61 60\n136 41\n118 104\n138 140\n104 65\n124 125\n133 22\n56 99\n44 99\n46 109\n101 36\n14 71\n124 107\n52 61\n59 117\n110 151\n3 49\n54 36\n17 101\n75 106\n14 35\n89 51\n127 20\n77 23\n152 86\n12 143\n18 67... | 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 lowercase English letters. The length of S is between 3 and 100, inclu... | [{"input": "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkki\n", "output": "100\n", "testtype": "stdin"}, {"input": "ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppplpppppppppppppppppppppppppppppppp\n", "output": "68\n", "testtype": "stdin"}, {"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\nThere are N people standing in a line. The person standing at the i-th position from the front is person P_i.... | [{"input": "100\n38 5 94 35 72 56 50 10 84 17 62 48 32 86 7 90 12 2 68 49 88 19 15 1 59 58 23 28 54 100 97 85 40 74 21 29 87 99 91 22 60 24 70 8 69 52 25 11 98 61 65 16 71 45 44 92 37 67 95 26 42 30 63 81 51 66 3 47 75 39 27 55 89 14 79 82 6 18 96 93 9 34 76 64 77 31 73 36 46 53 57 4 83 13 20 43 41 80 78 33\n100\n8 16\... | 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 lowercase English letters.\nYou will perform an operation ... | [{"input": "41344\neqjtwfwzfacxfdbetzjsntybptzniqaabkzpitldjgnulgvozyfkyqflzzzqdiulttiilljxmvcqvavlopdyghfphqwzwguwgbljjmihyrstjumbwjtmgptfsuwmtvirvzemidunrlolvtedgzcqdpqacuktrdtzmgldcqfujyqztaugkazxtirpyzuohmbthjbrihovhyvpbzfuqbpdbdgqlatkyuhknfgkxzjpqdfxpayanavjvezchueyjpkoujwjqtjpcqhvxnwlaelmgoogoloydmcrcyppvqdlidqpf... | 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 sequence of non-negative integers A=(A_1,\\ldots,A_N) of length N. Find the number of pairs o... | [{"input": "11331\n29802 148575 66678 180605 142429 164510 109626 113014 151382 65032 130860 165250 3809 145644 44362 90097 195044 68492 25739 146146 56559 161560 58304 92459 150727 122439 72793 184328 179554 53255 107956 43915 89235 87543 145456 134957 21921 98354 63103 21907 57240 127204 39318 184062 106352 110202 44... | 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 country of AtCoder, there are N stations: station 1, station 2, \\ldots, station N.\nYou are given M p... | [{"input": "16 20\n4018 9698 2850 3026 8 11\n2310 7571 7732 1862 13 14\n2440 2121 20 1849 11 16\n2560 5115 190 3655 5 16\n1936 6664 39 8822 4 16\n7597 8325 20 7576 12 5\n5396 1088 540 7765 15 1\n3226 88 6988 2504 13 5\n1838 7490 63 4098 8 3\n1456 5042 4 2815 14 7\n3762 6803 5054 6994 10 9\n9526 6001 61 8025 7 8\n5176 6... | 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 two integers A and B, each between 0 and 9, inclusive.\nPrint any integer between 0 and 9, incl... | [{"input": "2 5\n", "output": "2\n", "testtype": "stdin"}, {"input": "0 0\n", "output": "9\n", "testtype": "stdin"}, {"input": "7 1\n", "output": "4\n", "testtype": "stdin"}, {"input": "1 0\n", "output": "2\n", "testtype": "stdin"}, {"input": "2 0\n", "output": "3\n", "testtype": "stdin"}, {"input": "2 1\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\nThere is a simple undirected graph G with N vertices labeled with numbers 1, 2, \\ldots, N.\nYou are given th... | [{"input": "100\n0 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\n1 0 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": "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 positive integer N.\nFind the maximum value of a palindromic cube number not greater than N.\... | [{"input": "1000000000000000000\n", "output": "1331399339931331\n", "testtype": "stdin"}, {"input": "224692506716521945\n", "output": "1331399339931331\n", "testtype": "stdin"}, {"input": "1331399339931331\n", "output": "1331399339931331\n", "testtype": "stdin"}, {"input": "123456789012345\n", "output": "1334996994331\... | 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 is hosting a contest with N players numbered 1 to N. \nThe players will compete for points. Current... | [{"input": "10 10\n7 2620\n9 2620\n8 3375\n1 3375\n6 1395\n5 1395\n6 2923\n10 3375\n9 5929\n5 1225\n", "output": "2\n2\n3\n3\n4\n4\n5\n5\n6\n5\n", "testtype": "stdin"}, {"input": "3 4\n1 10\n3 20\n2 10\n2 10\n", "output": "2\n3\n2\n2\n", "testtype": "stdin"}, {"input": "1 3\n1 3\n1 4\n1 3\n", "output": "1\n1\n1\n", "te... | 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 a coordinate space, we want to place three cubes with a side length of 7 so that the volumes of the region... | [{"input": "343 343 0\n", "output": "Yes\n0 0 0 -1 -1 7 -1 -1 7\n", "testtype": "stdin"}, {"input": "339 210 90\n", "output": "Yes\n0 0 0 -1 -1 4 0 1 1\n", "testtype": "stdin"}, {"input": "359 245 60\n", "output": "Yes\n0 0 0 -1 2 3 -1 2 5\n", "testtype": "stdin"}, {"input": "546 210 21\n", "output": "Yes\n0 0 0 -1 0 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\nYou initially have an empty string S.\r\nAdditionally, there are bags 1, 2, \\dots, N, each containing some s... | [{"input": "dvzkuvxlxwftyrncmtzdkxiefsdrtnnqakqcloizwxrwuamobrjjnzzzxnmwrgembrkoxjouzrsybnzdcoqsemqdscasvplppfzk\n100\n10 rjjnzzzxnm zrsybnzdco zkuvxlxwft wxrwuamobr kxiefsdrtn wrgembrkox dcoqsemqds zdcoqsemqd embrkoxjou obrjjnzzzx\n10 wrgembrkox uamobrjjnz wxrwuamobr uvxlxwftyr cmtzdkxief rwuamobrjj rtnnqakqcl mbrkoxj... | code_stdio |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.